Image encoding / decoding method and apparatus and recording medium storing bitstream

By determining the location and value of representative samples using intra-frame prediction, and then using representative and reference samples for image encoding and decoding, the problem of transmission and storage costs for high-resolution and high-quality image data is solved, and higher compression efficiency is achieved.

CN115022632BActive Publication Date: 2025-12-23INTELLECTUAL DISCOVERY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210863160.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2018-09-13
Filing Date
2018-10-18
Publication Date
2025-12-23
Estimated Expiration
2038-10-18

AI Technical Summary

Technical Problem

The increased cost of transmitting and storing high-resolution and high-quality image data necessitates efficient image encoding/decoding technologies to improve compression efficiency.

Method used

By employing an intra-frame prediction method, the position and value of representative samples are determined, and the current block is predicted using representative and reference samples, thereby improving the compression efficiency of encoding and decoding.

Benefits of technology

It improves the compression efficiency of image encoding and decoding, and reduces the cost of data transmission and storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115022632B_ABST
    Figure CN115022632B_ABST
Patent Text Reader

Abstract

An image encoding / decoding method and apparatus and a recording medium storing a bitstream are provided. An image decoding method includes the steps of deriving an intra prediction mode of a current block, configuring reference samples of the current block, and performing an intra prediction on the current block based on the intra prediction mode and the reference samples, wherein the intra prediction can be a representative sample-based prediction.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with the application date of October 18, 2018, the application number of "201880067363.3", and the title of "Image encoding / decoding method and apparatus and recording medium storing bitstream". TECHNICAL FIELD

[0002] The present application relates to a method and apparatus for encoding / decoding an image and a recording medium storing a bitstream. More particularly, the present application relates to a method and apparatus for encoding / decoding an image using intra prediction and a recording medium storing a bitstream generated by the image encoding method / apparatus of the present application. BACKGROUND

[0003] Recently, in various application fields, the demand for high resolution and high quality images such as high definition (HD) images and ultra-high definition (UHD) images has increased. However, higher resolution and higher quality image data has an increased amount of data compared to conventional image data. Therefore, when image data is transmitted by using a medium such as a conventional wired and wireless broadband network, or when image data is stored by using a conventional storage medium, the cost of transmission and storage increases. In order to solve these problems that occur as the resolution and quality of image data increase, an efficient image encoding / decoding technique is required for higher resolution and higher quality images.

[0004] Image compression techniques include various techniques including an inter prediction technique that predicts pixel values included in a current picture from previous or subsequent pictures of the current picture, an intra prediction technique that predicts pixel values included in a current picture by using pixel information in the current picture, a transform and quantization technique for compressing the energy of a residual signal, an entropy encoding technique that allocates a short code to a value having a high frequency of occurrence and a long code to a value having a low frequency of occurrence, and the like. Image data can be efficiently compressed by using such image compression techniques, and can be transmitted or stored. SUMMARY

[0005] TECHNICAL PROBLEM

[0006] The present application aims to provide a method and apparatus for encoding and decoding an image to improve compression efficiency.

[0007] Another object of the present application is to provide a method and apparatus for encoding and decoding an image using intra prediction to improve compression efficiency.

[0008] Still another object of the present application is to provide a recording medium storing a bitstream generated by the image encoding method / apparatus of the present application.

[0009] TECHNICAL SOLUTION

[0010] An image decoding method according to an embodiment of the present application can include deriving an intra prediction mode of a current block, configuring reference samples of the current block, and performing an intra prediction on the current block based on the intra prediction mode and the reference samples, wherein the intra prediction can be a representative sample based prediction.

[0011] In the image decoding method according to the present application, the representative sample based prediction can include determining a position of the representative sample, determining a value of the representative sample, and predicting a sample in the current block using the representative sample and the reference samples.

[0012] In the image decoding method according to the present application, the position of the representative sample can be determined as a predetermined fixed position or determined by information signaled through a bitstream.

[0013] In the image decoding method according to the present application, the predetermined fixed position can be a right bottom position of the current block.

[0014] In the image decoding method according to the present application, the value of the representative sample can be determined using a statistical value of the representative sample and neighboring samples of the representative sample designated by the position of the representative sample.

[0015] In the image decoding method according to the present application, the position of the representative sample can be a right bottom position of the current block, and the value of the representative sample can be an average value of the representative sample, a left sample of the representative sample, a left top sample of the representative sample, and an upper sample of the representative sample.

[0016] In the image decoding method according to the present application, the determining of the value of the representative sample can include deriving a prediction value for the representative sample, reconstructing a residual value for the representative sample, and determining the value of the representative sample using the prediction value and the residual value.

[0017] In the image decoding method according to the present application, the prediction value for the representative sample can be derived using a left reference sample of the current block and an upper reference sample of the current block.

[0018] In the image decoding method according to the present application, a prediction value for a right boundary sample in the current block adjacent to a right boundary of the current block can be derived using an interpolation of the representative sample and the upper reference sample, and a prediction value for a bottom boundary sample in the current block adjacent to a bottom boundary of the current block can be derived using an interpolation of the representative sample and the left reference sample.

[0019] In the image decoding method according to the present application, the prediction value for the samples in the current block can be derived using the right boundary sample, the bottom boundary sample, the upper reference sample, and the left reference sample.

[0020] An image encoding method according to another embodiment of the present application can include determining an intra prediction mode of a current block, configuring reference samples of the current block, and performing an intra prediction on the current block based on the intra prediction mode and the reference samples, wherein the intra prediction is a prediction based on a representative sample.

[0021] In the image encoding method according to the present application, the prediction based on the representative sample can include determining a position of the representative sample, determining a value of the representative sample, and predicting a sample in the current block using the representative sample and the reference samples.

[0022] In the image encoding method according to the present application, the position of the representative sample can be determined as a predetermined fixed position or coded by information signaled through a bitstream.

[0023] In the image encoding method according to the present application, the value of the representative sample can be determined as a statistical value of the representative sample and neighboring samples of the representative sample using the position of the representative sample.

[0024] In the image encoding method according to the present application, the position of the representative sample can be a right bottom position of the current block, and the value of the representative sample is an average value of the representative sample, a left sample of the representative sample, an upper left sample of the representative sample, and an upper sample of the representative sample.

[0025] In the image encoding method according to the present application, the step of determining the value of the representative sample can include deriving a prediction value for the representative sample, deriving a residual value for the representative sample, and determining the value of the representative sample using the prediction value and the residual value.

[0026] In the image encoding method according to the present application, the prediction value for the representative sample can be derived using a left reference sample of the current block and an upper reference sample of the current block.

[0027] In the image encoding method according to the present application, the prediction value for a right boundary sample adjacent to the right boundary of the current block in the current block can be derived using the interpolation of the representative sample and the upper reference sample, and the prediction value for a bottom boundary sample adjacent to the bottom boundary of the current block in the current block can be derived using the interpolation of the representative sample and the left reference sample.

[0028] In the image encoding method according to the present application, the prediction value for a sample in the current block can be derived using the right boundary sample, the bottom boundary sample, the upper reference sample, and the left reference sample.

[0029] A computer-readable recording medium according to another embodiment of the present application can store a bitstream generated by the image encoding method or apparatus according to the present application.

[0030] Advantageous Effects

[0031] According to the present application, there are provided a method and apparatus for encoding and decoding an image to improve compression efficiency.

[0032] According to the present application, there are provided a method and apparatus for encoding and decoding an image to improve compression efficiency using intra prediction.

[0033] According to the present application, there is provided a recording medium storing a bitstream generated by the image encoding method / apparatus of the present application. BRIEF DESCRIPTION OF DRAWINGS

[0034] Figure 1 is a block diagram illustrating a configuration of an encoding apparatus according to an embodiment of the present application.

[0035] Figure 2 is a block diagram illustrating a configuration of a decoding apparatus according to an embodiment of the present application.

[0036] Figure 3 is a diagram schematically illustrating a partition structure of an image when the image is encoded and decoded.

[0037] Figure 4 is a diagram for explaining an embodiment of a process of inter prediction.

[0038] Figure 5 is a diagram for explaining intra prediction according to the present application.

[0039] Figure 6 is an exemplary diagram illustrating a relationship between a luma block and a chroma block.

[0040] Figure 7 is a diagram for describing a plurality of reconstructed sample lines.

[0041] Figure 8 is a diagram for describing a process of replacing unavailable samples with available samples.

[0042] Figure 9 various filter shapes are shown.

[0043] Figure 10 is a diagram for describing intra prediction according to a shape of a current block.

[0044] Figure 11 is a diagram for describing neighboring samples of a current block used for deriving parameters of a linear model used for predicting a chroma component from a luma component.

[0045] Figure 12 is an exemplary diagram showing a process of reconstructing a color component block.

[0046] Figure 13 is a diagram showing an embodiment of performing reconstruction by using multiple lines of upper reference samples and / or multiple lines of left reference samples.

[0047] Figure 14 is an exemplary diagram showing reference samples used for reconstruction according to an intra prediction mode or an encoding parameter of a respective block.

[0048] Figure 15 is a diagram showing a respective block of a first color component of an exemplary reconstruction when a second color component predicts a target block is a 4x4 block.

[0049] Figure 16 is a diagram showing a sample of a first color component and a sample of a second color component.

[0050] Figure 17 is a diagram showing an exemplary method of determining a representative sample.

[0051] Figure 18 is a diagram showing an exemplary method of performing prediction on a representative sample.

[0052] Figure 19 is a diagram showing another exemplary method of performing prediction on a representative sample.

[0053] Figure 20 is a diagram showing an exemplary method of generating right column prediction samples and bottom row prediction samples of a current block by using reconstructed representative samples and reference samples.

[0054] Figure 21 is a diagram showing an exemplary method of performing prediction by using reference samples and right column prediction samples or bottom row prediction samples.

[0055] Figure 22is a diagram illustrating an exemplary prediction method showing a case where a current block is divided into sub-blocks. DETAILED DESCRIPTION

[0056] Various modifications can be made to the present application, and various embodiments of the present application exist, wherein examples of various embodiments of the present application will now be provided and described in detail with reference to the accompanying drawings. However, although the exemplary embodiments can be interpreted to include all modifications, equivalents, or alternative forms within the technical concept and technical scope of the present application, the present application is not limited thereto. Like reference numerals refer to the same or similar functions throughout. In the drawings, the shapes and sizes of elements can be exaggerated for clarity. In the following detailed description of the present application, reference is made to the accompanying drawings that illustrate a specific embodiment by which the present application can be practiced. These embodiments are described in sufficient detail to enable those skilled in the art to practice the disclosure. It is to be understood that various embodiments of the present disclosure, although different, are not necessarily mutually exclusive. For example, specific features, structures, and characteristics described herein in connection with one embodiment can be practiced in other embodiments without departing from the spirit and scope of the disclosure. In addition, it should be understood that the position or arrangement of individual elements within each disclosed embodiment can be modified without departing from the spirit and scope of the disclosure. Accordingly, the following detailed description is not to be interpreted in a limiting sense, and the scope of the present disclosure is defined only by the appended claims, along with the full range of equivalents that the claims are entitled to in the appropriate jurisdictions.

[0057] The terms "first", "second", and the like used in the specification can be used to describe various components, but these components are not construed as being limited by the terms. The terms are used only to distinguish one component from another component. For example, a "first" component can be referred to as a "second" component, and a "second" component can also be similarly referred to as a "first" component without departing from the scope of the present application. The term "and / or" includes a combination of a plurality of terms or any one of the plurality of terms.

[0058] It will be understood that, in this specification, when an element is only referred to as being "connected to" or "coupled to" another element without being "directly connected to" or "directly coupled to" another element, it can be "directly connected to" or "directly coupled to" the other element, or connected or coupled to the other element with other elements therebetween. Conversely, it will be understood that when an element is referred to as being "directly coupled" or "directly connected" to another element, there is no intermediate element therebetween.

[0059] Further, the constituent components shown in the embodiments of the present application are independently shown in order to present different characteristic functions from each other. Thus, this does not mean that each of the constituent components is constituted as a separate hardware or software constituent unit. In other words, for convenience, each of the constituent components includes each of the enumerated constituent components. Thus, at least two of the constituent components among each of the constituent components can be combined to form one constituent component, or one constituent component can be divided into a plurality of constituent components for performing each function. Embodiments in which each of the constituent components is combined and embodiments in which one constituent component is divided are also included in the scope of the present application without departing from the essence of the present application.

[0060] The terms used in the present specification are merely used to describe particular embodiments, and are not intended to limit the present application. Expressions such as "include" or "has" used in the present specification do not exclude the existence of additional elements or features, but merely indicate that the elements or features are included or exist. The expression "including a" or "having a" should be construed to mean "including at least one" or "having at least one," not excluding the existence of additional elements or features. The expression "a" or "an" should be construed to mean "at least one" or "one or more," not excluding the existence of additional elements or features. The terms "comprise," "comprising," "include," "including," "have," "has," "contain," "containing," "characterized by," "including the" and "characterized by" are used interchangeably in the present specification.

[0061] Further, some of the constituent elements can not be essential elements for performing the essential functions of the present application, but can be optional elements for improving performance thereof. The present application can be implemented by including only the essential constituent elements for implementing the essence of the present application, excluding the constituent elements used in improving performance. A structure including only the essential constituent elements, excluding the optional elements used only in improving performance, is also included in the scope of the present application.

[0062] Hereinafter, embodiments of the present application will be described in detail with reference to the accompanying drawings. In describing the exemplary embodiments of the present application, a well-known function or construction will not be described in detail in order not to unnecessarily obscure the understanding of the present application. The same constituent elements in the drawings are denoted by the same reference numerals, and repeated description of the same elements will be omitted.

[0063] Hereinafter, an image can refer to a picture constituting a video, or can refer to a video itself. For example, "encoding or decoding or both encoding and decoding an image" can refer to "encoding or decoding or both encoding and decoding a moving picture", and can refer to "encoding or decoding or both encoding and decoding one of the pictures of a moving picture".

[0064] Hereinafter, the terms "moving picture" and "video" can be used as the same meaning and can be replaced with each other.

[0065] Hereinafter, a target image can be a coding target image as a coding target and / or a decoding target image as a decoding target. In addition, the target image can be an input image input to an encoding apparatus, and an input image input to a decoding apparatus. Here, the target image can have the same meaning as a current image.

[0066] Hereinafter, the terms "image", "picture", "frame", and "screen" can be used as the same meaning and can be replaced with each other.

[0067] Hereinafter, a target block can be a coding target block as a coding target and / or a decoding target block as a decoding target. In addition, the target block can be a current block as a target of current encoding and / or decoding. For example, the terms "target block" and "current block" can be used as the same meaning and can be replaced with each other.

[0068] Hereinafter, the terms "block" and "unit" can be used as the same meaning and can be replaced with each other. Or "block" can mean a specific unit.

[0069] Hereinafter, the terms "region" and "segment" can be replaced with each other.

[0070] Hereinafter, a specific signal can be a signal representing a specific block. For example, an original signal can be a signal representing a target block. A prediction signal can be a signal representing a prediction block. A residual signal can be a signal representing a residual block.

[0071] In an embodiment, each of a specific information, data, flag, index, element, and attribute, etc. can have a value. A value of the information, data, flag, index, element, and attribute equal to "0" can represent a logical false or a first predefined value. In other words, the value "0", false, logical false, and the first predefined value can be replaced with each other. A value of the information, data, flag, index, element, and attribute equal to "1" can represent a logical true or a second predefined value. In other words, the value "1", true, logical true, and the second predefined value can be replaced with each other.

[0072] When a variable i or j is used to represent a column, a row, or an index, a value of i can be an integer equal to or greater than 0, or an integer equal to or greater than 1. That is, the column, the row, the index, etc. can be counted from 0, or can be counted from 1.

[0073] Term Description

[0074] Encoder: means an apparatus that performs encoding. That is, means an encoding apparatus.

[0075] Decoder: means an apparatus that performs decoding. That is, means a decoding apparatus.

[0076] Block: is an array of samples of MxN. Here, M and N can represent positive integers, and the block can represent an array of samples in two-dimensional form. The block can refer to a unit. The current block can represent a coding target block that becomes a target at the time of encoding, or a decoding target block that becomes a target at the time of decoding. In addition, the current block can be at least one of a coding block, a prediction block, a residual block, and a transform block.

[0077] Sample: is a basic unit constituting a block. According to a bit depth (Bd), the sample can be represented as a value from 0 to 2 Bd -1. In the present invention, the sample can be used as the meaning of a pixel. That is, the sample, pel, pixel can have the same meaning as each other.

[0078] Unit: can refer to a coding and decoding unit. When an image is encoded and decoded, the unit can be an area generated by partitioning a single image. In addition, when a single image is partitioned into sub-partition units during encoding or decoding, the unit can represent a sub-partition unit. That is, an image can be partitioned into a plurality of units. When an image is encoded and decoded, a predetermined process for each unit can be performed. A single unit can be partitioned into a sub-unit having a size smaller than that of the unit. Depending on the function, the unit can represent a block, a macroblock, a coding tree unit, a coding tree block, a coding unit, a coding block, a prediction unit, a prediction block, a residual unit, a residual block, a transform unit, a transform block, etc. In addition, in order to distinguish the unit from the block, the unit can include a luma component block, a chroma component block associated with the luma component block, and a syntax element of each color component block. The unit can have various sizes and shapes, and specifically, the shape of the unit can be a two-dimensional geometric figure such as a square, a rectangle, a trapezoid, a triangle, a pentagon, etc. In addition, the unit information can include at least one of a unit type indicating a coding unit, a prediction unit, a transform unit, etc., and a unit size, a unit depth, an order of coding and decoding of the unit, etc.

[0079] Coding tree unit: is configured with a single coding tree block of a luma component Y and two coding tree blocks related to chroma components Cb and Cr. In addition, the coding tree unit can represent a block and a syntax element of each block. Each coding tree unit can be partitioned by using at least one of a quad-tree partitioning method, a binary-tree partitioning method, and a ternary-tree partitioning method, etc., to configure lower layer units such as a coding unit, a prediction unit, a transform unit, etc. The coding tree unit can be used as a term for designating a sample block that becomes a processing unit at the time of encoding / decoding an image as an input image. Here, the quad-tree can represent a quad.

[0080] When the size of the coding block falls within a first predetermined range, only quad-tree partitioning is allowed for the coding block. Here, the first predetermined range can be defined by at least one of a maximum size and a minimum size of a coding block that can be partitioned only by quad-tree partitioning. Information indicating the maximum size / minimum size of a coding block for which quad-tree partitioning is allowed can be signaled as data included in a bitstream, and the information can be signaled in units of at least one of a sequence, a picture parameter, and a slice (segment). Alternatively, the maximum size / minimum size of a coding block can be a fixed size preset in an encoder / decoder. For example, when the size of a coding block is in a range from 64x64 to 256x256, the coding block can be partitioned only by quad-tree partitioning. Alternatively, when the size of a coding block is greater than a maximum size of a transform block (TB), the coding block can be partitioned only by quad-tree partitioning. In this case, the block to be partitioned into quadrants can be a coding block or a transform block. In this case, information indicating quad-tree partitioning of a coding block (e.g., split_flag) can be a flag indicating whether a coding unit is partitioned by quad-tree partitioning. When the size of the coding block falls within a second predetermined range, the coding block can be partitioned only by binary-tree partitioning or ternary-tree partitioning. In this case, the above description of quad-tree partitioning can also be applied to binary-tree partitioning or ternary-tree partitioning.

[0081] coding tree block: can be used as a term for specifying any one of a Y coding tree block, a Cb coding tree block, and a Cr coding tree block.

[0082] neighboring block: can mean a block adjacent to a current block. The block adjacent to the current block can mean a block in contact with a boundary of the current block, or a block located within a predetermined distance from the current block. The neighboring block can mean a block adjacent to a vertex of the current block. Here, the block adjacent to the vertex of the current block can mean a block vertically adjacent to a neighboring block horizontally adjacent to the current block, or a block horizontally adjacent to a neighboring block vertically adjacent to the current block.

[0083] reconstructed neighboring block: can mean a neighboring block adjacent to a current block and having been spatially / temporally encoded or decoded. Here, the reconstructed neighboring block can mean a reconstructed neighboring unit. The reconstructed spatial neighboring block can be a block within a current picture that has been reconstructed by encoding or decoding, or both encoding and decoding. The reconstructed temporal neighboring block is a block or a neighboring block of the block at a position corresponding to a current block of a current picture within a reference picture.

[0084] Unit depth: can denote a degree of partitioning of a unit. In a tree structure, a highest node (root node) can correspond to a first unit which is not partitioned. Also, the highest node can have a minimum depth value. In this case, the depth of the highest node can be level 0. A node having a depth of level 1 can denote a unit generated by partitioning the first unit once. A node having a depth of level 2 can denote a unit generated by partitioning the first unit twice. A node having a depth of level n can denote a unit generated by partitioning the first unit n times. A leaf node can be a lowest node and a node which cannot be further partitioned. The depth of the leaf node can be a maximum level. For example, a predefined value of the maximum level can be 3. The depth of the root node can be the lowest, and the depth of the leaf node can be the deepest. Also, when a unit is denoted as a tree structure, a level in which the unit exists can denote a unit depth.

[0085] Bitstream: can denote a bitstream including encoded image information.

[0086] Parameter set: corresponds to header information among configurations within a bitstream. At least one of a video parameter set, a sequence parameter set, a picture parameter set, and an adaptation parameter set can be included in the parameter set. Also, the parameter set can include slice header and tile header information.

[0087] Parsing: can denote determining a value of a syntax element by performing entropy decoding, or can denote entropy decoding itself.

[0088] Symbol: can denote at least one of a syntax element, an encoding parameter, and a transform coefficient value of an encoding / decoding target unit. Also, the symbol can denote an entropy encoding target or an entropy decoding result.

[0089] Prediction mode: can be information indicating a mode encoded / decoded using intra prediction or a mode encoded / decoded using inter prediction.

[0090] Prediction unit: can denote a basic unit when performing prediction such as inter prediction, intra prediction, inter compensation, intra compensation, and motion compensation. A single prediction unit can be partitioned into a plurality of partitions having smaller sizes, or can be partitioned into a plurality of lower layer prediction units. The plurality of partitions can be basic units when performing prediction or compensation. A partition generated by dividing a prediction unit can also be a prediction unit.

[0091] Prediction unit partition: can denote a shape obtained by partitioning a prediction unit.

[0092] Transform unit: can mean a basic unit in which encoding / decoding is performed on a residual signal, such as a transform, an inverse transform, quantization, dequantization, transform coefficient encoding / decoding. A single transform unit can be partitioned into a plurality of lower-level transform units having a smaller size. Here, the transform / inverse transform can include at least one of a first transform / first inverse transform and a second transform / second inverse transform.

[0093] Scaling: can mean a process of multiplying a quantized level by a factor. A transform coefficient can be generated by scaling a quantized level. Scaling can also be referred to as dequantization.

[0094] Quantization parameter: can mean a value used when a transform coefficient is used to generate a quantized level during quantization. The quantization parameter can also mean a value used when a transform coefficient is generated by scaling a quantized level during dequantization. The quantization parameter can be a value mapped on a quantization step.

[0095] Delta quantization parameter: can mean a difference value between a predicted quantization parameter and a quantization parameter of an encoding / decoding target unit.

[0096] Scan: can mean a method of ordering coefficients within a unit, a block, or a matrix. For example, changing a two-dimensional matrix of coefficients into a one-dimensional matrix can be referred to as a scan, and changing a one-dimensional matrix of coefficients into a two-dimensional matrix can be referred to as a scan or an inverse scan.

[0097] Transform coefficient: can mean a coefficient value generated after a transform is performed in an encoder. The transform coefficient can mean a coefficient value generated after at least one of entropy decoding and dequantization is performed in a decoder. A quantized level obtained by quantizing a transform coefficient or a residual signal, or a quantized transform coefficient level, can also fall within the meaning of a transform coefficient.

[0098] Quantized level: can mean a value generated by quantizing a transform coefficient or a residual signal in an encoder. Alternatively, the quantized level can mean a value that is a dequantization target to be performed in a decoder. Similarly, a quantized transform coefficient level as a result of a transform and quantization can also fall within the meaning of a quantized level.

[0099] Non-zero transform coefficient: can mean a transform coefficient having a value other than zero, or a transform coefficient level or a quantized level having a value other than zero.

[0100] Quantization matrix: can mean a matrix used in a quantization process or a dequantization process performed to improve subjective image quality or objective image quality. The quantization matrix can also be referred to as a scaling list.

[0101] Quantization matrix coefficient: can mean each element within a quantization matrix. The quantization matrix coefficient can also be referred to as a matrix coefficient.

[0102] Default matrix: can mean a predetermined quantization matrix that is predefined in an encoder or a decoder.

[0103] Non-default matrix: can mean a quantization matrix that is not predefined in an encoder or a decoder but is signaled by a user.

[0104] Statistical value: a statistical value for at least one of a variable having a specific value that can be calculated, an encoding parameter, a constant value, etc. can be one or more of an average value, a weighted average value, a weighted sum value, a minimum value, a maximum value, a most frequently occurring value, a median value, an interpolation value of the corresponding specific value.

[0105] Figure 1 is a block diagram illustrating a configuration of an encoding apparatus according to an embodiment to which the present application is applied.

[0106] The encoding apparatus 100 can be an encoder, a video encoding apparatus, or an image encoding apparatus. A video can include at least one image. The encoding apparatus 100 can sequentially encode the at least one image.

[0107] Referring to Figure 1 , the encoding apparatus 100 can include a motion prediction unit 111, a motion compensation unit 112, an intra prediction unit 120, a switch 115, a subtractor 125, a transform unit 130, a quantization unit 140, an entropy encoding unit 150, a dequantization unit 160, an inverse transform unit 170, an adder 175, a filter unit 180, and a reference picture buffer 190.

[0108] The encoding apparatus 100 can perform encoding on an input image by using an intra mode or an inter mode or both the intra mode and the inter mode. Further, the encoding apparatus 100 can generate a bitstream including encoded information by encoding the input image, and output the generated bitstream. The generated bitstream can be stored in a computer-readable recording medium, or can be streamed through a wired / wireless transmission medium. When the intra mode is used as a prediction mode, the switch 115 can be switched to intra. Alternatively, when the inter mode is used as a prediction mode, the switch 115 can be switched to the inter mode. Here, the intra mode can mean an intra prediction mode, and the inter mode can mean an inter prediction mode. The encoding apparatus 100 can generate a prediction block for an input block of an input image. Further, the encoding apparatus 100 can encode a residual block using a residual of the input block and the prediction block after generating the prediction block. The input image can be referred to as a current image that is a current encoding target. The input block can be referred to as a current block that is a current encoding target, or as an encoding target block.

[0109] When the prediction mode is the intra mode, the intra prediction unit 120 can use samples of a block that has been encoded / decoded and is adjacent to the current block as reference samples. The intra prediction unit 120 can perform spatial prediction on the current block by using the reference samples, or generate predicted samples of the input block by performing spatial prediction. Here, the intra prediction can mean prediction within a frame.

[0110] When the prediction mode is the inter mode, the motion prediction unit 111 can retrieve a region that best matches the input block from a reference picture when performing motion prediction, and derive a motion vector by using the retrieved region. In this case, the search region can be used as the region. The reference picture can be stored in the reference picture buffer 190. Here, when encoding / decoding of the reference picture is performed, the reference picture can be stored in the reference picture buffer 190.

[0111] The motion compensation unit 112 can generate a predicted block by performing motion compensation on the current block by using the motion vector. Here, the inter prediction can mean inter prediction or motion compensation.

[0112] When a value of the motion vector is not an integer, the motion prediction unit 111 and the motion compensation unit 112 can generate a predicted block by applying an interpolation filter to a partial region of a reference picture. In order to perform inter prediction or motion compensation on an encoding unit, it can be determined which mode among a skip mode, a merge mode, an advanced motion vector prediction (AMVP) mode, and a current picture reference mode is to be used for motion prediction and motion compensation of a prediction unit included in the corresponding encoding unit. Then, depending on the determined mode, inter prediction or motion compensation can be performed differently.

[0113] The subtractor 125 can generate a residual block by using a residual of the input block and the predicted block. The residual block can be referred to as a residual signal. The residual signal can mean a difference between an original signal and a predicted signal. Also, the residual signal can be a signal generated by transforming or quantizing or transforming and quantizing a difference between the original signal and the predicted signal. The residual block can be a residual signal of a block unit.

[0114] The transform unit 130 can generate transform coefficients by performing transform on the residual block, and output the generated transform coefficients. Here, the transform coefficients can be coefficient values generated by performing transform on the residual block. When a transform skip mode is applied, the transform unit 130 can skip transform on the residual block.

[0115] A quantized level can be generated by applying quantization to the transform coefficients or to the residual signal. Hereinafter, the quantized level can also be referred to as a transform coefficient in an embodiment.

[0116] The quantization unit 140 can generate quantized levels by quantizing the transform coefficients or the residual signal according to the parameter, and output the generated quantized levels. Here, the quantization unit 140 can quantize the transform coefficients by using a quantization matrix.

[0117] The entropy encoding unit 150 can generate a bitstream by performing entropy encoding on the values calculated by the quantization unit 140 or on the encoding parameter values calculated when encoding is performed according to a probability distribution, and output the generated bitstream. The entropy encoding unit 150 can perform entropy encoding on the sample information of the image and information used to decode the image. For example, the information used to decode the image can include a syntax element.

[0118] When entropy encoding is applied, symbols are represented such that a smaller number of bits is allocated to symbols having a high generation probability, and a larger number of bits is allocated to symbols having a low generation probability, and thus, the size of the bitstream of the symbols to be encoded can be reduced. The entropy encoding unit 150 can use an encoding method for entropy encoding such as exponential Golomb, context adaptive variable length coding (CAVLC), context adaptive binary arithmetic coding (CABAC), etc. For example, the entropy encoding unit 150 can perform entropy encoding by using a variable length coding / code (VLC) table. Furthermore, the entropy encoding unit 150 can derive a binarization method of a target symbol and a probability model of the target symbol / binary bit, and perform arithmetic encoding by using the derived binarization method and the context model.

[0119] In order to encode the transform coefficient levels (quantized levels), the entropy encoding unit 150 can change the coefficients in the form of a two-dimensional block into the form of a one-dimensional vector by using a transform coefficient scanning method.

[0120] The coding parameters can include information such as syntax elements (flags, indices, etc.) coded in the encoder and signaled to the decoder, and information derived when performing encoding or decoding. The coding parameters can represent information needed when encoding or decoding an image. For example, at least one value or combination of the following can be included in the coding parameters: unit / block size, unit / block depth, unit / block partition information, unit / block shape, unit / block partition structure, whether or not to perform partitioning in a quad-tree form, whether or not to perform partitioning in a binary tree form, partitioning direction (horizontal or vertical) in a binary tree form, partitioning form (symmetric partitioning or asymmetric partitioning) in a binary tree form, whether or not to perform partitioning in a ternary tree form, partitioning direction (horizontal or vertical) in a ternary tree form, partitioning form (symmetric partitioning or asymmetric partitioning) in a ternary tree form, whether or not to perform partitioning in a multi-type tree form, partitioning direction (horizontal or vertical) in a multi-type tree form, partitioning form (symmetric partitioning or asymmetric partitioning) in a multi-type tree form, partitioning tree in a multi-type tree form, prediction mode (intra prediction or inter prediction), intra prediction mode / direction for luma, intra prediction mode / direction for chroma, intra partition information, inter partition information, coding block partition flag, prediction block partition flag, transform block partition flag, reference sample filtering method, reference sample filter tap, reference sample filter coefficient, prediction block filtering method, prediction block filter tap, prediction block filter coefficient, prediction block boundary filtering method, prediction block boundary filter tap, prediction block boundary filter coefficient, intra prediction mode, inter prediction mode, motion information, motion vector, motion vector difference, reference picture index, inter prediction angle, inter prediction indicator, prediction list utilization flag, reference picture list, reference picture, motion vector predictor index, motion vector predictor candidate, motion vector candidate list, whether or not to use merge mode, merge index, merge candidate, merge candidate list, whether or not to use skip mode, interpolation filter type, interpolation filter tap, interpolation filter coefficient, motion vector size, representation precision of motion vector, transform type, transform size, information on whether or not to use first (primary) transform, information on whether or not to use secondary transform, first transform index, secondary transform index, information on whether or not residual signal exists, coding block pattern, coding block flag (CBF), quantization parameter, quantization parameter residual, quantization matrix, whether or not to apply intra loop filter, intra loop filter coefficient, intra loop filter tap, intra loop filter shape / form, whether or not to apply deblocking filter, deblocking filter coefficient, deblocking filter tap, deblocking filter strength, deblocking filter shape / form, whether or not to apply adaptive sample offset, adaptive sample offset value, adaptive sample offset category, adaptive sample offset type, whether or not to apply adaptive loop filter, adaptive loop filter coefficient, adaptive loop filter tap, adaptive loop filter shape / form, binarization / debinarization method,Context model determination method, context model update method, whether to perform normal mode, whether to perform bypass mode, context bin, bypass bin, significant coefficient flag, last significant coefficient flag, coding flag for a unit of a coefficient group, position of last significant coefficient, flag as to whether a value of a coefficient is greater than 1, flag as to whether a value of a coefficient is greater than 2, flag as to whether a value of a coefficient is greater than 3, information on a remaining coefficient value, sign information, reconstructed luma sample, reconstructed chroma sample, residual luma sample, residual chroma sample, luma transform coefficient, chroma transform coefficient, quantized luma level, quantized chroma level, transform coefficient level scanning method, size of a motion vector search region at a decoder side, shape of a motion vector search region at a decoder side, number of times of motion vector search at a decoder side, information on a CTU size, information on a minimum block size, information on a maximum block size, information on a maximum block depth, information on a minimum block depth, image display / output order, slice identification information, slice type, slice partition information, parallel block identification information, parallel block type, parallel block partition information, picture type, bit depth of an input sample, bit depth of a reconstructed sample, bit depth of a residual sample, bit depth of a transform coefficient, bit depth of a quantized level, and information on a luma signal or information on a chroma signal.

[0121] Here, the signaling of the flag or the index can mean that the encoder entropy-encodes the corresponding flag or index and includes it in the bitstream, and can mean that the decoder entropy-decodes the corresponding flag or index from the bitstream.

[0122] When the encoding apparatus 100 performs encoding through inter prediction, the encoded current picture can be used as a reference picture for another picture that is subsequently processed. Accordingly, the encoding apparatus 100 can reconstruct or decode the encoded current picture, or store the reconstructed or decoded picture in the reference picture buffer 190 as a reference picture.

[0123] The quantized level can be dequantized in the dequantization unit 160, or can be inverse-transformed in the inverse transform unit 170. The coefficient that has been dequantized or inverse-transformed or both can be added to the prediction block by the adder 175. By adding the coefficient that has been dequantized or inverse-transformed or both to the prediction block, the reconstructed block can be generated. Here, the coefficient that has been dequantized or inverse-transformed or both can mean a coefficient for which at least one of dequantization and inverse transformation is performed, and can mean the reconstructed residual block.

[0124] The reconstructed block can pass through a filter unit 180. The filter unit 180 can apply at least one of a deblocking filter, a sample adaptive offset (SAO), and an adaptive loop filter (ALF) to the reconstructed sample, the reconstructed block, or the reconstructed picture. The filter unit 180 can be referred to as an in-loop filter.

[0125] The deblocking filter can remove block distortion generated in a boundary between blocks. In order to determine whether to apply the deblocking filter, it can be determined whether to apply the deblocking filter to the current block based on samples included in a number of rows or columns included in the block. When the deblocking filter is applied to the block, another filter can be applied according to a required deblocking filter strength.

[0126] In order to compensate for encoding errors, a suitable offset value can be added to a sample value by using a sample adaptive offset. The sample adaptive offset can correct an offset of a de-blocked picture from an original picture in units of samples. A method of applying an offset considering edge information about each sample can be used, or a method of partitioning samples of a picture into a predetermined number of regions, determining a region to which an offset is applied, and applying the offset to the determined region can be used.

[0127] The adaptive loop filter can perform filtering based on a comparison result of a filtered reconstructed picture and an original picture. Samples included in the picture can be partitioned into a predetermined group, a filter to be applied to each group can be determined, and differential filtering can be performed on each group. Information on whether to apply the ALF can be signaled through a coding unit (CU), and a form and coefficients of the ALF to be applied to each block can vary.

[0128] The reconstructed block or the reconstructed picture that has passed through the filter unit 180 can be stored in a reference picture buffer 190. The reconstructed block processed by the filter unit 180 can be a part of a reference picture. That is, the reference picture is a reconstructed picture composed of the reconstructed blocks processed by the filter unit 180. The stored reference picture can be used later at inter prediction or motion compensation.

[0129] Figure 2 FIG. 1 is a block diagram illustrating a configuration of a decoding apparatus according to an embodiment and to which the present application is applied.

[0130] The decoding apparatus 200 can be a decoder, a video decoding apparatus, or a picture decoding apparatus.

[0131] Referring to Figure 2 , the decoding apparatus 200 can include an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra prediction unit 240, a motion compensation unit 250, an adder 225, a filter unit 260, and a reference picture buffer 270.

[0132] The decoding apparatus 200 can receive a bitstream output from the encoding apparatus 100. The decoding apparatus 200 can receive a bitstream stored in a computer-readable recording medium, or can receive a bitstream being streamed through a wired / wireless transmission medium. The decoding apparatus 200 can decode the bitstream by using an intra mode or an inter mode. Furthermore, the decoding apparatus 200 can generate a reconstructed image or a decoded image generated by decoding, and output the reconstructed image or the decoded image.

[0133] When the prediction mode used in decoding is the intra mode, the switch can be switched to the intra. Alternatively, when the prediction mode used in decoding is the inter mode, the switch can be switched to the inter mode.

[0134] The decoding apparatus 200 can obtain a reconstructed residual block by decoding an input bitstream, and generate a prediction block. When the reconstructed residual block and the prediction block are obtained, the decoding apparatus 200 can generate a reconstructed block that is a decoding target by adding the reconstructed residual block to the prediction block. The decoding target block can be referred to as a current block.

[0135] The entropy decoding unit 210 can generate a symbol by entropy-decoding a bitstream according to a probability distribution. The generated symbol can include a quantized level form of a symbol. Here, the entropy-decoding method can be an inverse process of the above-described entropy-encoding method.

[0136] In order to decode a transform coefficient level (quantized level), the entropy decoding unit 210 can change a coefficient in a one-dimensional vector form to a two-dimensional block form by using a transform coefficient scanning method.

[0137] The quantized level can be inverse-quantized in the inverse quantization unit 220, or can be inverse-transformed in the inverse transform unit 230. The quantized level can be a result of inverse-quantization or inverse-transformation, or both inverse-quantization and inverse-transformation, and can be generated as a reconstructed residual block. Here, the inverse quantization unit 220 can apply a quantization matrix to the quantized level.

[0138] When the intra mode is used, the intra prediction unit 240 can generate a prediction block by performing spatial prediction on the current block, in which the spatial prediction uses sample values of blocks adjacent to the decoding target block and already decoded.

[0139] When the inter mode is used, the motion compensation unit 250 can generate a prediction block by performing motion compensation on the current block, in which the motion compensation uses a motion vector and a reference image stored in the reference picture buffer 270.

[0140] The adder 225 can generate a reconstructed block by adding the reconstructed residual block to the prediction block. The filter unit 260 can apply at least one of a deblocking filter, a sample adaptive offset, and an adaptive loop filter to the reconstructed block or the reconstructed picture. The filter unit 260 can output the reconstructed picture. The reconstructed block or the reconstructed picture can be stored in the reference picture buffer 270 and used when performing inter prediction. The reconstructed block processed by the filter unit 260 can be a part of a reference picture. That is, the reference picture is a reconstructed picture composed of the reconstructed blocks processed by the filter unit 260. The stored reference picture can be used later when performing inter prediction or motion compensation.

[0141] Figure 3 FIG. 1 is a diagram schematically illustrating a partition structure of an image when encoding and decoding the image. Figure 3 FIG. 2 schematically illustrates an example of partitioning a single unit into a plurality of lower-level units.

[0142] To effectively partition an image, a coding unit (CU) can be used when encoding and decoding. The coding unit can be used as a basic unit when encoding / decoding an image. Also, the coding unit can be used as a unit for distinguishing an intra prediction mode from an inter prediction mode when encoding / decoding an image. The coding unit can be a basic unit for prediction, transform, quantization, inverse transform, dequantization, or encoding / decoding processing of transform coefficients.

[0143] Referring to Figure 3 FIG. 3, an image 300 is sequentially partitioned in a maximum coding unit (LCU) and LCU units are determined as a partition structure. Here, the LCU can be used in the same meaning as a coding tree unit (CTU). The unit partitioning can denote partitioning of a block associated with the unit. In the block partitioning information, information of a unit depth can be included. The depth information can denote either or both of a number or degree of partitioning of a unit or a number and degree of partitioning of a unit. A single unit can be partitioned into a plurality of lower-level units hierarchically associated with the depth information based on a tree structure. In other words, a unit and lower-level units generated by partitioning the unit can correspond to a node and child nodes of the node, respectively. Each of the partitioned lower-level units can have the depth information. The depth information can be information denoting a size of a CU and can be stored in each CU. The unit depth denotes a number and / or degree related to partitioning of a unit. Accordingly, the partitioning information of the lower-level units can include information on sizes of the lower-level units.

[0144] The partition structure can represent a distribution of coding units (CUs) within the CTU 310. The distribution can be determined according to whether a single CU is partitioned into a plurality of CUs (a positive integer equal to or greater than 2, including 2, 4, 8, 16, etc.). The horizontal and vertical sizes of the CUs generated by the partitioning can be half of the horizontal and vertical sizes of the CU before being partitioned, respectively, or can have sizes smaller than the horizontal and vertical sizes before the partitioning, respectively, according to the number of times of partitioning. The CU can be recursively partitioned into a plurality of CUs. At least one of the height and width of the CU after the partitioning can be reduced compared to at least one of the height and width of the CU before the partitioning. The partitioning of the CU can be recursively performed until a predefined depth or a predefined size is reached. For example, the depth of the CTU can be 0, and the depth of the smallest coding unit (SCU) can be a predefined maximum depth. Here, as described above, the CTU can be a coding unit having a maximum coding unit size, and the SCU can be a coding unit having a minimum coding unit size. The partitioning starts from the CTU 310, and the CU depth is increased by 1 when the horizontal size or the vertical size, or both, of the CU is reduced by the partitioning. For example, for each depth, the size of the CU that is not partitioned can be 2Nx2N. Also, in the case of the CU that is partitioned, the CU having a size of 2Nx2N can be partitioned into four CUs having a size of NxN. When the depth is increased by 1, the size of N can be halved.

[0145] Also, information on whether the CU is partitioned can be represented by using partitioning information of the CU. The partitioning information can be 1-bit information. All CUs except for the SCU can include the partitioning information. For example, when the value of the partitioning information is a first value, the CU can not be partitioned, and when the value of the partitioning information is a second value, the CU can be partitioned.

[0146] Referring to Figure 3 , the CTU having a depth of 0 can be a 64x64 block. 0 can be a minimum depth. The SCU having a depth of 3 can be an 8x8 block. 3 can be a maximum depth. The CUs of the 32x32 block and the 16x16 block can be represented as depths 1 and 2, respectively.

[0147] For example, when a single coding unit is partitioned into four coding units, the horizontal and vertical sizes of the four partitioned coding units can be half the size of the horizontal and vertical sizes of the CU before being partitioned. In one embodiment, when a coding unit having a size of 32x32 is partitioned into four coding units, each of the four partitioned coding units can have a size of 16x16. When a single coding unit is partitioned into four coding units, the coding unit can be referred to as being partitioned (quad-tree partitioning) into a quad-tree form.

[0148] For example, when a single coding unit is partitioned into two coding units, the horizontal size or the vertical size of the two coding units can be half of the horizontal size or the vertical size of the coding unit before being partitioned. For example, when a coding unit having a size of 32x32 is partitioned in a vertical direction, each of the two coding units partitioned can have a size of 16x32. For example, when a coding unit having a size of 8x32 is partitioned into two sub-coding units in a horizontal direction, each of the two sub-coding units can have a size of 8x16. When a single coding unit is partitioned into two coding units, the coding unit can be said to be partitioned (binary tree partitioning) in a binary tree form.

[0149] For example, when a coding unit is partitioned into three sub-coding units, the horizontal size or the vertical size of the coding unit can be partitioned in a ratio of 1:2:1, thereby generating three sub-coding units having a ratio of 1:2:1 in horizontal size or vertical size. For example, when a coding unit having a size of 16x32 is partitioned into three sub-coding units in a horizontal direction, the three sub-coding units can have sizes of 16x8, 16x16, and 16x8 in order from the uppermost sub-coding unit to the lowermost sub-coding unit. For example, when a coding unit having a size of 32x32 is partitioned into three sub-coding units in a vertical direction, the three sub-coding units can have sizes of 8x32, 16x32, and 8x32 in order from the leftmost sub-coding unit to the rightmost sub-coding unit. When a coding unit is partitioned into three sub-coding units, the coding unit can be said to be partitioned in a ternary tree or according to a ternary tree partitioning structure.

[0150] In Figure 3 The coding tree unit (CTU) 320 is an example of a CTU to which all of the quad tree partitioning structure, the binary tree partitioning structure, and the ternary tree partitioning structure are applied.

[0151] As described above, in order to partition a CTU, at least one of the quad tree partitioning structure, the binary tree partitioning structure, and the ternary tree partitioning structure can be applied. The various tree partitioning structures can be sequentially applied to the CTU according to a predetermined priority order. For example, the quad tree partitioning structure can be preferentially applied to the CTU. A coding unit that cannot be further partitioned using the quad tree partitioning structure can correspond to a leaf node of a quad tree. The coding unit corresponding to the leaf node of the quad tree can be used as a root node of a binary tree and / or a ternary tree partitioning structure. That is, the coding unit corresponding to the leaf node of the quad tree can be further partitioned according to the binary tree partitioning structure or the ternary tree partitioning structure, or can not be further partitioned. Accordingly, a coding block generated by preventing binary tree partitioning or ternary tree partitioning of the coding unit corresponding to the leaf node of the quad tree, which is performed further quad tree partitioning, can be effectively perform block partitioning and / or signaling of partitioning information.

[0152] The fact that a coding unit corresponding to a node of a quadtree is partitioned can be signaled using quad-partition information. The quad-partition information having a first value (e.g., "1") can indicate that the current coding unit is partitioned according to a quadtree partition structure. The quad-partition information having a second value (e.g., "0") can indicate that the current coding unit is not partitioned according to a quadtree partition structure. The quad-partition information can be a flag having a predetermined length (e.g., one bit).

[0153] There can be no priority between binary tree partitioning and ternary tree partitioning. That is, a coding unit corresponding to a leaf node of a quadtree can be further partitioned by either of binary tree partitioning and ternary tree partitioning. Further, a coding unit generated by binary tree partitioning or ternary tree partitioning can be further partitioned by either of binary tree partitioning or ternary tree partitioning, or can not be further partitioned.

[0154] A tree structure in which there is no priority between binary tree partitioning and ternary tree partitioning is referred to as a multi-type tree structure. A coding unit corresponding to a leaf node of a quadtree can serve as a root node of a multi-type tree. Whether a coding unit corresponding to a node of a multi-type tree is partitioned can be signaled using at least one of multi-type tree partitioning indication information, partition direction information, and partition tree information. In order to partition a coding unit corresponding to a node of a multi-type tree, the multi-type tree partitioning indication information, the partition direction, and the partition tree information can be sequentially signaled.

[0155] The multi-type tree partitioning indication information having a first value (e.g., "1") can indicate that the current coding unit is to be partitioned by a multi-type tree partition. The multi-type tree partitioning indication information having a second value (e.g., "0") can indicate that the current coding unit is not to be partitioned by a multi-type tree partition.

[0156] When a coding unit corresponding to a node of a multi-type tree is partitioned according to a multi-type tree partition structure, the coding unit can further include partition direction information. The partition direction information can indicate in which direction the current coding unit is to be partitioned according to a multi-type tree partition. The partition direction information having a first value (e.g., "1") can indicate that the current coding unit is to be vertically partitioned. The partition direction information having a second value (e.g., "0") can indicate that the current coding unit is to be horizontally partitioned.

[0157] When a coding unit corresponding to a node of a multi-type tree is partitioned according to a multi-type tree partition structure, the current coding unit can further include partition tree information. The partition tree information can indicate a tree partition structure to be used for partitioning a node of a multi-type tree. The partition tree information having a first value (e.g., "1") can indicate that the current coding unit is to be partitioned according to a binary tree partition structure. The partition tree information having a second value (e.g., "0") can indicate that the current coding unit is to be partitioned according to a ternary tree partition structure.

[0158] The partition indication information, the partition tree information, and the partition direction information can each be a flag having a predetermined length (e.g., one bit).

[0159] At least any one of the quad-tree partition indication information, the multi-type tree partition indication information, the partition direction information, and the partition tree information can be entropy coded / entropy decoded. In order to entropy code / entropy decode those types of information, information about neighboring coding units adjacent to the current coding unit can be used. For example, it is highly likely that the partition type (partitioned or not partitioned, partition tree, and / or partition direction) of a left neighboring coding unit and / or an above neighboring coding unit of the current coding unit is similar to the partition type of the current coding unit. Thus, context information for entropy coding / entropy decoding information about the current coding unit can be derived from information about the neighboring coding units. The information about the neighboring coding units can include at least any one of the quad-tree partition information, the multi-type tree partition indication information, the partition direction information, and the partition tree information.

[0160] As another example, in the binary tree partition and the ternary tree partition, the binary tree partition can be preferentially performed. That is, the current coding unit can be first subjected to the binary tree partition, and then coding units corresponding to leaf nodes of the binary tree can be set as root nodes for the ternary tree partition. In this case, for coding units corresponding to nodes of the ternary tree, neither the quad-tree partition nor the binary tree partition can be performed.

[0161] A coding unit that cannot be partitioned in accordance with the quad-tree partition structure, the binary tree partition structure, and / or the ternary tree partition structure becomes a basic unit for encoding, prediction, and / or transform. That is, the coding unit cannot be further partitioned for prediction and / or transform. Thus, in a bitstream, there can be no partition structure information and partition information for partitioning a coding unit into prediction units and / or transform units.

[0162] However, when the size of a coding unit (i.e., a basic unit for partitioning) is larger than the size of the maximum transform block, the coding unit can be recursively partitioned until the size of the coding unit is reduced to be equal to or smaller than the size of the maximum transform block. For example, when the size of the coding unit is 64x64 and when the size of the maximum transform block is 32x32, the coding unit can be partitioned into four 32x32 blocks for transform. For example, when the size of the coding unit is 32x64 and the size of the maximum transform block is 32x32, the coding unit can be partitioned into two 32x32 blocks for transform. In this case, the partitioning of the coding unit for transform is not signaled separately and can be determined by a comparison between the horizontal size or the vertical size of the coding unit and the horizontal size or the vertical size of the maximum transform block. For example, when the horizontal size (width) of the coding unit is larger than the horizontal size (width) of the maximum transform block, the coding unit can be vertically bisected. For example, when the vertical size (length) of the coding unit is larger than the vertical size (length) of the maximum transform block, the coding unit can be horizontally bisected.

[0163] Information of the maximum size and / or the minimum size of the coding unit and information of the maximum size and / or the minimum size of the transform block can be signaled or determined at a higher level of the coding unit. The higher level can be, for example, a sequence level, a picture level, a slice level, etc. For example, the minimum size of the coding unit can be determined to be 4x4. For example, the maximum size of the transform block can be determined to be 64x64. For example, the minimum size of the transform block can be determined to be 4x4.

[0164] Information of the minimum size of the coding unit corresponding to a leaf node of a quadtree (quadtree minimum size) and / or information of the maximum depth of a multi-type tree from a root node to a leaf node (maximum tree depth of the multi-type tree) can be signaled or determined at a higher level of the coding unit. For example, the higher level can be a sequence level, a picture level, a slice level, etc. The information of the minimum size of the quadtree and / or the information of the maximum depth of the multi-type tree can be signaled or determined for each of an intra slice and an inter slice.

[0165] The difference information between the size of the CTU and the maximum size of the transform block can be signaled or determined at a higher level of the coding unit. For example, the higher level can be a sequence level, a picture level, a slice level, and the like. Information of the maximum size of the coding unit corresponding to each node of the binary tree (hereinafter, referred to as the maximum size of the binary tree) can be determined based on the size of the coding tree unit and the difference information. The maximum size of the coding unit corresponding to each node of the ternary tree (hereinafter, referred to as the maximum size of the ternary tree) can vary depending on the type of the slice. For example, the maximum size of the ternary tree can be 32x32 for an intra slice. For example, the maximum size of the ternary tree can be 128x128 for an inter slice. For example, the minimum size of the coding unit corresponding to each node of the binary tree (hereinafter, referred to as the minimum size of the binary tree) and / or the minimum size of the coding unit corresponding to each node of the ternary tree (hereinafter, referred to as the minimum size of the ternary tree) can be set to the minimum size of the coding block.

[0166] As another example, the maximum size of the binary tree and / or the maximum size of the ternary tree can be signaled or determined at a slice level. Alternatively, the minimum size of the binary tree and / or the minimum size of the ternary tree can be signaled or determined at a slice level.

[0167] According to the size information and the depth information of the various blocks described above, the quad-tree information, the multi-type tree partitioning indication information, the partition tree information, and / or the partition direction information can or can not be included in the bitstream.

[0168] For example, when the size of the coding unit is not greater than the minimum size of the quad-tree, the coding unit does not include the quad-tree information. Accordingly, the quad-tree information can be derived from the second value.

[0169] For example, when the size (horizontal size and vertical size) of the coding unit corresponding to the node of the multi-type tree is greater than the maximum size (horizontal size and vertical size) of the binary tree and / or the maximum size (horizontal size and vertical size) of the ternary tree, the coding unit can not be partitioned by the binary tree or the ternary tree. Accordingly, the multi-type tree partitioning indication information can not be signaled, but can be derived from the second value.

[0170] Optionally, the coding unit can not be further binarily or ternarily tree partitioned when the size (horizontal and vertical size) of the coding unit corresponding to the node of the multi-type tree is the same as the maximum size (horizontal and vertical size) of the binary tree and / or twice as large as the maximum size (horizontal and vertical size) of the ternary tree. Thus, the multi-type tree partitioning indication information can not be signaled but can be derived from the second value. This is because, when the coding unit is partitioned according to the binary and / or ternary tree partitioning structure, a coding unit smaller than the minimum size of the binary tree and / or the minimum size of the ternary tree is generated.

[0171] Optionally, the coding unit can not be further binarily and / or ternarily tree partitioned when the depth of the coding unit corresponding to the node of the multi-type tree is equal to the maximum depth of the multi-type tree. Thus, the multi-type tree partitioning indication information can not be signaled but can be derived from the second value.

[0172] Optionally, the multi-type tree partitioning indication information can only be signaled when at least one of the vertical binary tree partitioning, the horizontal binary tree partitioning, the vertical ternary tree partitioning and the horizontal ternary tree partitioning is feasible for the coding unit corresponding to the node of the multi-type tree. Otherwise, the coding unit can not be binarily and / or ternarily tree partitioned. Thus, the multi-type tree partitioning indication information can not be signaled but can be derived from the second value.

[0173] Optionally, the partitioning direction information can only be signaled when both the vertical binary tree partitioning and the horizontal binary tree partitioning or both the vertical ternary tree partitioning and the horizontal ternary tree partitioning are feasible for the coding tree corresponding to the node of the multi-type tree. Otherwise, the partitioning direction information can not be signaled but can be derived from the value indicating the possible partitioning directions.

[0174] Optionally, the partitioning tree information can only be signaled when both the vertical binary tree partitioning and the vertical ternary tree partitioning or both the horizontal binary tree partitioning and the horizontal ternary tree partitioning are feasible for the coding tree corresponding to the node of the multi-type tree. Otherwise, the partitioning tree information can not be signaled but can be derived from the value indicating the possible partitioning tree structures.

[0175] Figure 4 is a diagram illustrating an intra prediction process.

[0176] Figure 4 The arrows from the center to the outside in the diagram of

[0177] Intra coding and / or decoding can be performed by using reference samples of neighboring blocks of a current block. The neighboring blocks can be reconstructed neighboring blocks. For example, the intra coding and / or decoding can be performed by using values or coding parameters of the reference samples included in the reconstructed neighboring blocks.

[0178] A prediction block can refer to a block generated by performing intra prediction. The prediction block can correspond to at least one of a CU, a PU, and a TU. A unit of the prediction block can have a size of one of the CU, the PU, and the TU. The prediction block can be a square block having a size of 2x2, 4x4, 16x16, 32x32, or 64x64, etc., or can be a rectangular block having a size of 2x8, 4x8, 2x16, 4x16, and 8x16, etc.

[0179] Intra prediction can be performed according to an intra prediction mode for a current block. The number of the intra prediction modes that the current block can have can be a fixed value, and can be a value that is differently determined according to properties of the prediction block. For example, the properties of the prediction block can include a size of the prediction block and a shape of the prediction block, etc.

[0180] Regardless of a block size, the number of the intra prediction modes can be fixed to N. Alternatively, the number of the intra prediction modes can be 3, 5, 9, 17, 34, 35, 36, 65, or 67, etc. Alternatively, the number of the intra prediction modes can vary according to a block size or a color component type or both the block size and the color component type. For example, the number of the intra prediction modes can vary according to whether a color component is a luma signal or a chroma signal. For example, as a block size becomes larger, the number of the intra prediction modes can increase. Alternatively, the number of the intra prediction modes for a luma component block can be greater than the number of the intra prediction modes for a chroma component block.

[0181] The intra prediction mode can be a non-angular mode or an angular mode. The non-angular mode can be a DC mode or a planar mode, and the angular mode can be a prediction mode having a specific direction or angle. The intra prediction mode can be represented by at least one of a mode number, a mode value, a mode number, a mode angle, and a mode direction. The number of the intra prediction modes can be M equal to or greater than 1, including the non-angular and angular modes.

[0182] In order to perform intra prediction on a current block, a step of determining whether or not a sample included in a reconstructed neighboring block can be used as a reference sample of the current block can be performed. When there is a sample that cannot be used as the reference sample of the current block, a value obtained by copying or performing interpolation on at least one of sample values included in the reconstructed neighboring block or both copying and interpolation can be used to replace an unavailable sample value of the sample, and thus the replaced sample value is used as the reference sample of the current block.

[0183] When intra prediction is performed, a filter can be applied to at least one of a reference sample and a prediction sample based on an intra prediction mode and a current block size / shape.

[0184] In the case of the planar mode, when a prediction block of the current block is generated, depending on a position of a prediction target sample within the prediction block, a sample value of the prediction target sample can be generated by using a weighted sum of an upper reference sample and a left reference sample of the current sample and an upper right reference sample and a lower left reference sample of the current block. Further, in the case of the DC mode, when the prediction block of the current block is generated, an average of an upper reference sample and a left reference sample of the current block can be used. Further, in the case of the angular mode, the prediction block can be generated by using an upper reference sample, a left reference sample, an upper right reference sample, and / or a lower left reference sample of the current block. To generate a prediction sample value, interpolation of a real unit can be performed.

[0185] An intra prediction mode of a current block can be entropy encoded / decoded by predicting an intra prediction mode of a block that exists adjacent to the current block. When the intra prediction modes of the current block and the adjacent block are the same, information that the intra prediction modes of the current block and the adjacent block are the same can be signaled by using predetermined flag information. Further, indicator information of the intra prediction mode that is the same as the intra prediction mode of the current block among the intra prediction modes of the plurality of adjacent blocks can be signaled. When the intra prediction modes of the current block and the adjacent block are different, the intra prediction mode information of the current block can be entropy encoded / decoded by performing entropy encoding / decoding based on the intra prediction modes of the adjacent blocks.

[0186] Figure 5 is a diagram illustrating intra prediction according to the present application.

[0187] The intra prediction of the current block can include a step S510 of deriving an intra prediction mode, a step S520 of configuring a reference sample, and / or a step S530 of performing intra prediction.

[0188] In step S510, the intra prediction mode of the current block can be derived. The intra prediction mode of the current block can be derived by using a method of using an intra prediction mode of an adjacent block, a method of entropy encoding / decoding the intra prediction mode of the current block from a bitstream, a method of using an encoding parameter of the adjacent block, and / or a method of using an intra prediction mode of a color component. According to the method of using the intra prediction mode of the adjacent block, the intra prediction mode of the current block can be derived by using at least one of an intra prediction mode derived by using the intra prediction mode of the adjacent block, a combination of at least one intra prediction mode of the adjacent block, and at least one MPM.

[0189] At step S520, the reference samples can be configured by performing at least one of reference sample selection, reference sample padding, and reference sample filtering.

[0190] At step S530, the intra prediction can be performed by performing at least one of non-angular prediction, angular prediction, prediction based on position information, inter-color component prediction, and representative sample based intra prediction. When the representative sample based intra prediction is performed, the intra prediction can be performed based on at least one representative sample within the block. The representative sample based prediction can perform at least one of partitioning of the block, determination of the representative sample, prediction / transform / quantization of the representative sample, and representative sample based intra prediction. At step S530, filtering of the predicted samples can be additionally performed.

[0191] To derive the intra prediction mode of the current block, at least one reconstructed neighboring block can be used. The position of the reconstructed neighboring block can be a predetermined fixed position, or can be a position derived by encoding / decoding. Hereinafter, encoding / decoding can denote entropy encoding and entropy decoding. For example, when the coordinates of the top-left sample of the current block having a size of WxH is (0, 0), the neighboring block can be at least one of blocks adjacent to the coordinates (-1, H-1), (W-1, -1), (W, -1), (-1, H), and (-1, -1) and neighboring blocks of the above blocks. Here, W and H can represent the length or the number of samples of the width (W) and the height (H) of the current block.

[0192] The intra prediction mode of the unavailable neighboring block can be replaced with a predetermined intra prediction mode. The predetermined intra prediction mode can be, for example, a DC mode, a planar mode, a vertical mode, a horizontal mode, and / or a diagonal mode. For example, when the neighboring block is located outside the boundary of at least one predetermined unit of a picture, a slice, a parallel block, and a coding tree unit, the neighboring block is inter predicted, or when the neighboring block is encoded in a PCM mode, the corresponding block can be determined to be unavailable. Alternatively, when the neighboring block is unavailable, the intra prediction mode of the corresponding block is not replaced and is not used.

[0193] The intra prediction mode of the current block can be derived as the intra prediction mode of the neighboring block at a predetermined position or a statistical value of the intra prediction modes of at least two neighboring blocks. In the present specification, the statistical value can denote at least one of an average value, a maximum value, a minimum value, a mode, a median value, a weighted average value, and an interpolation.

[0194] Alternatively, the intra prediction mode of the current block can be derived based on the size of the neighboring blocks. For example, the intra prediction mode of the neighboring block having a relatively large size can be derived as the intra prediction mode of the current block. Alternatively, the statistical value can be calculated by assigning a large weight to the intra prediction mode of the block having a relatively large size. Alternatively, the mode to which a relatively large weight is assigned can be predefined or signaled. For example, a relatively large weight can be assigned to at least one of a vertical direction mode, a horizontal direction mode, a diagonal direction mode, and a non-direction mode. The same weight can be assigned to the above-described modes.

[0195] Alternatively, whether the intra prediction mode of the neighboring block is an angular mode can be considered. For example, when the intra prediction mode of the neighboring block is a non-angular mode, the non-angular mode can be derived as the intra prediction mode of the current block. Alternatively, the intra prediction mode of the neighboring block other than the non-angular mode can be derived as the intra prediction mode of the current block.

[0196] To derive the intra prediction mode of the current block, one or more most probable mode (MPM) lists can be configured by using the intra prediction modes of the neighboring blocks. The number N of candidate modes included in the MPM list can be fixed, or can be determined according to the size or shape or both of the current block. The MPM list can be configured not to include an overlapping mode. When the number of available candidate modes is less than N, a predetermined candidate mode (e.g., a mode obtained by adding or subtracting a predetermined offset to / from an angular mode) among the available candidate modes can be added to the one or more MPM lists. Alternatively, at least one of a horizontal mode, a vertical mode, a 45-degree angular mode, a 135-degree angular mode, a 225-degree angular mode, and a non-angular mode can be added to the MPM list. The predetermined offset can be 1, 2, 3, 4, or a positive integer. An MPM flag indicating whether a mode matching the intra prediction mode of the current block exists within the MPM list can be signaled. When the value of the MPM flag is 1, MPM index information mpm_idx indicating the matching mode within the MPM list can be signaled. On the other hand, when the value of the MPM flag is 0, remaining mode information rem_intra_luma_pred_mode for informing the intra prediction mode of the current block can be signaled. When performing prediction based on multiple reference sample lines, or when performing a weighted sum operation of calculating a weighted sum of an intra prediction value and an inter prediction value, one or both of the MPM index information and the remaining mode information can not be signaled. For example, when multiple sample lines are used (i.e., mrl_index is a value other than 0), the MPM flag or the remaining mode information can not be signaled. For example, when the weighted sum operation of the intra prediction value and the inter prediction value is performed, the remaining mode information can not be signaled.

[0197] The MPM list can be configured in a predetermined order based on the positions of the neighboring blocks. For example, the predetermined order can be the order of the blocks adjacent to the left side, the upper side, the lower left corner side, the upper right corner side, and the upper left corner side of the current block. The non-angular mode can be included in any position in the MPM list. For example, the non-angular mode can be added next to the intra prediction modes of the blocks adjacent to the left side and the upper side.

[0198] The MPM list generated based on the current block can be used as the MPM list for at least one sub-block included in the current block. The order between the candidate modes configuring the MPM list, the number of the candidate modes included in the MPM list, etc. can be determined based on the size, shape, and / or component of the current block.

[0199] Alternatively, a mode group can be configured by selecting a part of the modes among the modes not included in the MPM list. The configured mode group can be used as another list. For example, the mode group can be configured using the modes obtained by sampling at a predetermined interval after the modes not being MPM candidates or using the modes obtained by adding n (n is an integer equal to or greater than 1) to the MPM candidate modes or subtracting n from the MPM candidate modes.

[0200] When constructing the MPM list, the MPM list can be constructed differently depending on at least one element selected from a slice type, a coding mode, and a multiple reference line. That is, the MPM list can be constructed while changing at least one element selected from a number of MPMs, an order in which MPMs are derived, MPM candidate modes, and a default mode. For example, an MPM list for an I slice and an MPM list for a P slice or a B slice are constructed differently. For example, the MPM list for the I slice is constructed by deriving six MPM candidate modes, and the MPM list for the P slice or the B slice is constructed by deriving three MPM candidate modes. For example, an MPM list for a case where a coding mode of a current block is an intra mode and an MPM list for a case where the coding mode of the current block is an inter mode are constructed differently. The inter mode can include a mode in which prediction is performed using a weighted sum of an inter prediction value and an intra prediction value. An intra prediction mode for performing intra prediction in a process of performing prediction using the inter mode can be derived, and the derived mode can be used to construct the MPM list. In this case, the MPM candidate mode is limited to a small number of candidate modes. The MPM candidate mode includes at least one of, for example, a DC mode, a planar mode, a horizontal mode, and a vertical mode. For example, in a case where a multiple reference line (i.e., mrl_index has a value other than 0) is utilized, the MPM list can be constructed differently. That is, the MPM candidate mode includes an intra prediction mode that allows prediction based on the multiple reference line. When a non-directional mode such as the DC mode and the planar mode does not allow prediction based on the multiple reference line, the non-directional mode is not considered as the MPM candidate. In other words, the MPM list can be constructed only by using one or more directional modes.

[0201] According to another embodiment related to a method of deriving an intra prediction mode according to the present application, an intra prediction mode of a current block can be derived by using an intra prediction mode of a different color component. For example, when the current block is a chroma block, an intra prediction mode of a luma block corresponding to the chroma block can be used to derive an intra prediction mode of the chroma block. As the luma block corresponding to the chroma block, there can be one or more luma blocks. The corresponding luma block can be determined depending on at least any one of a size, a shape, and a coding parameter of the chroma block. Alternatively, the corresponding luma block can be determined depending on at least any one of a size, a shape, and a coding parameter of the luma block.

[0202] A luma block corresponding to a chroma block can be composed of a plurality of partitions. All or a part of the plurality of partitions can have different intra prediction modes. An intra prediction mode of the chroma block can be derived based on all or a part of the plurality of partitions included in the corresponding luma block. In this case, some partitions can be selectively used, in which the used partitions are selected based on a comparison of block sizes, shapes, depth information, etc. of the luma block (all or a part of the plurality of partitions) with those of the chroma block. A partition at a position of the luma block corresponding to a predetermined position in the chroma block can be selectively used. The predetermined position can refer to a corner sample (e.g., top-left sample) position in the chroma block or a center sample position in the chroma block.

[0203] The method of deriving an intra prediction mode of a color component block according to the intra prediction mode of a different color component block (i.e., inter-color component intra prediction mode) according to the present application is not limited to the example of using the intra prediction mode of a luma block corresponding to a chroma block. For example, the intra prediction mode of the chroma block can be derived by using or sharing at least any one of the MPM list and the MPM index mpm_idx of the luma block corresponding to the chroma block.

[0204] Figure 6 is an exemplary diagram illustrating a relationship between a luma block and a chroma block.

[0205] In Figure 6 In the illustrated example, a sample ratio of color components is 4:2:0, and at least one of luma blocks A, B, C, and D corresponds to one chroma block.

[0206] Referring to Figure 6 The intra prediction mode of one chroma block can be derived by using the intra prediction mode of the luma block A corresponding to a sample at a top-left position (0, 0) in the chroma block or the intra prediction mode of the luma block D corresponding to a sample at a center position (ns / 2, ns / 2) in the chroma block. The predetermined position in the chroma block is not limited to the top-left position (0, 0) or the center position (nS / 2, nS / 2). For example, the predetermined position can be a top-right position, a bottom-left position, and / or a bottom-right position. The center position of the chroma block can be (W / 2, H / 2), where W is a block width and H is a block height.

[0207] The predetermined position can be selected based on a shape of the chroma block. For example, for a chroma block having a square shape, the predetermined position can be a center sample position. For a chroma block having a rectangular shape, the predetermined position can be a top-left sample position. Alternatively, the predetermined position can be a position of a top-left sample in the chroma block having a square shape or a position of a center sample in the chroma block having a rectangular shape.

[0208] According to another embodiment, the intra prediction mode of the chroma block can be derived by using statistics of one or more intra prediction modes of the luma block having the same size as the chroma block.

[0209] In Figure 6 In the illustrated example, a mode corresponding to the average of the intra prediction modes of the luma blocks A and D or a mode corresponding to the average of the intra prediction modes of the blocks A, B, C and D within the luma block corresponding to the size of the chroma block is derived as the intra prediction mode of the chroma block.

[0210] When there are multiple intra prediction modes of the available luma block, all or a part of the multiple intra prediction modes can be selected. The selection is performed based on a predetermined position in the chroma block or based on the size, shape and / or depth of the chroma block, the luma block or both the chroma block and the luma block. The intra prediction mode of the chroma block can be derived by using the intra prediction modes of the selected luma block.

[0211] For example, the size of the luma block A corresponding to the top-left sample position (0, 0) in the chroma block and the size of the luma block D corresponding to the center sample position (nS / 2, nS / 2) in the chroma block are compared, and the intra prediction mode of the chroma block can be derived using the intra prediction mode of the luma block D having the larger size.

[0212] Alternatively, when the size of the luma block corresponding to a predetermined position in the chroma block is equal to or larger than the size of the chroma block, the intra prediction mode of the chroma block is derived by using the intra prediction mode of the luma block.

[0213] Alternatively, when the size of the chroma block is within a predetermined range, the intra prediction mode of the chroma block is derived by using the intra prediction mode of the luma block corresponding to the top-left sample position (0, 0) in the chroma block.

[0214] Alternatively, when the size of the chroma block is within a predetermined range, the size of the luma block corresponding to a predetermined position (0, 0) of the chroma block and the size of the luma block arranged at another predetermined position (nS / 2, nS / 2) of the chroma block are compared, and the intra prediction mode of the chroma block is derived by using the intra prediction mode of the luma block having the larger size.

[0215] The predetermined range can be derived from at least any one of information signaled through a bitstream, information of the size (and / or depth) of the block (the chroma block, the luma block or both the chroma block and the luma block) and information predefined in the encoder or the decoder.

[0216] Alternatively, when the chroma block has a rectangular shape, the intra prediction mode of the chroma block can be derived by using the intra prediction mode of the luma block corresponding to the center sample position (ns / 2, ns / 2) in the chroma block.

[0217] Among the plurality of partitions of the luma block, a partition having the same shape as the chroma block can be used. For example, when the chroma block has a square shape or a non-square shape, a partition having a square shape or a non-square shape selected among the plurality of partitions of the luma block can be used.

[0218] In the description below, the method of deriving the intra prediction mode of the chroma block using the intra prediction mode of the luma block is also applicable to a case where the intra prediction mode of the luma block is used as it is as the intra prediction mode of the chroma block. The method of deriving the intra prediction mode of the chroma block is not limited to the method of using the intra prediction mode of the corresponding luma block. For example, the intra prediction mode of the chroma block can be derived from the information for deriving the intra prediction mode of the luma block including the MPM list and the MPM index mpm_idx. Figure 6

[0219] Alternatively, the MPM list of the chroma block can be constructed using the intra prediction mode of the luma block corresponding to the sample of a predetermined position in the chroma block. In this case, the mpm_idx information of the chroma block can be encoded and signaled. The MPM list of the chroma block can be constructed in a similar manner to constructing the MPM list of the luma block. The MPM candidates of the chroma block can include the intra prediction mode of the neighboring chroma block and / or the intra prediction mode of the luma block corresponding to the chroma block.

[0220] When the MPM flag is 0, a second MPM list including at least one intra prediction mode can be configured, and the intra prediction mode of the current block can be derived by using a second MPM index (2nd_mpm_idx). Here, a second indicator (e.g., a second MPM flag) indicating whether the intra prediction mode of the current block is included in the second MPM list can be encoded / decoded. Similar to the first MPM list, the second MPM list can be configured by using the intra prediction mode of the neighboring block. Here, the intra prediction mode included in the first MPM list can not be included in the second MPM list. The number of MPM lists is not limited to 1 or 2, and N MPM lists can be used.

[0221] When the intra prediction mode of the current block is not included in one of the plurality of MPM lists, the luma component intra prediction mode of the current block can be encoded / decoded. In addition, the chroma component intra prediction mode can be derived based on the associated luma component intra prediction mode and be encoded / decoded.

[0222] ​When the current block is partitioned into sub-blocks, at least one of the described methods can be applied to derive an intra prediction mode for each sub-block.

[0223] The size or shape or both of the sub-blocks can be predetermined or both (e.g., 4x4), or can be determined according to the size or shape or both of the current block. Alternatively, the size of the sub-blocks can be determined based on whether neighboring blocks of the current block are partitioned, or the size of the sub-blocks can be determined based on the intra prediction modes of the neighboring blocks of the current block. For example, the current block can be partitioned based on boundaries where the intra prediction modes of the neighboring blocks are different. Alternatively, the current block can be partitioned based on whether the neighboring blocks are intra coded blocks or inter coded blocks.

[0224] An indicator (e.g., NDIP_flag) indicating that the intra prediction mode of the current block is derived by using the intra prediction modes of the neighboring blocks can be encoded / decoded. The indicator can be encoded / decoded per at least one unit of the current block and the sub-blocks. Here, when the size of the current block or the sub-blocks corresponds to a predetermined size or a predetermined size range, the indicator can be encoded / decoded.

[0225] The operation of determining whether the size of the current block corresponds to a predetermined size can be performed based on the horizontal length or the vertical length of the current block. For example, when the horizontal length or the vertical length is a length that can be partitioned, it is determined that the size of the current block corresponds to the predetermined size.

[0226] The intra prediction information can be signaled through at least one of a video parameter set (VPS), a sequence parameter set (SPS), a picture parameter set (PPS), an adaptation parameter set (APS), a slice header, and a parallel block header. At least one of the intra prediction information can not be signaled in case of a predetermined block size or smaller. Here, the intra prediction information of a previously encoded / decoded block (e.g., an upper layer block) can be used.

[0227] The reference samples for intra prediction can be configured based on the derived intra prediction mode. In the following description, the current block can represent a prediction block or a sub-block having a size / shape smaller than that of the prediction block. The reference samples can be configured by using at least one of the reconstructed samples neighboring the current block or by using a combination of the samples. In addition, filtering can be applied to the configured reference samples.

[0228] The number or the position or both of the reconstructed sample lines for configuring the reference samples can vary according to the position of the current block within the coding tree block. Each reconstructed sample on the multiple reconstructed sample lines can be used as the reference sample as it is. Alternatively, a predetermined filter can be applied to the reconstructed sample, and the reference sample can be generated by using the filtered reconstructed sample. The reconstructed sample to which the filter is applied can be included in the same reconstructed sample line or in a different reconstructed sample line.

[0229] An indicator indicating whether the multiple reference sample lines are used for prediction can be signaled. For example, an indicator such as mrl_enabled_flag can be included in at least one of the SPS, the PPS, and the slice header so as to be signaled. The flag can be an indicator indicating whether a single reference sample line or multiple reference sample lines are used.

[0230] When the indicator indicates that the multiple reference sample lines are used, a reference sample line index is also signaled. For example, mrl_index is signaled. Accordingly, which reference sample lines are used can be determined.

[0231] When the value of the indicator mrl_index is 0, a first reference sample line closest to the current block is utilized. On the other hand, when the value of the indicator mrl_index is 1, a second reference sample line second closest to the current block is utilized. When the value of the indicator mrl_index is 2, a third reference sample line third closest to the current block is used. The first reference sample line to the fourth reference sample line correspond to the reconstructed sample line 1 to the reconstructed sample line 4, respectively. Figure 7

[0232] The indicator mrl_index is signaled depending on at least one of an intra prediction mode of the current block, MPM information, a size (width and height), presence or absence of an upper boundary of a CTU, and a color component. When the indicator mrl_index is not signaled, a first reference sample line adjacent to the current block is used.

[0233] For example, the indicator mrl_index can be signaled when the intra prediction mode is a predetermined mode. The intra prediction mode can be at least one of the intra prediction modes of the respective neighboring blocks or the intra prediction mode of the current block. The predetermined mode is at least one of a non-directional prediction mode, a directional prediction mode, a vertical or horizontal mode, an even mode, and an odd mode. For example, the indicator mrl_index can be signaled when the intra prediction mode of the neighboring block adjacent to the left boundary or the upper boundary of the current block is one of the directional modes. Alternatively, the indicator mrl_index can be signaled when the intra prediction mode of the neighboring block is one of the even modes or one of the odd modes.

[0234] ​For example, the indicator mrl_index can be signaled based on MPM information of the current block. The MPM information includes at least one of MPM flags, MPM indices, MPM lists, and MPM candidates. For example, the indicator mrl_index can be signaled when MPM flags for the intra prediction mode of the current block indicate a match. Alternatively, the indicator mrl_index can be signaled when there is any one directional prediction mode within the MPM candidate list or only directional prediction modes within the MPM candidate list. Alternatively, the indicator mrl_index can be signaled when there is any one non-directional prediction mode within the MPM candidate list. Alternatively, the MPM information of the current block can be signaled differently depending on the indicator mrl_index. For example, at least one piece of MPM information can not be signaled when the indicator mrl_index has a non-zero value. For example, MPM flags or remaining mode information can not be signaled when the indicator mrl_index has a non-zero value. On the other hand, MPM indices can be signaled and used to derive the intra prediction mode of the current block when the indicator mrl_index has a non-zero value. For example, the MPM mode can be determined without parsing the MPM flags when the indicator mrl_index has a non-zero value.

[0235] For example, the indicator mrl_index can be signaled when the size (width or height) of the current block is within a predetermined size range. For example, the indicator mrl_index can be signaled when the size (width or height) is greater than a predetermined size (e.g., 4).

[0236] For example, the indicator mrl_index can be signaled depending on whether the current block is located at the upper boundary of the CTU. For example, the indicator mrl_index can not be signaled when the current block is located at the upper boundary of the CTU.

[0237] For example, the indicator mrl_index can be signaled when the color component of the current block is a luma signal and can not be signaled when the color component is a chroma signal.

[0238] Alternatively, the indicator mrl_index indicates a reference sample line to be optionally used. For example, a first reference sample line adjacent to the current block can always be used and a reference sample line indicated by the indicator mrl_index can be optionally used.

[0239] When multiple reference sample lines are used, it is determined whether to apply filtering for each reference sample line. For example, based on the intra prediction mode and the block size / shape, filtering can be applied to a first reference sample line neighboring the current block, while filtering can not be applied to a second reference sample line and subsequent reference sample lines surrounding the current block. Alternatively, filtering can be applied to only one reference sample line. For example, filtering can be applied to only a left reference sample line or an above reference sample line. Which reference sample line to filter can be determined according to at least one of the shape, size, and intra prediction mode of the current block. The shape of the current block can be determined according to a size comparison between the width and height of the current block or a ratio of the width and height.

[0240] The configured reference sample can be denoted as ref[m, n], and a sample obtained by applying a filter to the configured reference sample can be denoted as rec[m, n]. Here, m or n can be a predetermined integer value representing a sample position. When the position of a top-left sample within the current block is (0, 0), the position of a top-left reference sample of the current block can be set to (-1, -1).

[0241] Figure 7 is a diagram for describing multiple reconstructed sample lines.

[0242] The reference sample can be constructed by selecting one or more reconstructed sample lines neighboring the current block. For example, in Figure 7 , one of the multiple reconstructed sample lines can be selected to construct the reference sample.

[0243] A particular reconstructed sample line of the multiple reconstructed sample lines can be fixedly or adaptively selected, or any one of the reconstructed sample lines can be adaptively selected, in order to construct the reconstructed sample.

[0244] In another embodiment, in order to construct the reference sample, one or more reconstructed sample lines can be selected from the multiple reconstructed sample lines as shown in Figure 7 , and the selected reconstructed sample lines can be combined.

[0245] For example, as shown in Equation 1, the reference sample can be constructed using a weighted average of the reconstructed samples, where the weights of the reconstructed samples differ according to the distance between the reconstructed samples and the current block.

[0246] [Equation 1]

[0247] ref[-1,-1] = (rec[-2,-1] + 2 x rec[-1,-1] + rec[-1,-2] + 2) » 2

[0248] ref[x,-1] = (rec[x,-2] + 3 x rec[x,-1] + 2) » 2, (x = 0 to W+H-1)

[0249] ref[-1,y] = (rec[-2,y] + 3 x rec[-1,y] + 2) » 2, (y = 0 to W+H-1)

[0250] Optionally, the reference sample can be constructed using at least one of an average value, a maximum value, a minimum value, a median value, and a mode value of the plurality of reconstructed samples based on at least one of a distance of the current block from the corresponding reconstructed sample and an intra prediction mode of the current block.

[0251] Optionally, the reference sample can be constructed based on a change (a change amount) between each of the sample values of the consecutive reconstructed samples. For example, the reference sample can be constructed based on at least one of a determination of whether a difference between values of two consecutive reconstructed samples is greater than a threshold value and a determination of whether the values of the consecutive reconstructed samples are continuously changed or discontinuously changed. For example, when the value of rec[-1,-1] differs from the value of rec[-2,-1] by more than a threshold value, the value of ref[-1,-1] can be determined to have the value of rec[-1,-1] or a value corresponding to a weighted average value obtained by applying a predetermined weight to the value of rec[-1,-1]. For example, as the distance between the reconstructed sample and the current block decreases, each of the values of the consecutive reconstructed samples changes by n, and thus the value of ref[-1,-1] can be expressed as "ref[-1,-1] = rec[-1,-1] - n".

[0252] In different embodiments, with reference to Figure 7 Two or more reconstructed sample lines can be selected to construct the reference sample. For example, two lines including reconstructed sample line 1 and reconstructed sample line 2 can be fixedly selected, or four lines from reconstructed sample line 1 to reconstructed sample line 4 can be selected to construct the reference sample.

[0253] Optionally, two or more reconstructed sample lines can be adaptively selected to construct the reference sample. For example, one reconstructed sample line can be fixedly selected, and one or more reconstructed sample lines can be adaptively selected from among the other reconstructed sample lines to construct the reference sample.

[0254] The fixedly selected reconstructed sample line can be predefined in the encoder / decoder. For the case where the fixedly selected reconstructed sample line is predefined, information about the fixedly selected reconstructed sample line can not be signaled.

[0255] The information about the adaptively selected reconstructed sample line can be signaled in the form of an indicator or an index. The adaptively selected reconstructed sample line can be determined based on at least one of coding parameters of the current block or a block neighboring the current block. For example, the adaptively selected reconstructed sample line can be determined based on at least one of a size / shape of the current block or the block neighboring the current block and an intra prediction mode of the current block or the block neighboring the current block. In this case, the information required for the selection can not be signaled.

[0256] The reference sample line can include one or more samples. For example, the reference sample line can include samples corresponding to a length equal to a width (i.e., a horizontal dimension) or a height (i.e., a vertical dimension) of the current block. As another example, the reference sample line can include samples corresponding to a length twice as long as the width or the height of the current block. As another example, the reference sample line can include samples corresponding to a length equal to a sum of N samples (N is 1, 2, 3,...) twice as much as a sum of the width and the height of the current block. That is, the reference sample line can include reference samples corresponding to 2×(W+H)+N (where W and H are the width and the height of the current block, and N is an integer of 1 or more).

[0257] The method of constructing the reference samples neighboring the upper portion of the current block and the method of constructing the reference samples neighboring the left portion of the current block can be different. For example, the number of the reference sample lines located above the current block and the number of the reference sample lines located to the left of the current block can be different. For example, according to at least one of an intra prediction mode of the current block and a width or a height of the current block, the number of the reference sample lines neighboring the upper portion of the current block can be 1, and the number of the reference sample lines neighboring the left portion of the current block can be 2. For example, the length of the reference sample lines above the current block and the length of the reference sample lines to the left of the current block can be different. For example, the length of the reference sample lines can vary according to at least one of the intra prediction mode of the current block and the width or the height of the current block.

[0258] Each of the reference sample lines can have a different length. For example, referring to Figure 7 , the length of the reconstructed sample lines 2 to 4 can be longer than the length of the reconstructed sample line 1 by a length corresponding to one or more samples.

[0259] The length of the reference sample lines can be different for each of the reconstructed sample lines. For example, the reconstructed sample line n can be longer or shorter than the reconstructed sample line n-1 by a length corresponding to m samples. In Figure 7 the illustrated example, the reconstructed sample line n is longer than the reconstructed sample line n-1 by a length corresponding to one sample.

[0260] As described above, decision information on whether to use only the most recent reference sample line or to use multiple reference sample lines to construct the reference samples can be encoded / decoded. For example, the decision information can be encoded / decoded at a level of at least one of a sequence, a picture, a slice, a parallel block, a CTU, a CU, a PU, and a TU. In addition, information on availability of each of the multiple reference sample lines can be signaled at a higher level.

[0261] At least one of the number, position, and configuration of the reconstructed sample lines used in the reference sample construction can be set differently when the top or left boundary of the current block corresponds to a boundary of at least one of a picture, a slice, a parallel block, and a coding tree block (CTB). For example, when two or more reference sample lines are constructed, one reference sample line adjacent to the upper portion of the current block can be constructed when the top boundary of the current block corresponds to a boundary of at least one of a picture, a parallel block, a slice, and a coding tree block (CTB). For example, one reference sample line can be configured when the top boundary of the current block corresponds to the top boundary of the CTU, and otherwise, two or more reference sample lines can be configured. In this case, since only one reference sample line at the top boundary of the CTU is used, the size of a line buffer for storing data of the reference samples of the reference sample line can be reduced.

[0262] When selecting the reference samples, availability determination and reference sample padding can be performed on a block containing the reference samples to be used. For example, when the block containing the reference samples is available, the corresponding reference samples can be used. On the other hand, when the block containing the reference samples is not available, one or more available neighboring reference samples can be used to pad the unavailable reference samples in the block.

[0263] When the reference sample is located outside a boundary of at least one of a picture, a parallel block, a slice, or a coding tree block (CTB), the reference sample can be determined to be unavailable. When the current block is encoded with constrained intra prediction (CIP), the reference sample is determined to be unavailable in a case where the block including the reference sample has been encoded / decoded in an inter prediction mode.

[0264] Figure 8 is a diagram for describing a process of replacing unavailable samples with available samples.

[0265] When it is determined that the reconstructed neighboring sample is unavailable, the unavailable sample can be replaced with the reconstructed neighboring sample as an available sample. For example, as shown in Figure 8 When both available samples and unavailable samples exist, one or more available samples can be used to replace one or more unavailable samples, as shown in

[0266] The values of the available samples can be used to replace the sample values of the unavailable samples in a predetermined order. The available samples used to replace the unavailable samples can be the available samples adjacent to the unavailable samples in position. When there is no available sample adjacent to the unavailable sample, the earliest or closest available sample can be used to replace the unavailable sample. The replacement order of the unavailable samples can be, for example, from the bottom left to the top right. Alternatively, the replacement order can be from the top right to the bottom left. In particular, the replacement order can be from the top left to the top right and / or to the bottom left. Alternatively, the replacement order can be from the top right and / or from the bottom left to the top left.

[0267] For example, filling the unavailable samples with the values of the available samples can start from position 0, where position 0 is the bottom left sample position. That is, the first four unavailable samples can be filled with the value “a”, and the following 13 unavailable samples can be filled with the value “b”.

[0268] For example, the unavailable samples can be filled with a combined value of the available samples. For example, the unavailable samples can be filled with an average or an interpolation of the available samples adjacent to the two ends of the line of the unavailable samples, respectively. That is, the first four unavailable samples can be filled with the value “a”, and the following 13 unavailable samples can be filled with an average of the value “b” and the value “c”, or the following 13 unavailable samples can be filled by interpolating the value “b” and the value “c”.

[0269] Optionally, any intermediate value between the sample values "b" and "c" of the available samples can be used to fill the 13 unavailable samples. In this case, the unavailable samples can be filled with different corresponding values. For example, as the distance of an unavailable sample to the available sample with value "a" decreases, the unavailable sample can be filled with a value closer to value "a". For example, the closer the unavailable sample to the available sample with value "b", the closer the value used to fill the unavailable sample to value "b". That is, the value of the unavailable sample can be determined based on the distance between the unavailable sample and the available sample with value "a" or value "b". In order to replace the unavailable samples with the available samples, one or more replacement methods including the above method can be used adaptively. The method of replacing the unavailable samples with the available samples can be signaled as information contained in the bitstream, or can be predetermined in the encoder / decoder. Optionally, the replacement method can be derived according to a predetermined determination method. For example, the replacement method can be determined based on the difference between value "a" and value "b" or based on the number of unavailable samples. More specifically, the replacement method can be determined by comparing the difference between the values of the two available samples with a threshold value and / or by comparing the number of unavailable samples with a threshold value. For example, when the difference between the values of the two available samples is greater than the threshold value, and / or when the number of unavailable samples is greater than the threshold value, the unavailable samples can be replaced with different values from each other. The selection of the method of replacing the unavailable samples with the available samples can be performed based on each predetermined unit. For example, the replacement can be selected based on each video, each sequence, each picture, each slice, each parallel block, each coding tree unit (CTU), each coding unit (CU), each prediction unit (PU), each transform unit (TU), or each block. At this time, the selection of the method of replacing the unavailable samples with the available samples can be determined according to the information signaled based on each predetermined unit, or the selection of the method of replacing the unavailable samples with the available samples can be derived based on each predetermined unit. Optionally, the selection method regarding the replacement method can be predetermined in the encoder / decoder.

[0270] When the reference sample is located at a predetermined position, the filling can be automatically performed without determining whether the block including the reference sample is available. For example, referring to Figure 7 When the position (x, y) of the top-left sample of the current block is (0, 0), for a sample located at (x, y) where the x-coordinate or the y-coordinate is equal to or greater than W+H (x=W+H or greater, or y=W+H or greater), it can be impossible to determine the sample availability, and the sample can be filled with a neighboring reference sample.

[0271] For example, the sample ref[W+H, -2] can be padded with the value of the sample ref[W+H-1, -2] without performing the availability determination for the sample ref[W+H, -2]. As another example, the sample ref[W+H, -3] can be padded with the value of the sample ref[W+H-1, -3] without performing the availability determination for the sample [W+H, -3]. That is, the samples located at positions (x, y: x is equal to or greater than W+H or y is equal to or greater than W+H) can be padded by using the closest samples on the same sample line without performing the availability determination for the samples located at positions (x, y: x is equal to or greater than W+H or y is equal to or greater than W+H).

[0272] When the position of the top-left sample of the current block is (0, 0), the availability determination is performed for the samples located at positions (x, y: x is equal to or greater than W and less than W+H) among the samples located above the current block, and then the padding is performed according to the result of the availability determination. The availability determination is performed for the samples located at positions (x, y: y is equal to or greater than H and less than W+H) among the samples located to the left of the current block, and the padding is performed according to the availability determination.

[0273] For example, when the position of the top-left sample of the current block is (0, 0), the availability determination and the padding can be performed for the samples corresponding to rec[x, -1] (x from -1 to W+H-1) and / or the samples corresponding to rec[-1, y] (y from 0 to H+W-1).

[0274] For the padding, a plurality of reference sample lines can be used. For example, when the padding is performed for a first reference sample line adjacent (i.e., closest) to the current block, a second reference sample line second closest to the current block can be used. For example, the padding can be performed according to Equation 2. That is, the sample value of the first reference sample line can be derived by using a weighted average of the samples selected from the first reconstructed sample line and the samples selected from the second reconstructed sample line. In this case, the selected reconstructed samples can be the samples located at the position of the current sample or the positions adjacent to the position of the current sample.

[0275] [Equation 2]

[0276] ref[x, -1] = (rec[x, -2] + 3 × rec[x, -1] + 2) » 2, (x = 0 ~ H+W-1)

[0277] Filtering can be performed on one or more reference samples among the samples constructed as above. The filtering can be adaptively performed based on at least one of an intra prediction mode of the current block, a size of the current block, and a shape of the current block. For example, at least one of a determination of whether to apply the filtering, a filter type, a filter strength, and filter coefficients can be adaptively determined.

[0278] For example, a determination can be made as to whether to apply filtering for each of a plurality of reference sample lines. For example, filtering can be applied to a first reference sample line that is adjacent to the current block, and can not be applied to a second reference sample line. For example, both filtered and unfiltered values can be used for the same reference sample.

[0279] For example, at least one of a 3-tap filter, a 5-tap filter, a 7-tap filter, and an N-tap filter can be selectively applied according to at least one of an intra prediction mode of the current block, a size of the current block, and a shape of the current block. In this case, N is a positive integer.

[0280] For example, filters having different shapes can be selectively used according to at least one of an intra prediction mode, a size, and a shape of the current block. Figure 9 Various filter shapes are illustrated.

[0281] A shape of the current block can be determined by comparing a width (horizontal size) of the current block with a height (vertical size) of the current block. For example, at least one of a decision on whether to apply a filter, a filter type, a filter strength, and filter coefficients can be adaptively determined according to whether the current block is a horizontally long rectangular block or a vertically long rectangular block. Alternatively, at least one of a decision on whether to apply a filter, a filter type, a filter strength, and filter coefficients can be adaptively determined according to whether the current block is a rectangular block or a square block.

[0282] Intra prediction for the current block can be performed based on the derived intra prediction mode and the constructed reference samples.

[0283] For example, non-directional intra prediction can be performed for the current block. A mode of the non-directional intra prediction can be at least one of a DC mode, a planar mode, and an LM mode.

[0284] For the DC mode, prediction can be performed using an average value of one or more reference samples of the constructed reference samples. In this case, filtering can be applied to one or more predicted samples (also referred to as predicted samples) located at a boundary of the current block. The DC prediction can be adaptively performed based on at least one of a size of the current block and a shape of the current block. Further, a range of the reference samples used in the DC mode can be determined based on at least one of the size and the shape of the current block.

[0285] Figure 10 is a diagram for describing intra prediction according to a shape of a current block.

[0286] For example, when the current block is a square block, as Figure 10As shown in (a) of FIG. 1, a DC prediction can be performed by using an average of reference samples located above the current block and reference samples located at the left side of the current block.

[0287] For example, when the current block is a non-square block, neighboring samples adjacent to the left end and the upper end of the current block can be selectively used. When the current block is a square block, as shown in (b) of FIG. 1, a prediction can be performed using an average of reference samples adjacent to the longer side among the left side and the upper side of the current block. Figure 10

[0288] For example, when the size of the current block corresponds to a predetermined size or falls within a predetermined range, a predetermined number of reference samples among reference samples located above or at the left side of the current block are selected, and a prediction is performed using an average of the selected reference samples. The predetermined size can be a fixed size N x M preset in the encoder / decoder. In this case, N and M are integers greater than 0, and N and M can be the same as or different from each other. The predetermined range can indicate a threshold value for selecting reference samples for predicting the current block. The threshold value can be set with at least one of a minimum value and a maximum value. The minimum value and / or the maximum value can be one fixed value or a plurality of fixed values preset in the encoder / decoder, or one variable value or a plurality of variable values signaled after encoding by the encoder.

[0289] For example, one or more average values can be used to perform a prediction. When the current block is a square block or a non-square block, at least one of a first average value or a second average value can be used, wherein the first average value is an average of reference samples located above the current block, and the second average value is an average of reference samples located at the left side of the current block. The DC prediction value of the current block can be the first average value or the second average value. Alternatively, the DC prediction value of the current block can be a weighted sum obtained by weighting the first average value and the second average value. For example, the weights of the first average value and the second average value can be the same (i.e., 1:1).

[0290] According to the above method, a shift operation can be used to calculate all DC values. For example, even in a case where a sample length indicating a width, a height, or a sum of a width and a height of the current block is not a power of 2, the method can be used. The method can be applied to both luma DC prediction and chroma DC prediction. Alternatively, the method can be applied to luma DC prediction or chroma DC prediction.

[0291] For example, when the current block is a non-square block, a prediction can be performed based on the width or the height of the current block. For example, a prediction value can be obtained by dividing a sum of the value of the upper reference sample and the value of the left reference sample by the length of the longer side (i.e., the width or the height) of the current block. In this case, a division operation using a value corresponding to the longer one of the width and the height can be performed by a shift operation. ​

[0292] For example, multiple reference sample lines can be used to perform DC prediction. For example, such as... Figure 10 As shown in (c), two reference sample lines can be used to perform predictions.

[0293] For example, the average value of the reference samples included in the two reference sample lines can be determined as the DC prediction value for the current block.

[0294] Optionally, different weights can be applied to the reference samples of the first and second adjacent lines of the current block. For example, a weighted average of each sample in the first and second reference sample lines can be calculated by applying a weight of 3:1 to each sample in the first and second reference sample lines (i.e., (3 × first line reference sample + second line reference sample + 2) >> 2), and the average of these weighted averages can be determined as the DC prediction value for the current block. Optionally, a result of ((3 × first line reference sample - second line reference sample) >> 1) can be obtained, and the average of these values ​​can be determined as the DC prediction value for the current block. The weights are not limited to the above examples, and any weights can be used. In this case, the closer the reference sample line is to the current block, the greater the weight applied to that reference sample line. The number of reference sample lines that can be used is not limited to two, and three or more reference sample lines can be used for prediction.

[0295] For planar mode, prediction can be performed based on a weighted sum of distances from at least one reference sample to the intra-predicted target sample located in the current block.

[0296] Filtering can be performed on reference samples or predicted samples (i.e., predicted samples) of the current block. For example, after applying filtering to reference samples, planar prediction can be performed, and then filtering can be performed on one or more predicted samples. Among the predicted samples, filtering can be performed on samples in one, two, or N sample lines located at the top or left boundary of the current block.

[0297] To perform planar prediction, a weighted sum of one or more reference samples can be used. For example, such as Figure 10 As shown in (d), five reference samples can be used. For example, to generate a predicted sample for the target location [x, y], reference samples r[-1, -1], r[x, -1], r[-1, y], r[W, -1], and r[-1, H] can be used. In this case, W and H are the width and height of the current block, respectively. For example, the predicted sample pred[x, y] can be generated using Equation 3. In Equation 3, a, b, c, d, and e represent weights. N can be log2(a+b+c+d+e).

[0298] [Equation 3]

[0299] pred[x, y] = (a x r[-1, -1] + b x r[x, -1] + c x r[-1, y] + d x r[x, -1] + e x r[-1, H]) » N

[0300] As another example, the planar prediction can be performed using a plurality of reference sample lines. For example, the planar prediction can be performed using a weighted sum of two reference sample lines. As another example, the planar prediction can be performed using a weighted sum of reference samples in two reference sample lines. In this case, the reference sample selected from the second reference sample line can be a sample adjacent to the reference sample selected from the first reference sample line. That is, when the reference sample located at the position (-1, -1) is selected, the reference sample located at the position (-2, -2) can be selected. The planar prediction can be performed by calculating a weighted sum of the selected reference samples, and in this case, the same weight as used for the DC prediction can be used.

[0301] The directional prediction mode refers to at least one of a horizontal mode, a vertical mode, and an angular mode having a predetermined angle.

[0302] In the horizontal mode or the vertical mode, the prediction is performed using one or more reference samples arranged in a straight line direction, i.e., a horizontal direction or a vertical direction. A plurality of reference sample lines can be used. For example, when two reference sample lines are used, the prediction can be performed using two reference samples arranged in a horizontal line or a vertical line. Similarly, when N reference sample lines are used, N reference samples in a horizontal line or a vertical line can be used.

[0303] For the vertical mode, a statistical value of a first reference sample (e.g., r[x, -1]) on a first reference sample line and a second reference sample (e.g., r[x, -2]) on a second reference sample line can be used to perform the directional prediction.

[0304] For example, the prediction value of the vertical mode can be determined by calculating a result value of (3 x r[x, -1] + r[x, -2] + 2) » 2. Alternatively, the prediction value of the vertical mode can be determined by calculating a result value of (3 x r[x, -1] - r[x, -2] + 1) » 1. In another alternative, the prediction value of the vertical mode can be determined by calculating a value of (r[x, -1] + r[x, -2] + 1) » 1.

[0305] For example, a change between each sample value on a vertical line can be considered. For example, a prediction value for a vertical mode can be determined by calculating a result value of (r[x,-1]+(r[x,-1]-r[x,-2])>>1). In this case, N can be an integer equal to or greater than 1. A fixed value can be used as N. Alternatively, N can increase as a y coordinate of a prediction target sample increases. For example, N=y+1.

[0306] Even for the horizontal mode, one or more methods for the vertical mode can be used.

[0307] For an angular mode of a specific angle, prediction can be performed using one or more reference samples arranged in a slanted direction from an intra prediction target sample of the current block or one or more samples neighboring the reference samples located in the slanted direction. In this case, a total of N reference samples can be used, where N can be 2, 3, 4, 5, or 6. Prediction can also be performed by applying at least one of N-tap filters to the N reference samples. Examples of the N-tap filters include a 2-tap filter, a 3-tap filter, a 4-tap filter, a 5-tap filter, and a 6-tap filter. At this time, at least one of the reference samples can be located above the current block, and the remaining reference samples can be located to the left of the current block. The reference sample located above the current block (or the reference sample located to the left of the current block) can be located on the same line or on different lines.

[0308] According to another embodiment, intra prediction can be performed based on position information. In this case, the position information can be encoded / decoded, and a reconstructed sample block located at the above-described position can be derived as an intra prediction block of the current block. Alternatively, a similar block to the current block can be searched for by a decoder, and the found block can be derived as the intra prediction block of the current block. The search for the similar block can be performed in the encoder or the decoder. A range (search range) in which the search is performed can be limited to a predetermined range. For example, the search range can be limited to reconstructed sample blocks within a picture including the current block. Alternatively, the search range can be limited to a CTU including the current block or limited to a predetermined CU. That is, the intra prediction based on the position information can be performed by searching for a block similar to the current block among reconstructed samples within the CTU. The search can be performed using a template. For example, one or more reconstructed samples neighboring the current block are used as the template, and samples similar to the template are searched for in the CTU.

[0309] When a CTU is composed of only intra coding modes or when luma blocks and chroma blocks have different partition structures, intra prediction based on position information can be performed. For example, for an inter prediction available slice (e.g., P or B slice), information indicating that the current CTU is composed of only intra coding modes can be signaled. In this case, when the information indicates that the current CTU is composed of only intra coding modes, intra prediction based on position information can be performed. Alternatively, when luma blocks and chroma blocks in the current CTU have different partition structures (e.g., when the value of dual_tree or separate_tree is 1), intra prediction based on position information can be available. On the other hand, when a CTU includes both intra coded blocks and inter coded blocks or when luma blocks and chroma blocks have the same partition structure, intra prediction based on position information can not be available.

[0310] According to another embodiment, inter-color-component intra prediction is performed. For example, a chroma component can be intra predicted from a corresponding reconstructed luma component of the current block. Alternatively, one chroma component Cr can be intra predicted from a corresponding reconstructed chroma component Cb of the current block.

[0311] Inter-color-component intra prediction includes a color component block reconstruction step, a prediction parameter derivation step, and / or an inter-color-component prediction execution step. The term "color component" can refer to at least any one of a luma signal, a chroma signal, red, green, blue, Y, Cb, and Cr. Prediction of a first color component can be performed by using at least any one of a second color component, a third color component, and a fourth color component. The signal used for prediction of a color component can include at least any one of an original signal, a reconstructed signal, a residual signal, and a prediction signal.

[0312] When intra prediction is performed on a second color component target block, samples of a first color component corresponding block corresponding to the second color component target block, samples of a neighboring block of the first color component corresponding block, or both samples of the first color component corresponding block corresponding to the second color component target block and samples of the neighboring block of the first color component corresponding block can be used. For example, when intra prediction is performed on a chroma component block Cb or Cr, a reconstructed luma component block Y corresponding to the chroma component block Cb or Cr can be used.

[0313] When a chroma component is predicted based on a luma component, prediction can be performed according to Equation 4.

[0314] [Equation 4]

[0315] Pred C (i, j) = a · rec L '(i, j) + β

[0316] In Equation 4, Pred C(i, j) denotes a predicted chroma sample of the current block, and rec L (i, j) denotes a reconstructed luma sample of the current block. At this time, rec L '(i, j) can be a down-sampled reconstructed luma sample. The parameters a and b can be derived by minimizing a regression error between reconstructed neighboring luma samples around the current block and reconstructed neighboring chroma samples.

[0317] There are two modes for predicting a chroma component using a luma component. The two modes can include a single model mode and a multiple model mode. The single model mode can use one linear model when predicting a chroma component from a luma component for a current block. The multiple model mode can use two linear models.

[0318] In the multiple model mode, samples neighboring the current block (i.e., neighboring luma samples and neighboring chroma samples) can be classified into two groups. That is, the parameters a and b can be derived for each of the two groups. In addition, the luma samples of the current block can be classified according to a rule for classifying the neighboring luma samples.

[0319] For example, a threshold for classifying the neighboring samples into two groups can be calculated. The threshold can be calculated using an average of the reconstructed neighboring luma samples. However, the calculation of the threshold is not limited thereto. At least one of various statistical values recognized in the present specification can be used in addition to the average. When a value of a neighboring sample is greater than the threshold, the neighboring sample can be classified into a first group. Otherwise, the neighboring sample can be classified into a second group.

[0320] Although the multiple model mode uses two linear models in the above-described embodiment, the present application is not limited thereto, and can cover other cases using two or more linear models. When N linear models are used, samples can be classified into N groups. To this end, N-1 thresholds can be calculated.

[0321] As described above, when a chroma component is predicted from a luma component, a linear model can be used. In this case, the linear model can include a simple linear model (hereinafter referred to as "LM1"), a complex linear model (hereinafter referred to as "LM2"), and a complex filter linear model (hereinafter referred to as "LM3"). The parameters of the above-described models can be derived by minimizing a regression error between reconstructed luma samples around the current block and corresponding reconstructed chroma samples around the current block.

[0322] Figure 11 is a diagram for describing "neighboring samples of the current block" (hereinafter referred to as "neighboring data set") for deriving parameters of a model.

[0323] The neighboring data set for deriving parameters of LM1 can consist of a pair of samples including inFigure 11 The luminance samples and the chrominance samples in each of the line region B and the line region C shown in FIG. 6A. The neighboring data set for deriving the parameters of LM2 and LM3 can consist of a pair of samples including the luminance sample and the chrominance sample in each of the line region B, the line region C, the line region E, and the line region F shown in FIG. 6B. Figure 11 The luminance samples and the chrominance samples in each of the line region B and the line region C shown in FIG. 6A. The neighboring data set for deriving the parameters of LM2 and LM3 can consist of a pair of samples including the luminance sample and the chrominance sample in each of the line region B, the line region C, the line region E, and the line region F shown in FIG. 6B.

[0324] However, the neighboring data set is not limited to the above-described example. For example, in order to cover various linear relationships between the luminance samples and the chrominance samples in the current block, N neighboring data sets can be used for each mode. For example, N can be an integer of 2 or more, particularly 3.

[0325] The parameters of the linear model can be calculated using both the above template and the left template. Alternatively, there are two LM modes (LM_A mode and LM_L mode), and the above template and the left template can be used in the LM_A mode and the LM_L mode, respectively. That is, in the LM_A mode, only the above template can be used to obtain the linear model parameters. The above template can be extended to a range from (0, -n) to (W+H-1, -n) when the position of the top-left corner sample of the current block is (0, 0). In this case, n is an integer equal to or greater than 1. That is, in the LM_L mode, only the left template can be used to obtain the linear model parameters. The left template can be extended to a range from (-n, 0) to (-n, H+W-1). In this case, n is an integer equal to or greater than 1.

[0326] The parameters of the linear model can be derived using powers of two of the number of samples. When the current chroma block is a non-square block, the number of samples used to derive the parameters of the linear model can be determined based on the number of samples on the shorter side among the horizontal side and the vertical side of the current block. According to one embodiment, when the size of the current block is n x m (where n > m), for example, m samples among n neighboring samples adjacent to the top boundary of the current block can be selected by uniformly performing sub-sampling. In this case, the number of samples used to derive the parameters of the linear model can be 2m. As another example, when the size of the current block is n x m (where n > m), m samples among n neighboring samples adjacent to the top boundary of the current block can not be used. For example, among the n samples, the m samples farthest from the shorter side among the horizontal side and the vertical side of the current block can not be used. In this case, the number of samples used to derive the parameters of the linear model can be n (n-m samples adjacent to the top boundary of the current block + m samples adjacent to the left boundary of the current block).

[0327] Optionally, the chroma component block Cb can be used when performing the intra prediction on the chroma component block Cr. Optionally, at least one of the first, second, and third color component blocks corresponding to the fourth color component block can be used when performing the intra prediction on the fourth color component block.

[0328] The inter-color-component intra prediction can be determined based on at least any one of a size and a shape of the current target block. For example, the inter-color-component intra prediction on the target block can be performed when the size of the target block is equal to a size of a coding tree unit (CTU), greater than a predetermined size, or within a predetermined size range. Optionally, the inter-color-component intra prediction on the target block can be performed when the shape of the target block is a predetermined shape. The predetermined shape can be a square. In this case, the inter-color-component intra prediction on the target block can not be performed when the target block has a rectangular shape. In addition, the above-described embodiments are operated in reverse when the predetermined shape is a rectangular shape.

[0329] Optionally, the inter-color-component intra prediction on the prediction target block can be determined based on an encoding parameter of at least any one of a corresponding block corresponding to the prediction target block and a neighboring block of the corresponding block. For example, the inter-color-component intra prediction on the prediction target block can not be performed when the corresponding block has been predicted by an intra prediction method in a constrained intra prediction (CIP) environment. Optionally, the inter-color-component intra prediction on the prediction target block can be performed when an intra prediction mode of the corresponding block is a predetermined mode. Further optionally, the inter-color-component intra prediction can be determined based on at least any one of CBF information of the corresponding block and CBF information of the neighboring block of the corresponding block. The encoding parameter is not limited to the prediction mode of the block, but various parameters that can be used for encoding / decoding can be used.

[0330] A color component block reconstruction step will be described below.

[0331] The first color component block can be reconstructed when the second color component block is predicted by using the first color component block. For example, when an image has a YCbCr color space and a sampling rate of color components is one of 4:4:4, 4:2:2, and 4:2:0, block sizes of the color components can be different from each other. Accordingly, when the second color component block is predicted using the first color component block having a size different from that of the second color component block, the first color component block can be reconstructed such that the block size of the first color component and the block size of the second color component are equal. The reconstructed block can include at least any one of samples in the first color component block corresponding to the corresponding block and samples in a neighboring block of the first color component block. Figure 12 is an exemplary diagram illustrating a process of reconstructing a color component block.

[0332] In Figure 12In (a), p1[x, y] represents a sample at a position (x, y) in the first color component block. Figure 12 In (b), p1'[x, y] represents a sample at a position (x, y) in the reconstructed block generated by reconstructing the first color component block.

[0333] When the size of the first color component block is greater than the size of the second color component block, the first color component block is down-sampled to have a size equal to the size of the second color component block. The down-sampling can be performed by applying an N (N is an integer equal to or greater than 1) tap filter to one or more samples. For the down-sampling, at least any one of Equations 5 to 9 can be used. In a case where any one of various down-sampling methods is selectively used, the encoder can select one down-sampling method as a predetermined down-sampling method. For example, the encoder can select a down-sampling method having the best effect. The selected down-sampling method is encoded and signaled to the decoder. The signaled information can be index information indicating the down-sampling method.

[0334] [Equation 5]

[0335] p1'[x, y] = (p1[2x, 2y] + p1[2x, 2y+1] + 1) » 1

[0336] [Equation 6]

[0337] p1'[x, y] = (p1[2x+1, 2y] + p1[2x+1, 2y+1] + 1) » 1

[0338] [Equation 7]

[0339] p1'[x, y] = (p1[2x-1, 2y] + 2 x p1[2x, 2y] + p1[2x+1, 2y] + 2) » 2

[0340] [Equation 8]

[0341] p1'[x, y] = (p1[2x-1, 2y+1] + 2 x p1[2x, 2y+1] + p1[2x+1, 2y+1] + 2) » 2

[0342] [Equation 9]

[0343] p1'[x, y] = (p1[2x-1, 2y] + 2 x p1[2x, 2y] + p1[2x+1, 2y] + p1[2x-1, 2y+1] + 2 x p1[2x, 2y+1] + p1[2x+1, 2y+1] + 4) » 3

[0344] The downsampling method performed on two or more samples is not limited to any of the examples of Equations 5 through 9. For example, two or more samples can be selected from a group of samples consisting of sample pl[2x, 2y] and its neighboring samples for computing the downsampled value pl'[x, y]. The neighboring samples can be selected from among pl[2x - 1, 2y - 1], pl[2x - 1, 2y], pl[2x - 1, 2y + 1], pl[2x, 2y - 1], pl[2x, 2y + 1], pl[2x + 1, 2y - 1], pl[2x + 1, 2y], and pl[2x + 1, 2y + 1]. The downsampling can be performed by computing an average or a weighted average of the two or more samples.

[0345] Alternatively, the downsampling can be performed in a manner that selects a particular sample among one or more samples. In this case, at least any one of the following equations (Equations 10 through 13) can be used for downsampling.

[0346] [Equation 10]

[0347] pl'[x, y] = pl[2x, 2y]

[0348] [Equation 11]

[0349] pl'[x, y] = pl[2x, 2y + 1]

[0350] [Equation 12]

[0351] pl'[x, y] = pl[2x + 1, 2y]

[0352] [Equation 13]

[0353] pl'[x, y] = pl[2x + 1, 2y + 1]

[0354] When the size of the first color component block is smaller than the size of the second color component block, the first color component block is upsampled for reconstruction so that the sizes of the first color component block and the second color component block are equal. In this case, the upsampling is performed according to Equation 14.

[0355] [Equation 14]

[0356] pl'[2x, 2y] = pl[x, y],

[0357] pl'[2x + 1, 2y] = (pl[x, y] + pl[x + 1, y] + 1) » 1,

[0358] pl'[2x, 2y + 1] = (pl[x, y] + pl[x, y + 1] + 1) » 1,

[0359] p1'[2x+1,2y+1]=(p1[x+1,y]+p1[x,y+1]+1)>>1

[0360] In the reconstruction process, a filter can be applied to one or more samples. For example, the filter can be applied to one or more samples included in at least any one of the first color component block (i.e., the corresponding block), a neighboring block of the corresponding block, the second color component block (i.e., the target block), and a neighboring block of the target block.

[0361] In the above-mentioned reference sample reconstruction step, an indicator corresponding to a predetermined reference sample line among the plurality of reference sample lines can be signaled. In this case, in the reconstruction process, the reconstruction is performed using the predetermined reference sample line corresponding to the signaled indicator. For example, when the value of the indicator mrl_index is 0, the reconstruction process is performed using the first and second reference sample lines adjacent to the first color component corresponding block. Alternatively, when the value of the indicator mrl_index is 1, the reconstruction process is performed using the second and third reference sample lines adjacent to the first color component corresponding block. Alternatively, when the value of the indicator mrl_index is 3, the reconstruction process is performed using the third and fourth reference sample lines adjacent to the first color component corresponding block. The reference sample lines indicated by the indicator mrl_index can be used for the second color component target block.

[0362] In the reconstruction process, when a boundary of the second color component block (the target block) or a boundary of the first color component block (the corresponding block) is a boundary of a predetermined region, reference samples used for the reconstruction can be differently selected. In this case, the number of reference sample lines on the upper side can be different from the number of reference sample lines on the left side. The predetermined region can be at least any one of a picture, a slice, a parallel block, a CTU, and a CU.

[0363] For example, when the upper boundary of the first color component corresponding block is a boundary of a predetermined region, reference samples on the upper side can not be used for the reconstruction, and only reference samples on the left side can be used for the reconstruction. When the left boundary of the first color component corresponding block is a boundary of a predetermined region, reference samples on the left side can not be used for the reconstruction, and only reference samples on the upper side can be used for the reconstruction. Alternatively, N reference sample lines on the upper side and M reference sample lines on the left side can all be used for the reconstruction, where N can be less than M. For example, N can be 1 when the upper boundary corresponds to a boundary of a predetermined region. In addition, M can be 1 when the left boundary corresponds to a boundary of a predetermined region.

[0364] Alternatively, the reconstruction can be performed by using N reference sample lines on the upper side and M reference sample lines on the left side of the first color component corresponding block, regardless of whether a boundary of a predetermined region is the upper boundary or the left boundary of the first color component block.

[0365] Figure 13 This is a diagram illustrating an embodiment of performing reconstruction using multiple upper reference sample lines and / or multiple left reference sample lines.

[0366] like Figure 13 As shown in (a), reconstruction can be performed using four upper reference sample lines and four left reference sample lines.

[0367] For example, when the upper or left boundary of the corresponding block of the first color component is the boundary of a predetermined region, the number of upper reference sample lines and the number of left reference sample lines used for reconstruction can be different from each other. For example, as Figure 13 (b) to Figure 13 As shown in (d), any of the following combinations can be used for reconstruction: two upper reference point lines and four left reference point lines; one upper reference point line and three left reference point lines; one upper reference point line and two left reference point lines.

[0368] The number of reference sample lines used for reconstruction is not limited to the combinations above. That is, N upper reference sample lines and M left reference sample lines can be used, where N and M are equal to or different from each other. N and M can be equal to each other when both the upper and left boundaries of the corresponding block correspond to the boundaries of the predetermined region. That is, N and M can both be 1. Optionally, N can be set to be less than M under the same conditions. This is because upper reference sample lines require more resources (memory) than left reference sample lines.

[0369] Optionally, such as Figure 13 As shown in (e), one or more reference points within a region whose vertical and horizontal lengths are no greater than the vertical and horizontal lengths of the corresponding block of the first color component can be used for reconstruction.

[0370] When performing reconstruction processing, the reference sample points of the first color component corresponding block can be set differently based on any one of the block size, block shape, and encoding parameters of at least one block selected from the first color component corresponding block, the neighboring block of the first color component corresponding block, the second color component target block, and the neighboring block of the second color component target block.

[0371] For example, in the samples of the first color component corresponding block and its neighboring blocks, samples from blocks with inter-frame coding mode are not used, but only samples from blocks with intra-frame coding mode are used for reconstruction.

[0372] Figure 14 This is an exemplary diagram illustrating reference samples used for reconstruction based on the intra-prediction mode or coding parameters of the corresponding block. The reconstruction of the reference samples of the first color component block can be performed differently depending on the intra-prediction mode of the corresponding block of the first color component. For example, as...Figure 14 As shown in (a) of FIG. 10, when the intra prediction mode of the corresponding block is a non-angular mode such as a DC mode and a planar mode or is an angular mode in which both the upper side reference samples and the left side reference samples are used, at least one sample group of the upper side reference samples and the left side reference samples is used for the reconstruction. Alternatively, as shown in (b) of FIG. 10, when the intra prediction mode of the corresponding block is an angular mode in which both the upper side reference samples and the right upper side reference samples of the corresponding block are used, the reconstruction of the corresponding block is performed using at least one sample group of the upper side reference samples and the right upper side reference samples. Alternatively, as shown in (c) of FIG. 10, when the intra prediction mode of the corresponding block is an angular mode in which both the left side reference samples and the left lower side reference samples are used, the corresponding block can be reconstructed using at least any one sample group of the left side reference samples and the left lower side reference samples. Figure 14 As shown in (a) of FIG. 10, when the intra prediction mode of the corresponding block is a non-angular mode such as a DC mode and a planar mode or is an angular mode in which both the upper side reference samples and the left side reference samples are used, at least one sample group of the upper side reference samples and the left side reference samples is used for the reconstruction. Alternatively, as shown in (b) of FIG. 10, when the intra prediction mode of the corresponding block is an angular mode in which both the upper side reference samples and the right upper side reference samples of the corresponding block are used, the reconstruction of the corresponding block is performed using at least one sample group of the upper side reference samples and the right upper side reference samples. Alternatively, as shown in (c) of FIG. 10, when the intra prediction mode of the corresponding block is an angular mode in which both the left side reference samples and the left lower side reference samples are used, the corresponding block can be reconstructed using at least any one sample group of the left side reference samples and the left lower side reference samples. Figure 14 As shown in (a) of FIG. 10, when the intra prediction mode of the corresponding block is a non-angular mode such as a DC mode and a planar mode or is an angular mode in which both the upper side reference samples and the left side reference samples are used, at least one sample group of the upper side reference samples and the left side reference samples is used for the reconstruction. Alternatively, as shown in (b) of FIG. 10, when the intra prediction mode of the corresponding block is an angular mode in which both the upper side reference samples and the right upper side reference samples of the corresponding block are used, the reconstruction of the corresponding block is performed using at least one sample group of the upper side reference samples and the right upper side reference samples. Alternatively, as shown in (c) of FIG. 10, when the intra prediction mode of the corresponding block is an angular mode in which both the left side reference samples and the left lower side reference samples are used, the corresponding block can be reconstructed using at least any one sample group of the left side reference samples and the left lower side reference samples.

[0373] Alternatively, the reconstruction of the reference samples of the first color component corresponding block is performed differently according to the quantization parameter of at least one of the first color component corresponding block and its neighboring blocks. For example, as shown in (d) of FIG. 11, the reference samples in the upper block having a relatively small quantization parameter value QP among the neighboring blocks are used to perform the reconstruction. Figure 14 As shown in (a) of FIG. 10, when the intra prediction mode of the corresponding block is a non-angular mode such as a DC mode and a planar mode or is an angular mode in which both the upper side reference samples and the left side reference samples are used, at least one sample group of the upper side reference samples and the left side reference samples is used for the reconstruction. Alternatively, as shown in (b) of FIG. 10, when the intra prediction mode of the corresponding block is an angular mode in which both the upper side reference samples and the right upper side reference samples of the corresponding block are used, the reconstruction of the corresponding block is performed using at least one sample group of the upper side reference samples and the right upper side reference samples. Alternatively, as shown in (c) of FIG. 10, when the intra prediction mode of the corresponding block is an angular mode in which both the left side reference samples and the left lower side reference samples are used, the corresponding block can be reconstructed using at least any one sample group of the left side reference samples and the left lower side reference samples.

[0374] Alternatively, when the second color component target block has a rectangular shape, the reference samples arranged around the first color component corresponding block having a square shape are used for the reconstruction.

[0375] Alternatively, when the second color component target block is divided into two sub-blocks (for example, two 16x8 size sub-blocks) and when the first color component corresponding block is a 32x16 size block, the reference samples arranged around the 32x32 size block are used for the reconstruction of the corresponding block. In this case, the reference samples around the reconstructed 32x32 size block can be shared as the reference samples of the first color component block corresponding to the second 16x8 size sub-block arranged at the lower side among the two sub-blocks of the partitioned second color component target block.

[0376] Hereinafter, the prediction parameter derivation step will be described.

[0377] At least any one of the reference samples of the reconstructed first color component corresponding block and the reference samples of the second color component prediction target block can be used to derive the prediction parameter. Hereinafter, the terms "first color component" and "first color component block" can refer to the reconstructed first color component and the reconstructed first color component block, respectively.

[0378] Figure 15 is a diagram showing an exemplary reconstructed first color component corresponding block when the second color component prediction target block is a 4x4 block. In this case, the number of reference sample lines can be N.

[0379] As shown in (a) of FIG. 14, the prediction parameters can be derived using the reference samples arranged at the upper side and the left side of the reconstructed first color component corresponding block or the second color component prediction target block. Figure 15

[0380] For example, the prediction parameters can be derived by adaptively using the reference samples of the reconstructed first color component based on the intra prediction mode of the first color component corresponding block. In this case, the reference samples of the second color component can be adaptively used based on the intra prediction mode of the first color component corresponding block.

[0381] As shown in (a) of FIG. 15, when the intra prediction mode of the first color component corresponding block is a non-angular mode such as a DC mode or a planar mode or is an angular mode in which both the upper side reference sample and the left side reference sample are used, the reference samples at the upper side and the left side of the first color component corresponding block can be used.

[0382] As shown in (b) of FIG. 16 or (c) of FIG. 17, when the intra prediction mode of the first color component corresponding block is an angular mode in which the upper side reference sample is used, the reference sample at the upper side of the first color component corresponding block can be used. Figure 15 Figure 15 As shown in (d) of FIG. 16 or (e) of FIG. 17, when the intra prediction mode of the first color component corresponding block is an angular mode in which the left side reference sample is used, the reference sample at the left side of the first color component corresponding block can be used.

[0383] As shown in (d) of FIG. 16 or (e) of FIG. 17, when the intra prediction mode of the first color component corresponding block is an angular mode in which the left side reference sample is used, the reference sample at the left side of the first color component corresponding block can be used. Figure 15 Figure 15 Alternatively, when the intra prediction mode of the first color component corresponding block is an angular mode, the reference sample used in each prediction mode can be used as the reference sample of the first color component. For example, when the intra prediction mode is a vertical mode, the reference sample shown in (b) of FIG. 18 can be used. When the intra prediction mode is a horizontal mode, the reference sample shown in (d) of FIG. 18 can be used. When the intra prediction mode is a right-up diagonal mode, the reference sample shown in (c) of FIG. 18 can be used. When the intra prediction mode is a left-down diagonal mode, the reference sample shown in (e) of FIG. 18 can be used. When the intra prediction mode is a mode between the vertical mode and the right-up diagonal mode, the reference sample shown in (f) of FIG. 18 can be used. When the intra prediction mode is an angular mode in a 45° diagonal direction, the reference sample shown in (g) of FIG. 18 can be used.

[0384] Alternatively, when the intra prediction mode of the first color component corresponding block is an angular mode, the reference sample used in each prediction mode can be used as the reference sample of the first color component. For example, when the intra prediction mode is a vertical mode, the reference sample shown in (b) of FIG. 18 can be used. When the intra prediction mode is a horizontal mode, the reference sample shown in (d) of FIG. 18 can be used. When the intra prediction mode is a right-up diagonal mode, the reference sample shown in (c) of FIG. 18 can be used. When the intra prediction mode is a left-down diagonal mode, the reference sample shown in (e) of FIG. 18 can be used. When the intra prediction mode is a mode between the vertical mode and the right-up diagonal mode, the reference sample shown in (f) of FIG. 18 can be used. When the intra prediction mode is an angular mode in a 45° diagonal direction, the reference sample shown in (g) of FIG. 18 can be used. Figure 15 Figure 15 Figure 15 Figure 15 Figure 15 Figure 16 ​​​​​​​​the top-right reference sample, the bottom-left reference sample, or both of the top-right reference sample and the bottom-left reference sample of the (g) are used. The reference samples selected differently for each intra prediction mode are stored in a look-up table format for convenience of use.

[0385] The prediction parameters can be derived by adaptively using the reference samples of the first color component or the second color component according to the size and / or shape of the first color component block and / or the second color component block.

[0386] For example, when the size of the second color component target block is 64x64, 32, 16, or 8 reference samples among the reference samples on the upper side or the left side of the first color component block or the second color component block can be used. As described above, when the size of the second color component target block is a predetermined size, the reference samples of the first color component block or the second color component block can be adaptively used. The predetermined size is not limited to the 64x64 size, but can be a size signaled through a bitstream, or can be a size derived based on an encoding parameter of the current block or a neighboring block thereof.

[0387] Alternatively, when the second color component target block has a rectangular shape, the reference samples adjacent to the longer side (vertical side or horizontal side) of the second color component target block can be used. For example, when the target block has a block size of 32x8, the reference samples on the upper side of the first color component or the second color component block can be used.

[0388] Alternatively, when the second color component target block has a rectangular shape, the reference samples around a square block can be used. For example, when the target block is a 32x8 block, the reference samples around a 32x32 block can be used.

[0389] The prediction parameters can be derived using the reference samples around the reconstructed first color component block and the reference samples around the second color component block. The prediction parameters can be derived based on any one of factors including correlation, amount of change, average value, and distribution of color components. In this case, any one of a least square (LS), a least mean square (LMS), etc. can be used.

[0390] When the prediction parameters are derived through the LMS method, the prediction parameters can be a and b, α and β, or both of a and b and α and β. The prediction parameters that can minimize the error between the reference samples of the first color component and the reference samples of the second color component can be derived through Equation 15.

[0391] [Equation 15]

[0392]

[0393] In Equation 15, p2 n denotes the reference samples of the second color component, and p1'n a and b represent prediction parameters. N is the number of reference samples arranged in a vertical direction or a horizontal direction, and a and b represent prediction parameters.

[0394] In this case, the correlation between the reference samples can be calculated by Equation 16.

[0395] [Equation 16]

[0396] k = Max(0, BitDepth + log2(N) - 15)

[0397]

[0398]

[0399]

[0400]

[0401] In Equation 16, BitDepth represents a bit depth. p1’ represents a sample of the first color component, and p2 represents a sample of the second color component. Figure 17 is a diagram showing a sample of the first color component and a sample of the second color component.

[0402] When there is a region without a reference sample in the process of deriving the prediction parameters, the prediction parameters can be derived using only existing samples.

[0403] One or more prediction parameters can be derived. For example, a first prediction parameter can be derived from a reference sample having a value satisfying a certain requirement among reference samples used to derive the prediction parameters. In addition, a second prediction parameter can be derived from a reference sample having a value not satisfying the certain requirement. The certain requirement can be a condition that the value of the reference sample is less than statistical data (e.g., an average value).

[0404] According to another embodiment of the present application, a basic prediction parameter (default parameter) can be used instead of deriving the prediction parameter from the value of the reference sample. The default parameter can be defined in advance in the encoder and the decoder. For example, the prediction parameters a and b can be 1 and 0, respectively.

[0405] Optionally, when the prediction parameter is derived from the reference sample, the derived prediction parameter can be encoded and decoded.

[0406] When inter-color component prediction is performed among the color components Y, Cb and Cr, the prediction parameters for predicting the color components Cb and Cr can be derived from the color component Y. The prediction parameters for predicting the color component Cr can be derived from the color component Cb. Alternatively, as the prediction parameters for predicting the color component Cr, the prediction parameters for predicting the color component Cb, which have been derived from the color component Y, can be used as they are, instead of deriving new prediction parameters for predicting the color component Cr.

[0407] Hereinafter, the inter-color component prediction performing step will be described.

[0408] As described above, after the prediction parameters are derived, at least any of the derived prediction parameters can be used to perform inter-color component intra prediction.

[0409] For example, according to Equation 17, the prediction of the second color component target block can be performed by applying the derived prediction parameters to the reconstructed signal of the reconstructed first color component.

[0410] [Equation 17]

[0411] p2[x, y] = a x p1'[x, y] + b

[0412] In Equation 17, p2[x, y] represents the prediction block of the second color component target block. p1'[x, y] represents the first color component block or the reconstructed first color component block.

[0413] Alternatively, according to Equation 18, the prediction of the second color component target block can be performed by applying the derived prediction parameters to the residual signal of the reconstructed first color component.

[0414] [Equation 18]

[0415] p2[x, y] = p2_pred[x, y] + a x p1'_residual[x, y]

[0416] In Equation 18, p1'_residual represents the residual signal of the first color component, and p2_pred represents the prediction signal obtained by performing intra prediction with respect to the second color component target block.

[0417] When the number of derived prediction parameters is one or more, the one or more prediction parameters can be applied to the reconstructed samples of the first color component. For example, when the reconstructed samples of the first color component satisfy a certain requirement, inter-color-component intra prediction can be performed by applying a first prediction parameter derived from a reference sample satisfying the certain requirement. Meanwhile, when the reconstructed samples of the first color component do not satisfy the certain requirement, inter-color-component intra prediction can be performed by applying a second prediction parameter derived from a reference sample not satisfying the certain requirement. The certain requirement refers to a condition that a value of the reference sample is less than a statistic (e.g., an average value) of the reference samples of the first color component.

[0418] The inter-color-component prediction method can be used in an inter prediction mode. For example, when inter prediction is performed on a current block, inter prediction is performed on a first color component, and inter-color-component prediction or prediction combining inter prediction and inter-color-component prediction can be performed on a second color component. For example, the first color component can be a luma component, and the second color component can be a chroma component.

[0419] The inter-color-component prediction can be performed using a prediction sample or a reconstructed sample of the luma component. For example, after performing inter prediction on the luma component, prediction for a color component can be performed by applying an inter-color-component prediction parameter to a prediction sample obtained from the inter prediction of the luma component. Here, the prediction sample refers to a sample on which at least one of motion compensation, motion refinement, overlapped block motion compensation (OBMC), and bi-directional optical flow (BIO) has been performed.

[0420] In addition, the inter-color-component prediction can be adaptively performed according to an encoding parameter of the first color component. For example, whether to perform the inter-color-component prediction can be determined according to CBF information of the first color component. The CBF information can be information indicating whether a residual signal exists. That is, when the CBF of the first color component is 1, inter-color-component prediction can be performed on a second color component. When the CBF of the first color component is 0, inter-color-component prediction can not be performed on the second color component, and inter prediction can be performed on the second color component. Alternatively, a flag indicating whether to perform the inter-color-component prediction can be signaled.

[0421] The flag indicating whether to perform the inter-color-component prediction can be signaled when an encoding parameter of the first color component satisfies a predetermined condition. For example, when the CBF of the first color component is 1, the flag can be signaled to determine whether to perform inter-color-component prediction.

[0422] When inter-color-component prediction is performed on the second color component, inter- frame motion prediction or compensation values for the second color component can be used. For example, inter- frame prediction information of the first color component can be used to perform inter- frame motion prediction or compensation on the second color component. In addition, the prediction can be performed by calculating a weighted sum of the inter- frame motion compensation values and the inter-color-component prediction values for the second color component.

[0423] According to another embodiment of the present application, representative sample based intra prediction can be performed. When representative sample based intra prediction is performed, the prediction can be performed using at least one of the following: block partitioning, representative sample determination, representative sample prediction, transform and quantization, intra prediction using representative samples, and reconstruction.

[0424] The current block can be divided into one or more sub-blocks. The size of the current block and / or the sub-blocks is denoted by WxH, where W and H are predetermined integers. For example, the size of the current block and / or the sub-blocks can be any one selected from among CTU, CU, Signaling Unit (SU), QTMax, QTMin, BTMax, BTMin, 4x4, 8x8, 16x16, 32x32, 64x64, 128x128, 4x8, 8x16, 16x8, 32x64, 32x8, 4x32, etc. In this case, QTMax and QTMin denote the maximum size and the minimum size of a block that can be generated by quad-tree partitioning, respectively. Among these sizes, BTMax and BTMin denote the maximum size and the minimum size of a block that can be generated by binary-tree partitioning, respectively.

[0425] The size of the sub-blocks varies depending on the size of the current block. For example, the size of the sub-blocks is equal to the size (width or height) of the current block divided by N. In this case, N can be a positive integer, more specifically, at least one of 2, 4, 8, 16, 32, and 64. For example, when the size of the current block is 32x32 and each of the width and the height of the current block is divided by 4 (i.e., N is 4), the size of the sub-blocks can be 8x8.

[0426] The size of the sub-blocks can be determined depending on the coding parameters of the neighboring blocks. For example, the size of the sub-blocks can be determined depending on whether the neighboring blocks are intra-coded blocks or inter-coded blocks. Alternatively, the size of the sub-blocks can be determined depending on the intra-prediction modes of the neighboring blocks. Alternatively, the size of the sub-blocks can be determined depending on whether the neighboring blocks are partitioned.

[0427] At least one of the dividable size of the current block, the size of the sub-blocks, and the value of the size of the current block divided by N can be a predetermined fixed size or a fixed value.

[0428] For example, when the divisible size of the current block is a fixed size of 16x16, the current block can be divided into sub-blocks in the case where the size of the current block is 16x16.

[0429] For example, when the size of the sub-block is fixed to a size of 4x4, the size of the sub-block is required to be always 4x4 regardless of the size of the current block.

[0430] For example, assuming that the divisible size of the current block is a CTU and the value of N is 4, the current block can be divided into sub-blocks by dividing each of the width and height of the current block by 4 in the case where the size of the current block corresponds to the CTU.

[0431] One or more of the sub-blocks can be divided into smaller sub-blocks. For example, in the case where the size of the current block is 32x32 and the size of the sub-block is 16x16, the sub-block can be divided into smaller sub-blocks of 8x8, 4x4, 16x8, 4x16, etc.

[0432] At least one of the divisible size of the current block, the size of the sub-block, and the value of the size of the current block divided by N can be determined through entropy encoding / decoding. Information of at least one of the divisible size of the current block, the size of the sub-block, and the value of the size of the current block divided by N can be predefined in the encoder and the decoder. Alternatively, the information can be signaled at a block level or a level higher than the block. The higher level includes a video, a sequence, a picture, a slice, a parallel block, a CTU, and a CU.

[0433] One or more samples in the current block or the sub-block can be determined as a representative sample.

[0434] The representative sample can be one or more samples located in a block, wherein the block can be the current block or the sub-block.

[0435] Figure 17 is a diagram illustrating an exemplary method of determining a representative sample.

[0436] In Figure 17 , the diagram denoted by (a) and (d) illustrates an example of the current block, and the diagram denoted by (b) and (c) illustrates an example of the sub-block obtained according to the division of the current block.

[0437] For example, referring to the diagram denoted by (a) in Figure 17 , a sample located at the lower right corner of the current block can be determined as the representative sample.

[0438] Alternatively, referring to the diagram denoted by (b) in Figure 17 , a sample located at the center of the current block can be determined as the representative sample.

[0439] Alternatively, referring to the diagram denoted by (c) in Figure 17In the diagram represented by (c) in FIG. 6, two samples respectively located at the lower right corner and the center of the current block can be determined as the representative samples.

[0440] The value of the representative sample can be at least one of an original sample value, a predicted sample value and a reconstructed sample value corresponding to the position described in the diagram represented by (a) to (c) in FIG. 6. Figure 17 The value of the representative sample can be at least one of an original sample value, a predicted sample value and a reconstructed sample value corresponding to the position described in the diagram represented by (a) to (c) in FIG. 6.

[0441] The position of the representative sample can be a fixed position. For example, the position can be the lower right corner of the block. In this case, information of the position of the representative sample does not need to be signaled.

[0442] Optionally, information indicating the position of the representative sample can be signaled.

[0443] Optionally, the number of the representative samples and / or the position of the representative samples can be determined based on at least one of the intra prediction mode of the current block (i.e., whether it is a directional mode or a non-directional mode and / or the specific direction in the case of a directional mode), the size of the current block and the shape of the current block.

[0444] The value of the representative sample is a statistical value of one or more samples around the position shown in the diagram represented by (a), (b) or (c) in FIG. 6. Figure 17 For example, as shown in the diagram represented by (d) in FIG. 6, when the position of the representative sample is determined as D, a statistical value of two or more samples selected from the samples A, B, C and D (i.e., the sample located at the specified position D and the neighboring samples located around the specified position D) can be determined as the value of the representative sample. In this case, examples of the statistical value include the mean value, the median value, the maximum value, the minimum value, the mode and the weighted average value. The position of the neighboring samples to be used is determined according to at least one of the intra prediction mode, the size and the shape of the current block.

[0445] Figure 17 For example, when the intra prediction mode is the vertical mode, the samples B and D can be used. For example, when the size of the block is equal to or larger than a predetermined size, all the samples A to D can be used. For example, when the block has a rectangular shape extending vertically, the samples B and D can be used.

[0446] For example, when the intra prediction mode is the vertical mode, the samples C and D can be used. For example, when the size of the block is equal to or smaller than a predetermined size, all the samples A to D can be used. For example, when the block has a rectangular shape extending vertically, the samples C and D can be used.

[0447] For example, when the position of the representative sample is determined as the center of the current block, a statistical value of one or more samples around the center of the current block can be determined as the value of the representative sample. In this case, examples of the statistical value include the mean value, the median value, the maximum value, the minimum value, the mode and the weighted average value.

[0448] For example, when the position of the representative sample is determined as the center of the current block, a statistical value of one or more samples around the center of the current block can be determined as the value of the representative sample. In this case, examples of the statistical value include the mean value, the median value, the maximum value, the minimum value, the mode and the weighted average value. Figure 18 ​When D in the diagram represented by (d) in FIG. 1 is determined, the average value of the samples A, B, C, and D (i.e., (A+B+C+D+2)>>2) is determined as the representative sample value. Alternatively, the weighted sum of the samples B, C, and D (i.e., (B+2xD+C+2)>>2) can be determined as the representative sample value. Alternatively, the median value of the samples A, B, C, and D can be determined as the representative sample value.

[0449] One or more of the operations of prediction, transform / inverse transform, and quantization / dequantization are performed on the determined representative sample.

[0450] The prediction of the representative sample can be performed using one or more reconstructed reference samples around the current block.

[0451] Figure 18 is a diagram illustrating an exemplary method of performing prediction on a representative sample.

[0452] Figure 18 Four blocks are illustrated, including a current block located in the lower right corner, a left neighboring block, an above neighboring block, and a left-above neighboring block. In Figure 18 In (d) in FIG. 1, a black dot in the current block represents a representative sample, and gray dots in the respective neighboring blocks represent reference samples. In the following description, a reference sample in the above neighboring block or within the above neighboring block is denoted by “A”, a reference sample in the left neighboring block or within the left neighboring block is denoted by “L”, and a reference sample in the left-above neighboring block or within the left-above neighboring block is denoted by “AL”.

[0453] For example, as Figure 19 illustrated in (d) in FIG. 1, the prediction of the value of the representative sample R located at the lower right corner position within the current block can be performed using at least one of the reconstructed reference samples within the above neighboring block A, the left neighboring block L, or the left-above neighboring block AL. The reconstructed reference sample can be a sample located at the lower right corner within the reconstructed neighboring block. Alternatively, the reconstructed reference sample can be a collocated sample within the reconstructed neighboring block. That is, within the reconstructed neighboring block, a sample located at a position corresponding to the position of the representative sample within the current block is referred to as a collocated sample. In this case, the representative sample value can be the original sample value of the sample at that position. For example, when the reconstructed reference samples within the above neighboring block A and the left neighboring block L are used, the predicted representative sample value “Pred_R” as the predicted value for the representative sample is derived by Equation 19 described below.

[0454] [Equation 19]

[0455] Pred_R = (A+L+1)>>1

[0456] In Equation 19, A denotes the value of the reconstructed reference sample within the above neighboring block A, and L denotes the value of the reconstructed reference sample within the left neighboring block.

[0457] Figure 19 is a diagram illustrating another exemplary method of performing prediction on representative samples.

[0458] In Figure 18 In the embodiment illustrated, the current block is divided into 16 sub-blocks. The left neighboring block, the above neighboring block, and the top-left neighboring block of the current block have the same size as the sub-blocks. For the understanding of the determination of the positions of the representative samples and the reference samples, the above description associated with Figure 19 is suitably referred to.

[0459] For example, with reference to the diagram represented by (a) in FIG. 1, the right-bottom corner sample within each of the sub-blocks within the current block is determined as the representative sample. In this case, with reference to the diagram represented by (b) in FIG. 1, a block is generated by aggregating the representative samples within each of the sub-blocks. In addition, the reference samples existing in the vicinity of the current block as illustrated by the diagram represented by (a) in FIG. 1 are used as the reconstructed reference samples of the newly generated block composed of the representative samples as illustrated by the diagram represented by (b) in FIG. 1 (hereinafter, referred to as a representative sample block). In this case, the reference samples are the samples within the neighboring blocks having the same x-coordinate value or the same y-coordinate value as the representative samples. Figure 19 Figure 19 Figure 19 Figure 19 Figure 19

[0460] Optionally, the average value of the reference samples neighboring the current block can be used as the prediction value of the representative sample. For example, the DC mode prediction value for the current block can be used as the prediction value of the representative sample. Optionally, the block composed of the representative samples as illustrated by the diagram represented by (b) in FIG. 1 (i.e., the representative sample block) can be used as the current block, and the method according to the present application can be applied. In this case, the representative sample block can be reconstructed. Figure 20

[0461] The representative sample residual signal corresponding to the difference between the value of the representative sample and the prediction value of the representative sample can be entropy encoded or entropy decoded.

[0462] The transform / inverse transform or the quantization / dequantization can be performed on the representative sample residual signal. In this case, the type of the transform / inverse transform can vary depending on the prediction mode of the representative sample.

[0463] After the representative sample is reconstructed using the prediction value of the representative sample and the residual signal, the intra prediction is performed on the current block based on the reconstructed representative sample. ​​​​​​

[0464] A reconstructed representative sample refers to a value obtained by performing inverse quantization and / or inverse transform on a representative sample residual signal to generate an operated value, and then adding a predicted representative sample (a predicted value of the representative sample) to the operated value. Hereinafter, a representative sample indicates a reconstructed representative sample.

[0465] The intra prediction of the current block can be performed using at least one of the reconstructed representative sample and the reference samples neighboring the current block.

[0466] The intra prediction can be performed using the reconstructed representative sample and the interpolation of each reference sample.

[0467] Figure 20 is a diagram illustrating an exemplary method of generating right column prediction samples and bottom row prediction samples of a current block by using a reconstructed representative sample and reference samples.

[0468] Figure 20 Four blocks are illustrated, including a current block (a lower right block in the diagram), a left neighboring block, an upper neighboring block, and a left upper neighboring block. In Figure 20 , black dots in the current block indicate representative samples, and gray dots in the respective neighboring blocks indicate reference samples.

[0469] For example, as Figure 21 illustrated, right column prediction samples (hatched dots) and bottom row prediction samples (hatched dots) of the current block are obtained by interpolating the representative sample located at the lower right corner and each reference sample. For example, when the size of the current block is 8x8, the bottom row prediction samples (predicted sample values at the bottom row) are calculated as (a*L+b*Re+4)>>3, where "a" and "b" indicate weights varying with the position of the sample to be predicted, L indicates a left lower reference sample, and Re indicates the representative sample located at the lower right corner within the current block.

[0470] The prediction samples for the respective samples within the block can be generated by using the reference samples and one or more of the bottom row prediction samples and the right column prediction samples.

[0471] Figure 21 is a diagram illustrating an exemplary method of performing prediction by using reference samples and right column or bottom row prediction samples.

[0472] Figure 20 An embodiment is illustrated in which samples within the current block are predicted using the right column and bottom row prediction samples generated by the method of Figure 21 .

[0473] As Figure 22As shown, the samples within the current block are predicted using an interpolation method. For example, when the size of the current block is 8x8, the predicted sample (the predicted sample value) is calculated as (a*L+b*R+c*A+d*B+8)>>4, where "a", "b", "c", and "d" represent weights that vary with the position of the sample to be predicted, L represents a reference sample on the left side of the current block, R represents a predicted sample on the right column within the current block, A represents a reference sample above the current block, and B represents a predicted sample on the bottom row within the current block.

[0474] To predict the samples within the current block, directional prediction or non-directional prediction is performed. In this case, directional intra prediction can be performed from the right column predicted samples and the bottom row predicted samples. Alternatively, bi-directional intra prediction can be performed from the reference samples and the right column predicted samples and the bottom row predicted samples. The prediction direction for performing directional intra prediction from the right column predicted samples and the bottom row predicted samples (hereinafter referred to as the second direction) is determined depending on the prediction direction for performing directional intra prediction from the reference samples (hereinafter referred to as the first direction). For example, the second direction is at an angle of 180° with respect to the first direction. Alternatively, the second direction can be determined independently of the first direction. For example, information about the first direction and information about the second direction can be independently signaled.

[0475] Figure 22 is a diagram illustrating an exemplary prediction method for a case where the current block is divided into sub-blocks.

[0476] Referring to ​ , the current block is divided into 16 sub-blocks. In this case, intra prediction based on the right-bottom reconstructed reference samples is performed on a sub-block basis. In this case, the intra prediction on each sub-block can be performed in parallel.

[0477] When the intra prediction based on the representative samples is performed, the residual signal of the current block can not be encoded / decoded. For example, the predicted samples generated based on the prediction of the representative samples are determined as the reconstructed samples of the current block.

[0478] Whether the intra prediction based on the representative samples is performed can be determined in the step of deriving the intra prediction mode. For example, a flag can be transmitted to determine whether the intra prediction based on the representative samples is performed on the current block. For example, the intra prediction mode based on the representative samples can be derived as one of the non-directional modes.

[0479] When the intra prediction or the inter prediction is performed, a first color component can be intra predicted and a second color component can be inter predicted. For example, the first color component is a luma component and the second color component is a chroma component. Conversely, the first color component can be a chroma component and the second color component can be a luma component.

[0480] As for applying the filter to the prediction samples, it can be determined whether to apply the filter depending on at least one of an intra prediction mode, a size (width and height), a block shape, a prediction based on a plurality of sample lines, and a color component of the current block. The filter refers to a method of filtering one or more prediction samples using one or more reference samples.

[0481] For example, when the intra prediction mode of the current block is a predetermined mode, the filter can be applied to the prediction samples. For example, the predetermined mode is a directional mode, a non-directional mode, a horizontal mode, or a vertical mode.

[0482] For example, when the size of the current block falls within a predetermined size range, the filter can be applied to the prediction samples. For example, when the width of the current block is less than 64 and the height of the current block is less than 64, the filter can be applied. Alternatively, when the width or the height of the current block is greater or less than a predetermined size, the filter can be applied.

[0483] For example, it can be determined whether to apply the filter to the prediction samples depending on a reference sample line used for prediction. For example, when the reference sample line used for prediction is a first reference sample line adjacent to the current block, the filter can be applied. On the other hand, when the reference sample line is one of a second reference sample line and a forward reference sample line located around the current block, the filter can not be applied. An indicator mrl_index can be used to determine the reference sample line. For example, when the index for the current block is zero, the filter is applied. However, when the value of the index for the current block is greater than zero, the filter is not applied.

[0484] For example, when the color component of the block element is a luma signal, the filter is applied. However, when the color component of the current block is a chroma signal, the filter is not applied.

[0485] The prediction of the current block can be performed by combining one or more of the above-described exemplary prediction methods.

[0486] For example, the prediction of the current block can be performed by calculating a weighted sum of a prediction value obtained using a predetermined non-directional intra prediction mode and a prediction value obtained using a predetermined directional intra prediction mode. In this case, the weight can vary depending on at least one of an intra prediction mode of the current block, a size / shape of the current block, and a position of a target sample of prediction.

[0487] For example, the prediction of the current block can be performed by calculating a weighted sum of a prediction value obtained using a predetermined intra prediction mode and a prediction value obtained using a predetermined inter prediction mode. In this case, the weight can vary depending on at least one of a coding mode of the current block, the intra prediction mode, the inter prediction mode, and a size / shape. For example, when the intra prediction mode is a non-directional mode such as DC or planar, a weight corresponding to 1 / 2 can be applied to the intra prediction samples and the inter prediction samples, respectively. Alternatively, when the intra prediction mode is a vertical mode, the weight for the intra prediction samples decreases as a distance from a reference sample line above the current block. Similarly, when the intra prediction mode is a horizontal mode, the weight for the intra prediction samples decreases as a distance from a reference sample line on the left side of the current block. The sum of the weight applied to the intra prediction samples and the weight applied to the inter prediction samples can be any one of powers of 2. That is, it can be any one of 4, 8, 16, 32, etc. For example, when the size of the current block is within a predetermined size range, a weight corresponding to 1 / 2 can be applied to the intra prediction samples and the inter prediction samples, respectively.

[0488] The intra prediction mode can be fixed to DC mode and planar mode, or can be determined by signaling information. Alternatively, the intra prediction mode can be any mode selected from MPM candidate modes, and can be determined by MPM candidate modes derived from intra prediction modes of neighboring blocks. The mode of the neighboring block can be replaced by a predetermined representative mode. For example, when the intra prediction mode of the neighboring block is a directional mode of a specific direction classified into a vertical direction group, the mode of the neighboring block is replaced by a vertical mode. On the other hand, when the intra prediction mode of the neighboring block is a directional mode of a specific direction classified into a horizontal direction group, the mode of the neighboring block is replaced by a horizontal mode.

[0489] The inter prediction can be at least one of DC mode, merge mode, and AMVP mode. When the inter prediction mode of the current block is the merge mode, the prediction of the current block can be performed by calculating a weighted sum of an inter prediction value obtained by using motion information corresponding to a merge index and a prediction value obtained by using the DC mode or the planar mode.

[0490] For example, the prediction of the current block can be performed by calculating a weighted sum of one or more predicted samples obtained by using a plurality of sample lines. For example, the prediction can be performed by calculating a weighted sum of a first prediction value obtained by using a first reference sample line near the current block and a second prediction value obtained by using a second reference sample line near the current block and a forward reference sample line. The reference sample line used to obtain the second prediction value can be the reference sample line indicated by the mrl_index. The weights for the first prediction value and the second prediction value can be equal. Alternatively, the weights for the first prediction value and the second prediction value can vary depending on at least one of an intra prediction mode of the current block, a size / shape of the current block, and a position of a sample for which the prediction is to be performed. The first prediction value can be a value predicted using a predetermined mode. For example, the first prediction value can be a value predicted using at least one of a DC mode and a planar mode. The second prediction value can be a value predicted using an intra prediction mode of the current block derived in the available intra prediction mode derivation step.

[0491] When the prediction is performed by calculating a weighted sum of one or more predicted samples, filtering can not be performed on the predicted samples.

[0492] The above embodiments can be performed in the same manner in the encoder and the decoder.

[0493] The order applied to the above embodiments can be different between the encoder and the decoder, or the order applied to the above embodiments can be the same in the encoder and the decoder.

[0494] The above embodiments can be performed on each of the luma signal and the chroma signal, or the above embodiments can be performed identically on the luma signal and the chroma signal.

[0495] The block shape to which the above embodiments of the present application are applied can have a square shape or a non-square shape.

[0496] The above embodiments of the present application can be applied depending on a size of at least one of an encoding block, a prediction block, a transform block, a block, a current block, a coding unit, a prediction unit, a transform unit, a unit, and a current unit. Here, the size can be defined as a minimum size or a maximum size or both the minimum size and the maximum size, so that the above embodiments are applied, or the size can be defined as a fixed size to which the above embodiments are applied. Further, in the above embodiments, a first embodiment can be applied to a first size, and a second embodiment can be applied to a second size. In other words, the above embodiments can be applied in combination depending on the sizes. Further, when the size is equal to or greater than the minimum size and equal to or smaller than the maximum size, the above embodiments can be applied. In other words, when the block size is included in a certain range, the above embodiments can be applied.

[0497] For example, the above embodiments can be applied when the size of the current block is 8x8 or larger. For example, the above embodiments can be applied when the size of the current block is 4x4 or larger. For example, the above embodiments can be applied when the size of the current block is equal to or smaller than 16x16. For example, the above embodiments can be applied when the size of the current block is equal to or larger than 16x16 and equal to or smaller than 64x64.

[0498] The above embodiments of the present application can be applied depending on a temporal layer. In order to identify a temporal layer to which the above embodiments can be applied, a corresponding identifier can be signaled, and the above embodiments can be applied to a designated temporal layer identified by the corresponding identifier. Here, the identifier can be defined as a lowest layer or a highest layer or both the lowest layer and the highest layer to which the above embodiments can be applied, or can be defined as a specific layer indicating that the embodiments are applied. In addition, a fixed temporal layer to which the embodiments are applied can be defined.

[0499] For example, the above embodiments can be applied when the temporal layer of the current picture is a lowest layer. For example, the above embodiments can be applied when the temporal layer identifier of the current picture is 1. For example, the above embodiments can be applied when the temporal layer of the current picture is a highest layer.

[0500] A slice type to which the above embodiments of the present application are applied can be defined, and the above embodiments can be applied depending on the corresponding slice type.

[0501] In the above embodiments, the method is described based on a flowchart having a series of steps or units, but the present application is not limited to the order of the steps, and some steps can be performed simultaneously with other steps or in a different order. In addition, it should be understood by one of ordinary skill in the art that the steps in the flowchart are not mutually exclusive, and other steps can be added to the flowchart or some of the steps can be deleted from the flowchart without affecting the scope of the present application.

[0502] The embodiments include various aspects of the examples. All possible combinations can not be described, but one of ordinary skill in the art will be able to recognize different combinations. Accordingly, the present application can include all substitutions, modifications, and changes within the scope of the claims.

[0503] Embodiments of the present application can be implemented in the form of program instructions, which are executed by various computer components and recorded in a computer-readable recording medium. The computer-readable recording medium can individually include program instructions, data files, data structures, etc., or can include a combination of program instructions, data files, data structures, etc. The program instructions recorded in the computer-readable recording medium can be specifically designed and constructed for the present application, or can be well-known to those skilled in the computer software technical field. Examples of the computer-readable recording medium include a magnetic recording medium such as a hard disk, a floppy disk, and a magnetic tape; an optical data storage medium such as a CD-ROM or a DVD-ROM; a magneto-optical medium such as a floptical disk; and a hardware device specially configured to store and implement program instructions such as a read-only memory (ROM), a random access memory (RAM), a flash memory, etc. Examples of the program instructions include not only machine language codes formatted by a compiler, but also high-level language codes that can be implemented by a computer using an interpreter. The hardware device can be configured to be operated by one or more software modules or vice versa to perform the processes according to the present application.

[0504] Although the present application has been described in terms of specific embodiments (such as detailed elements) and limited examples and drawings, they are provided only to help more fully understand the present application, and the present application is not limited to the above embodiments. Those skilled in the art to which the present application pertains will understand that various modifications and changes can be made to the above description.

[0505] Therefore, the spirit of the present application should not be limited to the above embodiments, and the entire scope of the appended claims and their equivalents will fall within the scope and spirit of the present application.

[0506] Industrial applicability

[0507] The present application can be used to encode / decode an image.

Claims

1. An image decoding method performed by an image decoding device, comprising: configuring reference samples for intra prediction of a current block by selecting a reference sample line among a plurality of reference sample lines neighboring the current block; and generating an intra prediction block of the current block by performing intra prediction for the current block based on an intra prediction mode of the current block and the reference samples, wherein the intra prediction mode of the current block is obtained from one candidate list among a plurality of candidate lists based on a first MPM flag and a second MPM flag, wherein the plurality of candidate lists comprises a first MPM list and a second MPM list, wherein intra prediction modes included in the first MPM list are not included in the second MPM list, wherein whether the second MPM list is configured is determined based on the first MPM flag, wherein whether the intra prediction mode of the current block is included in the second MPM list is determined based on the second MPM flag, wherein the first MPM flag is signaled from a bitstream in response to the selected reference sample line being a first reference sample line among the plurality of reference sample lines, and wherein the first MPM flag and the second MPM flag are not signaled from the bitstream and an MPM index indicating the intra prediction mode of the current block is obtained based on the MPM index in response to the selected reference sample line not being the first reference sample line among the plurality of reference sample lines.

2. The method of claim 1, wherein the second MPM list comprises intra prediction modes of neighboring blocks of the current block.

3. An image encoding method performed by an image encoding device, comprising: configuring reference samples for intra prediction of a current block by selecting a reference sample line among a plurality of reference sample lines neighboring the current block; and generating an intra prediction block of the current block by performing intra prediction for the current block based on an intra prediction mode of the current block and the reference samples, wherein a first MPM flag and a second MPM flag are encoded based on the intra prediction mode of the current block obtained from one candidate list among a plurality of candidate lists, wherein the plurality of candidate lists comprises a first MPM list and a second MPM list, wherein intra prediction modes included in the first MPM list are not included in the second MPM list, wherein a value of the first MPM flag is determined based on whether the second MPM list is configured, wherein a value of the second MPM flag is determined based on whether the intra prediction mode of the current block is included in the second MPM list, wherein the first MPM flag is encoded into a bitstream in response to the selected reference sample line being a first reference sample line among the plurality of reference sample lines, and wherein the first MPM flag and the second MPM flag are not encoded into the bitstream and an MPM index indicating the intra prediction mode of the current block is encoded into the bitstream in response to the selected reference sample line not being the first reference sample line among the plurality of reference sample lines.

4. A method of transmitting a bitstream generated by an encoding method, the encoding method comprising: configuring reference samples for intra prediction of the current block by selecting a reference sample line among a plurality of reference sample lines neighboring the current block; and generating an intra prediction block of the current block by performing the intra prediction for the current block based on the intra prediction mode of the current block and the reference samples, wherein the first MPM flag and the second MPM flag are encoded based on the intra prediction mode of the current block obtained from one of a plurality of candidate lists, wherein the plurality of candidate lists comprises a first MPM list and a second MPM list, wherein the intra prediction modes included in the first MPM list are not included in the second MPM list, wherein a value of the first MPM flag is determined based on whether the second MPM list is configured, wherein a value of the second MPM flag is determined based on whether the intra prediction mode of the current block is included in the second MPM list, wherein the first MPM flag is encoded into the bitstream in response to the selected reference sample line being a first reference sample line among the plurality of reference sample lines, and wherein the first MPM flag and the second MPM flag are not encoded into the bitstream and an MPM index indicating the intra prediction mode of the current block is encoded into the bitstream in response to the selected reference sample line not being the first reference sample line among the plurality of reference sample lines.

Citation Information

Patent Citations

  • Method and apparatus of video coding

    US20170251213A1

  • Method and apparatus for processing video signal

    WO2017176030A1