Video decoding methods, video encoding methods, and video data transmission methods.
Patent Information
- Application Number
- VN1202605420
- Authority / Receiving Office
- VN · VN
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2016-10-04
- Filing Date
- 2017-09-29
- Publication Date
- 2026-08-17
AI Technical Summary
The increasing demand for high-resolution and ultra-high-definition video content poses challenges in video signal processing, particularly in efficiently performing intra prediction during encoding and decoding, as existing technologies struggle with effective compression and transmission of high-quality video data, leading to increased costs and storage requirements.
A method and device for performing intra prediction using weighted prediction with multiple reference samples, where an offset is applied to prediction samples based on the intra prediction mode and distance from the prediction sample, allowing for efficient encoding and decoding of video signals by correcting prediction samples generated through intra prediction.
This approach improves encoding and decoding efficiency by accurately predicting pixel values, reducing data transmission and storage costs, and enhancing the quality of high-resolution and ultra-high-definition video content.
Smart Images

Figure VN1202605420_0
Abstract
Description
Video signal processing method and device The present invention relates to a method and device for processing a video signal. 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 application fields. As the image data becomes higher in resolution and quality, the amount of data increases relatively compared to existing image data. Therefore, when transmitting the image data using media such as existing wired and wireless broadband lines or storing it using existing storage media, the transmission and storage costs increase. In order to solve these problems that occur as image data becomes higher in resolution and quality, high-efficiency image compression technologies can be utilized. There are various technologies such as inter-picture prediction technology that predicts pixel values included in the current picture from pictures before or after the current picture as an image compression technology, intra-picture prediction technology that predicts pixel values included in the current picture using pixel information in the current picture, and entropy coding technology that assigns short codes to values with high appearance frequency and long codes to values with low appearance frequency, etc., and using these image compression technologies, image data can be effectively compressed and transmitted or stored. Meanwhile, as the demand for high-resolution images increases, the demand for stereoscopic image content as a new image service is also increasing. Discussions are underway on video compression technology to effectively provide high-resolution and ultra-high-resolution stereoscopic image content. The purpose of the present invention is to provide a method and device capable of efficiently performing intra prediction on a block to be encoded / decoded when encoding / decoding a video signal. The purpose of the present invention is to provide a method and device for performing intra prediction through weighted prediction using multiple reference samples in encoding / decoding a video signal. The purpose of the present invention is to provide a method and device for correcting prediction samples generated through intra prediction using an offset when encoding / decoding a video signal. The purpose of the present invention is to provide a method and device for correcting a prediction sample generated through intra prediction using an offset when encoding / decoding a video signal, and using different offsets in predetermined units. The technical problems to be achieved in the present invention are not limited to the technical problems mentioned above, and other technical problems not mentioned will be clearly understood by a person having ordinary skill in the technical field to which the present invention belongs from the description below. A video signal decoding method and device according to the present invention can determine an intra prediction mode of a current block, derive a reference sample from neighboring samples of the current block, obtain a first prediction sample for the current block based on the intra prediction mode and the reference samples, determine an offset for the first prediction sample, and obtain a second prediction sample by applying the offset to the first prediction sample. A video signal encoding method and device according to the present invention can determine an intra prediction mode of a current block, derive a reference sample from neighboring samples of the current block, obtain a first prediction sample for the current block based on the intra prediction mode and the reference samples, determine an offset for the first prediction sample, and obtain a second prediction sample by applying the offset to the first prediction sample. In the video signal encoding / decoding method and device according to the present invention, whether to apply the offset to the first prediction sample can be determined based on the intra prediction mode of the current block. In the video signal encoding / decoding method and device according to the present invention, the offset can be determined based on a weighted sum of the multiple reference samples. In the video signal encoding / decoding method and device according to the present invention, the weight applied to each of the plurality of reference samples can be determined based on the distance from the first prediction sample. In the video signal encoding / decoding method and device according to the present invention, the plurality of reference samples may include a reference sample at a fixed position and a reference sample determined dependently on the position of the first prediction sample. In the video signal encoding / decoding method and device according to the present invention, the reference sample at the fixed position includes a reference sample adjacent to the upper left corner of the current block, and the reference sample determined depending on the position of the first prediction sample may include at least one of a reference sample located on the same horizontal line as the first prediction sample or a reference sample located on the same vertical line as the first prediction sample. In the video signal encoding / decoding method and device according to the present invention, each of the plurality of reference samples may be included in a different reference line. The features briefly summarized above of the present invention are merely exemplary aspects of the detailed description of the present invention that follows and do not limit the scope of the present invention. According to the present invention, intra prediction can be efficiently performed on a block to be encoded / decoded. According to the present invention, intra prediction can be performed based on weighted prediction using multiple reference samples. According to the present invention, there is an advantage in that encoding / decoding efficiency can be improved by correcting prediction samples generated through intra prediction. The effects obtainable from the present invention are not limited to the effects mentioned above, and other effects not mentioned will be clearly understood by those skilled in the art to which the present invention belongs from the description below. FIG. 1 is a block diagram showing an image encoding device according to an embodiment of the present invention. FIG. 2 is a block diagram showing an image decoding device according to an embodiment of the present invention. FIG. 3 illustrates an example of hierarchically dividing coding blocks based on a tree structure, as an embodiment of the present invention. FIG. 4 is a diagram showing a partition form that allows binary tree-based division as an embodiment to which the present invention is applied. FIG. 5 is a diagram showing an example in which only a specific type of binary tree-based division is allowed, as an embodiment to which the present invention is applied. FIG. 6 is a diagram for explaining an example in which information related to the number of allowed binary tree splits is encoded / decoded as an embodiment to which the present invention is applied. FIG. 7 is a diagram illustrating a partition mode that can be applied to a coding block as an embodiment to which the present invention is applied. FIG. 8 illustrates an example of an intra prediction mode pre-defined in a video encoder / decoder to which the present invention is applied. FIG. 9 illustrates an example of an extended intra prediction mode to which the present invention is applied. FIG. 10 is a flowchart schematically illustrating an intra prediction method as an embodiment to which the present invention is applied. FIG. 11 illustrates an embodiment of the present invention, in which a method for correcting a prediction sample of a current block is based on differential information of surrounding samples. FIG. 12 and FIG. 13 illustrate an embodiment of the present invention, which illustrates a method for correcting a prediction sample based on a predetermined correction filter. FIG. 14 illustrates an example of an application of the present invention, showing the range of reference samples for intra prediction. Figure 15 is a drawing illustrating multiple reference sample lines. FIG. 16 is a flowchart illustrating a method for correcting a prediction sample according to an embodiment of the present invention. FIG. 17 is a flowchart illustrating a method for correcting a predicted image in sub-block units according to one embodiment of the present invention. FIGS. 18 to 22 are drawings illustrating intra prediction patterns of a current block as an embodiment to which the present invention is applied. Figures 23 and 24 are diagrams showing examples in which different offsets are applied to each unit within a sub-block. FIG. 25 is a flowchart illustrating a process for obtaining a residual sample as an embodiment to which the present invention is applied. The present invention can have various modifications and various embodiments, and specific embodiments are illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present invention to specific embodiments, but should be understood to include all modifications, equivalents, or substitutes included in the spirit and technical scope of the present invention. In describing each drawing, similar reference numerals are used for similar components. The terms first, second, etc. may be used to describe various components, but the components should not be limited by the terms. The terms are only used to distinguish one component from another. For example, without departing from the scope of the present invention, the first component may be referred to as the second component, and similarly, the second component may also be referred to as the first component. The term and / or includes a combination of a plurality of related described items or any one of a plurality of related described items. When it is said that a component is "connected" or "connected" to another component, it should be understood that it may be directly connected or connected to that other component, but that there may be other components in between. On the other hand, when it is said that a component is "directly connected" or "directly connected" to another component, it should be understood that there are no other components in between. The terminology used in this application is only used to describe specific embodiments and is not intended to limit the present invention. The singular expression includes the plural expression unless the context clearly indicates otherwise. In this application, it should be understood that the terms "comprises" or "has" and the like are intended to specify the presence of a feature, number, step, operation, component, part or combination thereof described in the specification, 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. 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. FIG. 1 is a block diagram showing an image encoding device according to an embodiment of the present invention. Referring to FIG. 1, a video encoding device (100) may include a picture segmentation unit (110), a prediction unit (120, 125), a transformation unit (130), a quantization unit (135), a reordering unit (160), an entropy encoding unit (165), an inverse quantization unit (140), an inverse transformation unit (145), a filter unit (150), and a memory (155). Each component shown in FIG. 1 is independently depicted to indicate different characteristic functions in the image encoding device, and does not mean that each component is composed of separate hardware or a single software configuration unit. That is, each component is listed and included as a separate component for convenience of explanation, and at least two components among each component may be combined to form a single component, or one component may be divided into multiple components to perform a function, and such integrated and separated embodiments of each component are also included in the scope of the present invention as long as they do not deviate from the essence of the present invention. In addition, some components may not be essential components that perform essential functions in the present invention, but may be optional components that are merely used to improve performance. The present invention may be implemented by including only essential components for implementing the essence of the present invention, excluding components that are merely used to improve performance, and a structure that includes only essential components, excluding optional components that are merely used to improve performance, is also included in the scope of the present invention. The picture splitting unit (110) can split an input picture into at least one processing unit. At this time, the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The picture splitting unit (110) can split one picture into a combination of multiple coding units, prediction units, and transform units, and select one combination of coding units, prediction units, and transform units based on a predetermined criterion (e.g., a cost function) to encode the picture. For example, a picture can be split into multiple coding units. In order to split a coding unit in a picture, a recursive tree structure such as a quad tree structure can be used. A coding unit that is split into other coding units with one image or the largest coding unit as the root can be split with as many child nodes as the number of split coding units. A coding unit that cannot be split any further according to a certain restriction becomes a leaf node. That is, if it is assumed that only a square split is possible for a coding unit, a coding unit can be split into at most four different coding units. Hereinafter, in the embodiments of the present invention, the encoding unit may be used to mean a unit that performs encoding, or may be used to mean a unit that performs decoding. A prediction unit may be divided into at least one square or rectangular shape of the same size within one coding unit, or may be divided such that one prediction unit among the divided prediction units within one coding unit has a different shape and / or size from another prediction unit. When generating a prediction unit that performs intra prediction based on a coding unit, if it is not the minimum coding unit, intra prediction can be performed without dividing it into multiple NxN prediction units. The prediction unit (120, 125) may include an inter prediction unit (120) that performs inter prediction and an intra prediction unit (125) that performs intra prediction. It may be determined whether to use inter prediction or intra prediction for a prediction unit, and specific information (e.g., intra prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. At this time, the processing unit where the prediction is performed and the processing unit where the prediction method and specific contents are determined may be different. For example, the prediction method and the prediction mode, etc. may be determined in the prediction unit, and the prediction may be performed in the transformation unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transformation unit (130). In addition, the prediction mode information, motion vector information, etc. used for the prediction may be encoded together with the residual value in the entropy encoding unit (165) and transmitted to the decoder. When using a specific encoding mode, it is also possible to encode the original block as is and transmit it to the decoding unit without generating a prediction block through the prediction unit (120, 125). The inter prediction unit (120) may predict a prediction unit based on information of at least one picture among the previous picture or the subsequent picture of the current picture, and in some cases, may predict a prediction unit based on information of a part of an encoded region within the current picture. The inter prediction unit (120) may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit. The reference picture interpolation unit can receive reference picture information from the memory (155) and generate pixel information below an integer pixel from the reference picture. In the case of luminance pixels, a DCT-based 8-tap interpolation filter (DCT-based Interpolation Filter) with different filter coefficients can be used to generate pixel information below an integer pixel in units of 1 / 4 pixels. In the case of a chrominance signal, a DCT-based 4-tap interpolation filter (DCT-based Interpolation Filter) with different filter coefficients can be used to generate pixel information below an integer pixel in units of 1 / 8 pixels. The motion prediction unit can perform motion prediction based on a reference picture interpolated by the reference picture interpolation unit. Various methods such as FBMA (Full search-based Block Matching Algorithm), TSS (Three Step Search), and NTS (New Three-Step Search Algorithm) can be used to derive a motion vector. The motion vector can have a motion vector value of 1 / 2 or 1 / 4 pixel units based on the interpolated pixel. The motion prediction unit can predict the current prediction unit by using a different motion prediction method. Various methods such as the Skip method, the Merge method, the AMVP (Advanced Motion Vector Prediction) method, and the Intra Block Copy method can be used as the motion prediction method. The intra prediction unit (125) can generate a prediction unit based on reference pixel information surrounding the current block, which is pixel information within the current picture. If the surrounding block of the current prediction unit is a block on which inter prediction is performed and the reference pixel is a pixel on which inter prediction is performed, the reference pixel included in the block on which inter prediction is performed can be used as a replacement for the reference pixel information of the surrounding block on which intra prediction is performed. That is, if the reference pixel is not available, the unavailable reference pixel information can be used as a replacement for at least one reference pixel among the available reference pixels. In intra prediction, the prediction mode can have a directional prediction mode that uses reference pixel information according to the prediction direction and a non-directional mode that does not use directional information when performing prediction. The mode for predicting luminance information and the mode for predicting chrominance information can be different, and the intra prediction mode information used for predicting luminance information or the predicted luminance signal information can be utilized to predict chrominance information. When performing intra prediction, if the size of the prediction unit and the size of the transformation unit are the same, intra prediction for the prediction unit can be performed based on the pixels on the left side of the prediction unit, the pixels on the upper left side, and the pixels on the upper side. However, when performing intra prediction, if the sizes of the prediction unit and the transformation unit are different, intra prediction can be performed using reference pixels based on the transformation unit. In addition, intra prediction using NxN division can be used only for the minimum coding unit. The intra prediction method can generate a prediction block after applying an AIS (Adaptive Intra Smoothing) filter to a reference pixel according to a prediction mode. The type of AIS filter applied to the reference pixel may be different. In order to perform the intra prediction method, the intra prediction mode of a current prediction unit can be predicted from the intra prediction modes of prediction units existing in the vicinity of the current prediction unit. When the prediction mode of the current prediction unit is predicted using mode information predicted from the surrounding prediction units, if the intra prediction modes of the current prediction unit and the surrounding prediction units are the same, information that the prediction modes of the current prediction unit and the surrounding prediction units are the same can be transmitted using predetermined flag information, and if the prediction modes of the current prediction unit and the surrounding prediction units are different, entropy encoding can be performed to encode the prediction mode information of the current block. In addition, a residual block including residual value information, which is a difference value between the prediction unit that performed the prediction and the original block of the prediction unit based on the prediction unit generated in the prediction unit (120, 125), can be generated. The generated residual block can be input to the transformation unit (130). In the transformation unit (130), the residual block including the residual value information of the prediction unit generated through the original block and the prediction unit (120, 125) can be transformed using a transformation method such as DCT (Discrete Cosine Transform), DST (Discrete Sine Transform), or KLT. Whether to apply DCT, DST, or KLT to transform the residual block can be determined based on the intra prediction mode information of the prediction unit used to generate the residual block. The quantization unit (135) can quantize the values converted to the frequency domain in the transformation unit (130). The quantization coefficients can vary depending on the block or the importance of the image. The values produced by the quantization unit (135) can be provided to the dequantization unit (140) and the reordering unit (160). The rearrangement unit (160) can perform rearrangement of coefficient values for quantized residual values. The rearrangement unit (160) can change a two-dimensional block-shaped coefficient into a one-dimensional vector shape by using a coefficient scanning method. For example, the rearrangement unit (160) can change the two-dimensional block-shaped coefficient into a one-dimensional vector shape by scanning from the DC coefficient to the coefficient of the high-frequency region by using a zig-zag scan method. Depending on the size of the transformation unit and the intra prediction mode, a vertical scan that scans the two-dimensional block-shaped coefficient in the column direction or a horizontal scan that scans the two-dimensional block-shaped coefficient in the row direction may be used instead of the zig-zag scan. That is, depending on the size of the transformation unit and the intra prediction mode, it is possible to determine which scan method among the zig-zag scan, the vertical scan, and the horizontal scan is to be used. The entropy encoding unit (165) can perform entropy encoding based on the values produced by the rearrangement unit (160). Entropy encoding can use various encoding methods such as, for example, Exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding). The entropy encoding unit (165) can encode various information such as residual value coefficient information of an encoding unit, block type information, prediction mode information, division unit information, prediction unit information, transmission unit information, motion vector information, reference frame information, block interpolation information, and filtering information from the rearrangement unit (160) and the prediction unit (120, 125). The entropy encoding unit (165) can entropy encode the coefficient values of the encoding unit input from the rearrangement unit (160). In the inverse quantization unit (140) and the inverse transformation unit (145), the values quantized in the quantization unit (135) are inversely quantized and the values transformed in the transformation unit (130) are inversely transformed. The residual values generated in the inverse quantization unit (140) and the inverse transformation unit (145) can be combined with the predicted prediction units through the motion estimation unit, motion compensation unit, and intra prediction unit included in the prediction unit (120, 125) to generate a reconstructed block. The filter unit (150) may include at least one of a deblocking filter, an offset correction unit, and an ALF (Adaptive Loop Filter). A deblocking filter can remove block distortion caused by boundaries between blocks in a restored picture. In order to determine whether to perform deblocking, it is possible to determine whether to apply a deblocking filter to the current block based on pixels included in several columns or rows included in the block. When applying a deblocking filter to a block, a strong filter or a weak filter can be applied depending on the required deblocking filtering strength. In addition, when applying a deblocking filter, horizontal filtering and vertical filtering can be processed in parallel when performing vertical filtering and horizontal filtering. The offset correction unit can correct the offset from the original image on a pixel basis for the image on which deblocking has been performed. To perform offset correction for a specific picture, a method can be used in which the pixels included in the image are divided into a certain number of regions, the regions to be offset are determined, and the offset is applied to the regions, or a method can be used in which the offset is applied by considering the edge information of each pixel. Adaptive Loop Filtering (ALF) can be performed based on the value compared between the filtered restored image and the original image. After dividing the pixels included in the image into a predetermined group, one filter to be applied to the group is determined, and filtering can be performed differentially for each group. Information related to whether to apply ALF can be transmitted by luminance signal for each coding unit (CU), and the shape and filter coefficient of the ALF filter to be applied can be different for each block. In addition, the same shape (fixed shape) of the ALF filter can be applied regardless of the characteristics of the target block. The memory (155) can store a restored block or picture produced through the filter unit (150), and the stored restored block or picture can be provided to the prediction unit (120, 125) when performing inter prediction. FIG. 2 is a block diagram showing an image decoding device according to an embodiment of the present invention. Referring to FIG. 2, the image decoder (200) may include an entropy decoding unit (210), a reordering unit (215), an inverse quantization unit (220), an inverse transformation unit (225), a prediction unit (230, 235), a filter unit (240), and a memory (245). When a video bitstream is input to a video encoder, the input bitstream can be decoded in the opposite procedure to that of the video encoder. The entropy decoding unit (210) can perform entropy decoding in a procedure opposite to that of performing entropy encoding in the entropy encoding unit of the video encoder. For example, various methods such as Exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding) can be applied in response to the method performed in the video encoder. The entropy decoding unit (210) can decode information related to intra prediction and inter prediction performed in the encoder. The reordering unit (215) can perform reordering based on the method in which the bitstream that has been entropy-decoded by the entropy decoding unit (210) is reordered by the encoding unit. The coefficients expressed in the form of a one-dimensional vector can be re-restored into coefficients in the form of a two-dimensional block and reordered. The reordering unit (215) can perform reordering by receiving information related to the coefficient scanning performed by the encoding unit and performing reverse scanning based on the scanning order performed by the corresponding encoding unit. The inverse quantization unit (220) can perform inverse quantization based on the quantization parameters provided from the encoder and the coefficient values of the rearranged block. The inverse transform unit (225) can perform inverse transform, i.e., inverse DCT, inverse DST, and inverse KLT, on the transforms performed by the transform unit, i.e., DCT, DST, and KLT, on the quantization result performed by the image encoder. The inverse transform can be performed based on the transmission unit determined by the image encoder. In the inverse transform unit (225) of the image decoder, a transform technique (e.g., DCT, DST, KLT) can be selectively performed according to a plurality of pieces of information, such as a prediction method, the size of the current block, and the prediction direction. The prediction unit (230, 235) can generate a prediction block based on prediction block generation related information provided from the entropy decoding unit (210) and previously decoded block or picture information provided from the memory (245). As described above, when performing intra prediction in the same manner as the operation in the image encoder, if the size of the prediction unit and the size of the transformation unit are the same, intra prediction for the prediction unit is performed based on the pixels on the left side of the prediction unit, the pixels on the upper left side, and the pixels on the upper side. However, when performing intra prediction, if the size of the prediction unit and the size of the transformation unit are different, intra prediction can be performed using reference pixels based on the transformation unit. In addition, intra prediction using NxN division only for the minimum coding unit can be used. The prediction unit (230, 235) may include a prediction unit determination unit, an inter prediction unit, and an intra prediction unit. The prediction unit determination unit may receive various information such as prediction unit information input from the entropy decoding unit (210), prediction mode information of an intra prediction method, and motion prediction-related information of an inter prediction method, and may distinguish a prediction unit from a current encoding unit and determine whether the prediction unit performs inter prediction or intra prediction. The inter prediction unit (230) may perform inter prediction on the current prediction unit based on information included in at least one of a previous picture or a subsequent picture of the current picture including the current prediction unit by using information necessary for inter prediction of the current prediction unit provided from the image encoder. Alternatively, inter prediction may be performed based on information on a portion of a pre-restored area within the current picture including the current prediction unit. In order to perform inter prediction, it is possible to determine whether the motion prediction method of the prediction unit included in the encoding unit is Skip Mode, Merge Mode, AMVP Mode, or Intra Block Copy Mode based on the encoding unit. The intra prediction unit (235) can generate a prediction block based on pixel information in the current picture. If the prediction unit is a prediction unit that has performed intra prediction, the intra prediction can be performed based on intra prediction mode information of the prediction unit provided by the image encoder. The intra prediction unit (235) can include an AIS (Adaptive Intra Smoothing) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter is a part that performs filtering on the reference pixels of the current block and can determine whether to apply the filter according to the prediction mode of the current prediction unit and apply it. AIS filtering can be performed on the reference pixels of the current block using the prediction mode and AIS filter information of the prediction unit provided by the image encoder. If the prediction mode of the current block is a mode that does not perform AIS filtering, the AIS filter may not be applied. The reference pixel interpolation unit can interpolate the reference pixel to generate a reference pixel of a pixel unit less than an integer value when the prediction mode of the prediction unit is a prediction unit that performs intra prediction based on the pixel value interpolated by the reference pixel. When the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating the reference pixel, the reference pixel may not be interpolated. The DC filter can generate a prediction block through filtering when the prediction mode of the current block is the DC mode. The restored block or picture may be provided to a filter unit (240). The filter unit (240) may include a deblocking filter, an offset correction unit, and an ALF. Information on whether a deblocking filter has been applied to a corresponding block or picture can be received from a video encoder, and if a deblocking filter has been applied, information on whether a strong filter or a weak filter has been applied. The deblocking filter of a video decoder can receive information related to the deblocking filter provided by the video encoder, and the video decoder can perform deblocking filtering on the corresponding block. The offset correction unit can perform offset correction on the restored image based on information such as the type of offset correction applied to the image during encoding and the offset value. ALF can be applied to an encoding unit based on ALF application information provided from an encoder, ALF coefficient information, etc. This ALF information can be provided by being included in a specific parameter set. The memory (245) can store a restored picture or block so that it can be used as a reference picture or reference block, and can also provide the restored picture to an output unit. As described above, in the following embodiments of the present invention, for convenience of explanation, the term coding unit is used as an encoding unit, but it may also be a unit that performs not only encoding but also decoding. In addition, the current block represents a block to be encoded / decoded, and may represent a coding tree block (or coding tree unit), an encoding block (or encoding unit), a transform block (or transform unit), or a prediction block (or prediction unit), depending on the encoding / decoding step. A picture can be encoded / decoded by partitioning it into square or non-square basic blocks. At this time, the basic block can be called a coding tree unit. The coding tree unit can be defined as a coding unit having the largest size allowed in a sequence or a slice. Information related to whether the coding tree unit is square or non-square or the size of the coding tree unit can be signaled through a sequence parameter set, a picture parameter set, or a slice header. The coding tree unit can be partitioned into partitions of a smaller size. At this time, when a partition generated by partitioning the coding tree unit has depth 1, the partition generated by partitioning the partition having depth 1 can be defined as having depth 2. That is, a partition generated by partitioning a partition having depth k in the coding tree unit can be defined as having depth k+1. A partition of arbitrary size generated as a coding tree unit is split can be defined as a coding unit. A coding unit can be split recursively, or split into basic units for performing prediction, quantization, transformation, or in-loop filtering. For example, a partition of arbitrary size generated as a coding unit is split can be defined as a coding unit, or a transformation unit or a prediction unit, which is a basic unit for performing prediction, quantization, transformation, or in-loop filtering. Partitioning of a coding tree unit or a coding unit may be performed based on at least one of a vertical line or a horizontal line. In addition, the number of vertical lines or horizontal lines partitioning the coding tree unit or the coding unit may be at least one. For example, a coding tree unit or a coding unit may be divided into two partitions using one vertical line or one horizontal line, or a coding tree unit or a coding unit may be divided into three partitions using two vertical lines or two horizontal lines. Alternatively, a coding tree unit or a coding unit may be divided into four partitions, each of which has a length and a width equal to 1 / 2, using one vertical line and one horizontal line. When a coding tree unit or a coding unit is divided into a plurality of partitions using at least one vertical line or at least one horizontal line, the partitions may have uniform sizes or different sizes. Alternatively, one partition may have a different size from the rest of the partitions. In the embodiments described below, it is assumed that the coding tree unit or coding unit is partitioned into a quad tree or binary tree structure. However, partitioning of the coding tree unit or coding unit using a larger number of vertical lines or a larger number of horizontal lines is also possible. FIG. 3 illustrates an example of hierarchically dividing coding blocks based on a tree structure, as an embodiment of the present invention. The input video signal is decoded in units of a predetermined block, and the basic unit for decoding the input video signal in this way is called a coding block. The coding block can be a unit that performs intra / inter prediction, transformation, and quantization. In addition, a prediction mode (e.g., an intra-screen prediction mode or an inter-screen prediction mode) is determined in units of coding blocks, and prediction blocks included in the coding block can share the determined prediction mode. The coding block can be a square or non-square block having any size in the range of 8x8 to 64x64, and can be a square or non-square block having a size of 128x128, 256x256, or more. Specifically, the coding block can be hierarchically partitioned based on at least one of a quad tree and a binary tree. Here, the quad tree-based partitioning may mean a method in which a 2Nx2N coding block is partitioned into four NxN coding blocks, and the binary tree-based partitioning may mean a method in which one coding block is partitioned into two coding blocks. Even if the binary tree-based partitioning is performed, a square coding block may exist in a lower depth. The binary tree-based partitioning can be performed symmetrically or asymmetrically. The coding block partitioned based on the binary tree can be a square block or a non-square block such as a rectangle. For example, a partition shape that allows the binary tree-based partitioning can include at least one of a symmetric 2NxN (horizontal non-square coding unit) or Nx2N (vertical non-square coding unit), an asymmetric nLx2N, nRx2N, 2NxnU or 2NxnD, as in the example illustrated in FIG. 4. Binary tree-based partitioning may restrictively allow only one of the symmetric or asymmetric forms of partitioning. In this case, configuring a coding tree unit into square blocks may correspond to quad tree CU partitioning, and configuring a coding tree unit into symmetric non-square blocks may correspond to binary tree partitioning. Configuring a coding tree unit into square blocks and symmetric non-square blocks may correspond to quad and binary tree CU partitioning. Binary tree-based partitioning can be performed on coding blocks for which quad tree-based partitioning is no longer performed. Quad tree-based partitioning can no longer be performed on coding blocks that have been partitioned based on binary tree. In addition, the partitioning of the lower depth may be determined dependently on the partitioning form of the upper depth. For example, if binary tree-based partitioning is allowed in two or more depths, only binary tree-based partitioning of the same form as the binary tree partitioning form of the upper depth may be allowed in the lower depth. For example, if binary tree-based partitioning in the form of 2NxN is performed in the upper depth, binary tree-based partitioning in the form of 2NxN may be performed in the lower depth as well. Alternatively, if binary tree-based partitioning in the form of Nx2N is performed in the upper depth, binary tree-based partitioning in the form of Nx2N may be allowed in the lower depth as well. Conversely, at lower depths, it is also possible to allow only binary tree-based splits that have a different form than the binary tree splits at higher depths. For a sequence, a slice, a coding tree unit or a coding unit, only a specific form of binary tree-based partitioning may be restricted to be used. For example, for a coding tree unit, only a binary tree-based partitioning of the form 2NxN or Nx2N may be restricted to be allowed. The allowed partition shapes may be predefined in the encoder or decoder, or information about the allowed or disallowed partition shapes may be encoded and signaled through the bitstream. FIG. 5 is a diagram showing an example in which only a specific type of binary tree-based division is allowed. FIG. 5 (a) shows an example in which only a binary tree-based division in the form of Nx2N is allowed, and FIG. 5 (b) shows an example in which only a binary tree-based division in the form of 2NxN is allowed. In order to implement the above quad-tree or binary tree-based adaptive division, information indicating quad-tree-based division, information regarding the size / depth of a coding block in which quad-tree-based division is allowed, information indicating binary tree-based division, information regarding the size / depth of a coding block in which binary tree-based division is allowed, information regarding the size / depth of a coding block in which binary tree-based division is not allowed, or information regarding whether binary tree-based division is vertical or horizontal, etc. can be used. Additionally, for a coding tree unit or a given coding unit, the number of times binary tree splitting is allowed, the depth at which binary tree splitting is allowed, or the number of depths at which binary tree splitting is allowed, etc. can be obtained. The above information can be encoded in units of coding tree units or coding units and transmitted to a decoder via a bitstream. For example, a syntax 'max_binary_depth_idx_minus1' indicating the maximum depth at which binary tree splitting is allowed can be encoded / decoded through the bitstream. In this case, max_binary_depth_idx_minus1+1 can indicate the maximum depth at which binary tree splitting is allowed. Looking at the example illustrated in FIG. 6, in FIG. 6, binary tree splitting is illustrated as being performed on a coding unit with depth 2 and a coding unit with depth 3. Accordingly, at least one of information indicating the number of times binary tree splitting is performed within a coding tree unit (2 times), information indicating the maximum depth (depth 3) at which binary tree splitting is allowed within a coding tree unit, or information indicating the number of depths at which binary tree splitting is allowed within a coding tree unit (2, depth 2 and depth 3) can be encoded / decoded through a bitstream. As another example, at least one of the number of times a binary tree split is allowed, the depth at which a binary tree split is allowed, or the number of depths at which a binary tree split is allowed may be obtained for each sequence, slice. As an example, the information may be encoded for each sequence, picture, or slice and transmitted via a bitstream. Accordingly, at least one of the number of times a binary tree split is allowed, the maximum depth at which a binary tree split is allowed, or the number of depths at which a binary tree split is allowed, of the first slice and the second slice may be different. As an example, in the first slice, binary tree splitting may be allowed in only one depth, whereas in the second slice, binary tree splitting may be allowed in two depths. As another example, at least one of the number of times binary tree splitting is allowed, the depth at which binary tree splitting is allowed, or the number of depths at which binary tree splitting is allowed may be set differently depending on the temporal identifier (TemporalID) of a slice or picture. Here, the temporal identifier (TemporalID) is for identifying each of a plurality of layers of an image having at least one or more scalability among view, spatial, temporal, or quality. As illustrated in FIG. 3, a first coding block 300 having a split depth of k may be split into a plurality of second coding blocks based on a quad tree. For example, the second coding blocks 310 to 340 are square blocks having a size of half the width and height of the first coding block, and the split depth of the second coding block may be increased to k+1. A second coding block 310 having a split depth of k+1 can be split into a plurality of third coding blocks having a split depth of k+2. Splitting of the second coding block 310 can be performed selectively using either a quad tree or a binary tree depending on a splitting method. Here, the splitting method can be determined based on at least one of information indicating a quad tree-based splitting or information indicating a binary tree-based splitting. When the second coding block 310 is split based on a quad tree, the second coding block 310 is split into four third coding blocks 310a each having a size equal to half the width and height of the second coding block, and the split depth of the third coding block 310a can be increased to k+2. On the other hand, when the second coding block 310 is split based on a binary tree, the second coding block 310 can be split into two third coding blocks. At this time, each of the two third coding blocks is a non-square block having a size equal to half the width and height of the second coding block, and the split depth can be increased to k+2. The second coding block can be determined as a horizontal or vertical non-square block depending on the splitting direction, and the splitting direction can be determined based on information about whether the binary tree-based splitting is in the vertical direction or the horizontal direction. Meanwhile, the second coding block 310 may be determined as a terminal coding block that is not split any further based on a quad tree or a binary tree, in which case the coding block may be used as a prediction block or a transformation block. The third coding block 310a may be determined as a terminal coding block, similar to the division of the second coding block 310, or may be further divided based on a quad tree or binary tree. Meanwhile, the third coding block 310b divided based on the binary tree may be further divided based on the binary tree into a vertical coding block (310b-2) or a horizontal coding block (310b-3), and the division depth of the corresponding coding block may be increased to k+3. Alternatively, the third coding block 310b may be determined as a terminal coding block (310b-1) that is no longer divided based on the binary tree, and in this case, the corresponding coding block (310b-1) may be used as a prediction block or a transformation block. However, the above-described division process may be restrictively performed based on at least one of information about the size / depth of a coding block for which quad-tree-based division is allowed, information about the size / depth of a coding block for which binary tree-based division is allowed, or information about the size / depth of a coding block for which binary tree-based division is not allowed. The size that a coding block can have may be limited to a certain number, or the size of a coding block within a certain unit may have a fixed value. For example, the size of a coding block within a sequence or the size of a coding block within a picture may be limited to 256x256, 128x128, or 32x32. Information indicating the size of a coding block within a sequence or a picture may be signaled through a sequence header or a picture header. As a result of the partitioning based on quad trees and binary trees, the coding units can be square or rectangular of arbitrary size. The coding block is encoded using at least one of skip mode, intra-screen prediction, inter-screen prediction, or skip method. Once the coding block is determined, a prediction block can be determined through prediction partitioning of the coding block. The prediction partitioning of the coding block can be performed by a partition mode (Part_mode) indicating a partition shape of the coding block. The size or shape of the prediction block can be determined according to the partition mode of the coding block. For example, the size of the prediction block determined according to the partition mode can have a value equal to or smaller than the size of the coding block. Figure 7 is a diagram illustrating a partition mode that can be applied to a coding block when the coding block is encoded with inter-screen prediction. When a coding block is encoded with inter-screen prediction, any one of eight partition modes can be applied to the coding block, as in the example illustrated in FIG. 7. When a coding block is encoded with intra-picture prediction, the coding block may have a partition mode PART_2Nx2N or PART_NxN applied. PART_NxN can be applied when the coding block has a minimum size. Here, the minimum size of the coding block may be predefined in the encoder and decoder. Alternatively, information about the minimum size of the coding block may be signaled via the bitstream. For example, the minimum size of the coding block may be signaled via the slice header, and thus, the minimum size of the coding block may be defined for each slice. In general, the size of the prediction block can range from 64x64 to 4x4. However, if the coding block is encoded with inter-screen prediction, the prediction block may not have a size of 4x4 in order to reduce memory bandwidth when performing motion compensation. FIG. 8 illustrates an example of an intra prediction mode pre-defined in a video encoder / decoder to which the present invention is applied. A video encoder / decoder can perform intra prediction using any one of the pre-defined intra prediction modes. The pre-defined intra prediction modes for intra prediction can be composed of a non-directional prediction mode (e.g., Planar mode, DC mode) and 33 directional prediction modes. Alternatively, a greater number of directional prediction modes than the 33 directional prediction modes may be used to improve the accuracy of intra prediction. That is, M extended directional prediction modes may be defined by further subdividing the angles of the directional prediction modes (M>33), or a directional prediction mode with a predetermined angle may be derived and used by utilizing at least one of the 33 pre-defined directional prediction modes. It is also possible to use more intra prediction modes than the 35 intra prediction modes illustrated in FIG. 8. For example, by further subdividing the angle of the directional prediction mode or by decoding a directional prediction mode having a predetermined angle by using at least one of a predetermined number of predefined directional modes, it is possible to use more intra prediction modes than 35 intra prediction modes. In this case, using more intra prediction modes than 35 intra prediction modes can be referred to as an extended intra prediction mode. Fig. 9 is an example of an extended intra prediction mode, and the extended intra prediction mode can be composed of two non-directional prediction modes and 65 extended directional prediction modes. The extended intra prediction mode can be used equally for the luminance component and the chrominance component, or a different number of intra prediction modes can be used for each component. For example, 67 extended intra prediction modes can be used for the luminance component, and 35 intra prediction modes can be used for the chrominance component. Alternatively, intra prediction can be performed using different numbers of intra prediction modes depending on the chrominance format. For example, in the case of a 4:2:0 format, intra prediction can be performed using 67 intra prediction modes for the luminance component and 35 intra prediction modes for the chrominance component, and in the case of a 4:4:4 format, intra prediction can be performed using 67 intra prediction modes for both the luminance component and the chrominance component. Alternatively, intra prediction may be performed using different numbers of intra prediction modes depending on the size and / or shape of the block. That is, intra prediction may be performed using 35 intra prediction modes or 67 intra prediction modes depending on the size and / or shape of the PU or CU. For example, if the size of the CU or PU is smaller than 64x64 or is an asymmetric partition, intra prediction may be performed using 35 intra prediction modes, and if the size of the CU or PU is equal to or larger than 64x64, intra prediction may be performed using 67 intra prediction modes. Intra_2Nx2N may allow 65 directional intra prediction modes, and Intra_NxN may allow only 35 directional intra prediction modes. The size of a block to which the extended intra prediction mode is applied may be set differently for each sequence, picture or slice. For example, in a first slice, the extended intra prediction mode may be set to be applied to a block (e.g., a CU or PU) larger than 64x64, and in a second slice, the extended intra prediction mode may be set to be applied to a block larger than 32x32. Information indicating the size of a block to which the extended intra prediction mode is applied may be signaled for each sequence, picture or slice. For example, information indicating the size of a block to which the extended intra prediction mode is applied may be defined as 'log2_extended_intra_mode_size_minus4', which is obtained by taking the logarithm of the size of the block and then subtracting the integer 4 from it. For example, a value of log2_extended_intra_mode_size_minus4 of 0 may indicate that the extended intra prediction mode can be applied to a block having a size equal to or greater than 16x16 or a block having a size greater than 16x16, and a value of log2_extended_intra_mode_size_minus4 of 1 may indicate that the extended intra prediction mode can be applied to a block having a size equal to or greater than 32x32 or a block having a size greater than 32x32. As described above, the number of intra prediction modes can be determined by considering at least one of a chrominance component, a chrominance format, and a size or shape of a block. Not limited to the described example, intra prediction mode candidates (e.g., the number of MPMs) used to determine an intra prediction mode of a block to be encoded / decoded may also be determined based on at least one of a chrominance component, a chrominance format, and a size or shape of a block. With reference to the drawings described below, a method for determining an intra prediction mode of a block to be encoded / decoded and a method for performing intra prediction using the determined intra prediction mode will be described. FIG. 10 is a flowchart schematically illustrating an intra prediction method as an embodiment to which the present invention is applied. Encoding / decoding efficiency can be improved by applying intra prediction to blocks included in an image with strong directionality or blocks included in an image that did not appear in the previous frame. Referring to Fig. 10, the intra prediction mode of the current block can be determined (S1000). Specifically, the intra prediction mode of the current block can be derived based on the candidate list and the index. Here, the candidate list includes a plurality of candidates, and the plurality of candidates can be determined based on the intra prediction modes of the neighboring blocks adjacent to the current block. The neighboring blocks can include at least one of the blocks located at the top, bottom, left, right, or corner of the current block. The index can specify any one of the plurality of candidates belonging to the candidate list. The candidate specified by the index can be set as the intra prediction mode of the current block. The intra prediction mode used by the surrounding block for intra prediction can be set as a candidate. In addition, the intra prediction mode having a similar directionality to the intra prediction mode of the surrounding block can be set as a candidate. Here, the intra prediction mode having a similar directionality can be determined as a value obtained by adding or subtracting a predetermined constant value to the intra prediction mode of the surrounding block. The predetermined constant value can be an integer of 1, 2, or a larger number. The above candidate list may further include a default mode. The default mode may include at least one of a planar mode, a DC mode, a vertical mode, and a horizontal mode. The default mode may be adaptively added considering the maximum number of candidates that can be included in the candidate list of the current block. The maximum number of candidates that can be included in the candidate list can be 3, 4, 5, 6, or more. The maximum number of candidates that can be included in the candidate list can be a fixed value preset in the video encoder / decoder, or can be variably determined based on the properties of the current block. The properties can mean the position / size / shape of the block, the number / type of intra prediction modes that the block can use, chroma properties, chroma format, etc. Alternatively, information indicating the maximum number of candidates that can be included in the candidate list can be separately signaled, and the maximum number of candidates that can be included in the candidate list can be variably determined using this. The information indicating the maximum number of candidates can be signaled at least one of a sequence level, a picture level, a slice level, or a block level. When the extended intra prediction mode and the 35 pre-defined intra prediction modes are optionally used, the intra prediction modes of the surrounding blocks can be converted into indices corresponding to the extended intra prediction mode, or into indices corresponding to the 35 intra prediction modes, to derive candidates. A pre-defined table may be used for converting the indices, or a scaling operation based on a predetermined value may be used. Here, the pre-defined table may define a mapping relationship between different intra prediction mode groups (e.g., the extended intra prediction mode and the 35 intra prediction modes). For example, if the left neighboring block uses 35 intra prediction modes and the intra prediction mode of the left neighboring block is 10 (horizontal mode), this can be converted to index 16 corresponding to the horizontal mode in the extended intra prediction mode. Alternatively, if the upper surrounding block uses the extended intra prediction mode and the intra prediction mode index of the upper surrounding block is 50 (vertical mode), it can be converted to index 26 corresponding to the vertical mode in the 35 intra prediction modes. Based on the intra prediction mode determination method described above, intra prediction modes may be derived independently for each of the luminance component and the chrominance component, or the chrominance component may be derived as a dependency on the intra prediction mode of the luminance component. Specifically, the intra prediction mode of the chrominance component can be determined based on the intra prediction mode of the luminance component, as shown in Table 1 below. Intra_chroma_pred_mode[xCb][yCb]IntraPredModeY[xCb][yCb]026101X(0<=X<=34)0340000126342626262101034101031113414026101X In Table 1, intra_chroma_pred_mode represents information signaled to specify the intra prediction mode of the chrominance component, and IntraPredModeY represents the intra prediction mode of the luminance component. Referring to Fig. 10, a reference sample for intra prediction of the current block can be derived (S1010). Specifically, reference samples for intra prediction can be derived based on surrounding samples of the current block. The surrounding samples can mean restored samples of the above-described surrounding blocks, which can be restored samples before the in-loop filter is applied or restored samples after the in-loop filter is applied. A surrounding sample restored before the current block may be used as a reference sample, or a surrounding sample filtered based on a predetermined intra filter may be used as a reference sample. Filtering a surrounding sample using an intra filter may be referred to as reference sample smoothing. The intra filter may include at least one of a first intra filter applied to a plurality of surrounding samples positioned on the same horizontal line or a second intra filter applied to a plurality of surrounding samples positioned on the same vertical line. Depending on the positions of the surrounding samples, either the first intra filter or the second intra filter may be selectively applied, or two intra filters may be applied redundantly. At this time, a filter coefficient of at least one of the first intra filter or the second intra filter may be (1,2,1), but is not limited thereto. The filtering may be adaptively performed based on at least one of the intra prediction mode of the current block or the size of the transform block for the current block. For example, if the intra prediction mode of the current block is DC mode, vertical mode, or horizontal mode, filtering may not be performed. If the size of the transform block is NxM, filtering may not be performed. Here, N and M may be the same or different values, and may be any one of 4, 8, 16, or more values. For example, if the size of the transform block is 4x4, filtering may not be performed. Alternatively, filtering may be selectively performed based on a comparison result between the difference between the intra prediction mode of the current block and the vertical mode (or horizontal mode) and a pre-defined threshold. For example, filtering may be performed only when the difference between the intra prediction mode of the current block and the vertical mode is greater than the threshold. The threshold may be defined for each size of the transform block as shown in Table 2. 8x8 transform16x16 transform32x32 transformThreshold710 The intra filter may be determined as one of a plurality of intra filter candidates pre-defined in the video encoder / decoder. For this purpose, a separate index specifying the intra filter of the current block among the plurality of intra filter candidates may be signaled. Alternatively, the intra filter may be determined based on at least one of the size / shape of the current block, the size / shape of the transform block, information about the filter strength, or the variation of the surrounding samples. Referring to FIG. 10, intra prediction can be performed using the intra prediction mode of the current block and the reference sample (S1020). That is, the prediction sample of the current block can be obtained by using the intra prediction mode determined in S1000 and the reference sample derived in S1010. However, in the case of intra prediction, since the boundary sample of the surrounding block is used, a problem of deterioration in the image quality of the prediction image may occur. Therefore, a correction process for the prediction sample generated through the above-described prediction process may be further performed, which will be examined in detail below with reference to FIGS. 11 to 13. However, the correction process described below is not limited to being applied only to the intra prediction sample, and of course can be applied to the inter prediction sample or the restored sample. FIG. 11 illustrates an embodiment of the present invention, in which a method for correcting a prediction sample of a current block is based on differential information of surrounding samples. A prediction sample of a current block can be corrected based on differential information of multiple surrounding samples for the current block. The correction may be performed on all prediction samples belonging to the current block, or may be performed only on prediction samples belonging to a predetermined partial region. The partial region may be one row / column or multiple rows / columns, which may be a region pre-configured for correction in an image encoder / decoder. For example, correction may be performed on one row / column located at a boundary of the current block, or on multiple rows / columns from the boundary of the current block. Alternatively, the partial region may be variably determined based on at least one of the size / shape or the intra prediction mode of the current block. The surrounding samples may belong to at least one of the surrounding blocks located at the top, left, and upper left corners of the current block. The number of surrounding samples used for correction may be 2, 3, 4, or more. The positions of the surrounding samples may be variably determined depending on the positions of the prediction samples to be corrected within the current block. Alternatively, some of the surrounding samples may have fixed positions regardless of the positions of the prediction samples to be corrected, and the rest may have variable positions depending on the positions of the prediction samples to be corrected. The differential information of the surrounding samples may mean a differential sample between the surrounding samples, or may mean a value obtained by scaling the differential sample by a predetermined constant value (e.g., 1, 2, 3, etc.). Here, the predetermined constant value may be determined by considering the position of the prediction sample to be corrected, the position of the column or row to which the prediction sample to be corrected belongs, the position of the prediction sample within the column or row, etc. For example, if the intra prediction mode of the current block is vertical mode, the final prediction sample can be obtained as in the following mathematical expression 1 by using the differential sample between the surrounding sample p(-1,y) adjacent to the left boundary of the current block and the upper left surrounding sample p(-1,-1). For example, if the intra prediction mode of the current block is horizontal mode, the final prediction sample can be obtained as in the following mathematical expression 2 by using the differential sample between the surrounding sample p(x,-1) adjacent to the upper boundary of the current block and the upper left surrounding sample p(-1,-1). For example, if the intra prediction mode of the current block is the vertical mode, the final prediction sample can be obtained by using the differential sample between the surrounding sample p(-1, y) adjacent to the left boundary of the current block and the upper left surrounding sample p(-1, -1). At this time, the differential sample can be added to the prediction sample, or the differential sample can be scaled by a predetermined constant value and then added to the prediction sample. The predetermined constant value used for scaling can be determined differently according to the column and / or the row. For example, the prediction sample can be corrected as in the following mathematical expressions 3 and 4. For example, if the intra prediction mode of the current block is the horizontal mode, the final prediction sample can be obtained by using the differential sample between the surrounding sample p(x,-1) adjacent to the upper boundary of the current block and the upper left surrounding sample p(-1,-1), as described above in the vertical mode. For example, the prediction sample can be corrected as in the following mathematical expressions 5 and 6. FIG. 12 and FIG. 13 illustrate an embodiment of the present invention, which illustrates a method for correcting a prediction sample based on a predetermined correction filter. The prediction sample can be corrected based on surrounding samples of the prediction sample to be corrected and a predetermined correction filter. At this time, the surrounding samples can be specified by an angular line of a directional prediction mode of the current block, and can be one or more samples located on the same angular line as the prediction sample to be corrected. In addition, the surrounding samples can be prediction samples belonging to the current block, or restored samples belonging to a surrounding block restored before the current block. The number of taps, strength, or filter coefficient of the correction filter may be determined based on at least one of the position of the prediction sample to be corrected, whether the prediction sample to be corrected is located at the boundary of the current block, the intra prediction mode of the current block, the angle of the directional prediction mode, the prediction mode (inter or intra mode) of the surrounding block, or the size / shape of the current block. Referring to FIG. 12, when the index is 2 or 34 in the directional prediction mode, the final prediction sample can be obtained by using at least one prediction / restored sample located at the lower left of the prediction sample to be corrected and a predetermined correction filter, as shown in FIG. 12. Here, the prediction / restored sample at the lower left may belong to a previous line of the line to which the prediction sample to be corrected belongs, and may belong to the same block as the current sample or may belong to a neighboring block adjacent to the current block. Filtering of prediction samples may be performed only on lines located at block boundaries, or on multiple lines. For each line, a compensation filter having at least one different number of filter taps or filter coefficients may be used. For example, a (1 / 2, 1 / 2) filter may be used for the first line on the left closest to the block boundary, a (12 / 16, 4 / 16) filter may be used for the second line, a (14 / 16, 2 / 16) filter may be used for the third line, and a (15 / 16, 1 / 16) filter may be used for the fourth line. Alternatively, when the index is a value between 3 and 6 or between 30 and 33 in the directional prediction mode, filtering can be performed at the block boundary as shown in FIG. 13, and a 3-tap correction filter can be used to correct the prediction sample. Filtering can be performed using a 3-tap correction filter that inputs the lower left sample of the prediction sample to be corrected, the lower sample of the lower left sample, and the prediction sample to be corrected. The positions of the surrounding samples used in the correction filter can be determined differently based on the directional prediction mode. The filter coefficients of the correction filter can also be determined differently depending on the directional prediction mode. Depending on whether the surrounding block is inter mode or intra mode, different compensation filters can be applied. If the surrounding block is encoded in intra mode, a filtering method that gives more weight to the prediction sample can be used than if it is encoded in inter mode. For example, if the intra prediction mode is 34, a (1 / 2,1 / 2) filter can be used if the surrounding block is encoded in inter mode, and a (4 / 16, 12 / 16) filter can be used if the surrounding block is encoded in intra mode. Depending on the size / shape of the current block (e.g., coding block, prediction block), the number of lines filtered within the current block may vary. For example, if the size of the current block is less than or equal to 32x32, filtering may be performed on only one line at the block boundary, and otherwise, filtering may be performed on multiple lines including one line at the block boundary. Figures 12 and 13 are explained based on the case of using the 35 intra prediction modes mentioned in Figure 7, but can be applied identically / similarly even when using the extended intra prediction mode. FIG. 14 illustrates an example of an application of the present invention, showing the range of reference samples for intra prediction. Intra prediction of a current block can be performed using reference samples derived from reconstructed samples included in surrounding blocks. Here, the reconstructed sample means a sample whose encoding / decoding is completed before encoding / decoding of the current block. For example, intra prediction for the current block can be performed based on at least one of reference samples P(-1,-1), P(-1,y) (0<= y <= 2N-1), P(x,-1) (0<= x <= 2N-1) around the current block. The reference samples can be averaged to generate a prediction sample for the current block, or the reference samples can be copied in a specific direction in consideration of the directionality of the intra prediction mode of the current block to perform the prediction sample for the current block. Intra prediction of the current block may be performed using at least one of a plurality of reference lines. The lengths of the plurality of reference lines may be determined to be all or part of the same, or may be set differently. For example, assuming that the current block has the size of WxH, the kth reference line may include reference samples located in the same row as p(-k, -k) and p(-k, -k) (e.g., reference samples from p(-k+1,-k) to p(W+H+2(k-1),-k) or reference samples from p(-k+1, -k) to p(2W+2(k-1), -k)) and reference samples located in the same column as p(-k, -k) (e.g., reference samples from p(-k, -k+1) to p(-k,W+H+2(k-1)) or reference samples from p(-k, -k+1) to p(-k,2H+2(k-1))). Fig. 15 is a diagram illustrating a plurality of reference sample lines. As in the example illustrated in Fig. 15, when the first reference line adjacent to the boundary of the current block is referred to as 'reference line 0', the kth reference line can be configured to be adjacent to the k-1th reference line. Alternatively, unlike as illustrated in Fig. 15, it is also possible to configure all reference lines to have the same number of reference samples. Intra prediction of a current block can be performed by selecting at least one of a plurality of reference lines and based on a reference sample included in the selected reference line. In this way, performing intra prediction by selecting at least one from a plurality of reference line candidates can be referred to as an 'extended reference intra prediction method using an extended reference sample' or an 'extended intra prediction method'. In addition, a plurality of reference lines can be referred to as 'extended reference lines'. Whether to perform intra prediction based on an extended reference line can be determined based on information signaled through a bitstream. At this time, the information may be a 1-bit flag, but is not limited thereto. Information on whether to perform intra prediction based on an extended reference line can be signaled in units of a coding tree unit, a coding unit or a prediction unit, or can be signaled in units of a sequence, a picture or a slice. That is, whether to perform intra prediction based on an extended reference line can be determined in units of a sequence, a picture, a slice, a CTU, a CU or a PU. Since intra prediction generates prediction samples using limited reference samples, there may be cases where the generated prediction samples do not reflect the characteristics of the original image. That is, since intra prediction of the current block is performed using only neighboring samples of the current block, it may not accurately reflect the characteristics of the original image. For example, when there is an edge in the current block or a new object appears around the boundary of the current block, there may be cases where the difference between the prediction sample and the original image is large depending on the location of the prediction sample in the current block. In this case, the residual value may become relatively large, which may cause a problem in that the amount of bits to be encoded / decoded increases. Accordingly, the present invention proposes a method for refining prediction samples generated through intra prediction. The method for refining prediction samples will be described in detail with reference to FIGS. 16 to 24. FIG. 16 is a flowchart illustrating a method for correcting a prediction sample according to an embodiment of the present invention. First, based on the intra prediction mode of the current block, an intra prediction image (prediction block or prediction sample) for the current block can be obtained (S1610). In the embodiment described below, a prediction image generated based on the intra prediction mode for the current block is referred to as a first intra prediction image or a first prediction block, and a sample included in the first intra prediction image is referred to as a first prediction sample. When a first intra prediction image is generated as a result of performing intra prediction, a second intra prediction image (or a second prediction sample) may be generated by correcting the first intra prediction image (or the first prediction sample) by applying an offset to at least a portion of a current block. For example, correction of the first intra prediction image based on the offset may be performed on an entire portion of the current block, a pre-defined portion of the current block, or a sample at a specific location. An offset used to correct the first intra prediction image into the second intra prediction image may be referred to as an 'intra refinement offset'. Whether to apply an offset to at least a part of the current block may be determined based on the type of the intra prediction mode of the current block, the directionality of the intra prediction mode, the intra prediction mode angle, the size or shape of the current block (or the prediction block), etc. For example, if the intra prediction mode of the current block is a non-directional mode such as the DC mode or the planar mode, the offset may be applied to at least a part of the current block, whereas if the intra prediction mode of the current block is a directional mode, the offset may be set not to be applied to the current block. As another example, if the intra prediction mode of the current block is an intra prediction mode of a specific direction, the offset may be set to be applied to at least a part of the current block. Alternatively, whether to apply an offset to at least a portion of the current block may be determined by information decoded from the bitstream. For example, a syntax 'is_ predblock_refinement_flag' indicating whether to refine the first intra prediction image using the offset may be signaled through the bitstream. If the value of is_ predblock_refinement_flag is 1, refinement of the first intra prediction image may be performed using the offset in the current block, whereas if the value of is_ predblock_refinement_flag is 0, refinement of the first intra prediction image may not be performed in the current block. If refinement of the first intra prediction image is not performed, the first intra prediction image may be output as the final prediction result of the current block. To apply an offset to at least some area of the current block, an offset for the current block can be determined (S1620). The offset can be defined for each unit within the current block. Here, the unit can mean one sample, a line (e.g., a row or a column) composed of multiple samples, a sub-block including multiple lines, or a sub-block of a predetermined size. For example, by defining an offset for each sample within the first intra prediction image, and then adding or subtracting an offset corresponding to each sample to each sample, the second intra prediction image can be generated. The offset can be derived from a reference sample of the current block. Specifically, the offset can be derived based on a sum, difference, average, weighted operation (e.g., weighted average), median, maximum, or minimum value between multiple reference samples (e.g., two, three, or more reference samples). The reference sample used to derive the offset may include at least one of a reference sample at a fixed position or a reference sample determined depending on the position of the prediction sample (i.e., a sample of the first intra prediction image). As an example, the offset may be derived based on at least one of a reference sample adjacent to the upper left corner of the current block and a reference sample located on the same vertical line / horizontal line as the prediction sample to which the offset is to be applied. Alternatively, the number and / or positions of reference samples used to derive the offset may be variably determined based on the size and shape of the current block, the directionality or angle of the intra prediction mode, etc. The offset may be derived using a reference sample before a filter (e.g., an AIS filter) is applied. That is, the first intra prediction image may be generated using a reference sample on which filtering has been performed, while the second intra prediction image may be generated using a reference sample before a filter is applied. The offset may be derived based on multiple reference samples belonging to the same reference line, or may be derived based on reference samples included in different reference lines. For example, in the example illustrated in FIG. 15, an offset can be determined based on a difference value of a reference sample derived from the first reference line from a value of a reference sample derived from either the second reference line or the fourth reference line. Equations 7 and 8 show examples of deriving the intra refinement offset. The intra refinement offset h can be determined using any one of the equations shown in Equation 7. Alternatively, multiple intra refinement offsets f0, f1, f2, and f3 can be determined as shown in Equation 8. The correction of the current block can be performed based on any one of the multiple intra refinement offsets f0 to f3, or by applying different intra refinement offsets in units of a predetermined area. In Equations 7 and 8, refn (x=0~4) refers to reference line n. Also, (i n , j n ) represents the position of the reference sample included in the reference line n. The value of the reference sample used to derive the offset may be derived from a surrounding reconstruction sample for performing intra prediction of the current block, or may represent a separate reconstruction sample for calculating the offset. Here, the value of the separate reconstruction sample may be derived from a surrounding sample of the separate reconstruction sample or a sample at a predefined position. The value of the reference sample used to derive the offset may be a value before the in-loop filter is applied to the neighboring block, or may be a value after the in-loop filter is applied to the neighboring block. The offset can be obtained by applying a weight to the reference samples. For example, in mathematical expression 8, it is shown that the offset is obtained by applying a weight w to the difference between the reference samples. In addition, the offset can be obtained through a weighting operation that applies different weights to each reference sample. At this time, the weight applied to each reference sample can be determined based on the distance between the sample at a specific location in the current block and the reference line, the distance between the sample at a specific location and the reference sample, the distance between the reference samples, or the distance between the reference lines. The sample at a specific location may represent a sample at a predefined location in the current block, or a sample to which an offset is applied (hereinafter referred to as an 'offset application target sample' or a 'correction target sample'). The sample at a predefined location may include at least one of a sample adjacent to the left border of the current block, a sample adjacent to the upper border of the current block, or a sample adjacent to the upper left corner of the current block. For example, the weight may be determined in proportion to the distance between a sample at a specific location within the current block and a reference sample used in calculating the offset. For example, it is assumed that the offset is derived based on a reference sample located at the upper left corner of the current block, a reference sample located vertically to the sample to which the offset is applied, and a reference sample located horizontally to the sample to which the offset is applied. In this case, the weight applied to the reference sample located at the upper left corner of the current block may be obtained using at least one of the x-axis distance difference value or the y-axis distance difference value between the reference sample and the sample to which the offset is applied. In addition, the sample located vertically to the sample to which the offset is applied may be obtained based on the y-axis distance difference value between the reference sample and the sample to which the offset is applied, and the sample located horizontally to the sample to which the offset is applied may be obtained based on the x-axis distance difference value between the reference sample and the sample to which the offset is applied. Alternatively, the weights may be determined by adding / subtracting the distance between a sample at a specific location within the current block and a reference sample used in calculating the offset from a predefined value. As another example, the weights may be determined based on a ratio between a value representing the distance between a sample at a particular location within the current block and a reference sample and a value representing the size of the current block. The intra refinement offset may also be derived based on residual samples of neighboring reconstructed samples (i.e., reference samples) adjacent to the first intra prediction image. Here, the location of the neighboring reconstructed sample may be specified by at least one of a type, a directionality, or an angle of an intra prediction mode used to obtain the first intra prediction image. For example, the location of the neighboring reconstructed sample may be a reference sample located on an angular line of a directional intra prediction mode, or a line orthogonal to an angular line of the intra prediction mode. Alternatively, the value of the offset can be signaled on a per-slice, per-coding-unit or per-prediction-unit basis. Once the offset is determined, the offset can be applied to the first intra prediction image to generate a second intra prediction image that corrects the first intra prediction image (S1630). As an example, the following mathematical expression 9 shows an example of deriving a sample P'(x, y) of the second intra prediction image from a sample P(x, y) included in the first intra prediction image. As shown in the mathematical expression 8, the sample P'(i, j) of the second intra prediction image can be obtained by adding an offset f to the sample P(i, j) of the first intra prediction image. Contrary to what is shown in the mathematical expression 9, the second intra prediction image can also be obtained by subtracting an offset from the first intra prediction image. Alternatively, the second intra prediction image can be obtained based on a weighted operation of the first intra prediction image and the offset. In this case, the weight applied to the first intra prediction image and the offset can be determined according to the position of the sample to be corrected, etc. In the case of the directional intra prediction mode, since the prediction sample is generated by copying the reference sample adjacent to the current block, there is a problem that the prediction efficiency in areas far from the current block is reduced. That is, when the directional intra prediction mode is used, the residual value in an area relatively far from the boundary of the current block may contain a large amount of high-frequency components, which may cause a problem that the encoding / decoding efficiency is reduced. In order to solve the above problem, a method of correcting a prediction image in units of sub-blocks may be considered. Here, correcting a prediction image in units of sub-blocks may mean that correction of a prediction image is performed only in an area corresponding to a predetermined sub-block among the entire area of a current block, or may mean that an offset is defined in units of predetermined sub-blocks within the current block (i.e., different offsets are used in units of sub-blocks). When correcting a prediction image in units of sub-blocks, prediction accuracy in an area relatively far from a block boundary can be improved. Hereinafter, a method of correcting a prediction image in units of sub-blocks will be described in detail with reference to FIG. 17. FIG. 17 is a flowchart illustrating a method for correcting a predicted image in sub-block units according to one embodiment of the present invention. Referring to FIG. 17, for a current block, whether to correct (or update) a first intra prediction image in units of sub blocks can be determined (S1700). Whether correction for the first intra prediction image is performed in units of sub blocks can be determined based on at least one of the size, shape, type of intra prediction mode, directionality, or angle of the current block. Alternatively, whether to correct the first intra prediction image in units of sub blocks can be determined by a flag decoded from the bitstream. For example, a syntax 'is_sub_block_refinement_flag' indicating whether to update the first intra prediction image in units of sub blocks can be signaled through the bitstream. If the value of is_sub_block_refinement_flag is 1, correction of a first prediction sample using an offset is performed in a given sub block within the current block, whereas if the value of is_sub_block_refinement_flag is 0, correction in units of sub blocks may not be performed. Whether or not the first intra prediction image is corrected and the unit of correction can be determined hierarchically. For example, whether the unit of correction is a sub-block unit can be determined only when it is determined that correction of the first intra prediction image is performed. If it is determined that correction of the first intra prediction image is performed in units of sub blocks, the intra prediction pattern of the current block can be determined (S1710). Through the intra prediction pattern, the entire or partial area of the current block to which the offset is applied, the division shape of the current block, whether the offset is applied to a sub block included in the current block, or the offset size / sign assigned to each sub block can be determined. The intra prediction pattern of the current block may be selectively used as one of a plurality of patterns pre-defined in the decoder / decoder, and for this purpose, an index specifying the intra prediction pattern of the current block may be signaled from the bitstream. As another example, the intra prediction pattern of the current block may be determined based on a partition mode of a prediction unit or coding unit of the current block, a block size / shape, whether it is a directional intra prediction mode, an angle of the directional intra prediction mode, or an intra prediction pattern of a neighboring block. Whether an index indicating an intra prediction pattern of a current block is signaled can be determined by certain flag information signaled from the bitstream. For example, if the flag information indicates that an index indicating an intra prediction pattern of a current block is to be signaled from the bitstream, the intra prediction pattern of the current block can be determined based on the index decoded from the bitstream. In this case, the flag information can be signaled at at least one of a picture, a slice, or a block level. If the flag information indicates that an index representing an intra prediction pattern of the current block is not signaled from the bitstream, the intra prediction pattern of the current block may be determined based on a partition mode of a prediction unit or an encoding unit of the current block described above. For example, a form in which the current block is divided into sub-blocks may have the same form as a form in which an encoding block is divided into prediction units. When the intra prediction pattern of the current block is determined, an offset can be obtained in units of sub blocks (S1720). The offset can be signaled in units of slices, encoding units, or prediction units. As another example, the offset can be derived from neighboring samples (e.g., reference samples) of the current block. The offset can include at least one of offset size information or offset sign information. In this case, the offset size information can fall within an integer range greater than or equal to 0. Once the offset is determined, the first intra prediction image can be corrected for each sub-block to generate a second intra prediction image (S1730). The second intra prediction image can be obtained by applying the offset to the first intra prediction image. For example, the second prediction sample can be obtained by adding or subtracting the offset to the first prediction sample. At this time, different offsets can be applied to the first intra prediction image for each sub-block. FIGS. 18 to 22 are drawings illustrating intra prediction patterns of a current block as an embodiment to which the present invention is applied. For example, in the example illustrated in FIG. 18, when the index is '0' or '1', the current block may be divided into upper and lower sub-blocks, while an offset may not be set for the upper sub-block and an offset 'f' may be set for the lower sub-block. Accordingly, in the upper sub-block, the first prediction sample (P(i,j)) may be used as is, and in the lower sub-block, a second prediction sample (P(i,j)+f or P(i,j)-f) generated by adding or subtracting an offset to the first prediction sample may be used. In this specification, 'unset' may mean a case where an offset is not assigned to a corresponding block, or may mean that an offset of '0' value is assigned. When the index is '2' or '3', the current block is divided into left and right sub-blocks, while the offset may not be set for the left sub-block and the offset 'f' may be set for the right sub-block. Accordingly, in the left sub-block, the first prediction sample (P(i,j)) may be used as is, and in the right sub-block, the second prediction sample (P(i,j)+f or P(i,j)-f) generated by adding or subtracting the offset to the first prediction sample may be used. The available intra prediction patterns may be limited in scope based on the intra prediction mode of the current block. For example, if the intra prediction mode of the current block is a vertical intra prediction mode or a prediction mode in a direction similar to the vertical intra prediction mode (e.g., if the intra prediction mode index is 22 to 30 among 33 directional prediction modes), only the intra prediction patterns that horizontally divide the current block (e.g., index 0 or index 1 in FIG. 18) can be applied to the current block. As another example, if the intra prediction mode of the current block is a horizontal intra prediction mode or a prediction mode in a direction similar to the horizontal intra prediction mode (for example, if the intra prediction mode index is 6 to 14 among 33 directional prediction modes), only the intra prediction pattern that vertically divides the current block (for example, index 2 or index 3 in FIG. 18) can be applied to the current block. Alternatively, the intra prediction pattern available to the current block may be determined based on whether the intra prediction mode of the current block is a non-directional mode. In Fig. 18, it is illustrated that one of the sub-blocks included in the current block has no offset set, and the other has an offset set. Whether to set an offset in a sub-block may also be determined based on information signaled for each sub-block. Alternatively, whether to set an offset to a sub-block may be determined based on a position of the sub-block, an index for identifying the sub-block within the current block, etc. For example, based on a predetermined boundary of the current block, an offset may not be set for a sub-block that borders the predetermined boundary, and an offset may be set for a sub-block that does not border the predetermined boundary. Here, the predetermined boundary may be determined based on the size, shape, or intra prediction mode of the current block. Assuming that a given boundary is the upper boundary of the current block, no offset is set for a sub-block that touches the upper boundary of the current block under the intra prediction pattern corresponding to the index '0' or '1', and an offset may be set for a sub-block that does not touch the upper boundary of the current block. Assuming that the given boundary is the left boundary of the current block, under the intra prediction pattern corresponding to the index '2' or '3', no offset is set for a sub-block that borders the left boundary of the current block, and an offset may be set for a sub-block that does not border the left boundary of the current block. In Fig. 18, it is assumed that one of the sub-blocks included in the current block has no offset set, and the other has an offset set. As another example, offsets of different values may be set for the sub-blocks included in the current block. Referring to Figure 19, an example in which different offsets are set for each sub-block will be described. Referring to FIG. 19, when the index is '0' or '1', an offset 'h' may be set for an upper sub-block within the current block, and an offset 'f' may be set for a lower sub-block within the current block. Accordingly, a second prediction sample (P(i,j)+h or P(i,j)-h) may be generated by adding or subtracting the offset 'h' to a first prediction sample in the upper sub-block, and a second prediction sample (P(i,j)+f or P(i,j)-f) may be generated by adding or subtracting the offset 'f' to the first prediction sample in the lower sub-block. Referring to FIG. 19, when the index is '2' or '3', an offset 'h' may be set for a left sub-block within the current block, and an offset 'f' may be set for a right sub-block within the current block. Accordingly, a second prediction sample (P(i,j)+h or P(i,j)-h) may be generated by adding or subtracting the offset 'h' to a first prediction sample in the left sub-block, and a second prediction sample (P(i,j)+f or P(i,j)-f) may be generated by adding or subtracting the offset 'f' to the first prediction sample in the right sub-block. Although FIGS. 18 and 19 illustrate that the current block is divided into two sub-blocks having the same size, the number of sub-blocks and / or the size of the sub-blocks included in the current block are not limited to the examples illustrated in FIGS. 18 and 19. The number of sub-blocks included in the current block may be three or more, and each sub-block may have a different size. When the number of available intra prediction patterns is plural, the available intra prediction patterns can be grouped into plural categories. In this case, the intra prediction pattern of the current block can be selected based on a first index for identifying a category and a second index for identifying an intra prediction pattern within the corresponding category. Referring to FIG. 20, an example in which the intra prediction pattern of the current block is determined based on the first index and the second index will be described. In the example illustrated in FIG. 20, the 12 intra prediction patterns can be classified into three categories, each of which includes four intra prediction patterns. For example, the intra prediction patterns corresponding to indices 0 to 3 can be classified into category 0, the intra prediction patterns corresponding to indices 4 to 7 can be classified into category 1, and the intra prediction patterns corresponding to indices 8 to 11 can be classified into category 2. The decoder can decode a first index from the bitstream to specify a category including at least one intra prediction pattern. In the example illustrated in FIG. 20, the first index can specify any one of categories 0, 1, and 2. Once a category is specified based on the first index, the intra prediction pattern of the current block can be determined based on the second index decoded from the bitstream. Once category 1 is specified by the first index, the second index can specify any one of the four intra prediction patterns (i.e., indexes 4 to 7) included in category 1. Although Fig. 20 shows that each category contains the same number of intra prediction patterns, each category does not necessarily have to contain the same number of intra prediction patterns. The number of available intra prediction patterns or the number of categories can be determined on a sequence or slice basis. Additionally, at least one of the number of available intra prediction patterns or the number of categories can be signaled via a sequence header or a slice header. As another example, the number of available intra prediction patterns and / or the number of categories may be determined based on the size of the prediction unit or coding unit of the current block. For example, if the size of the current block (e.g., the coding unit of the current block) is 64x64 or larger, the intra prediction pattern of the current block may be selected from among the six intra prediction patterns illustrated in FIG. 21. Alternatively, if the size of the current block (e.g., the coding unit of the current block) is smaller than 64x64, the intra prediction pattern of the current block may be selected from among the intra prediction patterns illustrated in FIG. 18, FIG. 19, or FIG. 20. In FIGS. 18 to 21, the sub-blocks included in each intra prediction pattern are illustrated as being rectangular. As another example, an intra prediction pattern having at least one different size or shape of the sub-blocks may be used. As an example, FIG. 22 is a diagram illustrating an example of an intra prediction pattern having different sizes and shapes of sub-blocks. The offset for each sub-block (e.g., the offset h, f, g or i of each sub-block as shown in FIGS. 18 to 22) may be decoded from the bitstream, or may be derived from neighboring samples adjacent to the current block (e.g., reference samples). For example, as described with reference to FIG. 16, an offset derived from at least one reference sample may be used for a sub-block, or an offset derived from reference samples included in different reference lines (see Equations 7 and 8) may be used for a sub-block. As another example, the offset of a sub-block may be determined by considering the distance from a sample at a specific location within the current block. As an example, the offset may be determined in proportion to a value representing the distance between a sample at a specific location within the current block and a sample at a specific location within the sub-block. As another example, the offset of a sub-block may be determined by adding or subtracting a value determined based on a distance between a sample located at a given location within the current block and a sample located at a given location within the sub-block from a preset value. As another example, the offset may be determined based on a ratio of a value representing the distance between a sample located at a given location within the current block and a sample located at a given location within the sub-block and a value representing the size of the current block. Here, the sample located at a given position within the current block may include a sample adjacent to the left boundary of the current block, a sample located at the upper boundary of the current block, or a sample adjacent to the upper left corner of the current block. Different offsets can be applied to each unit within a sub-block. Specifically, different offsets can be applied to each sample within a sub-block, or to each line (row or column) or multiple lines. Figures 23 and 24 are diagrams showing examples in which different offsets are applied to each unit within a sub-block. The left drawing of Fig. 23 is a drawing showing a case where different offsets are applied per row within a sub-block, and the right drawing is a drawing showing an example where different offsets are applied per column within a sub-block. As illustrated in Fig. 23, different offsets may be used for each line, such as offset f0 applied to the first line, offset f1 applied to the second line, offset f2 applied to the third line, and offset f3 applied to the fourth line. Here, f0 to f3 may be derived based on differential values between reference samples belonging to different reference lines, as described through mathematical expression 8. Alternatively, as illustrated in FIG. 24, the weight applied to the offset may be set differently depending on the location within the sub-block. For example, different offsets may be used for each line, such as offset h for the first line, offset 2h for the second line, offset 3h for the third line, and offset 4h for the fourth line. Here, h may be derived based on the differential value between reference samples belonging to different reference lines, as described through mathematical expression 7. FIG. 25 is a flowchart illustrating a process for obtaining a residual sample as an embodiment to which the present invention is applied. First, the residual coefficient of the current block can be obtained (S2510). The decoder can obtain the residual coefficient through a coefficient scanning method. For example, the decoder can perform coefficient scanning using a diagonal scan, a zigzag scan, an up-right scan, a vertical scan, or a horizontal scan, and as a result, obtain the residual coefficient in the form of a two-dimensional block. Dequantization can be performed on the residual coefficients of the current block (S2520). It can be determined whether to skip the inverse transform on the inverse quantized residual coefficients of the current block (S2530). Specifically, the decoder can determine whether to skip the inverse transform in at least one of the horizontal direction or the vertical direction of the current block. If it is determined to apply the inverse transform in at least one of the vertical or the horizontal direction of the current block, the residual sample of the current block can be obtained by inversely transforming the inverse quantized residual coefficients of the current block (S2540). Here, the inverse transform can be performed using at least one of DCT, DST, or KLT. If the inverse transformation is skipped in both the horizontal and vertical directions of the current block, the inverse transformation is not performed in the horizontal and vertical directions of the current block. In this case, the inverse quantized residual coefficients can be scaled by a preset value to obtain the residual sample of the current block (S2550). Omitting the inverse transformation in the horizontal direction means not performing the inverse transformation in the horizontal direction, but performing the inverse transformation in the vertical direction. In this case, scaling may be performed in the horizontal direction. Omitting the vertical inverse transformation means not performing the vertical inverse transformation, but performing the horizontal inverse transformation. In this case, scaling may be performed in the vertical direction. Depending on the partitioning form of the current block, it can be determined whether the inverse transform skip technique can be used for the current block. For example, if the current block is generated through binary tree-based partitioning, the inverse transform skip technique can be restricted from being used for the current block. Accordingly, if the current block is generated through binary tree-based partitioning, the residual sample of the current block can be obtained by inversely transforming the current block. In addition, if the current block is generated through binary tree-based partitioning, encoding / decoding of information indicating whether inverse transform is skipped (e.g., transform_skip_flag) can be omitted. Alternatively, if the current block is generated through binary tree-based partitioning, the inverse transform skip technique may be restricted to be allowed only in at least one of the horizontal direction and the vertical direction. Here, the direction in which the inverse transform skip technique is restricted may be determined based on information decoded from the bitstream, or may be adaptively determined based on at least one of the size of the current block, the shape of the current block, or the intra prediction mode of the current block. For example, if the current block is a non-square block whose width is greater than its height, the inverse transform skip technique can be allowed only for the vertical direction, and the use of the inverse transform skip technique can be restricted for the horizontal direction. That is, if the current block is 2NxN, the inverse transform is performed in the horizontal direction of the current block, and the inverse transform can be optionally performed in the vertical direction. On the other hand, if the current block is a non-square block whose height is greater than its width, the inverse transform skip technique can be allowed only for the horizontal direction, and the use of the inverse transform skip technique can be restricted for the vertical direction. That is, if the current block is Nx2N, the inverse transform is performed in the vertical direction of the current block, and the inverse transform can be optionally performed in the horizontal direction. Conversely to the above example, if the current block is a non-square block with a width greater than its height, the inverse skip technique may be allowed only for the horizontal direction, and if the current block is a non-square block with a height greater than its width, the inverse skip technique may be allowed only for the vertical direction. Information on whether to skip inverse transform in the horizontal direction or information indicating whether to skip inverse transform in the vertical direction can be signaled through the bitstream. For example, information indicating whether to skip inverse transform in the horizontal direction can be a 1-bit flag, 'hor_transform_skip_flag', and information indicating whether to skip inverse transform in the vertical direction can be a 1-bit flag, 'ver_transform_skip_flag'. The encoder can encode at least one of 'hor_transform_skip_flag' or 'ver_transform_skip_flag' according to the shape of the current block. In addition, the decoder can determine whether inverse transform in the horizontal direction or the vertical direction is skipped by using at least one of 'hor_transform_skip_flag' or 'ver_transform_skip_flag'. Depending on the partitioning form of the current block, the inverse transformation may be set to be skipped for one direction. For example, if the current block is generated through binary tree-based partitioning, the inverse transformation in the horizontal direction or the vertical direction may be skipped. That is, if the current block is generated through binary tree-based partitioning, it is possible to determine to skip the inverse transformation for at least one of the horizontal direction or the vertical direction for the current block without encoding / decoding information indicating whether the inverse transformation of the current block is skipped (e.g., transform_skip_flag, hor_transform_skip_flag, ver_transform_skip_flag). Although the above-described embodiment has been described based on a series of steps or a flow chart, this does not limit the chronological order of the invention, and may be performed simultaneously or in a different order as needed. In addition, each of the components (e.g., units, modules, etc.) constituting the block diagram in the above-described embodiment may be implemented as a hardware device or software, or a plurality of components may be combined to be implemented as a single hardware device or software. The above-described embodiment may be implemented in the form of program instructions that may be executed through various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program instructions, data files, data structures, etc., singly or in combination. Examples of the computer-readable recording medium include magnetic media such as hard disks, floppy disks, and magnetic tapes, optical recording media such as CD-ROMs and DVDs, magneto-optical media such as floptical disks, and hardware devices specifically configured to store and execute program instructions such as ROMs, RAMs, and flash memories. The above hardware device may be configured to operate as one or more software modules to perform processing according to the present invention, and vice versa. The present invention can be applied to an electronic device capable of encoding / decoding an image.
Claims
1. A step of determining the intra prediction mode of the current block; A step of deriving a reference sample from a neighboring sample of the current block; A step of obtaining a first prediction sample for the current block based on the intra prediction mode and the reference samples; a step of determining an offset for the first prediction sample; and An image decoding method, comprising the step of obtaining a second prediction sample by applying the offset to the first prediction sample.
2. In paragraph 1, A method for decoding an image, characterized in that whether to apply the offset to the first prediction sample is determined based on the intra prediction mode of the current block.
3. In paragraph 1, An image decoding method, characterized in that the above offset is determined based on a weighted sum of the multiple reference samples.
4. In paragraph 3, An image decoding method, characterized in that the weight applied to each of the above multiple reference samples is determined based on the distance from the first prediction sample.
5. In paragraph 3, An image decoding method, characterized in that the above multiple reference samples include a reference sample at a fixed position and a reference sample determined dependently on the position of the first prediction sample.
6. In paragraph 5, A method for decoding an image, characterized in that the reference sample at the fixed position includes a reference sample adjacent to the upper left corner of the current block, and the reference sample determined depending on the position of the first prediction sample includes at least one of a reference sample located on the same horizontal line as the first prediction sample or a reference sample located on the same vertical line as the first prediction sample.
7. In paragraph 3, An image decoding method, characterized in that each of the above multiple reference samples is included in a different reference line.
8. Step of determining the intra prediction mode of the current block; A step of deriving a reference sample from a neighboring sample of the current block; A step of obtaining a first prediction sample for the current block based on the intra prediction mode and the reference samples; a step of determining an offset for the first prediction sample; and A method for encoding an image, comprising the step of obtaining a second prediction sample by applying the offset to the first prediction sample.
9. In paragraph 8, A video encoding method, characterized in that whether to apply the offset to the first prediction sample is determined based on the intra prediction mode of the current block.
10. In paragraph 8, A video encoding method, characterized in that the above offset is determined based on a weighted sum of the multiple reference samples.
11. In Article 10, An image encoding method, characterized in that the weight applied to each of the above multiple reference samples is determined based on the distance from the first prediction sample.
12. In paragraph 11, A video encoding method, characterized in that the above multiple reference samples include a reference sample at a fixed position and a reference sample determined dependently on the position of the first prediction sample.
13. In paragraph 12, A video encoding method, characterized in that the reference sample at the fixed position includes a reference sample adjacent to the upper left corner of the current block, and the reference sample determined depending on the position of the first prediction sample includes at least one of a reference sample located on the same horizontal line as the first prediction sample or a reference sample located on the same vertical line as the first prediction sample.
14. In paragraph 11, A method for encoding an image, wherein each of the above multiple reference samples is included in a different reference line.
15. An image decoding device including an intra prediction unit that determines an intra prediction mode of a current block, derives reference samples from neighboring samples of the current block, obtains a first prediction sample for the current block based on the intra prediction mode and the reference samples, determines an offset for the first prediction sample, and obtains a second prediction sample by applying the offset to the first prediction sample.