Image encoding methods and digital storage media
Patent Information
- Application Number
- VN1202607381
- Authority / Receiving Office
- VN · VN
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2019-03-11
- Filing Date
- 2019-10-11
- Publication Date
- 2026-10-15
AI Technical Summary
Current video compression technologies face challenges in efficiently encoding and decoding high-resolution and ultra-high-resolution stereoscopic video content, particularly in deriving effective intra prediction modes and configuring reference pixels for improved coding efficiency.
The proposed method generates a prediction block based on a pre-defined prediction mode, performs intra prediction by determining an intra reference line and mode from candidate groups, and applies transformations like DCT-2, DST-7, or DST-8, to enhance coding efficiency and accuracy.
This approach improves coding efficiency by adaptively deriving intra prediction modes and transforming residual samples, leading to more accurate intra prediction and better compression of high-resolution video content.
Smart Images

Figure VN1202607381_0
Abstract
Description
Video encoding / decoding method and device The present invention relates to a video signal processing method and apparatus. Market demand for high-resolution video is increasing, and consequently, there is a need for technology that can efficiently compress high-resolution video. In response to these market demands, the Moving Picture Expert Group (MPEG) of ISO / IEC and the Video Coding Expert Group (VCEG) of ITU-T jointly formed the Joint Collaborative Team on Video Coding (JCT-VC), completed the development of the High Efficiency Video Coding (HEVC) video compression standard in January 2013, and have been actively conducting research and development on next-generation compression standards. Video compression is broadly composed of intra-frame prediction (or intra prediction), inter-frame prediction (or inter prediction), transformation, quantization, entropy coding, and in-loop filters. Meanwhile, along with the increasing demand for high-resolution video, the demand for stereoscopic video content as a new video service is also increasing. Discussions are underway regarding video compression technologies to effectively provide high-resolution and ultra-high-resolution stereoscopic video content. The present invention aims to provide an image encoding / decoding method and apparatus with improved efficiency. The present invention aims to provide an intermode-specific prediction method and apparatus. The present invention aims to provide a method and apparatus for inducing an intra-prediction mode. The present invention aims to provide a method and apparatus for configuring a reference pixel for intra-prediction. The present invention aims to provide an intra-prediction / correction method and apparatus. The present invention aims to provide a multi-type based conversion method and apparatus. The present invention aims to provide a computer-readable recording medium that stores a bitstream generated by an image encoding method and device. The image encoding / decoding method and apparatus according to the present invention can generate a prediction block of a current block based on a predefined prediction mode, generate a transformation block of the current block through a predetermined transformation, and restore the current block based on the prediction block and the transformation block. In the image encoding / decoding method and apparatus according to the present invention, the step of generating the prediction block may include the step of determining an intra reference line of the current block, the step of determining an intra prediction mode of the current block from a predetermined group of candidates, and the step of performing an intra prediction of the current block based on the determined intra reference line and the intra prediction mode. In the image encoding / decoding method and apparatus according to the present invention, the candidate group is divided into a first candidate group and a second candidate group, the first candidate group is configured in a default mode pre-defined in the decoding device, and the second candidate group may be configured with a plurality of MPM candidates. In the image encoding / decoding method and apparatus according to the present invention, the intra prediction mode of the current block can be induced by selectively using either the first candidate group or the second candidate group. In the image encoding / decoding method and apparatus according to the present invention, the default mode may be at least one of a Planar mode, a DC mode, a vertical mode, a horizontal mode, a vertical mode, or a diagonal mode. In the image encoding / decoding method and apparatus according to the present invention, the plurality of MPM candidates may include at least one of the intra-prediction mode (candIntraPredMode), candIntraPredMode-n, and candIntraPredMode+n of a surrounding block. In the image encoding / decoding method and apparatus according to the present invention, the plurality of MPM candidates may include at least one of DC mode, vertical mode, horizontal mode, (vertical mode-m), (vertical mode+m), (horizontal mode-m), or (horizontal mode+m). In the image encoding / decoding method and apparatus according to the present invention, the determined intra-prediction mode may be changed by adding or subtracting a predetermined offset. In the image encoding / decoding method and apparatus according to the present invention, the application of the offset may be selectively performed based on at least one of the size, shape, segmentation information, value of the intra-prediction mode, or component type of the current block. In the image encoding / decoding method and apparatus according to the present invention, the step of performing intra prediction may include the step of dividing the current block into a plurality of sub-blocks using a vertical line or a horizontal line, and the step of performing intra prediction sequentially in units of the sub-blocks. In the image encoding / decoding method and apparatus according to the present invention, the number of sub-blocks belonging to the current block may be variably determined based on at least one of the size or shape of the current block. In the image encoding / decoding method and apparatus according to the present invention, the step of performing intra prediction may include a step of correcting a predicted value according to the intra prediction based on a predetermined reference sample and weights. In the image encoding / decoding method and apparatus according to the present invention, each of the reference sample and weight may be determined based on at least one of the size of the current block, the position of the current sample to be corrected, or the intra-prediction mode of the current block. In the image encoding / decoding method and apparatus according to the present invention, the conversion can be performed by selectively using at least one of DCT-2, DST-7, or DCT-8. A digital storage medium according to the present invention can store a video bitstream generated according to the aforementioned video encoding method / device. The present invention can provide an efficient intra-prediction mode induction method and apparatus. The present invention can improve encoding efficiency by configuring an adaptive reference sample. The present invention can improve the accuracy of intra prediction through correction of intra prediction. The present invention can improve the encoding efficiency of residual samples by performing not only multi-type based conversion but also additional conversion. According to the present invention, a computer-readable recording medium for storing a bitstream generated by an image encoding method / device according to the present invention may be provided. FIG. 1 is a block diagram showing an image encoding device according to the present invention. FIG. 2 is a block diagram showing an image decoding device according to the present invention. FIGS. 3 to 5 illustrate a method of dividing a picture into a plurality of blocks as an embodiment to which the present invention is applied. FIG. 6 schematically illustrates the process of restoring the current block as an embodiment to which the present invention is applied. FIG. 7 illustrates an inter prediction method as an embodiment to which the present invention is applied. FIGS. 8 to 10 illustrate an affine inter prediction method as an embodiment to which the present invention is applied. FIGS. 11 and 12 illustrate a merge mode-based inter-prediction method as an embodiment to which the present invention is applied. FIG. 13 illustrates an intra-prediction process as an embodiment to which the present invention is applied. FIG. 14 illustrates a method for determining the intra-reference line of the current block as an embodiment to which the present invention is applied. FIGS. 15 to 17 illustrate a signaling method of a second flag as an embodiment to which the present invention is applied. FIGS. 18 to 21 illustrate a method for changing an induced intra-prediction mode as an embodiment to which the present invention is applied. FIG. 22 illustrates a sub-partition-based intra-prediction method as an embodiment to which the present invention is applied. FIGS. 23 and 24 are embodiments to which the present invention is applied, and relate to a method for correcting a predicted value based on intra-prediction. FIGS. 25 to 27 illustrate a method for encoding / decoding residual images based on conversion and / or quantization as an embodiment to which the present invention is applied. FIGS. 28 and 29 illustrate a method of applying an in-loop filter to a restored image as an embodiment to which the present invention is applied. The image encoding / decoding method and apparatus according to the present invention can generate a prediction block of a current block based on a predefined prediction mode, generate a transformation block of the current block through a predetermined transformation, and restore the current block based on the prediction block and the transformation block. In the image encoding / decoding method and apparatus according to the present invention, the step of generating the prediction block may include the step of determining an intra reference line of the current block, the step of determining an intra prediction mode of the current block from a predetermined group of candidates, and the step of performing an intra prediction of the current block based on the determined intra reference line and the intra prediction mode. In the image encoding / decoding method and apparatus according to the present invention, the candidate group is divided into a first candidate group and a second candidate group, the first candidate group is configured in a default mode pre-defined in the decoding device, and the second candidate group may be configured with a plurality of MPM candidates. In the image encoding / decoding method and apparatus according to the present invention, the intra prediction mode of the current block can be induced by selectively using either the first candidate group or the second candidate group. In the image encoding / decoding method and apparatus according to the present invention, the default mode may be at least one of a Planar mode, a DC mode, a vertical mode, a horizontal mode, a vertical mode, or a diagonal mode. In the image encoding / decoding method and apparatus according to the present invention, the plurality of MPM candidates may include at least one of the intra-prediction mode (candIntraPredMode), candIntraPredMode-n, and candIntraPredMode+n of a surrounding block. In the image encoding / decoding method and apparatus according to the present invention, the plurality of MPM candidates may include at least one of DC mode, vertical mode, horizontal mode, (vertical mode-m), (vertical mode+m), (horizontal mode-m), or (horizontal mode+m). In the image encoding / decoding method and apparatus according to the present invention, the determined intra-prediction mode may be changed by adding or subtracting a predetermined offset. In the image encoding / decoding method and apparatus according to the present invention, the application of the offset may be selectively performed based on at least one of the size, shape, segmentation information, value of the intra-prediction mode, or component type of the current block. In the image encoding / decoding method and apparatus according to the present invention, the step of performing intra prediction may include the step of dividing the current block into a plurality of sub-blocks using a vertical line or a horizontal line, and the step of performing intra prediction sequentially in units of the sub-blocks. In the image encoding / decoding method and apparatus according to the present invention, the number of sub-blocks belonging to the current block may be variably determined based on at least one of the size or shape of the current block. In the image encoding / decoding method and apparatus according to the present invention, the step of performing intra prediction may include a step of correcting a predicted value according to the intra prediction based on a predetermined reference sample and weights. In the image encoding / decoding method and apparatus according to the present invention, each of the reference sample and weight may be determined based on at least one of the size of the current block, the position of the current sample to be corrected, or the intra-prediction mode of the current block. In the image encoding / decoding method and apparatus according to the present invention, the conversion can be performed by selectively using at least one of DCT-2, DST-7, or DCT-8. A digital storage medium according to the present invention can store a video bitstream generated according to the aforementioned video encoding method / device. Embodiments of the present invention are described in detail with reference to the drawings attached to this specification so that those skilled in the art can easily implement the invention. However, the present invention may be embodied in various different forms and is not limited to the embodiments described herein. Furthermore, in order to clearly explain the invention in the drawings, parts unrelated to the explanation have been omitted, and similar parts throughout the specification are denoted by similar reference numerals. Throughout this specification, when a part is described as being 'connected' to another part, this includes not only cases where they are directly connected, but also cases where they are electrically connected with other elements in between. Furthermore, throughout this specification, when a part is described as 'comprising' a certain component, this means that, unless specifically stated otherwise, it does not exclude other components but may include additional components. Additionally, terms such as "first," "second," etc., may be used to describe various components, but said components should not be limited by said terms. These terms are used solely for the purpose of distinguishing one component from another. Additionally, in the embodiments relating to the device and method described herein, some components of the device or some steps of the method may be omitted. Also, the order of some components of the device or some steps of the method may be changed. Additionally, other components or other steps may be inserted into some components of the device or some steps of the method. In addition, some components or steps of the first embodiment of the present invention may be added to or replace some components or steps of the second embodiment of the present invention. Furthermore, the components shown in the embodiments of the present invention are depicted independently to represent different characteristic functions and do not imply that each component consists of separate hardware or a single software unit. That is, for convenience of explanation, each component is described by listing it as a separate component, and at least two of the components may be combined to form a single component, or a single component may be divided into multiple components to perform a function. Such integrated and separated embodiments of each component are also included within the scope of the present invention as long as they do not deviate from the essence of the invention. In this specification, a block may be expressed in various ways such as a unit, region, unit, partition, etc., and a sample may be expressed in various ways such as a pixel, pel, pixel, etc. Hereinafter, embodiments of the present invention will be described in more detail with reference to the attached drawings. In describing the present invention, redundant descriptions of identical components are omitted. FIG. 1 is a block diagram showing an image encoding device according to the present invention. Referring to FIG. 1, a conventional image encoding device (100) may include a picture splitting unit (110), a prediction unit (120, 125), a conversion unit (130), a quantization unit (135), a reordering unit (160), an entropy encoding unit (165), an inverse quantization unit (140), an inverse conversion unit (145), a filter unit (150), and a memory (155). The picture splitting unit (110) can split the 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). In the following embodiments of the present invention, the term "coding unit" may be used to mean a unit that performs coding, or a unit that performs decoding. A prediction unit may be divided into at least one square or rectangle of the same size within a single coding unit, or it may be divided such that one of the prediction units within a single 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 into multiple prediction units NxN. The prediction unit (120, 125) may include an inter prediction unit (120) that performs inter prediction or inter-frame prediction, and an intra prediction unit (125) that performs intra prediction or intra-frame prediction. It may determine whether to use inter prediction or perform intra prediction for a prediction unit, and determine specific information according to each prediction method (e.g., intra prediction mode, motion vector, reference picture, etc.). The residual value (residual block) between the generated prediction block and the original block may be input to the conversion unit (130). In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded together with the residual value in the entropy encoding unit (165) and transmitted to the decoder. 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 partially encoded area 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. In the reference picture interpolation unit, reference picture information is received from memory (155), and pixel information of integer pixels or less can be generated from the reference picture. In the case of luminance pixels, a DCT-based 8-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 4 pixel units. In the case of chrominance signals, a DCT-based 4-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 8 pixel units. 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 calculate motion vectors. Based on the interpolated pixels, the motion vector can have motion vector values in units of 1 / 2 or 1 / 4 pixels. The motion prediction unit can predict the current prediction unit by using different motion prediction methods. Various methods such as Skip Mode, Merge Mode, AMVP Mode, Intra Block Copy Mode, and Affine Mode can be used as motion prediction methods. The intra prediction unit (125) can generate a prediction unit based on reference pixel information around the current block, which is pixel information within the current picture. If the surrounding block of the current prediction unit is a block that has performed inter prediction, and the reference pixel is a pixel that has performed inter prediction, the reference pixel included in the block that has performed inter prediction can be replaced with the reference pixel information of the surrounding intra prediction block. That is, if the reference pixel is not available, the unavailable reference pixel information can be replaced with at least one of the available reference pixels. Additionally, a residual block can be generated that includes residual value information, which is the difference between the prediction unit that performed the prediction based on the prediction unit generated in the prediction unit (120, 125) and the original block of the prediction unit. The generated residual block can be input to the conversion unit (130). In the transformation unit (130), the residual block containing 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 into the frequency domain in the conversion unit (130). The quantization coefficient may vary depending on the block or the importance of the image. The values produced by the quantization unit (135) may be provided to the inverse quantization unit (140) and the reordering unit (160). The reordering unit (160) can perform reordering of coefficient values for quantized residual values. The reordering unit (160) can convert two-dimensional block-shaped coefficients into one-dimensional vector forms through a coefficient scanning method. For example, the reordering unit (160) can convert the coefficients from DC to high-frequency range coefficients into one-dimensional vector forms by scanning using a Zig-Zag Scan method. Depending on the size of the conversion unit and the intra-prediction mode, a vertical scan that scans two-dimensional block-shaped coefficients in the column direction or a horizontal scan that scans two-dimensional block-shaped coefficients in the row direction may be used instead of the Zig-Zag Scan. That is, depending on the size of the conversion unit and the intra-prediction mode, it can be determined whether to use a Zig-Zag Scan, a vertical scan, or a horizontal scan. The entropy encoding unit (165) can perform entropy encoding based on the values calculated by the reordering 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). In this regard, the entropy encoding unit (165) can encode residual value coefficient information of the encoding unit from the reordering unit (160) and the prediction unit (120, 125). Additionally, according to the present invention, it is possible to signal and transmit information indicating that motion information is derived and used in the decoder side, and information regarding the technique used for deriving motion information. In the inverse quantization unit (140) and inverse transformation unit (145), the values quantized in the quantization unit (135) are inverse quantized, and the values transformed in the transformation unit (130) are inverse transformed. The residual value generated in the inverse quantization unit (140) and inverse transformation unit (145) can be combined with the prediction unit predicted 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 Adaptive Loop Filter (ALF). The deblocking filter can remove block distortion caused by boundaries between blocks in the restored picture. The offset correction unit can correct the offset from the original image on a pixel-by-pixel basis for the image that has undergone deblocking. To perform offset correction for a specific picture, a method may be used in which pixels included in the image are divided into a certain number of regions, the region to be offset is determined, and the offset is applied to that region, or a method may be used in which the offset is applied by considering the edge information of each pixel. Adaptive Loop Filtering (ALF) may be performed based on a value obtained by comparing the filtered restored image with the original image. After dividing the pixels included in the image into a predetermined group, a filter to be applied to that group is determined, and filtering may be performed differentially for each group. 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 the present invention. Referring to FIG. 2, the image decoder (200) may include an entropy decoder (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 using the reverse procedure of the video encoder. The entropy decoding unit (210) can perform entropy decoding in the opposite procedure to that which the entropy encoding unit of the image encoder performed. 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 correspondence with the method performed in the image 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 of reordering the entropy-decoded bitstream in the encoding unit in the entropy decoding unit (210). The coefficients expressed in the form of a one-dimensional vector can be reordered by restoring them to the form of two-dimensional block coefficients. The inverse quantization unit (220) can perform inverse quantization based on the coefficient values of the rearranged block and the quantization parameters provided by the encoder. The inverse transform unit (225) can perform inverse transforms, i.e., inverse DCT, inverse DST, and inverse KLT, on the transforms, i.e., DCT, DST, and KLT, performed by the transform unit 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 transformation technique (e.g., DCT, DST, KLT) can be selectively performed according to multiple 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 the prediction block generation information provided by the entropy decoding unit (210) and the previously decoded block or picture information provided by the memory (245). As described above, when performing intra prediction or intra-frame prediction identical to the operation in the video encoder, if the size of the prediction unit and the size of the transform unit are the same, intra prediction for the prediction unit is performed based on the pixels to the left of the prediction unit, the pixels to the top left, and the pixels to the top; however, if the size of the prediction unit and the size of the transform unit are different when performing intra prediction, intra prediction can be performed using reference pixels based on the transform unit. Additionally, intra prediction using NxN partitioning only for the minimum encoding unit may also 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 receives various information, such as prediction unit information input from the entropy decoding unit (210), prediction mode information of the intra prediction method, and motion prediction related information of the inter prediction method, distinguishes the prediction unit in the current encoding unit, and determines whether the prediction unit performs inter prediction or intra prediction. On the other hand, if the encoder (100) does not transmit motion prediction related information for the inter prediction, but instead transmits information indicating that motion information is derived and used from the decoder side and information regarding the technique used for deriving motion information, the prediction unit determination unit determines whether the inter prediction unit (230) performs prediction based on the information transmitted from the encoder (100). The inter prediction unit (230) can perform inter prediction for the current prediction unit based on information included in at least one picture, either a previous picture or a subsequent picture, of the current picture containing the current prediction unit, using information required for inter prediction of the current prediction unit provided by the video encoder. To perform inter prediction, based on the encoding unit, it can determine whether the motion prediction method of the prediction unit included in the corresponding encoding unit is a Skip Mode, Merge Mode, AMVP Mode, Intra Block Copy Mode, or Affine Mode. The intra prediction unit (235) can generate a prediction block based on pixel information within the current picture. If the prediction unit is a prediction unit that has performed intra prediction, it can perform intra prediction based on the intra prediction mode information of the prediction unit provided by the image encoder. The intra prediction unit (235) may include an Adaptive Intra Smoothing (AIS) 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 based on the prediction mode of the current prediction unit. AIS filtering can be performed on the reference pixels of the current block using the prediction mode of the prediction unit and AIS filter information 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 generate a reference pixel of an integer value or less by interpolating the reference pixel when the prediction mode of the prediction unit is a prediction unit that performs intra-prediction based on the pixel value interpolated from the reference pixel. If 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 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 regarding whether a deblocking filter has been applied to the corresponding block or picture can be received from the video encoder, and if a deblocking filter has been applied, information regarding whether a strong filter or a weak filter has been applied. The deblocking filter of the video decoder receives information related to the deblocking filter provided by the video encoder and can perform deblocking filtering on the corresponding block. The offset correction unit can perform offset correction on the restored image based on the type of offset correction and offset value information applied to the image during encoding. ALF can be applied to the encoding unit based on information on whether ALF is applied and ALF coefficient information provided by the encoder. This ALF information can be provided included in a specific parameter set. The memory (245) can store the 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 the output unit. FIGS. 3 to 5 illustrate a method of dividing a picture into a plurality of blocks as an embodiment to which the present invention is applied. Referring to Fig. 3, the picture is divided into a plurality of basic coding units (Coding Tree Unit, hereinafter CTU). The size of a CTU can be defined on a picture or video sequence basis, and each CTU is configured so as not to overlap with other CTUs. For example, the CTU size can be set to 128x128 for the entire sequence, and on a picture basis, any one of 128x128 to 256x256 can be selected and used. Coding blocks / coding units (hereinafter CUs) can be generated by hierarchically dividing the CTU. Prediction and transformation can be performed at the coding unit level, and it serves as the basic unit for determining the prediction coding mode. The prediction coding mode indicates a method for generating a prediction image, and examples include intra prediction (hereinafter intra prediction), inter prediction (hereinafter inter prediction), or combined prediction. Specifically, for example, a prediction block can be generated at the coding unit level using at least one of the prediction coding modes among intra prediction, inter prediction, or combined prediction. In the inter prediction mode, if the reference picture points to the current picture, the prediction block can be generated based on the region within the current picture that has already been decoded. This can be included in inter prediction because the prediction block is generated using the reference picture index and motion vector. Intra prediction is a method of generating a prediction block using information from the current picture, inter prediction is a method of generating a prediction block using information from another picture that has already been decoded, and composite prediction is a method of using a combination of inter prediction and intra prediction. In composite prediction, some of the multiple sub-regions constituting a single coding block may be encoded / decoded using inter prediction, and the remaining regions may be encoded / decoded using intra prediction. Alternatively, composite prediction may perform inter prediction first on multiple sub-regions and perform intra prediction secondarily. In this case, the prediction value of the coding block may be derived by taking a weighted average of the prediction value based on inter prediction and the prediction value based on intra prediction. The number of sub-regions constituting a single coding block may be two, three, four, or more, and the shape of the sub-regions may be a rectangle, a triangle, or other polygon. Referring to Fig. 4, the CTU can be partitioned into a quad tree, binary tree, or triple tree. The partitioned blocks can be further partitioned into a quad tree, binary tree, or triple tree. The method of dividing the current block into four square partitions is called quad tree partitioning, the method of dividing the current block into two square or non-square partitions is called binary tree partitioning, and the method of dividing the current block into three partitions is defined as binary tree partitioning. Binary partitioning in the vertical direction (SPLIT_BT_VER in Fig. 4) is called vertical binary tree partitioning, and binary tree partitioning in the horizontal direction (SPLIT_BT_HOR in Fig. 4) is defined as horizontal binary tree partitioning. Triple partitioning in the vertical direction (SPLIT_TT_VER in Fig. 4) is called vertical triple tree partitioning, and triple tree partitioning in the horizontal direction (SPLIT_TT_HOR in Fig. 4) is defined as horizontal triple tree partitioning. The number of partitions is called the partitioning depth, and the maximum partitioning depth can be set differently for each sequence, picture, subpicture, slice, or tile, and can be set to have different partitioning depths depending on the partitioning tree type (quad tree / binary tree / triple tree), and can signal a syntax indicating this. Using methods such as quad tree partitioning, binary tree partitioning, or triple tree partitioning, the coding units of the leaf nodes can be configured by further partitioning the partitioned coding units, or the coding units of the leaf nodes can be configured without further partitioning. Referring to FIG. 5, coding units can be configured by hierarchically dividing a single CTU, and coding units can be divided using at least one of binary tree partitioning, quad tree partitioning, or triple tree partitioning. This method is defined as multi tree partitioning. A coding unit created by partitioning an arbitrary coding unit with partitioning depth k is called a sub-coding unit, and the partitioning depth becomes (k+1). A coding unit with partitioning depth k that contains a sub-coding unit with partitioning depth (k+1) is called a super-coding unit. The partitioning type of the current coding unit may be restricted depending on the partitioning type of the parent coding unit and / or the partitioning type of the coding units surrounding the current coding unit. Here, the partitioning type indicates an indicator that shows which partitioning method was used: binary tree partitioning, quad tree partitioning, or triple tree partitioning. FIG. 6 schematically illustrates the process of restoring the current block as an embodiment to which the present invention is applied. Referring to FIG. 6, a prediction block of the current block can be generated based on a pre-defined prediction mode in the encoding / decoding device (S600). In video encoding / decoding, predicted images can be generated in multiple ways, and the method of generating predicted images is called the predictive encoding mode. The prediction coding mode may consist of an intra prediction coding mode, an inter prediction coding mode, a current picture reference coding mode, or a combined prediction mode. Inter-predictive coding mode is defined as a predictive coding mode that generates a predictive block (predicted image) of the current block using information from the previous picture, and intra-predictive coding mode is defined as a predictive coding mode that generates a predictive block using samples adjacent to the current block. A predictive block can also be generated using an already restored image of the current picture, which is defined as the current picture reference mode or intra-block copy mode. Predicted blocks may be generated using at least two prediction coding modes among the inter-predicted coding mode, the intra-predicted coding mode, or the current picture reference coding mode, and this is defined as a combined prediction mode. The inter-predicted coding mode will be examined in detail with reference to FIGS. 7 through 12. The intra-predicted coding mode will be examined in detail with reference to FIGS. 13 through 24. Referring to FIG. 6, a transformation block of the current block can be generated through a predetermined transformation (S610). A transformation block may be generated based on at least one of n transformation types predefined in the encoding / decoding device. n may be an integer of 1, 2, 3, 4, or more. As the transformation types, DCT2, DCT8, DST7, transformation skip mode, etc., may be used. Only one identical transformation type may be applied to the vertical and horizontal directions of a block, or different transformation types may be applied to each of the vertical and horizontal directions. To this end, a flag indicating whether one identical transformation type is applied may be used. The flag may be signaled by the encoding device. Additionally, the above-mentioned transformation type may be determined based on information signaled by the encoding device or based on a predetermined encoding parameter. Here, the encoding parameter may refer to at least one of the block size, shape, intra-prediction mode, or component type (e.g., luminance, chrominance). The block size may be expressed as width, height, ratio of width to height, product of width to height, sum / difference of width and height, etc. For example, if the current block size is greater than a predetermined threshold value, the horizontal transformation type may be determined as a first transformation type (e.g., DCT2), and the vertical transformation type may be determined as a second transformation type (e.g., DST7). The threshold value may be an integer of 0, 4, 8, 16, 32, or greater. A method for determining the transformation type will be examined with reference to FIG. 25. Meanwhile, the residual coefficient according to the present invention may be obtained by performing a second transformation after the first transformation. The second transformation may be performed on the residual coefficient of a portion of the current block. In this case, the decoding device may obtain a transformed block of the current block by performing a second inverse transformation on the portion of the current block and performing a first inverse transformation on the current block including the portion of the inverse transformed. This will be examined with reference to FIGS. 26 and 27. Referring to FIG. 6, the current block can be restored based on the prediction block and the transformation block (S620). A predetermined in-loop filter may be applied to the restored current block. The in-loop filter may include at least one of a deblocking filter, a sample adaptive offset (SAO) filter, or an adaptive loop filter (ALF), which will be examined with reference to FIGS. 28 and FIGS. 29. FIG. 7 illustrates an inter prediction method as an embodiment to which the present invention is applied. The method of generating a predicted block (predicted image) of a block in the current picture using information from the previous picture is defined as inter-predict coding mode. For example, a predicted image can be generated based on colocated blocks of the same location in the previous picture, or a predicted block (predicted image) can be generated based on a specific block of the previous picture. Here, a specific block can be derived from a motion vector. A block at the same location represents a block of the corresponding picture that has the same position and size as the current block and the top-left sample, as shown in FIG. 7. The corresponding picture can be identified from syntax such as a reference picture reference. In inter-predictive encoding mode, prediction blocks can be generated by considering the movement of objects. For example, if it is known in which direction and by how much an object in the previous picture has moved in the current picture, a prediction block (prediction image) can be generated based on a block that considers movement in the current block, and this is defined as a motion prediction block. In the current block, a motion prediction block or a residual block can be generated by differencing the corresponding prediction block. If movement occurs in an object, using a motion prediction block instead of the corresponding prediction block can improve compression performance by reducing the energy of the residual block. The method of using motion prediction blocks in this way is called motion-compensated prediction, and most inter-prediction coding uses motion-compensated prediction. A value indicating the direction and degree of movement of an object in the previous picture is called a motion vector. Motion vectors with different pixel precisions can be used in units of sequence, picture, sub-picture, slice, tile, brick, CTU, or CU. For example, the pixel precision of a motion vector in a specific block may be at least one of 1 / 16, 1 / 8, 1 / 4, 1 / 2, 1, 2, 4, or 8. Depending on the inter-prediction coding mode described below, the types and / or number of available pixel precision candidates may differ. For example, in the case of the affine inter-prediction method, k pixel precisions are available, and in the case of the inter-prediction method using translation motion, i pixel precisions are available. In the case of the current picture reference mode, j pixel precisions are available. Here, k, i, and j may be natural numbers 1, 2, 3, 4, 5, or greater. However, k may be smaller than i, and i may be smaller than j. An affine inter prediction method may use at least one pixel precision of 1 / 16, 1 / 4, or 1, and an inter prediction method using translation motion (e.g., merge mode, AMVP mode) may use at least one pixel precision of 1 / 4, 1 / 2, 1, or 4. A current picture reference mode may use at least one pixel precision of 1, 4, or 8. The inter prediction mode may optionally use an inter prediction method using translation motion and an affine inter prediction method using affine motion. Below, we will examine this with reference to FIGS. 8 to 12. FIGS. 8 to 10 illustrate an affine inter prediction method as an embodiment to which the present invention is applied. There are many cases where the movement of a specific object in a video does not appear linearly. For example, in a video where affine motion is used, such as camera zoom-in, zoom-out, rotation, and affine transformations that enable transformation into arbitrary forms as shown in Fig. 8, if only translation motion vectors are used to represent the movement of the object, the movement of the object cannot be effectively represented, and encoding performance may be reduced. Affine motion can be expressed as shown in the following mathematical formula 1. Representing affine motion using a total of six parameters is effective for videos with complex motion, but encoding efficiency may decrease because a large number of bits are used to encode the affine motion parameters. Accordingly, affine motion can be simplified and expressed using four parameters, and this is defined as the 4-parameter affine motion model. Equation 2 represents affine motion using four parameters. A 4-parameter affine motion model may include motion vectors at two control points of the current block. The control points may include at least one of the top-left corner, top-right corner, or bottom-left corner of the current block. For example, as shown on the left side of FIG. 9, the 4-parameter affine motion model may be determined by a motion vector sv0 at the top-left sample (x0,y0) of the coding unit and a motion vector sv1 at the top-right sample (x1,y1) of the coding unit, and sv0 and sv1 are defined as affine seed vectors. Hereinafter, the affine seed vector sv0 located at the top-left is assumed to be the first affine seed vector, and the affine seed vector sv1 located at the top-right is assumed to be the second affine seed vector. In a 4-parameter affine motion model, it is also possible to replace one of the first and second affine seed vectors with the affine seed vector located at the bottom left. The 6-parameter affine motion model is an affine motion model in which the motion vector sv2 of the residual control point (e.g., sample (x2, y2) at the bottom left) is added to the 4-parameter affine motion model as shown on the right side of FIG. 9. Hereinafter, the affine seed vector sv0 located at the top left is assumed to be the first affine seed vector, the affine seed vector sv1 located at the top right is assumed to be the second affine seed vector, and the affine seed vector sv2 located at the bottom left is assumed to be the third affine seed vector. Information regarding the number of parameters for expressing affine motion may be encoded in a bitstream. For example, a flag indicating whether to use 6-parameters and a flag indicating whether to use 4-parameters may be encoded in at least one of a picture, sub-picture, slice, tile, brick, coding unit, or CTU. Accordingly, either a 4-parameter affine motion model or a 6-parameter affine motion model may be selectively used in a given unit. Motion vectors can be derived for each sub-block of a coding unit using an affine seed vector as shown in Fig. 10, and this is defined as an affine sub-block vector. An affine sub-block vector can be derived as shown in the following mathematical equation 3. Here, the reference sample position (x, y) of the sub-block may be a sample located at the corner of the block (e.g., top-left sample) or a sample where at least one of the x-axis or y-axis is the center (e.g., center sample). Motion compensation can be performed at the coding unit level or at the sub-block level within the coding unit using affine sub-block vectors, and this is defined as the affine inter-prediction mode. In Equation 3, (x1-x0) can have a value equal to the width of the coding unit. FIGS. 11 and 12 illustrate a merge mode-based inter-prediction method as an embodiment to which the present invention is applied. The motion information (motion vector, reference picture index, etc.) of the current coding unit can be derived from the motion information of surrounding blocks without being encoded. The motion information of any of the surrounding blocks can be set as the motion information of the current coding unit, and this is defined as merge mode. The surrounding blocks used in merge mode may be blocks adjacent to the current coding unit (blocks touching the boundary of the current coding unit), such as merge candidate indices 0 to 4 of FIG. 11, or may be non-adjacent blocks, such as merge candidate indices 5 to 26 of FIG. 11. Alternatively, they may be non-adjacent blocks, such as merge candidate indices 5 to 34 of FIG. 12. If the distance of a merge candidate to the current block exceeds a predefined threshold, it can be set as unavailable. For example, a predefined threshold can be set to the height of the CTU (ctu_height) or ctu_height+N, and this is defined as the merge candidate availability threshold. That is, the y-axis coordinate of the merge candidate (y i The difference between ) and the y-axis coordinate (y0) of the top-left sample of the current coding unit (hereinafter, sample based on the current coding unit), i.e., (y i - If y0) is greater than the merge candidate availability threshold, the merge candidate can be set as unavailable. Here, N is a predefined offset value. Specifically, for example, N can be set to 16 or ctu_height. FIG. 13 illustrates an intra-prediction process as an embodiment to which the present invention is applied. Referring to FIG. 13, the intra-reference line of the current block can be determined (S1300). An intra-reference line may refer to a surrounding area referenced for intra prediction of the current block. The surrounding area may include at least one of a pixel line adjacent to the current block or a pixel line not adjacent to the current block. Any one of a plurality of pixel lines located around the current block may be selected and used as an intra-reference line. This will be examined with reference to FIG. 14. Referring to FIG. 13, the intra prediction mode of the current block can be determined (S1310). The intra prediction mode of the current block may be determined as any one of p pre-defined intra prediction modes in the encoding / decoding device. p may be 33, 67, or more. The pre-defined intra prediction modes may be divided into a candidate group and a non-candidate group. The encoding / decoding device may select either the candidate group or the non-candidate group and derive the intra prediction mode of the current block from the selected group. The selection may be performed based on a flag (hereinafter referred to as the first flag) indicating whether the intra prediction mode of the current block is derived from the candidate group. For example, if the first flag is the first value, the candidate group may be used, and if not, the non-candidate group may be used. Specifically, when the first flag is the first value, the intra prediction mode of the current block may be determined based on a candidate group (candModeList) containing at least one MPM candidate and an MPM index. The MPM index may be information specifying any one of the MPM candidates belonging to the candidate group. The MPM index may be signaled only when multiple MPM candidates belong to the candidate group. On the other hand, if the first flag is the second value (i.e., if there is no MPM candidate in the candidate group that is identical to the intra prediction mode of the current block), the intra prediction mode of the current block can be determined based on signaled residual mode information. The residual mode information can specify any one of the remaining modes, excluding the MPM candidate, to the encoding / decoding device. Below, we will examine the method for determining the candidate group. To increase the coding efficiency of the current coding unit's intra-prediction mode, the intra-prediction mode of surrounding coding units may also be utilized. There is a high probability that the intra prediction mode of the surrounding blocks and the intra prediction mode of the current block have the same or similar modes. The intra prediction mode of the current coding unit can be encoded using the Most Probable Mode (MPM) mode, which encodes whether it is the same as any one of the intra prediction modes of the surrounding blocks. In the MPM mode, compression efficiency can be improved by encoding the MPM index instead of directly encoding the intra prediction mode. The surrounding blocks may include at least one of the left surrounding block (surrounding block A) or the upper surrounding block (surrounding block B) of the current block. If the intra-prediction mode of the current coding unit is not one of the MPM modes, the value of the current coding unit's intra-prediction mode can be encoded. A candidate group may consist of N predefined MPM candidates. N can be an integer of 1, 2, 3, 4, 5, 6, or more. Below, we will examine how to construct 6 MPM candidates. [CASE 1] The candidate group may consist of at least one of the following: an intra-pred mode of surrounding block A (candIntraPredModeA), a non-directional intra-pred mode that does not have a value equal to candIntraPredModeA (DC or PLANAR mode), a vertical mode (INTRA_ANGULAR50), a horizontal mode (INTRA_ANGULAR18), or a diagonal mode (at least one of INTRA_ANGULAR2, INTRA_ANGULAR34, or INTRA_ANGULAR66). Specifically, for example, candModeList[0] can be set to candIntraPredModeA, and candModeList[1] can be set to the INTRA_DC value if candIntraPredModeA is INTRA_PLANAR, and to the INTRA_PLANAR value if candIntraPredModeA is not INTRA_PLANAR, and candModeList
[0002] INTRA_ANGULAR50, candModeList
[0003] is INTRA_ANGULAR18, candModeList
[0004] is INTRA_ANGULAR34, candModeList
[0005] Each can be set to INTRA_ANGULAR2. [CASE 2] If candIntraPredA and the intra-predation mode (candIntraPredB) of the surrounding block B are the same, and candIntraPredA and candIntraPredB are greater than or equal to 2, the candidate group may include at least one of candIntraPredA, INTRA_PLANAR, INTRA_DC, candIntraPredA-1, candIntraPredA+1, or a mode perpendicular to candIntraPredA. Specifically, for example, candModeList[0] can be set to candIntraPredModeA, candModeList[1] can be set to INTRA_PLANAR, candModeList
[0002] canTRA_DC, candModeList
[0003] candIntraPredModeA - 1 (i.e., 2 + ( ( candIntraPredModeA + 62 ) % 65 )), candModeList
[0004] candIntraPredModeA + 1 (i.e., 2 + ( ( candIntraPredModeA - 1 ) % 65 ) ), and candModeList
[0005] can be set to a mode perpendicular to candIntraPredA (i.e., candModeList
[0005] = 2 + ( ( candIntraPredModeA + 94) % 65 ) ). [CASE 3] If candIntraPredModeA and candIntraPredModeB are not the same, candModeList
[0000] and candModeList
[0001] can be set to candIntraPredModeA and candIntraPredModeB, respectively. If both candIntraPredModeA and candIntraPredModeB are directional modes, at least one of candModeList
[0002] or candModeList
[0003] can be set to non-directional mode. For example, candModeList
[0002] and candModeList
[0003] can be set to PLANAR mode and DC mode, respectively. Meanwhile, at least one of candModeList
[0004] or candModeList
[0005] can be determined based on a size comparison between candIntraPredModeA and candIntraPredModeB. For example, if candIntraPredModeA is greater than candIntraPredModeB, candModeList
[0004] may be led to a mode with 1 subtracted from the maximum value candIntraPredModeA, and candModeList
[0005] may be led to a mode with 1 added to the maximum value candIntraPredModeA. However, if the difference between candIntraPredModeA and candIntraPredModeB is greater than or equal to a predetermined threshold value, candModeList
[0004] may be led to a mode with 1 or 2 subtracted from the maximum value candIntraPredModeA, and candModeList
[0005] may be led to a mode with 1 or 2 added to the maximum value candIntraPredModeA. The threshold value may be any natural number in the range of 1 to 64. For example, the threshold value may be set to 1 or 2, or to 62, 63, or 64. [CASE 4] If either candIntraPredModeA or candIntraPredModeB is greater than or equal to 2 and the other is less than 2, the MPM candidate may be set to at least one of candIntraModeMax, INTRA_PLANAR / INTRA_DC, candIntraModeMax-1, candIntraModeMax+1, candIntraModeMax-2, candIntraModeMax+2, or a mode perpendicular to candIntraModeMax. Here, the candIntraModeMax value represents the larger value between candIntraPredModeA and candIntraPredModeB. The candIntraModeMin value may be set to the smaller value between candIntraPredModeA and candIntraPredModeB. Specifically, for example, candModeList[2] can be set to INTRA_DC if candIntraPredModeMin is INTRA_PLNAR, and candModeList
[0003] can be set to candIntraPredModeMax - 1 (i.e., 2 + ( ( candIntraPredModeMax + 62 ) % 65 )), candModeList
[0004] candIntraPredModeMax + 1 (i.e., 2 + ( ( candIntraPredModeMax - 1 ) % 65 ) ), and candModeList
[0005] can be set to a mode perpendicular to candIntraPredMax (i.e., candModeList
[0005] = 2 + ( ( candIntraPredModeMax + 94) % 65 ) ). However, in the aforementioned embodiments, the index assigned to the MPM candidate is merely an example and does not limit the position within the candidate group. Therefore, it goes without saying that the arrangement of the MPM candidate within the candidate group can be performed in a different order of priority than that of the aforementioned embodiments. The aforementioned candidate group may be divided into m candidate groups. m may be an integer of 2, 3, 4 or more. For the convenience of explanation, it is assumed that the candidate group is divided into a first candidate group and a second candidate group. The encoding / decoding device may select either a first candidate group or a second candidate group. The selection may be performed based on a flag (hereinafter referred to as the second flag) that specifies whether the intra prediction mode of the current block belongs to the first candidate group or the second candidate group. For example, if the second flag is the first value, the intra prediction mode of the current block is derived from the first candidate group, and if not, the intra prediction mode of the current block is derived from the second candidate group. Meanwhile, the second flag may be signaled only when the first flag described above is the first value. Additionally, the second flag may be signaled only when the intra-reference line of the current block is determined to be an adjacent intra-reference line. If the current block refers to a non-adjacent pixel line, the MPM candidate of the first candidate group may be restricted from being used. Alternatively, conversely, if the intra-prediction mode of the current block is derived from the first candidate group according to the second flag, the current block may be restricted from referring to a non-adjacent pixel line. The signaling method of the first flag will be examined with reference to FIGS. 15 to 17. Here, the first candidate group may consist of a pre-defined default mode. The default mode may be at least one of a directional mode or a non-directional mode. For example, the directional mode may include at least one of a vertical mode, a horizontal mode, or a diagonal mode. The non-directional mode may include at least one of a planar mode or a DC mode. A first candidate group may consist of r non-directional modes or only directional modes. r may be an integer of 1, 2, 3, 4, 5, or more. r may be a fixed value pre-agreed upon by the encoding / decoding device, or it may be determined variably based on a predetermined encoding parameter. If the first candidate group includes multiple default modes, an index specifying one of the multiple default modes may be signaled. The default mode corresponding to the signaled index may be set as the intra-prediction mode of the current block. On the other hand, if the first candidate group consists of a single default mode, the index is not signaled, and the intra-prediction mode of the current block may be set as the default mode of the first candidate group. Meanwhile, the second candidate group may include multiple MPM candidates. However, the second candidate group may be limited not to include default modes belonging to the first candidate group. The number of MPM candidates may be 2, 3, 4, 5, 6, or more. The number of MPM candidates may be a fixed value pre-agreed upon by the encoding / decoding device, or may be determined variably based on encoding parameters. MPM candidates may be derived based on the intra-prediction mode of a neighboring block adjacent to the current block. A neighboring block may be a block adjacent to at least one of the left, top, top-left, bottom-left, or top-right sides of the current block. Specifically, MPM candidates can be determined by considering whether the intra-prediction mode of the left block (candIntraPredModeA) and the intra-prediction mode of the top block (candIntraPredModeB) are identical, and whether candIntraPredModeA and candIntraPredModeB are non-directional modes. [CASE 1] For example, if candIntraPredModeA and candIntraPredModeB are identical and candIntraPredModeA is not a non-directional mode, the MPM candidates for the current block may include at least one of candIntraPredModeA, (candIntraPredModeA-n), (candIntraPredModeA+n), or a non-directional mode. Here, n may be 1, 2, or an integer greater than or equal to 1. The non-directional mode may include at least one of Planar mode or DC mode. For example, the MPM candidates for the current block may be determined as shown in Table 1 below. The index in Table 1 specifies the position or priority of the MPM candidates, but is not limited thereto. indexMPM Candidate0candIntraPredModeA12 + ( ( candIntraPredModeA + 61 ) % 64 )22 + ( ( candIntraPredModeA - 1 ) % 64 )32 + ( ( candIntraPredModeA + 60 ) % 64 )42 + ( ( candIntraPredModeA % 64 ) [CASE 2] Alternatively, if candIntraPredModeA and candIntraPredModeB are not identical and neither candIntraPredModeA nor candIntraPredModeB is a non-directional mode, the MPM candidates for the current block may include at least one of candIntraPredModeA, candIntraPredModeB, (maxAB-n), (maxAB+n), (minAB-n), (minAB+n), or a non-directional mode. Here, maxAB and minAB represent the maximum and minimum values among candIntraPredModeA and candIntraPredModeB, respectively, and n may be 1, 2, or an integer greater than or equal to 1. The non-directional mode may include at least one of Planar mode or DC mode. For example, the MPM candidates for the current block may be determined as shown in Table 2 below. The index in Table 2 specifies the position or priority of the MPM candidates, but is not limited thereto. Meanwhile, MPM candidates may be determined differently based on the difference between candIntraPredModeA and candIntraPredModeB. For example, if the difference between candIntraPredModeA and candIntraPredModeB falls within a predetermined threshold range, MPM candidate 1 of Table 2 is applied, and if not, MPM candidate 2 may be applied. Here, the threshold range may be any one of a first range greater than or equal to 62, a second range greater than or equal to 63, or a third range greater than or equal to 64. IndexMPM Candidate 1MPM Candidate 20candIntraPredModeAcandIntraPredModeA1candIntraPredModeBcandIntraPredModeB22 + ( ( minAB - 1 ) % 64 )2 + ( ( minAB + 61 ) % 64 )32 + ( ( maxAB + 61 ) % 64 )2 + ( ( minAB - 1 ) % 64 )42 + ( minAB % 64 )2 + ( ( maxAB + 61 ) % 64 ) However, if the difference between candIntraPredModeA and candIntraPredModeB is 1 or 2, instead of MPM candidate 2 in Table 2, an MPM candidate may be determined as shown in Table 3 below. For example, if the difference is 1, MPM candidate 3 may be applied, and if the difference is 2, MPM candidate 4 may be applied. Or, conversely, if the difference is 1, MPM candidate 4 may be applied, and if the difference is 2, MPM candidate 3 may be applied. IndexMPM Candidate 3MPM Candidate 40candIntraPredModeAcandIntraPredModeA1candIntraPredModeBcandIntraPredModeB22 + ( ( minAB + 61 ) % 64 )2 + ( ( minAB - 1 ) % 64 )32 + ( ( maxAB - 1 ) % 64 )2 + ( ( minAB + 61 ) % 64 )42 + ( (minAB + 60 ) % 64 )2 + ( ( maxAB - 1 ) % 64 ) In the aforementioned Tables 2 and 3, one of the MPM candidates is derived based on minAB, and the other is derived based on maxAB. However, this is not limited thereto, and an MPM candidate can be derived based on maxAB regardless of minAB, and conversely, can be derived based on minAB regardless of maxAB. [CASE 3] If candIntraPredModeA and candIntraPredModeB are not identical, and only one of candIntraPredModeA and candIntraPredModeB is an undirected mode, the MPM candidates for the current block may include at least one of maxAB, (maxAB-n), (maxAB+n), or undirected mode. Here, maxAB represents the maximum value between candIntraPredModeA and candIntraPredModeB, and n may be 1, 2, or an integer greater than or equal to 1. The undirected mode may include at least one of Planar mode or DC mode. For example, the MPM candidates for the current block may be determined as shown in Table 4 below. The index in Table 4 specifies the position or priority of the MPM candidates, but is not limited thereto. IndexMPM Candidate0maxAB12 + ( ( maxAB + 61 ) % 64 )22 + ( ( maxAB - 1 ) % 64 )32 + ( ( maxAB + 60 ) % 64 )42 + ( maxAB % 64 ) [CASE 4] If candIntraPredModeA and candIntraPredModeB are not identical and both candIntraPredModeA and candIntraPredModeB are non-directional modes, the MPM candidates for the current block may include at least one of non-directional mode, vertical mode, horizontal mode, (vertical mode-m), (vertical mode+m), (horizontal mode-m), or (horizontal mode+m). Here, m may be an integer of 1, 2, 3, 4, or more. The non-directional mode may include at least one of Planar mode or DC mode. For example, the MPM candidates for the current block may be determined as shown in Table 5 below. The indices in Table 5 specify the position or priority of the MPM candidates, but are not limited thereto. For example, index 1 may be assigned to horizontal mode, or the largest index may be assigned. Additionally, the MPM candidate may include at least one of diagonal modes (e.g., mode 2, mode 34, mode 66), (diagonal mode-m), or (diagonal mode+m). IndexMPM Candidate 0INTRA_DC 1Vertical Mode 2Horizontal Mode 3(Vertical Mode-4) 4(Vertical Mode+4) The IntraPredMode decrypted through the aforementioned process can be changed based on a predetermined offset. The application of the above offset may be selectively performed based on at least one of the block attributes, namely size, shape, partition information, partition depth, value of intra-prediction mode, or component type. Here, the block may refer to the current block and / or surrounding blocks of the current block. The above-mentioned division information may include at least one of first information indicating whether the current block is divided into a plurality of sub-blocks, second information indicating the division direction (e.g., horizontal or vertical), or third information regarding the number of divided sub-blocks. The above-mentioned division information may be encoded and signaled by an encoding device. Alternatively, a portion of the above-mentioned division information may be variably determined by a decoder based on the attributes of the aforementioned block, or may be set to a fixed value pre-defined by the encoding / decoding device. For example, if the first information is a first value, the current block is divided into multiple sub-blocks, and if not, the current block may not be divided into multiple sub-blocks (NO_SPLIT). If the current block is divided into multiple sub-blocks, the current block may be horizontally divided (HOR_SPLIT) or vertically divided (VER_SPLIT) based on the second information. In this case, the current block may be divided into k sub-blocks. Here, k may be an integer of 2, 3, 4, or greater. Alternatively, k may be limited to powers of 2 such as 1, 2, 4, etc. Or, for a block where at least one of the width or height of the current block is 4 (e.g., 4x8, 8x4), k is set to 2, and otherwise, k may be set to 4, 8, or 16. If the current block is non-divided (NO_SPLIT), k may be set to 1. The current block may be divided into sub-blocks having the same width and height, or into sub-blocks having different widths and heights. Regardless of the attributes of the aforementioned block, the current block may be divided into NxM block units (e.g., 2x2, 2x4, 4x4, 8x4, 8x8, etc.) that are pre-agreed to the encoding / decoding device. The above offset may be applied only when the current block size is less than or equal to a predetermined threshold value (T1). Here, the threshold value (T1) may represent the maximum block size to which the offset is applied. Alternatively, it may be applied only when the current block size is greater than or equal to a predetermined threshold value (T2). In this case, the threshold value (T2) may represent the minimum block size to which the offset is applied. The above threshold value may be signaled through a bitstream. Alternatively, it may be variably determined by the decoder based on at least one of the aforementioned block attributes, or it may be a fixed value pre-agreed upon by the encoding / decoding device. Alternatively, the above offset may be applied only when the shape of the current block is non-square. For example, if the following conditions are satisfied, a predetermined offset (e.g., 65) may be added to the IntraPredMode of the current block. - nW is greater than nH - IntraPredMode is greater than or equal to 2 - IntraPredMode is less than (whRatio>1) ? (8+2*whRatio) : 8 Here, nW and nH represent the width and height of the current block, respectively, and whRatio can be set to Abs(Log2(nW / nH)). Alternatively, if the following conditions are satisfied, a predetermined offset (e.g., 67) may be subtracted from the IntraPredMode of the current block. - nH is greater than nW - IntraPredMode is less than or equal to 66 - IntraPredMode is greater than (whRatio>1) ? (60-2*whRatio) : 60 As described above, the final IntraPredMode can be determined by adding or subtracting an offset from the IntraPredMode of the current block, taking into account the attributes of the current block. However, this is not limited thereto, and the application of the offset may be performed in the same or similar manner by taking into account the attributes of the sub-blocks belonging to the current block. Changes to the IntraPredMode will be examined with reference to FIGS. 18 to 21. Referring to FIG. 13, an intra prediction of the current block can be performed based on the determined intra reference line and the intra prediction mode (S1320). Specifically, intra prediction may be performed at the current block level or at a predetermined sub-block level constituting the current block. The intra prediction at the sub-block level will be examined with reference to FIG. 22. In addition, the predicted value based on the intra prediction above can be corrected. The correction process is performed based on a predetermined reference pixel and weights, and this will be examined with reference to FIGS. 23 and FIGS. 24. FIG. 14 illustrates a method for determining the intra-reference line of the current block as an embodiment to which the present invention is applied. Referring to FIG. 14, at least one of a plurality of intra reference lines may be used for intra prediction of the current block. For example, an intra-prediction can be performed by selecting any one of a plurality of intra-reference lines composed of adjacent intra-reference lines and non-adjacent intra-reference lines, and this is defined as a multi-line intra-prediction method. The non-adjacent intra-reference line may include at least one of a first non-adjacent intra-reference line (non-adjacent intra-reference line index 1), a second non-adjacent intra-reference line (non-adjacent intra-reference line index 2), or a third non-adjacent intra-reference line (non-adjacent intra-reference line index 3). Only some of the non-adjacent intra-reference lines may be used. For example, only the first non-adjacent intra-reference line and the second non-adjacent intra-reference line may be used, or only the first non-adjacent intra-reference line and the third non-adjacent intra-reference line may be used. The intra-reference line index (intra_luma_ref_idx), which is the syntax specifying the reference line used for intra-prediction, can be signaled at the coding unit level. Specifically, when using adjacent intra-reference lines, the first non-adjacent intra-reference line, and the third non-adjacent intra-reference line, intra_luma_ref_idx may be defined as shown in Table 6 below. Intra_luma_ref_idx[x0][y0] Reference line used for intra prediction 0 Adjacent intra reference line 1 First non-adjacent reference line 2 Third non-adjacent reference line Alternatively, depending on the size, shape, or intra prediction mode of the current block, the location of the non-adjacent reference line may be specified. For example, a line index of 0 may represent an adjacent intra reference line, and a line index of 1 may represent a first non-adjacent intra reference line. Meanwhile, depending on the size, shape, or intra prediction mode of the current block, a line index of 2 may represent a second non-adjacent intra reference line or a third non-adjacent intra reference line. The available non-adjacent reference lines may also be determined based on the intra mode. For example, when using diagonal mode, at least one of the adjacent reference line, the first non-adjacent reference line, or the third non-adjacent reference line may be used, and in vertical or horizontal mode, at least one of the adjacent reference line, the first non-adjacent reference line, or the second non-adjacent reference line may be configured to be used. When using non-adjacent intra-reference lines, non-directed mode may be configured not to be used. That is, when using non-adjacent intra-reference lines, DC mode or Planar mode may be restricted from being used. Conversely, if the current block uses non-directed mode, the current block may be configured not to use non-adjacent intra-reference lines. For example, if the current block is in non-directed mode, the line index may not be signaled and may be implicitly set to 0. FIGS. 15 to 17 illustrate a signaling method of a second flag as an embodiment to which the present invention is applied. The second flag according to the present invention may indicate whether the intra prediction mode of the current block is derived from a first candidate group configured as a default mode. The default mode is as described above, and a detailed description thereof is omitted here. For convenience of explanation, the present embodiment assumes that the default mode is a non-directional mode. Referring to FIG. 15, a second flag (isNonDir_flag) indicating whether the intra prediction mode is a non-directional mode (DC or Planar mode) can be signaled via a bitstream. If the value of isNonDir_flag is 1, it indicates that the intra prediction mode is a non-directional mode, and a non-adjacent intra reference line can be set not to be used as an intra reference line. A flag (NonDirIdx) indicating whether the non-directional mode is a DC mode or a Planar mode can be signaled via a bitstream. NonDirIdx can be signaled only when the value of isNonDir_flag is 1. As shown in Fig. 15, intra_luma_ref_idx, which specifies an intra-reference line, can be signaled only when the isNonDir_flag value is 0. If isNonDir_flag is 1, only adjacent intra-reference lines are used for intra prediction, and non-adjacent intra-reference lines are not used. Referring to FIG. 16, when the intra prediction mode of a coding block is DC or Planar mode (i.e., when the isNorDir_flag value is 1), a flag (intra_subpartitions_mode_flag) indicating whether a subpartition-based intra prediction method is used can be signaled via the bitstream, and when the intra_subpartitions_mode_flag value is 1, a flag (intra_subpartitions_split_flag) indicating whether to split into vertical or horizontal partitions can be signaled. Specifically, the intra prediction mode can be parsed using a syntax table such as the following Table 7. coding_unit( x0, y0, cbWidth, cbHeight, treeType ) {Descriptorif( tile_group_type != I ) {if( treeType != DUAL_TREE_CHROMA )cu_skip_flag[ x0 ][ y0 ]ae(v)if( cu_skip_flag[ x0 ][ y0 ] = = 0 )pred_mode_flagae(v)}if( CuPredMode[ x0 ][ y0 ] = = MODE_INTRA ) {if( sps_pcm_enabled_flag &&cbWidth >= MinIpcmCbSizeY && cbWidth <= MaxIpcmCbSizeY &&cbHeight >= MinIpcmCbSizeY && cbHeight <= MaxIpcmCbSizeY )...ae(v)} else {if( treeType = = SINGLE_TREE | | treeType = = DUAL_TREE_LUMA ) {isNonDir_flagae(v)if(isNonDir_flag){NonDirIdxae(v)}if ( ( cbWidth <= MaxTbSizeY | | cbHeight <= MaxTbSizeY ) && ( cbWidth * cbHeight > MinTbSizeY * MinTbSizeY ))intra_subpartitions_mode_flag[ x0 ][ y0 ]ae(v)if( intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 1 && cbWidth <= MaxTbSizeY && cbHeight <= MaxTbSizeY )intra_subpartitions_split_flag[ x0 ][ y0 ]ae(v)}if(!isNonDir_flag && ( y0 % CtbSizeY ) > 0 )intra_luma_ref_idx[ x0 ][ y0 ]ae(v)if (intra_luma_ref_idx[ x0 ][ y0 ] = = 0 && ( cbWidth <= MaxTbSizeY | | cbHeight <=MaxTbSizeY ) && ( cbWidth * cbHeight > MinTbSizeY * MinTbSizeY ))intra_subpartitions_mode_flag[ )intra_subpartitions_split_flag[ x0 ][ y0 ]ae(v)if( intra_luma_ref_idx[ x0 ][ y0 ] = = 0 && intra_subpartitions_mode_flag[ intra_luma_mpm_flag[ x0 ][ y0 ] )intra_luma_mpm_idx[ x0 ][ y0 ]ae(v)elseintra_luma_mpm_remainder[ x0 ][ y0 ]ae(v)}if( treeType = = SINGLE_TREE | ]ae(v)}} else if( treeType != DUAL_TREE_CHROMA ) { / * MODE_INTER * / ...}} If the intra prediction mode of the coding unit is a non-directional prediction mode (e.g., Planar or DC mode), the subpartition-based intra prediction method may be configured not to be used. Referring to FIG. 17, when isNonDir_flag is 1, the intra_subpartitions_mode_flag and intra_subpartitions_split_flag may not be signaled during the encoding stage. Specifically, the intra prediction mode may be parsed using a syntax table such as the following Tables 8 and 9. coding_unit( x0, y0, cbWidth, cbHeight, treeType ) {Descriptorif( tile_group_type != I ) {if( treeType != DUAL_TREE_CHROMA )cu_skip_flag[ x0 ][ y0 ]ae(v)if( cu_skip_flag[ x0 ][ y0 ] = = 0 )pred_mode_flagae(v)}if( CuPredMode[ x0 ][ y0 ] = = MODE_INTRA ) {if( sps_pcm_enabled_flag && cbWidth >= MinIpcmCbSizeY && cbWidth <= MaxIpcmCbSizeY && cbHeight >= MinIpcmCbSizeY && cbHeight <= MaxIpcmCbSizeY )...ae(v)} else {if( treeType = = SINGLE_TREE | | treeType = = DUAL_TREE_LUMA ) {isNonDir_flagae(v)if(isNonDir_flag){NonDirIdxae(v)}if(!isNonDir_flag && ( y0 % CtbSizeY ) > 0 )intra_luma_ref_idx[ x0 ][ y0 ]ae(v)if (intra_luma_ref_idx[ x0 ][ y0 ] = = 0 && ( cbWidth <= MaxTbSizeY | | cbHeight <= MaxTbSizeY ) && ( cbWidth * cbHeight > MinTbSizeY * MinTbSizeY ))intra_subpartitions_mode_flag[ x0 ][ y0 ]ae(v)if( intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 1 && cbWidth <= MaxTbSizeY && cbHeight <= MaxTbSizeY )intra_subpartitions_split_flag[ x0 ][ y0 ]ae(v)if( intra_luma_ref_idx[ x0 ][ y0 ] = = 0 && intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 0 )intra_luma_mpm_flag[ x0 ][ y0 ]ae(v)if( intra_luma_mpm_flag[ x0 ][ y0 ] )intra_luma_mpm_idx[ x0 ][ y0 ]ae(v)elseintra_luma_mpm_remainder[ x0 ][ y0 ]ae(v)}if( treeType = = SINGLE_TREE | | treeType = = DUAL_TREE_CHROMA )intra_chroma_pred_mode[ x0 ][ y0 ]ae(v)}} else if( treeType != DUAL_TREE_CHROMA ) { / * MODE_INTER * / ...}}. coding_unit( x0, y0, cbWidth, cbHeight, treeType ) {Descriptorif( tile_group_type != I ) {if( treeType != DUAL_TREE_CHROMA )cu_skip_flag[ x0 ][ y0 ]ae(v)if( cu_skip_flag[ x0 ][ y0 ] = = 0 )pred_mode_flagae(v)}if( CuPredMode[ x0 ][ y0 ] = = MODE_INTRA ) {if( sps_pcm_enabled_flag &&cbWidth >= MinIpcmCbSizeY && cbWidth <= MaxIpcmCbSizeY &&cbHeight >= MinIpcmCbSizeY && cbHeight <= MaxIpcmCbSizeY )...ae(v)} else {if( treeType = = SINGLE_TREE | | treeType = = DUAL_TREE_LUMA ) {isNonDir_flagae(v)if(isNonDir_flag){NonDirIdxae(v)}if(!isNonDir_flag){intra_luma_mpm_flag[ x0 ][ y0 ]ae(v)if( intra_luma_mpm_flag[ x0 ][ y0 ] )intra_luma_mpm_idx[ x0 ][ y0 ]ae(v)if( ( y0 % CtbSizeY ) > 0 )intra_luma_ref_idx[ x0 ][ y0 ]ae(v)if (intra_luma_ref_idx[ x0 ][ y0 ] = = 0 && ( cbWidth <= MaxTbSizeY | | cbHeight <= MaxTbSizeY ) && ( cbWidth * cbHeight > MinTbSizeY * MinTbSizeY ))intra_subpartitions_mode_flag[ x0 ][ y0 ]ae(v)if( intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 1 && cbWidth <= MaxTbSizeY && cbHeight <= MaxTbSizeY )intra_subpartitions_split_flag[ x0 ][ y0 ]ae(v)}elseintra_luma_mpm_remainder[ x0 ][ y0 ]ae(v)}if( treeType = = SINGLE_TREE | | treeType = = DUAL_TREE_CHROMA )intra_chroma_pred_mode[ x0 ][ y0 ]ae(v)}} else if( treeType != DUAL_TREE_CHROMA ) { / * MODE_INTER * / ...}}. Alternatively, a second flag (intra_default_mode_flag) indicating whether the intra prediction mode of the current block is a pre-defined default mode can be signaled via the bitstream. If the value of intra_default_mode_flag is 1, it indicates that the intra prediction mode is the default mode. An index (intra_defualt_mode_idx) indicating which of the default modes is used can be signaled via the bitstream. intra_defualt_mode_idx can be signaled only when the value of intra_default_mode_flag is 1. intra_default_mode_flag can be signaled only when the value of intra_default_mode_flag is 0, which specifies the intra reference line. Conversely, intra_default_mode_flag can be signaled only when intra_luma_ref_idx is 0. If intra_default_mode_flag is 1, it may be restricted so that only adjacent intra reference lines are used for intra prediction. Specifically, the intra prediction mode can be parsed using a syntax table such as the following Table 10. coding_unit( x0, y0, cbWidth, cbHeight, treeType ) {Descriptorif( tile_group_type != I ) {if( treeType != DUAL_TREE_CHROMA )cu_skip_flag[ x0 ][ y0 ]ae(v)if( cu_skip_flag[ x0 ][ y0 ] = = 0 )pred_mode_flagae(v)}if( CuPredMode[ x0 ][ y0 ] = = MODE_INTRA ) {if( sps_pcm_enabled_flag &&cbWidth >= MinIpcmCbSizeY && cbWidth <= MaxIpcmCbSizeY &&cbHeight >= MinIpcmCbSizeY && cbHeight <= MaxIpcmCbSizeY )...ae(v)} else {if( treeType = = SINGLE_TREE | | treeType = = DUAL_TREE_LUMA ) {intra_default_mode_flagae(v)if(intra_default_mode_flag){intra_default_mode_idxae(v)}if(!intra_default_mode_flag && ( y0 % CtbSizeY ) > 0 )intra_luma_ref_idx[ x0 ][ y0 ]ae(v)if (intra_luma_ref_idx[ x0 ][ y0 ] = = 0 && ( cbWidth <= MaxTbSizeY | | cbHeight <= MaxTbSizeY ) && ( cbWidth * cbHeight > MinTbSizeY * MinTbSizeY ))intra_subpartitions_mode_flag[ x0 ][ y0 ]ae(v)if( intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 1 && cbWidth <= MaxTbSizeY && cbHeight <= MaxTbSizeY )intra_subpartitions_split_flag[ x0 ][ y0 ]ae(v)if(intra_luma_ref_idx[ x0 ][ y0 ] = = 0 && intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 0)intra_luma_mpm_flag[ ]ae(v)elseintra_luma_mpm_remainder[ x0 ][ y0 ]ae(v)}if( treeType = = SINGLE_TREE | | treeType = = DUAL_TREE_CHROMA )intra_chroma_pred_mode[ x0 ][ y0 ]ae(v)}} else if( treeType != DUAL_TREE_CHROMA ) { / * MODE_INTER * / ...}} For example, the default mode may be set to at least one of DC mode, Planar mode, Horizontal mode, or Vertical mode. As another example, the default mode may be set to at least one of DC mode, Planar mode, Horizontal mode, Vertical mode, or Diagonal mode (e.g., INTRA_ANGULAR2, INTRA_ANGULAR66). As another example, the default mode may be set to at least one of horizontal mode, vertical mode, and diagonal mode (e.g., INTRA_ANGULAR2, INTRA_ANGULAR66, INTRA_ANGULAR34). FIGS. 18 to 21 illustrate a method for changing an induced intra-prediction mode as an embodiment to which the present invention is applied. The prediction angle of the directional mode can be set between 45 degrees and -135 degrees as shown in Fig. 18. When performing intra prediction in a non-directional coding unit, a disadvantage may occur in that the current sample is predicted using an intra reference sample that is far from the current sample instead of an intra reference sample that is close to the current sample due to the pre-defined prediction angle. For example, as shown in the left figure of FIG. 19, in a coding unit where the width of the coding unit is greater than the height of the coding unit (hereinafter, horizontal coding unit), intra prediction can be performed from a distant sample L instead of a close sample T. As another example, as shown in the right figure of FIG. 19, in a coding unit where the height of the coding unit is greater than the width of the coding unit (hereinafter, vertical coding unit), intra prediction can be performed from a distant sample T instead of a close sample L. In a non-rectangular coding unit, intra prediction can be performed at a prediction angle that deviates from a pre-defined prediction angle, and this is called a wide-angle intra prediction mode. The wide angle intra prediction mode can have a prediction angle of (45-α) to (-135-β), and a prediction angle that deviates from the angle used in the existing intra prediction mode is called a wide angle angle. In the left figure of Fig. 19, sample A in the horizontal direction coding unit can be predicted from intra-reference sample T using a wide-angle intra-prediction mode. In the right figure of Fig. 19, sample A in the vertical coding unit can be predicted from intra-reference sample L using a wide-angle intra-prediction mode. Wide-angle intra prediction modes may also use N+20 intra prediction modes by adding 20 wide-angle angles to the existing N intra prediction modes. Specifically, for example, when using 67 intra modes, a total of 87 intra prediction modes can be used by adding wide-angle angles as shown in Table 11. predModeIntra-14-13-12-11-10-9-8-7-6-5-4-3-2-1234intraPredAngle5123412561711281028673645751453935322926predModeIntra567891011121314151617 18192021intraPredAngle232018161412108643210-1-2-3predModeIntra2223242526272829303132333435363738intraPredAngle-4-6-8-10-12-14-16-18-20-23 -26-29-32-29-26-23-20predModeIntra3940414243444546474849505152535455intraPredAngle-18-16-14-12-10-8-6-4-3-2-1012346predModeIntra565758596 0616263646566676869707172intraPredAngle810121416182023262932353945515764predModeIntra7374757677787980intraPredAngle7386102128171256341512 When using a wide-angle intra prediction mode, as shown in FIG. 20, the length of the upper intra reference sample can be set to (2W+1) and the length of the left intra reference sample can be set to (2H+1). When using wide-angle intra prediction, if the intra prediction mode of the wide-angle intra prediction mode is encoded, the number of intra prediction modes increases, which may lower the encoding efficiency. The wide-angle intra prediction mode can be encoded by replacing it with an existing intra prediction mode that is not used in wide-angle intra, and the replacement prediction mode is called the wide-angle replacement mode. Specifically, for example, when 35 intra prediction modes are used as shown in FIG. 21, wide-angle intra prediction mode 35 can be encoded as wide-angle alternative mode intra prediction mode 2, and wide-angle intra prediction mode 36 can be encoded as wide-angle alternative mode intra prediction mode 3. The alternative modes and the number of alternative modes can be set differently depending on the shape of the coding block or the ratio of the height to the width of the coding block. Specifically, for example, as shown in Tables 12 and 13, the alternative modes and the number of alternative modes can be set differently depending on the shape of the coding block. Table 12 shows the case where 35 intra prediction modes are used, and Table 13 shows the case where 67 intra prediction modes are used. ConditionReplaced Intra Prediction ModesW / H = 2Modes 2, 3, 4W / H > 2Modes 2, 3, 4, 5, 6W / H = 1NoneH / W = 1 / 2Modes 32, 33, 34H / W < 1 / 2Modes 30, 31, 32, 33, 34 ConditionReplaced Intradiction Prediction ModesW / H = 2Modes 2, 3, 4, 5, 6, 7W / H > 2Modes 2, 3, 4, 5, 6, 7, 8, 9, 10, 11W / H = 1NoneH / W = 1 / 2Modes 61, 62, 63, 64, 65, 66H / W < 1 / 2Modes 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 Alternatively, the types and number of replacement modes can be set differently depending on the shape of the coding block or the ratio of the coding block height to width. Specifically, for example, as shown in Table 14, the replacement modes and number can be set differently depending on the shape of the coding block. Table 14 shows the intra-predictive replacement modes used depending on the ratio of the width and height of the coding block. Aspect ratioReplaced intra prediction modesW / H == 16Modes 12, 13,14,15W / H == 8Modes 12, 13W / H == 4Modes 2,3,4,5,6,7,8,9,10,11W / H == 2Modes 2,3,4,5,6,7,W / H == 1NoneW / H == 1 / 2Modes 61,62,63,64,65,66W / H == 1 / 4Mode 57,58,59,60,61,62,63,64,65,66W / H == 1 / 8Modes 55, 56W / H == 1 / 16Modes 53, 54, 55, 56 FIG. 22 illustrates a sub-partition-based intra-prediction method as an embodiment to which the present invention is applied. Referring to FIG. 22, a coding unit can be divided into multiple sub-blocks, and the sub-blocks can be predicted / restored sequentially based on a predetermined priority order; this is referred to as a sub-partition-based intra-prediction method. The current sub-block can be predicted by referring to samples of previously restored sub-blocks within the coding unit. Here, the samples of the restored sub-blocks may be samples to which an in-loop filter has not been applied. The priority order may be either from left to right or from top to bottom. However, it is not limited thereto and may be determined from right to left or from bottom to top. Hereinafter, the coding unit may refer to the current block. In a sub-partition-based intra-prediction method, all sub-blocks within a coding unit may be restricted to using the same intra-prediction mode. Alternatively, in a sub-partition-based intra-prediction method, at least one intra-prediction mode among the sub-blocks within a coding unit may differ from other sub-blocks. For example, the intra-prediction mode of the n-th sub-block may be derived by adding / subtracting an offset from the intra-prediction mode of the (n-1)-th sub-block. The offset may be pre-defined in the encoder / decoder, or it may be derived based on the shape, size, and intra-prediction mode of the coding unit, and the shape and size of the sub-partition. Alternatively, information for determining the offset may be signaled via a bitstream. Alternatively, some of the multiple sub-blocks may use a directional mode, and the others may use a non-directional mode. Alternatively, one of the multiple sub-blocks may use a predefined default mode, and the other may use a non-default mode. In this case, a non-directional mode may be used in the second sub-block only if the directional mode of the first sub-block is a predefined intra-prediction mode. Alternatively, in a sub-partition-based intra prediction method, the intra prediction mode of sub-blocks within a coding unit may be selected from pre-defined candidates. Here, the pre-defined candidates may include at least one of a horizontal mode, a vertical mode, a diagonal mode (e.g., top-left, top-right, bottom-left intra prediction modes), and a non-directional mode. Alternatively, in a sub-partition-based intra-prediction method, the intra-prediction mode of sub-blocks within a coding unit can be derived only from MPM candidates. Alternatively, the use of a sub-partition-based intra-prediction method may be restricted depending on the intra-prediction mode of the coding unit. For example, if the intra-prediction mode of the coding unit is a non-directional mode (e.g., Planar or DC mode) or a pre-defined directional mode (e.g., horizontal, vertical, or diagonal mode), the sub-partition-based intra-prediction method may be configured not to be used. Alternatively, if the intra-prediction mode of the coding unit is an intra-prediction mode in which neighboring sub-blocks cannot be utilized as reference samples (e.g., diagonal mode or wide-angle intra-prediction mode), the sub-partition-based intra-prediction method may be configured not to be used. Alternatively, the use of the sub-partition-based intra-prediction method may be restricted depending on the size or shape of the coding unit. For example, if the ratio of the height to the width of the coding unit is greater than or equal to a threshold value, or if at least one of the width or height of the current block is less than or equal to a threshold value, the sub-partition-based intra-prediction method may be configured not to be used. Depending on the number / location of the intra-reference lines of the coding unit, the use of the sub-partition-based intra-prediction method may be restricted. For example, the sub-partition-based intra-prediction method may be used only when the location of the intra-reference line of the coding unit is an adjacent intra-reference line. Alternatively, the sub-partition-based intra-prediction method may be used only when the number of intra-reference lines of the coding unit is one. Different quantization parameter values may be used for each sub-block, or the difference between the quantization parameter value of the previous sub-block and the quantization parameter value of the current sub-block may be encoded. In other words, the quantization parameter of the current sub-block can be derived based on the encoded difference value and the quantization parameter of the previous sub-block. Sub-blocks (partitions) can be divided into vertical partitions and horizontal partitions. Vertical partitions are created by dividing coding blocks using at least one vertical line, and horizontal partitions are created by dividing coding blocks using at least one horizontal line. Coding units may be divided using only vertical lines or only horizontal lines. Alternatively, coding units may be divided using both vertical and horizontal lines. The number of sub-blocks can be determined based on the size / shape of the coding unit. For example, in a 4x4 coding unit, no sub-partitions are divided, in an 8x4 to 4x8 coding unit, two sub-partitions can be divided, and in other coding units, four partitions can be divided. Alternatively, information indicating the number, size, or shape of sub-blocks may be signaled via a bitstream. Depending on the number of partitions determined by the signaled information, the size or shape of the sub-blocks may be determined, or the number of sub-blocks may be determined depending on the size / shape of the sub-blocks determined by the signaled information. Referring to FIG. 22, the coding unit can be divided into vertical or horizontal partitions. A flag intra_subpartitions_mode_flag indicating whether to use a sub-partition-based intra prediction method in the coding block can be signaled via a bitstream. An intra-partition type flag (intra_subpartitions_split_flag) indicating whether to split into vertical or horizontal partitions can be transmitted via the bitstream. If the value of intra_subpartitions_split_flag is 1, it indicates that subpartitions can be formed by splitting into horizontal partitions, and if the value of intra_subpartitions_split_flag is 0, it indicates that subpartitions can be formed by splitting into vertical partitions. FIGS. 23 and 24 are embodiments to which the present invention is applied, and relate to a method for correcting a predicted value based on intra-prediction. Correction of the predicted value according to the present invention may be performed based on a predetermined reference sample and weights. Here, the reference sample and weights may be determined based on the position of a sample within the current block (hereinafter referred to as the current sample) that is the subject of correction. Additionally, the position of the reference sample may be determined based on the intra-prediction mode of the current block. After generating an intra prediction image, the intra prediction image can be corrected pixel by pixel based on pixel position, and this is defined as a position-dependent prediction combination (PDPC). (Example 1) Referring to FIG. 23, a final intra-prediction image can be generated using weighted prediction of the current sample and one or more surrounding samples (samples located within the intra-reference line). The sample-specific weights used for weighted prediction may be set to values proportional to the position of the sample and the width and / or height of the coding unit. However, FIG. 23 is merely an example of a reference sample for PDPC and does not limit the position and / or number of reference samples. For example, the position and / or number of reference samples for PDPC may be determined differently depending on the intra-prediction mode of the current block. PDPC can also be used in multi-line intra prediction. PDPC_ref_idx for specifying PDPC reference samples based on the intra-reference line index intra_luma_ref_idx value can be defined as shown in Table 15. intra_luma_ref_idx[ x0 ][ y0 ]PDPC_ref_idx001123 Specifically, for example, PDPC can also generate a final intra-predicted image as shown in the following mathematical equation 4. In PDPC encoding, the reference samples used for weighted prediction are called PDPC reference samples. PDPC reference samples located in the upper intra-reference line are called upper PDPC reference samples (refT), reference samples located in the left intra-reference line are called left PDPC reference samples (refL), and reference samples located in the upper-left corner (e.g., R(-1,-1), R(-2,-2), or R(-4,-4)) are called upper-left PDPC reference samples. The position of the upper PDPC reference sample refT can be set to R(x+y+1, -1) or R(x, -1). Alternatively, the position of the left PDPC reference sample can be set differently depending on the shape of the coding unit or the intra prediction mode value, or it can be derived using weighted prediction from multiple samples. Specifically, for example, if the intra prediction mode is any one of DC mode, planar mode, horizontal mode (mode value 18) or vertical mode (mode value 50), the upper PDPC reference sample refT[x][y] can be derived as shown in the following mathematical equation 5. When the intra prediction mode is INTRA_2 or INTRA_66, the upper PDPC reference sample refT[x][y] can be derived as shown in the following mathematical equation 6. In the top-right diagonal mode (a prediction mode in which the intra prediction mode value is greater than 2 and less than 10 in the 67 intra or wide-angle intra prediction mode), the upper PDPC reference samples can be derived as shown in the following mathematical equation 7. In mathematical formula 7, refW represents the width of the reference sample reference. In Equation 7, dX[x][y] is a parameter that specifies the position of the intra-reference sample according to the angle of the intra-prediction mode, and can be derived as shown in Equation 8 below, which is called the intra-reference sample upper position parameter. In the bottom-left diagonal mode (a prediction mode where the intra prediction mode value is greater than 58 and less than 66 in the 67 intra or wide-angle intra prediction mode), the upper PDPC reference samples can be derived as shown in the following mathematical equation 9. The position of the left PDPC reference sample can be set to R(-1-PDPC_ref_idx, x+y+1)( p[-1-PDPC_ref_idx][ x+y+1] ) or R(-1-PDPC_ref_idx, x)( p[-1-PDPC_ref_idx][ x] ) or to R(-1-PDPC_ref_idx, x)( p[-1-PDPC_ref_idx][ x] ). Alternatively, the position of the upper PDPC reference sample can be set differently depending on the type of coding unit or the intra prediction mode value, or it can be derived using weighted prediction from multiple samples. Specifically, for example, if the intra prediction mode is any one of DC mode, planar mode, horizontal intra prediction mode (intra prediction mode value 18) to vertical intra prediction mode (intra prediction mode value 50), the left PDPC reference sample refL[x][y] can be derived as shown in the following mathematical formula 10. When the intra prediction mode is INTRA_2 or INTRA_66, the left PDPC reference sample refT[x][y] can be derived as shown in the following mathematical equation 11. In the top-right diagonal mode, the left PDPC reference sample can be derived as shown in the following mathematical equation 12. In bottom-left diagonal mode, left PDPC reference samples can be derived as shown in the following mathematical equation 13. In Equation 13, refH represents the height of the reference sample. In Equation 13, dY[x][y] is a parameter that specifies the position of the intra-reference sample according to the angle of the intra-prediction mode, and can be derived as shown in Equation 14 below, which is called the intra-reference sample left position parameter. In the above mathematical equation 14, invAngle is a parameter derived from the intra-predicted angle and can be derived as in mathematical equation 15. intraPredAngle represents the intra-prediction angle by prediction mode shown in Table 11. When performing PDPC using non-adjacent intra-reference samples in multi-line intra-prediction mode, image quality degradation may occur due to the increased discontinuity between the current sample and the intra-reference samples. To reduce image quality degradation, smoothing can be performed by weighted prediction of the selected non-adjacent intra-reference samples against adjacent reference samples and other non-adjacent intra-reference samples. For example, when using a multi-line intra-prediction mode, the left PDPC reference sample and the upper PDPC reference sample may be derived by weighted prediction of a reference sample line different from the selected reference sample line as shown in Fig. 24. Specifically, for example, non-adjacent reference samples among multi-line intras are used, and in the case of Top-Right diagonal mode, refT[x][y] can be derived using weighted predictions of non-adjacent reference samples and adjacent reference samples, and the weighted prediction parameter w can be set to a value proportional or inversely proportional to the distance from the current block. Specifically, for example, refT[x][y] can be derived as shown in the following mathematical equation 16. As another example, when using non-adjacent reference samples among multi-line intras and in Bottom-left diagonal mode, refL[x][y] can be derived using weighted predictions of non-adjacent and adjacent reference samples, and the weighted prediction parameter w can be set to a value proportional or inversely proportional to the distance from the current block. Specifically, for example, refL[x][y] can be derived as shown in the following Equation 17. As another example, when using non-adjacent reference samples among multi-line intras and in horizontal prediction mode (INTRA_18), refL[x][y] can be derived using weighted predictions of non-adjacent reference samples and adjacent reference samples, or the difference between the top-left PDPC sample and the left PDPC sample can be added. Specifically, for example, refL[x][y] can be derived as shown in the following mathematical equation 18. As another example, when using non-adjacent reference samples among multi-line intras and in vertical prediction mode (INTRA_50), refT[x][y] can be derived using weighted predictions of non-adjacent reference samples and adjacent reference samples, or the difference between the upper-left PDPC sample and the upper PDPC sample can be added. Specifically, for example, refL[x][y] can be derived as shown in the following mathematical formula 19. The sample-unit weights wL, wT, wTL, and (64 - wL - wT + wTL) (hereinafter referred to as PDPC sample-unit weights) of the PDPC weighted prediction can be derived based on the intra prediction mode. For example, they may be derived as values proportional to or inversely proportional to the x-axis coordinate value and / or the y-axis coordinate value and / or the width / height of the coding block. wL is called the left PDPC weight, wT is called the upper PDPC weight, wTL is called the upper-left PDPC weight, and (64 - wL - wT + wTL) is called the current sample PDPC weight. Specifically, for example, in the case of any one of DC mode, planner mode, horizontal intra-prediction mode (intra-prediction mode value 18) to vertical intra-prediction mode (intra-prediction mode value 50), it may be derived as shown in the following mathematical formula 20. Here, the shift value can be defined as in the following mathematical formula 21. When the intra prediction mode is INTRA_2 or INTRA_66, PDPC sample-unit weights can be derived as shown in the following mathematical formula 22. In the top-right diagonal mode (a prediction mode where the intra prediction mode is less than 10 in the 67 intra or wide-angle intra prediction mode), PDPC sample-unit weights can be derived as shown in the following mathematical equation 23. In the bottom-left diagonal mode (a prediction mode in which the intra prediction mode is greater than 58 and less than 67 in the 67 intra or wide-angle intra prediction mode), PDPC sample-unit weights can be derived as shown in the following mathematical equation 24. (Example 2) When the intra prediction mode of the current block is a non-directional mode, the reference pixels (refL, refT) of the current sample belong to a first pixel line adjacent to the current block and may be located on the same horizontal / vertical line as the current sample. The weights may include at least one of a first weight (wL) in the x-axis direction, a second weight (wT) in the y-axis direction, or a third weight (wTL) in the diagonal direction. The first weight may refer to a weight applied to the left reference pixel, the second weight may refer to a weight applied to the top reference pixel, and the third weight may refer to a weight applied to the top-left reference pixel. Here, the first and second weights may be determined based on the position information of the current sample and a predetermined scaling factor (nScale). The scaling factor may be determined based on the width (W) and height (H) of the current block. For example, the first weight (wL[x]) of the current sample (predSample[x][y]) can be determined as (32 >> ((x << 1) >> nScale)), and the second weight (wT[x]) can be determined as (32 >> ((y << 1) >> nScale)). The third weight (wTL[x][y]) can be determined as ((wL[x] >> 4) + (wT[y] >> 4)). However, if the intra prediction mode is Planar mode, the third weight can be determined as 0. The scaling factor can be set as ((Log2(nTbW) + Log2(nTbH) - 2) >> 2). When the intra prediction mode of the current block is a vertical / horizontal mode, the reference pixels (refL, refT) of the current sample belong to a first pixel line adjacent to the current block and may be located on the same horizontal / vertical line as the current sample. When it is a vertical mode, the first weight (wL[x]) of the current sample (predSample[x][y]) is determined as (32 >> ((x << 1) >> nScale)), the second weight (wT[y]) is determined as 0, and the third weight (wTL[x][y]) may be determined to be the same as the first weight. Meanwhile, in horizontal mode, the first weight (wL[x]) of the current sample (predSample[x][y]) is determined to be 0, the second weight (wT[y]) is determined to be (32 >> ((y << 1) >> nScale)), and the third weight (wTL[x][y]) can be determined to be the same as the second weight. When the intra prediction mode of the current block is a diagonal mode, the reference pixels (refL, refT) of the current sample belong to the first pixel line adjacent to the current block and may be located on the same diagonal line as the current sample. Here, the diagonal line has the same angle as the intra prediction mode of the current block. The diagonal line may refer to a diagonal line in the direction from the bottom left to the top right, or a diagonal line in the direction from the top left to the bottom right. At this time, the first weight (wL[x]) of the current sample (predSample[x][y]) is determined as (32 >> ((x << 1) >> nScale)), the second weight (wT[y]) is determined as (32 >> ((y << 1) >> nScale)), and the third weight (wTL[x][y]) may be determined as 0. Alternatively, if the intra prediction mode of the current block is smaller than mode 18, the reference sample (refL, refT) of the current sample may belong to an adjacent intra reference line of the current block. The reference sample may be located on the same diagonal line as the current sample or adjacent to the diagonal line. For example, if the diagonal line passes through an integer pel within an adjacent intra-reference line, the reference sample may be determined as an integer pel on the diagonal line. On the other hand, if the diagonal line passes between two integer pels belonging to an adjacent intra-reference line, the reference sample may be determined as a single prime pel generated by interpolating the two integer pels. Alternatively, without a separate interpolation process, the integer pel closest to the diagonal line among the two integer pels may be determined as the reference sample, or an integer pel in a specific direction relative to the diagonal line may be determined as the reference sample. Here, the specific direction may refer to either the left or the right, or either the top or the bottom. The diagonal line may be determined according to the angle of the intra-prediction mode of the current block. However, the reference sample may be limited to using only one of the left or top reference samples of the current block. The first weight (wL[x]) of the current sample (predSample[x][y]) may be determined to be 0, the second weight (wT[y]) may be determined to be (32 >> ((y << 1) >> nScale)), and the third weight (wTL[x][y]) may be determined to be 0. If the intra prediction mode of the current block is greater than mode 50, the reference pixel (refL, refT) of the current sample may belong to an adjacent intra reference line of the current block. The reference sample may be located on the same diagonal line as the current sample or adjacent to the diagonal line. For example, if the diagonal line passes through an integer pel within an adjacent intra-reference line, the reference sample may be determined as an integer pel on the diagonal line. On the other hand, if the diagonal line passes between two integer pels belonging to an adjacent intra-reference line, the reference sample may be determined as a single prime pel generated by interpolating the two integer pels. Alternatively, without a separate interpolation process, the integer pel closest to the diagonal line among the two integer pels may be determined as the reference sample, or an integer pel in a specific direction relative to the diagonal line may be determined as the reference sample. Here, the specific direction may refer to either the left or the right, or either the top or the bottom. The diagonal line may be determined according to the angle of the intra-prediction mode of the current block. However, the reference sample may be limited to using only one of the left or top reference pixels of the current block. The first weight (wL[x]) of the current sample (predSample[x][y]) may be determined as (32 >> ((x << 1) >> nScale)), the second weight (wT[y]) may be determined as 0, and the third weight (wTL[x][y]) may be determined as 0. Based on the determined reference pixels (refL[x][y], refT[x][y]) and weights (wL[x], wT[y], wTL[x][y]), the current sample (predSamples[x][y]) can be corrected as in Equation 4 above. However, the above-described correction process may be performed only when the current block does not perform intra prediction at the sub-block level. The above correction process may be performed only when the reference pixel of the current block is the first pixel line. The above correction process may be performed only when the intra prediction mode of the current block corresponds to a specific mode. Here, the specific mode may include at least one of a non-directional mode, a vertical mode, a horizontal mode, a mode smaller than a predetermined first threshold mode, and a mode larger than a predetermined second threshold mode. The first threshold mode may be mode 8, 9, 10, 11, or 12, or a horizontal mode or diagonal mode 66, and the second threshold mode may be mode 56, 57, 58, 59, or 60, or a vertical mode or diagonal mode 2. FIGS. 25 to 27 illustrate a method for encoding / decoding residual images based on conversion and / or quantization as an embodiment to which the present invention is applied. The image obtained by differing the predicted image from the original image is called the residual image. The residual image can be decomposed into binary frequency components through a 2D transformation such as the Discrete Cosine Transform (DCT). It has the characteristic that removing high-frequency components from the image does not cause significant visual distortion. By setting the values corresponding to high frequencies to small or zero, compression efficiency can be greatly increased without significant visual distortion. Depending on the size of the prediction block or the prediction mode, the Discrete sine transform (DST) may be used. Specifically, for example, if the prediction mode is intra and the size of the prediction block / coding block is smaller than NxN, the DST transformation may be configured to be used, and for other prediction blocks / coding blocks, the DCT may be configured to be used. DCT is a process that decomposes (transforms) an image into two-dimensional frequency components using a cosine transform, and these frequency components are represented as the basis image. For example, if a DCT transformation is performed on an NxN block, N 2 One basic pattern component can be obtained. Performing a DCT transformation means determining the magnitude of each basic pattern component contained in the original pixel block. The magnitude of each basic pattern component is called a DCT coefficient. Generally, the Discrete Cosine Transform (DCT) is mainly used for images where there are many non-zero components at low frequencies, and the Discrete Sine Transform (DST) can be used for images where there are many high-frequency components. DST represents a process that decomposes (transforms) an image into two-dimensional frequency components using a sine transformation. A two-dimensional image can be decomposed (transformed) into two-dimensional frequency components using transformation methods other than DCT or DST transformation, and this is called a two-dimensional image transformation. In certain blocks of the residual image, 2D image transformation may not be performed, and this is called a transform skip. Quantization can be applied after the transform skip. Any block within a 2D image may be subjected to DCT, DST, or 2D image transformation, and the transformation used is defined as the first transformation. After performing the first transformation, a transformation may be performed again on a part of the transformed block, and this is defined as the second transformation. The first transformation may use one of multiple transformation cores. Specifically, for example, any one of DCT2, DCT8, or DST7 may be selected and used in the transformation block, or different transformation cores may be used for the horizontal and vertical transformations of the transformation block; this is called the Multiple Transform Selection (MTS) method. Here, DCT2, DCT8, or DST7 are referred to as transformation cores. For example, you can signal cu_mts_flag to select whether to use DCT2 as the horizontal and vertical direction conversion core in a coding block. If the cu_mts_flag value is 1, it indicates that DCT2 is used as the horizontal and vertical direction conversion core. If the cu_mts_flag value is 0, it indicates that DCT8 or DST 7 is used as the horizontal and vertical direction conversion core. Limited to cases where the cu_mts_flag value is 0, the transformation core index (mts_idx) can be signaled. In the case of a vertical coding unit or a horizontal coding unit, the cu_mts_flag value may be set to 0. mts_idxINTRAINTER Horizontal Conversion Core Vertical Conversion Core Horizontal Conversion Core Vertical Conversion Core 0DST7DST7DCT8DCT81DCT8DST7DST7DCT82DST7DCT8DCT8DST73DCT8DCT8DST7DST7 If it is an intra-coding unit and the number of non-zero conversion coefficients is less than or equal to the threshold, the conversion core index may not be signaled, and DST7 may be used as a horizontal conversion core and a vertical conversion core. The threshold used in this case is called the first conversion selection threshold. For example, the first conversion selection threshold may be set to 2 or a value proportional to the size of the coding unit. Specifically, for example, the first transformation selection threshold may be set to 2 for coding units smaller than or equal to 32x32, and the first transformation selection threshold may be set to 4 for coding units larger than 32x32 (e.g., coding units of size 32x64, 64x32, or 64x64). Alternatively, different transformation cores may be used depending on the form of the coding unit. For example, in a horizontal coding unit or a vertical coding unit, the horizontal transformation core and the vertical transformation core may be configured not to be the same. That is, the transformation core index may be configured to have only values of 1 to 2, and the transformation core flag (mts_flag) may be signaled as shown in Table 16. If the conversion core flag value is 0, the conversion core index can be set to 1, and if the conversion core flag value is 1, the conversion core index can be set to 2. residual_coding( x0, y0, log2TbWidth, log2TbHeight, cIdx ) {Descriptor...if( cu_mts_flag[ numSigCoeff > 2 ) | ( CuPredMode[ x0 ][ y0 ] = = MODE_INTER ) ) ) {if (cbHeight == cbWidth) {mts_idx[ Alternatively, the mts_idx values can be reordered depending on the type of coding unit. For example, if the coding unit is a vertical coding unit or a horizontal coding unit, mts_idx can be reordered as shown in Table 17. mts_idxINTRAINTER Horizontal Direction Transformation Core Vertical Direction Transformation Core Horizontal Direction Transformation Core Vertical Direction Transformation Core 0DCT8DST7DST7DCT8DCT8DST72DST7DST7DST7DST73DCT8DCT8DST7DST7 Referring to FIG. 25, DST7 can be used as a horizontal direction conversion core when the maximum number of horizontal direction non-zero coefficients is less than 2 in an intra-coding unit. Here, the maximum number of horizontal direction non-zero coefficients represents the number of non-zero coefficients in a 1xN sub-block within the coding unit. If it is an intra-coding unit and the maximum number of vertical non-zero coefficients is less than 2, DST7 can be used as the vertical conversion core. Here, the maximum number of horizontal non-zero coefficients represents the number of non-zero coefficients in the Nx1 sub-block within the coding unit. Whether to perform a second transformation can be selectively determined based on whether the horizontal transformation core and the vertical transformation core are the same. For example, the second transformation can be set to be performed only when the horizontal transformation core and the vertical transformation core are the same. As another example, the second transformation can be set to be performed only when the horizontal transformation core and the vertical transformation core are different. Alternatively, if it is an intra-coding unit and the number of non-zero conversion coefficients is smaller than the first conversion selection threshold, the second conversion may be set not to be used. As another example, the second transformation may be set not to be used based on the number of non-zero transformation coefficients within the coding unit. It may also be configured so that if the number of non-zero transformation coefficients is greater than N, the second transformation is performed, and if it is less than or equal to N, the second transformation is not performed. The block units for performing the first transformation and the second transformation may be set differently. Specifically, for example, the first transformation may be performed on an 8x8 block of the residual image, and then the second transformation may be performed on each 4x4 sub-block. As another example, the first transformation may be performed on each 4x4 block, and then the second transformation may be performed on each 8x8 block. The size and shape of the sub-block to perform the second transformation may also be set differently based on the shape of the coding unit. For example, after performing a first transformation in a square coding unit, a second transformation may be performed only in all or part of the NxN sub-block located at the top left. Specifically, for example, as shown in FIG. 26, after performing a first transformation in an 8x8 coding unit, a second transformation may be performed in a 4x4 top-left sub-block. Among horizontal coding units, a coding unit whose width is four times or more the height of the coding unit is called a maximum horizontal coding unit. Among vertical coding units, a coding unit whose height is four times or more the width is called a maximum horizontal coding unit. As another example, after performing the first transformation in the maximum horizontal direction coding unit, the second transformation may be performed only in all or part of the upper-left (kN)x(4kN) sub-block. Specifically, for example, as shown in the upper figure of FIG. 27, after performing the first transformation in a 16x4 maximum horizontal direction coding unit, the second transformation may be performed in a 2x8 upper-left sub-block. As shown in the lower figure of FIG. 27, after performing the first transformation in the maximum vertical direction coding unit, the second transformation may be performed only in the upper left (4kN)x(kN) sub-block. The residual image to which the first transformation is applied is defined as the first transformation residual image. A DCT, DST, or 2D image transformation can be applied to the first transformed residual image, and the transformation used is defined as the second transformed image. The 2D image to which the second transformed image is applied is defined as the second transformed residual image. The sample values within a block after performing the first and / or second transformation are defined as transformation factors. Quantization refers to the process of dividing transformation factors by a predefined value to reduce the energy of a block. The value defined to apply quantization to the transformation factors is defined as the quantization parameter. Predefined quantization parameters can be applied in sequence units or block units. Typically, quantization parameters can be defined with values between 1 and 51. After performing transformation and quantization, inverse quantization and inverse transformation can be performed to generate a residual reconstruction image. A first reconstruction image can be generated by adding a prediction image to the residual reconstruction image. The decoding device can restore the residual image by performing the transformation and quantization processes in the aforementioned encoding device in reverse. If the transformation includes a first transformation and a second transformation, the decoding device can perform inverse quantization on the residual coefficients of the signaled transformation block and sequentially perform the second transformation and the first transformation on the transformation block. Here, the second transformation is applied only to a portion of the transformation block, and the portion of the region may refer to the top-left, left, or top sub-region. FIGS. 28 and 29 illustrate a method of applying an in-loop filter to a restored image as an embodiment to which the present invention is applied. In-loop filtering is a technique that adaptively filters a decoded image to reduce information loss occurring during the quantization and encoding processes. Deblocking filters, sample adaptive offset filters (SAO), and adaptive loop filters (ALF) are examples of in-loop filtering. A second reconstructed image can be generated by applying at least one of a deblocking filter, a Sample Adaptive Offset (SAO), or an Adaptive Loop Filter (ALF) to the first reconstructed image. After applying a deblocking filter to the restored image, SAO and ALF can be applied. During the video encoding process, conversion and quantization are performed in block units. Losses occur during the quantization process, and discontinuities appear at the boundaries of the restored image. The discontinuous images appearing at block boundaries are defined as blocking artifacts. A deblocking filter is a method that mitigates blocking artifacts occurring at the block boundaries of the first image and improves encoding performance. Block image quality degradation can be mitigated by performing filtering at block boundaries, and a block filter strength (hereinafter BS) value can be determined based on at least one of the following: whether a block is encoded in an intra-prediction mode as shown in FIG. 28, whether the difference in absolute values of motion vectors of neighboring blocks is greater than a predetermined threshold value, or whether the reference pictures of neighboring blocks are identical to each other. If the BS value is 0, filtering is not performed, and if the BS value is 1 or 2, filtering can be performed at block boundaries. Because quantization is performed in the frequency domain, ringing artifacts may occur at the edges of objects, or pixel values may become larger or smaller than the original by a certain amount. SAO can effectively reduce ringing artifacts by adding or subtracting specific offsets on a block basis, taking into account the pattern of the first reconstructed image. Depending on the characteristics of the reconstructed image, SAO consists of edge offset (EO) and band offset (BO). Edge offset is a method that adds a different offset to the current sample based on the surrounding pixel sample pattern. Band offset reduces encoding errors by adding a fixed value to a set of pixels with similar brightness values within a region. Pixel brightness can be divided into 32 uniform bands to group pixels with similar brightness values into a single set. For example, four adjacent bands can be grouped into one category. It can be configured to use the same offset value within a single category. ALF (Adaptive Loop Filter) is a method for generating a second reconstructed image using one of the filters defined on the first reconstructed image or the reconstructed image on which deblocking filtering is performed, as shown in Equation 25. In this case, the filter can be selected on a picture-by-picture or CTU-by-CTU basis. In the Luma component, any one of the 5x5, 7x7, or 9x9 diamond shapes can be selected as shown in Fig. 29. In the Chroma component, the use of only the 5x5 diamond shape may be restricted. The various embodiments of the present disclosure are not intended to list all possible combinations but to describe representative aspects of the present disclosure, and the matters described in the various embodiments may be applied independently or in combination of two or more. In addition, various embodiments of the present disclosure may be implemented by hardware, firmware, software, or a combination thereof. In the case of implementation by hardware, it may be implemented by one or more ASICs (Application Specific Integrated Circuits), DSPs (Digital Signal Processors), DSPDs (Digital Signal Processing Devices), PLDs (Programmable Logic Devices), FPGAs (Field Programmable Gate Arrays), general processors, controllers, microcontrollers, microprocessors, etc. The scope of the present disclosure includes software or machine-executable instructions (e.g., operating system, application, firmware, program, etc.) that enable an operation according to a method of various embodiments to be executed on a device or computer, and a non-transitory computer-readable medium on which such software or instructions, etc. are stored and executable on a device or computer. The present invention can be used to encode / decode video signals.
Claims
1. A step of generating a prediction block of the current block based on a pre-defined prediction mode; A step of generating a transformation block of the current block through a predetermined transformation; and A step of restoring the current block based on the above prediction block and the above transformation block, The step of generating the above prediction block is: A step of determining an intra reference line of the current block; a step of determining an intra prediction mode of the current block from a predetermined candidate group; and An image decoding method, comprising a step of performing intra prediction of the current block based on the determined intra reference line and the intra prediction mode.
2. In paragraph 1, The above candidate group is divided into the first candidate group and the second candidate group, The above first candidate group is configured with a default mode pre-defined in the decryption device, A method for decoding an image, wherein the second candidate group is composed of a plurality of MPM candidates.
3. In paragraph 2, A method for decoding an image, wherein the intra prediction mode of the current block is derived by selectively using either the first candidate group or the second candidate group.
4. In paragraph 2, A method for decoding an image, wherein the above default mode is at least one of Planar mode, DC mode, vertical mode, horizontal mode, vertical mode, or diagonal mode.
5. In paragraph 2, The above plurality of MPM candidates include at least one of intra prediction modes (candIntraPredMode), candIntraPredMode-n, and candIntraPredMode+n of the surrounding blocks, An image decoding method where n represents a natural number of 1, 2, or more.
6. In paragraph 2, The above multiple MPM candidates include at least one of DC mode, vertical mode, horizontal mode, (vertical mode-m), (vertical mode+m), (horizontal mode-m), or (horizontal mode+m), A method for decoding images, where m is a natural number of 1, 2, 3, 4, or more.
7. In paragraph 1, The intra prediction mode determined above is changed by adding or subtracting a predetermined offset, A method for decoding an image, wherein application of the above offset is selectively performed based on at least one of the size, shape, segmentation information, value of intra prediction mode, or component type of the current block.
8. In the first paragraph, the step of performing the intra prediction comprises: A step of dividing the current block into a plurality of sub-blocks using vertical or horizontal lines; and In units of the above sub-blocks, a step of sequentially performing intra prediction is included, A method for decoding an image, wherein the number of sub-blocks belonging to the current block is variably determined based on at least one of the size or shape of the current block.
9. In the first paragraph, the step of performing the intra prediction comprises: An image decoding method, comprising a step of correcting a prediction value according to the intra prediction based on a predetermined reference sample and weight.
10. In paragraph 9, A method for decoding an image, wherein each of the above reference sample and weight is determined based on at least one of the size of the current block, the position of the current sample to be corrected, or the intra prediction mode of the current block.
11. In paragraph 1, An image decoding method, wherein the above transformation is performed selectively using at least one of DCT-2, DST-7, or DCT-8.
12. Step of determining the intra reference line of the current block; a step of determining an intra prediction mode of the current block from a predetermined candidate group; and A step of performing intra prediction of the current block based on the intra reference line and the intra prediction mode determined above, The above candidate group is divided into the first candidate group and the second candidate group, The first candidate group is configured with a default mode pre-defined in the decryption device, and the second candidate group is configured with a plurality of MPM candidates. The above default mode is at least one of Planar mode, DC mode, vertical mode, horizontal mode, vertical mode or diagonal mode, A video encoding method, wherein the plurality of MPM candidates are determined based on intra prediction modes of neighboring blocks adjacent to the current block.
13. In a digital storage medium for storing a video bitstream, The above video bitstream is, Contains information specifying either a first candidate group or a second candidate group for determining an intra prediction mode of the current block, The first candidate group is configured with a pre-defined default mode, and the second candidate group is configured with multiple MPM candidates. The above default mode is at least one of Planar mode, DC mode, vertical mode, horizontal mode, vertical mode or diagonal mode, A digital storage medium, wherein the plurality of MPM candidates are determined based on intra prediction modes of neighboring blocks adjacent to the current block.
