IMAGE ENCODING / DECODING METHODS AND COMPUTER-BASED READ-AND-WRITING MEDIA FOR NON-INTERNAL STORAGE OF BIT STREAMS

VN127618APending Publication Date: 2026-08-03ELECTRONICS & TELECOMM RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
VN1202604973
Authority / Receiving Office
VN · VN
Patent Type
Applications
Current Assignee / Owner
Priority Date
2020-01-13
Filing Date
2020-04-29
Publication Date
2026-08-03

AI Technical Summary

Technical Problem

Existing video encoding/decoding methods face inefficiencies in encoding and decoding high-resolution, high-quality images due to increased data volume, particularly in cross-component prediction, where accuracy is compromised by varying color formats and subsampling factors, leading to optimization challenges in software and hardware implementation.

Method used

The method involves determining intra-prediction modes for blocks, performing cross-component prediction on luminance blocks, and using specific filter techniques for down-sampling, ensuring accurate prediction by considering various color formats and subsampling factors, and simplifying down-sampling processes for internal and neighboring samples.

Benefits of technology

This approach enhances encoding/decoding efficiency, ensures accurate cross-component prediction, and optimizes software and hardware implementation by using a single down-sampling filter regardless of location, thereby improving the overall video encoding/decoding process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure VN1202604973_0
    Figure VN1202604973_0
Patent Text Reader

Abstract

The invention relates to a method for encoding / decoding images. The method for decoding images consists of a step to determine the in-image prediction mode of the current block, and a step to generate a prediction block of the current block by performing a prediction based on the in-image prediction mode. When the in-image prediction mode of the current block is matrix-based in-image prediction mode (MIP), the length of the reference sample used for the in-image prediction procedure is inferred from the length of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

Video encoding / decoding method, device, and recording medium storing bitstream

[0001] The present invention relates to a video encoding / decoding method, device, and recording medium storing a bitstream. Specifically, the present invention relates to a method and device for encoding / decoding a video using cross-component prediction.

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

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

[0004] Conventional encoding / decoding methods and devices utilizing cross-component prediction have the disadvantage that, when downsampling is performed, various types of downsampling filters are selectively used depending on the location of downsampling and the availability of surrounding pixels, making optimization difficult in software and hardware implementation. Furthermore, the conventional techniques fail to account for various color formats and subsampling factors, potentially reducing the accuracy of cross-component prediction.

[0005] The purpose of the present invention is to provide a video encoding / decoding method and device with improved encoding / decoding efficiency.

[0006] In addition, the present invention aims to provide an image encoding / decoding method and device capable of performing accurate cross-component prediction by considering various color formats and sub-sampling factors.

[0007] In addition, the present invention aims to provide a recording medium storing a bitstream generated by an image decoding method or device according to the present invention.

[0008] A video decoding method according to one embodiment of the present invention includes a step of determining an intra-screen prediction mode of a current block and a step of generating a prediction block of the current block by performing prediction based on the intra-screen prediction mode, wherein when the intra-screen prediction mode of the current block is a MIP (Matrix-based Intra Prediction) mode, the length of a reference sample used for the intra-screen prediction can be derived based on the length of the current block.

[0009] In the above image decoding method, the reference sample includes an upper reference sample and a left reference sample, and the length of the upper reference sample can be derived as the horizontal length of the current block + 1, and the length of the left reference sample can be derived as the vertical length of the current block + 1.

[0010] In the above image decoding method, the reference sample may include an upper reference sample and a left reference sample, and the length of the upper reference sample may be derived as twice the horizontal length of the current block, and the length of the left reference sample may be derived as twice the vertical length of the current block.

[0011] In the above image decoding method, when the current block is a chrominance block and the within-screen prediction mode of the current block is a cross-component prediction mode, the within-screen prediction of the current block may include the steps of generating a peripheral sample of a luminance block corresponding to the current block, performing down-sampling on the peripheral sample of the luminance block, deriving a cross-component parameter based on the peripheral sample on which the down-sampling was performed, and generating a prediction block of the current block based on the cross-component parameter.

[0012] In the above image decoding method, the surrounding samples of the luminance block include at least one of an upper surrounding sample and a left surrounding sample, and when the surrounding samples of the luminance block are not available, the unavailable surrounding samples can be replaced with internal samples of the luminance block.

[0013] In the above image decoding method, when the unavailable peripheral sample is the upper peripheral sample, the internal sample of the luminance block may be an internal sample adjacent to the upper boundary of the luminance block, and when the unavailable peripheral sample is the left peripheral sample, the internal sample of the luminance block may be an internal sample adjacent to the left boundary of the luminance block.

[0014] In the above image decoding method, the unavailable upper peripheral sample and the internal sample adjacent to the upper boundary of the luminance block may have the same x-coordinate, and the unavailable left peripheral sample and the internal sample adjacent to the left boundary of the luminance block may have the same y-coordinate.

[0015] In the above image decoding method, the surrounding samples of the luminance block include at least one of an upper surrounding sample and a left surrounding sample, and a filter used for downsampling the upper surrounding sample can be determined differently based on at least one of information about whether the upper boundary of the current block is a CTU boundary and information about the positions of a chrominance signal and a corresponding luminance signal.

[0016] In the above image decoding method, the surrounding samples of the luminance block include at least one of an upper surrounding sample and a left surrounding sample, and a filter used for downsampling for the left surrounding sample can be determined differently based on information about the positions of a chrominance signal and a corresponding luminance signal.

[0017] In the above image decoding method, the intra-screen prediction of the current block further includes a step of performing downsampling on internal samples of the luminance block, and a filter used for downsampling on internal samples of the luminance block may be determined differently based on at least one of information regarding the availability of the surrounding samples and information regarding the positions of the chrominance signal and the corresponding luminance signal.

[0018] A video encoding method according to another embodiment of the present invention includes a step of determining an intra-screen prediction mode of a current block and a step of generating a prediction block of the current block by performing prediction based on the intra-screen prediction mode, wherein when the intra-screen prediction mode of the current block is a MIP (Matrix-based Intra Prediction) mode, the length of a reference sample used for the intra-screen prediction can be derived based on the length of the current block.

[0019] In the above image encoding method, the reference sample includes an upper reference sample and a left reference sample, and the length of the upper reference sample can be derived as the horizontal length of the current block + 1, and the length of the left reference sample can be derived as the vertical length of the current block + 1.

[0020] In the above video encoding method, the reference sample may include an upper reference sample and a left reference sample, and the length of the upper reference sample may be derived as twice the horizontal length of the current block, and the length of the left reference sample may be derived as twice the vertical length of the current block.

[0021] In the above image encoding method, when the current block is a chrominance block and the within-screen prediction mode of the current block is a cross-component prediction mode, the within-screen prediction of the current block may include the steps of generating a peripheral sample of a luminance block corresponding to the current block, performing down-sampling on the peripheral sample of the luminance block, deriving a cross-component parameter based on the peripheral sample on which the down-sampling was performed, and generating a prediction block of the current block based on the cross-component parameter.

[0022] In the above image encoding method, the surrounding samples of the luminance block include at least one of an upper surrounding sample and a left surrounding sample, and when the surrounding samples of the luminance block are not available, the unavailable surrounding samples can be replaced with internal samples of the luminance block.

[0023] In the above image encoding method, when the unavailable peripheral sample is the upper peripheral sample, the internal sample of the luminance block may be an internal sample adjacent to the upper boundary of the luminance block, and when the unavailable peripheral sample is the left peripheral sample, the internal sample of the luminance block may be an internal sample adjacent to the left boundary of the luminance block.

[0024] In the above image encoding method, the surrounding samples of the luminance block include at least one of an upper surrounding sample and a left surrounding sample, and a filter used for downsampling the upper surrounding sample can be determined differently based on at least one of information about whether the upper boundary of the current block is a CTU boundary and information about the positions of a chrominance signal and a corresponding luminance signal.

[0025] In the above image encoding method, the surrounding samples of the luminance block include at least one of an upper surrounding sample and a left surrounding sample, and a filter used for downsampling for the left surrounding sample can be determined differently based on information about the positions of a chrominance signal and a corresponding luminance signal.

[0026] In the above image encoding method, the intra-screen prediction of the current block further includes a step of performing downsampling on internal samples of the luminance block, and a filter used for downsampling on internal samples of the luminance block may be determined differently based on at least one of information regarding the availability of the surrounding samples and information regarding the positions of the chrominance signal and the corresponding luminance signal.

[0027] According to another embodiment of the present invention, a computer-readable recording medium is a non-transitory computer-readable recording medium storing a bitstream generated by an image encoding method, wherein the image encoding method includes a step of determining an intra-screen prediction mode of a current block and a step of generating a prediction block of the current block by performing prediction based on the intra-screen prediction mode, and when the intra-screen prediction mode of the current block is a MIP (Matrix-based Intra Prediction) mode, a length of a reference sample used for the intra-screen prediction can be derived based on a length of the current block.

[0028] According to the present invention, a video encoding / decoding method and device with improved encoding / decoding efficiency can be provided.

[0029] In addition, according to the present invention, an image encoding / decoding method and device capable of performing accurate cross-component prediction by considering various color formats and sub-sampling factors can be provided.

[0030] Additionally, according to the present invention, downsampling of internal samples of a specific component block can be simplified.

[0031] Additionally, according to the present invention, downsampling of upper peripheral samples of a specific component block can be simplified.

[0032] Additionally, according to the present invention, downsampling of left peripheral samples of a specific component block can be simplified.

[0033] In addition, according to the present invention, a recording medium storing a bitstream generated by an image encoding method or device according to the present invention can be provided.

[0034] In addition, according to the present invention, a recording medium storing a bitstream received and decoded by an image decoding device according to the present invention and used for image restoration can be provided.

[0035] In addition, according to the present invention, when performing downsampling in inter-component prediction, an image encoding / decoding method and device that are easy to optimize in software and hardware implementation can be provided by using a single downsampling filter for a valid sample or a virtual sample regardless of the location where downsampling is performed and the validity of surrounding samples.

[0036] In addition, according to the present invention, a video encoding / decoding method and device can be provided that performs intra-screen prediction after always generating all surrounding samples as valid samples or virtual samples for all intra-screen prediction modes.

[0037] Figure 1 is a block diagram showing the configuration according to one embodiment of an encoding device to which the present invention is applied.

[0038] Figure 2 is a block diagram showing the configuration according to one embodiment of a decryption device to which the present invention is applied.

[0039] Figure 3 is a diagram schematically showing the image segmentation structure when encoding and decoding an image.

[0040] Figure 4 is a diagram for explaining an embodiment of an on-screen prediction process.

[0041] Figure 5 is a diagram for explaining an embodiment of a screen-to-screen prediction process.

[0042] Figure 6 is a diagram for explaining the process of transformation and quantization.

[0043] Figure 7 is a diagram illustrating reference samples available for prediction within the screen.

[0044] FIG. 8 is a diagram for explaining a process of performing cross-component prediction according to one embodiment of the present invention.

[0045] FIG. 9 and FIG. 10 are diagrams for explaining a process in which peripheral availability information of a first component block derived using peripheral availability information of a second component block is expanded according to one embodiment of the present invention.

[0046] FIG. 11 is a diagram for explaining a process in which peripheral availability information of a first component block derived using peripheral availability information of a second component block is expanded when the uppermost position of the current block is the same as the upper boundary of the CTU, according to one embodiment of the present invention.

[0047] FIG. 12 is a diagram illustrating an embodiment of availability information used in generating peripheral samples of a first component block according to one embodiment of the present invention.

[0048] FIG. 13 is a drawing showing an example of generating a peripheral sample line according to a color format, according to one embodiment of the present invention.

[0049] FIG. 14 is a diagram illustrating an example of generation of peripheral sample lines according to a syntax element indicating a sub-sampling method for a chrominance block according to one embodiment of the present invention.

[0050] FIG. 15 is a diagram for explaining a process of performing downsampling when the upper and left boundaries of the current block are identical to the CTU boundaries, according to one embodiment of the present invention.

[0051] FIGS. 16 and 17 are diagrams for explaining down-sampling center positions for a first component block according to surrounding availability information when performing down-sampling for surrounding samples of a specific location, according to one embodiment of the present invention.

[0052] FIG. 18 and FIG. 19 are flowcharts illustrating a process for performing down-sampling on internal samples of a first component block according to one embodiment of the present invention.

[0053] FIG. 20 and FIG. 21 are flowcharts illustrating a process for performing down sampling on upper peripheral samples of a first component block according to one embodiment of the present invention.

[0054] FIG. 22 and FIG. 23 are flowcharts illustrating a process for performing down-sampling on left peripheral samples of a first component block according to one embodiment of the present invention.

[0055] FIG. 24 is a diagram for explaining a process of generating a virtual sample by using available surrounding samples when there is an unavailable sample among surrounding samples, according to one embodiment of the present invention.

[0056] FIG. 25 is a diagram illustrating a simplified embodiment of syntax elements related to MRL (Multiple Reference Line) according to one embodiment of the present invention.

[0057] FIGS. 26 to 31 are diagrams for explaining one embodiment of a cross-component prediction process according to the present invention.

[0058] Figures 32 to 57 are drawings for explaining various modified examples of the cross component prediction process according to the present invention.

[0059] The present invention is susceptible to various modifications and embodiments. Therefore, specific embodiments are illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present invention to specific embodiments, but rather to include all modifications, equivalents, and substitutes included within the spirit and scope of the present invention. In the drawings, similar reference numerals designate the same or similar functions throughout. The shape and size of elements in the drawings may be exaggerated for clarity. The detailed description of the exemplary embodiments described below refers to the accompanying drawings, which illustrate specific embodiments by way of example. These embodiments are described in sufficient detail to enable those skilled in the art to practice the embodiments. It should be understood that the various embodiments, while different, are not necessarily mutually exclusive. For example, specific shapes, structures, and characteristics described herein may be implemented in other embodiments without departing from the spirit and scope of the present invention. Furthermore, it should be understood that the location or arrangement of individual components within each disclosed embodiment may be changed without departing from the spirit and scope of the embodiment. Accordingly, the detailed description set forth below is not intended to be taken in a limiting sense, and the scope of the exemplary embodiments, if properly described, is defined only by the appended claims, along with the full scope equivalents to which such claims are entitled.

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

[0061] When a component of the present invention is referred to as being "connected" or "connected" to another component, it should be understood that it may be directly connected or connected to that other component, but that other components may also be present in between. Conversely, when a component is referred to as being "directly connected" or "directly connected" to another component, it should be understood that no other components are present in between.

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

[0063] The terminology used in the present invention is only used to describe specific embodiments and is not intended to limit the present invention. The singular expression includes plural expressions unless the context clearly indicates otherwise. In the present invention, it should be understood that the terms "comprise" or "have" are intended to specify the presence of a feature, number, step, operation, component, part, or combination thereof described in the specification, but do not exclude in advance the possibility of the presence or addition of one or more other features, numbers, steps, operations, components, parts, or combinations thereof. In other words, the description of a specific configuration in the present invention as "comprising" does not exclude configurations other than the specified configuration, and means that additional configurations may be included in the scope of the implementation of the present invention or the technical idea of ​​the present invention.

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

[0065] Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In describing the embodiments of this specification, if it is determined that a detailed description of a related known configuration or function may obscure the gist of this specification, the detailed description will be omitted. The same reference numerals will be used for identical components in the drawings, and duplicate descriptions of identical components will be omitted.

[0066] Hereinafter, the term "video" may refer to a single picture constituting a video, or may refer to the video itself. For example, "encoding and / or decoding of a video" may refer to "encoding and / or decoding of a video," or may refer to "encoding and / or decoding of one of the videos constituting the video."

[0067] Hereinafter, the terms “movie” and “video” may be used interchangeably and have the same meaning.

[0068] Hereinafter, the target image may be an encoding target image, which is the target of encoding, and / or a decoding target image, which is the target of decoding. Furthermore, the target image may be an input image input to an encoding device, or an input image input to a decoding device. Here, the target image may have the same meaning as the current image.

[0069] Hereinafter, the terms “image”, “picture”, “frame” and “screen” may be used interchangeably and have the same meaning.

[0070] Hereinafter, the target block may be an encoding target block that is the target of encoding and / or a decoding target block that is the target of decoding. Furthermore, the target block may be a current block that is the target of current encoding and / or decoding. For example, the terms "target block" and "current block" may be used interchangeably and have the same meaning.

[0071] Hereinafter, the terms "block" and "unit" may be used interchangeably and have the same meaning. Alternatively, "block" may refer to a specific unit.

[0072] Hereinafter, the terms “region” and “segment” may be used interchangeably.

[0073] Hereinafter, a specific signal may be a signal representing a specific block. For example, the original signal may be a signal representing a target block. The prediction signal may be a signal representing a predicted block. The residual signal may be a signal representing a residual block.

[0074] In the embodiments, each of the specified information, data, flags, indices, and elements, attributes, etc., can have a value. The value "0" of the information, data, flags, indices, and elements, attributes, etc., can represent logical false or a first predefined value. That is, the values ​​"0", false, logical false, and the first predefined value can be used interchangeably with each other. The value "1" of the information, data, flags, indices, and elements, attributes, etc., can represent logical true or a second predefined value. That is, the values ​​"1", true, logical true, and the second predefined value can be used interchangeably with each other.

[0075] When a variable such as i or j is used to represent a row, column, or index, the value of i can be an integer greater than or equal to 0, or an integer greater than or equal to 1. That is, in the embodiments, rows, columns, and indices can be counted from 0, or can be counted from 1.

[0076]

[0077] Glossary of Terms

[0078] Encoder: refers to a device that performs encoding. In other words, it can mean an encoding device.

[0079] Decoder: Refers to a device that performs decoding. In other words, it can refer to a decoding device.

[0080] Block: An MxN array of samples. Here, M and N can represent positive integer values, and a block can commonly represent a two-dimensional sample array. A block can represent a unit. The current block can represent an encoding target block that is the target of encoding during encoding, and a decoding target block that is the target of decoding during decoding. In addition, the current block can be at least one of an encoding block, a prediction block, a residual block, and a transform block.

[0081] Sample: The basic unit that constitutes a block. Bit depth (B) d ) from 0 to 2 Bd - It can be expressed as a value up to 1. In the present invention, a sample can be used with the same meaning as a pixel or a pixel. That is, a sample, a pixel, and a pixel can have the same meaning.

[0082] Unit: This may refer to a unit of image encoding and decoding. In image encoding and decoding, a unit may be a region into which one image is divided. In addition, a unit may refer to a divided unit when one image is divided into detailed units and encoded or decoded. That is, one image may be divided into multiple units. In image encoding and decoding, predefined processing may be performed for each unit. One unit may be further divided into sub-units having a smaller size than the unit. Depending on the function, a unit may refer to 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, a unit may mean a luminance component block, a corresponding chroma component block, and a syntax element for each block to distinguish it from a block. The unit may have various sizes and shapes, and in particular, the shape of the unit may include a geometric shape that can be expressed in two dimensions, such as a square, a rectangle, a trapezoid, a triangle, a pentagon, etc. In addition, the unit information may include at least one or more of the type of the unit indicating an encoding unit, a prediction unit, a residual unit, a transformation unit, etc., the size of the unit, the depth of the unit, the encoding and decoding order of the unit, etc.

[0083] Coding Tree Unit: It consists of one luminance component (Y) coding tree block and two chrominance component (Cb, Cr) coding tree blocks related to it. It may also mean including the blocks and syntax elements for each block. Each coding tree unit may be split using one or more splitting methods such as a quad tree, a binary tree, a ternary tree, etc. to form lower units such as a coding unit, a prediction unit, a transformation unit, etc. It may be used as a term to refer to a sample block that becomes a processing unit in the process of decoding / encoding an image, such as splitting an input image. Here, a quad tree may mean a quarternary tree.

[0084] If the size of the coding block falls within a predetermined range, splitting may only be possible using a quad tree. Here, the predetermined range may be defined as at least one of the maximum size and the minimum size of the coding block that can be split using a quad tree. Information indicating the maximum / minimum size of the coding block that allows splitting using a quad tree form may be signaled through a bitstream, and the information may be signaled in units of at least one of a sequence, a picture parameter, a tile group, or a slice (segment). Alternatively, the maximum / minimum size of the coding block may be a fixed size pre-set in the encoder / decoder. For example, if the size of the coding block is 256x256 to 64x64, splitting may only be possible using a quad tree. Alternatively, if the size of the coding block is larger than the size of the maximum transform block, splitting may only be possible using a quad tree. In this case, the block to be split may be at least one of the coding block or the transform block. In such cases, the information indicating the division of the encoding block (e.g., split_flag) may be a flag indicating whether or not the encoding block is divided into a quad tree. If the size of the encoding block falls within a certain range, division may only be possible into a binary tree or a 3-split tree. In this case, the above description regarding the quad tree may be equally applicable to the binary tree or the 3-split tree.

[0085] Coding Tree Block: This term can be used to refer to any one of the Y coding tree block, Cb coding tree block, and Cr coding tree block.

[0086] Neighbor block: This may refer to a block adjacent to the current block. A block adjacent to the current block may refer to a block whose boundary is adjacent to the current block or a block located within a certain distance from the current block. A neighboring block may refer to a block adjacent to a vertex of the current block. Here, a block adjacent to a vertex of the current block may refer to 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. A neighboring block may also refer to a restored neighboring block.

[0087] Reconstructed Neighbor Block: This may refer to a neighboring block that has already been spatially / temporally encoded or decoded around the current block. In this case, the reconstructed neighboring block may refer to a reconstructed neighboring unit. The reconstructed spatial neighboring block may be a block within the current picture that has already been reconstructed through encoding and / or decoding. The reconstructed temporal neighboring block may be a reconstructed block or a neighboring block of a location corresponding to the current block of the current picture within the reference image.

[0088] Unit Depth: This can indicate the degree to which a unit has been divided. In a tree structure, the root node corresponds to the initial, undivided unit. This root node can be referred to as the root node. Furthermore, the root node can have the minimum depth. In this case, the root node can have a depth of level 0. A node with a depth of level 1 can represent a unit created by splitting the initial unit once. A node with a depth of level 2 can represent a unit created by splitting the initial unit twice. A node with a depth of level n can represent a unit created by splitting the initial unit n times. A leaf node can be the lowest node and cannot be further divided. The depth of a leaf node can be the maximum level. For example, the default value for the maximum level can be 3. The root node can be said to have the shallowest depth, and the leaf node can have the deepest depth. Additionally, when units are represented in a tree structure, the level at which a unit exists can indicate unit depth.

[0089] Bitstream: This can mean a string of bits containing encoded image information.

[0090] Parameter Set: Corresponds to header information among the structures in the bitstream. At least one of a video parameter set, a sequence parameter set, a picture parameter set, and an adaptation parameter set may be included in the parameter set. In addition, the parameter set may also include tile group, slice header, and tile header information. In addition, the tile group may mean a group including multiple tiles, and may have the same meaning as a slice.

[0091] An adaptation parameter set may refer to a parameter set that can be shared and referenced by different pictures, subpictures, slices, tile groups, tiles, or bricks. Furthermore, subpictures, slices, tile groups, tiles, or bricks within a picture may reference different adaptation parameter sets and use information within the adaptation parameter set.

[0092] Additionally, adaptation parameter sets can reference different adaptation parameter sets using identifiers of different adaptation parameter sets in subpictures, slices, tile groups, tiles, or bricks within a picture.

[0093] Additionally, adaptation parameter sets can reference different adaptation parameter sets within a slice, tile group, tile, or brick within a subpicture using identifiers of different adaptation parameter sets.

[0094] Additionally, different adaptation parameter sets can be referenced by using identifiers of different adaptation parameter sets within tiles or bricks within a slice.

[0095] Additionally, the adaptation parameter sets can reference different adaptation parameter sets using identifiers of different adaptation parameter sets within the bricks within the tile.

[0096] By including information about an adaptation parameter set identifier in the parameter set or header of the above subpicture, an adaptation parameter set corresponding to the adaptation parameter set identifier can be used in the subpicture.

[0097] By including information about an adaptation parameter set identifier in the parameter set or header of the above tile, an adaptation parameter set corresponding to the adaptation parameter set identifier can be used in the tile.

[0098] By including information about an adaptation parameter set identifier in the header of the above brick, an adaptation parameter set corresponding to the adaptation parameter set identifier can be used in the brick.

[0099] The above picture can be divided into one or more rows of tiles and one or more columns of tiles.

[0100] The above subpicture may be divided into one or more tile rows and one or more tile columns within the picture. The above subpicture is a rectangular / square region within the picture and may include one or more CTUs. Additionally, one subpicture may include at least one tile / brick / slice.

[0101] The above tile is a rectangular / square area within the picture and may include one or more CTUs. In addition, the tile may be divided into one or more bricks.

[0102] The above brick may represent one or more CTU rows within a tile. A tile may be divided into one or more bricks, and each brick may have at least one CTU row. A tile that is not divided into two or more tiles may also represent a brick.

[0103] The above slice may include one or more tiles within a picture, and may include one or more bricks within a tile.

[0104] Parsing: This can mean entropy decoding a bitstream to determine the value of a syntax element, or it can mean entropy decoding itself.

[0105] Symbol: It can mean at least one of the syntactic elements of the target unit for encoding / decoding, the coding parameter, the value of the transform coefficient, etc. In addition, the symbol can mean the target of entropy encoding or the result of entropy decoding.

[0106] Prediction Mode: This can be information indicating a mode in which encoding / decoding is performed with intra-screen prediction or a mode in which encoding / decoding is performed with inter-screen prediction.

[0107] Prediction Unit: This can refer to the basic unit used when performing predictions, such as inter-screen prediction, intra-screen prediction, inter-screen compensation, intra-screen compensation, and motion compensation. A single prediction unit can be divided into multiple partitions or multiple sub-prediction units of smaller sizes. Multiple partitions can also be the basic unit for performing prediction or compensation. Partitions created by dividing a prediction unit can also be prediction units.

[0108] Prediction Unit Partition: This can refer to the form in which the prediction unit is divided.

[0109] Reference Picture List: This may refer to a list containing one or more reference pictures used for inter-frame prediction or motion compensation. The types of reference picture lists may include LC (List Combined), L0 (List 0), L1 (List 1), L2 (List 2), L3 (List 3), etc., and one or more reference picture lists may be used for inter-frame prediction.

[0110] Inter-Prediction Indicator: This can indicate the inter-prediction direction (unidirectional prediction, bidirectional prediction, etc.) of the current block. Alternatively, it can indicate the number of reference images used to generate the prediction block for the current block. Alternatively, it can indicate the number of prediction blocks used when performing inter-prediction or motion compensation for the current block.

[0111] Prediction list utilization flag: Indicates whether a prediction block is generated using at least one reference picture within a specific reference picture list. The prediction list utilization flag can be used to derive an inter-screen prediction indicator, and conversely, the prediction list utilization flag can be derived using the inter-screen prediction indicator. For example, when the prediction list utilization flag indicates a first value of 0, it can indicate that a prediction block is not generated using a reference picture within the reference picture list, and when it indicates a second value of 1, it can indicate that a prediction block can be generated using the reference picture list.

[0112] Reference Picture Index: This may refer to an index that indicates a specific reference picture in the reference picture list.

[0113] Reference Picture: This may refer to an image referenced by a specific block for inter-frame prediction or motion compensation. Alternatively, the reference picture may be an image that includes a reference block referenced by the current block for inter-frame prediction or motion compensation. Hereinafter, the terms "reference picture" and "reference picture" may be used interchangeably and have the same meaning.

[0114] Motion Vector: This can be a two-dimensional vector used for inter-frame prediction or motion compensation. A motion vector can indicate the offset between a target block to be encoded / decoded and a reference block. For example, (mvX, mvY) can represent a motion vector. mvX can represent the horizontal component, and mvY can represent the vertical component.

[0115] Search Range: The search range can be a two-dimensional region where motion vectors are searched during inter-frame prediction. For example, the search range can have dimensions MxN, where M and N can each be positive integers.

[0116] Motion Vector Candidate: When predicting a motion vector, this can refer to a block that becomes a prediction candidate or the motion vector of that block. Additionally, the motion vector candidate can be included in a motion vector candidate list.

[0117] Motion Vector Candidate List: This may refer to a list constructed using one or more motion vector candidates.

[0118] Motion Vector Candidate Index: This may refer to an indicator pointing to a motion vector candidate within the motion vector candidate list. It may be the index of a motion vector predictor.

[0119] Motion Information: may mean information including at least one of a motion vector, a reference image index, an inter-screen prediction indicator, a prediction list utilization flag, reference image list information, a reference image, a motion vector candidate, a motion vector candidate index, a merge candidate, and a merge index.

[0120] Merge Candidate List: This may refer to a list constructed using one or more merge candidates.

[0121] Merge Candidate: This can refer to a spatial merge candidate, a temporal merge candidate, a combined merge candidate, a combined bi-prediction merge candidate, a zero-merge candidate, etc. Merge candidates can include motion information such as inter-frame prediction indicators, reference image indices for each list, motion vectors, prediction list utilization flags, and inter-frame prediction indicators.

[0122] Merge Index: This may refer to an indicator that points to a merge candidate within the merge candidate list. Furthermore, the merge index may indicate the block that derived the merge candidate among the restored blocks spatially and temporally adjacent to the current block. Furthermore, the merge index may indicate at least one piece of motion information associated with the merge candidate.

[0123] Transform Unit: This can refer to a basic unit when performing residual signal encoding / decoding, such as transform, inverse transform, quantization, inverse quantization, and transform coefficient encoding / decoding. One transform unit can be divided into multiple lower transform units having smaller sizes. Here, the transform / inverse transform can include at least one of a primary transform / inverse transform and a secondary transform / inverse transform.

[0124] Scaling: This can refer to the process of multiplying a quantized level by a factor. The result of scaling the quantized level can be a transform coefficient. Scaling can also be called dequantization.

[0125] Quantization Parameter: This can refer to a value used when generating quantized levels using transform coefficients in quantization. Alternatively, it can refer to a value used when generating transform coefficients by scaling quantized levels in dequantization. The quantization parameter can be a value mapped to the quantization step size.

[0126] Delta Quantization Parameter: This can mean the difference value between the predicted quantization parameter and the quantization parameter of the target unit to be encoded / decoded.

[0127] Scan: This can refer to a method for arranging the order of coefficients within a unit, block, or matrix. For example, sorting a two-dimensional array into a one-dimensional array is called a scan. Alternatively, sorting a one-dimensional array into a two-dimensional array can also be called a scan or inverse scan.

[0128] Transform Coefficient: This may refer to a coefficient value generated after performing a transform in an encoder. Alternatively, it may refer to a coefficient value generated after performing at least one of entropy decoding and dequantization in a decoder. The meaning of the transform coefficient may also include a quantized level or a quantized transform coefficient level that applies quantization to a transform coefficient or residual signal.

[0129] Quantized Level: This can refer to the value generated by performing quantization on a transform coefficient or residual signal in an encoder. Alternatively, it can refer to the value that is the target of dequantization before dequantization is performed in a decoder. Similarly, the quantized transform coefficient level, which is the result of transformation and quantization, can also be included in the meaning of the quantized level.

[0130] Non-zero Transform Coefficient: This can mean a transform coefficient whose magnitude is not 0, a transform coefficient level whose magnitude is not 0, or a quantized level.

[0131] Quantization Matrix: This can refer to a matrix used in the quantization or dequantization process to improve the subjective or objective image quality. The quantization matrix can also be called a scaling list.

[0132] Quantization Matrix Coefficient: This can refer to each element within a quantization matrix. Quantization matrix coefficients can also be called matrix coefficients.

[0133] Default Matrix: This can refer to a predetermined quantization matrix that is predefined in the encoder and decoder.

[0134] Non-default Matrix: This can refer to a quantization matrix that is not predefined in the encoder and decoder and is signaled by the user.

[0135] Statistical value: The statistical value for at least one variable, encoding parameter, constant, etc. having specific operable values ​​may be at least one of the mean, weighted mean, weighted sum, minimum, maximum, mode, median, and interpolation values ​​of the specific values.

[0136] Figure 1 is a block diagram showing the configuration according to one embodiment of an encoding device to which the present invention is applied.

[0137] The encoding device (100) may be an encoder, a video encoding device, or an image encoding device. A video may include one or more images. The encoding device (100) may sequentially encode one or more images.

[0138] Referring to FIG. 1, the encoding device (100) may include a motion prediction unit (111), a motion compensation unit (112), an intra prediction unit (120), a switch (115), a subtractor (125), a transformation unit (130), a quantization unit (140), an entropy encoding unit (150), an inverse quantization unit (160), an inverse transformation unit (170), an adder (175), a filter unit (180), and a reference picture buffer (190).

[0139] The encoding device (100) can perform encoding on an input image in intra mode and / or inter mode. In addition, the encoding device (100) can generate a bitstream including encoded information through 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 the prediction mode, the switch (115) can be switched to intra, and when the inter mode is used as the prediction mode, the switch (115) can be switched to inter. Here, the intra mode can mean an intra-screen prediction mode, and the inter mode can mean an inter-screen prediction mode. The encoding device (100) can generate a prediction block for an input block of the input image. In addition, after the prediction block is generated, the encoding device (100) can encode a residual block using a residual of the input block and the prediction block. The input image may be referred to as the current image, which is the current encoding target. The input block may be referred to as the current block, which is the current encoding target, or the encoding target block.

[0140] When the prediction mode is intra mode, the intra prediction unit (120) can use samples of blocks already encoded / decoded around the current block as reference samples. The intra prediction unit (120) can perform spatial prediction on the current block using the reference samples, and can generate prediction samples for the input block through spatial prediction. Here, intra prediction can mean prediction within the screen.

[0141] When the prediction mode is inter mode, the motion prediction unit (111) can search for an area that best matches the input block from the reference image during the motion prediction process and derive a motion vector using the searched area. At this time, the area can be used as a search area. The reference image can be stored in the reference picture buffer (190). Here, when encoding / decoding for the reference image is processed, it can be stored in the reference picture buffer (190).

[0142] The motion compensation unit (112) can generate a prediction block for the current block by performing motion compensation using a motion vector. Here, inter prediction may mean inter-screen prediction or motion compensation.

[0143] The above motion prediction unit (111) and motion compensation unit (112) can generate a prediction block by applying an interpolation filter to a portion of the reference image when the value of the motion vector does not have an integer value. In order to perform inter-screen prediction or motion compensation, it is possible to determine whether the motion prediction and motion compensation method of the prediction unit included in the corresponding encoding unit is a skip mode, a merge mode, an advanced motion vector prediction (AMVP) mode, or a current picture reference mode based on the encoding unit, and perform inter-screen prediction or motion compensation according to each mode.

[0144] The subtractor (125) can generate a residual block using the difference between the input block and the predicted block. The residual block may also be referred to as a residual signal. The residual signal may refer to the difference between the original signal and the predicted signal. Alternatively, the residual signal may be a signal generated by transforming, quantizing, or transforming and quantizing the difference between the original signal and the predicted signal. The residual block may be a residual signal in block units.

[0145] The transform unit (130) can perform a transform on the residual block to generate a transform coefficient and output the generated transform coefficient. Here, the transform coefficient may be a coefficient value generated by performing a transform on the residual block. When the transform skip mode is applied, the transform unit (130) may also skip the transform on the residual block.

[0146] Quantized levels can be generated by applying quantization to transform coefficients or residual signals. In the following embodiments, quantized levels may also be referred to as transform coefficients.

[0147] The quantization unit (140) can generate a quantized level by quantizing a transform coefficient or residual signal according to a quantization parameter, and can output the generated quantized level. At this time, the quantization unit (140) can quantize the transform coefficient using a quantization matrix.

[0148] The entropy encoding unit (150) can generate a bitstream by performing entropy encoding according to a probability distribution on values ​​produced by the quantization unit (140) or coding parameter values ​​produced during the encoding process, and can output the bitstream. The entropy encoding unit (150) can perform entropy encoding on information about image samples and information for decoding the image. For example, the information for decoding the image can include syntax elements, etc.

[0149] When entropy encoding is applied, a small number of bits are allocated to symbols with a high occurrence probability, and a large number of bits are allocated to symbols with a low occurrence probability, thereby representing the symbols, whereby the size of the bit string for the symbols to be encoded can be reduced. The entropy encoding unit (150) can use an encoding method such as exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), or Context-Adaptive Binary Arithmetic Coding (CABAC) for entropy encoding. For example, the entropy encoding unit (150) can perform entropy encoding using a Variable Length Coding / Code (VLC) table. In addition, the entropy encoding unit (150) may perform arithmetic encoding using the binarization method, probability model, and context model derived from the binarization method of the target symbol and the probability model of the target symbol / bin.

[0150] The entropy encoding unit (150) can change a two-dimensional block form coefficient into a one-dimensional vector form through a transform coefficient scanning method to encode a transform coefficient level (quantized level).

[0151] Coding parameters may include not only information (flags, indices, etc.) encoded by the encoder and signaled to the decoder, such as syntax elements, but also information derived during the encoding or decoding process, and may mean information required when encoding or decoding an image. For example, unit / block size, unit / block depth, unit / block partition information, unit / block shape, unit / block partition structure, whether to partition in quad tree shape, whether to partition in binary tree shape, partition direction in binary tree shape (horizontal direction or vertical direction), partition type in binary tree shape (symmetric partition or asymmetric partition), whether to partition in 3-partition tree shape, partition direction in 3-partition tree shape (horizontal direction or vertical direction), partition type in 3-partition tree shape (symmetric partition or asymmetric partition), whether to partition in composite tree shape, partition direction in composite tree shape (horizontal direction or vertical direction), partition type in composite tree shape (symmetric partition or asymmetric partition), partition tree in composite tree shape (binary tree or 3-partition tree), prediction mode (intra-screen prediction or inter-screen prediction), intra-screen luminance prediction mode / direction, intra-screen chrominance prediction mode / direction, intra-screen partition information, inter-screen partition information, encoding block partition flag, prediction block partition flag, transform block partition flag, reference sample filtering method, reference sample filter tab, reference sample filter coefficients, prediction block filtering method, prediction block filter Tab, prediction block filter coefficient, prediction block boundary filtering method, prediction block boundary filter tab, prediction block boundary filter coefficient, intra-screen prediction mode, inter-screen prediction mode, motion information, motion vector, motion vector difference, reference picture index, inter-screen prediction direction, inter-screen prediction indicator, prediction list utilization flag, reference picture list, reference picture, motion vector prediction index, motion vector prediction candidate, motion vector candidate list, whether to use merge mode, merge index, merge candidate, merge candidate list,Whether skip mode is used, interpolation filter type, interpolation filter tap, interpolation filter coefficients, motion vector size, motion vector representation accuracy, transformation type, transformation size, information on whether the first transformation is used, information on whether the second transformation is used, first transformation index, second transformation index, information on whether residual signal exists, coded block pattern, coded block flag, quantization parameter, residual quantization parameter, quantization matrix, whether intra-screen loop filter is applied, intra-screen loop filter coefficients, intra-screen loop filter tap, intra-screen loop filter shape / shape, whether deblocking filter is applied, deblocking filter coefficients, deblocking filter tap, deblocking filter strength, deblocking filter shape / shape, whether adaptive sample offset is applied, adaptive sample offset value, adaptive sample offset category, adaptive sample offset type, whether adaptive loop filter is applied, adaptive loop filter coefficients, adaptive loop filter tap, adaptive loop filter shape / shape, binarization / inverse binarization method, context model determination method, context model update Method, whether to perform regular mode, whether to perform bypass mode, context bin, bypass bin, significant coefficient flag, last significant coefficient flag, coefficient group unit encoding flag, last significant coefficient position, flag whether coefficient value is greater than 1, flag whether coefficient value is greater than 2, flag whether coefficient value is greater than 3, remaining coefficient value information, sign information, restored luminance sample, restored chrominance sample, residual luminance sample, residual chrominance sample, luminance transform coefficient, chrominance transform coefficient, luminance quantized level, chrominance quantized level, transform coefficient level scanning method, size of decoder lateral motion vector search region, shape of decoder lateral motion vector search region, number of decoder lateral motion vector searches, CTU size information, minimum block size information, maximum block size information, maximum block depth information, minimum block depth information, image display / output order,At least one value or a combined form of slice identification information, slice type, slice division information, tile group identification information, tile group type, tile group division information, tile identification information, tile type, tile division information, picture type, input sample bit depth, restored sample bit depth, residual sample bit depth, transform coefficient bit depth, quantized level bit depth, information about a luminance signal, and information about a chrominance signal may be included in the encoding parameter.

[0152] Here, signaling a flag or index may mean that the encoder entropy encodes the flag or index and includes it in the bitstream, and that the decoder entropy decodes the flag or index from the bitstream.

[0153] When the encoding device (100) performs encoding through inter prediction, the encoded current image can be used as a reference image for other images to be processed later. Accordingly, the encoding device (100) can reconstruct or decode the encoded current image again and store the reconstructed or decoded image as a reference image in the reference picture buffer (190).

[0154] The quantized level can be dequantized in the dequantization unit (160) and inversely transformed in the inverse transformation unit (170). The dequantized and / or inversely transformed coefficients can be combined with a prediction block through an adder (175), and a reconstructed block can be generated by combining the dequantized and / or inversely transformed coefficients and the prediction block. Here, the dequantized and / or inversely transformed coefficients refer to coefficients on which at least one of dequantization and inverse transformation has been performed, and may refer to a reconstructed residual block.

[0155] The restoration block may pass through a filter unit (180). The filter unit (180) may apply at least one of a deblocking filter, a sample adaptive offset (SAO), an adaptive loop filter (ALF), etc. to the restoration sample, restoration block, or restoration image. The filter unit (180) may also be referred to as an in-loop filter.

[0156] A deblocking filter can remove block distortion that occurs at the boundaries between blocks. Whether to apply a deblocking filter to the current block can be determined based on the samples contained in several columns or rows within the block. When applying a deblocking filter to a block, different filters can be applied depending on the required deblocking filtering strength.

[0157] Sample adaptive offset can be used to compensate for encoding errors by adding an appropriate offset value to sample values. Sample adaptive offset can compensate for the offset from the original image on a sample-by-sample basis in a deblocked image. This can be done by dividing the samples contained in the image into a fixed number of regions, determining the regions to be offset, and applying the offset to those regions, or by applying the offset based on the edge information of each sample.

[0158] An adaptive loop filter can perform filtering based on a comparison between a reconstructed image and the original image. By dividing the samples contained in the image into predetermined groups and determining the filter to be applied to each group, filtering can be performed differentially for each group. Information regarding whether to apply an adaptive loop filter can be signaled for each coding unit (CU), and the shape and filter coefficients of the adaptive loop filter applied to each block can vary.

[0159] The restored block or restored image that has passed through the filter unit (180) may be stored in the reference picture buffer (190). The restored block that has passed through the filter unit (180) may be a part of the reference image. In other words, the reference image may be a restored image composed of restored blocks that have passed through the filter unit (180). The stored reference image may be used for inter-screen prediction or motion compensation thereafter.

[0160] Figure 2 is a block diagram showing the configuration according to one embodiment of a decryption device to which the present invention is applied.

[0161] The decoding device (200) may be a decoder, a video decoding device, or an image decoding device.

[0162] Referring to FIG. 2, the decoding device (200) may include an entropy decoding unit (210), an inverse quantization unit (220), an inverse transformation unit (230), an intra prediction unit (240), a motion compensation unit (250), an adder (255), a filter unit (260), and a reference picture buffer (270).

[0163] The decoding device (200) can receive a bitstream output from the encoding device (100). The decoding device (200) can receive a bitstream stored in a computer-readable recording medium, or a bitstream streamed through a wired / wireless transmission medium. The decoding device (200) can perform decoding on the bitstream in intra mode or inter mode. In addition, the decoding device (200) can generate a restored image or a decoded image through decoding, and can output the restored image or the decoded image.

[0164] If the prediction mode used for decryption is intra mode, the switch can be switched to intra. If the prediction mode used for decryption is inter mode, the switch can be switched to inter.

[0165] The decoding device (200) can decode the input bitstream to obtain a reconstructed residual block and generate a prediction block. Once the reconstructed residual block and the prediction block are obtained, the decoding device (200) can generate a reconstructed block to be decoded by adding the reconstructed residual block and the prediction block. The block to be decoded may be referred to as a current block.

[0166] The entropy decoding unit (210) can generate symbols by performing entropy decoding according to a probability distribution for the bitstream. The generated symbols may include symbols in the form of quantized levels. Here, the entropy decoding method may be the reverse process of the entropy encoding method described above.

[0167] The entropy decoding unit (210) can change a one-dimensional vector-shaped coefficient into a two-dimensional block-shaped coefficient through a transform coefficient scanning method to decode a transform coefficient level (quantized level).

[0168] The quantized level can be dequantized in the dequantization unit (220) and inversely transformed in the inverse transformation unit (230). The quantized level can be generated as a restored residual block as a result of performing the dequantization and / or inverse transformation. At this time, the inverse quantization unit (220) can apply a quantization matrix to the quantized level.

[0169] When the intra mode is used, the intra prediction unit (240) can generate a prediction block by performing spatial prediction on the current block using sample values ​​of already decoded blocks surrounding the block to be decoded.

[0170] When the inter mode is used, the motion compensation unit (250) can generate a prediction block by performing motion compensation using a motion vector and a reference image stored in the reference picture buffer (270) on the current block. The motion compensation unit (250) can generate a prediction block by applying an interpolation filter to a portion of the reference image when the value of the motion vector does not have an integer value. In order to perform motion compensation, it is possible to determine whether the motion compensation method of the prediction unit included in the corresponding encoding unit is skip mode, merge mode, AMVP mode, or current picture reference mode based on the encoding unit, and motion compensation can be performed according to each mode.

[0171] The adder (255) can add the restored residual block and the prediction block to generate a restored 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 restored block or restored image. The filter unit (260) can output the restored image. The restored block or restored image can be stored in the reference picture buffer (270) and used for inter prediction. The restored block that has passed through the filter unit (260) can be a part of the reference image. In other words, the reference image can be a restored image composed of restored blocks that have passed through the filter unit (260). The stored reference image can be used for inter-screen prediction or motion compensation thereafter.

[0172] Figure 3 is a diagram schematically illustrating an image segmentation structure when encoding and decoding an image. Figure 3 schematically illustrates an embodiment in which one unit is divided into multiple sub-units.

[0173] In order to efficiently segment an image, a coding unit (CU) may be used in encoding and decoding. The coding unit may be used as a basic unit for image encoding / decoding. In addition, the coding unit may be used as a unit for distinguishing an intra-screen prediction mode and an inter-screen prediction mode during image encoding / decoding. The coding unit may be a basic unit used for the process of prediction, transformation, quantization, inverse transformation, inverse quantization, or encoding / decoding of transform coefficients.

[0174] Referring to FIG. 3, an image (300) is sequentially divided into Largest Coding Unit (LCU) units, and a division structure is determined for each LCU unit. Here, LCU may be used in the same sense as Coding Tree Unit (CTU). Division of a unit may mean division of a block corresponding to the unit. Block division information may include information regarding the depth of the unit. The depth information may indicate the number of times and / or the degree to which the unit is divided. One unit may be hierarchically divided into multiple sub-units with depth information based on a tree structure. In other words, a unit and a sub-unit generated by division of the unit may correspond to a node and a child node of the node, respectively. Each divided sub-unit may have depth information. The depth information may be information indicating the size of a CU and may be stored for each CU. Since the unit depth indicates the number of times and / or the degree to which the unit is divided, the division information of a sub-unit may include information regarding the size of the sub-unit.

[0175] The partition structure may refer to the distribution of coding units (CUs) within the CTU (310). This distribution may be determined depending on whether to partition one CU into a plurality of CUs (a positive integer greater than or equal to 2, including 2, 4, 8, 16, etc.). The width and height of the CU generated by the partition may be half and half of the width and height of the CU before the partition, respectively, or may be smaller than the width and height of the CU before the partition depending on the number of partitions. The CU may be recursively partitioned into a plurality of CUs. By recursive partitioning, at least one of the width and height of the partitioned CU may be reduced compared to at least one of the width and height of the CU before the partitioning. The partitioning of the CU may be performed recursively up to a predefined depth or a predefined size. For example, the depth of a CTU may be 0, and the depth of a Smallest Coding Unit (SCU) may be a predefined maximum depth. Here, the CTU may be a coding unit having the largest coding unit size as described above, and the SCU may be a coding unit having the smallest coding unit size. Splitting starts from the CTU (310), and each time the horizontal and / or vertical size of the CU is reduced by the splitting, the depth of the CU increases by 1. For example, for each depth, a CU that is not split may have a size of 2Nx2N. Additionally, for a CU that is split, a CU of size 2Nx2N may be split into four CUs of size NxN. The size of N may be halved each time the depth increases by 1.

[0176] Additionally, information on whether a CU is split can be expressed through the CU's split information. The split information can be 1-bit information. All CUs except SCUs can include split information. For example, if the split information value is the first value, the CU may not be split, and if the split information value is the second value, the CU may be split.

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

[0178] For example, when one coding unit is split into four coding units, the horizontal and vertical sizes of the four split coding units may be half the sizes of the horizontal and vertical sizes of the coding unit before being split. For example, when a coding unit having a size of 32x32 is split into four coding units, each of the four split coding units may have a size of 16x16. When one coding unit is split into four coding units, it can be said that the coding unit is split in the form of a quad-tree (quad-tree partition).

[0179] For example, when one coding unit is split into two coding units, the horizontal or vertical size of the two split coding units may be half the size compared to the horizontal or vertical size of the coding unit before being split. For example, when a coding unit having a size of 32x32 is split vertically into two coding units, each of the two split coding units may have a size of 16x32. For example, when a coding unit having a size of 8x32 is split horizontally into two coding units, each of the two split coding units may have a size of 8x16. When one coding unit is split into two coding units, the coding unit can be said to be split in the form of a binary tree (binary-tree partition).

[0180] For example, when one coding unit is split into three coding units, the coding unit can be split into three coding units by splitting the horizontal or vertical size of the coding unit before splitting at a ratio of 1:2:1. For example, when a coding unit having a size of 16x32 is split horizontally into three coding units, the three split coding units can have sizes of 16x8, 16x16, and 16x8 from the top, respectively. For example, when a coding unit having a size of 32x32 is split vertically into three coding units, the three split coding units can have sizes of 8x32, 16x32, and 8x32 from the left, respectively. When one coding unit is split into three coding units, the coding unit can be said to have been split in the form of a ternary-tree (ternary-tree partition).

[0181] CTU (320) of Fig. 3 is an example of a CTU to which quad tree partitioning, binary tree partitioning, and 3-split tree partitioning are all applied.

[0182] As described above, at least one of quad-tree partitioning, binary-tree partitioning, and 3-partition-tree partitioning may be applied to partition a CTU. Each partitioning may be applied based on a predetermined priority. For example, quad-tree partitioning may be preferentially applied to a CTU. A coding unit that cannot be further quad-tree partitioned may correspond to a leaf node of a quad-tree. A coding unit corresponding to a leaf node of a quad-tree may be a root node of a binary tree and / or a 3-partition-tree. That is, a coding unit corresponding to a leaf node of a quad-tree may be binary-tree partitioned, 3-partition-tree partitioned, or may not be partitioned any further. At this time, by preventing quad-tree partitioning from being performed again on a coding unit generated by binary-tree partitioning or 3-partition-tree partitioning of a coding unit corresponding to a leaf node of a quad-tree, partitioning of a block and / or signaling of partition information may be effectively performed.

[0183] The splitting of a coding unit corresponding to each node of a quad tree can be signaled using quad splitting information. Quad splitting information having a first value (e.g., '1') can indicate that the corresponding coding unit is quad tree split. Quad splitting information having a second value (e.g., '0') can indicate that the corresponding coding unit is not quad tree split. The quad splitting information can be a flag having a predetermined length (e.g., 1 bit).

[0184] There may be no priority between binary tree partitioning and 3-partition tree partitioning. That is, a coding unit corresponding to a leaf node of a quad tree may be partitioned either by a binary tree or by a 3-partition tree. Furthermore, a coding unit generated by a binary tree partitioning or a 3-partition tree partitioning may be partitioned again by a binary tree partitioning or a 3-partition tree partitioning, or may not be partitioned any further.

[0185] A partition in which there is no priority between a binary tree partition and a 3-partition tree partition can be called a multi-type tree partition. That is, a coding unit corresponding to a leaf node of a quad tree can become a root node of a multi-type tree. The partitioning of a coding unit corresponding to each node of a multi-type tree can be signaled using at least one of information on whether the multi-type tree is partitioned, information on the direction of partitioning, and information on the partition tree. For the partitioning of a coding unit corresponding to each node of the multi-type tree, information on whether the multi-type tree is partitioned, information on the direction of partitioning, and information on the partition tree may be sequentially signaled.

[0186] Information on whether a composite tree with a first value (e.g., '1') is split may indicate that the corresponding encoding unit is split into a composite tree. Information on whether a composite tree with a second value (e.g., '0') may indicate that the corresponding encoding unit is not split into a composite tree.

[0187] When a coding unit corresponding to each node of a composite tree is split into a composite tree, the coding unit may further include split direction information. The split direction information may indicate a split direction of the composite tree split. Split direction information having a first value (e.g., '1') may indicate that the coding unit is split in a vertical direction. Split direction information having a second value (e.g., '0') may indicate that the coding unit is split in a horizontal direction.

[0188] When an encoding unit corresponding to each node of a composite tree is split into a composite tree, the encoding unit may further include split tree information. The split tree information may indicate a tree used for splitting the composite tree. Split tree information having a first value (e.g., '1') may indicate that the encoding unit is split into a binary tree. Split tree information having a second value (e.g., '0') may indicate that the encoding unit is split into a 3-split tree.

[0189] The information on whether to split, the information on the split tree, and the information on the split direction may each be flags having a predetermined length (e.g., 1 bit).

[0190] At least one of quad partition information, information on whether a composite tree is partitioned, partition direction information, and partition tree information can be entropy encoded / decoded. For entropy encoding / decoding of the above information, information of a peripheral encoding unit adjacent to a current encoding unit can be used. For example, the partitioning shape (whether to be partitioned, partition tree, and / or partitioning direction) of a left encoding unit and / or an upper encoding unit is likely to be similar to the partitioning shape of the current encoding unit. Therefore, based on the information of the peripheral encoding unit, context information for entropy encoding / decoding of the information of the current encoding unit can be derived. At this time, the information of the peripheral encoding unit can include at least one of quad partition information of the corresponding encoding unit, information on whether a composite tree is partitioned, partition direction information, and partition tree information.

[0191] In another embodiment, among binary tree partitioning and 3-partition tree partitioning, binary tree partitioning may be performed preferentially. That is, binary tree partitioning may be applied first, and the encoding unit corresponding to the leaf node of the binary tree may be set as the root node of the 3-partition tree. In this case, quad tree partitioning and binary tree partitioning may not be performed for the encoding unit corresponding to the node of the 3-partition tree.

[0192] A coding unit that cannot be further split by quad-tree splitting, binary tree splitting, and / or 3-tree splitting can become a unit of encoding, prediction, and / or transformation. That is, a coding unit may not be further split for prediction and / or transformation. Accordingly, a split structure, split information, etc. for splitting a coding unit into prediction units and / or transformation units may not exist in the bitstream.

[0193] However, if the size of the encoding unit that is the unit of division is larger than the size of the largest transform block, the encoding unit may be recursively divided until the size becomes equal to or smaller than the size of the largest transform block. For example, if the size of the encoding unit is 64x64 and the size of the largest transform block is 32x32, the encoding unit may be divided into four 32x32 blocks for transformation. For example, if the size of the encoding unit is 32x64 and the size of the largest transform block is 32x32, the encoding unit may be divided into two 32x32 blocks for transformation. In this case, whether or not to split the encoding unit for transformation is not separately signaled, but may be determined by comparing the width or height of the encoding unit with the width or height of the largest transform block. For example, if the width of the encoding unit is larger than the width of the largest transform block, the encoding unit may be divided into two vertically. Additionally, if the height of the encoding unit is greater than the height of the maximum transform block, the encoding unit may be divided into two halves horizontally.

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

[0195] Information about the minimum size of a coding unit corresponding to a leaf node of a quad tree (quad tree minimum size) and / or information about the maximum depth from a root node to a leaf node of a composite tree (composite tree maximum depth) may be signaled or determined at a higher level of the coding unit. The higher level may be, for example, a sequence level, a picture level, a slice level, a tile group level, a tile level, etc. Information about the quad tree minimum size and / or information about the composite tree maximum depth may be signaled or determined for each of an intra-screen slice and an inter-screen slice.

[0196] The differential information about the size of a CTU and the maximum size of a 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, a tile group level, a tile level, etc. Information about the maximum size of a coding unit corresponding to each node of a binary tree (binary tree maximum size) can be determined based on the size of the coding tree unit and the differential information. The maximum size of a coding unit corresponding to each node of a 3-partition tree (3-partition tree maximum size) can have different values ​​depending on the type of slice. For example, in the case of an intra-screen slice, the maximum size of the 3-partition tree can be 32x32. Also, for example, in the case of an inter-screen slice, the maximum size of the 3-partition tree can be 128x128. For example, the minimum size of the encoding unit corresponding to each node of the binary tree (binary tree minimum size) and / or the minimum size of the encoding unit corresponding to each node of the 3-partition tree (3-partition tree minimum size) can be set as the minimum size of the encoding block.

[0197] As another example, the maximum size of a binary tree and / or the maximum size of a 3-partition tree may be signaled or determined at the slice level. Additionally, the minimum size of a binary tree and / or the minimum size of a 3-partition tree may be signaled or determined at the slice level.

[0198] Based on the size and depth information of the various blocks described above, quad partitioning information, information on whether a composite tree is partitioned, partitioning tree information, and / or partitioning direction information may or may not be present in the bitstream.

[0199] For example, if the size of the encoding unit is not greater than the quad tree minimum size, the encoding unit does not include quad partition information, and the quad partition information can be inferred as the second value.

[0200] For example, if the size (width and height) of an encoding unit corresponding to a node of a composite tree is larger than the maximum size (width and height) of a binary tree and / or the maximum size (width and height) of a 3-partition tree, the encoding unit may not be split into a binary tree and / or a 3-partition tree. Accordingly, information on whether the composite tree is split is not signaled, but can be inferred as a second value.

[0201] Alternatively, if the size (width and height) of the encoding unit corresponding to the node of the composite tree is equal to the minimum size (width and height) of the binary tree, or if the size (width and height) of the encoding unit is equal to twice the minimum size (width and height) of the 3-partition tree, the encoding unit may not be subjected to binary tree splitting and / or 3-partition tree splitting. Accordingly, information on whether the composite tree is split or not may be inferred as a second value without being signaled. This is because, if the encoding unit is subjected to binary tree splitting and / or 3-partition tree splitting, an encoding unit smaller than the minimum size of the binary tree and / or the minimum size of the 3-partition tree is generated.

[0202] Alternatively, the binary tree splitting or the 3-split tree splitting may be limited based on the size of the virtual pipeline data unit (hereinafter, the pipeline buffer size). For example, if the binary tree splitting or the 3-split tree splitting splits the encoding unit into sub-coding units that do not fit the pipeline buffer size, the binary tree splitting or the 3-split tree splitting may be limited. The pipeline buffer size may be the size of the largest transform block (e.g., 64X64). For example, when the pipeline buffer size is 64X64, the following splitting may be limited.

[0203] - 3-partition tree partitioning for NxM (N and / or M are 128) coding units

[0204] - Horizontal binary tree splitting for 128xN (N <= 64) coding units

[0205] - Vertical binary tree partitioning for Nx128 (N <= 64) coding units

[0206] Alternatively, if the depth of the encoding unit corresponding to the node of the composite tree within the composite tree is equal to the maximum depth of the composite tree, the encoding unit may not be split into a binary tree and / or a 3-split tree. Accordingly, information on whether the composite tree is split may not be signaled, but may be inferred as a second value.

[0207] Alternatively, information on whether the composite tree is split may be signaled only if at least one of a vertical binary tree split, a horizontal binary tree split, a vertical 3-partition tree split, and a horizontal 3-partition tree split is possible for the encoding unit corresponding to the node of the composite tree. Otherwise, the encoding unit may not be split into a binary tree and / or a 3-partition tree. Accordingly, information on whether the composite tree is split may not be signaled, but may be inferred as a second value.

[0208] Alternatively, the split direction information may be signaled only when both vertical binary tree splitting and horizontal binary tree splitting are possible for the encoding unit corresponding to the node of the composite tree, or when both vertical 3-partition tree splitting and horizontal 3-partition tree splitting are possible. Otherwise, the split direction information may not be signaled and may be inferred as a value indicating a possible splitting direction.

[0209] Alternatively, the split tree information may be signaled only if both vertical binary tree splitting and vertical 3-partition tree splitting are possible for the encoding unit corresponding to the node of the composite tree, or if both horizontal binary tree splitting and horizontal 3-partition tree splitting are possible. Otherwise, the split tree information may not be signaled and may be inferred as a value indicating a tree that can be split.

[0210] Figure 4 is a diagram for explaining an embodiment of an on-screen prediction process.

[0211] The arrows from the center to the periphery of Figure 4 may indicate the prediction directions of the prediction modes within the screen.

[0212] In-frame encoding and / or decoding may be performed using reference samples from neighboring blocks of the current block. The neighboring blocks may be reconstructed neighboring blocks. For example, in-frame encoding and / or decoding may be performed using values ​​or encoding parameters of reference samples contained in the reconstructed neighboring blocks.

[0213] A prediction block may refer to a block generated as a result of performing prediction within a screen. The prediction block may correspond to at least one of a CU, a PU, and a TU. The unit of the prediction block may be the size of at least one of a CU, a PU, and a TU. The prediction block may be a square block having a size such as 2x2, 4x4, 16x16, 32x32, or 64x64, or may be a rectangular block having a size such as 2x8, 4x8, 2x16, 4x16, or 8x16.

[0214] In-screen prediction can be performed based on the in-screen prediction mode for the current block. The number of in-screen prediction modes that the current block can have can be a predefined fixed value, or it can be determined differently based on the properties of the prediction block. For example, the properties of the prediction block can include the size and shape of the prediction block.

[0215] The number of prediction modes within a picture may be fixed to N regardless of the size of the block. Or, for example, the number of prediction modes within a picture may be 3, 5, 9, 17, 34, 35, 36, 65, or 67. Or, the number of prediction modes within a picture may vary depending on the size of the block and / or the type of the color component. For example, the number of prediction modes within a picture may vary depending on whether the color component is a luma signal or a chroma signal. For example, the number of prediction modes within a picture may increase as the size of the block increases. Or, the number of prediction modes within a luma component block may be greater than the number of prediction modes within a chroma component block.

[0216] The in-screen prediction mode may be a non-directional mode or a directional mode. The non-directional mode may be a DC mode or a planar mode, and the angular mode may be a prediction mode having a specific direction or angle. The in-screen prediction mode may be expressed by at least one of a mode number, a mode value, a mode number, a mode angle, and a mode direction. The number of in-screen prediction modes may be one or more M including the non-directional and directional modes. A step of checking whether samples included in reconstructed neighboring blocks for in-screen prediction of the current block can be used as reference samples of the current block may be performed. If there is a sample that cannot be used as a reference sample of the current block, the sample value of at least one of the samples included in the reconstructed neighboring blocks is copied and / or interpolated to replace the sample value of the sample that cannot be used as a reference sample, and then the sample value can be used as a reference sample of the current block.

[0217] Figure 7 is a diagram illustrating reference samples available for prediction within the screen.

[0218] As illustrated in FIG. 7, at least one of reference sample lines 0 to 3 may be used for intra-screen prediction of the current block. In FIG. 7, samples of segments A and F may be padded with the closest samples of segments B and E, respectively, instead of being taken from the reconstructed neighboring blocks. Index information indicating reference sample lines to be used for intra-screen prediction of the current block may be signaled. For example, in FIG. 7, reference sample line indicators 0, 1, and 2 may be signaled as index information indicating reference sample lines 0, 1, and 2. If the upper boundary of the current block is the boundary of a CTU, only reference sample line 0 may be available. Therefore, in this case, the index information may not be signaled. If a reference sample line other than reference sample line 0 is used, filtering on the prediction block described below may not be performed.

[0219] When making in-screen predictions, a filter can be applied to at least one of the reference sample or the prediction sample based on at least one of the in-screen prediction mode and the size of the current block.

[0220] In planar mode, when generating a prediction block of the current block, the sample value of the prediction target sample can be generated using a weighted sum of the top and left reference samples of the current sample, the top-right and bottom-left reference samples of the current block, depending on the position of the prediction target sample within the prediction block. In addition, in DC mode, when generating a prediction block of the current block, the average value of the top and left reference samples of the current block can be used. In addition, in directional mode, the prediction block can be generated using the top, left, top-right and / or bottom-left reference samples of the current block. Real-valued interpolation can also be performed to generate the prediction sample value.

[0221] In the case of intra-screen prediction between color components, a prediction block for a current block of a second color component can be generated based on a corresponding reconstruction block of a first color component. For example, the first color component can be a luminance component, and the second color component can be a chrominance component. For intra-screen prediction between color components, parameters of a linear model between the first color component and the second color component can be derived based on a template. The template can include top and / or left peripheral samples of the current block and top and / or left peripheral samples of a reconstruction block of the first color component corresponding thereto. For example, the parameters of the linear model can be derived using a sample value of the first color component having a maximum value among the samples in the template and a sample value of the second color component corresponding thereto, and a sample value of the first color component having a minimum value among the samples in the template and a sample value of the second color component corresponding thereto. Once the parameters of the linear model are derived, a prediction block for the current block can be generated by applying a corresponding reconstruction block to the linear model. Depending on the video format, subsampling may be performed on the surrounding samples of the reconstructed block of the first color component and the corresponding reconstructed block. For example, if one sample of the second color component corresponds to four samples of the first color component, the four samples of the first color component may be subsampled to compute one corresponding sample. In this case, parameter derivation of the linear model and intra-picture prediction between color components may be performed based on the subsampled corresponding samples. Whether intra-picture prediction between color components is performed and / or the range of the template may be signaled as an intra-picture prediction mode.

[0222] A current block can be split into two or four sub-blocks in the horizontal or vertical direction. The split sub-blocks can be sequentially reconstructed. That is, intra-picture prediction can be performed on the sub-blocks to generate sub-prediction blocks. In addition, inverse quantization and / or inverse transformation can be performed on the sub-blocks to generate sub-residual blocks. A reconstructed sub-block can be generated by adding the sub-prediction block to the sub-residual block. The reconstructed sub-block can be used as a reference sample for intra-picture prediction of a subsequent sub-block. A sub-block can be a block including a predetermined number of samples (e.g., 16). Therefore, for example, if the current block is an 8x4 block or a 4x8 block, the current block can be split into two sub-blocks. In addition, if the current block is a 4x4 block, the current block cannot be split into sub-blocks. If the current block has a size other than that, the current block can be split into four sub-blocks. Information regarding whether or not to perform the sub-block-based intra-screen prediction and / or the splitting direction (horizontal or vertical) may be signaled. The sub-block-based intra-screen prediction may be restricted to be performed only when using reference sample line 0. When the sub-block-based intra-screen prediction is performed, filtering on the prediction block described below may not be performed.

[0223] A final prediction block can be generated by performing filtering on a predicted prediction block within a screen. The filtering can be performed by applying predetermined weights to a filtering target sample, a left reference sample, an upper reference sample, and / or an upper left reference sample. The weights and / or reference samples (range, position, etc.) used for the filtering can be determined based on at least one of a block size, an within-screen prediction mode, and a position of the filtering target sample within the prediction block. The filtering can be performed only for a predetermined within-screen prediction mode (e.g., DC, planar, vertical, horizontal, diagonal, and / or adjacent diagonal mode). The adjacent diagonal mode can be a mode obtained by adding or subtracting k from the diagonal mode. For example, k can be a positive integer less than or equal to 8.

[0224] The intra-screen prediction mode of the current block can be predicted from the intra-screen prediction modes of blocks existing around the current block and entropy encoded / decoded. If the intra-screen prediction modes of the current block and the surrounding blocks are the same, information indicating that the intra-screen prediction modes of the current block and the surrounding blocks are the same can be signaled using predetermined flag information. In addition, indicator information regarding an intra-screen prediction mode that is the same as the intra-screen prediction mode of the current block among the intra-screen prediction modes of a plurality of surrounding blocks can be signaled. If the intra-screen prediction modes of the current block and the surrounding blocks are different, entropy encoding / decoding can be performed based on the intra-screen prediction modes of the surrounding blocks to entropy encode / decode the intra-screen prediction mode information of the current block.

[0225] Figure 5 is a diagram for explaining an embodiment of a screen-to-screen prediction process.

[0226] The rectangles illustrated in Figure 5 can represent images. Additionally, the arrows in Figure 5 can indicate prediction directions. Each image can be classified into an I-picture (Intra Picture), a P-picture (Predictive Picture), a B-picture (Bi-predictive Picture), etc., depending on its encoding type.

[0227] I-pictures can be encoded / decoded through intra-picture prediction without inter-picture prediction. P-pictures can be encoded / decoded through inter-picture prediction using only reference pictures existing in one direction (e.g., forward or backward). B-pictures can be encoded / decoded through inter-picture prediction using reference pictures existing in both directions (e.g., forward and backward). In addition, in the case of B-pictures, they can be encoded / decoded through inter-picture prediction using reference pictures existing in both directions or inter-picture prediction using reference pictures existing in one of the forward and backward directions. Here, the bi-directionality can be forward and backward. Here, when inter-picture prediction is used, the encoder can perform inter-picture prediction or motion compensation, and the decoder can perform corresponding motion compensation.

[0228] Below, inter-screen prediction according to an embodiment is described in detail.

[0229] Inter-screen prediction or motion compensation can be performed using reference images and motion information.

[0230] Motion information for a current block can be derived through inter-frame prediction by each of the encoding device (100) and the decoding device (200). The motion information can be derived using motion information of a reconstructed surrounding block, motion information of a collocated block (col block), and / or a block adjacent to the collocated block. The collocated block may be a block corresponding to the spatial position of the current block within an already reconstructed collocated picture (col picture). Here, the collocated picture may be one picture from at least one reference picture included in a reference picture list.

[0231] The method for deriving motion information may vary depending on the prediction mode of the current block. For example, prediction modes applied for inter-frame prediction may include AMVP mode, merge mode, skip mode, merge mode with motion vector difference, sub-block merge mode, geometric segmentation mode, inter-intra joint prediction mode, and affine inter mode. Here, the merge mode may be referred to as motion merge mode.

[0232] For example, when AMVP is applied as a prediction mode, a motion vector candidate list can be generated by determining at least one of the motion vector of the reconstructed neighboring block, the motion vector of the called block, the motion vector of the block adjacent to the called block, and the (0, 0) motion vector as a motion vector candidate. A motion vector candidate can be derived using the generated motion vector candidate list. Motion information of the current block can be determined based on the derived motion vector candidate. Here, the motion vector of the called block or the motion vector of the block adjacent to the called block can be referred to as a temporal motion vector candidate, and the motion vector of the reconstructed neighboring block can be referred to as a spatial motion vector candidate.

[0233] The encoding device (100) can calculate the motion vector difference (MVD) between the motion vector of the current block and the motion vector candidate, and can entropy encode the MVD. In addition, the encoding device (100) can generate a bitstream by entropy encoding the motion vector candidate index. The motion vector candidate index can indicate an optimal motion vector candidate selected from among the motion vector candidates included in the motion vector candidate list. The decoding device (200) can entropy decode the motion vector candidate index from the bitstream, and select a motion vector candidate of a block to be decoded from among the motion vector candidates included in the motion vector candidate list using the entropy-decoded motion vector candidate index. In addition, the decoding device (200) can derive a motion vector of a block to be decoded by summing the entropy-decoded MVD and the motion vector candidate.

[0234] Meanwhile, the encoding device (100) can entropy encode the resolution information of the calculated MVD. The decoding device (200) can adjust the resolution of the entropy-decoded MVD using the MVD resolution information.

[0235] Meanwhile, the encoding device (100) can calculate the motion vector difference (MVD) between the motion vector of the current block and the motion vector candidate based on the affine model, and can entropy encode the MVD. The decoding device (200) can derive the affine control motion vector of the block to be decoded through the sum of the entropy-decoded MVD and the affine control motion vector candidate, thereby deriving the motion vector in units of sub blocks.

[0236] The bitstream may include a reference picture index indicating a reference picture, etc. The reference picture index may be entropy encoded and signaled from the encoding device (100) to the decoding device (200) via the bitstream. The decoding device (200) may generate a prediction block for the block to be decoded based on the derived motion vector and the reference picture index information.

[0237] Another example of a method for deriving motion information is merge mode. Merge mode may refer to merging motions of multiple blocks. Merge mode may refer to a mode in which motion information of a current block is derived from motion information of surrounding blocks. When merge mode is applied, a merge candidate list may be generated using motion information of reconstructed surrounding blocks and / or motion information of a call block. The motion information may include at least one of 1) a motion vector, 2) a reference image index, and 3) an inter-frame prediction indicator. The prediction indicator may be unidirectional (L0 prediction, L1 prediction) or bidirectional.

[0238] The merge candidate list may represent a list in which motion information is stored. The motion information stored in the merge candidate list may be at least one of motion information of a neighboring block adjacent to the current block (spatial merge candidate), motion information of a block collocated with the current block in a reference image (temporal merge candidate), new motion information generated by a combination of motion information already existing in the merge candidate list, motion information of a block encoded / decoded before the current block (history-based merge candidate), and a zero merge candidate.

[0239] The encoding device (100) can generate a bitstream by entropy encoding at least one of a merge flag and a merge index, and then signal it to the decoding device (200). The merge flag can be information indicating whether to perform a merge mode for each block, and the merge index can be information on which block among the neighboring blocks adjacent to the current block will be merged. For example, the neighboring blocks of the current block can include at least one of the left neighboring block, the upper neighboring block, and the temporal neighboring block of the current block.

[0240] Meanwhile, the encoding device (100) can entropy encode correction information for correcting the motion vector among the motion information of the merge candidate and signal it to the decoding device (200). The decoding device (200) can correct the motion vector of the merge candidate selected by the merge index based on the correction information. Here, the correction information can include at least one of correction status information, correction direction information, and correction size information. As described above, a prediction mode that corrects the motion vector of the merge candidate based on the signaled correction information can be referred to as a merge mode with a motion vector difference.

[0241] Skip mode may be a mode that applies motion information of surrounding blocks as is to the current block. When skip mode is used, the encoding device (100) may entropy encode information on which block's motion information is to be used as the motion information of the current block and signal it to the decoding device (200) through a bitstream. At this time, the encoding device (100) may not signal a syntax element regarding at least one of motion vector difference information, an encoding block flag, and a transform coefficient level (quantized level) to the decoding device (200).

[0242] Sub-block merge mode may refer to a mode for deriving motion information in units of sub-blocks of a coding block (CU). When the sub-block merge mode is applied, a sub-block merge candidate list may be generated using motion information (sub-block based temporal merge candidate) of a sub-block collocated with a current sub-block in a reference image and / or an affine control point motion vector merge candidate.

[0243] Geometric partitioning mode may refer to a mode in which the current block is divided in a predetermined direction to derive motion information for each block, each prediction sample is derived using each derived motion information, and each derived prediction sample is weighted and combined to derive a prediction sample of the current block.

[0244] Inter-intra combined prediction mode may mean a mode in which a prediction sample of the current block is derived by weighting prediction samples generated through inter-screen prediction and prediction samples generated through intra-screen prediction.

[0245] The decoding device (200) can independently correct the derived motion information. The decoding device (200) can search a predefined area based on a reference block indicated by the derived motion information to derive the motion information with the minimum SAD as corrected motion information.

[0246] The decoding device (200) can compensate for the prediction sample derived through inter-screen prediction using optical flow.

[0247] Figure 6 is a diagram for explaining the process of transformation and quantization.

[0248] As illustrated in FIG. 6, a quantized level can be generated by performing a transformation and / or quantization process on the residual signal. The residual signal can be generated as a difference between an original block and a prediction block (an intra-screen prediction block or an inter-screen prediction block). Here, the prediction block can be a block generated by intra-screen prediction or inter-screen prediction. Here, the transformation can include at least one of a primary transformation and a secondary transformation. A transformation coefficient can be generated by performing a primary transformation on the residual signal, and a secondary transformation can be performed on the transformation coefficient to generate a secondary transformation coefficient.

[0249] The primary transform can be performed using at least one of a plurality of pre-defined transform methods. For example, the plurality of pre-defined transform methods can include a discrete cosine transform (DCT), a discrete sine transform (DST), or a Karhunen-Loeve transform (KLT)-based transform. A secondary transform can be performed on transform coefficients generated after the primary transform is performed. The transform method applied during the primary transform and / or the secondary transform can be determined according to at least one of the encoding parameters of the current block and / or the neighboring blocks. Alternatively, transform information indicating the transform method can be signaled. The DCT-based transform can include, for example, DCT2, DCT-8, etc. The DST-based transform can include, for example, DST-7.

[0250]

[0251] Quantization can be performed on the result or residual signal of the first transform and / or the second transform to generate a quantized level. The quantized level can be scanned according to at least one of an up-right diagonal scan, a vertical scan, and a horizontal scan based on at least one of an within-picture prediction mode or a block size / shape. For example, the coefficients of a block can be converted into a one-dimensional vector form by scanning them using an up-right diagonal scan. Depending on the size of the transform block and / or the within-picture prediction mode, a vertical scan that scans the two-dimensional block shape coefficients in the column direction, or a horizontal scan that scans the two-dimensional block shape coefficients in the row direction may be used instead of the up-right diagonal scan. The scanned quantized level can be entropy encoded and included in a bitstream.

[0252] A decoder can entropy-decode a bitstream to generate quantized levels. These quantized levels can be aligned into a two-dimensional block shape through inverse scanning. At least one of the following methods can be used for inverse scanning: upper-right diagonal scanning, vertical scanning, or horizontal scanning.

[0253] Inverse quantization can be performed on a quantized level, a second inverse transform can be performed depending on whether a second inverse transform is performed, and a first inverse transform can be performed depending on whether a first inverse transform is performed on the result of the second inverse transform, thereby generating a restored residual signal.

[0254] Inverse mapping of the dynamic range may be performed on the luminance component restored through intra-picture prediction or inter-picture prediction before in-loop filtering. The dynamic range may be divided into 16 equal pieces, and a mapping function for each piece may be signaled. The mapping function may be signaled at the slice level or the tile group level. The inverse mapping function for performing the inverse mapping may be derived based on the mapping function. In-loop filtering, storage of reference pictures, and motion compensation are performed in the inverse mapped area, and the prediction block generated through inter-picture prediction may be converted to the mapped area by mapping using the mapping function, and then used to generate a reconstructed block. However, since intra-picture prediction is performed in the mapped area, the prediction block generated through intra-picture prediction may be used to generate a reconstructed block without mapping / inverse mapping.

[0255] If the current block is a residual block of chrominance components, the residual block can be converted into an inverse mapped region by performing scaling on the chrominance components of the mapped region. The availability of the scaling can be signaled at the slice level or the tile group level. The scaling can be applied only when the mapping for the luma component is available and the partitioning of the luminance component and the partitioning of the chrominance component follow the same tree structure. The scaling can be performed based on the average of the sample values ​​of the luminance prediction block corresponding to the chrominance block. In this case, if the current block uses inter-screen prediction, the luminance prediction block can mean the mapped luminance prediction block. The value required for the scaling can be derived by referring to a lookup table using the index of the piece to which the average of the sample values ​​of the luminance prediction block belongs. Finally, by scaling the residual block using the derived value, the residual block can be converted into an inverse mapped region. Restoration of the subsequent chrominance component blocks, intra-screen prediction, inter-screen prediction, in-loop filtering, and storage of reference pictures can be performed in the reverse-mapped area.

[0256] Information indicating whether mapping / demapping of the luminance component and chrominance component is available can be signaled via a sequence parameter set.

[0257] A prediction block of a current block can be generated based on a block vector indicating a displacement between the current block and a reference block within the current picture. In this way, a prediction mode that generates a prediction block by referencing the current picture can be called an Intra Block Copy (IBC) mode. The IBC mode can be applied to an MxN (M<=64, N<=64) coding unit. The IBC mode can include a skip mode, a merge mode, an AMVP mode, etc. In the case of the skip mode or the merge mode, a merge candidate list is configured, and a merge index is signaled so that one merge candidate can be specified. The block vector of the specified merge candidate can be used as the block vector of the current block. The merge candidate list can include at least one or more of a spatial candidate, a history-based candidate, an average-of-two-candidate candidate, or a zero-merge candidate. In the case of the AMVP mode, a differential block vector can be signaled. Additionally, the predicted block vector can be derived from the left neighboring block and the upper neighboring block of the current block. An index indicating which neighboring block to use can be signaled. The predicted block in the IBC mode can be limited to blocks included in the current CTU or the left CTU and within the previously reconstructed region. For example, the block vector value of the predicted block of the current block can be limited so that it is located within the three 64x64 block regions preceding the 64x64 block to which the current block belongs in the encoding / decoding order. By limiting the block vector value in this way, the memory consumption and device complexity associated with the IBC mode implementation can be reduced.

[0258] Hereinafter, with reference to FIGS. 8 to 57, a video encoding / decoding method according to one embodiment of the present invention will be described.

[0259] Cross-component prediction may mean a process in which a predetermined down-sampling is performed on restored first component samples, and a prediction sample of a second component block is generated using the restored first component samples for which the down-sampling was performed and a predefined linear or nonlinear relationship.

[0260] Here, cross-component prediction can be used in the same sense as color component prediction or component-to-component prediction. Here, component can mean color component.

[0261] In this specification, the cross-component prediction mode may be used in the same sense as the Cross-Component Linear Model (CCLM) mode.

[0262] FIG. 8 is a diagram for explaining a process of performing cross-component prediction according to one embodiment of the present invention.

[0263] Referring to FIG. 8, the process of performing cross-component prediction may include a step of generating surrounding samples of a first component block (S801), a step of performing down-sampling for the first component samples (S802), a step of deriving cross-component parameters (S803), and a step of generating prediction samples of a second component block (S804).

[0264] Here, in the step of generating a peripheral sample of the first component block (S801), a peripheral sample of the restored first component block can be generated. In addition, in the step of performing down-sampling on the first component samples (S802), down-sampling can be performed on at least one of the generated peripheral sample and the restored first component samples. In addition, in the step of deriving a cross-component parameter (S803), a cross-component parameter can be derived using the down-sampled sample. In addition, in the step of generating a prediction sample of the second component block (S804), a prediction sample of the second component block can be generated.

[0265] Hereinafter, embodiments of the present invention for the above steps will be described in detail.

[0266] Here, the second component may mean at least one component. For example, in the case of the YUV color format, the first component may mean the luminance component Y, and the second component may mean the chrominance components U and V. As another example, in the case of the RGB color format, the first component may mean G, and the second component may mean R and B.

[0267] At this time, the cross component parameter derivation step (S803) and the prediction sample generation step (S804) of the second component block can be performed independently for at least one or more second components.

[0268] Below, the peripheral sample generation step (S801) of the first component block is described.

[0269] In a step (S801) of generating a surrounding sample of a first component block according to one embodiment of the present invention, surrounding samples having at least one line can be generated for a first component block area corresponding to the same position of a second component block area for cross-component prediction of a second component block.

[0270] For example, surrounding samples may be generated having at least one line at the top, top right, left, top left and / or bottom left positions of the first component block.

[0271] The process of generating the above-mentioned surrounding samples may be applied to the method of generating reference samples used for on-screen prediction. At this time, the length or number of reference sample lines to be generated may differ from the method of generating reference samples used for on-screen prediction, but the process of generating the reference samples may be the same.

[0272] Additionally, when cross-component prediction is performed on the current block, the filtering process for the reference sample may be omitted during the process of generating the reference sample.

[0273] At this time, if the surrounding samples to be generated exist in the available area, the restored value before the deblocking filter is applied can be used as is to generate at least one surrounding sample. In the present disclosure, the presence of a sample in the available area may mean that the sample is available. Furthermore, the presence of a sample in an unavailable area may mean that the sample is unavailable. Furthermore, the availability of a sample may mean that the sample is valid and can be used in at least one of the encoding / decoding processes.

[0274] On the other hand, if the surrounding samples to be generated exist in an unavailable area, at least one virtual surrounding sample can be generated by padding the nearest sample value existing in the available area. At this time, although at least one of the virtual surrounding samples is generated in an unavailable area, it can be determined as an available sample and used during the on-screen prediction process. At this time, the same downsampling filter can be applied to the area where the available surrounding samples exist and the area where the virtual surrounding samples exist.

[0275] For example, if the first component block is a luminance block and the second component block is a chrominance block, in order to perform cross-component prediction for the chrominance block, surrounding samples having at least one line for the luminance block may be generated. At this time, if the upper surrounding samples of the luminance block exist in an unavailable area, at least one virtual upper surrounding sample may be generated by padding the upper inner sample value within the luminance block, which is the nearest sample value existing in the available area. Alternatively, if the left surrounding samples of the luminance block exist in an unavailable area, at least one virtual left surrounding sample may be generated by padding the left inner sample value within the luminance block, which is the nearest sample value existing in the available area. Alternatively, if the surrounding samples of all luminance blocks exist in an unavailable area, all virtual surrounding samples may be generated as an intermediate value according to the bit depth. The virtual surrounding samples may be generated in an area in which the surrounding samples are unavailable.

[0276] At this time, if the surrounding area based on the second component block is included in at least one of the same slice, the same tile, and the same subpicture as the current block, if it exists within the same picture, and if it is included in the same CTU (Coding Tree Unit) row as the current block when WPP (Wavefront Parallel Processing) is used, it can be said to be an available area.

[0277] Conversely, a surrounding area based on a second component block may be considered unavailable if it is included in a different slice, different tile, or different subpicture than the current block, exists outside the picture, and is included in a different CTU row than the current block when WPP is used.

[0278] Alternatively, if constrained intra-screen prediction is used, the surrounding area may be considered unavailable if it is not encoded / decoded in intra-screen prediction mode.

[0279] The above-described process for determining the available area can be equally applied to the surrounding area of ​​the first component block.

[0280] FIGS. 9 and 10 are diagrams illustrating a process for expanding peripheral availability information of a first component block derived using peripheral availability information of a second component block, according to one embodiment of the present invention. In this case, the availability information may mean validity information.

[0281] Hereinafter, in FIGS. 9 and 10, the 'O' mark may indicate an available peripheral sample, and the 'X' mark may indicate an unavailable peripheral sample. Furthermore, the peripheral availability information may be information indicating whether a peripheral sample is available. Furthermore, the length of the peripheral availability information may indicate the length of a peripheral sample containing the peripheral availability information.

[0282] The peripheral availability information of the second component block may be used to derive peripheral availability information of the first component block area corresponding to the second component block area. At this time, the unit of the availability information may be defined as the minimum CU (Coding Unit) size defined in the encoder / decoder or as one sample size. Alternatively, the unit of the availability information may be signaled or determined based on at least one of the coding parameters of the current block.

[0283] For example, if the second component block is a chrominance block and the first component block is a luminance block, the surrounding availability information of the chrominance block can be used to generate surrounding samples of the luminance block.

[0284] For example, referring to FIG. 9, when the color format is YUV 4:2:0, since the horizontal and vertical lengths of the peripheral availability information of the chrominance block are half that of the luminance block, the horizontal and vertical lengths of the peripheral availability information of the chrominance block can be doubled to generate peripheral samples of the luminance block. In this case, the length of the availability information at the upper left may not be extended.

[0285] As another example, referring to FIG. 10, when the color format is YUV 4:2:2, the horizontal length of the peripheral availability information of the chrominance block is half that of the luminance block, and the vertical length is the same as that of the luminance block, so that only the horizontal length of the peripheral availability information of the chrominance block is doubled to generate peripheral samples of the luminance block. At this time, the length of the availability information at the upper left may not be expanded.

[0286] As another example, if the color format is YUV 4:4:4, the horizontal and vertical lengths of the surrounding availability information of the chrominance block are the same as those of the luminance block, so the length of the surrounding availability information of the chrominance block is not extended and can be used as is for the luminance block.

[0287] When peripheral samples having at least one line are generated, the left and lower left peripheral samples can use availability information at the same y-coordinate, and the upper and upper right peripheral samples can use availability information at the same x-coordinate. Additionally, the upper left peripheral samples can use the upper left peripheral availability information.

[0288] FIG. 11 is a diagram for explaining a process in which peripheral availability information of a first component block derived using peripheral availability information of a second component block is expanded when the uppermost position of the current block is the same as the upper boundary of the CTU, according to one embodiment of the present invention.

[0289] The peripheral availability information of the second component block may be used to derive the peripheral availability information of the first component block corresponding to the second component block. When the peripheral availability information of the first component block area is derived, if the top position of the current block is the same as the CTU upper boundary, when generating peripheral samples having two or more lines, the peripheral samples may be generated by assuming that the top, top left, and top right peripheral samples existing in the Nth peripheral sample line (where N is an integer greater than or equal to 2) are all unavailable. The unavailable peripheral samples may be generated by padding the available nearest sample existing in the same line or as an intermediate value according to the bit depth. Therefore, the line buffer can only store the reconstructed samples of at most one line of the top of the picture.

[0290] For example, referring to Fig. 11, the peripheral availability information of the first component block derived using the peripheral availability information of the chrominance block, which is the second component block, can be expanded. At this time, when the uppermost position of the second component block is the same as the upper boundary of the CTU, the lower left, upper, and upper right peripheral samples existing in the second peripheral sample line and the third peripheral sample line of the first component block are assumed to always be unavailable regardless of the peripheral availability information of the second component block, so that the peripheral samples can be generated.

[0291] In a peripheral sample generation step (S801) of a first component block according to one embodiment of the present invention, peripheral availability information of a first component block area corresponding to a second component block area can be derived using peripheral availability information of a second component block.

[0292] For example, when the first component block and the second component block use the same encoding / decoding tree structure, the peripheral availability information of the first component block can be derived using the peripheral availability information of the second component block.

[0293] As another example, if the first component block and the second component block use independent encoding / decoding tree structures, it can be assumed that all blocks within the Coding Tree Block (CTB) that includes the first component block area corresponding to the second component block area have completed encoding / decoding. Accordingly, in this case, if the peripheral area is currently within the CTB, the peripheral area can be determined as an available area, and if it is outside the CTB, the peripheral area can be determined as an unavailable area.

[0294] If the surrounding samples to be generated are included in the available area, the restored samples before the deblocking filter is applied can be used as is to generate at least one surrounding sample.

[0295] Conversely, if the surrounding samples fall within an unavailable region, the reconstructed samples present in the available region may be padded to generate at least one virtual surrounding sample in the unavailable region. In this case, the same downsampling filter may be applied to the region containing the available surrounding samples and the region containing the virtual surrounding samples.

[0296] For example, if the first component block is a luminance block and the second component block is a chrominance block, in order to perform cross-component prediction for the chrominance block, surrounding samples having at least one line for the luminance block may be generated. At this time, if the upper surrounding samples of the luminance block exist in an unavailable area, at least one virtual upper surrounding sample may be generated by padding the upper inner sample value within the luminance block, which is the nearest sample value existing in the available area. Alternatively, if the left surrounding samples of the luminance block exist in an unavailable area, at least one virtual left surrounding sample may be generated by padding the left inner sample value within the luminance block, which is the nearest sample value existing in the available area. At this time, the samples existing in the available area may mean not only the restored surrounding samples but also the upper or left samples within the current block. The virtual surrounding samples may be generated in an area in which the surrounding samples are unavailable.

[0297] At this time, if not all surrounding areas are available, virtual surrounding samples can be generated with intermediate values ​​that the sample can have. Here, the intermediate value that the sample can have can be defined as a value of 1 << (bit_depth - 1) according to the bit depth (bit_depth) of the first component. Alternatively, virtual surrounding samples can be generated by padding the top sample or the left sample within the current block.

[0298] FIG. 12 is a diagram illustrating an embodiment of availability information used in generating peripheral samples of a first component block according to one embodiment of the present invention.

[0299] In Fig. 12(a), v(i, j) represents an array of availability information corresponding to the first component block derived using the peripheral availability information of the second component block. Referring to Fig. 12(a), peripheral availability information having one line around the first component block corresponding to the second component block can be derived using the peripheral availability information of the second component block.

[0300] Fig. 12(b) shows an example in which the arrangement of peripheral availability information derived in Fig. 12(a) is used to derive peripheral availability information having three lines around the first component block.

[0301] FIG. 13 is a drawing showing an example of generating a peripheral sample line according to a color format, according to one embodiment of the present invention.

[0302] FIG. 14 is a diagram illustrating an example of generation of peripheral sample lines according to a syntax element indicating a sub-sampling method for a chrominance block according to one embodiment of the present invention.

[0303] The number of peripheral sample lines to be generated may be determined by the color format. Alternatively, the number of peripheral sample lines to be generated may be determined by a syntax element indicating a subsampling method for the chrominance block.

[0304] For example, referring to FIG. 13(a), when the color format is YUV 4:4:4, since the ratio between the resolutions of the first component and the second component is 1:1, a peripheral sample having one line at the top, top right, top left, left, and / or bottom left positions of the first component block can be generated.

[0305] As another example, referring to FIG. 13(b), when the color format is YUV 4:2:2, since the ratio between the horizontal resolutions of the first component and the second component is 2:1, peripheral samples having at least two lines at the top, top right, top left, left, and / or bottom left positions of the first component block can be generated for downsampling.

[0306] As another example, if the color format is YUV 4:2:0, since the ratio between the horizontal and vertical resolutions of the first component and the second component is 2:1, peripheral samples having at least two lines at the top, top right, top left, left, and / or bottom left positions of the first component block can be generated for downsampling.

[0307] As another example, referring to FIG. 14(a), when the color format is YUV 4:2:0 and a syntax element (e.g., sps_cclm_colocated_chroma_flag or sps_chroma_vertical_collocated_flag) indicating a sub-sampling method for a chrominance block has a value indicating 4:2:0 co-sited, a surrounding sample having at least two lines at the top and / or top-right positions of the first component block for down-sampling may be generated, and a surrounding sample having at least three lines at the top-left, left, and / or bottom-left positions may be generated. The sps_cclm_colocated_chroma_flag may indicate the same syntax element as the sps_chroma_vertical_collocated_flag.

[0308] For example, sps_cclm_colocated_chroma_flag can be signaled for a given direction (vertical direction or horizontal direction). If sps_cclm_colocated_chroma_flag is '1' (or the first value), it can mean that the positions of the chrominance samples and the positions of the luminance samples are co-sited in the given direction. Also, if sps_cclm_colocated_chroma_flag is '0' (or the second value), it can mean that the positions of the chrominance samples and the positions of the luminance samples are not co-sited in the given direction. When the positions of the chrominance samples and the positions of the luminance samples are not co-sited in the given direction, the chrominance sample can be mid-sited between two adjacent luminance samples in the given direction.

[0309] As another example, referring to FIG. 14(b), if the color format is YUV 4:2:0 and the syntax element indicating the subsampling method for the chrominance block (e.g., sps_cclm_colocated_chroma_flag or sps_chroma_vertical_collocated_flag, etc.) has a value indicating 4:2:0 mid-sited, peripheral samples having at least three lines at the top, top-right, top-left, left, and / or bottom-left positions of the first component block can be generated.

[0310] For each peripheral sample line to be generated, the horizontal or vertical length of the peripheral sample can be determined by the size of the second component transform block (or the second component coding block), the peripheral sample line index, and / or the subsampling method for the chrominance block.

[0311] For example, the horizontal length of the surrounding samples to be generated (numSampT) can be derived as follows.

[0312] numSampT = nTbW * sub_width_c

[0313] At this time, nTbW is the horizontal length of the second component transformation block, and sub_width_c represents a subsampling factor of the second component block and the first component block, and may mean a value defined in Table 1 below. In this specification, sub_width_c may be used with the same meaning as SubWidthC, and may be a value representing the horizontal size ratio of the first component block and the second component block.

[0314] As another example, the horizontal length of the surrounding samples to be generated (numSampT) can be derived as follows.

[0315] numSampT = (nTbW + min(nTbW, nTbH)) * sub_width_c

[0316] At this time, nTbW is the horizontal length of the second component transformation block, nTbH is the vertical length of the second component transformation block, and min(nTbW, nTbH) may mean the smaller value among the two input values ​​nTbW, nTbH.

[0317] As another example, the horizontal length of the surrounding samples to be generated (numSampT) can be derived as follows.

[0318] numSampT = (nTbW << 1) * sub_width_c

[0319] As another example, when horizontal peripheral samples of the Nth upper peripheral sample line are generated, the horizontal length (numSampT) of the peripheral samples to be generated can be derived as follows.

[0320] numSampT = (nTbW << 1) * sub_width_c + max(1, nTbW / nTbH) * (N-1) * sub_width_c

[0321] Additionally, the vertical length of the surrounding samples to be generated (numSampL) can be derived as follows.

[0322] numSampL = nTbH * sub_height_c

[0323] At this time, nTbH is the vertical length of the second component transformation block, and sub_height_c represents a sub-sampling factor of the second component block and the first component block, and may mean a value defined in Table 1 below. In this specification, sub_height_c may be used with the same meaning as SubHeightC, and may be a value representing the vertical size ratio of the first component block and the second component block.

[0324] As another example, the vertical length of the surrounding samples to be generated (numSampL) can be derived as follows.

[0325] numSampL = (nTbH + min(nTbW, nTbH)) * sub_height_c

[0326] As another example, the vertical length of the surrounding samples to be generated (numSampL) can be derived as follows.

[0327] numSampL = (nTbH << 1) * sub_height_c

[0328] As another example, when vertical peripheral samples of the Nth left peripheral sample line are generated, the vertical length (numSampL) of the peripheral samples to be generated can be derived as follows.

[0329] numSampL = (nTbH << 1) * sub_height_c + max(1, nTbH / nTbW) * (N-1) * sub_height_c

[0330] At this time, max(1, nTbH / nTbW) can mean the larger value among the two input values ​​1, nTbH / nTbW.

[0331] At this time, the sub_width_c and the sub_height_c can be defined as shown in Table 1 below according to the color format.

[0332]

[0333] In the step (S801) of generating a peripheral sample of a first component block according to one embodiment of the present invention, the horizontal and vertical lengths of the peripheral samples to be generated may be determined by the size of the second component block (e.g., the second component transform block) and the type of cross-component prediction mode. The type of the cross-component prediction mode may mean at least one of the INTRA_LT_CCLM mode, the INTRA_T_CCLM mode, and the INTRA_L_CCLM mode.

[0334] For example, if a mode in which both top and left samples can be used among cross-component prediction modes in the current block (e.g., INTRA_LT_CCLM mode) is used, the horizontal length (numSampT) of the surrounding samples to be generated can be calculated as follows using the horizontal size (nTbW) of the second component transform block and the subsampling factors (e.g., sub_width_c) of the second component and the first component.

[0335] numSampT = nTbW * sub_width_c

[0336] As another example, if a mode in which both top and left samples can be used among cross-component prediction modes in the current block (e.g., INTRA_LT_CCLM mode) is used, the vertical length (numSampL) of the surrounding samples to be generated can be calculated as follows using the vertical size (nTbH) of the second component transform block and the subsampling factor (e.g., sub_height_c) between the second component and the first component.

[0337] numSampL = nTbH * sub_height_c

[0338] As another example, if a mode in which the top and top-right samples can be used among the cross-component prediction modes in the current block (e.g., INTRA_T_CCLM mode) is used, the horizontal length (numSampT) of the surrounding samples to be generated can be calculated as follows using the horizontal size (nTbW) of the second component transform block and the sub-sampling factor (e.g., sub_width_c) between the second component and the first component.

[0339] numSampT = (nTbW << 1) * sub_width_c

[0340] Or it can be calculated as follows:

[0341] numSampT = (nTbW + min(nTbW, nTbH)) * sub_width_c

[0342] As another example, if a mode in which left and lower left samples can be used among cross-component prediction modes in the current block (e.g., INTRA_L_CCLM mode) is used, the vertical length (numSampL) of the surrounding samples to be generated can be calculated as follows using the vertical size (nTbH) of the second component transform block and the subsampling factor (e.g., sub_height_c) between the second component and the first component.

[0343] numSampL = (nTbH << 1) * sub_height_c

[0344] Or it can be calculated as follows:

[0345] numSampL = (nTbH + min(nTbW, nTbH)) * sub_height_c

[0346] The horizontal and vertical lengths of the surrounding samples to be generated can be determined by the size of the second component block (e.g., the second component transform block), the type of cross-component prediction mode, and / or surrounding availability information.

[0347] For example, if a mode in which both top and left samples can be used among cross-component prediction modes in the current block (e.g., INTRA_LT_CCLM mode) is used, the horizontal length (numSampT) of the surrounding samples to be generated can be calculated as follows using the horizontal size (nTbW) of the second component transform block, the subsampling factor between the second component and the first component (e.g., sub_width_c), and the availability information of the top surrounding samples (availTop).

[0348] numSampT = availTop ? nTbW * sub_width_c : 0

[0349] At this time, availTop is a variable that has a value of '1' if the upper surrounding block area based on the second component block is available, and a value of '0' if it is not available.

[0350] As another example, if a cross-component prediction mode in which both top and left samples can be used in the current block (e.g., INTRA_LT_CCLM mode) is used, the vertical length of the surrounding samples to be generated (numSampL) can be calculated as follows using the vertical size of the second component transform block (nTbH), the subsampling factor between the second component and the first component (e.g., sub_height_c), and the availability information of the left surrounding samples (availLeft).

[0351] numSampL = availLeft ? nTbH * sub_height_c : 0

[0352] At this time, availLeft is a variable that has a value of '1' if the left peripheral block area based on the current second component block is available, and a value of '0' if it is not available.

[0353] As another example, if a mode in which top and top-right samples can be used among cross-component prediction modes in the current block (e.g., INTRA_T_CCLM mode) is used, the horizontal length of the surrounding samples to be generated (numSampT) can be calculated as follows using the horizontal size of the second component transform block (nTbW), the subsampling factor between the second component and the first component (e.g., sub_width_c), and the number of available samples among the surrounding samples located in the top-right (numAvailTopRightSamples).

[0354] numSampT = availTop ? (tu_width + min(numAvailTopRightSamples, tu_height)) * sub_width_c : 0

[0355] At this time, numAvailTopRightSamples can indicate the number of available samples located at the top right of the current second component block.

[0356] As another example, if a mode in which left and bottom left samples can be used among cross-component prediction modes in the current block (e.g., INTRA_L_CCLM mode) is used, the vertical length of the surrounding samples to be generated (numSampL) can be calculated as follows using the vertical size of the second component transform block (nTbH), the subsampling factor between the second component and the first component (e.g., sub_height_c), and the number of available samples among the bottom left surrounding samples (numAvailLeftBotSamples).

[0357] numSampL = availLeft ? (tu_height + min(numAvailLeftBotSamples, tu_width)) * sub_height_c : 0

[0358] At this time, numAvailLeftBotSamples can represent the number of available samples located at the lower left of the current second component block.

[0359] As a result of the expression for the above numSampT, if the value of numSampT is '0', the process of generating the surrounding samples located on the top may be omitted. In addition, as a result of the expression for the above numSampL, if the value of numSampL is '0', the process of generating the surrounding samples located on the left may be omitted.

[0360] As a variation of the above-described embodiment, numSampT represents the number of available samples among the upper and upper-right surrounding samples of the second component block, and numSampL represents the number of available samples among the left and lower-left surrounding samples of the second component block, and can be derived as follows. At this time, numSampT and numSampL can be derived differently depending on whether the prediction mode (predModeIntra) of the current block is INTRA_LT_CCLM mode.

[0361] If the prediction mode of the current block is INTRA_LT_CCLM mode,

[0362] numSampT = availT ? nTbW : 0

[0363] numSampL = availL ? nTbH : 0

[0364] If the prediction mode of the current block is not INTRA_LT_CCLM mode, i.e., INTRA_L_CCLM mode or INTRA_T_CCLM mode,

[0365] numSampT = (availT && predModeIntra == INTRA_T_CCLM) ? (nTbW + min(numTopRight, nTbH)) : 0

[0366] numSampL = (availL && predModeIntra == INTRA_L_CCLM) ? (nTbH + min(numLeftBelow, nTbW)) : 0

[0367] At this time, availT and availL may be information indicating the availability of samples around the top (or top right) and left (or bottom left) of the second component block. In addition, numTopRight may be information indicating the number of available samples among the samples around the top right of the second component block, and numLeftBelow may be information indicating the number of available samples among the samples around the bottom left of the second component block.

[0368] In the step (S801) of generating a peripheral sample of a first component block according to one embodiment of the present invention, if at least one or more of the peripheral samples of the first component block are not available, peripheral samples can be generated through padding of at least one or more internal samples of the first component block.

[0369] For example, if a left peripheral sample of the first component block is available, the left peripheral sample can be used as a peripheral sample as is, and if the left peripheral sample is not available, the peripheral sample closest to the peripheral sample can be padded, the leftmost internal sample of the first component block can be padded to the left, or the left peripheral sample can be generated using the closest peripheral sample and the leftmost internal sample of the first component block.

[0370] As another example, if the top peripheral sample of the first component block is available, the top peripheral sample can be used as the peripheral sample as is, and if the top peripheral sample is not available, the peripheral sample closest to that peripheral sample can be padded, the inner sample located at the top of the first component block can be padded to the top, or the upper peripheral sample can be generated using the closest peripheral sample and the inner sample located at the top of the first component block.

[0371] At this time, the same downsampling filter can be applied to the area where available surrounding samples exist and the area where virtual surrounding samples exist.

[0372] As another example, if the upper left peripheral sample of the first component block is available, the upper left sample can be used as a peripheral sample as is, and if the upper left peripheral sample is not available, the peripheral sample closest to that peripheral sample can be padded, the inner sample located at the upper left of the first component block can be padded to the upper left, or the upper left peripheral sample can be generated using the closest peripheral sample and the inner sample located at the upper left of the first component block.

[0373] As another example, if the upper right peripheral sample of the first component block is available, the upper right sample can be used as the peripheral sample as is, and if the upper right peripheral sample is not available, the peripheral sample closest to that peripheral sample can be padded, the inner sample located at the upper right of the first component block can be padded to the upper right, or the upper right peripheral sample can be generated using the closest peripheral sample and the inner sample located at the upper right of the first component block.

[0374] As another example, if the lower left peripheral sample of the first component block is available, the lower left sample can be used as the peripheral sample as is, and if the lower left peripheral sample is not available, the peripheral sample closest to that peripheral sample can be padded, the inner sample located at the lower left of the first component block can be padded to the lower left, or the lower left peripheral sample can be generated using the closest peripheral sample and the inner sample located at the lower left of the first component block.

[0375] If downsampling of the surrounding samples of the first component block is omitted in the step of performing downsampling for the first component samples (S802), only one or two surrounding sample lines may be generated depending on the sampling factor for the second component.

[0376] For example, if both sub_width_c and sub_height_c are 1, only the first peripheral sample line is generated, and the first peripheral sample line can be used when performing downsampling on the internal samples of the first component block. In addition, at least one sample of the first peripheral sample line can be used in the cross-component parameter derivation step (S803).

[0377] As another example, if both sub_width_c and sub_height_c are 2, a first peripheral sample line and a second peripheral sample line are generated, and the first peripheral sample line can be used when performing downsampling on internal samples of the first component block. In addition, at least one sample of the second peripheral sample line can be used in the cross component parameter derivation step (S803).

[0378] As another example, if sub_width_c is 2 and sub_height_c is 1, a first peripheral sample line and a second peripheral sample line are generated for the left or lower left peripheral samples, and the first peripheral sample line can be used when performing downsampling for the internal samples of the first component block. In addition, at least one sample of the second peripheral sample line can be used in the cross component parameter derivation step (S803).

[0379] As another example, if sub_width_c is 2 and sub_height_c is 1, only the first peripheral sample line is generated for the upper or upper-right peripheral samples, and the first peripheral sample line can be used when performing downsampling for the internal samples of the first component block. In addition, at least one sample of the first peripheral sample line can be used in the cross-component parameter derivation step (S803).

[0380] As another example, if sub_width_c is 1 and sub_height_c is 2, a first peripheral sample line and a second peripheral sample line are generated for the upper or upper-right peripheral samples, and the first peripheral sample line can be used when performing downsampling for internal samples of the first component block. In addition, at least one sample of the second peripheral sample line can be used in the cross-component parameter derivation step (S803).

[0381] As another example, when sub_width_c is 1 and sub_height_c is 2, only the first peripheral sample line is generated for the left or lower left peripheral samples, and the first peripheral sample line can be used when performing downsampling for the internal samples of the first component block. In addition, at least one sample of the first peripheral sample line can be used in the cross component parameter derivation step (S803).

[0382] Below, the downsampling step (S802) for the first component samples is described.

[0383] In a step (S802) of performing down-sampling on first component samples according to one embodiment of the present invention, it is assumed that all surrounding samples required for down-sampling are available, and thus simplified down-sampling on the first component samples can be performed as follows without determining surrounding availability. At this time, a single down-sampling filter can be used as the down-sampling filter without determining surrounding availability.

[0384] Depending on the subsampling factor (sub_width_c or sub_height_c) and subsampling method of the color format, different downsampling filters may be used.

[0385] For example, if the color format is YUV 4:4:4, downsampling may not be performed as in the following equation. That is, if the color format is YUV 4:4:4, since both sub_width_c and sub_height_c are 1, the sample values ​​of the downsampling target can be used as the downsampled result values ​​without separate downsampling.

[0386] outY[x][y] = inY[x][y], with x = -1 ... tu_width - 1, y = -1 ... tu_height - 1

[0387] At this time, outY may mean the first component sample array in which downsampling is performed, and x and y may mean the positions of the first component samples corresponding thereto when the upper left inner sample position of the second component block is assumed to be (0, 0).

[0388] In addition, inY[x][y], with x = 0 ... tu_width - 1, y = 0 ... tu_height - 1 is a restored first component sample array before deblocking filtering, and inY[-1][y], with y = -1 ... tu_height - 1 and inY[x][-1], with x = 0 ... tu_width - 1 may refer to surrounding samples generated in the surrounding sample generation step (S801) of the first component block. Here, the tu_width may refer to a horizontal size of the second component transformation block, and the tu_height may refer to a vertical size of the second component transformation block.

[0389] As another example, if the color format is YUV 4:2:2 or YUV 4:2:0, and the syntax element indicating the subsampling method for the chrominance blocks (e.g., sps_cclm_colocated_chroma_flag or sps_chroma_vertical_collocated_flag, etc.) is a value indicating co-sited (e.g., sps_cclm_colocated_chroma_flag is '1'), filtering can be performed using a cross-shaped downsampling filter with a fairly high weight at the center position of the filter, as follows:

[0390] outY[x][y] = (w[0] * inY[sub_width_c * x][sub_height_c * (y-1)] + w[1] * inY[sub_width_c * (x-1)][sub_height_c * y] + w[2] * inY[sub_width_c * inY[sub_width_c * (x+1)][sub_height_c * y] + w[4] * inY[sub_width_c * x][sub_height_c * (y+1)] + a) >> b

[0391] At this time, x = -1 ... tu_width - 1, y = -1 ... tu_height - 1.

[0392] At this time, inY[x][y] with x = 0 ... tu_width * sub_width_c - 1, y = 0 ... tu_height * sub_height_c - 1 is the restored first component sample array before deblocking filtering, and inY[-1][y], with y = -1 ... tu_height * sub_height_c - 1 and inY[x][-1], with x = 0 ... tu_width * sub_width_c - 1 may be surrounding samples generated in the surrounding sample generation step (S801) of the first component block.

[0393] At this time, the weight w can be defined as w[0] = 1, w[1] = 1, w[2] = 4, w[3] = 1, w[4] = 1. In addition, a and b are values ​​for the average and rounding operations, and can be determined based on the sum of the w values. For example, in the above equation, a can be defined as 4 and b can be defined as 3.

[0394] Alternatively, decimation downsampling filtering can be performed in which the sample value corresponding to the filtering center position is used as is.

[0395] outY[x][y] = (w[0] * inY[sub_width_c * x][sub_height_c * y] + a) >> b

[0396] At this time, x = -1 ... tu_width - 1, y = -1 ... tu_height - 1.

[0397] At this time, inY[x][y] with x = 0 ... tu_width * sub_width_c - 1, y = 0 ... tu_height * sub_height_c - 1 is the restored first component sample array before deblocking filtering, and inY[-1][y], with y = -1 ... tu_height * sub_height_c - 1 and inY[x][-1], with x = 0 ... tu_width * sub_width_c - 1 may be surrounding samples generated in the surrounding sample generation step (S801) of the first component block.

[0398] At this time, the weight w[0] can be defined as 8, and in the above equation, a can be defined as 4 and b can be defined as 3. Alternatively, the weight w[0] can be defined as 1, and a and b can each be defined as 0.

[0399] According to one embodiment of the present invention, when a syntax element (e.g., sps_cclm_colocated_chroma_flag or sps_chroma_vertical_collocated_flag, etc.) indicating a subsampling method for a chrominance block is a value indicating mid-sited (e.g., sps_cclm_colocated_chroma_flag is '0'), filtering may be performed using a downsampling filter of an NxM window that takes surrounding samples into account as follows.

[0400] outY[x][y] = (w[0] * inY[sub_width_c * inY[sub_width_c *

[0401] At this time, x = -1 ... tu_width - 1, y = -1 ... tu_height - 1.

[0402] At this time, inY[x][y] with x = 0 ... tu_width * sub_width_c - 1, y = 0 ... tu_height * sub_height_c - 1 is the restored first component sample array before deblocking filtering, and inY[-1][y], with y = -1 ... tu_height * sub_height_c - 1 and inY[x][-1], with x = 0 ... tu_width * sub_width_c - 1 may be surrounding samples generated in the surrounding sample generation step (S801) of the first component block.

[0403] At this time, the weight w can be defined as w[0] = 1, w[1] = 2, w[2] = 1, w[3] = 1, w[4] = 2, w[5] = 1 when the color format is YUV 4:2:0, and can be defined as w[0] = 2, w[1] = 4, w[2] = 2, w[3] = 0, w[4] = 0, w[5] = 0 when the color format is YUV 4:2:2. In addition, a and b are values ​​for rounding operation and can be determined by the sum of the w values. For example, in the above equation, a can be defined as 4 and b can be defined as 3.

[0404] Alternatively, if the color format is YUV 4:2:2, filtering can be performed using a downsampling filter with an Nx1 window as follows.

[0405] outY[x][y] = (w[0] * inY[sub_width_c * (x-1)][sub_height_c * y)] + w[1] * inY[sub_width_c * x)][sub_height_c * y] + w[2] * inY[sub_width_c * (x+ 1)][sub_height_c * y] + a) >> b

[0406] At this time, w[0], w[1], and w[2] can be 2, 4, and 2, respectively. Additionally, a and b can be 4 and 3, respectively.

[0407] The above downsampling methods can be performed only on the internal samples excluding the surrounding samples, i.e., inY[x][y] with x = 0 ... tu_width * sub_width_c - 1, y = 0 ... tu_height * sub_height_c - 1. In addition, downsampling can be performed only on specific locations of the surrounding samples to reduce the amount of computation.

[0408] The embodiments for the above YUV color format can be similarly applied to color formats such as RGB, ICtCP, etc.

[0409] FIG. 15 is a diagram for explaining a process of performing downsampling when the upper and left boundaries of the current block are identical to the CTU boundaries, according to one embodiment of the present invention.

[0410] Downsampling may be performed using fewer lines than in the examples described above, in order to reduce the line buffer size, if the surrounding samples located at the top, top left, and top right of the current block are included in different CTUs than the current block. Alternatively, the downsampling may be performed by padding the sample values ​​of the first surrounding sample line to the second or third surrounding sample line.

[0411] For example, as illustrated in FIG. 15, if the upper and left boundaries of the current block are identical to the CTU boundaries, downsampling can be performed by padding the sample values ​​of the first peripheral sample line to the second and third peripheral sample lines. In this case, since the left and lower left peripheral samples are not included in the line buffer, the actual peripheral values ​​can be used without padding.

[0412] Additionally, if the top and left boundaries of the current block are identical to the CTU boundaries, only the first peripheral sample line can be used for deriving cross-component parameters without performing downsampling.

[0413] According to one embodiment of the present invention, downsampling is performed only on samples at specific locations among surrounding samples and can be used to derive at least one cross component parameter.

[0414] At this time, the number of surrounding samples for which downsampling is performed can always be fixed to N for all cross-component prediction modes. At this time, N can be a non-zero positive integer.

[0415] At this time, the specific location can be calculated based on the second component block, and can be determined as follows depending on the type of cross component prediction mode, surrounding availability information, size of the transform block, or chrominance subsampling factor.

[0416] Among the upper and upper right surrounding samples, the array pickPosT for the x-axis position information of the sample to be downsampled can be derived as follows.

[0417] pickPosT[ pos ] = startPosT + pos * pickStepT, with pos = 0 ... cntT - 1

[0418] numIs4N = (Prediction mode of current block == INTRA_LT_CCLM) ? 0 : 1

[0419] startPosT = numC2SampT >> (2 + numIs4N)

[0420] pickStepT = max(1, numC2SampT >> (1 + numIs4N))

[0421] cntT = min(numC2SampT, (1 + numIs4N) << 1))

[0422] At this time, numC2SampT may mean a value obtained by dividing the numSampT value derived in the peripheral sample generation step (S801) of the first component block by sub_width_c. If constrained intra prediction is used, numC2sampT may be considered 0 or cntL may be considered 0 if the upper block is not in intra-screen prediction mode.

[0423] Therefore, the positions of the upper and upper right peripheral samples (samplePosTopC2) of the cntT second component blocks used for deriving the cross component parameters can be determined as follows.

[0424] x coordinate: samplePosTopC2[n].x = pickPosT[n] with n = 0 ... cntT - 1

[0425] y-coordinate: samplePosTopC2[n].y = -1

[0426] The downsampling center positions (samplePosTopC1) of the corresponding cntT first component blocks can be determined as follows.

[0427] x coordinate: samplePosTopC1[n].x = pickPosT[n] * sub_width_c, with n = 0 ... cntT - 1

[0428] y coordinate: samplePosTopC1[n].y = -1 * sub_height_c

[0429] Among the left and lower left surrounding samples, the array pickPosL for the y-axis position information of the sample to be down-sampled can be derived as follows.

[0430] pickPosL[ pos ] = startPosL + pos * pickStepL, with pos = 0 ... cntL - 1

[0431] numIs4N = (Prediction mode of current block == INTRA_LT_CCLM) ? 0 : 1

[0432] startPosL = numC2SampL >> (2 + numIs4N)

[0433] pickStepL = max(1, numC2SampL >> (1 + numIs4N))

[0434] cntL = min(numC2SampL, (1 + numIs4N) << 1))

[0435] At this time, numC2SampL may mean a value obtained by dividing the numSampL value derived in the peripheral sample generation step (S801) of the first component block by sub_height_c. If constrained intra-screen prediction is used, numC2sampL may be considered 0 or cntL may be considered 0 if the left block is not in intra-screen prediction mode.

[0436] Therefore, the positions of the left and lower left peripheral samples (samplePosLeftC2) of the cntL second component blocks used for deriving the cross component parameters can be determined as follows.

[0437] x-coordinate: samplePosLeftC2[n].x = -1

[0438] y coordinate: samplePosLeftC2[n].y = pickPosL[n] with n = 0 ... cntL - 1

[0439] The downsampling center positions (samplePosLeftC1) of the corresponding cntL first component blocks can be determined as follows.

[0440] x-coordinate: samplePosLeftC1[n].x = -1 * sub_width_c

[0441] y coordinate: samplePosLeftC1[n].y = pickPosL[n] * sub_width_c, with n = 0 ... cntL - 1

[0442] FIGS. 16 and 17 are diagrams for explaining downsampling center positions for a first component block based on surrounding availability information when performing downsampling for surrounding samples of a specific location, according to one embodiment of the present invention. In the present specification, the downsampling center position may mean a central sample position corresponding to the center of a downsampling filter when performing downsampling using a downsampling filter.

[0443] Referring to FIGS. 16 and 17, the downsampling center locations for the first component block (e.g., luminance block) are shown in gray according to the surrounding availability information.

[0444] Figure 16 illustrates a case where the first component block has a size of 8x4 and the INTRA_T_CCLM mode is used as the cross-component prediction mode. At this time, Figure 16(a) illustrates the down-sampling center positions (gray figures) when both the upper and upper-right surrounding samples are available, and Figure 16(b) illustrates the down-sampling center positions (gray figures) when only the upper surrounding samples are available.

[0445] Fig. 17 illustrates a case where the first component block has a size of 8x4 and the INTRA_L_CCLM mode is used as the cross-component prediction mode. In this case, Fig. 17(a) illustrates down-sampling center positions (gray figures) when both the left and lower-left surrounding samples are available, Fig. 17(b) illustrates a case where all the left surrounding samples are available and only some of the lower-left surrounding samples are available, and Fig. 17(c) illustrates a case where only the left surrounding samples are available.

[0446] As shown in FIGS. 16 and 17, the downsampling center position may vary depending on the number of available surrounding samples. However, assuming that the first component block has a size of 8x4 and all surrounding samples are available, only the case in FIG. 16(a) always occurs when the INTRA_T_CCLM mode is used as the prediction mode, and only the case in FIG. 17(a) always occurs when the INTRA_L_CCLM mode is used as the prediction mode, so the downsampling center positions can be fixed.

[0447] At this time, the same downsampling method used for downsampling internal samples can also be used for surrounding samples of the specific location selected as described above. That is, the downsampling method for surrounding samples can also be determined by the subsampling factor and subsampling method of the color format.

[0448] In the step (S802) of performing down-sampling on first component samples according to one embodiment of the present invention, when down-sampling is performed only for a specific location of a surrounding sample, it is assumed that the surrounding area is always available, and thus the process of deriving the specific location can be simplified as follows.

[0449] For example, when the cross-component prediction mode for the second component block is INTRA_LT_CCLM mode, an array pickPosT for x-axis position information of a sample to be down-sampled among upper peripheral samples and an array pickPosL for y-axis position information of a sample to be down-sampled among left peripheral samples can be derived as follows.

[0450] pickPosT[ pos ] = startPosT + pos * pickStepT, with pos = 0 ... cntT - 1

[0451] startPosT = (nTbW >> 2)

[0452] pickStepT = (nTbW >> 1)

[0453] cntT = 2

[0454] pickPosL[ pos ] = startPosL + pos * pickStepL, with pos = 0 ... cntL - 1

[0455] startPosL = (nTbH >> 2)

[0456] pickStepL = (nTbH >> 1)

[0457] cntL = 2

[0458] As another example, when the cross-component prediction mode for the second component block is INTRA_L_CCLM mode, the array pickPosL for the y-axis position information of the samples to be down-sampled among the left and lower left surrounding samples can be derived as follows.

[0459] pickPosL[ pos ] = startPosL + pos * pickStepL, with pos = 0 ... cntL - 1

[0460] startPosL = (nTbH + min(nTbW, nTbH)) >> 3 or (nTbH >> 2)

[0461] pickStepL = (nTbH + min(nTbW, nTbH)) >> 2 or (nTbH >> 1)

[0462] cntL = 4

[0463] As another example, when the cross-component prediction mode for the second component block is INTRA_T_CCLM mode, the array pickPosT for the x-axis position information of the samples to be down-sampled among the upper and upper-right surrounding samples can be derived as follows.

[0464] pickPosT[ pos ] = startPosT + pos * pickStepT, with pos = 0 ... cntT - 1

[0465] startPosT = (nTbW + min(nTbW, nTbH)) >> 3 or (nTbW >> 2)

[0466] pickStepT = (nTbW + min(nTbW, nTbH)) >> 2 or (nTbW >> 1)

[0467] cntT = 4

[0468] Therefore, the positions of the upper and upper right peripheral samples (samplePosTopC2) of the cntT second component blocks used for deriving the cross component parameters can be determined as follows.

[0469] x coordinate: samplePosTopC2[n].x = pickPosT[n] with n = 0 ... cntT - 1

[0470] y-coordinate: samplePosTopC2[n].y = -1

[0471] The downsampling center positions (samplePosTopC1) of the corresponding cntT first component blocks can be determined as follows.

[0472] x coordinate: samplePosTopC1[n].x = pickPosT[n] * sub_width_c, with n = 0 ... cntT - 1

[0473] y coordinate: samplePosTopC1[n].y = -1 * sub_height_c

[0474] Additionally, the positions of the left and lower left peripheral samples (samplePosLeftC2) of the cntL second component blocks used for deriving cross component parameters can be determined as follows.

[0475] x-coordinate: samplePosLeftC2[n].x = pickPosL[n] with n = 0 ... cntL - 1

[0476] y-coordinate: samplePosLeftC2[n].y = -1

[0477] The downsampling center positions (samplePosLeftC1) of the corresponding cntL first component blocks can be determined as follows.

[0478] x-coordinate: samplePosLeftC1[n].x = pickPosL[n] * sub_width_c, with n = 0 ... cntL - 1

[0479] y-coordinate: samplePosLeftC1[n].y = -1 * sub_height_c

[0480] Therefore, since the locations of surrounding samples where downsampling is to be performed are fixed values ​​depending on the type of cross-component prediction mode or the size of the transformation block, if a table is created based on pre-calculated values ​​of sample location information, the calculation can be derived in a table-driven manner without being performed for each block.

[0481] In the step (S802) of performing downsampling on first component samples according to one embodiment of the present invention, only samples present at a specific location among surrounding samples may be used to derive cross-component parameters. Alternatively, the result of downsampling performed around the specific location may be used to derive cross-component parameters.

[0482] At this time, the number of specific locations may vary depending on the size of the second component block. The larger the second component block, the more surrounding samples present at specific locations may be used.

[0483] For example, if the number of samples in the second component block is 16 or less, four surrounding samples existing at a specific location can be used, and if the number of samples in the second component block is more than 16, eight surrounding samples existing at a specific location can be used.

[0484] Alternatively, a syntax element indicating the number of the specific positions may be transmitted as a higher level syntax element such as SPS, PPS, or slice header so that the encoder and decoder can use the same number.

[0485] At this time, the specific location can be calculated based on the second component block, and can be determined as follows depending on the type of cross component prediction mode, surrounding availability information, size of the transform block, and / or chrominance subsampling factor.

[0486] Among the samples around the top and top right, the array pickPosT for the x-axis position information of the samples to be downsampled can be derived as follows.

[0487] pickPosT[ pos ] = startPosT + pos * pickStepT, with pos = 0 … cntT - 1

[0488] numIs4N = (Prediction mode of current block == INTRA_LT_CCLM) ? 0 : 1

[0489] isGt4 = (tuWidth > 4)? 1 : 0

[0490] startPosT = numC2SampT >> (2 + numIs4N + isGt4)

[0491] pickStepT = max(1, numC2SampT >> (1 + numIs4N + isGt4))

[0492] cntT = min(8, (Prediction mode of current block == INTRA_LT_CCLM) ? min(numC2SampT, tuWidth >> 1) : ? min(numC2SampT, tuWidth))

[0493] At this time, numC2SampT may mean a value obtained by dividing the numSampT value derived in the peripheral sample generation step (S801) of the first component block by sub_width_c.

[0494] Therefore, the positions of the upper and upper right peripheral samples (samplePosTopC2) of the cntT second component blocks used for deriving the cross component parameters can be determined as follows.

[0495] x coordinate: samplePosTopC2[n].x = pickPosT[n] with n = 0 ... cntT - 1

[0496] y-coordinate: samplePosTopC2[n].y = -1

[0497] The downsampling center positions (samplePosTopC1) of the corresponding cntT first component blocks can be determined as follows.

[0498] x coordinate: samplePosTopC1[n].x = pickPosT[n] * sub_width_c, with n = 0 ... cntT - 1

[0499] y coordinate: samplePosTopC1[n].y = -1 * sub_height_c

[0500] Among the samples around the left and lower left, the array pickPosL for the y-axis position information of the sample to be down-sampled can be derived as follows.

[0501] pickPosL[ pos ] = startPosL + pos * pickStepL, with pos = 0 … cntL - 1

[0502] numIs4N = (Prediction mode of current block == INTRA_LT_CCLM) ? 0 : 1

[0503] isGt4 = (tuHeight > 4)? 1 : 0

[0504] startPosL = numC2SampL >> (2 + numIs4N + isGt4)

[0505] pickStepL = max(1, numC2SampL >> (1 + numIs4N + isGt4))

[0506] cntL = min(8, (Prediction mode of current block == INTRA_LT_CCLM) ? min(numC2SampL, tuHeight >> 1) : ? min(numC2SampL, tuHeight))

[0507] At this time, numC2SampL may mean a value obtained by dividing the numSampL value derived in the peripheral sample generation step (S801) of the first component block by sub_height_c.

[0508] Therefore, the positions of the left and lower left peripheral samples (samplePosLeftC2) of the cntL second component blocks used for deriving the cross component parameters can be determined as follows.

[0509] x-coordinate: samplePosLeftC2[n].x = -1

[0510] y coordinate: samplePosLeftC2[n].y = pickPosL[n] with n = 0 ... cntL - 1

[0511] The downsampling center positions (samplePosLeftC1) of the corresponding cntL first component blocks can be determined as follows.

[0512] x-coordinate: samplePosLeftC1[n].x = -1 * sub_width_c

[0513] y coordinate: samplePosLeftC1[n].y = pickPosL[n] * sub_width_c, with n = 0 ... cntL - 1

[0514] In the step (S802) of performing downsampling on first component samples according to one embodiment of the present invention, only surrounding samples present at a specific location among surrounding samples may be used to derive cross-component parameters. Alternatively, when the result of downsampling centered on a specific location is used to derive cross-component parameters, the process of deriving the specific location may be simplified as follows, assuming that the surrounding area is always valid.

[0515] For example, if the cross-component prediction mode of the second component block for the current block is INTRA_LT_CCLM mode, an array pickPosT for x-axis position information of a sample to be down-sampled among upper surrounding samples and an array pickPosL for y-axis position information of a sample to be down-sampled among left surrounding samples can be derived as follows.

[0516] pickPosT[ pos ] = startPosT + pos * pickStepT, with pos = 0 … cntT - 1

[0517] isGt4 = (tuWidth > 4)? 1 : 0

[0518] startPosT = (nTbW >> (2 + isGt4))

[0519] pickStepT = (nTbW >> (1 + isGt4))

[0520] cntT = min(8, tuWidth >> 1)

[0521] pickPosL[ pos ] = startPosL + pos * pickStepL, with pos = 0 … cntL - 1

[0522] isGt4 = (tuHeight > 4)? 1 : 0

[0523] startPosL = (nTbH >> (2 + isGt4))

[0524] pickStepL = (nTbH >> (1 + isGt4))

[0525] cntL = min(8, tuHeight >> 1)

[0526] As another example, if the cross-component prediction mode of the second component block for the current block is INTRA_L_CCLM mode, the array pickPosL for the y-axis position information of the samples to be down-sampled among the left and lower left surrounding samples can be derived as follows.

[0527] pickPosL[ pos ] = startPosL + pos * pickStepL, with pos = 0 … cntL - 1

[0528] isGt4 = (tuHeight > 4) ? 1:0

[0529] startPosL = (nTbH + min(nTbW, nTbH)) >> (3 + isGt4)) or (nTbH >> (2 + isGt4))

[0530] pickStepL = (nTbH + min(nTbW, nTbH)) >> (2 + isGt4)) or (nTbH >> (1 + isGt4))

[0531] cntL = min(8, tuWidth)

[0532] As another example, if the cross-component prediction mode of the second component block for the current block is INTRA_T_CCLM mode, the array pickPosT for the x-axis position information of the samples to be down-sampled among the upper and upper-right surrounding samples can be derived as follows.

[0533] pickPosT[ pos ] = startPosT + pos * pickStepT, with pos = 0 … cntT - 1

[0534] isGt4 = (tuHeight > 4) ? 1:0

[0535] startPosT = (nTbW + min(nTbW, nTbH)) >> (3 + isGt4)) or (nTbW >> (2 + isGt4))

[0536] pickStepT = (nTbW + min(nTbW, nTbH)) >> (2 + isGt4)) or (nTbW >> (1 + isGt4))

[0537] cntT= min(8, tuHeight)

[0538] Therefore, the positions of the upper and upper right peripheral samples (samplePosTopC2) of the cntT second component blocks used for deriving the cross component parameters can be determined as follows.

[0539] x coordinate: samplePosTopC2[n].x = pickPosT[n] with n = 0 ... cntT - 1

[0540] y-coordinate: samplePosTopC2[n].y = -1

[0541] The downsampling center positions (samplePosTopC1) of the corresponding cntT first component blocks can be determined as follows.

[0542] x coordinate: samplePosTopC1[n].x = pickPosT[n] * sub_width_c, with n = 0 ... cntT - 1

[0543] y coordinate: samplePosTopC1[n].y = -1 * sub_height_c

[0544] Additionally, the positions of the left and lower left peripheral samples (samplePosLeftC2) of the cntL second component blocks used for deriving cross component parameters can be determined as follows.

[0545] x-coordinate: samplePosLeftC2[n].x = pickPosL[n] with n = 0 ... cntL - 1

[0546] y-coordinate: samplePosLeftC2[n].y = -1

[0547] The downsampling center positions (samplePosLeftC1) of the corresponding cntL first component blocks can be determined as follows.

[0548] x-coordinate: samplePosLeftC1[n].x = pickPosL[n] * sub_width_c, with n = 0 ... cntL - 1

[0549] y-coordinate: samplePosLeftC1[n].y = -1 * sub_height_c

[0550] Therefore, since the locations of surrounding samples where downsampling is to be performed are fixed values ​​depending on the type of cross-component prediction mode or the size of the transformation block, if a table is created based on pre-calculated values ​​of sample location information, the calculation can be derived in a table-driven manner without being performed for each block.

[0551] The step (S802) of performing down-sampling on the first component samples according to one embodiment of the present invention may be omitted. That is, the surrounding samples of the first component block corresponding to the position of the derived down-sampled sample may be used in the cross-component parameter derivation step (S803) without performing the down-sampling process.

[0552] However, the step S802 may be omitted only when the number of samples of a relatively small block, i.e., the second component block, is less than or equal to a threshold value defined equally in the encoder / decoder.

[0553] That is, if the number of samples of the second component block exceeds the threshold value, downsampling of the surrounding samples of the first component block may be performed.

[0554] When performing downsampling on internal samples of a first component block, if surrounding samples are not available, at least one or more of the nearest internal samples may be used for padding to generate surrounding samples, and then downsampling may be performed. In this case, downsampling may be performed using a single downsampling filter.

[0555] Below, the cross component parameter derivation step (S803) is described.

[0556] In the cross-component parameter derivation step (S803) according to one embodiment of the present invention, at least one or more surrounding samples of the second component block and at least one or more surrounding samples of the first component block area corresponding to the second component block area may be used to derive one or more parameters of a predefined linear or nonlinear relationship.

[0557] For example, among the surrounding samples of the second component block, only at least one or more specific position samples (samplePosLeftC2) described above can be used to derive at least one parameter. Down-sampled surrounding samples of the first component block area corresponding to the specific position can be used to derive at least one parameter.

[0558] As another example, assuming that the surrounding samples in the previous step are always valid, only a fixed number (e.g., F, where F is a non-zero positive integer) of surrounding samples (samplePosLeftC2) of the second component surrounding block can be used to derive at least one parameter. In addition, a fixed number (e.g., F) of down-sampled surrounding samples of the first component block area can be used to derive at least one parameter.

[0559] As another example, at least one parameter may be derived using only a fixed number of surrounding samples of a second component block located at specific locations. Furthermore, at least one parameter may be derived using a fixed number of downsampled surrounding samples of a first component block area located at specific locations.

[0560] As another example, among the down-sampled first component samples corresponding to the surrounding samples of the second component block, a max_c1 sample set including the top N samples by sorting the sample values ​​located at a fixed number of specific positions in descending order and a min_c1 sample set including the top M samples by sorting the sample values ​​located at a fixed number of specific positions in ascending order may be used to derive at least one parameter. In this case, M and N may be non-zero positive integers.

[0561] In addition, at least one parameter may be derived by using a max_c2 sample set including N samples of a second component block area corresponding to sample positions of the max_c1 sample set and a min_c2 sample set including M samples of a second component block area corresponding to sample positions of the min_c1 sample set. In this case, M and N may be non-zero positive integers.

[0562] At this time, the specific location can be derived in the step (S802) of performing downsampling for the first component samples, and can vary depending on at least one of the horizontal size, vertical size, color format, sub-sampling method of the chrominance signal, or type of cross-component prediction mode of the transformation block (or coding block).

[0563] As another example, statistical values ​​such as mean, maximum, and / or minimum for samples within the sample set (e.g., max_c1, max_c2, min_c1, min_c2) may be used to derive at least one parameter of a predefined linear or nonlinear relationship.

[0564] As another example, at least one of the sample sets may be used to derive at least one parameter of a predefined linear or nonlinear relationship.

[0565] As another example, when the YUV color format is used, the position information of the max_c1, min_c1 sample sets of the Y component can be used to derive the max_c2, min_c2 sample sets of the U component and the max_c2, min_c2 sample sets of the V component.

[0566] As another example, among the surrounding samples of the second component block, at least one parameter may be derived by using a max_c2 sample set including the top N samples by sorting the sample values ​​(samplePosLeftC2) located at a fixed number of specific positions in descending order and a min_c2 sample set including the top M samples by sorting the sample values ​​in ascending order. In this case, M and N may be non-zero positive integers.

[0567] Additionally, at least one parameter may be derived by using a max_c1 sample set including N samples of a down-sampled first component block region corresponding to sample positions of the max_c2 sample set and a min_c1 sample set including M samples of a down-sampled first component block region corresponding to sample positions of the min_c2 sample set.

[0568] As another example, when the YUV color format is used, the position information of the max_c2, min_c2 sample sets of the U or V component can be used to derive the max_c1, min_c1 sample sets of the Y component.

[0569] In the cross-component parameter derivation step (S803) according to one embodiment of the present invention, when the cross-component prediction mode is used for the current block, one or more parameters of a predefined linear or nonlinear relationship can be derived for a fixed number of surrounding samples regardless of the number of available surrounding samples, assuming that surrounding samples are always available.

[0570] At this time, the surrounding sample used for deriving the above parameters may have a fixed position depending on the size of the conversion coefficient, and may be a virtual sample generated in the surrounding sample generation step (S801) of the first component block.

[0571] For example, at least one of the above-described sample sets and the following simplified linear relationship may be used to derive at least one of the parameters k, a and b for cross-component prediction of the second component block.

[0572] diff = avg_max_c1 - avg_min_c1

[0573] At this time, avg_max_c1 may be the average value of at least one sample of the max_c1 sample set. Additionally, avg_min_c1 may be the average value of at least one sample of the min_c1 sample set.

[0574] If diff is not 0,

[0575] diffC = avg_max_c2 - avg_min_c2

[0576] At this time, avg_max_c2 may be the average value of at least one sample of the max_c2 sample set. In addition, avg_min_c2 may be the average value of at least one sample of the min_c2 sample set.

[0577] x = Floor(Log2(diff))

[0578] normDiff = ((diff<<4)>>x) & 15

[0579] x += (normDiff!= 0) ? 1 : 0

[0580] y = Floor(Log2(Abs(diffC)))+1

[0581] a = (diffC*(divSigTable[normDiff]|8)+2 y-1 ) >> y

[0582] k = ((3+xy) < 1) ? 1 : 3+xy

[0583] a = ((3+xy) < 1) ? Sign(a)*15 : a

[0584] b = avg_min_c2 - ((a* avg_min_c1)>>k)

[0585] where divSigTable[]={0, 7, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 0}

[0586] If diff is 0,

[0587] k = 0

[0588] a = 0

[0589] b = avg_min_c2

[0590] For example, when a YUV color format is used, avg_max_c1, avg_min_c1 sample sets corresponding to the Y component and avg_max_c2, avg_min_c2 sample sets corresponding to the U component can be used to derive parameters for cross-component prediction of the U component block.

[0591] Additionally, when a YUV color format is used, avg_max_c1, avg_min_c1 sample sets corresponding to the Y component and avg_max_c2, avg_min_c2 sample sets corresponding to the V component can be used to derive parameters for cross-component prediction of the V component block.

[0592] Below, the prediction sample generation step (S804) of the second component block is described.

[0593] In the prediction sample generation step (S804) of the second component block according to one embodiment of the present invention, the cross component parameter derived in the S803 step may be used to generate prediction samples of the second component block.

[0594] For example, the above-described down-sampled first component sample block (ds_c1) and at least one of the cross component parameters k, a, and b can be used to generate prediction samples (pred_samples) of a second component block of size NxM as in the following equation.

[0595] pred_samples[ x ][ y ] = Clip1C(((ds_c1[ x ][ y ] * a) >> k) + b), with x = 0...N-1, y = 0...M-1

[0596] At this time, Clip1C(x) = Clip3(0, (1 << bit_depth_c2) - 1, x),

[0597] Here, bit_depth_c2 is a value representing the bit depth of the second component, and Clip3(x,y,z) may be a function that clips the z value so that it only has a range greater than or equal to x and less than or equal to y.

[0598] FIG. 18 and FIG. 19 are flowcharts illustrating a process for performing down-sampling on internal samples of a first component block according to one embodiment of the present invention.

[0599] In FIGS. 18 and 19, the center positions of the samples on which downsampling is to be performed are shown in gray, and the numbers (e.g., 1, 2, 4) written on each sample may indicate weights. Here, the weights may indicate filter coefficients of the downsampling filter.

[0600] Referring to Fig. 18, the locations of the internal samples of the first component block can be divided into four groups (e.g., C, TI, LI, I) (1810). In this case, TN may represent the location of the upper peripheral sample, and LN may represent the location of the left peripheral sample. In addition, the inner samples in Fig. 18 refer to the internal samples of the block.

[0601] Additionally, the type of filter used for downsampling, the shape of the filter, the length of the filter, the size of the filter, and / or the filter coefficients may vary depending on the value of the syntax element (sps_cclm_colocated_chroma_flag) indicating the subsampling method for the chrominance block, the location of each internal sample, the availability of the left sample (availL), and the availability of the top sample (availT).

[0602] For example, as illustrated in FIG. 18, if the value of sps_cclm_colocated_chroma_flag is '1' (or the first value) and the internal sample of the first component block is classified into group C, the type of filter used for downsampling, the shape of the filter, the length of the filter, the size of the filter, and / or the filter coefficients may vary depending on the values ​​of availL and / or availT. If the internal sample is classified into group C, and both availL and availT are 'Yes', downsampling may be performed using values ​​in which a weight of 4 is applied to the center sample on which downsampling is to be performed, and weights of 1 are applied to the samples above, to the left, to the right, and below the center sample on which downsampling is to be performed. If availL is 'Yes' and availT is 'No', downsampling may be performed using values ​​in which a weight of 2 is applied to the center sample on which downsampling is to be performed, and weights of 1 are applied to the samples to the left and right of the center sample on which downsampling is to be performed. If availL is 'No' and availT is 'Yes', downsampling may be performed using a value with a weight of 2 applied to the center sample on which downsampling is to be performed and a value with a weight of 1 applied to the upper and lower samples of the center sample on which downsampling is to be performed. If both availL and availT are 'No', downsampling may be performed using a value with a weight of 1 applied to the center sample on which downsampling is to be performed.

[0603] Also, referring to FIG. 19, similarly to FIG. 18, the locations of internal samples of the first component block can be divided into four groups (e.g., C, TI, LI, I) (1910). On the other hand, in FIG. 19, unlike FIG. 18, at least one of the type of filter, the shape of the filter, the length of the filter, the size of the filter, and / or the filter coefficients can be changed only by the value of the syntax element (sps_cclm_colocated_chroma_flag) indicating the subsampling method for the chrominance block.

[0604] For example, as illustrated in FIG. 19, if the value of sps_cclm_colocated_chroma_flag is '1' (or the first value), down sampling may be performed using a value in which a weight of 4 is applied to the center sample on which down sampling is to be performed, and a weight of 1 is applied to the upper, left, right, and lower samples of the center sample on which down sampling is to be performed. If the value of sps_cclm_colocated_chroma_flag is '0' (or the second value), down sampling may be performed using a value in which a weight of 2 is applied to the center sample on which down sampling is to be performed, a weight of 1 is applied to the left, right, lower left, and lower right samples of the center sample on which down sampling is to be performed, and a weight of 2 is applied to the lower sample of the center sample on which down sampling is to be performed.

[0605] Therefore, according to one embodiment of the present invention, downsampling of internal samples in the first component block region can be simplified. Furthermore, since the same downsampling filter can be applied to all sample positions and conditional branching statements can be eliminated, parallel processing implementation can be facilitated.

[0606] FIG. 20 and FIG. 21 are flowcharts illustrating a process for performing down sampling on upper peripheral samples of a first component block according to one embodiment of the present invention.

[0607] In FIGS. 20 and 21, the center positions of the samples on which down-sampling is to be performed are shown in gray, and the numbers (e.g., 1, 2, 4) written on each sample may indicate weights. Here, the weights may indicate filter coefficients of the down-sampling filter.

[0608] Referring to Figure 20, the upper peripheral sample of the first component block can be represented as TN (2010).

[0609] In addition, the type of filter used for downsampling, the shape of the filter, the length of the filter, the size of the filter, and / or the filter coefficients may vary depending on whether the X-axis position of the location where downsampling is to be performed is greater than 0 within the first component block (X > 0), the value of the syntax element (sps_cclm_colocated_chroma_flag) indicating the subsampling method for the chrominance block, whether the location where downsampling is to be performed is a CTU boundary (CTU boundary), and whether the upper left sample is available (availTL).

[0610] For example, as illustrated in FIG. 20, if the value of sps_cclm_colocated_chroma_flag is '1' (or the first value) and the X-axis position of the position where down sampling is to be performed is greater than 0 (X > 0) within the first component block, the type of filter used for down sampling, the shape of the filter, the length of the filter, the size of the filter, and / or the filter coefficients may vary depending on whether the position where down sampling is to be performed is a CTU boundary. If the position where down sampling is to be performed is not a CTU boundary (when the CTU boundary value is 'FALSE'), down sampling may be performed using a value in which a weight of 4 is applied to the center sample where down sampling is to be performed, and a weight of 1 is applied to the samples above, to the left, to the right, and below the center sample where down sampling is to be performed. If the location where down sampling is to be performed is a CTU boundary (when the CTU boundary value is 'TRUE'), down sampling can be performed using a value in which a weight of 2 is applied to the center sample where down sampling is to be performed and a weight of 1 is applied to the left and right samples of the center sample where down sampling is to be performed.

[0611] On the other hand, referring to FIG. 21, unlike FIG. 20, at least one of the type of filter, shape of filter, length of filter, size of filter and / or filter coefficient may be changed only by the value of the syntax element (sps_cclm_colocated_chroma_flag) indicating the subsampling method for the chroma block and / or whether the location where downsampling is to be performed is a CTU boundary (CTU boundary).

[0612] For example, as illustrated in FIG. 21, if the location where down sampling is to be performed is a CTU boundary (when the CTU boundary value is 'TRUE'), down sampling may be performed using values ​​in which a weight of 2 is applied to the center sample where down sampling is to be performed and a weight of 1 is applied to the left and right samples of the center sample where down sampling is to be performed. If the location where down sampling is to be performed is not a CTU boundary (when the CTU boundary value is 'FALSE') and the value of sps_cclm_colocated_chroma_flag is '1' (or the first value), down sampling may be performed using values ​​in which a weight of 4 is applied to the center sample where down sampling is to be performed and a weight of 1 is applied to the upper, left, right, and lower samples of the center sample where down sampling is to be performed. If the location where down sampling is to be performed is not a CTU boundary (the CTU boundary value is 'FALSE') and the value of sps_cclm_colocated_chroma_flag is '0' (or the second value), down sampling can be performed using values ​​in which a weight of 2 is applied to the center sample where down sampling is to be performed, a weight of 1 is applied to the left, right, lower left, and lower right samples of the center sample where down sampling is to be performed, and a weight of 2 is applied to the lower sample of the center sample where down sampling is to be performed.

[0613] Therefore, according to one embodiment of the present invention, downsampling of samples surrounding the upper portion of the first component block region can be simplified. Furthermore, since the same downsampling filter can be applied to all sample positions and conditional branching statements can be eliminated, parallel processing implementation can be facilitated.

[0614] FIG. 22 and FIG. 23 are flowcharts illustrating a process for performing down-sampling on left peripheral samples of a first component block according to one embodiment of the present invention.

[0615] In FIGS. 22 and 23, the center positions of the samples where down-sampling is to be performed are shown in gray, and the numbers (e.g., 1, 2, 4) written on each sample may indicate weights. Here, the weights may indicate filter coefficients of the down-sampling filter.

[0616] Referring to Figure 22, the left peripheral samples of the first component block can be represented as LN (2210).

[0617] Additionally, the type of filter used for downsampling, the shape of the filter, the length of the filter, the size of the filter, and / or the filter coefficients may vary depending on whether the Y-axis position of the location where downsampling is to be performed is greater than 0 within the first component block (Y > 0), the value of the syntax element (sps_cclm_colocated_chroma_flag) indicating the subsampling method for the chrominance block, and the availability of upper left peripheral samples (availTL).

[0618] For example, as illustrated in FIG. 22, if the value of sps_cclm_colocated_chroma_flag is '0' (or the second value), that is, if the value of sps_cclm_colocated_chroma_flag is not '1', down sampling may be performed using a value in which a weight of 2 is applied to the center sample on which down sampling is to be performed, a weight of 1 is applied to the left, right, lower left, and lower right samples of the center sample on which down sampling is to be performed, and a weight of 2 is applied to the lower sample of the center sample on which down sampling is to be performed. If the value of sps_cclm_colocated_chroma_flag is '1' (or the first value), the type of filter used for down sampling, the shape of the filter, the length of the filter, the size of the filter, and / or the filter coefficients may vary depending on whether the Y-axis position of the position on which down sampling is to be performed is greater than 0 within the first component block and whether the upper left surrounding samples are available (availTL).

[0619] On the other hand, referring to Fig. 23, unlike Fig. 22, at least one of the type of filter, the shape of the filter, the length of the filter, the size of the filter, and / or the filter coefficients can be changed only by the value of the syntax element (sps_cclm_colocated_chroma_flag) indicating the subsampling method for the chroma block.

[0620] For example, as illustrated in FIG. 23, if the value of sps_cclm_colocated_chroma_flag is '1' (or the first value), down sampling may be performed using a value in which a weight of 4 is applied to the center sample on which down sampling is to be performed, and a weight of 1 is applied to the upper, left, right, and lower samples of the center sample on which down sampling is to be performed. If the value of sps_cclm_colocated_chroma_flag is '0' (or the second value), that is, if the value of sps_cclm_colocated_chroma_flag is not '1', down sampling may be performed using a value in which a weight of 2 is applied to the center sample on which down sampling is to be performed, a weight of 1 is applied to the left, right, lower left, and lower right samples of the center sample on which down sampling is to be performed, and a weight of 2 is applied to the lower sample of the center sample on which down sampling is to be performed.

[0621] Therefore, according to one embodiment of the present invention, downsampling of left peripheral samples of the first component block region can be simplified. Furthermore, since the same downsampling filter can be applied to all sample positions and conditional branching statements can be eliminated, parallel processing implementation can be facilitated.

[0622] At least one embodiment of the present invention can be applied to all types of intra-screen prediction modes, thereby simplifying the processing processes for each intra-screen prediction mode. For example, one embodiment of the present invention can be applied to Matrix-based Intra Prediction (MIP) mode.

[0623] MIP mode is a method of generating a prediction sample of the current block by multiplying a pre-defined or pre-transmitted matrix with already decoded surrounding samples.

[0624] However, in MIP mode, as in other intra-frame prediction modes, there may be cases where surrounding samples are unavailable. Therefore, by generating virtual samples for unavailable samples using available samples during intra-frame prediction, surrounding samples are always available, allowing prediction samples for the current block to be generated in MIP mode in a simplified manner without having to determine the availability of surrounding samples.

[0625] That is, before performing prediction using the MIP mode, a process of generating peripheral samples is performed so that peripheral samples, which are reference samples, can always be available. Prediction using the MIP mode can be performed using the available peripheral samples. The process of generating peripheral samples may refer to a process of generating unavailable samples using available samples, and may be referred to as a reference sample generation process. In addition, the process of generating peripheral samples may be performed by including at least one of an availability determination process and a sample replacement process.

[0626] For intra-screen prediction, at least one of the encoding / decoding methods related to at least one intra-screen prediction mode (e.g., MIP, ISP, Angular Intra Mode, etc.) may be used to share the generated surrounding samples. Here, ISP may refer to Intra Sub-Partition mode, and Angular Intra Mode may refer to an intra-screen prediction mode that performs intra-screen prediction according to an angle.

[0627] That is, a process of generating surrounding samples, which are reference samples, is performed before performing prediction using at least one of MIP mode, ISP mode, and Angular Intra Mode, so that the surrounding samples can always be available.

[0628] Additionally, sharing the generated surrounding samples in encoding / decoding methods related to the intra-screen prediction mode may mean using the generated surrounding samples in the same way in the encoding / decoding methods related to the intra-screen prediction mode. In other words, the method for generating the surrounding samples in the encoding / decoding methods related to the intra-screen prediction mode may be the same.

[0629] At this time, the length of the left peripheral sample can be set to twice the vertical length of the transformation block (or coding block), and the length of the upper peripheral sample can be set to twice the horizontal length of the transformation block (or coding block).

[0630] Alternatively, the length of the left peripheral sample may be determined as the sum of the vertical and horizontal lengths of the transform block (or coding block), and the length of the top peripheral sample may be determined as the sum of the horizontal and vertical lengths of the transform block (or coding block).

[0631] Therefore, the peripheral samples may consist of left peripheral samples, top peripheral samples, and one top left peripheral sample.

[0632] According to one embodiment of the present invention, the length of the generated peripheral samples may vary depending on the intra-screen prediction mode. In this case, at least one of the encoding / decoding methods related to the intra-screen prediction mode (e.g., MIP mode, ISP mode, Angular Intra Mode, etc.) may generate peripheral samples to perform intra-screen prediction. In this case, the peripheral samples may be used in the same sense as reference samples.

[0633] At this time, when Angular Intra Mode is used as the on-screen prediction mode, the lengths of the surrounding samples on the top and left can be set to twice the horizontal and vertical lengths of the transformation block (or coding block), respectively.

[0634] Additionally, when MIP mode is used as the on-screen prediction mode, the lengths of the top and left peripheral samples can be determined in various ways.

[0635] For example, when MIP mode is used, the length of the left peripheral sample can be determined as the vertical length of the transform block (or coding block) + 1, and the length of the top peripheral sample can be determined as the horizontal length of the transform block (or coding block) + 1. As a result, even if the top or left is a picture, subpicture, slice, or tile boundary and thus no sample is available, the sample values ​​present in the top right or bottom left can be used to generate the top or left peripheral samples.

[0636] As another example, when MIP mode is used, the length of the left peripheral sample can be determined as the vertical length of the transform block (or coding block), the length of the top peripheral sample can be determined as the horizontal length of the transform block (or coding block) + 1, or the length of the top peripheral sample can be determined as twice the horizontal length of the transform block (or coding block). This allows the sample values ​​present in the upper right to be used to generate the top or left peripheral samples even if the top is a picture, subpicture, slice, or tile boundary and thus no samples are available.

[0637] Alternatively, when MIP mode, Angular Intra Mode, DC mode, or Planar mode is used, the length of the left peripheral sample can be set to twice the vertical length of the transform block, and the length of the top peripheral sample can be set to twice the horizontal length of the transform block.

[0638] And, when the ISP (Intra Sub-Partition) mode is used, the length of the left peripheral sample can be determined as the sum of the vertical length of the transform block and the vertical length of the coding block, and the length of the upper peripheral sample can be determined as the sum of the horizontal length of the transform block and the horizontal length of the coding block.

[0639] FIG. 24 is a diagram for explaining a process of generating a virtual sample by using available surrounding samples when there is an unavailable sample among surrounding samples, according to one embodiment of the present invention.

[0640] Referring to FIG. 24, the intra-screen prediction according to one embodiment of the present invention may include a peripheral sample line generation step (S2401), a peripheral sample filtering step (S2402), and an intra-screen prediction execution step (S2403). At this time, in the intra-screen prediction execution step (S2403), at least one of the intra-screen prediction modes including Angular Intra Mode, CCLM (Cross-Component Linear Model) mode, and MIP mode may be used. As a result of performing step S2403, an intra-screen prediction sample may be generated.

[0641] Before the above intra-screen prediction mode is used to perform intra-screen prediction, if at least one of the surrounding samples is not available, the available samples may be used to generate virtual samples.

[0642] At this time, if at least one sample among the surrounding samples is not available, an availability determination process and a sample replacement process that can be used in a general on-screen prediction mode can be performed.

[0643] For example, when the intra-screen prediction mode of the current block is the MIP mode, reference samples of the MIP mode can be constructed from the surrounding samples of the current block to perform the MIP mode. The construction of the reference samples of the MIP mode can be performed similarly to the construction of reference samples of the general intra-screen prediction mode. For example, when constructing reference samples of the MIP mode from the surrounding samples of the current block, it can first be checked whether the surrounding samples are available. Thereafter, unavailable surrounding samples can be replaced using available surrounding samples, thereby constructing reference samples of the MIP mode.

[0644] Accordingly, when the current prediction mode is an intra-screen prediction mode, the encoder / decoder can generate peripheral sample lines in common for all modes (S2401) or perform peripheral sample filtering (S2402), and generate intra-screen prediction samples according to each mode (S2403). At this time, the length of the peripheral samples to be generated, whether to generate multiple peripheral sample lines, and / or whether to filter the generated samples may vary depending on each intra-screen prediction mode. Here, the multiple peripheral sample lines may mean two or more peripheral sample lines. One of the two or more peripheral sample lines may be used for intra-screen prediction. That is, the multiple peripheral sample lines may mean MRL (Multiple Reference Line).

[0645] FIG. 25 is a diagram illustrating a simplified embodiment of syntax elements related to MRL (Multiple Reference Line) according to one embodiment of the present invention.

[0646] According to one embodiment of the present invention, when MRL (Multiple Reference Line) is used for intra-screen prediction, when generating peripheral sample lines for blocks located at the upper boundary of a CTU, only the reconstructed samples of the closest upper line are used, and the second, third, and fourth peripheral sample lines can be generated through processes such as padding of the closest upper line. Accordingly, when intra-screen prediction through MRL is performed on all blocks, encoding / decoding can be performed regardless of whether it is a CTU boundary. Accordingly, compression efficiency can be improved, and the parsing processing rate for the syntax element can be improved because the conditional statement regarding whether it is a CTU boundary is removed when encoding / decoding an MRL syntax element.

[0647] For example, referring to FIG. 25, the condition on whether the intra_luma_ref_idx syntax element is transmitted or not (e.g., ((y0 % CtbSizeY) > 0)) regarding whether the CTU boundary is present can be removed.

[0648] Referring to FIG. 25, the MRL enabled information (sps_mrl_enabled_flag) signaled in at least one of the parameter sets may indicate whether intra-picture prediction using MRL is enabled. For example, if the MRL enabled information indicates a specific value (e.g., '1'), multiple peripheral sample lines may be utilized when intra-picture prediction is performed on the current block.

[0649] Additionally, the peripheral sample line indicator (intra_luma_ref_idx) may be an indicator that determines the peripheral sample line when intra-screen prediction using MRL is used. In this case, the peripheral sample line indicator may be used with the same meaning as the reference sample line indicator.

[0650] Additionally, the block splitting indicator (intra_subpartitions_mode_flag) can indicate whether the current block predicted within the screen is split. In other words, the block splitting indicator can indicate whether to use the ISP (Intra Sub-Partition) mode.

[0651] Additionally, the block split direction indicator (intra_subpartitions_split_flag) can indicate whether the split direction of the current block predicted within the screen is horizontal or vertical. In this case, the block split direction indicator can be signaled when the block splitting status indicator indicates "split."

[0652] Referring to FIG. 25, in one embodiment of the present invention, the condition on whether there is a CTU boundary related to whether a surrounding sample line indicator is signaled (e.g., ((y0 % CtbSizeY) > 0)) is removed, so that the parsing processing rate for the syntax element can be improved.

[0653] The cross component prediction according to the present invention has been described above, and the present invention may include various variations of performing cross component prediction based on the above.

[0654] FIGS. 26 to 31 are diagrams for explaining one embodiment of a cross-component prediction process according to the present invention.

[0655] FIG. 26 and FIG. 27 may be examples that specify input and output for performing the aforementioned cross component prediction and specifically implement the peripheral sample generation step (S801) of the first component block.

[0656] More specifically, according to FIGS. 26 and 27, the positions (xTbY, yTbY) of the corresponding first component blocks can be derived based on the positions (xTbC, yTbC) of the second component blocks and the size ratios (SubWidthC, SubHeightC) of the first and second component blocks. In addition, the availability of surrounding samples (avail, availT, availL, etc.) can be determined, and the number of available surrounding samples (numSampT, numSampL) and various variables described above (numIs4N, startPosN, numSampN, cntN, pickPosN, pickStepN, etc.) can be derived.

[0657] When the numbers of available surrounding samples numSampL and numSampT are both 0, the prediction samples (predSamples) of the second component block can be generated based on the bit depth, as in Equation 27-7.

[0658] When numSampL or numSampT is not 0, as a step for performing cross-component prediction, the reconstructed samples (before performing deblocking filtering) of the first component block at a position corresponding to the position of the second component block may be assigned as internal samples (collocated luma samples pY[x][y]) of the first component block. In addition, neighboring luma samples pY[x][y] of the first component block may be generated.

[0659] FIG. 28 and FIG. 29 may be examples of specifically implementing a down-sampling step (S802) for first component samples as a step for performing the aforementioned cross component prediction.

[0660] As illustrated in FIGS. 28 and 29, downsampling may be performed on the reconstructed first component block corresponding to the second component block, so as to generate down-sampled collocated luma samples pDsY[x][y]. Specifically, when both SubWidthC and SubHeightC are 1, i.e., when the color format is YUV 4:4:4, downsampling may not be performed as in Equation 28-1. When SubWidthC or SubHeightC is not 1, the filter coefficients for downsampling may be determined first, and the determined filter coefficients may be used to perform downsampling. The filter coefficients and the form of the filter to be used for downsampling may be determined in various ways as described above. The downsampling may be performed based on, for example, the size ratio of the first component block and the second component block (SubWidthC, SubHeightC), information signaled through the bitstream (sps_chroma_vertical_collocated_flag), etc. Additionally, the above downsampling may be performed on the restored left and upper peripheral samples of the first component block, respectively, so that pSelDsY can be generated.

[0661] FIG. 30 and FIG. 31 are examples of steps for performing the aforementioned cross component prediction, which may be examples of specifically implementing the cross component parameter derivation step (S803).

[0662] As illustrated in FIG. 30, a maximum value (maxY) and a minimum value (minY) can be determined from the down-sampled peripheral samples pSelDsY of the first component block. For example, the maximum value (maxY) can be derived as an average of a first maximum value and a second maximum value in pSelDsY. In addition, the minimum value (minY) can be derived as an average of a first minimum value and a second minimum value in pSelDsY. In addition, a maximum value (maxC) and a minimum value (minC) can be determined from the peripheral samples pSelC of the second component block. For example, the maximum value (maxC) can be derived as an average of a value of a second component sample corresponding to a first maximum value in pSelDsY and a value of a second component sample corresponding to a second maximum value. In addition, the minimum value (minC) can be derived as an average of a value of a second component sample corresponding to a first minimum value in pSelDsY and a value of a second component sample corresponding to a second minimum value.

[0663] Thereafter, as illustrated in FIG. 31, at least one of the cross component parameters a, b, and k can be derived.

[0664] Using the above-derived cross component parameters, cross component prediction can be performed as in Equation 31-18 of FIG. 31 to generate prediction samples (predSamples) of the second component block.

[0665] Figures 32 to 57 illustrate various variations of the cross-component prediction process according to the present invention.

[0666] The variations illustrated in FIGS. 32 to 57 are modifications of some of the embodiments illustrated in FIGS. 26 to 31, and the basic procedures may be the same. Specifically, FIGS. 32 to 37 illustrate a first variation (variation #1), FIGS. 38 to 42 illustrate a second variation (variation #2), FIGS. 43 to 47 illustrate a third variation (variation #3), FIGS. 48 to 52 illustrate a fourth variation (variation #4), and FIGS. 53 to 57 illustrate a fifth variation (variation #5).

[0667]

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

[0669] An image can be encoded / decoded using at least one or a combination of at least one of the above embodiments.

[0670] The order of applying the above embodiments may be different in the encoder and the decoder, and the order of applying the above embodiments may be the same in the encoder and the decoder.

[0671] The above embodiments can be performed for each of the luminance and chrominance signals, and the above embodiments can be performed equally for the luminance and chrominance signals.

[0672] The shape of the block to which the above embodiments of the present invention are applied may have a square shape or a non-square shape.

[0673] At least one of the syntax elements (flags, indices, etc.) that are entropy encoded in the encoder and entropy decoded in the decoder can use at least one of the binarization methods below.

[0674] Truncated Rice binarization method

[0675] K-th order Exp_Golomb binarization method

[0676] Restricted K-th order Exp_Golomb binarization method

[0677] Fixed-length binarization method

[0678] Unary binarization method

[0679] Truncated unary binarization method

[0680] Truncated Binary Binarization Method

[0681] The above embodiments of the present invention can be applied according to the size of at least one of an encoding block, a prediction block, a transform block, a block, a current block, an encoding unit, a prediction unit, a transform unit, a unit, and a current unit. Here, the size may be defined as a minimum size and / or a maximum size for applying the above embodiments, or may be defined as a fixed size for which the above embodiments are applied. In addition, the first embodiment of the above embodiments may be applied to a first size, and the second embodiment may be applied to a second size. That is, the above embodiments may be applied in a complex manner depending on the size. In addition, the above embodiments of the present invention may be applied only when the size is greater than or equal to the minimum size and less than or equal to the maximum size. That is, the above embodiments may be applied only when the block size is included within a certain range.

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

[0683] The above embodiments of the present invention can be applied according to temporal layers. A separate identifier is signaled to identify the temporal layer to which the above embodiments are applicable, and the above embodiments can be applied to the temporal layer specified by the identifier. The identifier here may be defined as the lowest layer and / or highest layer to which the above embodiments are applicable, or may be defined as indicating a specific layer to which the above embodiments are applicable. In addition, a fixed temporal layer to which the above embodiments are applicable may be defined.

[0684] For example, the above embodiments may be applied only when the temporal layer of the current image is the lowest layer. For example, the above embodiments may be applied only when the temporal layer identifier of the current image is 1 or greater. For example, the above embodiments may be applied only when the temporal layer of the current image is the highest layer.

[0685] The slice type or tile group type to which the above embodiments of the present invention are applied is defined, and the above embodiments of the present invention can be applied according to the slice type or tile group type.

[0686] In the embodiments described above, the methods are described based on a flowchart as a series of steps or units. However, the present invention is not limited to the order of the steps, and some steps may occur in a different order or simultaneously with other steps described above. Furthermore, those skilled in the art will understand that the steps depicted in the flowchart are not exclusive, and that other steps may be included, or one or more steps in the flowchart may be deleted without affecting the scope of the present invention.

[0687] The above-described embodiments include examples of various aspects. While not all possible combinations to illustrate the various aspects can be described, those skilled in the art will recognize that other combinations are possible. Accordingly, the present invention is intended to encompass all other alterations, modifications, and variations within the scope of the following claims.

[0688] The embodiments of the present invention described above may be implemented in the form of program commands that can be executed through various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program commands, data files, data structures, etc., either singly or in combination. The program commands recorded on the computer-readable recording medium may be those specially designed and configured for the present invention or may be those known and available to those skilled in the art of computer software. Examples of the computer-readable recording medium include magnetic media such as hard disks, floppy disks, and magnetic tapes, optical recording media such as CD-ROMs and DVDs, magneto-optical media such as floptical disks, and hardware devices specially configured to store and execute program commands, such as ROMs, RAMs, and flash memories. Examples of program commands include not only machine language codes generated by a compiler, but also high-level language codes that can be executed by a computer using an interpreter, etc. The hardware devices may be configured to operate as one or more software modules to perform processing according to the present invention, and vice versa.

[0689] Although the present invention has been described above with specific details such as specific components and limited examples and drawings, these are provided only to help a more general understanding of the present invention, and the present invention is not limited to the above examples, and those with ordinary knowledge in the technical field to which the present invention pertains can make various modifications and variations from this description.

[0690] Therefore, the idea of ​​the present invention should not be limited to the embodiments described above, and all things that are modified equally or equivalently to the following claims as well as the claims are considered to fall within the scope of the idea of ​​the present invention.

[0691] The present invention can be used in a device for encoding / decoding an image.

Claims

1. A step for determining the on-screen prediction mode of the current block; and A step of generating a prediction block of the current block by performing a prediction based on the prediction mode within the screen, An image decoding method in which the length of a reference sample used for the intra-screen prediction is derived based on the length of the current block when the intra-screen prediction mode of the current block is MIP (Matrix-based Intra Prediction) mode.

2. In paragraph 1, An image decoding method, wherein the above reference sample includes an upper reference sample and a left reference sample, the length of the upper reference sample is derived as the horizontal length of the current block + 1, and the length of the left reference sample is derived as the vertical length of the current block + 1.

3. In paragraph 1, An image decoding method wherein the above reference sample includes an upper reference sample and a left reference sample, and the length of the upper reference sample is derived to be twice the horizontal length of the current block, and the length of the left reference sample is derived to be twice the vertical length of the current block.

4. In paragraph 1, When the current block is a chrominance block and the prediction mode within the screen of the current block is a cross-component prediction mode, The on-screen prediction of the current block above is: A step of generating surrounding samples of a luminance block corresponding to the current block; A step of performing downsampling on surrounding samples of the above luminance block; A step of deriving cross component parameters based on surrounding samples on which the above downsampling is performed; and An image decoding method comprising a step of generating a prediction block of the current block based on the cross component parameters.

5. In paragraph 4, The surrounding samples of the luminance block include at least one of the upper surrounding sample and the left surrounding sample, An image decoding method in which, when a surrounding sample of the luminance block is unavailable, the unavailable surrounding sample is replaced with an internal sample of the luminance block.

6. In paragraph 5, When the above unavailable peripheral sample is the upper peripheral sample, the interior sample of the luminance block is the interior sample adjacent to the upper boundary of the luminance block, An image decoding method wherein, when the unavailable peripheral sample is the left peripheral sample, the internal sample of the luminance block is an internal sample adjacent to the left boundary of the luminance block.

7. In paragraph 6, The above unavailable upper peripheral samples and the inner samples adjacent to the upper boundary of the luminance block have the same x-coordinate, An image decoding method in which the unavailable left peripheral sample and the internal sample adjacent to the left boundary of the luminance block have the same y-coordinate.

8. In paragraph 4, The surrounding samples of the luminance block include at least one of the upper surrounding sample and the left surrounding sample, A method for decoding an image, wherein the filter used for downsampling for the upper peripheral sample is determined differently based on at least one of information about whether the upper boundary of the current block is a CTU boundary and information about the positions of the chrominance signal and the corresponding luminance signal.

9. In paragraph 4, The surrounding samples of the luminance block include at least one of the upper surrounding sample and the left surrounding sample, An image decoding method in which the filter used for downsampling for the above left peripheral sample is determined differently based on information about the positions of the chrominance signal and the corresponding luminance signal.

10. In paragraph 4, The on-screen prediction of the current block above is: Further comprising the step of performing downsampling on the inner samples of the luminance block, A method for decoding an image, wherein a filter used for downsampling an internal sample of the luminance block is determined differently based on at least one of information regarding the availability of the surrounding samples and the position of the chrominance signal and the corresponding luminance signal.

11. A step for determining the on-screen prediction mode of the current block; and A step of generating a prediction block of the current block by performing a prediction based on the prediction mode within the screen, A video encoding method in which the length of a reference sample used for the intra-screen prediction is derived based on the length of the current block when the intra-screen prediction mode of the current block is MIP (Matrix-based Intra Prediction) mode.

12. In paragraph 11, A video encoding method wherein the above reference sample includes an upper reference sample and a left reference sample, the length of the upper reference sample is derived as the horizontal length of the current block + 1, and the length of the left reference sample is derived as the vertical length of the current block + 1.

13. In paragraph 11, A video encoding method wherein the above reference sample includes an upper reference sample and a left reference sample, the length of the upper reference sample is derived to be twice the horizontal length of the current block, and the length of the left reference sample is derived to be twice the vertical length of the current block.

14. In paragraph 11, When the current block is a chrominance block and the prediction mode within the screen of the current block is a cross-component prediction mode, The on-screen prediction of the current block above is: A step of generating surrounding samples of a luminance block corresponding to the current block; A step of performing downsampling on surrounding samples of the above luminance block; A step of deriving cross component parameters based on surrounding samples on which the above downsampling is performed; and An image encoding method comprising a step of generating a prediction block of the current block based on the cross component parameters.

15. In paragraph 14, The surrounding samples of the luminance block include at least one of the upper surrounding sample and the left surrounding sample, A method of encoding an image, wherein when a surrounding sample of the luminance block is unavailable, the unavailable surrounding sample is replaced with an internal sample of the luminance block.

16. In paragraph 15, When the above unavailable peripheral sample is the upper peripheral sample, the interior sample of the luminance block is the interior sample adjacent to the upper boundary of the luminance block, A method for encoding an image, wherein when the unavailable peripheral sample is the left peripheral sample, the internal sample of the luminance block is an internal sample adjacent to the left boundary of the luminance block.

17. In paragraph 14, The surrounding samples of the luminance block include at least one of the upper surrounding sample and the left surrounding sample, A method for encoding an image, wherein a filter used for downsampling the upper peripheral samples is determined differently based on at least one of information about whether the upper boundary of the current block is a CTU boundary and information about the positions of a chrominance signal and a corresponding luminance signal.

18. In paragraph 14, The surrounding samples of the luminance block include at least one of the upper surrounding sample and the left surrounding sample, An image encoding method in which the filter used for downsampling for the above left peripheral sample is determined differently based on information about the positions of the chrominance signal and the corresponding luminance signal.

19. In paragraph 14, The on-screen prediction of the current block above is: Further comprising the step of performing downsampling on the inner samples of the luminance block, A method for encoding an image, wherein a filter used for downsampling an internal sample of the luminance block is determined differently based on at least one of information regarding the availability of the surrounding samples and the positions of the chrominance signal and the corresponding luminance signal.

20. In a non-transitory computer-readable recording medium storing a bitstream generated by a video encoding method, The above image encoding method is, a step of determining the on-screen prediction mode of the current block; and A step of generating a prediction block of the current block by performing a prediction based on the prediction mode within the screen, A computer-readable recording medium in which, when the on-screen prediction mode of the current block is MIP (Matrix-based Intra Prediction) mode, the length of a reference sample used for the on-screen prediction is derived based on the length of the current block.