Video decoding methods, video encoding methods, and compressed video data transmission devices.

VN127673APending Publication Date: 2026-08-03KT CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
VN1202605244
Authority / Receiving Office
VN · VN
Patent Type
Applications
Current Assignee / Owner
Priority Date
2017-09-21
Filing Date
2018-09-20
Publication Date
2026-08-03

AI Technical Summary

Technical Problem

The increasing demand for high-resolution and high-quality video signals leads to higher data volumes, resulting in increased transmission and storage costs, and existing video compression technologies struggle to efficiently handle high-resolution and ultra-high-resolution stereoscopic video content.

Method used

A method and device for efficient intra prediction during video encoding/decoding that uses a plurality of non-neighboring reference samples, including right and bottom reference samples, and adaptively determines the range and weights of reference samples to calculate DC values on a sub-block basis.

Benefits of technology

This approach enhances the efficiency of intra prediction by utilizing a broader range of reference samples and adaptive weighting, effectively reducing data volume while maintaining image quality, thus addressing the challenges of high-resolution video compression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure VN1202605244_0
    Figure VN1202605244_0
  • Figure VN1202605244_1
    Figure VN1202605244_1
Patent Text Reader

Abstract

The invention relates to a method and apparatus for decoding video, and a method and apparatus for encoding video. The method for decoding video under the invention may include the step of determining the internal prediction mode of the current block, determining the direct current (DC) value using reference samples adjacent to the current block when the internal prediction mode of the current block is DC, and acquiring the prediction sample of the current block based on the DC value.
Need to check novelty before this filing date? Find Prior Art

Description

Video signal processing method and device

[0001] The present invention relates to a video signal processing method and device.

[0002] Recently, the demand for high-resolution, high-quality images, such as HD (High Definition) and UHD (Ultra High Definition) images, is increasing across various application fields. As image data becomes higher in resolution and quality, the relative amount of data increases compared to conventional image data. Therefore, transmitting image data using existing media such as wired and wireless broadband lines or storing it using existing storage media leads to increased transmission and storage costs. To address these issues arising from the increasing resolution and quality of image data, high-efficiency image compression technologies can be utilized.

[0003] There are various technologies for image compression, such as inter-picture prediction technology that predicts pixel values ​​included in the current picture from pictures before or after the current picture, intra-picture prediction technology that predicts pixel values ​​included in the current picture using pixel information in the current picture, and entropy encoding technology that assigns short codes to values ​​with high frequency of appearance and long codes to values ​​with low frequency of appearance. Using these image compression technologies, image data can be effectively compressed and transmitted or stored.

[0004] Meanwhile, as demand for high-resolution video grows, so does the demand for stereoscopic video content as a new video service. Discussions are underway on video compression technologies to effectively deliver high-resolution and ultra-high-resolution stereoscopic video content.

[0005] The purpose of the present invention is to provide a method and device capable of efficiently performing intra prediction on a block to be encoded / decoded when encoding / decoding a video signal.

[0006] The purpose of the present invention is to provide a method and device for performing intra prediction using a plurality of non-adjacent reference samples in encoding / decoding a video signal.

[0007] The purpose of the present invention is to provide a method and device for performing intra prediction using right and bottom reference samples in encoding / decoding a video signal.

[0008] The purpose of the present invention is to provide a method and device for adaptively determining the range of reference samples used for calculating DC values ​​when encoding / decoding a video signal.

[0009] The purpose of the present invention is to provide a method and device for calculating a DC value by assigning different weights to reference samples when encoding / decoding a video signal.

[0010] The purpose of the present invention is to provide a method and device for calculating a DC value in sub-block units when encoding / decoding a video signal.

[0011] The technical problems to be achieved in the present invention are not limited to the technical problems mentioned above, and other technical problems not mentioned can be clearly understood by a person having ordinary skill in the technical field to which the present invention belongs from the description below.

[0012] The video signal decoding method and device according to the present invention can determine the intra prediction mode of a current block, and if the intra prediction mode of the current block is a DC mode, determine a DC value using reference samples surrounding the current block, and derive a prediction sample of the current block based on the DC value. At this time, the DC value can be obtained for each unit area within the current block.

[0013] A video signal encoding method and device according to the present invention can determine an intra prediction mode of a current block, and if the intra prediction mode of the current block is a DC mode, determine a DC value using reference samples surrounding the current block, and derive a prediction sample of the current block based on the DC value. At this time, the DC value can be obtained for each unit area within the current block.

[0014] In the video signal encoding / decoding method and device according to the present invention, the range of reference samples used to obtain the DC value can be determined differently for each unit area.

[0015] In the video signal encoding / decoding method and device according to the present invention, the reference samples may include at least one of a left reference sample, an upper reference sample, a right reference sample, or a lower reference sample.

[0016] In the video signal encoding / decoding method and device according to the present invention, the DC value of a first region bordering the upper boundary and the left boundary of the current block can be obtained based on the left reference sample and the upper reference sample, and the DC value of a second region bordering the right boundary and the lower boundary of the current block can be obtained based on the right reference sample and the lower reference sample.

[0017] In the video signal encoding / decoding method and device according to the present invention, the unit area may be a sub-block of a predetermined size.

[0018] In the video signal encoding / decoding method and device according to the present invention, the current block can be divided into a plurality of regions based on the upper right diagonal line.

[0019] In the video signal encoding / decoding method and device according to the present invention, the DC value is obtained based on the left reference sample and the upper reference sample of the current block, and the weights assigned to the left reference sample and the reference sample can be determined differently for each unit area.

[0020] The features briefly summarized above of the present invention are merely exemplary aspects of the detailed description of the present invention described below and do not limit the scope of the present invention.

[0021] According to the present invention, intra prediction can be efficiently performed on a block to be encoded / decoded.

[0022] According to the present invention, there is an advantage in that the efficiency of intra prediction can be increased by performing intra prediction using a plurality of non-adjacent reference samples.

[0023] According to the present invention, there is an advantage in that the efficiency of intra prediction can be increased by using right and bottom reference samples.

[0024] According to the present invention, there is an advantage in that the efficiency of intra prediction can be improved by adaptively determining the range of reference samples used for calculating DC values.

[0025] The present invention has the advantage of increasing the efficiency of intra prediction by calculating a DC value by assigning different weights to reference samples when encoding / decoding a video signal.

[0026] According to the present invention, there is an advantage in that the efficiency of intra prediction can be increased by calculating the DC value in sub-block units.

[0027] The effects that can be obtained from the present invention are not limited to the effects mentioned above, and other effects not mentioned can be clearly understood by a person having ordinary skill in the art to which the present invention belongs from the description below.

[0028] FIG. 1 is a block diagram showing an image encoding device according to an embodiment of the present invention.

[0029] FIG. 2 is a block diagram showing an image decoding device according to an embodiment of the present invention.

[0030] FIG. 3 illustrates an example of hierarchically dividing coding blocks based on a tree structure, as an embodiment of the present invention.

[0031] FIG. 4 is a diagram showing a partition form that allows binary tree-based division as an embodiment to which the present invention is applied.

[0032] FIG. 5 is a diagram showing an example in which only a specific type of binary tree-based division is allowed, as an example to which the present invention is applied.

[0033] FIG. 6 is a diagram illustrating an example in which information related to the number of allowed binary tree splits is encoded / decoded as an embodiment to which the present invention is applied.

[0034] FIG. 7 is a diagram illustrating a partition mode that can be applied to a coding block as an embodiment to which the present invention is applied.

[0035] FIG. 8 illustrates an example of an intra prediction mode pre-defined in an image encoder / decoder to which the present invention is applied.

[0036] FIG. 9 illustrates an example of an extended intra prediction mode to which the present invention is applied.

[0037] FIG. 10 is a flowchart schematically illustrating an intra prediction method as an embodiment to which the present invention is applied.

[0038] FIG. 11 illustrates an embodiment to which the present invention is applied, and illustrates a method for correcting a prediction sample of a current block based on differential information of surrounding samples.

[0039] Figures 12 and 13 are diagrams showing a one-dimensional reference sample group in which reference samples are rearranged in a row.

[0040] Figure 14 is a diagram showing an example of deriving a right reference sample or a bottom reference sample using multiple reference samples.

[0041] FIG. 15 and FIG. 16 are diagrams for explaining determining a right reference sample and a bottom reference sample for a non-square block according to one embodiment of the present invention.

[0042] Figure 17 is a drawing for explaining an example of deriving a second reference sample using a first reference sample.

[0043] Figure 18 is a diagram illustrating reference samples that constitute a one-dimensional reference sample group.

[0044] Figure 19 is an example showing an area to which bidirectional intra prediction is applied.

[0045] Figure 20 is an example that identifies a directional prediction mode in which bidirectional intra prediction is allowed.

[0046] FIG. 21 is a flowchart illustrating an intra prediction method of a current block based on a bidirectional intra prediction mode according to the present invention.

[0047] Figure 22 is a diagram showing an example in which different weights are applied depending on the location of the reference sample.

[0048] Figures 23 and 24 illustrate the weights applied to reference samples when the current block is non-square.

[0049] Figure 25 is a diagram showing an example in which the range of reference samples used to derive DC values ​​is determined differently for each region.

[0050] Figure 26 is a diagram showing an example in which the range of reference samples used to derive DC values ​​is determined differently for each region.

[0051] Figure 27 is a diagram showing an example in which the weights assigned to reference samples are set differently for each sub-block.

[0052] The present invention is susceptible to various modifications and embodiments. Specific embodiments are illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present invention to specific embodiments, but rather to encompass all modifications, equivalents, and alternatives falling within the spirit and technical scope of the present invention. Throughout the description of each drawing, similar reference numerals have been used to designate similar components.

[0053] While terms such as "first" and "second" may be used to describe various components, these components should not be limited by these terms. These terms are used solely to distinguish one component from another. For example, without departing from the scope of the present invention, a first component may be referred to as a "second component," and similarly, a second component may also be referred to as a "first component." The term "and / or" includes a combination of multiple related items described herein or any of multiple related items described herein.

[0054] When a component is referred to as being "connected" or "connected" to another component, it should be understood that it may be directly connected or connected to that other component, but that there may be other components intervening. Conversely, when a component is referred to as being "directly connected" or "connected" to another component, it should be understood that there are no other components intervening.

[0055] The terminology used in this application is only used to describe specific embodiments and is not intended to limit the present invention. The singular expression includes the plural expression unless the context clearly indicates otherwise. In this application, it should be understood that the terms "comprise" or "have" indicate the presence of a feature, number, step, operation, component, part, or combination thereof described in the specification, but do not exclude in advance the possibility of the presence or addition of one or more other features, numbers, steps, operations, components, parts, or combinations thereof.

[0056] Hereinafter, with reference to the attached drawings, preferred embodiments of the present invention will be described in more detail. Hereinafter, identical components in the drawings will be designated by the same reference numerals, and redundant descriptions of identical components will be omitted.

[0057]

[0058] FIG. 1 is a block diagram showing an image encoding device according to an embodiment of the present invention.

[0059] Referring to FIG. 1, a video encoding device (100) may include a picture segmentation unit (110), a prediction unit (120, 125), a transformation unit (130), a quantization unit (135), a reordering unit (160), an entropy encoding unit (165), an inverse quantization unit (140), an inverse transformation unit (145), a filter unit (150), and a memory (155).

[0060] Each component shown in Fig. 1 is independently depicted to indicate different characteristic functions in the video encoding device, and does not mean that each component is composed of separate hardware or a single software component. That is, each component is listed and included as a separate component for convenience of explanation, and at least two components among each component may be combined to form a single component, or one component may be divided into multiple components to perform a function, and such integrated and separate embodiments of each component are also included in the scope of the present invention as long as they do not deviate from the essence of the present invention.

[0061] Additionally, some components may not be essential components that perform essential functions of the present invention, but may be optional components merely used to enhance performance. The present invention may be implemented by including only components essential to implementing the essence of the present invention, excluding components used solely for performance enhancement. A structure that includes only essential components, excluding optional components used solely for performance enhancement, is also within the scope of the present invention.

[0062] 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). The picture splitting unit (110) can split one picture into a combination of multiple coding units, prediction units, and transform units, and select one combination of coding units, prediction units, and transform units based on a predetermined criterion (e.g., a cost function) to encode the picture.

[0063] For example, a picture can be split into multiple coding units. A recursive tree structure, such as a quad tree structure, can be used to split a coding unit in a picture. A coding unit that is split into other coding units starting from an image or the largest coding unit as the root can be split into as many child nodes as the number of split coding units. A coding unit that cannot be split any further according to a certain restriction becomes a leaf node. That is, assuming that only a square split is possible for a coding unit, a coding unit can be split into at most four different coding units.

[0064] Hereinafter, in the embodiments of the present invention, the encoding unit may be used to mean a unit that performs encoding or may be used to mean a unit that performs decoding.

[0065] A prediction unit may be divided into at least one square or rectangular shape of the same size within a single coding unit, or may be divided such that one prediction unit among the divided prediction units within a single coding unit has a different shape and / or size from another prediction unit.

[0066] When generating a prediction unit that performs intra prediction based on a coding unit, if it is not the minimum coding unit, intra prediction can be performed without dividing it into multiple prediction units NxN.

[0067] The prediction unit (120, 125) may include an inter prediction unit (120) that performs inter prediction and an intra prediction unit (125) that performs intra prediction. It may be determined whether to use inter prediction or intra prediction for a prediction unit, and specific information (e.g., intra prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. At this time, the processing unit where prediction is performed and the processing unit where the prediction method and specific contents are determined may be different. For example, the prediction method and prediction mode may be determined in the prediction unit, and the prediction may be performed in the transformation unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transformation unit (130). In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded together with the residual value in the entropy encoding unit (165) and transmitted to the decoder. When using a specific encoding mode, it is also possible to encode the original block as is and transmit it to the decoding unit without generating a prediction block through the prediction unit (120, 125).

[0068] The inter prediction unit (120) may predict a prediction unit based on information of at least one picture among the previous or subsequent pictures of the current picture, and in some cases, may predict a prediction unit based on information of a portion of an encoded region within the current picture. The inter prediction unit (120) may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.

[0069] The reference picture interpolation unit can receive reference picture information from the memory (155) and generate pixel information less than an integer pixel 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 less than an integer pixel in units of 1 / 4 pixels. In the case of a chrominance signal, a DCT-based 4-tap interpolation filter with different filter coefficients can be used to generate pixel information less than an integer pixel in units of 1 / 8 pixels.

[0070] The motion prediction unit can perform motion prediction based on a reference picture interpolated by the reference picture interpolation unit. Various methods can be used to derive a motion vector, such as FBMA (Full search-based Block Matching Algorithm), TSS (Three Step Search), and NTS (New Three-Step Search Algorithm). The motion vector can have a motion vector value in units of 1 / 2 or 1 / 4 pixels based on the interpolated pixel. The motion prediction unit can predict the current prediction unit by using different motion prediction methods. Various methods can be used as motion prediction methods, such as the Skip method, the Merge method, the AMVP (Advanced Motion Vector Prediction) method, and the Intra Block Copy method.

[0071] The intra prediction unit (125) can generate a prediction unit based on reference pixel information surrounding the current block, which is pixel information within the current picture. If the surrounding block of the current prediction unit is a block on which inter prediction has been performed and the reference pixel is a pixel on which inter prediction has been performed, the reference pixel included in the block on which inter prediction has been performed can be replaced and used with reference pixel information of the surrounding block on which intra prediction has been performed. That is, if the reference pixel is not available, the unavailable reference pixel information can be replaced and used with at least one reference pixel among the available reference pixels.

[0072] In intra prediction, the prediction mode can have a directional prediction mode that uses reference pixel information according to the prediction direction, and a non-directional mode that does not use directional information when performing prediction. The mode for predicting luminance information and the mode for predicting chrominance information can be different, and the intra prediction mode information used to predict luminance information or the predicted luminance signal information can be utilized to predict chrominance information.

[0073] When performing intra prediction, if the size of the prediction unit and the size of the transformation unit are the same, intra prediction for the prediction unit can be performed based on the pixels located to the left of the prediction unit, the pixels located at the upper left, and the pixels located at the upper. However, when performing intra prediction, if the sizes of the prediction unit and the transformation unit are different, intra prediction can be performed using reference pixels based on the transformation unit. In addition, intra prediction using NxN division can be used only for the minimum coding unit.

[0074] The intra prediction method can generate a prediction block after applying an Adaptive Intra Smoothing (AIS) filter to a reference pixel according to a prediction mode. The type of AIS filter applied to the reference pixel may be different. In order to perform the intra prediction method, the intra prediction mode of the current prediction unit can be predicted from the intra prediction modes of prediction units existing around the current prediction unit. When the prediction mode of the current prediction unit is predicted using the mode information predicted from the surrounding prediction units, if the intra prediction modes of the current prediction unit and the surrounding prediction units are the same, information indicating that the prediction modes of the current prediction unit and the surrounding prediction units are the same can be transmitted using predetermined flag information, and if the prediction modes of the current prediction unit and the surrounding prediction units are different, entropy encoding can be performed to encode the prediction mode information of the current block.

[0075] Additionally, a residual block containing 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, can be generated. The generated residual block can be input to the transformation unit (130).

[0076] In the transformation unit (130), the residual block including the residual value information of the prediction unit generated through the original block and the prediction unit (120, 125) can be transformed using a transformation method such as DCT (Discrete Cosine Transform), DST (Discrete Sine Transform), or KLT. Whether to apply DCT, DST, or KLT to transform the residual block can be determined based on the intra prediction mode information of the prediction unit used to generate the residual block.

[0077] The quantization unit (135) can quantize values ​​converted to the frequency domain by the transformation unit (130). The quantization coefficients can vary depending on the block or the importance of the image. The values ​​produced by the quantization unit (135) can be provided to the dequantization unit (140) and the reordering unit (160).

[0078] The rearrangement unit (160) can perform rearrangement of coefficient values ​​for quantized residual values.

[0079] The rearrangement unit (160) can change a two-dimensional block-shaped coefficient into a one-dimensional vector form through a coefficient scanning method. For example, the rearrangement unit (160) can change the two-dimensional block-shaped coefficient into a one-dimensional vector form by scanning from the DC coefficient to the coefficient of the high-frequency region using a zig-zag scan method. Depending on the size of the transformation unit and the intra prediction mode, a vertical scan that scans the two-dimensional block-shaped coefficient in the column direction or a horizontal scan that scans the two-dimensional block-shaped coefficient in the row direction may be used instead of the zig-zag scan. That is, depending on the size of the transformation unit and the intra prediction mode, it is possible to determine which scan method among the zig-zag scan, the vertical scan, and the horizontal scan is to be used.

[0080] The entropy encoding unit (165) can perform entropy encoding based on the values ​​produced by the rearrangement unit (160). Entropy encoding can use various encoding methods such as, for example, Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC).

[0081] The entropy encoding unit (165) can encode various information such as residual value coefficient information of an encoding unit, block type information, prediction mode information, division unit information, prediction unit information, transmission unit information, motion vector information, reference frame information, block interpolation information, and filtering information from the rearrangement unit (160) and the prediction unit (120, 125).

[0082] The entropy encoding unit (165) can entropy encode the coefficient values ​​of the encoding unit input from the rearrangement unit (160).

[0083] The inverse quantization unit (140) and the inverse transformation unit (145) inversely quantize the values ​​quantized in the quantization unit (135) and inversely transform the values ​​transformed in the transformation unit (130). The residual values ​​generated in the inverse quantization unit (140) and the inverse transformation unit (145) can be combined with the predicted prediction units 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.

[0084] The filter unit (150) may include at least one of a deblocking filter, an offset correction unit, and an ALF (Adaptive Loop Filter).

[0085] A deblocking filter can remove block distortion caused by boundaries between blocks in a reconstructed picture. To determine whether to perform deblocking, a deblocking filter can be applied to the current block based on the pixels contained in several columns or rows within the block. When applying a deblocking filter to a block, a strong filter or a weak filter can be applied depending on the required deblocking filtering strength. Furthermore, when applying a deblocking filter, horizontal and vertical filtering can be processed in parallel when performing vertical and horizontal filtering.

[0086] The offset correction unit can correct the offset from the original image on a pixel-by-pixel basis for an image that has undergone deblocking. To perform offset correction for a specific picture, the pixels contained in the image can be divided into a certain number of regions, the regions to be offset can be determined, and the offset can be applied to those regions. Alternatively, the offset can be applied by considering the edge information of each pixel.

[0087] Adaptive Loop Filtering (ALF) can be performed based on the comparison of the filtered restored image with the original image. After dividing the pixels included in the image into predetermined groups, a filter to be applied to each group can be determined, and filtering can be performed differentially for each group. Information regarding whether to apply ALF can be transmitted by luminance signal for each coding unit (CU), and the shape and filter coefficients of the ALF filter to be applied can vary depending on each block. Furthermore, an ALF filter of the same form (fixed form) can be applied regardless of the characteristics of the target block.

[0088] 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.

[0089]

[0090] FIG. 2 is a block diagram showing an image decoding device according to an embodiment of the present invention.

[0091] Referring to FIG. 2, the image decoder (200) may include an entropy decoding unit (210), a reordering unit (215), an inverse quantization unit (220), an inverse transformation unit (225), a prediction unit (230, 235), a filter unit (240), and a memory (245).

[0092] When a video bitstream is input to a video encoder, the input bitstream can be decoded in the opposite procedure to that of the video encoder.

[0093] The entropy decoding unit (210) can perform entropy decoding in a procedure opposite to that of the entropy encoding unit of the video encoder. For example, various methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC) can be applied in response to the method performed in the video encoder.

[0094] The entropy decoding unit (210) can decode information related to intra prediction and inter prediction performed in the encoder.

[0095] The reordering unit (215) can perform reordering based on the method in which the bitstream entropy-decoded by the entropy decoding unit (210) is reordered by the encoding unit. The coefficients expressed in the form of a one-dimensional vector can be reordered by restoring them back to coefficients in the form of a two-dimensional block. The reordering unit (215) can perform reordering by receiving information related to the coefficient scanning performed by the encoding unit and performing reverse scanning based on the scanning order performed by the corresponding encoding unit.

[0096] The inverse quantization unit (220) can perform inverse quantization based on the quantization parameters provided by the encoder and the coefficient values ​​of the rearranged block.

[0097] The inverse transform unit (225) can perform inverse transform, i.e., inverse DCT, inverse DST, and inverse KLT, on the transforms performed by the transform unit, i.e., DCT, DST, and KLT, on the quantization result performed by the image encoder. The inverse transform can be performed based on the transmission unit determined by the image encoder. In the inverse transform unit (225) of the image decoder, a transform technique (e.g., DCT, DST, KLT) can be selectively performed according to a plurality of pieces of information, such as a prediction method, the size of the current block, and the prediction direction.

[0098] The prediction unit (230, 235) can generate a prediction block based on the prediction block generation related information provided by the entropy decoding unit (210) and the previously decoded block or picture information provided by the memory (245).

[0099] As described above, when performing intra prediction in the same manner as the operation in the image encoder, if the size of the prediction unit and the size of the transformation unit are the same, intra prediction for the prediction unit is performed based on the pixels on the left side of the prediction unit, the pixels on the upper left side, and the pixels on the upper side. However, when performing intra prediction, if the size of the prediction unit and the size of the transformation unit are different, intra prediction can be performed using reference pixels based on the transformation unit. In addition, intra prediction using NxN division only for the minimum coding unit can be used.

[0100] The prediction unit (230, 235) may include a prediction unit determination unit, an inter prediction unit, and an intra prediction unit. The prediction unit determination unit may receive various information such as prediction unit information input from the entropy decoding unit (210), prediction mode information of an intra prediction method, and motion prediction-related information of an inter prediction method, and may distinguish a prediction unit from a current encoding unit and determine whether the prediction unit performs inter prediction or intra prediction. The inter prediction unit (230) may perform inter prediction on the current prediction unit based on information included in at least one of a previous picture or a subsequent picture of the current picture including the current prediction unit, using information necessary for inter prediction of the current prediction unit provided from the image encoder. Alternatively, inter prediction may be performed based on information of a pre-restored portion of the current picture including the current prediction unit.

[0101] In order to perform inter prediction, it is possible to determine whether the motion prediction method of the prediction unit included in the encoding unit is Skip Mode, Merge Mode, AMVP Mode, or Intra Block Copy Mode based on the encoding unit.

[0102] The intra prediction unit (235) can generate a prediction block based on pixel information in the current picture. If the prediction unit is a prediction unit that has performed intra prediction, intra prediction can be performed based on intra prediction mode information of the prediction unit provided by the image encoder. The intra prediction unit (235) can include an AIS (Adaptive Intra Smoothing) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter is a part that performs filtering on the reference pixels of the current block, and can determine and apply whether to apply the filter according to 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 and AIS filter information of the prediction unit provided by the image encoder. If the prediction mode of the current block is a mode that does not perform AIS filtering, the AIS filter may not be applied.

[0103] The reference pixel interpolation unit can interpolate the reference pixel to generate a reference pixel of a pixel unit less than an integer value when the prediction mode of the prediction unit is a prediction unit that performs intra prediction based on the pixel value interpolated from the reference pixel. When the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating the reference pixel, the reference pixel may not be interpolated. The DC filter can generate a prediction block through filtering when the prediction mode of the current block is the DC mode.

[0104] 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.

[0105] Information about whether a deblocking filter has been applied to a corresponding block or picture can be received from the video encoder, and if a deblocking filter has been applied, information about whether a strong or weak filter has been applied. The deblocking filter of the video decoder can receive information related to the deblocking filter provided by the video encoder, and the video decoder can perform deblocking filtering on the corresponding block.

[0106] The offset correction unit can perform offset correction on the restored image based on the type of offset correction applied to the image during encoding and offset value information.

[0107] ALF can be applied to a coding unit based on information such as whether ALF is applied and ALF coefficient information provided from the encoder. This ALF information can be provided by being included in a specific parameter set.

[0108] The memory (245) can store a restored picture or block so that it can be used as a reference picture or reference block, and can also provide the restored picture to an output unit.

[0109] As described above, in the following embodiments of the present invention, for convenience of explanation, the term coding unit is used as an encoding unit, but it may also be a unit that performs not only encoding but also decoding.

[0110] In addition, the current block represents a block to be encoded / decoded, and may represent a coding tree block (or coding tree unit), an encoding block (or encoding unit), a transformation block (or transformation unit), or a prediction block (or prediction unit), depending on the encoding / decoding step.

[0111]

[0112] A picture can be encoded / decoded by partitioning it into square or non-square basic blocks. At this time, the basic block can be called a coding tree unit. The coding tree unit can be defined as a coding unit with the largest size allowed in a sequence or slice. Information related to whether the coding tree unit is square or non-square or the size of the coding tree unit can be signaled through a sequence parameter set, a picture parameter set, or a slice header. The coding tree unit can be partitioned into partitions of smaller sizes. At this time, if a partition created by partitioning the coding tree unit is said to have depth 1, the partition created by partitioning the partition with depth 1 can be defined as having depth 2. In other words, a partition created by partitioning a partition with depth k within the coding tree unit can be defined as having depth k+1.

[0113] A partition of arbitrary size generated by splitting a coding tree unit can be defined as a coding unit. A coding unit can be split recursively, or split into basic units for performing prediction, quantization, transformation, or in-loop filtering. For example, a partition of arbitrary size generated by splitting a coding unit can be defined as a coding unit, or a transformation unit or prediction unit, which are basic units for performing prediction, quantization, transformation, or in-loop filtering.

[0114] Partitioning of a coding tree unit or coding unit may be performed based on at least one of a vertical line or a horizontal line. In addition, the number of vertical lines or horizontal lines partitioning the coding tree unit or coding unit may be at least one. For example, a coding tree unit or coding unit may be divided into two partitions using one vertical line or one horizontal line, or a coding tree unit or coding unit may be divided into three partitions using two vertical lines or two horizontal lines. Alternatively, a coding tree unit or coding unit may be divided into four partitions, each having a length and width of 1 / 2, using one vertical line and one horizontal line.

[0115] When a coding tree unit or a coding unit is divided into multiple partitions using at least one vertical line or at least one horizontal line, the partitions may have uniform sizes or different sizes. Alternatively, one partition may have a different size from the other partitions.

[0116] In the embodiments described below, it is assumed that the coding tree unit or coding unit is partitioned into a quad tree, triple tree, or binary tree structure. However, partitioning of the coding tree unit or coding unit using a larger number of vertical lines or a larger number of horizontal lines is also possible.

[0117] FIG. 3 illustrates an example of hierarchically dividing coding blocks based on a tree structure, as an embodiment of the present invention.

[0118] The input video signal is decoded in units of a predetermined block, and the basic unit for decoding the input video signal in this way is called a coding block. The coding block can be a unit that performs intra / inter prediction, transformation, and quantization. In addition, a prediction mode (e.g., an intra-screen prediction mode or an inter-screen prediction mode) is determined in units of the coding block, and the prediction blocks included in the coding block can share the determined prediction mode. The coding block can be a square or non-square block having any size in the range of 8x8 to 64x64, and can be a square or non-square block having a size of 128x128, 256x256, or more.

[0119] Specifically, the coding block can be hierarchically partitioned based on at least one of a quad tree, a triple tree, and a binary tree. Here, the quad tree-based partitioning may mean a method in which a 2Nx2N coding block is partitioned into four NxN coding blocks, the triple tree-based partitioning may mean a method in which one coding block is partitioned into three coding blocks, and the binary tree-based partitioning may mean a method in which one coding block is partitioned into two coding blocks. Even if the triple tree-based partitioning or the binary tree-based partitioning is performed, square coding blocks may exist in lower depths. Alternatively, after the triple tree-based partitioning or the binary tree-based partitioning is performed, the generation of square coding blocks in lower depths may be restricted.

[0120] Binary tree-based partitioning can be performed symmetrically or asymmetrically. Coding blocks partitioned based on binary trees can be square blocks or non-square blocks such as rectangles. For example, partition shapes that allow binary tree-based partitioning can include at least one of symmetric 2NxN (horizontal non-square coding units) or Nx2N (vertical non-square coding units), and asymmetric nLx2N, nRx2N, 2NxnU, or 2NxnD, as in the example illustrated in FIG. 4.

[0121] Binary tree-based partitioning may restrictively allow only one of the symmetric or asymmetric partitioning types. In this case, configuring a coding tree unit with square blocks corresponds to quad-tree CU partitioning, while configuring a coding tree unit with symmetric non-square blocks corresponds to binary tree partitioning. Configuring a coding tree unit with square blocks and symmetric non-square blocks corresponds to quad and binary tree CU partitioning.

[0122] Binary tree-based partitioning can be performed on coding blocks for which quad tree-based partitioning is no longer performed. For coding blocks partitioned based on binary trees, at least one of quad tree-based partitioning, triple tree-based partitioning, or binary tree-based partitioning can be configured to no longer be performed.

[0123] Alternatively, a triple-tree-based partition or a binary-tree-based partition may be allowed for a binary-tree-based partitioned coding block, but only one of the horizontal or vertical partitions may be allowed.

[0124] For example, depending on the position, index, shape, additional splitting shape of neighboring partitions, etc. of the coding block split based on the binary tree, additional splitting or additional splitting direction may be restricted for the coding block split based on the binary tree. For example, when the index of the coding block having a front coding order among two coding blocks generated by the binary tree-based splitting is 0 (hereinafter, coding block index 0), and the index of the coding block having a back coding order is 1 (hereinafter, coding block index 1), if the binary tree-based splitting is applied to both the coding block having the coding block index 0 or the coding block index 1, the binary tree-based splitting direction of the coding block having the coding block index 1 may be determined according to the binary tree-based splitting direction of the coding block having the coding block index 0. Specifically, when the binary tree-based partitioning direction of a coding block having a coding block index of 0 is to partition the coding block having a coding block index of 0 into square partitions, the binary tree-based partitioning of the coding block having a coding block index of 1 can be restricted to have a different direction from the binary tree-based partitioning of the coding block having a coding block index of 1. That is, both the coding blocks having a coding block index of 0 and the coding block index of 1 can be restricted from being partitioned into square partitions. In this case, encoding / decoding of information indicating the binary tree partitioning direction of the coding block having a coding block index of 1 can be omitted. This is because partitioning both the coding blocks having a coding block index of 0 and the coding block index of 1 into square partitions has the same effect as partitioning the upper depth block based on a quad tree, and therefore, allowing both the coding block index of 0 and the coding block index of 1 to be partitioned into square partitions is not desirable in terms of encoding efficiency.

[0125] Triple-tree-based partitioning refers to dividing a coding block into three partitions in a horizontal or vertical direction. All three partitions generated by the triple-tree-based partitioning may have different sizes. Alternatively, two of the partitions generated by the triple-tree-based partitioning may have the same size and the remaining one may have a different size. For example, the width or height ratio of the partitions generated by dividing the coding block may be set to 1:n:1, 1:1:n, n:1:1, or m:n:1 depending on the partitioning direction. Here, m and n may be 1 or real numbers greater than 1, such as integers such as 2.

[0126] Triple-tree-based partitioning can be performed on coding blocks for which quad-tree-based partitioning is no longer performed. For coding blocks partitioned based on a triple-tree, at least one of quad-tree-based partitioning, triple-tree-based partitioning, or binary-tree-based partitioning can be configured to no longer be performed.

[0127] Alternatively, for a coding block partitioned based on a triple tree, either a triple tree-based partition or a binary tree-based partition may be allowed, but only one of the horizontal or vertical partitions may be allowed in a restricted manner.

[0128] For example, depending on the location, index, shape, size, additional partitioning type of neighboring partitions, etc. of the coding block partitioned based on the triple tree, additional partitioning or additional partitioning direction for the coding block partitioned based on the triple tree may be restricted. For example, for the partition with the largest size among the coding blocks generated by the triple tree-based partitioning, either horizontal partitioning or vertical partitioning may be restricted. Specifically, for the partition with the largest size among the coding blocks generated by the triple tree-based partitioning, binary tree partitioning in the same direction as the triple tree partitioning direction of the upper depth partition or triple tree partitioning in the same direction may not be permitted. In this case, encoding / decoding of information indicating the binary tree partitioning direction or the triple tree partitioning direction may be omitted for the largest partition among the coding blocks partitioned based on the triple tree.

[0129] Depending on the size or shape of the current block, binary tree- or triple tree-based partitioning may be restricted. Here, the size of the current block may be expressed based on at least one of the width, height, minimum / maximum of width / height, sum of width and height, product of width and height, or number of samples contained in the current block. For example, if at least one of the width or height of the current block is greater than a predefined value, binary tree- or triple tree-based partitioning may not be allowed. Here, the predefined value may be an integer such as 16, 32, 64, or 128. As another example, if the width and height ratio of the current block is greater than or less than a predefined value, binary tree- or triple tree-based partitioning may not be allowed. If the predefined value is 1, binary tree- or triple tree-based partitioning may be allowed only if the current block is a square block with equal width and height.

[0130] The partitioning of a lower depth may be determined dependently on the partitioning form of a higher depth. For example, if binary tree-based partitioning is allowed in two or more depths, only binary tree-based partitioning of the same form as the binary tree partitioning form of the higher depth may be allowed in the lower depths. For example, if binary tree-based partitioning in the form of 2NxN is performed in the upper depth, binary tree-based partitioning in the form of 2NxN may also be performed in the lower depths. Alternatively, if binary tree-based partitioning in the form of Nx2N is performed in the upper depth, binary tree-based partitioning in the form of Nx2N may also be allowed in the lower depths.

[0131] Conversely, at lower depths, it is also possible to allow only binary tree-based splits that have a different form from the binary tree splits at higher depths.

[0132] For a sequence, slice, coding tree unit or coding unit, only a specific form of binary tree-based partitioning or a specific form of triple tree-based partitioning may be restricted to be used. For example, for a coding tree unit, only a binary tree-based partitioning of the form 2NxN or Nx2N may be restricted to be allowed. The allowed partition shapes may be predefined in the encoder or decoder, or information about the allowed or disallowed partition shapes may be encoded and signaled through the bitstream.

[0133] FIG. 5 is a diagram showing an example in which only a specific type of binary tree-based partitioning is allowed. FIG. 5 (a) shows an example in which only a binary tree-based partitioning of an Nx2N type is allowed, and FIG. 5 (b) shows an example in which only a binary tree-based partitioning of a 2NxN type is allowed. In order to implement the above quad-tree or binary tree-based adaptive partitioning, information indicating quad-tree-based partitioning, information regarding the size / depth of a coding block in which quad-tree-based partitioning is allowed, information indicating binary tree-based partitioning, information regarding the size / depth of a coding block in which binary tree-based partitioning is allowed, information regarding the size / depth of a coding block in which binary tree-based partitioning is not allowed, or information regarding whether binary tree-based partitioning is vertical or horizontal may be used.

[0134] Additionally, for a coding tree unit or a given coding unit, the number of times binary tree splitting / triple tree splitting is allowed, the depth at which binary tree splitting / triple tree splitting is allowed, or the number of depths at which binary tree splitting / triple tree splitting is allowed, etc. can be obtained. The above information can be encoded in units of coding tree units or coding units and transmitted to a decoder via a bitstream.

[0135] For example, the syntax 'max_binary_depth_idx_minus1', which indicates the maximum depth at which binary tree splitting is allowed, can be encoded / decoded through the bitstream. In this case, max_binary_depth_idx_minus1+1 can indicate the maximum depth at which binary tree splitting is allowed.

[0136] Referring to the example illustrated in FIG. 6, in FIG. 6, binary tree splitting is illustrated as being performed on a coding unit with a depth of 2 and a coding unit with a depth of 3. Accordingly, at least one of information indicating the number of times binary tree splitting is performed within the coding tree unit (2 times), information indicating the maximum depth (depth 3) at which binary tree splitting is allowed within the coding tree unit, or information indicating the number of depths (2, depth 2 and depth 3) at which binary tree splitting is allowed within the coding tree unit can be encoded / decoded through the bitstream.

[0137] As another example, at least one of the number of times binary tree splitting / triple tree splitting is allowed, the depth at which binary tree splitting / triple tree splitting is allowed, or the number of depths at which binary tree splitting / triple tree splitting is allowed may be obtained for each sequence, picture, or slice. As an example, the information may be encoded for each sequence, picture, or slice and transmitted through a bitstream. Alternatively, the depth at which binary tree splitting / triple tree splitting is allowed, or the number of depths at which binary tree splitting / triple tree splitting is allowed, may be predefined for each sequence, picture, or slice. Accordingly, at least one of the number of times binary tree / triple tree splitting is allowed, the maximum depth at which binary tree / triple tree splitting is allowed, or the number of depths at which binary tree / triple tree splitting is allowed, of the first slice and the second slice may be different. For example, in the first slice, binary tree splits may be allowed only at one depth, whereas in the second slice, binary tree splits may be allowed at two depths.

[0138] As another example, at least one of the number of times binary tree / triple tree splitting is allowed, the depth at which binary tree / triple tree splitting is allowed, or the number of depths at which binary tree / triple tree splitting is allowed may be set differently depending on the temporal identifier (TemporalID) of the slice or picture. Here, the temporal identifier (TemporalID) is for identifying each of a plurality of layers of an image having at least one or more scalability among view, spatial, temporal, or quality.

[0139] As illustrated in FIG. 3, a first coding block 300 having a split depth of k may be split into a plurality of second coding blocks based on a quad tree. For example, the second coding blocks 310 to 340 are square blocks having a size half the width and height of the first coding block, and the split depth of the second coding block may be increased to k+1.

[0140] A second coding block 310 having a split depth of k+1 may be split into a plurality of third coding blocks having a split depth of k+2. Splitting of the second coding block 310 may be performed selectively using either a quad tree or a binary tree depending on the splitting method. Here, the splitting method may be determined based on at least one of information indicating a quad tree-based splitting or information indicating a binary tree-based splitting.

[0141] When the second coding block 310 is split based on a quad tree, the second coding block 310 is split into four third coding blocks 310a each having a size equal to half the width and height of the second coding block, and the split depth of the third coding block 310a can be increased to k+2. On the other hand, when the second coding block 310 is split based on a binary tree, the second coding block 310 can be split into two third coding blocks. At this time, each of the two third coding blocks is a non-square block in which one of the width and height of the second coding block is half the size, and the split depth can be increased to k+2. The second coding block can be determined as a horizontal or vertical non-square block depending on the splitting direction, and the splitting direction can be determined based on information about whether the binary tree-based splitting is in the vertical or horizontal direction.

[0142] Meanwhile, the second coding block 310 may be determined as a terminal coding block that is no longer split based on a quad tree or binary tree, in which case the coding block may be used as a prediction block or a transformation block.

[0143] The third coding block 310a may be determined as a terminal coding block, similar to the division of the second coding block 310, or may be further divided based on a quad tree or binary tree.

[0144] Meanwhile, the third coding block 310b divided based on the binary tree may be further divided based on the binary tree into a vertical coding block (310b-2) or a horizontal coding block (310b-3), and the division depth of the corresponding coding block may be increased to k+3. Alternatively, the third coding block 310b may be determined as a terminal coding block (310b-1) that is no longer divided based on the binary tree, and in this case, the corresponding coding block (310b-1) may be used as a prediction block or a transform block. However, the above-described division process may be performed restrictively based on at least one of information about the size / depth of a coding block for which quad-tree-based division is allowed, information about the size / depth of a coding block for which binary tree-based division is allowed, or information about the size / depth of a coding block for which binary tree-based division is not allowed.

[0145] The size that a coding block can have may be limited to a certain number, or the size of a coding block within a certain unit may have a fixed value. For example, the size of a coding block within a sequence or a coding block within a picture may be limited to 256x256, 128x128, or 32x32. Information indicating the size of a coding block within a sequence or picture may be signaled through a sequence header or a picture header.

[0146] As a result of partitioning based on quad trees, binary trees and triple trees, the coding units can be square or rectangular of arbitrary size.

[0147]

[0148] The coding block can be encoded / decoded using at least one of skip mode, intra-screen prediction, inter-screen prediction or skip method.

[0149] As another example, intra-prediction or inter-prediction can be performed in units of the same size as or smaller than the coding block by partitioning the coding block. To this end, once the coding block is determined, a prediction block can be determined through prediction partitioning of the coding block. The prediction partitioning of the coding block can be performed by a partition mode (Part_mode) indicating the partition shape of the coding block. The size or shape of the prediction block can be determined according to the partition mode of the coding block. For example, the size of the prediction block determined according to the partition mode can be equal to or smaller than the size of the coding block.

[0150] Figure 7 is a diagram illustrating a partition mode that can be applied to a coding block when the coding block is encoded with inter-screen prediction.

[0151] When a coding block is encoded with inter-screen prediction, any one of eight partition modes can be applied to the coding block, as in the example illustrated in FIG. 7.

[0152] If a coding block is encoded with intra-picture prediction, the coding block may have a partition mode PART_2Nx2N or PART_NxN applied.

[0153] PART_NxN can be applied when the coding block has a minimum size. Here, the minimum size of the coding block may be predefined in the encoder and decoder. Alternatively, information regarding the minimum size of the coding block may be signaled through the bitstream. For example, the minimum size of the coding block may be signaled through the slice header, and thus the minimum size of the coding block may be defined for each slice.

[0154] In general, the size of the prediction block can be from 64x64 to 4x4. However, if the coding block is encoded with inter-screen prediction, the prediction block may not have a size of 4x4 to reduce memory bandwidth when performing motion compensation.

[0155]

[0156] FIG. 8 illustrates an example of an intra prediction mode pre-defined in an image encoder / decoder to which the present invention is applied.

[0157] A video encoder / decoder can perform intra prediction using any one of the predefined intra prediction modes. The predefined intra prediction modes for intra prediction can be composed of a non-directional prediction mode (e.g., planar mode, DC mode) and 33 directional prediction modes.

[0158] Alternatively, a greater number of directional prediction modes than the 33 directional prediction modes can be used to improve the accuracy of intra prediction. That is, the angles of the directional prediction modes can be further refined to define M extended directional prediction modes (M>33), or a directional prediction mode with a predetermined angle can be derived and used by utilizing at least one of the 33 pre-defined directional prediction modes.

[0159] Specifically, it is possible to utilize more intra prediction modes than the 35 intra prediction modes illustrated in FIG. 8. Using more intra prediction modes than the 35 intra prediction modes illustrated in FIG. 8 can be referred to as extended intra prediction modes.

[0160] Figure 9 illustrates an example of an extended intra prediction mode, which may be comprised of two non-directional prediction modes and 65 extended directional prediction modes. The extended intra prediction mode may be used equally for both luminance and chrominance components, or may use different numbers of intra prediction modes for each component. For example, 67 extended intra prediction modes may be used for the luminance component, and 35 intra prediction modes may be used for the chrominance component.

[0161] Alternatively, intra prediction can be performed using different numbers of intra prediction modes depending on the chrominance format. For example, in the 4:2:0 format, intra prediction can be performed using 67 intra prediction modes for the luminance component and 35 intra prediction modes for the chrominance component, and in the 4:4:4 format, intra prediction can be performed using 67 intra prediction modes for both the luminance component and the chrominance component.

[0162] Alternatively, intra prediction can be performed using different numbers of intra prediction modes depending on the size and / or shape of the block. That is, intra prediction can be performed using 35 intra prediction modes or 67 intra prediction modes depending on the size and / or shape of the PU or CU. For example, if the size of the CU or PU is smaller than 64x64 or is an asymmetric partition, intra prediction can be performed using 35 intra prediction modes, and if the size of the CU or PU is equal to or larger than 64x64, intra prediction can be performed using 67 intra prediction modes. Intra_2Nx2N may allow 65 directional intra prediction modes, and Intra_NxN may allow only 35 directional intra prediction modes.

[0163] The size of the block to which the extended intra prediction mode is applied may be set differently for each sequence, picture, or slice. For example, in the first slice, the extended intra prediction mode may be set to be applied to a block larger than 64x64 (e.g., CU or PU), and in the second slice, the extended intra prediction mode may be set to be applied to a block larger than 32x32. Information indicating the size of the block to which the extended intra prediction mode is applied may be signaled for each sequence, picture, or slice. For example, information indicating the size of the block to which the extended intra prediction mode is applied may be defined as 'log2_extended_intra_mode_size_minus4', which is obtained by taking the logarithm of the block size and then subtracting the integer 4. For example, a value of 0 for log2_extended_intra_mode_size_minus4 may indicate that the extended intra prediction mode can be applied to a block having a size of 16x16 or more or a block having a size greater than 16x16, and a value of 1 for log2_extended_intra_mode_size_minus4 may indicate that the extended intra prediction mode can be applied to a block having a size of 32x32 or more or a block having a size greater than 32x32.

[0164] As described above, the number of intra prediction modes can be determined by considering at least one of the chrominance component, the chrominance format, the size or shape of the block. In addition to the described example, the intra prediction mode candidates (e.g., the number of MPMs) used to determine the intra prediction mode of the encoding / decoding target block can also be determined according to at least one of the chrominance component, the chrominance format, the size or shape of the block. In addition, it is also possible to use a greater number of intra prediction modes than those illustrated in FIG. 8. For example, it is also possible to further subdivide the directional prediction modes illustrated in FIG. 8 to use 129 directional prediction modes and 2 non-directional prediction modes. Whether to use a greater number of intra prediction modes than those illustrated in FIG. 8 can be determined by considering at least one of the chrominance component, the chrominance format, the size or shape of the block, as in the above-described example.

[0165] With reference to the drawings described below, a method for determining an intra prediction mode of a block to be encoded / decoded and a method for performing intra prediction using the determined intra prediction mode will be described.

[0166]

[0167] FIG. 10 is a flowchart schematically illustrating an intra prediction method as an embodiment to which the present invention is applied.

[0168] Referring to FIG. 10, the intra prediction mode of the current block can be determined (S1000).

[0169] Specifically, the intra prediction mode of the current block can be derived based on a candidate list and an index. Here, the candidate list includes multiple candidates, and the multiple candidates can be determined based on the intra prediction modes of neighboring blocks adjacent to the current block. The neighboring blocks can include at least one of blocks located above, below, to the left, to the right, or at a corner of the current block. The index can specify any one of the multiple candidates in the candidate list. The candidate specified by the index can be set as the intra prediction mode of the current block.

[0170] The intra prediction mode used by the surrounding blocks for intra prediction can be set as a candidate. For example, candidates can be derived based on the intra prediction modes of the left block, the upper block, the lower-left corner adjacent block, the upper-right corner adjacent block, and the upper-left corner adjacent block of the current block. If the surrounding blocks are encoded using inter prediction, the intra prediction mode of the collocated blocks of the surrounding blocks can be used to derive candidates for the current block.

[0171] Additionally, an intra prediction mode having a similar directionality to the intra prediction mode of a neighboring block may be set as a candidate. Here, the intra prediction mode having a similar directionality may be determined by adding or subtracting a predetermined constant value to the intra prediction mode of the neighboring block. The predetermined constant value may be an integer of 1, 2, or a larger integer, and the predetermined constant value may be adaptively determined according to the number of available intra prediction modes. For example, when the number of available intra prediction modes is 35, the predetermined constant value may be set to 1, and when the number of available intra prediction modes is 67, the predetermined constant value may be set to 2. Furthermore, when the number of available intra prediction modes is 131, the predetermined constant value may be set to 4.

[0172] The above candidate list may further include a default mode. The default mode may include at least one of the planar mode, DC mode, vertical mode, horizontal mode, upper-right diagonal mode, and upper-left diagonal mode. The default mode may be adaptively added considering the maximum number of candidates that can be included in the candidate list of the current block.

[0173] The maximum number of candidates that can be included in the candidate list can be 3, 4, 5, 6, 7, or more. The maximum number of candidates that can be included in the candidate list can be a fixed value preset in the video encoder / decoder, or can be variably determined based on the properties of the current block. The properties can mean the position / size / shape of the block, the number / type of intra prediction modes that the block can use, chrominance properties, chrominance format, etc. Alternatively, information indicating the maximum number of candidates that can be included in the candidate list can be separately signaled, and the maximum number of candidates that can be included in the candidate list can be variably determined using this. The information indicating the maximum number of candidates can be signaled at least one of a sequence level, a picture level, a slice level, or a block level.

[0174] Candidates included in the candidate list may be arranged in a predefined order. For example, the candidates may be arranged in the following order: left block, top block, bottom left block, top right block, and top left block. Alternatively, the candidate arrangement order may be determined variably depending on the size or shape of the current block. For example, if the current block is a non-square block with a height greater than its width, the intra prediction mode of the top block may be arranged with a higher priority than the intra prediction mode of the left block.

[0175] When the extended intra prediction mode and the 35 predefined intra prediction modes are optionally used, the intra prediction modes of the surrounding blocks can be converted into indices corresponding to the extended intra prediction mode or into indices corresponding to the 35 intra prediction modes to derive candidates. A predefined table can be used to convert the indices, or a scaling operation based on a predetermined value can be used. Here, the predefined table can define a mapping relationship between different intra prediction mode groups (e.g., the extended intra prediction mode and the 35 intra prediction modes).

[0176] For example, if the left neighboring block uses 35 intra prediction modes and the intra prediction mode of the left neighboring block is 10 (horizontal mode), this can be converted to index 16 corresponding to the horizontal mode in the extended intra prediction mode.

[0177] Alternatively, if the upper surrounding block uses the extended intra prediction mode and the intra prediction mode index of the upper surrounding block is 50 (vertical mode), it can be converted to index 26 corresponding to the vertical mode in the 35 intra prediction modes.

[0178] Based on the intra prediction mode determination method described above, intra prediction modes may be derived independently for each of the luminance component and the chrominance component, or the chrominance component may be derived as a dependency on the intra prediction mode of the luminance component.

[0179] Specifically, the intra prediction mode of the chrominance component can be determined based on the intra prediction mode of the luminance component, as shown in Table 1 below.

[0180] Intra_chroma_pred_mode[xCb][yCb]IntraPredModeY[xCb][yCb]026101X(0<=X<=34)0340000126342626262101034101031113414026101X

[0181] In Table 1, intra_chroma_pred_mode represents information signaled to specify the intra prediction mode of the chrominance component, and IntraPredModeY represents the intra prediction mode of the luminance component.

[0182] Once the candidate list is determined, information indicating whether a candidate with the same intra prediction mode as the current block is included in the candidate list can be decoded. If the information indicates that a candidate with the same intra prediction mode as the current block is included in the candidate list, index information (e.g., MPM_index) indicating one of the candidates can be decoded. The intra prediction mode of the current block can be set to be identical to the intra prediction mode of the candidate indicated by the index information.

[0183] On the other hand, if the information indicates that a candidate having the same intra prediction mode as the current block is not included in the candidate list, residual intra prediction mode information (e.g., rem_intra_mode) specifying any one of the residual intra prediction modes excluding the candidate may be decoded. The intra prediction mode of the current block may be determined based on the intra prediction mode indicated by the residual intra prediction mode information. For example, the current intra prediction mode may be determined by comparing the candidate with the intra prediction mode indicated by the residual intra prediction mode. For example, if the intra prediction mode of the candidate is smaller than the intra prediction mode indicated by the residual intra prediction mode, the intra prediction mode of the current block may be derived by adding 1 to the residual intra prediction mode.

[0184] Referring to FIG. 10, a reference sample for intra prediction of the current block can be derived (S1010).

[0185] Specifically, reference samples for intra prediction can be derived based on surrounding samples of the current block. The surrounding samples may refer to reconstructed samples of the above-described surrounding blocks, which may be reconstructed samples before the in-loop filter is applied or reconstructed samples after the in-loop filter is applied.

[0186] A surrounding sample restored before the current block may be used as a reference sample, or a surrounding sample filtered based on a predetermined intra filter may be used as a reference sample. Filtering a surrounding sample using an intra filter may be referred to as reference sample smoothing. The intra filter may include at least one of a first intra filter applied to a plurality of surrounding samples positioned on the same horizontal line or a second intra filter applied to a plurality of surrounding samples positioned on the same vertical line. Depending on the position of the surrounding sample, either the first intra filter or the second intra filter may be selectively applied, or two intra filters may be applied redundantly. At this time, the filter coefficient of at least one of the first intra filter or the second intra filter may be (1, 2, 1), but is not limited thereto.

[0187] The filtering may be adaptively performed based on at least one of the intra prediction mode of the current block or the size of the transform block for the current block. For example, if the intra prediction mode of the current block is DC mode, vertical mode, or horizontal mode, filtering may not be performed. If the size of the transform block is NxM, filtering may not be performed. Here, N and M may be the same or different values, and may be any of 4, 8, 16, or more. For example, if the size of the transform block is 4x4, filtering may not be performed. Alternatively, filtering may be selectively performed based on a comparison result between the difference between the intra prediction mode of the current block and the vertical mode (or horizontal mode) and a pre-defined threshold. For example, filtering may be performed only when the difference between the intra prediction mode of the current block and the vertical mode is greater than the threshold. The threshold may be defined for each size of the transform block, as shown in Table 2.

[0188] 8x8 transform16x16 transform32x32 transformThreshold710

[0189] The intra filter may be determined as one of a plurality of intra filter candidates predefined in the video encoder / decoder. For this purpose, a separate index specifying the intra filter of the current block among the plurality of intra filter candidates may be signaled. Alternatively, the intra filter may be determined based on at least one of the size / shape of the current block, the size / shape of the transform block, information about the filter strength, or the variation of surrounding samples.

[0190] Intra prediction of the current block may be performed using multiple reference sample lines. For example, it may be performed using two or more reference sample lines.

[0191] Whether to perform intra prediction using multiple reference sample lines can be adaptively determined based on the size, shape, or intra prediction mode of the current block. For example, if the intra prediction mode of the current block is a non-directional intra prediction mode or an intra prediction mode in a specific direction, performing intra prediction using multiple reference sample lines can be restricted. Here, the specific direction can include a vertical direction, a horizontal direction, a diagonal direction, etc.

[0192] Referring to FIG. 10, intra prediction can be performed using the intra prediction mode and reference sample of the current block (S1020).

[0193] That is, a prediction sample of the current block can be obtained using the intra prediction mode determined in S1000 and the reference sample derived in S1010. When intra prediction is performed using multiple reference sample lines, a prediction sample can be obtained based on a weighted sum of reference samples belonging to different reference sample lines. For example, a prediction sample can be derived based on a weighted sum of a first reference sample belonging to a first reference sample line and a second reference sample belonging to a second reference sample line. At this time, the weights applied to the first reference sample and the second reference sample may have the same value or may have different values ​​depending on the distance from the prediction target sample. For example, a higher weight can be given to a first reference sample and a second reference sample having a closer distance from the prediction target sample.

[0194] However, intra prediction may result in a reduction in the image quality of the predicted image because it utilizes boundary samples from surrounding blocks. Therefore, a correction process may be performed on the prediction samples generated through the above-described prediction process, which will be discussed in detail below with reference to Figure 11. However, the correction process described below is not limited to intra prediction samples, and can also be applied to inter prediction samples or restored samples.

[0195]

[0196] FIG. 11 illustrates an embodiment to which the present invention is applied, and illustrates a method for correcting a prediction sample of a current block based on differential information of surrounding samples.

[0197] A prediction sample of a current block can be corrected based on differential information of multiple surrounding samples for the current block. The correction may be performed on all prediction samples belonging to the current block, or may be performed only on prediction samples belonging to a predetermined partial region. The partial region may be one row / column or multiple rows / columns, which may be a region pre-configured for correction in a video encoder / decoder. For example, correction may be performed on one row / column located at the boundary of the current block, or on multiple rows / columns from the boundary of the current block. Alternatively, the partial region may be variably determined based on at least one of the size / shape or the intra prediction mode of the current block.

[0198] The surrounding samples may belong to at least one of the surrounding blocks located at the top, left, or upper-left corner of the current block. The number of surrounding samples used for correction may be two, three, four, or more. The positions of the surrounding samples may be determined variably depending on the positions of the prediction samples to be corrected within the current block. Alternatively, some of the surrounding samples may have fixed positions regardless of the positions of the prediction samples to be corrected, while the rest may have variable positions depending on the positions of the prediction samples to be corrected.

[0199] The difference information of surrounding samples may refer to a difference sample between surrounding samples, or may refer to a value obtained by scaling the difference sample by a predetermined constant value (e.g., 1, 2, 3, etc.). Here, the predetermined constant value may be determined by considering the position of the prediction sample to be corrected, the position of the column or row to which the prediction sample to be corrected belongs, the position of the prediction sample within the column or row, etc.

[0200] For example, if the intra prediction mode of the current block is vertical mode, the final prediction sample can be obtained as in the following mathematical expression 1 by using the difference sample between the surrounding sample p(-1,y) adjacent to the left boundary of the current block and the upper left surrounding sample p(-1,-1).

[0201]

[0202] For example, if the intra prediction mode of the current block is horizontal mode, the final prediction sample can be obtained as in the following mathematical expression 2 by using the difference sample between the surrounding sample p(x,-1) adjacent to the upper boundary of the current block and the upper left surrounding sample p(-1,-1).

[0203]

[0204] For example, if the intra prediction mode of the current block is vertical mode, the final prediction sample can be obtained by using the difference sample between the surrounding sample p(-1, y) adjacent to the left boundary of the current block and the surrounding sample p(-1, -1) at the upper left. At this time, the difference sample can be added to the prediction sample, or the difference sample can be scaled by a predetermined constant value and then added to the prediction sample. The predetermined constant value used for scaling can be determined differently according to the column and / or row. For example, the prediction sample can be corrected as in the following mathematical expressions 3 and 4.

[0205]

[0206]

[0207] For example, if the intra prediction mode of the current block is horizontal mode, the final prediction sample can be obtained by using the difference sample between the surrounding sample p(x,-1) adjacent to the upper boundary of the current block and the upper left surrounding sample p(-1,-1), as described above in the vertical mode. For example, the prediction sample can be corrected as in the following mathematical expressions 5 and 6.

[0208]

[0209]

[0210] If the intra prediction mode of the current block is a directional prediction mode, intra prediction of the current block can be performed based on the directionality of the directional prediction mode. As an example, Table 3 shows the intra direction parameters (intraPredAng) of Mode 2 to Mode 34, which are directional intra prediction modes illustrated in FIG. 8.

[0211] predModeIntra12345678910111213141516intraPredAng-32262117139520-2-5-9-13-17-21predMo deIntra18192021222324252627282930313233intraPredAng-32-26-21-17-13-9-5-2025913172126

[0212] Table 3 illustrates 33 directional intra prediction modes, but it is possible to define more or fewer directional intra prediction modes.

[0213] The intra directional parameters for the current block can be determined based on a lookup table that defines the mapping relationship between directional intra prediction modes and intra directional parameters. Alternatively, the intra directional parameters for the current block can be determined based on information signaled via the bitstream.

[0214] Intra prediction of a current block can be performed using at least one of a left reference sample or an upper reference sample, depending on the directionality of the directional intra prediction mode. Here, the upper reference sample may refer to reference samples having a y-axis coordinate smaller than a prediction target sample (x, 0) included in the top row in the current block (e.g., from (-1, -1) to (2W-1, -1)), and the left reference sample may refer to reference samples having an x-axis coordinate smaller than a prediction target sample (0, y) included in the leftmost column in the current block (e.g., from (-1, -1) to (-1, 2H-1)).

[0215] Depending on the directionality of the intra prediction mode, the reference samples of the current block can be arranged one-dimensionally. Specifically, if both the top and left reference samples must be used for intra prediction of the current block, the reference samples for each target prediction sample can be selected assuming that they are arranged in a vertical or horizontal line.

[0216] For example, when the intra direction parameter is negative (e.g., for intra prediction modes corresponding to Mode 11 to Mode 25 in Table 3), the upper reference samples and the left reference samples can be rearranged along the horizontal or vertical direction to form a one-dimensional reference sample group (P_ref_1D).

[0217] Figures 12 and 13 are diagrams showing a one-dimensional reference sample group in which reference samples are rearranged in a row.

[0218] Whether the reference samples are rearranged vertically or horizontally can be determined based on the directionality of the intra prediction mode. For example, when the intra prediction mode index is between 11 and 18, as in the example illustrated in FIG. 12, the upper reference samples of the current block can be rotated counterclockwise to generate a one-dimensional reference sample group in which the left reference samples and the upper reference samples are arranged vertically.

[0219] On the other hand, when the intra prediction mode index is between 19 and 25, as in the example shown in FIG. 13, the left reference samples of the current block can be rotated clockwise to generate a one-dimensional reference sample group in which the left reference samples and the top reference samples are arranged in the horizontal direction.

[0220] If the intra direction parameter of the current block is non-negative, intra prediction for the current block can be performed using only the left reference samples or the top reference samples. Accordingly, for intra prediction modes in which the intra direction parameter is non-negative, a one-dimensional reference sample group can be generated using only the left reference samples or the top reference samples.

[0221] Based on the intra-directional parameters, a reference sample decision index iIdx can be derived to specify at least one reference sample used to predict the prediction target sample. In addition, a weight-related parameter i used to determine a weight applied to each reference sample based on the intra-directional parameters fact can be derived. As an example, the following mathematical expressions 7 and 8 illustrate examples of deriving reference sample decision indices and weight-related parameters.

[0222]

[0223]

[0224] As shown in mathematical expression 7, iIdx and i fact is variably determined according to the slope of the directional intra prediction mode. At this time, the reference sample specified by iIdx may correspond to an integer pel.

[0225] Based on the reference sample determination index, at least one reference sample can be specified for each target sample to be predicted. For example, based on the reference sample determination index, the location of a reference sample within a one-dimensional reference sample group for predicting the target sample within the current block can be specified. Based on the reference sample at the specified location, a predicted image (i.e., a predicted sample) for the target sample to be predicted can be generated.

[0226]

[0227] Considering the intra prediction mode of the current block, if the prediction target sample can be predicted using only one reference sample, a prediction image for the prediction target sample can be generated based on the reference sample specified by the intra prediction mode of the current block.

[0228] For example, if a virtual angular line according to the angle of the intra prediction mode or the slope of the intra prediction mode passes through an integer pel (i.e., a reference sample at an integer position) within a one-dimensional reference sample group, a prediction image for the prediction target sample can be generated by copying the reference sample at the integer pel position or considering the position between the reference sample at the integer pel position and the prediction target sample. As an example, the following mathematical expression 8 shows an example of generating a prediction image P(x, y) for the prediction target sample by copying the reference sample P_ref_1D(x+iIdx+1) within the one-dimensional reference sample group specified by the intra prediction mode of the current block.

[0229]

[0230] Considering the intra prediction mode of the current block, if it is determined that the prediction target sample is not predicted with only one reference sample, prediction for the prediction target sample can be performed using multiple reference samples. Specifically, according to the intra prediction mode of the current block, prediction for the prediction target sample can be performed by linearly interpolating the reference sample at a predetermined position and neighboring reference samples neighboring the reference sample at the predetermined position or by performing interpolation based on a tap filter. The number of taps of the interpolation filter can be a natural number greater than or equal to 2. Specifically, depending on the number of reference samples to be interpolated, the number of taps of the tap filter can be 2, 3, 4, 5, 6, or an integer greater than or equal to 2.

[0231] For example, if an imaginary angular line according to the angle of the intra prediction mode or the slope of the intra prediction mode does not pass through an integer pel (i.e., a reference sample at an integer position) within a one-dimensional reference sample group, a prediction image for a prediction target sample can be generated by interpolating a reference sample located on the angular line and reference samples adjacent to the left / right or above / below the reference sample. As an example, the following mathematical expression 9 shows an example of generating a prediction sample P(x, y) for a prediction target sample by interpolating two or more reference samples.

[0232]

[0233] The coefficients of the interpolation filter are the weight-related parameters i fact can be determined based on. For example, the coefficients of the interpolation filter can be determined based on the distance between a fractional pel located on an angular line and an integer pel (i.e., the integer position of each reference sample).

[0234] The following mathematical expression 10 is an example of a case where the number of taps in the tap filter is 4.

[0235]

[0236] When using a multi-tap filter, a sample at a position that does not correspond to a left reference sample or an upper reference sample can be replaced with the reference sample closest to that position. For example, in Equation 9, if the sample at position P_ref_1D(x+iIdx-1) does not correspond to the upper reference sample, the sample can be replaced with the reference sample at position P_ref_1D(x+idx). Alternatively, if the sample at position P_ref_1D(x+iIdx+2) does not correspond to the upper reference sample, the sample can be replaced with the reference sample at position P_ref_1D(x+iIdx+1).

[0237] A multi-tap filter can be applied to multiple reference samples aligned horizontally or vertically. Alternatively, the multi-tap filter can be applied to a polygonal shape, such as a square. The shape to which the multi-tap filter is applied can be variably determined based on the size, shape, or intra-prediction mode of the current block.

[0238] As shown in mathematical expressions 8 to 10, the technique of generating a prediction sample by interpolating a reference sample using the directionality of intra prediction can be called an intra prediction sample interpolation technique.

[0239] When using an intra prediction sample interpolation technique, a large number of taps in a tap filter does not necessarily guarantee improved prediction accuracy. For example, if the current block is an asymmetric coding unit with a significantly larger height or width than the other, such as 2x16, or a small block, such as 4x4, using a tap filter with more than 4 taps may result in excessive smoothing of the predicted image. Therefore, the type of tap filter can be adaptively determined based on the size, shape, or intra prediction mode of the current block. Here, the type of tap filter can be distinguished by at least one of the number of taps, filter coefficients, filter strength (strong / weak), and filtering direction. The number of filter taps or filter coefficients can be variably determined based on the filter strength. In addition, the application direction of the tap filter can be determined, such as horizontal interpolation, vertical interpolation, or both horizontal and vertical interpolation, depending on the type of tap filter. The application direction of the tap filter can also be variably set on a line-by-line (row or column) basis or a sample-by-sample basis within the current block.

[0240] Specifically, the type of tap filter to be used can be determined based on the width or height of the current block. For example, if at least one of the width or height of the current block is smaller than a predefined value, the intra prediction sample interpolation technique can be performed using a 2-tap filter instead of a 4-tap filter. On the other hand, if both the width and height of the current block are equal to or larger than the predefined value, the intra prediction sample interpolation technique can be performed using a 4-tap filter. Here, the predefined value can represent a value such as 4, 8, or 16.

[0241] Alternatively, the type of tap filter to use can be determined based on whether the width and height of the current block are the same value. For example, if the width and height of the current block are different values, a 2-tap filter can be used instead of a 4-tap filter to perform intra-prediction sample interpolation. Conversely, if the width and height of the current block are the same value, a 4-tap filter can be used to perform intra-prediction sample interpolation.

[0242] Alternatively, the type of tap filter to be used can be determined based on the ratio of the width to height of the current block. For example, if the ratio of the width (w) to the height (h) of the current block (i.e., w / h or h / w) is less than a predefined threshold, a 2-tap filter can be used instead of a 4-tap filter to perform intra prediction sample interpolation. On the other hand, if the ratio of the width to the height of the current block is greater than or equal to a predefined threshold, a 4-tap filter can be used to perform intra prediction sample interpolation.

[0243] Alternatively, the type of tap filter may be determined based on the intra prediction mode, shape, or size of the current block. For example, if the current block is a coding unit having a shape of 2x16 and the intra prediction mode of the current block is an intra prediction mode that falls within the horizontal range, the intra prediction sample interpolation technique may be performed using a tap filter having a tap number of n. On the other hand, if the current block is a coding unit having a shape of 2x16 and the intra prediction mode of the current block is an intra prediction mode that falls within the vertical range, the intra prediction sample interpolation technique may be performed using a tap filter having a tap number of m.

[0244] On the other hand, if the current block is a coding unit of the shape of 16x2 and the intra prediction mode of the current block is an intra prediction mode belonging to the horizontal direction range, the intra prediction sample interpolation technique can be performed using a tap filter with the number of taps n. On the other hand, if the current block is a coding unit of the shape of 16x2 and the intra prediction mode of the current block is an intra prediction mode belonging to the vertical direction range, the intra prediction sample interpolation technique can be performed using a tap filter with the number of taps m.

[0245] Here, the horizontal range may represent a predetermined range including horizontal intra prediction modes, and the vertical range may represent a predetermined range including vertical intra prediction modes. For example, based on 35 intra prediction modes, the horizontal range may represent intra prediction modes from mode 11 to mode 18, and the vertical range may represent intra prediction modes from mode 19 to mode 27.

[0246] Additionally, n and m are constants greater than 0, and n and m may have different values. Alternatively, n and m may be set to have the same value, but at least one of the filter coefficients or filter strengths of the n-tap filter and the m-tap filter may be set to be different.

[0247]

[0248] When using directional prediction mode or DC mode, there is a risk of image quality degradation at block boundaries. On the other hand, planar mode has the advantage of relatively less image quality degradation at block boundaries compared to the above prediction modes.

[0249] Planar prediction can be performed by generating a first prediction image in the horizontal direction and a second prediction image in the vertical direction using reference samples, and then weighting the first prediction image and the second prediction image.

[0250] Here, the first predicted image may be generated based on reference samples adjacent to the current block located in the horizontal direction of the prediction target sample. For example, the first predicted image may be generated based on a weighted sum of reference samples located in the horizontal direction of the prediction target sample. At this time, the weight applied to each reference sample may be determined in consideration of the distance from the prediction target sample or the size of the current block. The samples located in the horizontal direction may include a left reference sample located on the same horizontal line as the prediction target sample (i.e., a left reference sample having the same y-coordinate as the prediction target sample) and a right reference sample (i.e., a right reference sample having the same y-coordinate as the prediction target sample). At this time, the right reference sample may be derived from an upper reference sample of the current block. For example, the right reference sample may be derived by copying the value of an upper reference sample located on the same vertical line, or may be derived as a weighted sum or average value of multiple upper reference samples. Here, the upper reference sample located on the same vertical line as the right reference sample may include a reference sample adjacent to the upper right corner of the current block (i.e., an upper reference sample having the same x-coordinate as the right reference sample). Alternatively, the position of the upper reference sample used to derive the right reference sample may be determined differently depending on the shape, size, or position of the prediction target sample of the current block.

[0251] The second predicted image may be generated based on reference samples adjacent to the current block that are located in the vertical direction of the prediction target sample. For example, the second predicted image may be generated based on a weighted sum of reference samples that are located in the vertical direction of the prediction target sample. At this time, the weight applied to each reference sample may be determined in consideration of the distance from the prediction target sample or the size of the current block. The samples located in the vertical direction may include an upper reference sample (i.e., an upper reference sample having the same x-coordinate as the prediction target sample) and a lower reference sample (i.e., a lower reference sample having the same x-coordinate as the prediction target sample) that are located on the same vertical line as the prediction target sample. At this time, the lower reference sample may be derived from the left reference sample of the current block. For example, the lower reference sample may be derived by copying the value of the left reference sample that is located on the same horizontal line, or may be derived as a weighted sum or average value of multiple left reference samples. Here, the left reference sample, which is located on the same horizontal line as the bottom reference sample, may include a reference sample adjacent to the lower left corner of the current block (i.e., a left reference sample having the same y-coordinate as the bottom reference sample). Alternatively, the location of the upper reference sample used to derive the bottom reference sample may be determined differently depending on the size, shape, or location of the target sample of the current block.

[0252] Alternatively, both the left reference sample and the top reference sample may be used to derive at least one of the right reference sample or the bottom reference sample.

[0253] For example, the weighted sum or average of the top reference sample and the left reference sample of the current block can be determined as the value of at least one of the right reference sample or the bottom reference sample.

[0254] Alternatively, the lower right reference sample adjacent to the lower right corner of the current block may be derived using the lower left reference sample and the upper right reference sample, and then the right reference sample and the lower reference sample may be derived using the derived lower right reference sample. The lower right reference sample may be derived based on a weighted sum or average of the upper right reference sample and the left reference sample of the current block. At this time, the weights applied to the upper right reference sample and the left reference sample may have the same value, or may be determined based on the width / height of the current block.

[0255] Once the lower right reference sample is determined, the lower right reference sample and the upper right reference sample can be interpolated to derive the right reference sample, and the lower right reference sample and the lower left reference sample can be interpolated to derive the lower reference sample. At this time, the coefficients of the interpolation filter can be determined based on the size of the current block, the shape of the current block, the distance to the lower right reference sample, the distance to the upper right reference sample, or the distance to the lower left reference sample.

[0256] To derive the right reference sample or the left reference sample, a reference sample at a fixed position can be used, or a reference sample that is adaptively selected depending on the position of the prediction target sample can be used. For example, the right reference sample can be derived using the upper right reference sample regardless of the position of the prediction target sample, or a left reference sample (e.g., a reference sample having the same y-axis coordinate as the prediction target sample) or an upper reference sample (e.g., a reference sample having the same x-axis coordinate as the prediction target sample) selected depending on the position of the prediction target sample. Alternatively, the bottom reference sample can be derived using the lower left reference sample regardless of the position of the prediction target sample, or a left reference sample (e.g., a reference sample having the same y-axis coordinate as the prediction target sample) or an upper reference sample (e.g., a reference sample having the same x-axis coordinate as the prediction target sample) selected depending on the position of the prediction target sample.

[0257] Figure 14 is a diagram illustrating an example of deriving a right reference sample or a bottom reference sample using multiple reference samples. It is assumed that the current block is a block having a size of WxH.

[0258] Referring to (a) of Fig. 14, first, the lower right reference sample P(W, H) can be generated based on the weighted sum or average value of the upper right reference sample P(W, -1) and the lower left sample P(-1, H) of the current block. At this time, the weights applied to the upper right reference sample and the left reference sample can be set to be the same, or determined based on the width (W) and height (H) of the current block. For example, when the current block is non-square, the weight applied to the upper right reference sample can be determined as W / (W+H), and the weight applied to the lower left reference sample can be determined as H / (W+H).

[0259] And, based on the lower right reference sample P(W, H) and the upper right reference sample P(W, -1), the right reference sample P(W, y) for the target prediction sample (x, y) can be generated. For example, the right prediction sample P(W, y) can be calculated as a weighted sum or an average value of the lower right reference sample P(W, H) and the upper right reference sample P(W, -1). In addition, the lower reference sample P(x, H) for the target prediction sample (x, y) can be generated based on the lower right reference sample P(W, H) and the lower left reference sample P(-1, H). For example, the lower reference sample P(x, H) can be calculated as a weighted sum or an average value of the lower right reference sample P(W, H) and the left reference sample P(-1, H).

[0260] As shown in (b) of Fig. 14, when the right reference sample and the bottom reference sample are generated, the first prediction sample P for the prediction target sample is generated using the generated reference sample. h (x, y) and the second prediction sample P v (x, y) can be generated. At this time, the first prediction sample P h (x, y) is generated based on the weighted sum of the left reference sample P(-1, y) and the right reference sample P(W, y), and the second prediction sample P v (x, y) can be generated based on the weighted sum of the upper reference sample P(x, -1) and the lower reference sample P(x, H).

[0261] FIG. 15 and FIG. 16 are diagrams for explaining determining a right reference sample and a bottom reference sample for a non-square block according to one embodiment of the present invention.

[0262] As in the example illustrated in Fig. 15, if the current block is a non-square block of size (N / 2)xN, the right reference sample can be derived based on the upper right reference sample P(N / 2, -1), and the bottom reference sample can be derived based on the lower left reference sample P(-1, N).

[0263] Alternatively, the right reference sample or the bottom reference sample may be derived based on at least one of the weighted sum, average, minimum value, or maximum value of the upper right reference sample P(N / 2, -1) and the lower left reference sample P(-1, N). For example, the right reference sample may be derived based on the weighted sum or average of P(N / 2, -1) and P(-1, N), or the lower right reference sample P(N / 2, N) may be derived based on P(N / 2, -1) and P(-1, N), and then the right reference sample may be derived by interpolating the lower right reference sample and the upper right reference sample. Alternatively, the bottom reference sample may be derived based on the weighted sum or average of P(N / 2, -1) and P(-1, N), or the lower right reference sample P(N / 2, N) may be derived based on P(N / 2, -1) and P(-1, N), and then the bottom reference sample may be derived by interpolating the lower right reference sample and the lower left reference sample.

[0264] On the other hand, as in the example illustrated in Fig. 16, if the current block is a non-square block of size Nx(N / 2), the right reference sample can be derived based on the upper right reference sample P(N, -1), and the bottom reference sample can be derived based on the lower left reference sample P(-1, N / 2).

[0265] Alternatively, the right reference sample or the bottom reference sample may be derived based on at least one of the weighted sum, average, minimum value, or maximum value of the upper left reference sample P(N, -1) and the lower left reference sample P(-1, N / 2). For example, the right reference sample may be derived based on the weighted sum or average of P(N, -1) and P(-1, N / 2), or the lower right reference sample P(N, N / 2) may be derived based on P(N, -1) and P(-1, N / 2), and then the right reference sample may be derived by interpolating the lower right reference sample and the upper right reference sample. Alternatively, the bottom reference sample may be derived based on the weighted sum or average of P(N, -1) and P(-1, N / 2), or the lower right reference sample P(N, N / 2) may be derived based on P(N, -1) and P(-1, N / 2), and then the bottom reference sample may be derived by interpolating the lower right reference sample and the lower left reference sample.

[0266] In the examples described with reference to FIGS. 14 to 16, the lower reference sample is derived based on at least one of the lower left reference sample of the current block located on the same horizontal line as the lower reference sample or the upper right reference sample of the current block located on the same vertical line as the right reference sample, and the right reference sample is derived based on at least one of the upper right reference sample of the current block located on the same vertical line as the right reference sample or the lower left reference sample of the current block located on the same horizontal line as the lower reference sample. Unlike the described examples, the right reference sample may be derived based on at least one of the upper middle reference sample or the left middle reference sample, or the left reference sample may be derived. For example, the lower middle sample may be derived using the upper middle sample and the lower left reference sample, and then the lower samples may be generated through interpolation or extrapolation of the lower middle sample and the lower left sample. In addition, the right middle sample may be derived using the left middle sample and the upper right sample, and then the lower samples may be generated through interpolation or extrapolation of the right middle sample and the upper right sample.

[0267] The positions of the reference samples used to generate the first and second predicted images may be determined differently depending on the size or shape of the current block. For example, the positions of the upper or left reference samples used to derive the right or lower reference samples may be determined differently depending on the size or shape of the current block.

[0268] For example, if the current block is a square block of size NxN, the right reference sample may be derived based on the upper right reference sample P(N, -1), while the bottom reference sample may be derived based on the lower left reference sample P(-1, N). Alternatively, if the current block is a square block of size NxN, the right reference sample and the bottom reference sample may be derived based on at least one of the weighted sum, average, minimum value, or maximum value of the upper right reference sample P(N, -1) and the lower left reference sample P(-1, N).

[0269] On the other hand, if the current block is a non-square block of size Nx2 / N, the lower middle reference sample P(N / 2, -1) can be derived based on the upper middle reference sample P(N / 2, -1) and the lower left reference sample P(-1, N / 2), and the lower reference samples can be derived based on the derived lower middle reference sample. For example, the lower reference samples can be derived through interpolation or extrapolation of the lower middle reference sample and the lower left reference sample. Alternatively, if the current block is a non-square block of size N / 2xN, the right middle reference sample P(N / 2, -1) can be derived based on the upper right reference sample P(N / 2, -1) and the left middle reference sample P(-1, N / 2), and the right reference samples can be derived based on the derived right middle reference sample. For example, the right reference samples can be derived by interpolation or extrapolation of the right middle reference sample and the right upper reference sample.

[0270] The first predicted image can be calculated based on weighted predictions of reference samples that lie on the same horizontal line as the target sample. Furthermore, the second predicted image can be calculated based on weighted predictions of reference samples that lie on the same vertical line as the target sample.

[0271] In addition to the examples described above, the first predicted image or the second predicted image can also be generated using the average value, minimum value, or maximum value of the reference samples.

[0272] Depending on whether the target sample for prediction is included in a predetermined area within the current block, the size or shape of the current block, etc., the method for deriving the reference sample can be set differently, or the method for deriving the first predicted image or the second predicted image can be set differently. Specifically, depending on the location of the target sample for prediction, the number of reference samples used for using the right or bottom reference sample, or the location of the reference samples, or the weights or the number of reference samples used for deriving the first predicted image or the second predicted image can be set differently.

[0273] For example, the right reference sample used when generating the first prediction image of the prediction target samples included in the predetermined area can be derived using only the upper reference sample, and the right reference sample used when generating the first prediction image of the prediction target samples included outside the predetermined area can be derived based on the weighted sum or average of the upper reference sample and the left reference sample.

[0274] For example, as in the example illustrated in FIG. 15, if the current block is a non-square block whose height is longer than its width, the right reference sample of the prediction target sample at the (x, y) position included in the predetermined area within the current block can be derived from P(N / 2, -1). For example, the right reference sample of the prediction target sample included in the predetermined area can be generated by copying the value of the P(N / 2, -1) reference sample. On the other hand, the right reference sample of the prediction target sample at the (x', y') position included outside the predetermined area within the current block can be derived based on the weighted sum or average value of P(N / 2, -1) and P(-1, N). For example, the right reference sample of the prediction target sample included outside the predetermined area can be generated through interpolation of the lower right reference sample P(N / 2, N) and the upper right reference sample P(N / 2, -1), which are derived based on P(N / 2, -1) and P(-1, N).

[0275] Alternatively, as in the example illustrated in FIG. 16, if the current block is a non-square block whose width is longer than its height, the lower reference sample of the prediction target sample at the (x, y) position included in the predetermined area within the current block can be derived from P(-1, N / 2). For example, the lower reference sample of the prediction target sample at the (x, y) position included in the predetermined area can be generated by copying the value of the P(-1, N / 2) reference sample. On the other hand, the lower reference sample of the prediction target sample at the (x', y') position included outside the predetermined area within the current block can be derived based on the weighted sum or average value of P(N, -1) and P(-1, N / 2). For example, the lower target reference sample of the prediction target sample included outside the predetermined area can be generated through interpolation of the lower right reference sample P(N, N / 2) and the lower left reference sample P(-1, N / 2), which are derived based on P(N, -1) and P(-1, N / 2).

[0276] As another example, the prediction target samples included in the predetermined area generate the first prediction image or the second prediction image based on the weighted sum of the reference samples, and the prediction target samples outside the predetermined area generate the first prediction image or the second prediction image with the average value, minimum value, or maximum value of the reference samples, or generate the first prediction image or the second prediction image using only one of the reference samples at a predefined position. For example, as in the example illustrated in FIG. 15, when the current block is a non-square block in which the height is longer than the width, the prediction target sample at the position (x, y) included in the predetermined area within the current block can generate the first prediction image using only one of the right reference sample P(N / 2, y) derived from P(N / 2, -1) or the left reference sample at the position P(-1, y). On the other hand, the prediction target sample at the position (x', y') that is not included in the above-mentioned predetermined area can generate the first prediction image based on the weighted sum or average of the right reference sample P(N / 2, y') derived from P(N / 2, -1) and the reference samples at the position P(-1, y').

[0277] Alternatively, as in the example illustrated in FIG. 16, when the current block is a non-square block whose width is longer than its height, the prediction target sample at the position (x, y) included in a predetermined area within the current block can generate a second prediction image using only one of the lower reference sample P(x, N / 2) derived from P(-1, N / 2) or the upper reference sample at the position P(x, -1). On the other hand, the prediction target sample at the position (x', y') not included in the predetermined area can generate a second prediction image based on a weighted sum or average of the lower reference sample P(x', N / 2) derived from P(-1, N / 2) and the reference samples at the position P(-1, y').

[0278] In the above-described embodiment, the predetermined area may be at least one sample line adjacent to the boundary of the current block or a remaining area excluding these. Here, the boundary of the current block may include at least one of a left boundary, a right boundary, an upper boundary, or a lower boundary. In addition, the number or position of the boundaries used to define the predetermined area may be set differently depending on the shape of the current block. Alternatively, the predetermined area may be a block shape that borders one corner of the current block. In this case, the size and shape of the predetermined area may be determined based on at least one of the size or shape of the current block.

[0279] Under planar mode, the final predicted image can be derived based on the weighted sum, average, minimum or maximum value of the first predicted image and the second predicted image.

[0280] For example, the following mathematical expression 11 is the first predicted image P h and the second predicted image P v An example of generating a final predicted image P based on the weighted sum of .

[0281]

[0282] In the above mathematical expression 11, the prediction weight w may be different depending on the shape and size of the current block or the location of the target sample to be predicted.

[0283] For example, the prediction weight w can be derived by considering the width of the current block, the height of the current block, or the width-height ratio of the current block. If the current block is a non-square block whose width is greater than its height, w can be set so that more weight is given to the first predicted image. Conversely, if the current block is a non-square block whose height is greater than its width, w can be set so that more weight is given to the second predicted image.

[0284] For example, if the current block is square, the prediction weight w may have a value of 1 / 2. On the other hand, if the current block is a non-square block whose height is greater than its width (e.g., (N / 2)xN), the prediction weight w may be set to 1 / 4, and if the current block is a non-square block whose width is greater than its height (e.g., Nx(N / 2)), the prediction weight w may be set to 3 / 4.

[0285]

[0286] In addition to the planar mode, intra prediction can also be performed using reference samples other than the left reference sample and the top reference sample in the DC mode or the directional intra prediction mode. In the following embodiments, the left reference sample and the top reference sample are referred to as first reference samples, and reference samples other than the left reference sample and the top reference sample are referred to as second reference samples. For example, the second reference sample may include the right reference sample and / or the bottom reference sample of the current block. Here, the bottom reference sample may refer to reference samples having a y-axis coordinate greater than a prediction target sample of the bottommost row in the current block, and the right reference sample may refer to reference samples having an x-axis coordinate greater than a prediction target sample of the rightmost column in the current block.

[0287] Whether to perform intra prediction using the second reference sample may be determined based on at least one of the size, shape, intra prediction mode, or position of the prediction target sample of the current block. For example, whether to perform intra prediction using the second reference sample may be determined based on whether the intra prediction mode of the current block is vertical mode, horizontal mode, or diagonal mode. Alternatively, intra prediction may be performed using the second reference sample for prediction target samples included in a predetermined area within the current block, while intra prediction may be performed using the first reference sample for prediction target samples not included in the predetermined area within the current block.

[0288] Alternatively, information indicating whether a second reference sample is used may be signaled via the bitstream. The information may be a 1-bit flag, an index used to determine the intra prediction mode of the current block, or the like.

[0289] Alternatively, it may be determined whether to use the second reference sample based on whether a second reference sample was used in a surrounding block of the current block.

[0290] The second reference sample may be generated based on the first reference sample. For example, the second reference sample may be constructed by changing the order of the first reference samples, or the second reference sample may be derived using the first reference sample at a specific location.

[0291] Figure 17 is a drawing for explaining an example of deriving a second reference sample using a first reference sample.

[0292] First, the bottom right reference sample P(W, H) can be derived based on the top right reference sample r(W, -1) and the bottom left reference sample r(-1, H) of the current block. Specifically, the bottom right reference sample can be derived through a weighted sum or average operation of the top right reference sample and the bottom left reference sample. The following mathematical expression 12 illustrates an example of deriving the bottom right reference sample.

[0293]

[0294] As shown in the above mathematical expression 12, the lower right reference sample can be calculated based on the weighted sum between the upper right reference sample and the lower left reference sample. At this time, the weights applied to the upper right reference sample and the lower left reference sample can be determined according to the width and height of the current block. For example, if the current block is square, the same weights can be applied to the upper right reference sample and the lower left reference sample, whereas if the current block is non-square, different weights can be applied to the upper right reference sample and the lower left reference sample. However, the weight setting method shown in mathematical expression 12 is only an example of the present invention, and the present invention is not limited thereto. In addition to the example shown in mathematical expression 12, the weights may be determined based on at least one of the size and shape of the current block, the intra prediction mode, the availability of reference samples, the availability of neighboring blocks, whether neighboring blocks are encoded in the intra prediction mode, or the intra prediction mode of the neighboring blocks.

[0295] The right reference sample can be derived based on the upper right reference sample and the lower right reference sample. For example, the right reference sample can be obtained by interpolating the upper right reference sample and the lower right reference sample. Mathematical expression 13 below illustrates an example of deriving the right reference sample.

[0296]

[0297] As shown in the above mathematical expression 13, the right reference sample P r (W, y) (where y is an integer between 0 and the CU height (cu_height)) can be obtained by weighted prediction of the upper right reference sample r(W, -1) and the lower right reference sample P(W, H). At this time, the weights applied to the upper right reference sample and the lower right reference sample can be determined based on at least one of the width, the height of the current block, or the position of the right reference sample. For example, as in the example shown in Equation 13, a weight of (H-1-y) / H can be applied to the upper right reference sample, while a weight of (y+1) / H can be applied to the lower right reference sample. However, the weight setting method shown in Equation 13 is only an example of the present invention, and the present invention is not limited thereto. In addition to the example shown in Equation 13, the weights may be determined based on at least one of the size and shape of the current block, the intra prediction mode, the availability of reference samples, the availability of neighboring blocks, whether neighboring blocks are encoded in the intra prediction mode, or the intra prediction mode of the neighboring blocks.

[0298] The bottom reference sample can be derived based on the bottom left reference sample and the bottom right reference sample. For example, the bottom reference sample can be obtained by interpolating the bottom left reference sample and the bottom right reference sample. Mathematical expression 14 below illustrates an example of deriving the bottom reference sample.

[0299]

[0300] As shown in the above mathematical expression 14, the lower reference sample P b(x, H) (where x is an integer between 0 and the CU width (cu_width)) can be obtained by weighted prediction of the lower left reference sample r(-1, H) and the lower right reference sample P(W, H). At this time, the weights applied to the lower left reference sample and the lower right reference sample can be determined based on at least one of the width, the height, or the position of the lower reference sample of the current block. For example, as in the example shown in Equation 14, a weight of (W-1-x) / W can be applied to the lower left reference sample, while a weight of (x+1) / H can be applied to the lower right reference sample. However, the weight setting method shown in Equation 14 is merely an example of the present invention, and the present invention is not limited thereto. In addition to the example shown in Equation 14, the weights may be determined based on at least one of the size and shape of the current block, the intra prediction mode, the availability of reference samples, the availability of neighboring blocks, whether neighboring blocks are encoded in the intra prediction mode, or the intra prediction mode of the neighboring blocks.

[0301] If the current block is non-square, the right reference sample and the bottom reference sample may be derived based on the examples described above through FIGS. 15 and 16.

[0302] As in the above examples, second reference samples, such as the right reference sample and the bottom reference sample, can be derived using first reference samples at fixed positions, such as the upper right reference sample and the lower left reference sample. Unlike the above examples, the second reference sample can also be derived using first reference samples at positions different from the upper right reference sample and / or the lower left reference sample. For example, the right reference sample and the bottom reference sample can be derived using first reference samples, such as the upper middle reference sample of the current block or the left middle sample of the current block.

[0303] Alternatively, the first reference sample used to derive the second reference sample may be determined based on the intra prediction mode of the current block. For example, the right reference sample and / or the bottom reference sample may be derived based on the left reference sample and / or the top reference sample, which are specified by the intra prediction mode directionality of the current block.

[0304] Alternatively, the second reference sample may be determined using a plurality of left reference samples and / or a plurality of top reference samples. For example, at least one of the right reference sample, the bottom reference sample, or the bottom-right reference sample may be generated based on a weighted sum, average, maximum, or minimum value of the plurality of left reference samples, or may be generated based on a weighted sum, average, maximum, or minimum value of the plurality of top reference samples.

[0305] Alternatively, a second reference sample may be generated by copying the first reference sample. In this case, the first reference sample used to generate the second reference sample may have a fixed position, or may be adaptively determined based on the size, shape, intra prediction mode of the current block, or the position of the second reference sample.

[0306] In the above example, the number of bottom reference samples is W and the number of right reference samples is H, but a larger number of bottom reference samples and / or right reference samples can be derived. For example, the bottom reference samples can be derived to the same vertical line as the rightmost top reference sample r(2W-1, -1), or the right reference samples can be derived to the same horizontal line as the bottommost left reference sample r(-1, 2H-1).

[0307] At this time, the bottom reference sample having an x-coordinate greater than W can be generated by extrapolating the bottom left reference sample and the bottom right reference sample, or by interpolating the bottom right reference sample P(W, H) and the rightmost bottom reference sample P(2W-1, H). The rightmost bottom reference sample can be generated by copying the rightmost top reference sample r(2W-1, -1), or by performing a weighted sum operation between the rightmost top reference sample and the bottom left reference sample. The right reference sample having a y-coordinate greater than H can be generated by extrapolating the top right reference sample and the bottom right reference sample, or by interpolating the bottom right reference sample P(W, H) and the bottom right reference sample P(W, 2H-1). At this time, the bottom right reference sample can be generated by copying the bottom left reference sample r(-1, 2H-1), or by performing a weighted sum operation between the bottom left reference sample and the leftmost top reference sample.

[0308] The first reference samples may be arranged one-dimensionally to create a first one-dimensional reference sample group, and the second reference samples may be arranged one-dimensionally to create a second one-dimensional reference sample group. At this time, the first one-dimensional reference sample group may be configured to include not only the first reference samples but also at least one or more of the second reference samples, and the second one-dimensional reference sample group may be configured to include not only the second reference samples but also at least one or more of the first reference samples.

[0309] Figure 18 is a diagram illustrating reference samples that constitute a one-dimensional reference sample group.

[0310] As in the example illustrated in (a) of Fig. 18, the first one-dimensional reference sample group may be composed of left reference samples and top reference samples of the current block.

[0311] On the other hand, as in the example illustrated in (b) of FIG. 18, the second one-dimensional reference sample group may be configured to further include some left reference samples and some upper reference samples in addition to the right reference samples and the lower reference samples of the current block.

[0312] That is, among the left reference samples, the lower left reference sample r(-1, H) and the left reference samples having a y-axis coordinate greater than the lower left reference sample can be included in both the first one-dimensional reference sample group and the second one-dimensional reference sample group. In addition, among the upper reference samples, the upper right reference sample r(W, -1) and the upper reference samples having a x-axis coordinate greater than the upper right reference sample can be included in both the first one-dimensional reference sample group and the second one-dimensional reference sample group.

[0313] Alternatively, based on at least one of the size, shape, or intra prediction mode of the current block, some of the first reference samples may be included only in the first one-dimensional reference sample group, or some of the first reference samples may be included only in the second one-dimensional reference sample group. Not only the composition of the one-dimensional reference sample group, but also the arrangement order of the reference samples constituting the one-dimensional reference sample group may be variably determined based on at least one of the size, shape, or intra prediction mode of the current block.

[0314] For convenience of explanation, in the embodiments described below, a reference sample group including a left reference sample and an upper reference sample of the current block will be referred to as a first reference sample group (e.g., a first one-dimensional reference sample group), and a reference sample group including a right reference sample and a lower reference sample of the current block will be referred to as a second reference sample group (e.g., a second one-dimensional reference sample group). For example, the first reference sample group and the second reference sample group may be distinguished depending on whether the right reference sample and the lower reference sample are included. In addition, in order to perform intra prediction of a target sample to be predicted, a reference sample selected from the first reference sample group will be referred to as a first base reference sample, and a reference sample selected from the second reference sample group will be referred to as a second base reference sample.

[0315] Intra prediction of a current block may be performed using at least one of a first reference sample group or a second reference sample group. For example, a prediction value of a prediction target sample in the current block may be obtained based on at least one of a first basic reference sample selected from the first reference sample group or a second basic reference sample selected from the second reference sample group. At this time, the first basic reference sample and / or the second basic reference sample may be determined based on at least one of a shape, a size, or an intra prediction mode of the current block. For example, when the intra prediction mode of the current block is determined, a first basic reference sample for the prediction target sample may be specified according to the determined intra prediction mode direction, and a second basic reference sample for the prediction target sample may be specified according to the reverse direction of the determined intra prediction mode.

[0316] Alternatively, the position of the second base reference sample may be determined based on the position of the first base reference sample, or the position of the first base reference sample may be determined based on the position of the second base reference sample. For example, the second base reference sample having the same x-coordinate or the same y-coordinate as the first base reference sample may be selected, or the second base reference sample having a value obtained by adding an offset to the x-coordinate or y-coordinate of the first base reference sample may be selected. Here, the offset may have a fixed value, or may be adaptively determined according to the size, shape, or intra prediction mode of the current block.

[0317] Alternatively, the positions of the first base reference sample and / or the second base reference sample may be determined based on the position of the target sample to be predicted. For example, the first base reference sample and / or the second base reference sample having the same x-coordinate or the same y-coordinate as the target sample to be predicted may be selected, or the first base reference sample and / or the second base reference sample having a value obtained by adding an offset to the x-coordinate or the y-coordinate of the target sample to be predicted may be selected. Here, the offset may have a fixed value, or may be adaptively determined according to the size, shape, or intra prediction mode of the current block.

[0318] The predicted value of the prediction target sample may be generated based on at least one of a first predicted image based on a first basic reference sample or a second predicted image based on a second basic reference sample. In this case, the first predicted image may be generated based on the aforementioned mathematical expressions 8 to 10.

[0319] The second predicted image can be generated by interpolating or copying a second base reference sample that is specified based on the slope of the intra prediction mode of the current block. As an example, Equation 15 is a diagram illustrating an example of deriving a second predicted image by copying a second base reference sample.

[0320]

[0321] In the above mathematical expression 15, P2(x, y) represents the second predicted image, and P_2nd_1D(x+iIdx+1+f) represents the second basic reference sample.

[0322] When the slope of the intra prediction mode of the current block cannot be expressed by only one second base reference sample, a plurality of second base reference samples can be interpolated to generate a second prediction image. Specifically, when a virtual angle line according to the slope and / or angle of the intra prediction mode does not pass through an integer pel (i.e., a reference sample at an integer position), the second prediction image can be obtained by interpolating the second reference samples adjacent to the left, right, above, and below the angle line. As an example, Mathematical Expression 16 shows an example of obtaining a second prediction image by interpolating second reference samples.

[0323]

[0324] The coefficients of the interpolation filter are the weight-related parameters i fact can be determined based on. For example, the coefficients of the interpolation filter can be determined based on the distance between a fractional pel located on an angular line and an integer pel (i.e., the integer position of each reference sample).

[0325] In mathematical expression 16, an interpolation filter with a tap count of 2 is exemplified, but an interpolation filter with a tap count greater than 2 can also be used.

[0326] A final prediction image of a prediction target sample can be obtained based on at least one of a first prediction image or a second prediction image. For example, the first prediction image can be determined as the final prediction image of the prediction target sample, or the second prediction image can be determined as the final prediction image of the prediction target sample. Alternatively, the final prediction image of the prediction target sample can be determined based on a weighted sum or average operation of the first and second prediction images. Mathematical expression 17 illustrates an example of obtaining a final prediction sample based on a weighted operation of the first and second prediction images.

[0327]

[0328] In the above mathematical expression 17, P1(x, y) represents the first predicted image, and P2(x, y) represents the second predicted image. In addition, w(x, y) represents the weight assigned to the first predicted image.

[0329] The weights assigned to the first and second predicted images may be determined based on at least one of the position of the prediction target sample, the size and shape of the current block, or the intra prediction mode. As an example, Equation 18 illustrates an example in which the weights are determined based on the size of the current block and the position of the prediction target sample.

[0330]

[0331] In the above mathematical expression 18, W and H represent the width and height of the current block, respectively, and (x, y) represents the coordinates of the prediction target sample.

[0332] As in the example shown in the above mathematical expression 18, the weight given to the first prediction image can be set to be larger as the prediction target sample is closer to the upper left corner of the current block, and the weight given to the second prediction image can be set to be larger as the prediction target sample is closer to the lower right corner of the current block.

[0333] Alternatively, weights may be derived from neighboring blocks of the current block. Here, the neighboring blocks of the current block may include at least one of the upper neighboring block, the left neighboring block, or the neighboring block adjacent to a corner (e.g., the upper left neighboring block, the upper right neighboring block, or the lower left neighboring block) of the current block.

[0334] Alternatively, information for determining weights may be signaled via the bitstream. The information may indicate weight values ​​applied to the first or second predicted image, or may indicate weight differences between the current block and neighboring blocks.

[0335] As in the example described above, obtaining the final predicted image through a weighted sum operation between the first predicted image and the second predicted image can be called bi-intra prediction.

[0336] Bidirectional intra prediction can be applied only to some regions within the current block. The regions to which bidirectional intra prediction is applied may be predefined by the encoder and decoder. For example, bidirectional intra prediction can be applied to a block of a predetermined size (e.g., 4x4) adjacent to the lower right corner within the current block. Alternatively, the region to which bidirectional intra prediction is applied can be adaptively determined based on the size, shape, or intra prediction mode of the current block. Alternatively, information for determining the region to which bidirectional intra prediction is applied (e.g., information indicating the size or position of the region) may be signaled through the bitstream.

[0337] Figure 19 is an example showing an area to which bidirectional intra prediction is applied.

[0338] Within a region where bidirectional intra prediction is applied, the first and second predicted images can be weighted and predicted to obtain a final predicted sample. Conversely, within a region where bidirectional intra prediction is not applied, either the first or second predicted image can be determined as the final predicted sample.

[0339] In the above example, it has been described that bidirectional intra prediction is performed using the first basic reference sample selected from the first sample group and the second basic reference sample selected from the second sample group. Unlike the described example, it is also possible to perform bidirectional intra prediction by selecting multiple reference samples from the first sample group, or to perform bidirectional intra prediction by selecting multiple reference samples from the second sample group. For example, when the intra prediction mode of the current block is the upper right diagonal direction or the lower left diagonal direction, bidirectional intra prediction can be performed by selecting the upper reference sample and the left reference sample from the first sample group. That is, the first reference image obtained based on the upper reference sample and the second reference image obtained based on the lower reference sample can be weighted-predicted to obtain the final prediction sample of the current block.

[0340] Alternatively, depending on the intra prediction mode, bidirectional intra prediction may be performed by selecting the right reference sample and the bottom reference sample from the second sample group.

[0341] Bidirectional intra prediction can be defined as an independent intra prediction mode. For example, by defining N directional prediction modes and N bidirectional intra prediction modes corresponding to the N directional prediction modes, a total of 2N+2 intra prediction modes can be defined. For example, by adding a bidirectional intra prediction mode to the intra prediction modes illustrated in FIG. 8, a total of 68 intra prediction modes (i.e., 2 non-directional intra prediction modes, 33 directional intra prediction modes, and 33 bidirectional intra prediction modes) can be defined. Of course, it is also possible to use more or fewer directional intra prediction modes or bidirectional intra prediction modes than 33.

[0342] Alternatively, after determining the intra prediction mode of the current block, it is also possible to determine whether to use the determined intra prediction mode as a bidirectional prediction mode. For example, once the intra prediction mode of the current block is determined, information on whether to use the determined intra prediction mode as a bidirectional intra prediction mode can be decoded. The information may be a 1-bit flag (e.g., bi_intra_flag), but is not limited thereto. A value of bi_intra_flag of 0 indicates that directional intra prediction is performed, and a value of bi_intra_flag of 1 indicates that bidirectional intra prediction is performed. That is, when the value of bi_intra_flag is 0, the first prediction image is determined as the final prediction sample of the current block, whereas when the value of bi_intra_flag is 1, a weighted prediction of the first prediction image and the second prediction image may be determined as the final prediction sample of the current block.

[0343] Alternatively, whether the current block uses the bidirectional intra prediction mode can be determined based on whether the neighboring blocks adjacent to the current block used the bidirectional intra prediction mode. For example, if the intra prediction mode of the current block is identical to a candidate derived based on the intra prediction mode of the neighboring blocks (i.e., an MPM candidate), whether the current block uses the bidirectional intra prediction mode can be determined in the same manner as whether the neighboring blocks used the bidirectional intra prediction mode.

[0344] Alternatively, it may be determined whether to perform bidirectional intra prediction based on the size and / or shape of the current block. For example, bidirectional intra prediction may be configured to be allowed only for blocks larger than 32x32. Accordingly, bidirectional intra prediction will not be applied when the current block size is smaller than 32x32, whereas bidirectional intra prediction can be applied when the current block size is larger than 32x32.

[0345] As another example, bidirectional intra prediction could be allowed only for square blocks, or bidirectional intra prediction could be allowed only for non-square blocks.

[0346] Alternatively, bidirectional intra prediction may be applied only to some directional intra prediction modes. As an example, FIG. 20 is an example that identifies directional prediction modes in which bidirectional intra prediction is allowed. As in the example illustrated in FIG. 20, bidirectional intra prediction may be set to be allowed only for some intra prediction modes between the horizontal direction and the vertical direction. In this case, when an intra prediction mode within the above range is selected, bidirectional intra prediction may be performed by default, and when an intra prediction mode within the above range is selected, whether to perform the bidirectional intra prediction mode may be determined based on at least one of information parsed through the bitstream, the size or shape of the current block.

[0347] The intra prediction modes that allow bidirectional intra prediction are not limited to the examples illustrated in FIG. 20. The intra prediction modes that allow bidirectional intra prediction may be predefined in the encoder and decoder, or may be adaptively determined based on the size and / or shape of the current block. Alternatively, information for determining the intra prediction modes that allow bidirectional intra prediction may be signaled via the bitstream.

[0348] FIG. 21 is a flowchart illustrating an intra prediction method of a current block based on a bidirectional intra prediction mode according to the present invention.

[0349] First, it can be determined whether bidirectional intra prediction is applied to the current block (S2110). Whether bidirectional intra prediction is applied to the current block can be determined based on information parsed from the bitstream, the shape, size, or intra prediction mode of the current block.

[0350] For example, after determining the intra prediction mode of the current block based on the candidate list and index, it is possible to determine whether bidirectional intra prediction is applied to the current block based on the size, shape, or information parsed from the bitstream of the current block (e.g., bi_pred_flag). Alternatively, it is also possible to determine whether bidirectional intra prediction is applied to the current block based on whether the intra prediction mode of the current block is a directional prediction mode to which bidirectional intra prediction is applied.

[0351] Thereafter, reference samples of the current block can be derived (S2120). First, first reference samples adjacent to the left and top of the current block are derived, and if bidirectional intra prediction is applied to the current block, second reference samples adjacent to the right and bottom can be additionally derived (S2130).

[0352] Next, if bidirectional intra prediction is not applied to the current block, a first predicted image may be generated based on at least one base reference sample among the first reference samples, depending on the intra prediction mode of the current block (S2140). In this case, the first predicted image may be determined as the final predicted sample of the current block.

[0353] On the other hand, when bidirectional intra prediction is applied to the current block, in addition to the first predicted image, a second predicted image can be generated based on at least one basic reference sample among the second reference samples (S2150). The first basic reference sample and the second basic reference sample can be determined based on the directionality of the intra prediction mode, or can be determined based on the size and shape of the current block or the position of other basic reference samples. Once the first predicted image and the second predicted image are obtained, the first predicted image and the second predicted image can be weighted-predicted to obtain a final predicted sample of the current block.

[0354]

[0355] When the intra prediction mode of the current block is the DC mode, a DC value may be derived from reference samples, and the derived DC value may be determined as a value of prediction samples in the current block. For example, when the intra prediction mode of the current block is the DC mode, an average value of upper reference samples and left reference samples of the current block may be determined as a DC value, and the DC value may be determined as a prediction sample value of the current block. Here, the left reference samples used to calculate the DC value may be included in at least one range from r(-1, -1) to r(-1, H-1), r(-1, -1) to r(-1, H+W-1), or r(-1, -1) to r(-1, 2H-1), and the upper reference samples used to calculate the DC value may be included in at least one range from r(-1, -1) to r(W-1, -1), r(-1, -1) to r(W+H-1, -1), or r(-1, -1) to r(2W-1, -1). Alternatively, the DC value may be calculated using the left reference samples and the upper reference samples, but the upper left reference sample r(-1,-1) may be excluded when calculating the DC value.

[0356] If the current block is large or non-square, the correlation between the current block and some reference samples may be low, reducing prediction efficiency. Therefore, the range of reference samples used to calculate the DC value can be set differently depending on the size or shape of the current block, or different weights can be applied depending on the location of the reference sample to calculate the DC value.

[0357] For example, a greater weight may be given to top reference samples having an x-coordinate equal to or less than the rightmost column of the current block than to top reference samples having an x-coordinate greater than the rightmost column of the current block, or a greater weight may be given to left reference samples having a y-coordinate equal to or less than the bottommost row of the current block than to left reference samples having a y-coordinate greater than the bottommost row of the current block.

[0358] Figure 22 is a diagram showing an example in which different weights are applied depending on the location of the reference sample.

[0359] In Fig. 22, it is exemplified that a weight of 1 is applied to the upper reference samples having an x-coordinate greater than the rightmost column of the current block and the left reference samples having a y-coordinate greater than the bottommost row of the current block, and a weight of 3 is applied to the other upper reference samples and left reference samples. According to the example given in Fig. 22, the DC value can be calculated based on the following mathematical expression 19.

[0360]

[0361] In the example illustrated in FIG. 22, the weights assigned to the reference samples are shown to be changed based on the x-coordinate of the rightmost column and the y-coordinate of the bottommost row of the current block, but the weights assigned to the reference samples may also be adjusted based on locations other than those illustrated.

[0362] Weights for each reference sample may also be determined based on the size and / or shape of the current block. For example, if the current block is a non-square block whose width is greater than its height, the weights applied to at least some of the upper reference samples may be set to have a greater value than the weights applied to at least some of the left reference samples. Conversely, if the current block is a non-square block whose height is greater than its width, the weights applied to at least some of the left reference samples may be set to have a greater value than the weights applied to at least some of the upper reference samples.

[0363] Figures 23 and 24 illustrate the weights applied to reference samples when the current block is non-square.

[0364] In Fig. 23, it is exemplified that a weight of 1 is applied to the left reference samples having a y-coordinate greater than the upper reference samples and the lowermost row of the current block, while a weight of 3 is applied to the left reference samples having a y-coordinate equal to or less than the lowermost row of the current block. That is, as in the example illustrated in Fig. 23, when the current block is a non-square shape in which the height is greater than the width, the weight applied to the left reference samples of the current block can be set to be greater than the weight applied to the upper reference samples. Accordingly, the DC value can be obtained as in the following mathematical expression 20.

[0365]

[0366] In Fig. 24, it is exemplified that a weight of 1 is applied to the left reference samples and the top reference samples having an x-coordinate greater than the rightmost column of the current block, while a weight of 3 is applied to the top reference samples having an x-coordinate equal to or less than the rightmost column of the current block. That is, as in the example illustrated in Fig. 24, when the current block is a non-square shape in which the width is greater than the height, the weight applied to the top reference samples of the current block can be set to be greater than the weight applied to the left reference samples. Accordingly, the DC value can be obtained as in the following mathematical expression 21.

[0367]

[0368] In Fig. 23, it is exemplified that a weight of 1 is given to both the top reference samples having an x-coordinate greater than the rightmost column of the current block and the top reference samples having an x-coordinate equal to or smaller than the rightmost column of the current block, but it is also possible to set the weights given to each differently. Similarly, in Fig. 24, the weights given to the left reference samples having a y-coordinate greater than the bottommost row of the current block and the left reference samples having a y-coordinate equal to or smaller than the bottommost row of the current block can be set differently.

[0369] The weights applied to the reference samples can have fixed values ​​in the encoder and decoder. Alternatively, the weights can be determined adaptively based on the shape or size of the current block. For example, the weights can be determined adaptively based on the height, width, or aspect ratio of the current block.

[0370] Alternatively, information indicating the weight applied to each reference sample may be signaled via the bitstream. Based on this information, the weight applied to each reference sample can be determined.

[0371] Alternatively, the weights applied to the current block can be determined based on the weights applied to neighboring blocks. For example, the weights applied to neighboring blocks can be determined as the weights of the current block, or the weights of the current block can be derived by adding a difference value to the weights applied to neighboring blocks. Here, the difference value can be determined based on information signaled through the bitstream.

[0372] In FIGS. 22 to 24, at least one of the left reference samples or the upper reference samples is divided into two groups to which different weights are applied. Unlike the illustrated example, the left reference samples or the upper reference samples may be divided into a larger number of groups, and then different weights may be applied to each group. For example, a DC value may be calculated by applying different weights to each reference sample or to each unit group. In this case, the unit groups may be divided based on a predefined number. That is, each unit group may include the same number of reference samples. Alternatively, the number of reference samples included in each unit group may be determined differently based on the size or shape of the current block.

[0373] As another example, a uniform weight may be applied to each of the left reference samples and / or the top reference samples, but the weights applied to the left reference samples and the top reference samples may be determined differently. For example, if the current block is a non-square shape in which the width is greater than the height, the DC value may be obtained by giving a greater weight to the top reference samples than to the left reference samples, whereas if the current block is a non-square shape in which the height is greater than the width, the DC value may be obtained by giving a greater weight to the left reference samples than to the top reference samples.

[0374] Depending on the size, shape, or location of the current block within the CTU, the DC value may be calculated using only some of the top reference samples or the left reference samples. For example, if the current block is a non-square shape in which the width is greater than the height, the DC value may be calculated using only the top reference samples. That is, if the current block is a non-square shape in which the width is greater than the height, the average of the top reference samples may be determined as the DC value, or the weighted sum between the top reference samples may be determined as the DC value. Alternatively, if the current block is a non-square shape in which the height is greater than the width, the DC value may be calculated using only the left reference samples. That is, if the current block is a non-square shape in which the height is greater than the width, the average of the left reference samples may be determined as the DC value, or the weighted sum between the left reference samples may be determined as the DC value. Alternatively, when deriving the DC value, reference samples included in neighboring blocks included in the same upper-level CU as the current block may be excluded. For example, if the upper-level CU is split horizontally, the DC value of the lower-level CU can be derived using only the left reference sample. Conversely, if the upper-level CU is split vertically, the DC value of the right-level CU can be derived using only the upper reference sample.

[0375] Alternatively, depending on the shape of the current block, the DC value can be calculated by excluding at least one of the upper reference samples having an x-coordinate value greater than the rightmost row of the current block or the left reference samples having a y-coordinate value greater than the bottommost row of the current block.

[0376] As in the example described above, generating a DC value by giving different weights to the upper reference samples and the left reference samples can be called 'DC weighted prediction'.

[0377] Whether to apply DC-weighted prediction to the current block may be determined based on the size or shape of the current block. For example, DC-weighted prediction may be allowed only for blocks having a size greater than a predetermined threshold. Here, the threshold may represent a block size such as 16x16, 32x32, or 64x64, or may represent a reference value for either the width or height of the block. If the size of the current block is smaller than the threshold, DC-weighted prediction may not be applied even if the intra prediction mode of the current block is DC mode. If DC-weighted prediction is not applied, the DC value may be determined by applying the same weight to the upper reference samples and the left reference samples. Alternatively, DC-weighted prediction may be allowed only when the current block is non-square.

[0378] As another example, information indicating whether to apply DC-weighted prediction may be signaled via the bitstream.

[0379] Alternatively, whether to apply DC-weighted prediction to the current block may be determined based on whether DC-weighted prediction is used in neighboring blocks adjacent to the current block. For example, if the intra-prediction mode of the current block is identical to a candidate derived based on the intra-prediction mode of the neighboring blocks (i.e., an MPM candidate), whether to apply DC-weighted prediction to the current block may be determined in the same manner as whether DC-weighted prediction is applied to the neighboring blocks.

[0380] Alternatively, if the intra prediction mode of the current block is DC mode, DC weighted prediction may be applied by default.

[0381] As another example, the DC value may be derived using a second reference sample. Specifically, the DC value may be derived using at least one of the right reference samples or the left reference samples.

[0382] The second reference sample may be used to calculate a DC value instead of the first reference sample, or may be used to calculate a DC value in addition to the first reference sample. For example, instead of the upper reference samples, at least one of the right reference samples or the lower reference samples may be used to calculate a DC value, or instead of the left reference samples, at least one of the right reference samples or the lower reference samples may be used to calculate a DC value. Alternatively, at least one of the right reference samples or the lower reference samples may be used to calculate a DC value together with the upper reference samples and the left reference samples.

[0383] Here, the right reference samples used to calculate the DC value may be included in at least one range from r(W, -1) to r(W, H-1), r(W, -1) to r(W, H+W-1), or r(W, -1) to r(W, 2H-1), and the bottom reference samples used to calculate the DC value may be included in at least one range from r(-1, H) to r(W-1, H), r(-1, H) to r(W+H-1, H), or r(-1, H) to r(2W-1, H). Alternatively, the DC value may be calculated using the left reference samples and the top reference samples, but when calculating the DC value, a reference sample adjacent to a corner of the current block (e.g., at least one of the bottom right reference sample r(W, H), the top right reference sample r(W, -1), or the bottom left reference sample r(-1, H)) may be excluded.

[0384] The range of reference samples used to derive the DC value can be determined based on the size and shape of the current block, the position / index of the current block, or the intra prediction mode of the neighboring block. For example, if at least one of the upper reference samples or the left reference samples is included in a neighboring block included in the same upper-level CU as the current block, the DC value can be calculated using the lower reference samples or the right reference samples instead of the upper reference samples or the left reference samples. For example, if the upper-level CU is split horizontally, the DC value of the CU located below can be derived using the lower reference samples instead of the upper reference samples. On the other hand, if the upper-level CU is split vertically, the DC value of the CU located on the right can be derived using the right reference samples instead of the left reference samples.

[0385] The range of reference samples used to derive DC values ​​may be set differently for each predetermined unit within the current block. Here, the predetermined unit may be a sample, a sub-block, or a predetermined area. For example, the range of reference samples used to derive DC values ​​may be set differently for each sub-block unit of 4x4 size or for each sub-block unit after dividing the current block into four. Alternatively, the range of reference samples used to derive DC values ​​may be set differently for each row, each column, each area adjacent to a predetermined boundary and the remaining area, or each area between the upper left area and the lower right area based on a diagonal line dividing the current block in half. An intra prediction mode that derives DC values ​​in units smaller than a CU (or a PU or a TU) may be referred to as a sub-block unit DC mode.

[0386] Figure 25 is a diagram showing an example in which the range of reference samples used to derive DC values ​​is determined differently for each region.

[0387] Figure 25 (a) identifies a reference sample used to derive a DC value of an area located in the upper left, and Figure 25 (b) identifies a reference sample used to derive a DC value of an area located in the lower right.

[0388] The current block can be divided into two regions based on the diagonal line in the upper right diagonal direction. At this time, the DC value of the region located on the upper left can be derived based on the first reference sample, while the DC value of the region located on the lower right can be derived based on the second reference sample. Specifically, the DC value of the upper left region can be derived based on the left reference samples and the upper reference samples, while the DC value of the lower right region can be derived based on the right reference samples and the lower reference samples. In other words, the DC value of a given region within the current block can be derived using reference samples adjacent to the boundary of the given region.

[0389] After dividing the current block into three regions, a DC value can be calculated using different reference samples in each of the three regions. For example, a region in which at least one of the x-coordinate or the y-coordinate is smaller than a first reference value can be set as a first region, and a region in which at least one of the x-coordinate or the y-coordinate is greater than or equal to the first reference value or smaller than the second reference value can be set as a second region. In addition, a region in which at least one of the x-coordinate or the y-coordinate is greater than the second reference value can be set as a third region. In this case, a DC value can be derived in the first region using the first reference sample, and a DC value can be derived in the third region using the second reference sample. In the second region, a DC value can be derived using both the first reference sample and the second reference sample.

[0390] Unlike the example shown in Figure 25, the current block can also be divided into multiple blocks based on the diagonal in the upper left diagonal direction.

[0391] Figure 26 is a diagram showing an example in which the range of reference samples used to derive DC values ​​is determined differently for each region.

[0392] Figures 26 (a) to (d) identify reference samples used to derive DC values ​​of the upper left sub-block, upper right sub-block, lower left sub-block, and lower right sub-block, respectively.

[0393] If the current block is divided into four sub-blocks of the same size, the DC value of each sub-block can be derived using reference samples adjacent to the corresponding sub-block. For example, the DC value of the upper left sub-block can be derived using the left reference samples and the upper reference samples, and the DC value of the upper right sub-block can be derived using the right reference samples and the upper reference samples. The DC value of the lower left sub-block can be derived using the left reference samples and the lower reference samples, and the DC value of the lower right sub-block can be derived using the right reference samples and the lower reference samples.

[0394] At this time, when deriving the DC value of each sub-block, reference samples adjacent to the corners of the current block may not be used. For example, when deriving the DC value of the upper left sub-block, the reference sample adjacent to the upper left corner of the current block may be excluded, and when deriving the DC value of the upper right sub-block, the reference sample adjacent to the upper right corner of the current block may be excluded.

[0395] In Fig. 26, it is illustrated that half of the reference samples whose x-axis coordinate is not greater than the width of the current block and half of the reference samples whose y-axis coordinate is not greater than the height of the current block are used to derive the DC value of each sub-block. Without being limited to the illustrated example, all of the reference samples whose x-axis coordinate is not greater than the width of the current block and all of the reference samples whose y-axis coordinate is not greater than the height of the current block may also be used to derive the DC value of each sub-block.

[0396] Unlike the example shown in Figure 26, the current block may be divided into fewer or more sub-blocks than four.

[0397] The shape / size of a sub-block may be determined based on the shape / size of the current block. Alternatively, the size of a sub-block may be predefined in the encoder and decoder.

[0398] If the intra prediction mode of the current block is DC mode, either the sub-block unit DC mode or the block unit DC mode may be selectively used. In this case, information for selecting either the sub-block unit DC mode or the block unit DC mode may be signaled through the bitstream.

[0399] Alternatively, it may be adaptively determined based on at least one of the shape and size of the current block, encoding information of the neighboring block (e.g., whether the neighboring block is encoded with intra prediction or inter prediction), the intra prediction mode of the neighboring block, or the position / partition index of the current block.

[0400] Alternatively, the DC value may be calculated using the same reference samples for each sub-block, but the weights assigned to the reference samples may be set differently for each sub-block. All four sub-blocks may calculate the DC value using the left reference samples and the top reference samples, but the weights assigned to the reference samples may be set differently for each sub-block location.

[0401] Fig. 27 is a diagram illustrating an example in which the weights assigned to reference samples are set differently for each sub-block. As in the example illustrated in Fig. 27, all four sub-blocks calculate DC values ​​using the left reference samples and the top reference samples, but the weights assigned to the reference samples can be set differently for each location of the sub-block. Specifically, the weights assigned to reference samples adjacent to a sub-block can be set to be greater than the weights assigned to reference samples not adjacent to the sub-block.

[0402] In Fig. 27, only the left reference samples and the upper reference samples are used as examples, but even when the DC value is calculated using the right reference samples and the lower reference samples, the weights assigned to the right reference samples and the lower reference samples may be determined differently depending on the location of the sub-block.

[0403]

[0404] Although the above-described embodiments have been described based on a series of steps or a flowchart, this does not limit the chronological order of the invention, and may be performed simultaneously or in a different order as needed. In addition, each of the components (e.g., units, modules, etc.) constituting the block diagram in the above-described embodiments may be implemented as a hardware device or software, or a plurality of components may be combined to be implemented as a single hardware device or software. The above-described embodiments may be implemented in the form of program commands that can be executed through various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program commands, data files, data structures, etc., singly or in combination. Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes, optical recording media such as CD-ROMs and DVDs, magneto-optical media such as floptical disks, and hardware devices specifically configured to store and execute program commands such as ROMs, RAMs, and flash memories. The above hardware device may be configured to operate as one or more software modules to perform processing according to the present invention, and vice versa.

[0405] The present invention can be applied to an electronic device capable of encoding / decoding an image.

Claims

1. A step of determining the intra prediction mode of the current block; When the intra prediction mode of the current block is DC mode, a step of determining a DC value using reference samples surrounding the current block; and Including a step of deriving a prediction sample of the current block based on the DC value, An image decoding method, characterized in that the DC value is obtained for each unit area within the current block.

2. In paragraph 1, An image decoding method, characterized in that the range of reference samples used to obtain the DC value is determined differently for each unit area.

3. In paragraph 2, An image decoding method, characterized in that the above reference samples include at least one of a left reference sample, an upper reference sample, a right reference sample, or a lower reference sample.

4. In paragraph 3, A video decoding method, characterized in that the DC value of a first region bordering the upper boundary and the left boundary of the current block is obtained based on the left reference sample and the upper reference sample, and the DC value of a second region bordering the right boundary and the lower boundary of the current block is obtained based on the right reference sample and the lower reference sample.

5. In paragraph 2, An image decoding method, characterized in that the above unit area is a sub-block of a predetermined size.

6. In paragraph 2, An image decoding method characterized in that the current block is divided into multiple regions based on the upper right diagonal line.

7. In paragraph 1, The above DC value is obtained based on the left reference sample and the upper reference sample of the current block, An image decoding method, characterized in that the weights assigned to the left reference sample and the reference sample are determined differently for each unit area.

8. Step of determining the intra prediction mode of the current block; When the intra prediction mode of the current block is DC mode, a step of determining a DC value using reference samples surrounding the current block; and Including a step of deriving a prediction sample of the current block based on the DC value, An image encoding method, characterized in that the DC value is obtained for each unit area within the current block.

9. In paragraph 8, An image encoding method, characterized in that the range of reference samples used to obtain the DC value is determined differently for each unit area.

10. In paragraph 9, A video encoding method, characterized in that the above reference samples include at least one of a left reference sample, an upper reference sample, a right reference sample, or a lower reference sample.

11. In paragraph 10, A video encoding method, characterized in that the DC value of a first region bordering the upper boundary and the left boundary of the current block is obtained based on the left reference sample and the upper reference sample, and the DC value of a second region bordering the right boundary and the lower boundary of the current block is obtained based on the right reference sample and the lower reference sample.

12. In paragraph 9, An image encoding method, characterized in that the above unit area is a sub-block of a predetermined size.

13. In paragraph 9, An image encoding method characterized in that the current block is divided into multiple regions based on the upper right diagonal line.

14. Including an intra prediction unit that determines the intra prediction mode of the current block, and if the intra prediction mode of the current block is a DC mode, determines a DC value using reference samples around the current block, and derives a prediction sample of the current block based on the DC value. An image decoding device, characterized in that the DC value is obtained for each unit area within the current block.

15. Including an intra prediction unit that determines the intra prediction mode of the current block, and if the intra prediction mode of the current block is a DC mode, determines a DC value using reference samples around the current block, and derives a prediction sample of the current block based on the DC value. An image encoding device, characterized in that the DC value is obtained for each unit area within the current block.