Device and method for encoding and decoding video

Adaptive selection of transform kernels based on intra prediction modes addresses inefficiencies in video encoding and decoding, enhancing compression efficiency and image quality.

WO2026010405A1PCT designated stage Publication Date: 2026-01-08SAMSUNG ELECTRONICS CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/KR2025/009537
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-11-22
Filing Date
2025-07-03
Publication Date
2026-01-08

AI Technical Summary

Technical Problem

Existing video encoding and decoding methods do not effectively utilize adaptive transform kernels based on intra prediction modes, leading to inefficiencies in removing spatial redundancy within images.

Method used

Adaptive determination of transform kernels for inverse transformation based on intra prediction modes, allowing selection from a set of candidates tailored to the characteristics of each block for improved compression efficiency.

Benefits of technology

Enhances compression efficiency by adaptively selecting transform kernels, reducing artifacts and improving image quality during decoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure KR2025009537_08012026_PF_FP_ABST
    Figure KR2025009537_08012026_PF_FP_ABST
Patent Text Reader

Abstract

A method for decoding a video, according to one embodiment, may comprise the steps of: determining a transform kernel set of a current block on the basis of an intra prediction mode of the current block; adaptively determining, on the basis of the characteristics of the current block, a transform kernel candidate available for inverse transformation of the current block from among a plurality of transform kernel candidates included in the transform kernel set; determining a transform kernel candidate for the current block from among the available transform kernel candidates; and generating residual samples of the current block by performing an inverse transform on transform coefficients of the current block by using the determined transform kernel candidate of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

Device and method for encoding and decoding images

[0001] The present disclosure relates to the field of video encoding and decoding, and more particularly, to a device and method for encoding and decoding a video based on an adaptively determined transform.

[0002] In image encoding and decoding, the image is divided into blocks, and each block can be predicted and decoded through inter prediction or intra prediction.

[0003] Inter prediction can be a technique for compressing images by removing temporal redundancy between images. Inter prediction can predict blocks in the current image using a reference image. The reference block most similar to the current block can be searched within a predetermined search range within the reference image. The current block can be predicted based on the reference block, and the predicted block generated as a result of the prediction can be subtracted from the current block to generate a residual block.

[0004] Standards such as H.264 AVC (Advanced Video Coding) and HEVC (High Efficiency Video Coding) can use the motion vectors of previously encoded blocks adjacent to the current block or blocks included in a previously encoded image as motion vector predictors of the current block to predict the motion vector of the current block. The motion vector difference, which is the difference between the motion vector of the current block and the motion vector predictor, can be signaled to the decoder side through a predetermined method.

[0005] Intra prediction can be a technique for compressing images by removing spatial redundancy within the image. Intra prediction, a prediction block can be generated based on the surrounding pixels of the current block, depending on the intra prediction mode. Then, the prediction block can be subtracted from the current block to generate a residual block. The intra prediction mode used to generate the prediction block can be signaled to the decoder through a predetermined method.

[0006] Residual blocks generated through inter-prediction or intra-prediction can be transformed and quantized and then passed to a decoder. The decoder can dequantize and inversely transform the residual blocks, and combine them with the predicted blocks of the current block to reconstruct the current block. In certain cases, the decoder can filter the reconstructed current block to remove artifacts within it.

[0007] A method of decoding an image according to one embodiment may include a step of determining a set of transform kernels of a current block based on an intra prediction mode of the current block.

[0008] In a method for decoding an image according to one embodiment, a set of transform kernels may include a plurality of transform kernel candidates.

[0009] A method for decoding an image according to one embodiment may include a step of adaptively determining a transform kernel candidate available for inverse transformation of a current block from among a plurality of transform kernel candidates included in a transform kernel set, based on characteristics of the current block.

[0010] A method of decoding an image according to one embodiment may include a step of determining a transform kernel candidate of a current block from among available transform kernel candidates.

[0011] A method of decoding an image according to one embodiment may include a step of generating a residual sample of a current block by performing an inverse transform on a transform coefficient of the current block using a transform kernel candidate of the current block.

[0012] A method of encoding an image according to one embodiment may include a step of determining a set of transform kernels of a current block based on an intra prediction mode of the current block.

[0013] In a method of encoding an image according to one embodiment, a set of transform kernels may include a plurality of transform kernel candidates.

[0014] A method for encoding an image according to one embodiment may include a step of adaptively determining a transform kernel candidate available for inverse transformation of a current block from among a plurality of transform kernel candidates included in a transform kernel set, based on characteristics of the current block.

[0015] A method for encoding an image according to one embodiment may include a step of generating a transform coefficient of a current block by performing a transform on a residual sample of the current block using a transform kernel candidate of the current block.

[0016] In a method for encoding an image according to one embodiment, a transform kernel candidate of a current block can be selected from among the available transform kernel candidates.

[0017] An image decoding device according to one embodiment can determine a set of transform kernels of a current block based on an intra prediction mode of the current block.

[0018] In an image decoding device according to one embodiment, a set of transform kernels may include a plurality of transform kernel candidates.

[0019] An image decoding device according to one embodiment can adaptively determine a transform kernel candidate available for inverse transformation of a current block from among a plurality of transform kernel candidates included in a transform kernel set, based on characteristics of the current block.

[0020] An image decoding device according to one embodiment can determine a transformation kernel candidate of a current block from among available transformation kernel candidates.

[0021] An image decoding device according to one embodiment can generate a residual sample of a current block by performing an inverse transformation on a transform coefficient of the current block using a transform kernel candidate of the current block.

[0022] An image encoding device according to one embodiment can determine a set of transform kernels of a current block based on an intra prediction mode of the current block.

[0023] In an image encoding device according to one embodiment, a set of transform kernels may include a plurality of transform kernel candidates.

[0024] An image encoding device according to one embodiment can adaptively determine a transform kernel candidate available for inverse transformation of a current block from among a plurality of transform kernel candidates included in a transform kernel set based on characteristics of a current block.

[0025] An image encoding device according to one embodiment can generate a transform coefficient of a current block by performing a transform on a residual sample of the current block using a transform kernel candidate of the current block.

[0026] In an image encoding device according to one embodiment, a transform kernel candidate of a current block can be selected from among the available transform kernel candidates.

[0027] A computer-readable recording medium according to one embodiment can record a bitstream generated by an encoding method according to one embodiment of the present disclosure.

[0028] FIG. 1 is a block diagram of an image decoding device according to one embodiment.

[0029] FIG. 2 is a block diagram of an image encoding device according to one embodiment.

[0030] FIG. 3 illustrates a process of dividing a current encoding unit to determine at least one encoding unit according to one embodiment.

[0031] FIG. 4 illustrates a process of dividing a non-square coding unit to determine at least one coding unit according to one embodiment.

[0032] FIG. 5 illustrates a process of dividing an encoding unit based on at least one of block shape information and segmentation shape mode information according to one embodiment.

[0033] FIG. 6 illustrates a method for determining a predetermined coding unit among an odd number of coding units according to one embodiment.

[0034] FIG. 7 illustrates the order in which multiple encoding units are processed when a current encoding unit is divided to determine multiple encoding units according to one embodiment.

[0035] FIG. 8 illustrates a process for determining that a current encoding unit is split into an odd number of encoding units when encoding units cannot be processed in a predetermined order according to one embodiment.

[0036] FIG. 9 illustrates a process of dividing a first encoding unit to determine at least one encoding unit according to one embodiment.

[0037] FIG. 10 illustrates that, according to one embodiment, the shapes into which a first encoding unit can be divided are limited when a second encoding unit of a non-square shape determined by splitting the first encoding unit satisfies a predetermined condition.

[0038] FIG. 11 illustrates a process of splitting a square-shaped encoding unit when the split shape mode information cannot represent splitting into four square-shaped encoding units according to one embodiment.

[0039] FIG. 12 illustrates that, according to one embodiment, the processing order between multiple encoding units may vary depending on the division process of the encoding units.

[0040] FIG. 13 illustrates a process in which the depth of an encoding unit is determined as the shape and size of the encoding unit change when the encoding unit is recursively split to determine a plurality of encoding units according to one embodiment.

[0041] FIG. 14 illustrates an index (part index, hereinafter referred to as PID) for depth and encoding unit distinction that can be determined according to the shape and size of encoding units according to one embodiment.

[0042] FIG. 15 illustrates that a plurality of coding units are determined according to a plurality of predetermined data units included in a picture according to one embodiment.

[0043] FIG. 16 illustrates encoding units that can be determined for each picture when the combination of forms into which encoding units can be divided is different for each picture according to one embodiment.

[0044] FIG. 17 illustrates various forms of encoding units that can be determined based on segmentation form mode information expressed in binary code according to one embodiment.

[0045] FIG. 18 illustrates another form of a coding unit that can be determined based on segmentation mode information expressed in binary code according to one embodiment.

[0046] FIG. 19 is a block diagram of an image encoding and decoding system that performs loop filtering according to one embodiment.

[0047] Fig. 20 is a block diagram illustrating a configuration of an image decoding device according to one embodiment.

[0048] FIG. 21 is a diagram showing types of intra prediction modes according to one embodiment of the present disclosure.

[0049] FIG. 22 is a diagram showing types of intra prediction modes for a non-square block according to one embodiment of the present disclosure.

[0050] FIG. 23 is a diagram showing types of intra prediction modes for a non-square block according to one embodiment of the present disclosure.

[0051] FIG. 24 is a diagram illustrating sample sets required for deriving a cross line prediction mode according to one embodiment.

[0052] FIGS. 25A and 25B are diagrams illustrating a method for calculating a cost value corresponding to a directional mode of a first group according to one embodiment.

[0053] FIGS. 26A and 26B are diagrams for explaining a method for calculating a cost value corresponding to a directional mode of a second group according to one embodiment.

[0054] FIGS. 27a and 27b are diagrams for explaining a method for calculating a cost value corresponding to a directional mode of a third group according to one embodiment.

[0055] FIG. 28 is a diagram for explaining a method for calculating a cost value corresponding to a horizontal mode according to one embodiment.

[0056] FIG. 29 is a diagram for explaining a method for calculating a cost value corresponding to a vertical mode according to one embodiment.

[0057] FIG. 30 is a diagram for explaining a template-based intra prediction mode derivation method according to one embodiment of the present disclosure.

[0058] FIG. 31 is a diagram for explaining a method for deriving an intra prediction mode based on a change in a sample value according to one embodiment of the present disclosure.

[0059] FIG. 32 is a diagram illustrating gradient information according to one embodiment of the present disclosure.

[0060] FIG. 33 is a flowchart illustrating an image decoding method according to one embodiment of the present disclosure.

[0061] FIG. 34 is a diagram for explaining a conversion coefficient distribution according to one embodiment of the present disclosure.

[0062] FIG. 35 is a diagram for explaining a transformation method using a plurality of transformation kernel sets according to one embodiment of the present disclosure.

[0063] FIG. 36 is a flowchart illustrating an image decoding method according to one embodiment of the present disclosure.

[0064] FIG. 37 is a diagram illustrating an application area of ​​a secondary transformation according to one embodiment of the present disclosure.

[0065] FIG. 38 is a flowchart illustrating an image decoding method according to one embodiment of the present disclosure.

[0066] FIG. 39 is a block diagram showing the configuration of an image encoding device according to one embodiment of the present disclosure.

[0067] FIG. 40 is a flowchart illustrating an image encoding method according to one embodiment of the present disclosure.

[0068] The present disclosure may be subject to various modifications and various embodiments. Examples are illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the embodiments of the present disclosure, and the present disclosure may include all modifications, equivalents, and alternatives that fall within the spirit and technical scope of the various embodiments.

[0069] When describing embodiments, detailed descriptions of related known technologies may be omitted if they are deemed to unnecessarily obscure the gist of the present disclosure. Furthermore, numbers (e.g., "first," "second," etc.) used in the description of embodiments may correspond to identification symbols used to distinguish one component from another.

[0070] In this disclosure, the expression “at least one of a, b or c” may refer to “a”, “b”, “c”, “a and b”, “a and c”, “b and c”, “all of a, b and c”, or variations thereof.

[0071] In the present disclosure, when a component is referred to as being “connected” or “connected” to another component, the component may be directly connected or connected to the other component, but unless there is a specific description to the contrary, the component may also be connected or connected via another component in between.

[0072] In the present disclosure, components expressed as "units", "modules", etc. may be two or more components combined into a single component, or a single component may be divided into two or more more detailed components. In addition, each component described below may additionally perform some or all of the functions performed by other components in addition to its own main function, and some of the main functions performed by each component may be exclusively performed by other components.

[0073] In the present disclosure, 'image' may refer to a picture, a still image, a frame, a moving image composed of a plurality of consecutive still images, or a video.

[0074] In this disclosure, "sample" may refer to data assigned to a sampling location in an image and thus to be processed. For example, a pixel within a frame in a spatial domain may correspond to a sample. A unit containing multiple samples may be defined as a block.

[0075] Hereinafter, with reference to FIGS. 1 to 19, an image encoding method and device based on a tree-structured encoding unit and a transformation unit according to one embodiment, and an image decoding method and device are disclosed.

[0076] FIG. 1 illustrates a block diagram of an image decoding device (100) according to one embodiment.

[0077] The video decoding device (100) may include a bitstream acquisition unit (110) and a decoding unit (120). The bitstream acquisition unit (110) and the decoding unit (120) may include at least one processor. In addition, the bitstream acquisition unit (110) and the decoding unit (120) may include a memory that stores commands to be executed by at least one processor.

[0078] The bitstream acquisition unit (110) can receive a bitstream. The bitstream includes information obtained by encoding an image by an image encoding device (200) described below. In addition, the bitstream can be transmitted from the image encoding device (200). The image encoding device (200) and the image decoding device (100) can be connected by wire or wirelessly, and the bitstream acquisition unit (110) can receive the bitstream by wire or wirelessly. The bitstream acquisition unit (110) can receive the bitstream from a storage medium such as an optical medium, a hard disk, etc. The decoding unit (120) can restore the image based on information obtained from the received bitstream. The decoding unit (120) can obtain syntax elements for restoring the image from the bitstream. The decoding unit (120) can restore the image based on the syntax elements.

[0079] To describe in detail the operation of the video decoding device (100), the bitstream acquisition unit (110) can receive a bitstream.

[0080] The image decoding device (100) may perform an operation of obtaining a binstring corresponding to a splitting shape mode of an encoding unit from a bitstream. In addition, the image decoding device (100) may perform an operation of determining a splitting rule of the encoding unit. In addition, the image decoding device (100) may perform an operation of splitting the encoding unit into a plurality of encoding units based on at least one of the binstring corresponding to the splitting shape mode and the splitting rule. In order to determine the splitting rule, the image decoding device (100) may determine a first allowable range of the size of the encoding unit according to a ratio of the width and height of the encoding unit. In order to determine the splitting rule, the image decoding device (100) may determine a second allowable range of the size of the encoding unit according to the splitting shape mode of the encoding unit.

[0081] Below, the division of encoding units according to one embodiment of the present disclosure is described in detail.

[0082] First, a picture can be divided into one or more slices or one or more tiles. A slice or a tile can be a sequence of one or more maximum coding tree units (CTUs). Depending on the implementation, a slice may include one or more tiles, and a slice may include one or more maximum coding units. A slice including one or more tiles can be determined within a picture.

[0083] The maximum coding block (Coding Tree Block; CTB) is a concept that contrasts with the maximum coding unit (CTU). A CTB is an NxN block containing NxN samples (N is an integer). Each color component can be divided into one or more CTBs.

[0084] When a picture has three sample arrays (sample arrays for Y, Cr, and Cb components), a maximum coding unit (CTU) is a unit that includes a maximum coding block of luma samples, two maximum coding blocks of corresponding chroma samples, and syntax structures used to encode the luma samples and chroma samples. When a picture is a monochrome picture, a maximum coding unit is a unit that includes a maximum coding block of monochrome samples and syntax structures used to encode the monochrome samples. When a picture is a picture that is encoded with a color plane that is separated by color components, a maximum coding unit is a unit that includes syntax structures used to encode the picture and samples of the picture.

[0085] A single maximum coding block (CTB) can be divided into MxN coding blocks containing MxN samples (M, N are integers).

[0086] When a picture has a sample array for each Y, Cr, and Cb component, a coding unit (CU) is a unit that includes a coding block for a luma sample and two coding blocks for corresponding chroma samples, and syntax structures used to encode the luma sample and the chroma samples. When a picture is a monochrome picture, a coding unit is a unit that includes a coding block for a monochrome sample and syntax structures used to encode the monochrome samples. When a picture is a picture that is encoded with a color plane that is separated by color component, a coding unit is a unit that includes syntax structures used to encode the picture and samples of the picture.

[0087] As explained above, the maximum coding block and the maximum coding unit are distinct concepts, and the coding block and the coding unit are distinct concepts. That is, the (maximum) coding unit refers to a data structure including a (maximum) coding block including the corresponding sample and a syntax structure corresponding to it. However, since a person skilled in the art can understand that the (maximum) coding unit or the (maximum) coding block refers to a block of a predetermined size including a predetermined number of samples, the following specification will refer to the maximum coding block and the maximum coding unit, or the coding block and the coding unit, without distinction unless there are special circumstances.

[0088] An image can be divided into Coding Tree Units (CTUs). The size of the CTUs can be determined based on information obtained from the bitstream. The shape of the CTUs can be a square of equal size, but is not limited thereto.

[0089] For example, information about the maximum size of a luma coding block can be obtained from the bitstream. For example, the maximum size of the luma coding block indicated by the information about the maximum size of the luma coding block can be one of 4x4, 8x8, 16x16, 32x32, 64x64, 128x128, and 256x256.

[0090] For example, information about the maximum size of a luma coding block capable of being split into two and the luma block size difference can be obtained from the bitstream. The information about the luma block size difference can indicate the size difference between a luma maximum coding unit and a maximum luma coding block capable of being split into two. Therefore, by combining the information about the maximum size of a luma coding block capable of being split into two obtained from the bitstream and the information about the luma block size difference, the size of the luma maximum coding unit can be determined. Using the size of the luma maximum coding unit, the size of the chroma maximum coding unit can also be determined. For example, if the Y: Cb: Cr ratio is 4:2:0 according to the color format, the size of the chroma block can be half the size of the luma block, and similarly, the size of the chroma maximum coding unit can be half the size of the luma maximum coding unit.

[0091] According to one embodiment, since information about the maximum size of a luma coding block capable of binary splitting is obtained from a bitstream, the maximum size of the luma coding block capable of binary splitting can be determined variably. In contrast, the maximum size of a luma coding block capable of ternary splitting can be fixed. For example, the maximum size of a luma coding block capable of ternary splitting in an I picture may be 32x32, and the maximum size of a luma coding block capable of ternary splitting in a P picture or a B picture may be 64x64.

[0092] Additionally, the maximum coding unit can be hierarchically divided into coding units based on the division shape mode information obtained from the bitstream. As the division shape mode information, at least one of information indicating whether quad division is performed, information indicating whether multi-division is performed, division direction information, and division type information can be obtained from the bitstream.

[0093] For example, information indicating whether a quad split is present may indicate whether the current encoding unit is to be quad split (QUAD_SPLIT) or not to be quad split.

[0094] If the current encoding unit is not quad-split, the information indicating whether it is multi-split may indicate whether the current encoding unit will not be split any further (NO_SPLIT) or will be binary / ternary split.

[0095] When the current encoding unit is binary or ternary split, the split direction information indicates that the current encoding unit is split in either the horizontal or vertical direction.

[0096] When the current encoding unit is split in the horizontal or vertical direction, the split type information indicates that the current encoding unit is split into binary split or ternary split.

[0097] Depending on the split direction information and the split type information, the split mode of the current encoding unit can be determined. The split mode when the current encoding unit is split into binaries in the horizontal direction can be determined as binary horizontal split (SPLIT_BT_HOR), the split mode when the current encoding unit is split into ternary horizontal split (SPLIT_TT_HOR), the split mode when the current encoding unit is split into binaries in the vertical direction can be determined as binary vertical split (SPLIT_BT_VER), and the split mode when the current encoding unit is split into ternary vertical split (SPLIT_TT_VER).

[0098] The image decoding device (100) can obtain segmentation shape mode information from a bitstream from a single binstring. The format of the bitstream received by the image decoding device (100) can include a fixed length binary code, a unary code, a truncated unary code, a predetermined binary code, etc. The binstring represents information as a series of binary numbers. The binstring can be composed of at least one bit. The image decoding device (100) can obtain segmentation shape mode information corresponding to the binstring based on a segmentation rule. The image decoding device (100) can determine whether to quad-segment an encoding unit, whether not to quad-segment, or the segmentation direction and segmentation type based on a single binstring.

[0099] The coding unit may be smaller than or equal to the maximum coding unit. For example, the maximum coding unit is also a coding unit with the maximum size, so it is a coding unit. If the split shape mode information for the maximum coding unit indicates that it is not split, the coding unit determined from the maximum coding unit has the same size as the maximum coding unit. If the split shape mode information for the maximum coding unit indicates that it is split, the maximum coding unit may be split into coding units. In addition, if the split shape mode information for the coding unit indicates splitting, the coding units may be split into coding units of smaller sizes. However, the splitting of the image is not limited thereto, and the maximum coding unit and the coding units may not be distinguished. The splitting of the coding unit is described in more detail with reference to FIGS. 3 to 16.

[0100] Additionally, one or more prediction blocks for prediction may be determined from the coding unit. The prediction blocks may be equal to or smaller than the coding unit. Additionally, one or more transformation blocks for transformation may be determined from the coding unit. The transformation blocks may be equal to or smaller than the coding unit.

[0101] The shape and size of the transformation block and the prediction block may be unrelated.

[0102] In another embodiment, prediction may be performed using the encoding unit as a prediction block. Transformation may also be performed using the encoding unit as a transform block.

[0103] The division of a coding unit is described in more detail with reference to FIGS. 3 to 16. The current block and neighboring blocks of the present disclosure may represent one of a maximum coding unit, a coding unit, a prediction block, and a transform block. In addition, the current block or the current coding unit is a block currently being decoded or encoded, or a block currently being divided. The neighboring block may be a block reconstructed before the current block. The neighboring block may be spatially or temporally adjacent to the current block. The neighboring block may be located on one of the lower left, left, upper left, upper right, upper right, right, and lower right sides of the current block.

[0104] FIG. 3 illustrates a process in which an image decoding device (100) divides a current encoding unit to determine at least one encoding unit according to one embodiment.

[0105] The block shape may include 4Nx4N, 4Nx2N, 2Nx4N, 4NxN, Nx4N, 32NxN, Nx32N, 16NxN, Nx16N, 8NxN or Nx8N, where N may be a positive integer. The block shape information is information indicating at least one of the shape, direction, width and height ratio or size of the encoding unit.

[0106] The shape of the encoding unit may include square and non-square. When the width and height of the encoding unit are equal (i.e., when the block shape of the encoding unit is 4Nx4N), the image decoding device (100) may determine the block shape information of the encoding unit as square. The image decoding device (100) may determine the shape of the encoding unit as non-square.

[0107] When the width and height of the encoding unit are different (i.e., when the block shape of the encoding unit is 4Nx2N, 2Nx4N, 4NxN, Nx4N, 32NxN, Nx32N, 16NxN, Nx16N, 8NxN, or Nx8N), the image decoding device (100) may determine the block shape information of the encoding unit to be non-square. When the shape of the encoding unit is non-square, the image decoding device (100) may determine the ratio of the width and height among the block shape information of the encoding unit to be at least one of 1:2, 2:1, 1:4, 4:1, 1:8, 8:1, 1:16, 16:1, 1:32, and 32:1. Additionally, based on the width length and height length of the encoding unit, the image decoding device (100) can determine whether the encoding unit is in the horizontal or vertical direction. Additionally, based on at least one of the width length, height length, or area of ​​the encoding unit, the image decoding device (100) can determine the size of the encoding unit.

[0108] According to one embodiment, the image decoding device (100) can determine the shape of an encoding unit using block shape information, and can determine the shape into which the encoding unit is divided using segmentation shape mode information. That is, the splitting method of the encoding unit indicated by the segmentation shape mode information can be determined depending on which block shape the block shape information used by the image decoding device (100) indicates.

[0109] The image decoding device (100) can obtain the segmentation shape mode information from the bitstream. However, the present invention is not limited thereto, and the image decoding device (100) and the image encoding device (200) can determine the pre-agreed segmentation shape mode information based on the block shape information. The image decoding device (100) can determine the pre-agreed segmentation shape mode information for the maximum coding unit or the minimum coding unit. For example, the image decoding device (100) can determine the segmentation shape mode information for the maximum coding unit as quad split. In addition, the image decoding device (100) can determine the segmentation shape mode information for the minimum coding unit as “not split.” Specifically, the image decoding device (100) can determine the size of the maximum coding unit as 256x256. The image decoding device (100) can determine the pre-agreed segmentation shape mode information as quad split. Quad splitting is a splitting mode that divides both the width and height of an encoding unit in half. The image decoding device (100) can obtain a coding unit of size 128x128 from a maximum coding unit of size 256x256 based on the splitting mode information. In addition, the image decoding device (100) can determine the size of the minimum coding unit as 4x4. The image decoding device (100) can obtain splitting mode information indicating "not splitting" for the minimum coding unit.

[0110] According to one embodiment, the image decoding device (100) may use block shape information indicating that the current encoding unit is a square shape. For example, the image decoding device (100) may determine whether to not split a square encoding unit, to split it vertically, to split it horizontally, to split it into four encoding units, etc., according to the split shape mode information. Referring to FIG. 3, when the block shape information of the current encoding unit (300) indicates a square shape, the decoding unit (120) may not split an encoding unit (310a) having the same size as the current encoding unit (300) according to the split shape mode information indicating that it is not split, or may determine a split encoding unit (310b, 310c, 310d, 310e, 310f, etc.) based on the split shape mode information indicating a predetermined splitting method.

[0111] Referring to FIG. 3, the image decoding device (100) may determine two coding units (310b) by vertically dividing the current coding unit (300) based on the split shape mode information indicating that the current coding unit (300) is vertically divided, according to an embodiment. The image decoding device (100) may determine two coding units (310c) by horizontally dividing the current coding unit (300) based on the split shape mode information indicating that the current coding unit (300) is horizontally divided, according to an embodiment. The image decoding device (100) may determine four coding units (310d) by vertically and horizontally dividing the current coding unit (300) based on the split shape mode information indicating that the current coding unit (300) is vertically and horizontally divided, according to an embodiment. The image decoding device (100) may determine three coding units (310e) by vertically dividing the current coding unit (300) based on the split shape mode information indicating that the current coding unit (300) is ternary divided, according to an embodiment. The image decoding device (100) can determine three coding units (310f) into which the current coding unit (300) is horizontally divided based on the division shape mode information indicating that the ternary division is horizontally divided. However, the division shapes into which a square coding unit can be divided should not be interpreted as being limited to the above-described shapes, and may include various shapes that can be indicated by the division shape mode information. Specified division shapes into which a square coding unit is divided will be specifically described below through various embodiments.

[0112] FIG. 4 illustrates a process in which an image decoding device (100) divides a non-square coding unit to determine at least one coding unit according to one embodiment.

[0113] According to one embodiment, the image decoding device (100) may utilize block shape information indicating that the current encoding unit is non-square. The image decoding device (100) may determine whether to not split the current non-square encoding unit or to split it using a predetermined method based on the split shape mode information. Referring to FIG. 4, when the block shape information of the current encoding unit (400 or 450) indicates a non-square shape, the image decoding device (100) may determine an encoding unit (410 or 460) having the same size as the current encoding unit (400 or 450) according to the split shape mode information indicating that it is not split, or may determine a split encoding unit (420a, 420b, 430a, 430b, 430c, 470a, 470b, 480a, 480b, 480c) based on the split shape mode information indicating a predetermined splitting method. The predetermined splitting method by which a non-square encoding unit is split will be described in detail through various embodiments below.

[0114] According to one embodiment, the image decoding device (100) may determine a form in which an encoding unit is split using split form mode information, and in this case, the split form mode information may indicate the number of at least one encoding unit generated by splitting the encoding unit. Referring to FIG. 4, when the split form mode information indicates that the current encoding unit (400 or 450) is split into two encoding units, the image decoding device (100) may split the current encoding unit (400 or 450) based on the split form mode information to determine two encoding units (420a, 420b, or 470a, 470b) included in the current encoding unit.

[0115] According to one embodiment, when the image decoding device (100) splits a current encoding unit (400 or 450) having a non-square shape based on split shape mode information, the image decoding device (100) may split the current encoding unit by considering the position of the long side of the non-square current encoding unit (400 or 450). For example, the image decoding device (100) may split the current encoding unit (400 or 450) in a direction that splits the long side of the current encoding unit (400 or 450) by considering the shape of the current encoding unit (400 or 450) to determine a plurality of encoding units.

[0116] According to one embodiment, if the split shape mode information indicates that the coding unit is split into an odd number of blocks (ternary splitting), the image decoding device (100) may determine an odd number of coding units included in the current coding unit (400 or 450). For example, if the split shape mode information indicates that the current coding unit (400 or 450) is split into three coding units, the image decoding device (100) may split the current coding unit (400 or 450) into three coding units (430a, 430b, 430c, 480a, 480b, 480c).

[0117] According to one embodiment, the ratio of the width and height of the current encoding unit (400 or 450) may be 4:1 or 1:4. When the ratio of the width and height is 4:1, the block shape information may be in the horizontal direction because the length of the width is longer than the length of the height. When the ratio of the width and height is 1:4, the block shape information may be in the vertical direction because the length of the width is shorter than the length of the height. The image decoding device (100) may determine to split the current encoding unit into an odd number of blocks based on the split shape mode information. In addition, the image decoding device (100) may determine the splitting direction of the current encoding unit (400 or 450) based on the block shape information of the current encoding unit (400 or 450). For example, if the current encoding unit (400) is in the vertical direction, the image decoding device (100) can divide the current encoding unit (400) in the horizontal direction to determine encoding units (430a, 430b, 430c). Also, if the current encoding unit (450) is in the horizontal direction, the image decoding device (100) can divide the current encoding unit (450) in the vertical direction to determine encoding units (480a, 480b, 480c).

[0118] According to one embodiment, the image decoding device (100) may determine an odd number of coding units included in the current coding unit (400 or 450), and the sizes of the determined coding units may not all be the same. For example, among the determined odd number of coding units (430a, 430b, 430c, 480a, 480b, 480c), the size of a given coding unit (430b or 480b) may have a different size from the other coding units (430a, 430c, 480a, 480c). That is, the encoding units into which the current encoding unit (400 or 450) can be divided and determined can have multiple types of sizes, and in some cases, an odd number of encoding units (430a, 430b, 430c, 480a, 480b, 480c) can each have different sizes.

[0119] According to one embodiment, when the split shape mode information indicates that the coding unit is split into an odd number of blocks, the image decoding device (100) can determine an odd number of coding units included in the current coding unit (400 or 450), and further, the image decoding device (100) can place a predetermined restriction on at least one coding unit among the odd number of coding units generated by splitting. Referring to FIG. 4, the image decoding device (100) can perform a decoding process for a coding unit (430b, 480b) located in the center among three coding units (430a, 430b, 430c, 480a, 480b, 480c) generated by splitting the current coding unit (400 or 450) differently from the decoding process for other coding units (430a, 430c, 480a, 480c). For example, the image decoding device (100) can restrict the encoding unit (430b, 480b) located in the center from being split any further, unlike other encoding units (430a, 430c, 480a, 480c), or can restrict it to be split only a predetermined number of times.

[0120] FIG. 5 illustrates a process in which an image decoding device (100) divides an encoding unit based on at least one of block shape information and division shape mode information according to one embodiment.

[0121] According to one embodiment, the image decoding device (100) may determine whether to split or not to split a first coding unit (500) having a square shape into coding units based on at least one of block shape information and split shape mode information. According to one embodiment, when the split shape mode information indicates splitting the first coding unit (500) in the horizontal direction, the image decoding device (100) may split the first coding unit (500) in the horizontal direction to determine a second coding unit (510). The first coding unit, the second coding unit, and the third coding unit used according to one embodiment are terms used to understand the relationship before and after splitting between coding units. For example, when the first coding unit is split, the second coding unit may be determined, and when the second coding unit is split, the third coding unit may be determined. Hereinafter, the relationship between the first coding unit, the second coding unit, and the third coding unit used may be understood to follow the above-described characteristics.

[0122] According to one embodiment, the image decoding device (100) may determine to split or not split the determined second encoding unit (510) into encoding units based on the split shape mode information. Referring to FIG. 5, the image decoding device (100) may split the first encoding unit (500) based on the split shape mode information to split the determined second encoding unit (510) of a non-square shape into at least one third encoding unit (520a, 520b, 520c, 520d, etc.) or may not split the second encoding unit (510). The image decoding device (100) can obtain split shape mode information, and the image decoding device (100) can split the first encoding unit (500) based on the obtained split shape mode information to obtain a plurality of second encoding units (e.g., 510) of various shapes, and the second encoding unit (510) can be split according to the way in which the first encoding unit (500) is split based on the split shape mode information. According to one embodiment, when the first encoding unit (500) is split into the second encoding unit (510) based on the split shape mode information for the first encoding unit (500), the second encoding unit (510) can also be split into the third encoding unit (e.g., 520a, 520b, 520c, 520d, etc.) based on the split shape mode information for the second encoding unit (510). That is, the coding unit can be recursively split based on the split shape mode information associated with each coding unit. Accordingly, a square coding unit can be determined from a non-square coding unit, and such a square coding unit can be recursively split to determine a non-square coding unit.

[0123] Referring to FIG. 5, among the odd number of third coding units (520b, 520c, 520d) determined by splitting the second coding unit (510) having a non-square shape, a predetermined coding unit (e.g., a coding unit located in the middle or a coding unit having a square shape) may be split recursively. According to an embodiment, the non-square third coding unit (520b), which is one of the odd number of third coding units (520b, 520c, 520d), may be split horizontally into a plurality of fourth coding units. The non-square fourth coding unit (530b or 530d), which is one of the plurality of fourth coding units (530a, 530b, 530c, 530d), may be split again into a plurality of coding units. For example, the fourth coding unit (530b or 530d) having a non-square shape may be further divided into an odd number of coding units. Methods that can be used for recursive division of coding units will be described later through various embodiments.

[0124] According to one embodiment, the image decoding device (100) may split each of the third encoding units (520a, 520b, 520c, 520d, etc.) into encoding units based on the split shape mode information. In addition, the image decoding device (100) may determine not to split the second encoding unit (510) based on the split shape mode information. According to one embodiment, the image decoding device (100) may split the second encoding unit (510) having a non-square shape into an odd number of third encoding units (520b, 520c, 520d). The image decoding device (100) may place a predetermined restriction on a predetermined third encoding unit among the odd number of third encoding units (520b, 520c, 520d). For example, the image decoding device (100) can limit the encoding unit (520c) located in the middle among an odd number of third encoding units (520b, 520c, 520d) to not be divided any further or to be divided a settable number of times.

[0125] Referring to FIG. 5, the image decoding device (100) may limit the coding unit (520c) located in the middle among the odd number of third coding units (520b, 520c, 520d) included in the second coding unit (510) having a non-square shape to not be split any further, or to be split in a predetermined split form (for example, to be split only into four coding units or to be split in a form corresponding to the split form of the second coding unit (510), or to be split only a predetermined number of times (for example, to be split only n times, where n>0). However, the above limitations on the coding unit (520c) located in the middle are merely simple embodiments and should not be interpreted as being limited to the above-described embodiments, but should be interpreted as including various limitations in which the coding unit (520c) located in the middle can be decoded differently from the other coding units (520b, 520d).

[0126] According to one embodiment, the image decoding device (100) can obtain the segmentation shape mode information used to segment the current encoding unit from a predetermined location within the current encoding unit.

[0127] FIG. 6 illustrates a method for an image decoding device (100) to determine a predetermined encoding unit among an odd number of encoding units according to one embodiment.

[0128] Referring to FIG. 6, the split shape mode information of the current encoding unit (600, 650) can be obtained from a sample at a predetermined position among a plurality of samples included in the current encoding unit (600, 650) (for example, a sample (640, 690) located in the center). However, the predetermined position within the current encoding unit (600) from which at least one of the split shape mode information can be obtained should not be interpreted as being limited to the center position illustrated in FIG. 6, but should be interpreted as including various positions (for example, top, bottom, left, right, upper left, lower left, upper right, or lower right, etc.) that can be included within the current encoding unit (600). The image decoding device (100) can obtain the split shape mode information obtained from the predetermined position and determine whether or not to split the current encoding unit into encoding units of various shapes and sizes.

[0129] According to one embodiment, the image decoding device (100) may select one of the coding units when the current coding unit is divided into a predetermined number of coding units. Various methods may be used to select one of the multiple coding units, and descriptions of such methods will be provided later through various embodiments.

[0130] According to one embodiment, the image decoding device (100) can divide the current encoding unit into a plurality of encoding units and determine an encoding unit at a predetermined position.

[0131] According to one embodiment, the image decoding device (100) may use information indicating the positions of each of the odd-numbered coding units to determine an coding unit located in the middle of the odd-numbered coding units. Referring to FIG. 6, the image decoding device (100) may divide the current coding unit (600) or the current coding unit (650) to determine odd-numbered coding units (620a, 620b, 620c) or odd-numbered coding units (660a, 660b, 660c). The image decoding device (100) may use information about the positions of the odd-numbered coding units (620a, 620b, 620c) or odd-numbered coding units (660a, 660b, 660c) to determine the middle coding unit (620b) or the middle coding unit (660b). For example, the image decoding device (100) can determine the coding unit (620b) located in the center by determining the positions of the coding units (620a, 620b, 620c) based on information indicating the positions of predetermined samples included in the coding units (620a, 620b, 620c). Specifically, the image decoding device (100) can determine the coding unit (620b) located in the center by determining the positions of the coding units (620a, 620b, 620c) based on information indicating the positions of samples (630a, 630b, 630c) at the upper left of the coding units (620a, 620b, 620c).

[0132] According to one embodiment, information indicating the positions of the upper left samples (630a, 630b, 630c) included in each of the coding units (620a, 620b, 620c) may include information on the positions or coordinates of the coding units (620a, 620b, 620c) within the picture. According to one embodiment, information indicating the positions of the upper left samples (630a, 630b, 630c) included in each of the coding units (620a, 620b, 620c) may include information indicating the width or height of the coding units (620a, 620b, 620c) included in the current coding unit (600), and this width or height may correspond to information indicating the difference between the coordinates of the coding units (620a, 620b, 620c) within the picture. That is, the image decoding device (100) can determine the encoding unit (620b) located in the center by directly using information about the positions or coordinates of the encoding units (620a, 620b, 620c) within the picture or by using information about the width or height of the encoding unit corresponding to the difference between the coordinates.

[0133] According to one embodiment, information indicating the position of the sample (630a) at the upper left of the upper encoding unit (620a) may represent (xa, ya) coordinates, information indicating the position of the sample (530b) at the upper left of the middle encoding unit (620b) may represent (xb, yb) coordinates, and information indicating the position of the sample (630c) at the upper left of the lower encoding unit (620c) may represent (xc, yc) coordinates. The image decoding device (100) may determine the middle encoding unit (620b) using the coordinates of the upper left samples (630a, 630b, 630c) included in the encoding units (620a, 620b, 620c), respectively. For example, when the coordinates of the samples (630a, 630b, 630c) on the upper left are sorted in ascending or descending order, the encoding unit (620b) including the coordinates (xb, yb) of the sample (630b) located in the center can be determined as the encoding unit located in the center among the encoding units (620a, 620b, 620c) determined by dividing the current encoding unit (600). However, the coordinates indicating the positions of the upper left samples (630a, 630b, 630c) may indicate coordinates indicating the absolute positions within the picture, and further, based on the position of the upper left sample (630a) of the upper left coding unit (620a), the (dxb, dyb) coordinates, which are information indicating the relative position of the sample (630b) of the upper left of the middle coding unit (620b), and the (dxc, dyc) coordinates, which are information indicating the relative position of the sample (630c) of the upper left of the lower coding unit (620c), may be used. In addition, the method of determining the coding unit of a given position by using the coordinates of the corresponding sample as information indicating the position of the sample included in the coding unit should not be interpreted as being limited to the above-described method, but should be interpreted as various arithmetic methods that can utilize the coordinates of the sample.

[0134] According to one embodiment, the image decoding device (100) may divide the current encoding unit (600) into a plurality of encoding units (620a, 620b, 620c), and select an encoding unit from among the encoding units (620a, 620b, 620c) according to a predetermined criterion. For example, the image decoding device (100) may select an encoding unit (620b) having a different size from among the encoding units (620a, 620b, 620c).

[0135] According to one embodiment, the image decoding device (100) may determine the width or height of each of the encoding units (620a, 620b, 620c) by using the (xa, ya) coordinate, which is information indicating the position of the sample (630a) at the upper left of the upper encoding unit (620a), the (xb, yb) coordinate, which is information indicating the position of the sample (630b) at the upper left of the middle encoding unit (620b), and the (xc, yc) coordinate, which is information indicating the position of the sample (630c) at the upper left of the lower encoding unit (620c). The image decoding device (100) can determine the size of each of the encoding units (620a, 620b, 620c) using coordinates (xa, ya), (xb, yb), (xc, yc) indicating the positions of the encoding units (620a, 620b, 620c). According to one embodiment, the image decoding device (100) can determine the width of the upper encoding unit (620a) as the width of the current encoding unit (600). The image decoding device (100) can determine the height of the upper encoding unit (620a) as yb-ya. According to one embodiment, the image decoding device (100) can determine the width of the middle encoding unit (620b) as the width of the current encoding unit (600). The image decoding device (100) may determine the height of the middle encoding unit (620b) as yc-yb. According to one embodiment, the image decoding device (100) may determine the width or height of the lower encoding unit using the width or height of the current encoding unit and the width and height of the upper encoding unit (620a) and the middle encoding unit (620b). The image decoding device (100) may determine an encoding unit having a different size from other encoding units based on the width and height of the determined encoding units (620a, 620b, 620c).Referring to FIG. 6, the image decoding device (100) can determine the middle encoding unit (620b) having a different size from the sizes of the upper encoding unit (620a) and the lower encoding unit (620c) as the encoding unit of a predetermined position. However, the process by which the image decoding device (100) described above determines the encoding unit having a different size from other encoding units is merely an embodiment of determining the encoding unit of a predetermined position using the size of the encoding unit determined based on sample coordinates, and therefore, various processes of determining the encoding unit of a predetermined position by comparing the sizes of the encoding units determined according to predetermined sample coordinates can be used.

[0136] The image decoding device (100) can determine the width or height of each of the encoding units (660a, 660b, 660c) by using the (xd, yd) coordinate, which is information indicating the position of the sample (670a) at the upper left of the left encoding unit (660a), the (xe, ye) coordinate, which is information indicating the position of the sample (670b) at the upper left of the middle encoding unit (660b), and the (xf, yf) coordinate, which is information indicating the position of the sample (670c) at the upper left of the right encoding unit (660c). The image decoding device (100) can determine the size of each of the encoding units (660a, 660b, 660c) by using the (xd, yd), (xe, ye), (xf, yf), which are coordinates indicating the positions of the encoding units (660a, 660b, 660c).

[0137] According to one embodiment, the image decoding device (100) may determine the width of the left encoding unit (660a) as xe-xd. The image decoding device (100) may determine the height of the left encoding unit (660a) as the height of the current encoding unit (650). According to one embodiment, the image decoding device (100) may determine the width of the middle encoding unit (660b) as xf-xe. The image decoding device (100) may determine the height of the middle encoding unit (660b) as the height of the current encoding unit (600). According to one embodiment, the image decoding device (100) may determine the width or height of the right encoding unit (660c) using the width or height of the current encoding unit (650) and the widths and heights of the left encoding unit (660a) and the middle encoding unit (660b). The image decoding device (100) can determine an encoding unit having a different size from other encoding units based on the width and height of the determined encoding units (660a, 660b, 660c). Referring to FIG. 6, the image decoding device (100) can determine a middle encoding unit (660b) having a different size from the sizes of the left encoding unit (660a) and the right encoding unit (660c) as an encoding unit at a predetermined position. However, the process of the image decoding device (100) described above determining an encoding unit having a different size from other encoding units is merely an embodiment of determining an encoding unit at a predetermined position using the size of the encoding unit determined based on sample coordinates, and therefore, various processes of determining an encoding unit at a predetermined position by comparing the sizes of the encoding units determined according to predetermined sample coordinates can be used.

[0138] However, the location of the sample considered for determining the location of the encoding unit should not be interpreted as being limited to the upper left corner described above, and it can be interpreted that information on the location of any sample included in the encoding unit can be used.

[0139] According to one embodiment, the image decoding device (100) may select an encoding unit at a predetermined position from among an odd number of encoding units determined by splitting the current encoding unit, taking into consideration the shape of the current encoding unit. For example, if the current encoding unit has a non-square shape in which the width is longer than the height, the image decoding device (100) may determine an encoding unit at a predetermined position in the horizontal direction. That is, the image decoding device (100) may determine one of the encoding units whose positions vary in the horizontal direction and place a restriction on the corresponding encoding unit. If the current encoding unit has a non-square shape in which the height is longer than the width, the image decoding device (100) may determine an encoding unit at a predetermined position in the vertical direction. That is, the image decoding device (100) may determine one of the encoding units whose positions vary in the vertical direction and place a restriction on the corresponding encoding unit.

[0140] According to one embodiment, the image decoding device (100) may use information indicating the positions of each of the even-numbered coding units to determine the coding unit at a predetermined position among the even-numbered coding units. The image decoding device (100) may determine the even-numbered coding units by dividing the current coding unit (binary dividing) and may determine the coding unit at a predetermined position using information about the positions of the even-numbered coding units. A specific process for this may be a process corresponding to the process of determining the coding unit at a predetermined position (e.g., the center position) among the odd-numbered coding units described above in FIG. 6, and thus will be omitted.

[0141] According to one embodiment, when a current encoding unit having a non-square shape is split into a plurality of encoding units, predetermined information about the encoding unit at a predetermined position may be used during the splitting process to determine an encoding unit at a predetermined position among the plurality of encoding units. For example, the image decoding device (100) may use at least one of block shape information and split shape mode information stored in a sample included in a middle encoding unit during the splitting process to determine an encoding unit located in the middle among the encoding units into which the current encoding unit is split.

[0142] Referring to FIG. 6, the image decoding device (100) can split the current encoding unit (600) into a plurality of encoding units (620a, 620b, 620c) based on the split shape mode information, and can determine the encoding unit (620b) located in the middle among the plurality of encoding units (620a, 620b, 620c). Furthermore, the image decoding device (100) can determine the encoding unit (620b) located in the middle by considering the position where the split shape mode information is acquired. That is, the split shape mode information of the current encoding unit (600) can be obtained from a sample (640) located in the center of the current encoding unit (600), and when the current encoding unit (600) is split into a plurality of encoding units (620a, 620b, 620c) based on the split shape mode information, the encoding unit (620b) including the sample (640) can be determined as the encoding unit located in the center. However, the information used to determine the encoding unit located in the center should not be interpreted as being limited to the split shape mode information, and various types of information can be used in the process of determining the encoding unit located in the center.

[0143] According to one embodiment, predetermined information for identifying a coding unit at a predetermined position may be obtained from a predetermined sample included in the coding unit to be determined. Referring to FIG. 6, the image decoding device (100) may use split shape mode information obtained from a sample at a predetermined position within the current coding unit (600) (e.g., a sample located at the center of the current coding unit (600)) to determine a coding unit at a predetermined position among a plurality of coding units (620a, 620b, 620c) determined by splitting the current coding unit (600) (e.g., a coding unit located at the center of the coding units split into multiple units). That is, the image decoding device (100) can determine the sample at the predetermined position by considering the block shape of the current encoding unit (600), and the image decoding device (100) can determine an encoding unit (620b) that includes a sample from which predetermined information (e.g., division shape mode information) can be obtained among a plurality of encoding units (620a, 620b, 620c) determined by dividing the current encoding unit (600), and can set a predetermined restriction. Referring to FIG. 6, according to one embodiment, the image decoding device (100) can determine a sample (640) located at the center of the current encoding unit (600) as a sample from which predetermined information can be obtained, and the image decoding device (100) can set a predetermined restriction on the encoding unit (620b) that includes such a sample (640) during the decoding process. However, the location of the sample from which certain information can be obtained should not be interpreted as being limited to the above-described location, but may be interpreted as samples at any location included in the encoding unit (620b) to be determined in order to set a limitation.

[0144] According to one embodiment, the position of a sample from which predetermined information can be obtained may be determined according to the shape of the current encoding unit (600). According to one embodiment, the block shape information may determine whether the shape of the current encoding unit is square or non-square, and may determine the position of a sample from which predetermined information can be obtained according to the shape. For example, the image decoding apparatus (100) may determine a sample located on a boundary that divides at least one of the width and height of the current encoding unit in half as a sample from which predetermined information can be obtained, using at least one of information about the width and information about the height of the current encoding unit. As another example, when the block shape information related to the current encoding unit indicates that the shape is non-square, the image decoding apparatus (100) may determine one of the samples adjacent to the boundary that divides the long side of the current encoding unit in half as a sample from which predetermined information can be obtained.

[0145] According to one embodiment, when the image decoding device (100) divides the current encoding unit into a plurality of encoding units, the image decoding device (100) may use the split shape mode information to determine the encoding unit at a predetermined position among the plurality of encoding units. According to one embodiment, the image decoding device (100) may obtain the split shape mode information from a sample at a predetermined position included in the encoding unit, and the image decoding device (100) may divide the plurality of encoding units generated by splitting the current encoding unit using the split shape mode information obtained from the sample at a predetermined position included in each of the plurality of encoding units. That is, the encoding unit may be recursively divided using the split shape mode information obtained from the sample at a predetermined position included in each of the encoding units. Since the recursive division process of the encoding unit has been described above with reference to FIG. 5, a detailed description thereof will be omitted.

[0146] According to one embodiment, the image decoding device (100) can divide a current encoding unit to determine at least one encoding unit, and can determine the order in which the at least one encoding unit is decoded according to a predetermined block (e.g., the current encoding unit).

[0147] FIG. 7 illustrates the order in which multiple encoding units are processed when an image decoding device (100) divides a current encoding unit to determine multiple encoding units according to one embodiment.

[0148] According to one embodiment, the image decoding device (100) may determine second encoding units (710a, 710b) by vertically splitting the first encoding unit (700) according to the splitting shape mode information, determine second encoding units (730a, 730b) by horizontally splitting the first encoding unit (700), or determine second encoding units (750a, 750b, 750c, 750d) by vertically and horizontally splitting the first encoding unit (700).

[0149] Referring to FIG. 7, the image decoding device (100) can determine the order in which the second encoding units (710a, 710b) determined by vertically dividing the first encoding unit (700) are processed in the horizontal direction (710c). The image decoding device (100) can determine the order in which the second encoding units (730a, 730b) determined by horizontally dividing the first encoding unit (700) are processed in the vertical direction (730c). The image decoding device (100) can determine the second encoding units (750a, 750b, 750c, 750d) determined by dividing the first encoding unit (700) in the vertical and horizontal directions according to a predetermined order (e.g., raster scan order (750e) or z scan order (z scan order)) in which encoding units located in one row are processed and then encoding units located in the next row are processed.

[0150] According to one embodiment, the image decoding device (100) can recursively split the encoding units. Referring to FIG. 7, the image decoding device (100) can split the first encoding unit (700) to determine a plurality of encoding units (710a, 710b, 730a, 730b, 750a, 750b, 750c, 750d), and can recursively split each of the determined plurality of encoding units (710a, 710b, 730a, 730b, 750a, 750b, 750c, 750d). A method for splitting a plurality of coding units (710a, 710b, 730a, 730b, 750a, 750b, 750c, 750d) may be a method corresponding to a method for splitting the first coding unit (700). Accordingly, the plurality of coding units (710a, 710b, 730a, 730b, 750a, 750b, 750c, 750d) may each be independently split into a plurality of coding units. Referring to FIG. 7, the image decoding device (100) may split the first coding unit (700) in the vertical direction to determine the second coding units (710a, 710b), and further may determine to independently split or not split each of the second coding units (710a, 710b).

[0151] According to one embodiment, the image decoding device (100) may horizontally divide the second encoding unit (710a) on the left into third encoding units (720a, 720b), and may not divide the second encoding unit (710b) on the right.

[0152] According to one embodiment, the processing order of the coding units may be determined based on the splitting process of the coding units. In other words, the processing order of the split coding units may be determined based on the processing order of the coding units immediately before splitting. The image decoding device (100) may determine the processing order of the third coding units (720a, 720b) ​​determined by splitting the second coding unit (710a) on the left, independently from the second coding unit (710b) on the right. Since the second coding unit (710a) on the left is split horizontally and the third coding units (720a, 720b) ​​are determined, the third coding units (720a, 720b) ​​may be processed in the vertical direction (720c). In addition, since the order in which the second encoding unit (710a) on the left and the second encoding unit (710b) on the right are processed corresponds to the horizontal direction (710c), the right encoding unit (710b) can be processed after the third encoding units (720a, 720b) ​​included in the second encoding unit (710a) on the left are processed in the vertical direction (720c). Since the above-described content is intended to explain the process in which the processing order of the encoding units is determined according to the encoding units before splitting, it should not be interpreted as being limited to the above-described embodiment, but should be interpreted as being used in various ways in which encoding units that are split and determined in various forms can be independently processed according to a predetermined order.

[0153] FIG. 8 illustrates a process for determining that a current encoding unit is divided into an odd number of encoding units when the encoding units cannot be processed in a predetermined order, according to one embodiment of the present invention.

[0154] According to one embodiment, the image decoding device (100) may determine that the current encoding unit is split into an odd number of encoding units based on the acquired split shape mode information. Referring to FIG. 8, a first encoding unit (800) having a square shape may be split into second encoding units (810a, 810b) having a non-square shape, and the second encoding units (810a, 810b) may each be independently split into third encoding units (820a, 820b, 820c, 820d, 820e). According to one embodiment, the image decoding device (100) can determine a plurality of third encoding units (820a, 820b) by horizontally dividing the left encoding unit (810a) among the second encoding units, and can divide the right encoding unit (810b) into an odd number of third encoding units (820c, 820d, 820e).

[0155] According to one embodiment, the image decoding device (100) can determine whether there is an odd number of split encoding units by determining whether the third encoding units (820a, 820b, 820c, 820d, 820e) can be processed in a predetermined order. Referring to FIG. 8, the image decoding device (100) can determine the third encoding units (820a, 820b, 820c, 820d, 820e) by recursively splitting the first encoding unit (800). The image decoding device (100) can determine whether the first encoding unit (800), the second encoding unit (810a, 810b), or the third encoding unit (820a, 820b, 820c, 820d, 820e) is divided into an odd number of encoding units based on at least one of the block shape information and the split shape mode information. For example, the encoding unit located on the right side of the second encoding unit (810a, 810b) can be divided into an odd number of third encoding units (820c, 820d, 820e). The order in which the plurality of encoding units included in the first encoding unit (800) are processed can be a predetermined order (e.g., z-scan order (830)), and the image decoding device (100) can determine whether the third encoding unit (820c, 820d, 820e) determined by dividing the second encoding unit (810b) on the right into odd numbers satisfies the condition that it can be processed according to the predetermined order.

[0156] According to one embodiment, the image decoding device (100) may determine whether the third encoding units (820a, 820b, 820c, 820d, 820e) included in the first encoding unit (800) satisfy a condition that they can be processed in a predetermined order, and the condition is related to whether at least one of the width and height of the second encoding unit (810a, 810b) is split in half according to the boundary of the third encoding unit (820a, 820b, 820c, 820d, 820e). For example, the third encoding unit (820a, 820b) determined by splitting the height of the left second encoding unit (810a) of a non-square shape in half may satisfy the condition. Since the boundaries of the third encoding units (820c, 820d, 820e) determined by dividing the right second encoding unit (810b) into three encoding units do not divide the width or height of the right second encoding unit (810b) in half, it may be determined that the third encoding units (820c, 820d, 820e) do not satisfy the condition. In the case where this condition is not satisfied, the image decoding device (100) may determine that there is a disconnection in the scanning order, and may determine that the right second encoding unit (810b) is divided into an odd number of encoding units based on the determination result. According to an embodiment, the image decoding device (100) may place a predetermined restriction on an encoding unit at a predetermined position among the divided encoding units when the encoding unit is divided into an odd number of encoding units. Since the contents of such restrictions or predetermined positions have been described above through various embodiments, a detailed description thereof will be omitted.

[0157] FIG. 9 illustrates a process in which an image decoding device (100) divides a first encoding unit (900) to determine at least one encoding unit according to one embodiment.

[0158] According to one embodiment, the image decoding device (100) may split the first coding unit (900) based on the split shape mode information acquired through the bitstream acquisition unit (110). The first coding unit (900) having a square shape may be split into four coding units having a square shape or may be split into a plurality of coding units having a non-square shape. For example, referring to FIG. 9, when the first coding unit (900) is square and the split shape mode information indicates that it is split into non-square coding units, the image decoding device (100) may split the first coding unit (900) into a plurality of non-square coding units. Specifically, when the split shape mode information indicates that the first encoding unit (900) is split in the horizontal direction or the vertical direction to determine an odd number of encoding units, the image decoding device (100) can split the first encoding unit (900) having a square shape into second encoding units (910a, 910b, 910c) determined by splitting them in the vertical direction into an odd number of encoding units or second encoding units (920a, 920b, 920c) determined by splitting them in the horizontal direction.

[0159] According to one embodiment, the image decoding device (100) can determine whether the second encoding units (910a, 910b, 910c, 920a, 920b, 920c) included in the first encoding unit (900) satisfy a condition that allows them to be processed in a predetermined order, and the condition is related to whether at least one of the width and height of the first encoding unit (900) is split in half according to the boundary of the second encoding units (910a, 910b, 910c, 920a, 920b, 920c). Referring to FIG. 9, since the boundaries of the second coding units (910a, 910b, 910c) determined by vertically dividing the first coding unit (900) in a square shape do not divide the width of the first coding unit (900) in half, it may be determined that the first coding unit (900) does not satisfy the condition that it can be processed in a predetermined order. In addition, since the boundaries of the second coding units (920a, 920b, 920c) determined by horizontally dividing the first coding unit (900) in a square shape do not divide the height of the first coding unit (900) in half, it may be determined that the first coding unit (900) does not satisfy the condition that it can be processed in a predetermined order. If such a condition is not satisfied, the image decoding device (100) may determine that the scan order is disconnected, and based on the determination result, may determine that the first encoding unit (900) is divided into an odd number of encoding units. According to one embodiment, the image decoding device (100) may place a predetermined restriction on an encoding unit at a predetermined position among the divided encoding units when the encoding unit is divided into an odd number of encoding units. Since the contents of such restrictions or predetermined positions, etc. have been described above through various embodiments, a detailed description thereof will be omitted.

[0160] According to one embodiment, the image decoding device (100) can divide the first encoding unit to determine encoding units of various shapes.

[0161] Referring to FIG. 9, the image decoding device (100) can divide the first encoding unit (900) having a square shape and the first encoding unit (930 or 950) having a non-square shape into encoding units of various shapes.

[0162] FIG. 10 illustrates that, according to one embodiment, a video decoding device (100) limits the shapes into which a second encoding unit can be divided when a non-square shape of a second encoding unit determined by splitting a first encoding unit (1000) satisfies a predetermined condition.

[0163] According to one embodiment, the image decoding device (100) may determine to split a first coding unit (1000) having a square shape into second coding units (1010a, 1010b, 1020a, 1020b) having a non-square shape based on the split shape mode information acquired through the bitstream acquisition unit (110). The second coding units (1010a, 1010b, 1020a, 1020b) may be split independently. Accordingly, the image decoding device (100) may determine to split or not split into a plurality of coding units based on the split shape mode information related to each of the second coding units (1010a, 1010b, 1020a, 1020b). According to one embodiment, the image decoding device (100) may determine third encoding units (1012a, 1012b) by horizontally dividing the left second encoding unit (1010a) having a non-square shape determined by vertically dividing the first encoding unit (1000). However, when the image decoding device (100) divides the left second encoding unit (1010a) in the horizontal direction, the right second encoding unit (1010b) may be restricted from being horizontally divided in the same direction as the direction in which the left second encoding unit (1010a) is divided. If the second encoding unit on the right (1010b) is split in the same direction to determine the third encoding unit (1014a, 1014b), the second encoding unit on the left (1010a) and the second encoding unit on the right (1010b) may be independently split in the horizontal direction to determine the third encoding unit (1012a, 1012b, 1014a, 1014b). However, this is the same result as the image decoding device (100) splitting the first encoding unit (1000) into four square-shaped second encoding units (1030a, 1030b, 1030c, 1030d) based on the split shape mode information, which may be inefficient in terms of image decoding.

[0164] According to one embodiment, the image decoding device (100) may determine third coding units (1022a, 1022b, 1024a, 1024b) by vertically dividing a second coding unit (1020a or 1020b) having a non-square shape determined by dividing a first coding unit (1000) in a horizontal direction. However, when the image decoding device (100) vertically divides one of the second coding units (e.g., the upper second coding unit (1020a)), the other second coding units (e.g., the lower coding unit (1020b)) may be restricted from being vertically divided in the same direction as the direction in which the upper second coding unit (1020a) is divided, for the reasons described above.

[0165] FIG. 11 illustrates a process in which an image decoding device (100) divides a square-shaped encoding unit when the split shape mode information cannot indicate that the encoding unit is divided into four square-shaped encoding units according to one embodiment.

[0166] According to one embodiment, the image decoding device (100) may split the first encoding unit (1100) based on the split shape mode information to determine the second encoding units (1110a, 1110b, 1120a, 1120b, etc.). The split shape mode information may include information about various shapes into which the encoding unit may be split, but the information about various shapes may not include information for splitting the encoding unit into four encoding units having a square shape. According to this split shape mode information, the image decoding device (100) cannot split the first encoding unit (1100) having a square shape into four second encoding units having a square shape (1130a, 1130b, 1130c, 1130d). Based on the segmentation shape mode information, the image decoding device (100) can determine a second encoding unit (1110a, 1110b, 1120a, 1120b, etc.) of a non-square shape.

[0167] According to one embodiment, the image decoding device (100) can independently split each of the second encoding units (1110a, 1110b, 1120a, 1120b, etc.) having a non-square shape. Each of the second encoding units (1110a, 1110b, 1120a, 1120b, etc.) can be split in a predetermined order using a recursive method, which may be a splitting method corresponding to a method in which the first encoding unit (1100) is split based on splitting shape mode information.

[0168] For example, the image decoding device (100) can determine third coding units (1112a, 1112b) having a square shape by splitting the left second coding unit (1110a) in the horizontal direction, and can determine third coding units (1114a, 1114b) having a square shape by splitting the right second coding unit (1110b) in the horizontal direction. Furthermore, the image decoding device (100) can also determine third coding units (1116a, 1116b, 1116c, 1116d) having a square shape by splitting both the left second coding unit (1110a) and the right second coding unit (1110b) in the horizontal direction. In this case, the encoding unit can be determined in the same form as the first encoding unit (1100) being divided into four square-shaped second encoding units (1130a, 1130b, 1130c, 1130d).

[0169] As another example, the image decoding device (100) may determine third coding units (1122a, 1122b) having a square shape by vertically splitting the upper second coding unit (1120a), and may determine third coding units (1124a, 1124b) having a square shape by vertically splitting the lower second coding unit (1120b). Furthermore, the image decoding device (100) may determine third coding units (1126a, 1126b, 1126a, 1126b) having a square shape by vertically splitting both the upper second coding unit (1120a) and the lower second coding unit (1120b). In this case, the encoding unit can be determined in the same form as the first encoding unit (1100) being divided into four square-shaped second encoding units (1130a, 1130b, 1130c, 1130d).

[0170] FIG. 12 illustrates that, according to one embodiment, the processing order between multiple encoding units may vary depending on the process of dividing the encoding units.

[0171] According to one embodiment, the image decoding device (100) may split the first encoding unit (1200) based on the split shape mode information. If the block shape is square and the split shape mode information indicates that the first encoding unit (1200) is split in at least one of the horizontal direction and the vertical direction, the image decoding device (100) may split the first encoding unit (1200) to determine second encoding units (e.g., 1210a, 1210b, 1220a, 1220b, etc.). Referring to FIG. 12, the second encoding units (1210a, 1210b, 1220a, 1220b) having a non-square shape determined by splitting the first encoding unit 1200 only in the horizontal direction or the vertical direction may be independently split based on the split shape mode information for each. For example, the image decoding device (100) can determine third encoding units (1216a, 1216b, 1216c, 1216d) by horizontally dividing second encoding units (1210a, 1210b) generated by vertically dividing the first encoding unit (1200), and can determine third encoding units (1226a, 1226b, 1226c, 1226d) by vertically dividing second encoding units (1220a, 1220b) generated by horizontally dividing the first encoding unit (1200). Since the process of dividing the second encoding units (1210a, 1210b, 1220a, 1220b) has been described above with reference to FIG. 11, a detailed description thereof will be omitted.

[0172] According to one embodiment, the image decoding device (100) can process encoding units according to a predetermined order. Since the characteristics of processing encoding units according to a predetermined order have been described above with reference to FIG. 7, a detailed description thereof will be omitted. Referring to FIG. 12, the image decoding device (100) can divide a first encoding unit (1200) having a square shape and determine four third encoding units (1216a, 1216b, 1216c, 1216d, 1226a, 1226b, 1226c, 1226d) having a square shape. According to one embodiment, the image decoding device (100) can determine the processing order of the third encoding units (1216a, 1216b, 1216c, 1216d, 1226a, 1226b, 1226c, 1226d) depending on the form in which the first encoding unit (1200) is divided.

[0173] According to one embodiment, the image decoding device (100) may determine third encoding units (1216a, 1216b, 1216c, 1216d) by horizontally dividing the second encoding units (1210a, 1210b) generated by vertically dividing them, and the image decoding device (100) may process the third encoding units (1216a, 1216b, 1216c, 1216d) according to an order (1217) of first processing the third encoding units (1216a, 1216c) included in the left second encoding unit (1210a) in the vertical direction and then processing the third encoding units (1216b, 1216d) included in the right second encoding unit (1210b) in the vertical direction.

[0174] According to one embodiment, the image decoding device (100) may determine third encoding units (1226a, 1226b, 1226c, 1226d) by vertically dividing the second encoding units (1220a, 1220b) generated by being divided in the horizontal direction, and the image decoding device (100) may process the third encoding units (1226a, 1226b, 1226c, 1226d) according to an order (1227) of first processing the third encoding units (1226a, 1226b) included in the upper second encoding unit (1220a) in the horizontal direction and then processing the third encoding units (1226c, 1226d) included in the lower second encoding unit (1220b) in the horizontal direction.

[0175] Referring to FIG. 12, the second encoding units (1210a, 1210b, 1220a, 1220b) can be divided into third encoding units (1216a, 1216b, 1216c, 1216d, 1226a, 1226b, 1226c, 1226d) having a square shape. The second encoding units (1210a, 1210b) determined by being split in the vertical direction and the second encoding units (1220a, 1220b) determined by being split in the horizontal direction are split into different shapes, but according to the third encoding units (1216a, 1216b, 1216c, 1216d, 1226a, 1226b, 1226c, 1226d) determined later, the first encoding unit (1200) is ultimately split into encoding units of the same shape. Accordingly, even if the image decoding device (100) determines encoding units of the same shape as a result by recursively splitting the encoding units through different processes based on the split shape mode information, it can process a plurality of encoding units determined in the same shape in different orders.

[0176] FIG. 13 illustrates a process in which the depth of an encoding unit is determined as the shape and size of the encoding unit change when the encoding unit is recursively divided to determine a plurality of encoding units according to one embodiment.

[0177] According to one embodiment, the image decoding device (100) may determine the depth of an encoding unit according to a predetermined criterion. For example, the predetermined criterion may be the length of a long side of the encoding unit. If the length of the long side of the current encoding unit is split to be 2n (n>0) times the length of the long side of the encoding unit before splitting, the image decoding device (100) may determine that the depth of the current encoding unit is increased by n compared to the depth of the encoding unit before splitting. Hereinafter, an encoding unit with an increased depth is expressed as an encoding unit of a lower depth.

[0178] Referring to FIG. 13, according to one embodiment, based on block shape information indicating a square shape (for example, the block shape information may indicate '0: SQUARE'), the image decoding device (100) may divide a first coding unit (1300) having a square shape to determine a second coding unit (1302), a third coding unit (1304), etc. of a lower depth. If the size of the first coding unit (1300) having a square shape is 2Nx2N, the second coding unit (1302) determined by dividing the width and height of the first coding unit (1300) by half may have a size of NxN. Furthermore, the third coding unit (1304) determined by dividing the width and height of the second coding unit (1302) by half may have a size of N / 2xN / 2. In this case, the width and height of the third encoding unit (1304) correspond to 1 / 4 of the width and height of the first encoding unit (1300). When the depth of the first encoding unit (1300) is D, the depth of the second encoding unit (1302), which is 1 / 2 of the width and height of the first encoding unit (1300), may be D+1, and the depth of the third encoding unit (1304), which is 1 / 4 of the width and height of the first encoding unit (1300), may be D+2.

[0179] In one embodiment, based on block shape information indicating a non-square shape (for example, the block shape information may indicate '1: NS_VER' indicating a non-square shape in which the height is longer than the width or '2: NS_HOR' indicating a non-square shape in which the width is longer than the height), the image decoding device (100) may split a first coding unit (1310 or 1320) having a non-square shape to determine a second coding unit (1312 or 1322), a third coding unit (1314 or 1324) of a lower depth, etc.

[0180] The image decoding device (100) can determine a second encoding unit (e.g., 1302, 1312, 1322, etc.) by splitting at least one of the width and height of the first encoding unit (1310) having a size of Nx2N. That is, the image decoding device (100) can split the first encoding unit (1310) in the horizontal direction to determine a second encoding unit (1302) having a size of NxN or a second encoding unit (1322) having a size of NxN / 2, and can also split the first encoding unit (1310) in the horizontal direction and the vertical direction to determine a second encoding unit (1312) having a size of N / 2xN.

[0181] According to one embodiment, the image decoding device (100) may determine a second coding unit (e.g., 1302, 1312, 1322, etc.) by splitting at least one of the width and the height of the first coding unit (1320) having a size of 2NxN. That is, the image decoding device (100) may split the first coding unit (1320) in the vertical direction to determine a second coding unit (1302) having a size of NxN or a second coding unit (1312) having a size of N / 2xN, and may also split the first coding unit (1320) in the horizontal direction and the vertical direction to determine a second coding unit (1322) having a size of NxN / 2.

[0182] According to one embodiment, the image decoding device (100) may determine a third encoding unit (e.g., 1304, 1314, 1324, etc.) by splitting at least one of the width and the height of the second encoding unit (1302) having a size of NxN. That is, the image decoding device (100) may split the second encoding unit (1302) in the vertical direction and the horizontal direction to determine a third encoding unit (1304) having a size of N / 2xN / 2, a third encoding unit (1314) having a size of N / 4xN / 2, or a third encoding unit (1324) having a size of N / 2xN / 4.

[0183] According to one embodiment, the image decoding device (100) may determine a third encoding unit (e.g., 1304, 1314, 1324, etc.) by splitting at least one of the width and the height of the second encoding unit (1312) having a size of N / 2xN. That is, the image decoding device (100) may split the second encoding unit (1312) in the horizontal direction to determine a third encoding unit (1304) having a size of N / 2xN / 2 or a third encoding unit (1324) having a size of N / 2xN / 4, or split the second encoding unit (1312) in the vertical direction and the horizontal direction to determine a third encoding unit (1314) having a size of N / 4xN / 2.

[0184] According to one embodiment, the image decoding device (100) may determine a third encoding unit (e.g., 1304, 1314, 1324, etc.) by splitting at least one of the width and the height of the second encoding unit (1322) having a size of NxN / 2. That is, the image decoding device (100) may split the second encoding unit (1322) in the vertical direction to determine a third encoding unit (1304) having a size of N / 2xN / 2 or a third encoding unit (1314) having a size of N / 4xN / 2, or split the second encoding unit (1322) in the vertical direction and the horizontal direction to determine a third encoding unit (1324) having a size of N / 2xN / 4.

[0185] According to one embodiment, the image decoding device (100) may split a square-shaped encoding unit (e.g., 1300, 1302, 1304) in a horizontal direction or a vertical direction. For example, a first encoding unit (1300) having a size of 2Nx2N may be split in the vertical direction to determine a first encoding unit (1310) having a size of Nx2N, or may be split in the horizontal direction to determine a first encoding unit (1320) having a size of 2NxN. According to one embodiment, when the depth is determined based on the length of the longest side of the encoding unit, the depth of the encoding unit determined by splitting the first encoding unit (1300) having a size of 2Nx2N in the horizontal direction or the vertical direction may be the same as the depth of the first encoding unit (1300).

[0186] According to one embodiment, the width and height of the third coding unit (1314 or 1324) may be 1 / 4 times that of the first coding unit (1310 or 1320). When the depth of the first coding unit (1310 or 1320) is D, the depth of the second coding unit (1312 or 1322), which is 1 / 2 times the width and height of the first coding unit (1310 or 1320), may be D+1, and the depth of the third coding unit (1314 or 1324), which is 1 / 4 times the width and height of the first coding unit (1310 or 1320), may be D+2.

[0187] FIG. 14 illustrates an index (part index, hereinafter referred to as PID) for depth and encoding unit distinction that can be determined according to the shape and size of encoding units according to one embodiment.

[0188] According to one embodiment, the image decoding device (100) may split a first encoding unit (1400) having a square shape to determine second encoding units of various shapes. Referring to FIG. 14, the image decoding device (100) may split the first encoding unit (1400) in at least one of a vertical direction and a horizontal direction according to the split shape mode information to determine second encoding units (1402a, 1402b, 1404a, 1404b, 1406a, 1406b, 1406c, 1406d). That is, the image decoding device (100) can determine the second encoding unit (1402a, 1402b, 1404a, 1404b, 1406a, 1406b, 1406c, 1406d) based on the split shape mode information for the first encoding unit (1400).

[0189] According to one embodiment, the depth of the second coding units (1402a, 1402b, 1404a, 1404b, 1406a, 1406b, 1406c, 1406d) determined according to the split shape mode information for the first coding unit (1400) having a square shape may be determined based on the length of the long side. For example, since the length of one side of the first coding unit (1400) having a square shape and the length of the long side of the second coding unit (1402a, 1402b, 1404a, 1404b) having a non-square shape are the same, the depth of the first coding unit (1400) and the second coding units (1402a, 1402b, 1404a, 1404b) having a non-square shape may be considered to be the same as D. In contrast, when the image decoding device (100) divides the first encoding unit (1400) into four square-shaped second encoding units (1406a, 1406b, 1406c, 1406d) based on the split shape mode information, the length of one side of the square-shaped second encoding units (1406a, 1406b, 1406c, 1406d) is half the length of one side of the first encoding unit (1400), so the depth of the second encoding units (1406a, 1406b, 1406c, 1406d) may be a depth of D+1, which is one depth lower than D, the depth of the first encoding unit (1400).

[0190] According to one embodiment, the image decoding device (100) may split a first encoding unit (1410) having a height greater than its width into a plurality of second encoding units (1412a, 1412b, 1414a, 1414b, 1414c) in a horizontal direction according to the splitting shape mode information. According to one embodiment, the image decoding device (100) may split a first encoding unit (1420) having a width greater than its height into a plurality of second encoding units (1422a, 1422b, 1424a, 1424b, 1424c) in a vertical direction according to the splitting shape mode information.

[0191] According to one embodiment, the depth of the second coding unit (1412a, 1412b, 1414a, 1414b, 1414c. 1422a, 1422b, 1424a, 1424b, 1424c) determined based on the split shape mode information for the first coding unit (1410 or 1420) of a non-square shape may be determined based on the length of the long side. For example, since the length of one side of the second encoding unit (1412a, 1412b) in the shape of a square is half the length of one side of the first encoding unit (1410) in the shape of a non-square having a height longer than a width, the depth of the second encoding unit (1412a, 1412b) in the shape of a square is D+1, which is one depth lower than the depth D of the first encoding unit (1410) in the shape of a non-square.

[0192] Furthermore, the image decoding device (100) can split a non-square first encoding unit (1410) into an odd number of second encoding units (1414a, 1414b, 1414c) based on the split shape mode information. The odd number of second encoding units (1414a, 1414b, 1414c) can include non-square second encoding units (1414a, 1414c) and square second encoding units (1414b). In this case, since the length of the long side of the second encoding unit (1414a, 1414c) of a non-square shape and the length of one side of the second encoding unit (1414b) of a square shape are half the length of one side of the first encoding unit (1410), the depth of the second encoding unit (1414a, 1414b, 1414c) may be a depth of D+1, which is one depth lower than D, which is the depth of the first encoding unit (1410). The image decoding device (100) may determine the depth of the encoding units associated with the first encoding unit (1420) of a non-square shape, in which the width is longer than the height, in a manner corresponding to the above method of determining the depth of the encoding units associated with the first encoding unit (1410).

[0193] According to one embodiment, when determining an index (PID) for distinguishing divided coding units, the image decoding device (100) may determine the index based on a size ratio between the coding units when the coding units divided into an odd number are not of the same size. Referring to FIG. 14, among the coding units (1414a, 1414b, 1414c) divided into an odd number, the coding unit (1414b) located in the middle may have the same width as the other coding units (1414a, 1414c) but may have a height that is twice the height of the coding units (1414a, 1414c) that are different in height. That is, in this case, the coding unit (1414b) located in the middle may include two of the other coding units (1414a, 1414c). Accordingly, if the index (PID) of the encoding unit (1414b) located in the middle according to the scanning order is 1, the index of the encoding unit (1414c) located in the next order may be 3, which is an increase of 2. In other words, there may be a discontinuity in the index value. According to one embodiment, the image decoding device (100) may determine whether the encoding units divided into an odd number are not of the same size based on the presence or absence of discontinuity in the index for distinguishing between the divided encoding units.

[0194] According to one embodiment, the image decoding device (100) may determine whether the image is divided into a specific split shape based on the value of an index for distinguishing a plurality of coding units that are divided from the current coding unit. Referring to FIG. 14, the image decoding device (100) may divide a first coding unit (1410) having a rectangular shape in which the height is longer than the width, to determine an even number of coding units (1412a, 1412b) or an odd number of coding units (1414a, 1414b, 1414c). The image decoding device (100) may use an index (PID) indicating each coding unit to distinguish each of the plurality of coding units. According to one embodiment, the PID may be obtained from a sample (for example, an upper left sample) at a predetermined position of each coding unit.

[0195] According to one embodiment, the image decoding device (100) may determine an coding unit at a predetermined position among the coding units that are divided and determined using an index for distinguishing the coding units. According to one embodiment, when the split shape mode information for the first coding unit (1410) having a rectangular shape with a height longer than the width indicates that the first coding unit (1410) is divided into three coding units, the image decoding device (100) may divide the first coding unit (1410) into three coding units (1414a, 1414b, 1414c). The image decoding device (100) may assign an index to each of the three coding units (1414a, 1414b, 1414c). The image decoding device (100) may compare the indexes for each coding unit to determine the middle coding unit among the coding units divided into an odd number of coding units. The image decoding device (100) may determine a coding unit (1414b) having an index corresponding to a middle value among the indices of the coding units as a coding unit at a middle position among the coding units determined by splitting the first coding unit (1410). According to an embodiment, when determining an index for distinguishing the split coding units, the image decoding device (100) may determine the index based on a size ratio between the coding units when the coding units do not have the same size. Referring to FIG. 14, the coding unit (1414b) generated by splitting the first coding unit (1410) may have the same width as other coding units (1414a, 1414c) but may be twice the height of the coding units (1414a, 1414c) that are different in height. In this case, if the index (PID) of the encoding unit (1414b) located in the middle is 1, the index of the encoding unit (1414c) located in the next order may be 3, which is an increase of 2.In cases like this where the index increases uniformly and then the increase amount changes, the image decoding device (100) may determine that the current encoding unit is divided into a plurality of encoding units including encoding units having different sizes from other encoding units. According to one embodiment, when the split shape mode information indicates that the current encoding unit is divided into an odd number of encoding units, the image decoding device (100) may divide the current encoding unit into a form in which an encoding unit at a predetermined position among the odd number of encoding units (for example, a middle encoding unit) has a different size from the other encoding units. In this case, the image decoding device (100) may determine a middle encoding unit having a different size using an index (PID) for the encoding unit. However, the above-described index, the size or position of the encoding unit at the predetermined position to be determined are specific for explaining one embodiment and should not be interpreted as being limited thereto, and it should be interpreted that various indexes, positions and sizes of encoding units can be used.

[0196] According to one embodiment, the image decoding device (100) may utilize a predetermined data unit from which recursive division of the encoding unit begins.

[0197] FIG. 15 illustrates that a plurality of encoding units are determined according to a plurality of predetermined data units included in a picture according to one embodiment.

[0198] According to one embodiment, a predetermined data unit may be defined as a data unit from which a coding unit begins to be recursively split using split shape mode information. That is, it may correspond to a coding unit of the highest depth used in the process of determining multiple coding units for splitting the current picture. For convenience of explanation, this predetermined data unit will be referred to as a reference data unit hereinafter.

[0199] In one embodiment, the reference data unit may exhibit a predetermined size and shape. In one embodiment, the reference data unit may include MxN samples, where M and N may be the same and may be integers expressed as powers of 2. That is, the reference data unit may exhibit a square or non-square shape, and may be subsequently divided into an integer number of coding units.

[0200] According to one embodiment, the video decoding device (100) can divide the current picture into a plurality of reference data units. According to one embodiment, the video decoding device (100) can divide the plurality of reference data units into which the current picture is divided using division type mode information for each reference data unit. This division process of the reference data units can correspond to a division process using a quad-tree structure.

[0201] According to one embodiment, the image decoding device (100) may predetermine the minimum size that a reference data unit included in the current picture may have. Accordingly, the image decoding device (100) may determine reference data units of various sizes having a size greater than or equal to the minimum size, and may determine at least one encoding unit using segmentation mode information based on the determined reference data unit.

[0202] Referring to FIG. 15, the image decoding device (100) may use a reference coding unit (1500) having a square shape, or may use a reference coding unit (1502) having a non-square shape. According to one embodiment, the shape and size of the reference coding unit may be determined according to various data units (e.g., sequence, picture, slice, slice segment, tile, tile group, maximum coding unit, etc.) that may include at least one reference coding unit.

[0203] According to one embodiment, the bitstream acquisition unit (110) of the image decoding device (100) can acquire at least one of information on the shape of the reference coding unit and information on the size of the reference coding unit from the bitstream for each of the various data units. The process of determining at least one coding unit included in the square-shaped reference coding unit (1500) has been described above through the process of splitting the current coding unit (300) of FIG. 3, and the process of determining at least one coding unit included in the non-square-shaped reference coding unit (1502) has been described above through the process of splitting the current coding unit (400 or 450) of FIG. 4, so a detailed description thereof will be omitted.

[0204] According to one embodiment, the image decoding device (100) may use an index for identifying the size and shape of the reference coding unit to determine the size and shape of the reference coding unit according to some data units that are predetermined based on a predetermined condition. That is, the bitstream acquisition unit (110) may acquire only an index for identifying the size and shape of the reference coding unit for each slice, slice segment, tile, tile group, maximum coding unit, etc., among the various data units (e.g., sequences, pictures, slices, slice segments, tiles, tile groups, maximum coding units, etc.) that satisfy a predetermined condition (e.g., data units having a size smaller than a slice) from the bitstream. The image decoding device (100) may determine the size and shape of the reference data unit for each data unit that satisfies the predetermined condition by using the index. When information about the shape of the reference coding unit and information about the size of the reference coding unit are obtained from the bitstream for each relatively small-sized data unit and used, the efficiency of the bitstream may not be good. Therefore, instead of directly obtaining information about the shape of the reference coding unit and information about the size of the reference coding unit, only the index may be obtained and used. In this case, at least one of the size and shape of the reference coding unit corresponding to the index indicating the size and shape of the reference coding unit may be determined in advance. That is, the image decoding device (100) can determine at least one of the size and shape of the reference coding unit included in the data unit that serves as the basis for obtaining the index by selecting at least one of the sizes and shapes of the predetermined reference coding units according to the index.

[0205] According to one embodiment, the image decoding device (100) may use at least one reference coding unit included in one maximum coding unit. That is, a maximum coding unit for dividing an image may include at least one reference coding unit, and a coding unit may be determined through a recursive splitting process of each reference coding unit. According to one embodiment, at least one of the width and the height of the maximum coding unit may correspond to an integer multiple of at least one of the width and the height of the reference coding unit. According to one embodiment, the size of the reference coding unit may be a size obtained by splitting the maximum coding unit n times according to a quad tree structure. That is, the image decoding device (100) may split the maximum coding unit n times according to the quad tree structure to determine the reference coding unit, and may split the reference coding unit based on at least one of block shape information and split shape mode information according to various embodiments.

[0206] According to one embodiment, the video decoding device (100) may obtain and use block shape information indicating the shape of the current encoding unit or split shape mode information indicating a method of splitting the current encoding unit from the bitstream. The split shape mode information may be included in a bitstream related to various data units. For example, the video decoding device (100) may use split shape mode information included in a sequence parameter set, a picture parameter set, a video parameter set, a slice header, a slice segment header, a tile header, and a tile group header. Furthermore, the video decoding device (100) may obtain and use a syntax element corresponding to block shape information or split shape mode information from the bitstream for each maximum encoding unit and each reference encoding unit.

[0207] Hereinafter, a method for determining a partitioning rule according to one embodiment of the present disclosure will be described in detail.

[0208] The video decoding device (100) can determine a segmentation rule of the video. The segmentation rule may be predetermined between the video decoding device (100) and the video encoding device (200). The video decoding device (100) can determine the segmentation rule of the video based on information obtained from a bitstream. The video decoding device (100) can determine the segmentation rule based on information obtained from at least one of a sequence parameter set, a picture parameter set, a video parameter set, a slice header, a slice segment header, a tile header, and a tile group header. The video decoding device (100) can determine the segmentation rule differently according to a frame, a slice, a tile, a temporal layer, a maximum coding unit, or an coding unit.

[0209] The image decoding device (100) can determine a segmentation rule based on the block shape of the encoding unit. The block shape can include the size, shape, width and height ratio, and direction of the encoding unit. The image encoding device (200) and the image decoding device (100) can determine in advance that the segmentation rule will be determined based on the block shape of the encoding unit. However, the present invention is not limited thereto. The image decoding device (100) can determine the segmentation rule based on information obtained from the bitstream received from the image encoding device (200).

[0210] The shape of the encoding unit may include a square and a non-square. If the width and height of the encoding unit are equal, the image decoding device (100) may determine the shape of the encoding unit as a square. In addition, if the width and height of the encoding unit are not equal, the image decoding device (100) may determine the shape of the encoding unit as a non-square.

[0211] The size of the coding unit may include various sizes such as 4x4, 8x4, 4x8, 8x8, 16x4, 16x8, ..., 256x256. The size of the coding unit may be classified according to the length of the long side, the length of the short side, or the area of ​​the coding unit. The image decoding device (100) may apply the same splitting rule to the coding units classified into the same group. For example, the image decoding device (100) may classify the coding units having the same long side length into the same size. In addition, the image decoding device (100) may apply the same splitting rule to the coding units having the same long side length.

[0212] The ratio of the width to the height of the coding unit may include 1:2, 2:1, 1:4, 4:1, 1:8, 8:1, 1:16, 16:1, 32:1, or 1:32, etc. In addition, the direction of the coding unit may include a horizontal direction and a vertical direction. The horizontal direction may indicate a case where the length of the width of the coding unit is longer than the length of the height. The vertical direction may indicate a case where the length of the width of the coding unit is shorter than the length of the height.

[0213] The image decoding device (100) can adaptively determine a splitting rule based on the size of the encoding unit. The image decoding device (100) can determine a different allowable splitting mode based on the size of the encoding unit. For example, the image decoding device (100) can determine whether splitting is allowed based on the size of the encoding unit. The image decoding device (100) can determine a splitting direction based on the size of the encoding unit. The image decoding device (100) can determine an allowable splitting type based on the size of the encoding unit.

[0214] Determining the splitting rule based on the size of the encoding unit may be a splitting rule predetermined between the image encoding device (200) and the image decoding device (100). In addition, the image decoding device (100) may determine the splitting rule based on information obtained from the bitstream.

[0215] The image decoding device (100) can adaptively determine a segmentation rule based on the position of the encoding unit. The image decoding device (100) can adaptively determine a segmentation rule based on the position that the encoding unit occupies in the image.

[0216] Additionally, the image decoding device (100) can determine a splitting rule so that encoding units generated through different splitting paths do not have the same block shape. However, this is not limited thereto, and encoding units generated through different splitting paths may have the same block shape. Encoding units generated through different splitting paths may have different decoding processing orders. Since the decoding processing order has been described together with FIG. 12, a detailed description thereof will be omitted.

[0217] FIG. 16 illustrates encoding units that can be determined for each picture when the combination of forms into which encoding units can be divided is different for each picture according to one embodiment.

[0218] Referring to FIG. 16, the image decoding device (100) can determine a different combination of partitioning shapes into which encoding units can be partitioned for each picture. For example, the image decoding device (100) can decode an image using a picture (1600) that can be partitioned into four encoding units, a picture (1610) that can be partitioned into two or four encoding units, and a picture (1620) that can be partitioned into two, three, or four encoding units, among at least one picture included in the image. The image decoding device (100) can only use partitioning shape information indicating that the picture (1600) is partitioned into four square encoding units to partition the picture (1600) into a plurality of encoding units. The image decoding device (100) can only use partitioning shape information indicating that the picture (1610) is partitioned into two or four encoding units to partition the picture. The video decoding device (100) can only use the segmentation type information indicating that the picture (1620) is segmented into two, three, or four encoding units. The above-described combination of segmentation types is merely an example for explaining the operation of the video decoding device (100), and therefore the above-described combination of segmentation types should not be interpreted as being limited to the above-described example, but should be interpreted as being capable of using various combinations of segmentation types for each predetermined data unit.

[0219] According to one embodiment, the bitstream acquisition unit (110) of the image decoding device (100) can acquire a bitstream including an index indicating a combination of segmentation type information for each predetermined data unit (e.g., sequence, picture, slice, slice segment, tile, tile group, etc.). For example, the bitstream acquisition unit (110) can acquire an index indicating a combination of segmentation type information from a sequence parameter set, a picture parameter set, a slice header, a tile header, or a tile group header. The image decoding device (100) of the image decoding device (100) can determine a combination of segmentation types by which an encoding unit can be divided for each predetermined data unit using the acquired index, and thus can use different combinations of segmentation types for each predetermined data unit.

[0220] FIG. 17 illustrates various forms of encoding units that can be determined based on segmentation mode information that can be expressed in binary code according to one embodiment.

[0221] According to one embodiment, the image decoding device (100) can split an encoding unit into various shapes using block shape information and split shape mode information acquired through the bitstream acquisition unit (110). The shapes of the encoding unit that can be split may correspond to various shapes including the shapes described through the above-described embodiments.

[0222] Referring to FIG. 17, the image decoding device (100) can split a square-shaped encoding unit in at least one of the horizontal direction and the vertical direction based on the split shape mode information, and can split a non-square-shaped encoding unit in the horizontal direction or the vertical direction.

[0223] According to one embodiment, when the image decoding device (100) can divide a square-shaped encoding unit into four square encoding units by horizontally and vertically splitting the encoding unit, there may be four types of splitting modes that the splitting mode information for the square encoding unit can indicate. According to one embodiment, the splitting mode information may be expressed as a two-digit binary code, and a binary code may be assigned to each splitting mode. For example, when the encoding unit is not split, the splitting mode information may be expressed as (00)b, when the encoding unit is split in the horizontal direction and the vertical direction, the splitting mode information may be expressed as (01)b, when the encoding unit is split in the horizontal direction, the splitting mode information may be expressed as (10)b, and when the encoding unit is split in the vertical direction, the splitting mode information may be expressed as (11)b.

[0224] According to one embodiment, when the image decoding device (100) splits a non-square coding unit in a horizontal direction or a vertical direction, the type of split shape that the split shape mode information can indicate may be determined depending on the number of coding units into which the coding unit is split. Referring to FIG. 17, the image decoding device (100) may split a non-square coding unit into up to three according to one embodiment. The image decoding device (100) may split the coding unit into two coding units, in which case the split shape mode information may be expressed as (10)b. The image decoding device (100) may split the coding unit into three coding units, in which case the split shape mode information may be expressed as (11)b. The image decoding device (100) may determine not to split the coding unit, in which case the split shape mode information may be expressed as (0)b. That is, the image decoding device (100) can use variable length coding (VLC) rather than fixed length coding (FLC) to use a binary code representing segmentation mode information.

[0225] According to one embodiment, referring to FIG. 17, the binary code of the partition shape mode information indicating that the coding unit is not split may be expressed as (0)b. If the binary code of the partition shape mode information indicating that the coding unit is not split is set to (00)b, all binary codes of the 2-bit partition shape mode information must be used even if there is no partition shape mode information set to (01)b. However, as illustrated in FIG. 17, if three partition shapes for a non-square coding unit are used, the image decoding device (100) can determine that the coding unit is not split even if it uses a 1-bit binary code (0)b as the partition shape mode information, and thus can efficiently use the bitstream. However, the partition shapes of the non-square coding unit indicated by the partition shape mode information should not be interpreted as being limited to only the three shapes illustrated in FIG. 17, but should be interpreted as various shapes including the above-described embodiments.

[0226] FIG. 18 illustrates another form of a coding unit that can be determined based on segmentation mode information that can be expressed in binary code according to one embodiment.

[0227] Referring to FIG. 18, the image decoding device (100) can split a square-shaped encoding unit in the horizontal direction or the vertical direction based on the split shape mode information, and can split a non-square-shaped encoding unit in the horizontal direction or the vertical direction. That is, the split shape mode information can indicate that a square-shaped encoding unit is split in one direction. In this case, the binary code of the split shape mode information indicating that a square-shaped encoding unit is not split can be expressed as (0)b. If the binary code of the split shape mode information indicating that the encoding unit is not split is set to (00)b, all binary codes of the 2-bit split shape mode information must be used even though there is no split shape mode information set to (01)b. However, as illustrated in FIG. 18, if three types of division forms for a square-shaped encoding unit are used, the image decoding device (100) can determine that the encoding unit is not divided even if it uses a 1-bit binary code (0)b as the division form mode information, and thus can efficiently use the bitstream. However, the division forms of the square-shaped encoding unit indicated by the division form mode information should not be interpreted as being limited to only the three types illustrated in FIG. 18, but should be interpreted as various types including the embodiments described above.

[0228] In one embodiment, block shape information or segmentation shape mode information may be expressed using binary code, and such information may be directly generated as a bitstream. Furthermore, block shape information or segmentation shape mode information that may be expressed using binary code may not be directly generated as a bitstream, but may instead be used as a binary code input into CABAC (context adaptive binary arithmetic coding).

[0229] According to one embodiment, the image decoding device (100) describes a process of obtaining syntax for block shape information or segmentation shape mode information through CABAC. A bitstream including a binary code for the syntax can be obtained through a bitstream obtaining unit (110). The image decoding device (100) can detect a syntax element indicating block shape information or segmentation shape mode information by de-binarizing a bin string included in the obtained bitstream. According to one embodiment, the image decoding device (100) can obtain a set of binary bin strings corresponding to syntax elements to be decoded, and decode each bin using probability information, and the image decoding device (100) can repeat the process until a bin string composed of the decoded bins becomes equal to one of the previously obtained bin strings. The image decoding device (100) can determine syntax elements by performing inverse binarization of an empty string.

[0230] According to one embodiment, the image decoding device (100) may perform a decoding process of adaptive binary arithmetic coding to determine a syntax for a bin string, and the image decoding device (100) may update a probability model for bins acquired through the bitstream acquisition unit (110). Referring to FIG. 17, the bitstream acquisition unit (110) of the image decoding device (100) may acquire a bitstream representing a binary code representing segmentation mode information according to one embodiment. Using the acquired binary code having a size of 1 or 2 bits, the image decoding device (100) may determine a syntax for the segmentation mode information. In order to determine the syntax for the segmentation mode information, the image decoding device (100) may update a probability for each bit of the 2-bit binary code. That is, the image decoding device (100) can update the probability of having a value of 0 or 1 when decoding the next bin, depending on whether the value of the first bin among the 2-bit binary codes is 0 or 1.

[0231] According to one embodiment, the image decoding device (100) may, in the process of determining the syntax, update the probability for the bins used in the process of decoding the bins of the empty string for the syntax, and the image decoding device (100) may determine that certain bits among the empty strings have the same probability without updating the probability.

[0232] Referring to FIG. 17, in the process of determining a syntax using an empty string indicating split shape mode information for a non-square coding unit, the image decoding device (100) may determine the syntax for the split shape mode information using one bin having a value of 0 when the non-square coding unit is not split. That is, when the block shape information indicates that the current coding unit is a non-square shape, the first bin of the empty string for the split shape mode information may be 0 when the non-square coding unit is not split, and may be 1 when it is split into 2 or 3 coding units. Accordingly, the probability that the first bin of the empty string of the split shape mode information for the non-square coding unit is 0 may be 1 / 3, and the probability that it is 1 may be 2 / 3. As described above, the image decoding device (100) can only express a 1-bit empty string having a value of 0 for the partition shape mode information indicating that a non-square-shaped encoding unit is not partitioned, so the image decoding device (100) can determine the syntax for the partition shape mode information by determining whether the second bin is 0 or 1 only when the first bin of the partition shape mode information is 1. According to one embodiment, the image decoding device (100) can decode the bin by considering that the probability that the second bin is 0 or 1 when the first bin for the partition shape mode information is 1 is the same probability.

[0233] According to one embodiment, the image decoding device (100) may use various probabilities for each bin in the process of determining a bin of a bin string for the partition shape mode information. According to one embodiment, the image decoding device (100) may determine the probability of a bin for the partition shape mode information differently depending on the direction of a non-square block. According to one embodiment, the image decoding device (100) may determine the probability of a bin for the partition shape mode information differently depending on the area or the length of the long side of the current encoding unit. According to one embodiment, the image decoding device (100) may determine the probability of a bin for the partition shape mode information differently depending on at least one of the shape and the length of the long side of the current encoding unit.

[0234] According to one embodiment, the image decoding device (100) may determine that the bin probability for the segmentation shape mode information is the same for encoding units of a predetermined size or larger. For example, the bin probability for the segmentation shape mode information may be determined to be the same for encoding units of a size of 64 samples or larger based on the length of the long side of the encoding unit.

[0235] According to one embodiment, the image decoding device (100) may determine the initial probability for bins constituting the empty string of the segmentation shape mode information based on the slice type (e.g., I slice, P slice, or B slice).

[0236] Figure 19 is a block diagram of an image encoding and decoding system that performs loop filtering.

[0237] The encoding unit (1910) of the image encoding and decoding system (1900) transmits an encoded bitstream of an image, and the decoding unit (1950) receives the bitstream and decodes it to output a restored image. Here, the encoding unit (1910) may have a configuration similar to that of the image encoding device (200) described below, and the decoding unit (1950) may have a configuration similar to that of the image decoding device (100).

[0238] In the encoding unit (1910), the prediction encoding unit (1915) outputs prediction data through inter prediction and intra prediction, and the transformation and quantization unit (1920) outputs quantized transformation coefficients of residual data between the prediction data and the current input image. The entropy encoding unit (1925) encodes and transforms the quantized transformation coefficients and outputs them as a bitstream. The quantized transformation coefficients are restored to spatial domain data through the inverse quantization and inverse transformation unit (1930), and the restored spatial domain data are output as a restored image through the deblocking filtering unit (1935) and the loop filtering unit (1940). The restored image can be used as a reference image of the next input image through the prediction encoding unit (1915).

[0239] The encoded image data among the bitstreams received by the decoding unit (1950) is restored to residual data in the spatial domain through the entropy decoding unit (1955) and the inverse quantization and inverse transformation unit (1960). The prediction data and residual data output from the prediction decoding unit (1975) are combined to form image data in the spatial domain, and the deblocking filtering unit (1965) and the loop filtering unit (1970) can perform filtering on the image data in the spatial domain to output a restored image for the current original image. The restored image can be used as a reference image for the next original image by the prediction decoding unit (1975).

[0240] The loop filtering unit (1940) of the encoding unit (1910) performs loop filtering using filter information input according to user input or system settings. The filter information used by the loop filtering unit (1940) is output to the entropy encoding unit (1925) and transmitted to the decoding unit (1950) together with the encoded image data. The loop filtering unit (1970) of the decoding unit (1950) can perform loop filtering based on the filter information input from the decoding unit (1950).

[0241] The various embodiments described above describe operations related to the image decoding method performed by the image decoding device (100). Hereinafter, the operations of the image encoding device (200), which performs the image encoding method corresponding to the reverse process of the image decoding method, will be described through various embodiments.

[0242] FIG. 2 illustrates a block diagram of an image encoding device (200) capable of encoding an image based on at least one of block shape information and segmentation shape mode information according to one embodiment.

[0243] The video encoding device (200) may include an encoding unit (220) and a bitstream generation unit (210). The encoding unit (220) may receive an input image and encode the input image. The encoding unit (220) may encode the input image to obtain at least one syntax element. The syntax element may include at least one of a skip flag, a prediction mode, a motion vector difference, a motion vector prediction method (or index), a transform quantized coefficient, a coded block pattern, a coded block flag, an intra prediction mode, a direct flag, a merge flag, a delta QP, a reference index, a prediction direction, and a transform index. The encoding unit (220) may determine a context model based on block shape information including at least one of a shape, a direction, a ratio of width and height, or a size of an encoding unit.

[0244] The bitstream generation unit (210) can generate a bitstream based on an encoded input image. For example, the bitstream generation unit (210) can generate a bitstream by entropy encoding syntax elements based on a context model. In addition, the image encoding device (200) can transmit the bitstream to the image decoding device (100).

[0245] According to one embodiment, the encoding unit (220) of the image encoding device (200) can determine the shape of an encoding unit. For example, the encoding unit may be square or have a non-square shape, and information indicating such shape may be included in the block shape information.

[0246] According to one embodiment, the encoding unit (220) can determine the shape into which the encoding unit is to be split. The encoding unit (220) can determine the shape of at least one encoding unit included in the encoding unit, and the bitstream generation unit (210) can generate a bitstream including split shape mode information including information about the shape of such encoding unit.

[0247] According to one embodiment, the encoder (220) may determine whether the encoding unit is split or not. If the encoder (220) determines that the encoding unit includes only one encoding unit or that the encoding unit is not split, the bitstream generation unit (210) may generate a bitstream including split shape mode information indicating that the encoding unit is not split. In addition, the encoder (220) may split the encoding unit into a plurality of encoding units, and the bitstream generation unit (210) may generate a bitstream including split shape mode information indicating that the encoding unit is split into a plurality of encoding units.

[0248] According to one embodiment, information indicating the number of encoding units to be split into or the direction in which the encoding unit is to be split may be included in the splitting mode information. For example, the splitting mode information may indicate splitting in at least one of the vertical and horizontal directions, or may indicate no splitting.

[0249] The video encoding device (200) determines information about the segmentation shape mode based on the segmentation shape mode of the encoding unit. The video encoding device (200) determines a context model based on at least one of the shape, direction, width, and height ratio or size of the encoding unit. Then, the video encoding device (200) generates information about the segmentation shape mode for segmenting the encoding unit based on the context model as a bitstream.

[0250] In order to determine a context model, the video encoding device (200) may obtain an array for matching at least one of the shape, direction, width and height ratio or size of the encoding unit with an index for the context model. The video encoding device (200) may obtain an index for the context model based on at least one of the shape, direction, width and height ratio or size of the encoding unit in the array. The video encoding device (200) may determine the context model based on the index for the context model.

[0251] The video encoding device (200) may further determine the context model based on block shape information including at least one of the shape, direction, width, and height ratio or size of a neighboring encoding unit adjacent to the encoding unit, in order to determine the context model. In addition, the neighboring encoding unit may include at least one of encoding units located on the lower left, left, upper left, upper right, right, or lower right of the encoding unit.

[0252] In addition, the video encoding device (200) may compare the length of the width of the upper peripheral encoding unit with the length of the width of the encoding unit to determine the context model. In addition, the video encoding device (200) may compare the length of the height of the left and right peripheral encoding units with the length of the height of the encoding unit. In addition, the video encoding device (200) may determine the context model based on the comparison results.

[0253] Since the operation of the video encoding device (200) includes similar contents to the operation of the video decoding device (100) described in FIGS. 3 to 19, a detailed description is omitted.

[0254] FIG. 20 is a block diagram showing the configuration of an image decoding device according to one embodiment of the present disclosure.

[0255] Referring to FIG. 20, the image decoding device (2000) may include a processor (2010) and a memory (2020).

[0256] In one embodiment of the present disclosure, the processor (2010) may include processing circuitry and / or multiple processors. For example, the processor (2010) may include various processing circuitry, including at least one processor, wherein one or more of the at least one processor may be configured to individually and / or collectively perform various functions described in the present disclosure in a distributed manner.

[0257] In one embodiment of the present disclosure, the memory (2020) may include one or more storage media storing at least one instruction. The processor (2010) may control the image decoding device (2000) by executing the instructions stored in the memory (2020). For example, the processor (2010) may control the image decoding device (2000) to perform operations by individually or collectively executing the instructions stored in the memory (2020). In one embodiment of the present disclosure, the operations performed by the image decoding device (2000) may be operations performed by the processor (2010) of the image decoding device (2000).

[0258] In one embodiment of the present disclosure, the image decoding device (2000) may correspond to the image decoding device (100) illustrated in FIG. 1 and / or the decoding unit (1950) illustrated in FIG. 19.

[0259] The image decoding device (2000) can obtain a bitstream generated as a result of encoding an image. The bitstream can include the encoding result for the current block. In one embodiment of the present disclosure, the image decoding device (2000) can receive the bitstream from the image encoding device via a network.

[0260] In one embodiment of the present disclosure, the image decoding device (2000) can obtain a bitstream from a data storage medium including at least one of a magnetic medium such as a hard disk, a floppy disk, and a magnetic tape, an optical recording medium such as a CD-ROM and a DVD, or a magneto-optical medium such as a floptical disk.

[0261] The video decoding device (2000) can obtain syntax elements for decoding the video from the bitstream. The values ​​corresponding to the syntax elements can be included in the bitstream according to the hierarchical structure of the video. In one embodiment of the present disclosure, the video decoding device (2000) can obtain the syntax elements by entropy decoding the bins included in the bitstream.

[0262] In one embodiment of the present disclosure, a bitstream may include information about a prediction mode of a current block within a current image. The current block may include at least one of a maximum coding unit, a coding unit, a transformation unit, or a prediction unit segmented from a current image to be decoded.

[0263] In one embodiment of the present disclosure, the prediction mode of the current block may include at least one of an intra mode, an inter mode, a combined mode, a geometric partitioning mode (GPM), a spatial geometric partitioning mode (SGPM), a block copy mode, a template matching prediction mode, a block-based delta pulse code modulation (BDPCM) mode, an extrapolation filter-based intra prediction (EIP) mode, an intra prediction fusion mode, or a matrix-based intra prediction (MIP) mode.

[0264] In one embodiment, the intra prediction mode may be selected from a plurality of intra prediction modes. The plurality of intra prediction modes may include a non-directional intra prediction mode and a directional intra prediction mode. Intra prediction modes according to one embodiment of the present disclosure are described with reference to FIGS. 21 to 23.

[0265] In one embodiment, the block copy mode may include an intra-block copy mode. In one embodiment, the block copy mode may include an intra-block copy mode. In one embodiment, the intra-block copy mode may be a sub-mode of the intra-mode, but is not limited thereto, and may represent a mode separate from the intra-mode.

[0266] In one embodiment, the template matching prediction mode may include a template matching intra prediction mode. The combined mode may include a combined inter-intra prediction (CIIP) mode, which performs prediction by combining predictions according to the intra mode and predictions according to the inter mode. The geometric segmentation mode may perform predictions using inter prediction or intra prediction for each segmented region.

[0267] The video decoding device (2000) can restore the current block by performing prediction according to the prediction mode for the current block according to the prediction mode of the current block.

[0268] In one embodiment, the image decoding device (2000) can obtain information regarding the prediction mode of the current block from the bitstream. For example, the image decoding device (2000) can obtain index information indicating the prediction mode of the current block from the bitstream.

[0269] In one embodiment of the present disclosure, when the prediction mode of the current block is the CIIP mode, the video decoding device (2000) can reconstruct the current block by combining inter prediction and intra prediction. For example, the video decoding device (2000) can perform intra prediction according to the planar mode. For example, the video decoding device (2000) can perform inter prediction using a motion vector. The video decoding device (2000) can reconstruct the current block using a weighted sum of a prediction block according to inter prediction and a prediction block according to intra prediction. The weight can be determined based on whether a block neighboring the current block has been intra predicted.

[0270] In one embodiment of the present disclosure, when the prediction mode of the current block is a geometric segmentation mode, the image decoding device (2000) can perform prediction by segmenting the current block. The image decoding device (2000) can obtain a segmentation angle and a segmentation distance for a boundary at which segmentation is performed within the current block. The image decoding device (2000) can segment the current block based on the segmentation angle and the segmentation distance. The image decoding device (2000) can reconstruct the current block by performing inter prediction or intra prediction on each of the segmented regions within the current block. The image decoding device (2000) can i) perform intra prediction on both segmented regions, ii) perform inter prediction on one region and intra prediction on the other region, or iii) perform inter prediction on both segmented regions.

[0271] In one embodiment of the present disclosure, when the prediction mode of the current block is block copy mode, the image decoding device (2000) can reconstruct the current block based on a reference block included in the current image. In one embodiment of the present disclosure, when the prediction mode of the current block is block copy mode, the image decoding device (2000) can determine information about a block vector representing the reference block. In one embodiment of the present disclosure, the image decoding device (2000) can determine a prediction block based on the reference block. For example, the image decoding device (2000) can determine a prediction block that is identical to the reference block or by performing filtering on the reference block.

[0272] In one embodiment of the present disclosure, when the prediction mode of the current block is the template matching prediction mode, the image decoding device (2000) can reconstruct the current block using a reference block. The image decoding device (2000) can obtain information related to whether the template matching prediction mode is used. The image decoding device (2000) can determine whether the template matching prediction mode is used based on the obtained information. The reference block can be determined based on at least one of an area included in the current image or an area included in a previously decoded image.

[0273] In one embodiment of the present disclosure, the image decoding device (2000) may determine a reference block using a cost function. The cost function may include at least one of SAD (sum of absolute difference), SSD (sum of squared difference), SATD (sum of absolute transformed difference), SSE (sum of squared error), or MR-SAD (mean removed SAD). A block with the smallest cost value calculated using the cost function may be determined as a reference block.

[0274] For example, the image decoding device (2000) can determine the error between templates using at least one cost function among SAD, SATD, SSE, and MR-SAD. When the cost function is SAD, the image decoding device (2000) can determine the error based on the sum of the absolute values ​​of the differences between each sample of the template of the current block and each sample of the template of the candidate block. When the cost function is SSD, the image decoding device (2000) can determine the error based on the sum of the squares of the differences between each sample of the template of the current block and each sample of the template of the candidate block. The cost function may include a function representing the number of identical samples.

[0275] The video decoding device (2000) can determine a block with a small error among candidate blocks as a reference block. The video decoding device (2000) can determine a predicted block by performing intra prediction using template matching on the current image. In the present disclosure, the process of determining a reference block for the current block using a template may be referred to as template matching. In the present disclosure, performing a prediction on the current block based on template matching may be referred to as template matching prediction or intra template matching prediction.

[0276] In one embodiment, the IntraTMP mode may indicate a method for predicting the current block by specifying a true block within a previously reconstructed search region based on template matching. The SGPM may indicate an intra mode similar to the GPM, which generates prediction samples for geometrically divided partitions through intra prediction. The EIP mode is an extrapolation filter-based prediction technique, which may indicate a method for predicting the interior of a block by filtering based on information outside the block. The intra-prediction fusion mode may indicate a prediction method for determining a final predictor by weighting various predictors generated from multiple reference sample lines. The MIP mode may indicate a method for performing prediction based on a pre-trained matrix. As an example, modes exemplified by the non-regular intra mode may be referenced in High Efficiency Video Coding (HEVC), Versatile Video Coding (VVC), and Enhanced Compression Model (ECM).

[0277] The video decoding device (2000) can generate a reconstructed current block using a prediction block. In one embodiment of the present disclosure, the video decoding device (2000) can determine the prediction block as the reconstructed current block. In one embodiment of the present disclosure, the video decoding device (2000) can generate a reconstructed current block by combining residual data obtained from a bitstream with the prediction block. The reconstructed current block can be used as a reference block for the next block.

[0278] In one embodiment, the image decoding device (2000) can obtain residual data from a bitstream. The residual data can include information regarding the difference between an original image (or an original sample) and a predicted image (or a predicted sample). In one embodiment, the image decoding device (2000) can obtain transform coefficients of a residual block corresponding to a transform unit from the bitstream.

[0279] In one embodiment, the image decoding device (2000) can obtain a residual sample of the residual block of the residual block based on the transform coefficient of the residual block. For example, the image decoding device (2000) can obtain a residual sample of the residual block by performing at least one of inverse quantization or inverse transformation on the transform coefficient of the residual block. In one embodiment, the image decoding device (2000) can determine a residual sample of an encoding unit using at least a part of a portion of the residual samples of the residual block.

[0280] The image decoding device (2000) may determine some of the residual samples of the residual block as residual samples of the encoding unit when the size of the residual block is larger than the size of the transformation unit. Alternatively, the image decoding device (2000) may determine some of the residual samples of the residual block on which filtering has been performed as residual samples of the encoding unit. The image decoding device (2000) may restore the samples of the encoding unit based on the residual samples of the encoding unit.

[0281] In a prediction mode (e.g., intra mode) that uses reference samples included in a current image, a prediction block of the current block can be generated based on the surrounding samples of the current block according to the prediction mode, under the assumption that there will be continuity between the surrounding samples of the current block and the samples within the current block. The image decoding apparatus (2000) according to an embodiment of the present disclosure can use not only the surrounding samples of the current block included in the current image but also the spatial reference samples included in the current image for intra prediction. When using samples reconstructed before the current block, the size of the residual data can be reduced by predicting the samples of the current block using not only the samples immediately adjacent to the current block but also samples far from the current block.

[0282] In a prediction mode (e.g., inter mode) that utilizes reference samples included in a reference image rather than the current image, a prediction block of the current block can be generated based on a reference block (or reference sample) of the reference image according to the prediction mode, under the assumption that there will be continuity between the current image and the reference image. An image decoding apparatus (2000) according to an embodiment of the present disclosure can improve compression efficiency by increasing the efficiency of intra prediction.

[0283] The image decoding device (2000) can improve prediction accuracy by considering both a reference block (or reference sample) included in the current image and a reference block (or reference sample) included in an image other than the current image. The image decoding device (2000) according to one embodiment of the present disclosure can improve prediction accuracy by considering both the current image and an image other than the current image.

[0284] The video decoding device (2000) can perform deblocking filtering. The deblocking filter can improve video quality by smoothing edges between blocks.

[0285] The video decoding device (2000) can perform filtering on samples of the current block on which deblocking filtering has been performed using a sample adaptive offset (SAO) filter and / or a bilateral filter (BIF). The SAO filter and BIF can improve image quality by reducing the error between the restored image and the original image. The SAO filter and BIF can perform filtering on a sample-by-sample basis.

[0286] The image decoding device (2000) can perform filtering using an adaptive loop filter (ALF). ALF can improve image quality by reducing the error between the restored image and the original image. ALF can perform filtering on a block-by-block basis.

[0287] FIG. 21 is a diagram showing types of intra prediction modes according to one embodiment of the present disclosure.

[0288] In one embodiment of the present disclosure, the image decoding device (2000) may determine an intra prediction mode of a current block (e.g., an encoding block) to perform intra prediction. The image decoding device (2000) may select an intra prediction mode of the current block from among a plurality of intra prediction modes.

[0289] Referring to FIG. 21, in one embodiment of the present disclosure, the plurality of intra prediction modes may include a non-directional planar mode of number 0 (or Intra_Planar mode), a non-directional DC mode of number 1 (or Intra_DC mode), and directional modes of number 2 to 66 (or intra directional modes) (e.g., (Intra_Angular2.. Intra_Angular66)).

[0290] In one embodiment of the present disclosure, the planar mode may refer to a mode in which a prediction sample is determined based on a weighted average value according to the distances of the left reference sample, the upper reference sample, the lower left sample of the current block, and the upper right sample. In one embodiment of the present disclosure, the DC mode may refer to a mode in which the average value of the reference samples is determined as the prediction sample.

[0291] In one embodiment of the present disclosure, the plurality of intra prediction modes may include wide-angle modes (or wide-angle directional modes, wide-angle intra directional modes). Referring to FIG. 21, the plurality of intra prediction modes may include wide-angle modes from -14 to -1 and from 67 to 80, indicated by dotted lines. The wide-angle modes may be used for intra prediction of a non-square current block.

[0292] For example, a wide-angle mode may be used to identify reference samples of a non-square current block. The image decoding device (2000) may determine an intra prediction mode based on the width and height of the current block. According to one embodiment of the present disclosure, a method for determining the wide-angle mode is described with reference to FIGS. 22 and 23.

[0293] In one embodiment of the present disclosure, in intra-directional modes, the locations of reference samples for generating prediction samples of samples within the current block can be identified by considering the direction indicated by the intra-directional modes. For example, in mode 34, reference samples located 45 degrees to the upper left of the samples within the current block can be identified.

[0294] In one embodiment of the present disclosure, the video decoding device (2000) can determine an intra prediction mode using a most probable mode (MPM). The prediction decoding unit (2020) can determine whether to use the MPM. The video decoding device (2000) can obtain information related to whether to use the MPM from the bitstream. When using the MPM, the video decoding device (2000) can determine an MPM list including multiple intra prediction modes.

[0295] The video decoding device (2000) can determine the MPM list using the surrounding blocks of the current block. For example, the video decoding device (2000) can determine the MPM list using the upper intra prediction mode of the current block (hereinafter, “upper intra prediction mode”) and the intra prediction mode of the left block (hereinafter, “left intra prediction mode”). If the surrounding blocks of the current block are not available (for example, if the intra prediction mode of the surrounding blocks is not determined), the intra prediction mode of the unavailable surrounding blocks can be set to a predetermined mode (for example, the planar mode).

[0296] In one embodiment of the present disclosure, when both the left intra prediction mode and the upper intra prediction mode are non-directional modes, the image decoding device (2000) may determine a predetermined list including non-directional intra prediction modes as an MPM list. For example, the MPM list may include non-directional planar modes and DC modes, and may additionally include directional modes (e.g., vertical intra prediction modes, horizontal intra prediction modes).

[0297] In one embodiment of the present disclosure, if one of the left intra prediction mode and the upper intra prediction mode is a directional mode and the other is a non-directional mode, the image decoding device (2000) may determine an MPM list based on an index value of the directional mode and an index value of the non-directional mode. For example, the MPM list may include a non-directional planar mode and a peripheral intra prediction mode of an intra prediction mode having a larger index value among the directional mode and the non-directional mode.

[0298] In one embodiment of the present disclosure, when the left intra prediction mode and the upper intra prediction mode are the same directional mode, the image decoding device (2000) may determine an MPM list based on the directional mode. For example, the MPM list may include a non-directional planar mode and a directional mode surrounding intra prediction mode.

[0299] In one embodiment of the present disclosure, when the left intra prediction mode and the upper intra prediction mode are different directional modes, the image decoding device (2000) may determine an MPM list based on the left intra prediction mode and the upper intra prediction mode. For example, the MPM list may include a non-directional planar mode, a left intra prediction mode, an upper intra prediction mode, a peripheral mode of the left intra prediction mode, and a peripheral mode of the upper intra prediction mode. As an example, the image decoding device (2000) may determine the MPM list based on a difference between an index value of the left intra prediction mode and an index value of the upper intra prediction mode.

[0300] The video decoding device (2000) can determine one of the MPM lists as the intra prediction mode of the current block. The video decoding device (2000) can obtain information (e.g., an index) indicating the intra prediction mode of the current block from the MPM list from the bitstream.

[0301] FIG. 22 is a diagram showing types of intra prediction modes for a non-square block according to one embodiment of the present disclosure.

[0302] Referring to Figure 22, the directionality mode of a block can be defined in the range of 45 degrees to -135 degrees clockwise, such as intra prediction modes 2 to 66. For intra prediction of a block, the left reference sample can be used twice the height of the block, and the upper reference sample can be used twice the width of the block. However, in the case of non-square blocks, the height and width of the block are not equal, so a wide-angle mode may be required.

[0303] According to one embodiment of the present disclosure, the reference samples in the range of 45 degrees to -135 degrees with respect to the lower right sample (2210) of the block may include the lower left reference sample (2220) and may not include the upper right reference sample (2230). Here, the lower left reference sample (2220) may mean, among the left samples adjacent to the block, a vertical distance from the upper left sample of the block is greater than twice the height of the block (e.g., 2H) and is located within a range of 45 degrees from the lower right sample (2210) of the block. The upper right reference sample (2230) may mean, among the upper samples adjacent to the block, a vertical distance from the upper left sample of the block is less than twice the width of the block (e.g., 2W) and is located outside a range of -135 degrees from the lower right sample (2210) of the block. In this example, intra prediction modes between 2 and 66 cannot refer to the upper right reference sample (2230).

[0304] The video decoding device (2000) may replace some of the intra prediction modes indicating the lower left reference sample (2220) with wide-angle modes indicating the upper right reference sample (2230). For example, the video decoding device (2000) may replace the index value “predModeIntra” of the intra prediction mode that is 2 or more and less than a predetermined value with “predModeIntra + 65”.

[0305] The image decoding device (2000) can replace some directional modes with wide-angle modes based on the height and width of a block. The image decoding device (2000) can determine the wide-angle mode using a predetermined method according to the ratio of the height and width of a block (e.g., 16, 8, 4, 2, 1 / 2, 1 / 4, 1 / 8, or 1 / 16).

[0306] FIG. 23 is a diagram showing types of intra prediction modes for a non-square block according to one embodiment of the present disclosure.

[0307] Referring to FIG. 23, a block according to one embodiment of the present disclosure may have a height greater than a width.

[0308] According to one embodiment of the present disclosure, a reference sample in a range of 45 degrees to -135 degrees based on a lower right sample (2210) of a block includes an upper right reference sample (2320) and does not include a lower left reference sample (2330). Here, the upper right reference sample (2320) may mean, among upper samples adjacent to a block, a sample whose vertical distance from the upper left sample of the block is greater than twice the width of the block (e.g., 2W) and is located within a range of -135 degrees from the lower right sample (2310) of the block. The lower left reference sample (2330) may mean, among left samples adjacent to a block, a sample whose vertical distance from the upper left sample of the block is less than twice the height of the block (e.g., 2H) and is located outside a range of 45 degrees from the lower right sample (2310) of the block. As with Figure 22, in this example, intra prediction modes between 2 and 66 cannot refer to the lower left reference sample (2330).

[0309] Accordingly, the image decoding device (2000) can replace some of the intra prediction modes indicating the upper right reference sample (2320) with a wide-angle mode indicating the lower left reference sample (2330). For example, the image decoding device (2000) can replace the index value “predModeIntra” of the intra prediction mode that is greater than or equal to a predetermined value and less than or equal to 66 with “predModeIntra - 67”.

[0310] The image decoding device (2000) can replace some directional modes with wide-angle modes based on the height and width of a block. The image decoding device (2000) can determine the wide-angle mode using a predetermined method according to the ratio of the height and width of a block (e.g., 16, 8, 4, 2, 1 / 2, 1 / 4, 1 / 8, or 1 / 16).

[0311] Below, a method for deriving an intra prediction mode on the image decoding device (2000) side based on a surrounding restored area (or a previously decoded / restored area) will be described.

[0312] A method for deriving an intra prediction mode according to an embodiment of the present disclosure may include at least one of a method for deriving an intra prediction mode based on a difference between a predetermined set of samples within a reconstructed area around a current block (described with reference to FIGS. 24 to 29 below), a method for deriving an intra prediction mode based on a difference between a predicted value and a reconstructed value for a template of a current block (described with reference to FIG. 30 below), or a method for deriving an intra prediction mode based on a gradient of a sample value within a reconstructed area around a current block (described with reference to FIGS. 31 and 32 below).

[0313] First, a method for deriving an intra prediction mode based on differences between predetermined sample sets within a surrounding restored region will be described with reference to FIGS. 24 to 29. In the present disclosure, a method for deriving an intra prediction mode based on differences between predetermined sample sets within a surrounding restored region may be referred to as Cross Line Prediction (CLP), and an intra prediction mode derived based on CLP may be referred to as a CLP mode. However, the contents of the present disclosure are not limited to these names.

[0314] FIG. 24 is a diagram illustrating sample sets required for deriving a cross line prediction mode according to one embodiment.

[0315] The video decoding device (2000) can identify sample sets restored before the current block (2490) to determine the CLP mode of the current block (2490).

[0316] Referring to FIG. 24, the sample sets may include at least one of a first sample set (2420) located below the upper left sample (2410) restored before the current block (2490) in the current image (2400), a second sample set (2440) located to the right of the upper left sample (2410), a third sample set (2460) located above the upper left sample (2410), or a fourth sample set (2480) located to the left of the upper left sample (2410).

[0317] In one embodiment, samples included in a first sample set (2420) may be referred to as first samples, samples included in a second sample set (2440) may be referred to as second samples, and samples included in a third sample set (2460) may be referred to as third samples. Additionally, samples included in a fourth sample set (2480) may be referred to as fourth samples.

[0318] When the coordinates of the upper left sample inside the current block (2490) are (x, y), the coordinates of the upper left sample (2410) restored before the current block (2490) may be (x-1, y-1).

[0319] In one embodiment, when the coordinates of the upper left sample (2410) are (x-1, y-1), the coordinates of the samples included in the first sample set (2420) may be (x-1, y) to (x-1, y+a) (a+1 is the number of samples included in the first sample set (2420)). In addition, the coordinates of the samples included in the second sample set (2440) may be (x, y-1) to (x+b, y-1) (b+1 is the number of samples included in the second sample set (2440)). In addition, the coordinates of the samples included in the third sample set (2460) may be (x-1, yc) to (x-1, y-2) (c-1 is the number of samples included in the third sample set (2460)). Additionally, the coordinates of the samples included in the fourth sample set (2480) may be (xd, y-1) to (x-2, y-1) (d-1 is the number of samples included in the fourth sample set (2480)).

[0320] In one embodiment, the image decoding device (2000) can derive the intra prediction mode of the current block (2490) using two or more sample sets among the four sample sets illustrated in FIG. 24.

[0321] The number of samples included in the first sample set (2420), the second sample set (2440), the third sample set (2460), and the fourth sample set (2480) can be determined in various ways.

[0322] In one embodiment, the number of samples included in the first sample set (2420) may be greater than or equal to the number of samples in the vertical direction of the current block (2490) (or the height of the current block (2490)). For example, the number of samples included in the first sample set (2420) may be twice the number of samples in the vertical direction of the current block (2490).

[0323] In one embodiment, the number of samples included in the second sample set (2440) may be greater than or equal to the number of samples in the horizontal direction of the current block (2490) (or the width of the current block (2490)). For example, the number of samples included in the second sample set (2440) may be twice the number of samples in the horizontal direction of the current block (2490).

[0324] In one embodiment, the number of samples included in the third sample set (2460) may be less than the number of samples included in the first sample set (2420), and the number of samples included in the fourth sample set (2480) may be less than the number of samples included in the second sample set (2440).

[0325] The reason why the number of samples included in the third sample set (2460) and the fourth sample set (2480) is set to be smaller than that of the first sample set (2420) and the second sample set (2440) is to ensure stable memory management. If the number of samples included in the third sample set (2460) and the fourth sample set (2480) increases, samples that have already been restored must be stored in the memory for a long time, and the load due to memory access increases. Therefore, a relatively small number of samples are stored in the third sample set (2460) and the fourth sample set (2480).

[0326] The video decoding device (2000) may perform intra prediction using one sample set as a reference sample set according to each of the plurality of directional modes to test multiple directional modes, thereby generating a predicted sample set corresponding to another sample set. This may be understood as intra-predicting one sample set from another sample set according to each of the plurality of directional modes.

[0327] The video decoding device (2000) can determine which sample set should be used as a reference sample set and which sample set's prediction sample set should be generated by considering the prediction directions indicated by the plurality of directional modes.

[0328] The video decoding device (2000) can determine which directional mode is appropriate for the current block (2490) by considering the prediction sample sets generated according to each of the plurality of directional modes. Cost values ​​corresponding to the prediction sample sets can be calculated to select the directional mode appropriate for the current block (2490).

[0329] The cost value can represent the accuracy of intra prediction. Higher intra prediction accuracy leads to lower cost values, while lower intra prediction accuracy leads to higher cost values.

[0330] In one embodiment, the image decoding device (2000) can identify directional modes applicable to the current block (2490) before testing multiple directional modes, and determine the CLP mode of the current block (2490) from among the identified directional modes.

[0331] The image decoding device (2000) can identify directional modes applicable to the current block (2490) based on the size of the current block (2490). For example, if the size of the current block (2490) is a size to which wide-angle intra prediction can be applied (e.g., 8x4), the image decoding device (2000) can identify that directional modes 8 to 72 are applicable to the current block (2490). In this case, the image decoding device (2000) can determine the intra prediction mode of the current block (2490) by testing directional modes 8 to 72. Additionally, for example, if the size of the current block (2490) is such that wide-angle intra prediction cannot be applied, the image decoding device (2000) can identify that directional modes 2 to 66 are applicable to the current block (2490). In this case, the image decoding device (2000) can determine the CLP mode of the current block (2490) by testing directional modes 2 to 66.

[0332] In one embodiment, the image decoding device (2000) can identify directional modes applicable to the current block (2490) based on the directional mode of a previous block that was reconstructed before the current block (2490). Since blocks within the current image may have similar directional modes, a directional mode suitable for the current block (2490) can be quickly determined by referring to the directional mode of the previous block.

[0333] A previous block restored before the current block (2490) may include at least one of a block located to the left of the current block (2490), a block located above the current block (2490), or a block located to the upper left of the current block (2490).

[0334] The video decoding device (2000) can identify directional modes that can be applied to the current block (2490) based on the directional mode of the previous block, if the previous block restored before the current block (2490) was restored through intra prediction.

[0335] The video decoding device (2000) may determine that directional modes adjacent to the directional mode of the previous block can be applied to the current block (2490). The directional modes adjacent to the directional mode of the previous block may mean directional modes having mode numbers that are identical / similar to the mode numbers of the directional mode of the previous block.

[0336] For example, the image decoding device (2000) may determine that the directional mode k (a is an integer) or the directional mode k+a (a is an integer) can be applied to the current block (2490) when the intra prediction mode of the previous block is the directional mode k (k is an integer).

[0337] Once the directional modes applicable to the current block (2490) are identified, the image decoding device (2000) can test which of the identified directional modes is suitable for the current block (2490).

[0338] In one embodiment, the image decoding device (2000) can group a plurality of directional modes (e.g., a plurality of directional modes determined to be applicable to the current block (2490)) according to a prediction direction for testing the plurality of directional modes.

[0339] For example, the image decoding device (2000) can classify directional modes in which the prediction direction points to the lower left into a first group, directional modes in which the prediction direction points to the upper left into a second group, and directional modes in which the prediction direction points to the upper right into a third group.

[0340] Referring to FIG. 23, the directional modes -14 to 17 pointing to the lower left can be classified into the first group, the directional modes 19 to 49 pointing to the upper left can be classified into the second group, and the directional modes 51 to 80 pointing to the upper right can be classified into the third group.

[0341] There may be 18 horizontal modes between the directional modes of the first group and the directional modes of the second group, and 50 vertical modes between the directional modes of the second group and the directional modes of the third group. The horizontal modes may be referred to as the directional modes of the fourth group, and the vertical modes may be referred to as the directional modes of the fifth group.

[0342] The reason multiple directional modes are grouped into multiple groups is because the sample set used as the reference sample set and the sample set used as the target of prediction may differ depending on the prediction direction. For directional modes belonging to the same group, the same sample set may be used as the reference sample set and the same sample set used as the target of prediction.

[0343] The fact that directional modes are grouped according to prediction direction is for convenience of explanation, and the grouping operation may or may not be performed by the image decoding device (2000). In other words, in one embodiment, the image decoding device (2000) can determine which group a specific directional mode belongs to, determine which sample sets are required for the directional mode belonging to the group, and test the specific directional mode using the determined sample sets. Alternatively, the image decoding device (2000) can test the specific directional mode using predetermined sample sets without a separate grouping operation.

[0344] Referring to FIGS. 25a to 29, a method for calculating cost values ​​for each of a plurality of directional modes to determine the CLP mode of the current block (2490) is described.

[0345] FIGS. 25A and 25B are diagrams illustrating a method for calculating a cost value corresponding to a directional mode of a first group according to one embodiment.

[0346] As illustrated in FIG. 25A, a first sample set (2420) and a second sample set (2440) may be used for the first group of directional modes pointing in the lower left direction (d1). The first sample set (2420) may be positioned below the upper left sample (2410) restored before the current block (2490), and the second sample set (2440) may be positioned to the right of the upper left sample (2410) restored before the current block (2490).

[0347] The video decoding device (2000) can generate a prediction sample set corresponding to the second sample set (2440) by using the first sample set (2420) indicated by the prediction direction (d1) of the directional mode of the first group as a reference sample set.

[0348] The number of samples included in the prediction sample set may be the same as the number of samples included in the second sample set (2440).

[0349] To generate a prediction sample of one sample in the second sample set (2440), one or more samples in the first sample set (2420) located along the prediction direction (d1) relative to the corresponding sample may be used.

[0350] In one embodiment, an n-tap filter may be applied to a plurality of samples in the first sample set (2420) to consider fractional positions in generating a prediction sample of any one sample in the second sample set (2440). Here, n may be an integer greater than or equal to 1. In one embodiment, n may be adaptively determined based on at least one of the area, aspect ratio, width, and height of the current block (2490), the edge strength of the first sample set (2420), or the edge strength of the second sample set (2440). A method for calculating the edge strength will be described later.

[0351] In one embodiment, the image decoding device (2000) can interpolate integer samples included in the second sample set (2440) to generate sub-samples, and generate prediction samples corresponding to the integer samples and sub-samples based on the first sample set (2420).

[0352] The video decoding device (2000) can compare the predicted sample set with the second sample set (2440) to calculate a cost value corresponding to the directional mode of the first group. The cost value corresponding to the directional mode of the first group can be based on difference values ​​between sample values ​​in the predicted sample set and sample values ​​in the second sample set (2440).

[0353] In one embodiment, the more similar the predicted sample set is to the second sample set (2440), the smaller the cost value can be calculated.

[0354] In one embodiment, the cost value corresponding to the comparison result of the predicted sample set and the second sample set (2440) may include a sum of absolute difference (SAD), a sum of squared error (SSE), a mean removed SAD (MR-SAD), or a mean of absolute difference (MAD) between sample values ​​in the predicted sample set and sample values ​​in the second sample set (2440).

[0355] Next, as illustrated in FIG. 25b, a third sample set (2460) and a fourth sample set (2480) may be used to test the directional mode of the first group. The third sample set (2460) may be positioned above the upper left sample (2410) restored before the current block (2490), and the fourth sample set (2480) may be positioned to the left of the upper left sample (2410) restored before the current block (2490).

[0356] The video decoding device (2000) can generate a prediction sample set corresponding to the third sample set (2460) by using the fourth sample set (2480) indicated by the prediction direction (d1) of the directional mode of the first group as a reference sample set. The number of samples included in the prediction sample set may be the same as the number of samples included in the third sample set (2460).

[0357] To generate a prediction sample of one sample in the third sample set (2460), one or more samples in the fourth sample set (2480) located in the prediction direction (d1) relative to that sample may be used.

[0358] In one embodiment, an n-tap filter may be applied to a plurality of samples in a fourth sample set (2480) to consider fractional positions in generating a prediction sample of any one sample in a third sample set (2460), wherein n may be an integer greater than or equal to 1. In one embodiment, n may be adaptively determined based on at least one of the area, aspect ratio, width, height of the current block (2490), the edge strength of the third sample set (2460), or the edge strength of the fourth sample set (2480).

[0359] In one embodiment, the image decoding device (2000) can interpolate integer samples included in the third sample set (2460) to generate sub-samples, and generate prediction samples corresponding to the integer samples and sub-samples based on the fourth sample set (2480).

[0360] The cost value corresponding to the comparison result of the predicted sample set and the third sample set (2460) may include SAD, SSE, MR-SAD or MAD between the sample values ​​in the predicted sample set and the sample values ​​in the third sample set (2460).

[0361] In one embodiment, the cost values ​​calculated based on the first sample set (2420) and the second sample set (2440) illustrated in FIG. 25a may be referred to as the first preliminary cost values, and the cost values ​​calculated based on the third sample set (2460) and the fourth sample set (2480) illustrated in FIG. 25b may be referred to as the second preliminary cost values.

[0362] The video decoding device (2000) can determine the cost value of the directional mode of the first group using at least one of the first preliminary cost value of the directional mode of the first group or the second preliminary cost value of the directional mode of the first group. The cost value of the directional mode of the first group can be used for comparison with the cost values ​​of other directional modes.

[0363] In one embodiment, the first preliminary cost value may be determined as the cost value of the directional mode of the first group. Furthermore, in one embodiment, the second preliminary cost value may be determined as the cost value of the directional mode of the first group. Furthermore, in one embodiment, the smaller value of the first preliminary cost value and the second preliminary cost value may be determined as the cost value of the directional mode of the first group. Furthermore, in one embodiment, the average of the first preliminary cost value and the second preliminary cost value may be determined as the cost value of the directional mode of the first group.

[0364] When there are multiple directional modes classified into a first group, the image decoding device (2000) can calculate cost values ​​for each of the multiple directional modes.

[0365] FIGS. 26A and 26B are diagrams for explaining a method for calculating a cost value corresponding to a directional mode of a second group according to one embodiment.

[0366] As illustrated in FIG. 26a, a first sample set (2420) and a fourth sample set (2480) can be used for testing the directional mode of the second group pointing in the upper left direction (d2).

[0367] The video decoding device (2000) can generate a prediction sample set corresponding to the first sample set (2420) by using the fourth sample set (2480) indicated by the prediction direction (d2) of the directional mode of the second group as a reference sample set.

[0368] The number of prediction samples included in the prediction sample set may be the same as the number of samples included in the first sample set (2420).

[0369] To generate a prediction sample of one sample in the first sample set (2420), one or more samples in the fourth sample set (2480) located in the prediction direction (d2) relative to that sample may be used.

[0370] In one embodiment, an n-tap filter may be applied to a plurality of samples in a fourth sample set (2480) to generate a prediction sample of one sample in a first sample set (2420), wherein n may be an integer greater than or equal to 1. In one embodiment, n may be adaptively determined based on at least one of the width, aspect ratio, width, height of the current block (2490), the edge strength of the first sample set (2420), or the edge strength of the fourth sample set (2480).

[0371] In one embodiment, the image decoding device (2000) can interpolate integer samples included in the first sample set (2420) to generate sub-samples, and generate prediction samples corresponding to the integer samples and sub-samples based on the fourth sample set (2480).

[0372] The cost value corresponding to the comparison result of the predicted sample set and the first sample set (2420) may include SAD, SSE, MR-SAD or MAD between the sample values ​​in the predicted sample set and the sample values ​​in the first sample set (2420).

[0373] Next, as illustrated in FIG. 26b, a second sample set (2440) and a third sample set (2460) may be used for testing the directional mode of the second group.

[0374] The video decoding device (2000) can generate a prediction sample set corresponding to the second sample set (2440) by using the third sample set (2460) indicated by the prediction direction (d2) of the directional mode of the second group as a reference sample set. The number of prediction samples included in the prediction sample set may be the same as the number of samples included in the second sample set (2440).

[0375] To generate a prediction sample of one sample in the second sample set (2440), one or more samples in the third sample set (2460) located in the prediction direction (d2) relative to that sample may be used.

[0376] In one embodiment, an n-tap filter may be applied to a plurality of samples in a third sample set (2460) to generate a prediction sample of one sample in a second sample set (2440), wherein n may be an integer greater than or equal to 1. In one embodiment, n may be adaptively determined based on at least one of the width, aspect ratio, width, height of the current block (2490), the edge strength of the second sample set (2440), or the edge strength of the third sample set (2460).

[0377] In one embodiment, the image decoding device (2000) can interpolate integer samples included in the second sample set (2440) to generate sub-samples, and generate prediction samples corresponding to the integer samples and sub-samples based on the third sample set (2460).

[0378] The cost value corresponding to the comparison result of the predicted sample set and the second sample set (2440) may include SAD, SSE, MR-SAD or MAD between the sample values ​​in the predicted sample set and the sample values ​​in the second sample set (2440).

[0379] The cost values ​​calculated based on the first sample set (2420) and the fourth sample set (2480) illustrated in FIG. 26a may be referred to as the first preliminary cost values, and the cost values ​​calculated based on the second sample set (2440) and the third sample set (2460) illustrated in FIG. 26b may be referred to as the second preliminary cost values.

[0380] The video decoding device (2000) can determine the cost value of the directional mode of the second group using at least one of the first preliminary cost value of the directional mode of the second group calculated based on the first sample set (2420) and the fourth sample set (2480), or the second preliminary cost value of the directional mode of the second group calculated based on the second sample set (2440) and the third sample set (2460). The cost value of the directional mode of the second group can be used for comparison with the cost values ​​of other directional modes.

[0381] In one embodiment, the first preliminary cost value of the directional mode of the second group may be determined as the cost value of the directional mode of the second group. Furthermore, in one embodiment, the second preliminary cost value of the directional mode of the second group may be determined as the cost value of the directional mode of the second group. Furthermore, in one embodiment, the smaller value between the first preliminary cost value of the directional mode of the second group and the second preliminary cost value of the directional mode of the second group may be determined as the cost value of the directional mode of the second group.

[0382] Additionally, in one embodiment, an average of the first preliminary cost value of the directional mode of the second group and the second preliminary cost value of the directional mode of the second group may be determined as the cost value of the directional mode of the second group.

[0383] When there are multiple directional modes classified into a second group, the image decoding device (2000) can calculate cost values ​​for each of the multiple directional modes.

[0384] FIGS. 27a and 27b are diagrams for explaining a method for calculating a cost value corresponding to a directional mode of a third group according to one embodiment.

[0385] As illustrated in FIG. 27a, a first sample set (2420) and a second sample set (2440) can be used for the directional mode of the third group pointing in the upper right direction.

[0386] The video decoding device (2000) can generate a prediction sample set corresponding to the first sample set (2420) by using the second sample set (2440) indicated by the prediction direction (d3) of the directional mode of the third group as a reference sample set. The number of prediction samples included in the prediction sample set may be the same as the number of samples included in the first sample set (2420).

[0387] To generate a prediction sample of one sample in the first sample set (2420), one or more samples in the second sample set (2440) located in the prediction direction (d3) relative to that sample may be used.

[0388] In one embodiment, an n-tap filter may be applied to a plurality of samples in a second sample set (2440) to generate a prediction sample of one sample in a first sample set (2420), wherein n may be an integer greater than or equal to 1. In one embodiment, n may be adaptively determined based on at least one of the width, aspect ratio, width, height of the current block (2490), the edge strength of the first sample set (2420), or the edge strength of the second sample set (2440).

[0389] In one embodiment, the image decoding device (2000) can interpolate integer samples included in the first sample set (2420) to generate sub-samples, and generate prediction samples corresponding to the integer samples and sub-samples based on the second sample set (2440).

[0390] The cost value corresponding to the comparison result of the predicted sample set and the first sample set (2420) may include SAD, SSE, MR-SAD or MAD between the sample values ​​in the predicted sample set and the sample values ​​in the first sample set (2420).

[0391] Next, as illustrated in FIG. 27b, a third sample set (2460) and a fourth sample set (2480) can be used for testing the directional mode of the third group.

[0392] The video decoding device (2000) can generate a prediction sample set corresponding to the fourth sample set (2480) by using the third sample set (2460) indicated by the prediction direction (d3) of the directional mode of the third group as a reference sample set.

[0393] The number of prediction samples included in the prediction sample set may be the same as the number of samples included in the fourth sample set (2480).

[0394] To generate a prediction sample of one sample in the fourth sample set (2480), one or more samples in the third sample set (2460) located in the prediction direction (d3) relative to that sample may be used.

[0395] In one embodiment, an n-tap filter may be applied to a plurality of samples in a third sample set (2460) to generate a prediction sample of any one sample in a fourth sample set (2480), wherein n may be an integer greater than or equal to 1. In one embodiment, n may be adaptively determined based on at least one of the width, aspect ratio, width, height of the current block (2490), the edge strength of the third sample set (2460), or the edge strength of the fourth sample set (2480).

[0396] In one embodiment, the image decoding device (2000) can interpolate integer samples included in the fourth sample set (2480) to generate sub-samples, and generate prediction samples corresponding to the integer samples and sub-samples based on the third sample set (2460).

[0397] The cost value corresponding to the comparison result of the predicted sample set and the fourth sample set (2480) may include SAD, SSE, MR-SAD or MAD between the sample values ​​in the predicted sample set and the sample values ​​in the fourth sample set (2480).

[0398] The cost values ​​calculated based on the first sample set (2420) and the second sample set (2440) illustrated in FIG. 27a may be referred to as the first preliminary cost values, and the cost values ​​calculated based on the third sample set (2460) and the fourth sample set (2480) illustrated in FIG. 27b may be referred to as the second preliminary cost values.

[0399] The video decoding device (2000) can determine the cost value of the directional mode of the third group using at least one of the first preliminary cost value of the directional mode of the third group or the second preliminary cost value of the directional mode of the third group. The cost value of the directional mode of the third group can be used for comparison with the cost values ​​of other directional modes.

[0400] In one embodiment, the first preliminary cost value of the directional mode of the third group may be determined as the cost value of the directional mode of the third group. Furthermore, in one embodiment, the second preliminary cost value of the directional mode of the third group may be determined as the cost value of the directional mode of the third group. Furthermore, in one embodiment, the smaller value between the first preliminary cost value of the directional mode of the third group and the second preliminary cost value of the directional mode of the third group may be determined as the cost value of the directional mode of the third group.

[0401] Additionally, in one embodiment, an average of the first preliminary cost value of the directional mode of the third group and the second preliminary cost value of the directional mode of the third group may be determined as the cost value of the directional mode of the third group.

[0402] When there are multiple directional modes classified into a third group, the image decoding device (2000) can calculate cost values ​​for each of the multiple directional modes.

[0403] FIG. 28 is a diagram for explaining a method for calculating a cost value corresponding to a horizontal mode according to one embodiment.

[0404] For calculating the cost value corresponding to the horizontal mode, the upper left sample (2410) and the second sample set (2440) restored before the current block (2490) can be used.

[0405] The image decoding device (2000) can generate a prediction sample set corresponding to the second sample set (2440) by using the upper left sample (2410) indicated by the prediction direction (d4) of the horizontal mode as a reference sample. In one embodiment, the sample values ​​of the prediction samples can be determined to be identical to the sample values ​​of the upper left sample (2410).

[0406] The number of prediction samples included in the prediction sample set may be the same as the number of samples included in the second sample set (2440). The cost value corresponding to the comparison result between the prediction sample set and the second sample set (2440) may include SAD, SSE, MR-SAD, or MAD between the sample values ​​in the prediction sample set and the sample values ​​in the second sample set (2440).

[0407] In one embodiment, for calculating the cost value corresponding to the horizontal mode, the upper left sample (2410) and the fourth sample set (2480) restored before the current block (2490) may be used.

[0408] The video decoding device (2000) can generate a prediction sample corresponding to the upper left sample (2410) by using the fourth sample set (2480) indicated by the prediction direction (d4) of the horizontal mode as a reference sample set. In one embodiment, the sample value of the prediction sample can be determined by applying the sample values ​​of the samples included in the fourth sample set (2480) to a predetermined formula.

[0409] The cost value corresponding to the comparison result of the predicted sample and the upper left sample (2410) may include SAD, SSE, MR-SAD or MAD between the sample value of the predicted sample and the sample value of the upper left sample (2410).

[0410] For horizontal mode, the cost value calculated based on the second sample set (2440) and the upper left sample (2410) can be referred to as the first preliminary cost value, and the cost value calculated based on the upper left sample (2410) and the fourth sample set (2480) can be referred to as the second preliminary cost value.

[0411] The image decoding device (2000) can determine the cost value of the horizontal mode using at least one of the first preliminary cost value of the horizontal mode or the second preliminary cost value of the horizontal mode. The cost value of the horizontal mode can be used for comparison with the cost values ​​of other directional modes.

[0412] In one embodiment, the first preliminary cost value of the horizontal mode may be determined as the cost value of the horizontal mode. Furthermore, in one embodiment, the second preliminary cost value of the horizontal mode may be determined as the cost value of the horizontal mode. Furthermore, in one embodiment, a smaller value between the first preliminary cost value of the horizontal mode and the second preliminary cost value of the horizontal mode may be determined as the cost value of the horizontal mode. Furthermore, in one embodiment, an average of the first preliminary cost value of the horizontal mode and the second preliminary cost value of the horizontal mode may be determined as the cost value of the horizontal mode.

[0413] FIG. 29 is a diagram for explaining a method for calculating a cost value corresponding to a vertical mode according to one embodiment.

[0414] For calculating the cost value corresponding to the vertical mode, the upper left sample (2410) and the first sample set (2420) restored before the current block (2490) can be used.

[0415] The image decoding device (2000) can generate a prediction sample set corresponding to the first sample set (2420) by using the upper left sample (2410) indicated by the prediction direction (d5) of the vertical mode as a reference sample. In one embodiment, the sample values ​​of the prediction samples can be determined to be identical to the sample values ​​of the upper left sample (2410).

[0416] The number of prediction samples included in the prediction sample set may be the same as the number of samples included in the first sample set (2420).

[0417] The cost value corresponding to the comparison result of the predicted sample set and the first sample set (2420) may include SAD, SSE, MR-SAD or MAD between the sample values ​​in the predicted sample set and the sample values ​​in the first sample set (2420).

[0418] In one embodiment, for calculating the cost value corresponding to the vertical mode, the upper left sample (2410) and the third sample set (2460) restored before the current block (2490) may be used.

[0419] The video decoding device (2000) can generate a prediction sample corresponding to the upper left sample (2410) by using the third sample set (2460) indicated by the prediction direction (d5) of the vertical mode as a reference sample set. In one embodiment, the sample value of the prediction sample can be determined by applying the sample values ​​of the samples included in the third sample set (2460) to a predetermined formula.

[0420] The cost value corresponding to the comparison result of the predicted sample and the upper left sample (2410) may include SAD, SSE, MR-SAD or MAD between the sample value of the predicted sample and the sample value of the upper left sample (2410).

[0421] For vertical mode, the cost value calculated based on the first sample set (2420) and the upper left sample (2410) can be referred to as the first preliminary cost value, and the cost value calculated based on the upper left sample (2410) and the third sample set (2460) can be referred to as the second preliminary cost value.

[0422] The video decoding device (2000) can determine the cost value of the vertical mode using at least one of the first preliminary cost value of the vertical mode or the second preliminary cost value of the vertical mode. The cost value of the vertical mode can be used for comparison with the cost values ​​of other directional modes.

[0423] In one embodiment, a first preliminary cost value of the vertical mode may be determined as the cost value of the vertical mode. Furthermore, in one embodiment, a second preliminary cost value of the vertical mode may be determined as the cost value of the vertical mode. Furthermore, in one embodiment, a smaller value between the first preliminary cost value of the vertical mode and the second preliminary cost value of the vertical mode may be determined as the cost value of the vertical mode. Furthermore, in one embodiment, an average of the first preliminary cost value of the vertical mode and the second preliminary cost value of the vertical mode may be determined as the cost value of the vertical mode.

[0424] In one embodiment, when cost values ​​of directional modes of a first group, cost values ​​of directional modes of a second group, cost values ​​of directional modes of a third group, cost values ​​of a horizontal mode, and cost values ​​of a vertical mode are calculated, the image decoding device (2000) can determine a directional mode having a smallest cost value among the calculated cost values ​​as the intra prediction mode of the current block (2490).

[0425] In one embodiment, when a test is performed on directional modes applicable to the current block (2490), cost values ​​of directional modes that are not applicable to the current block (2490) may not be calculated. For example, for a square-shaped current block (2490), cost values ​​corresponding to directional modes -14 to -1 and directional modes 67 to 80 illustrated in FIG. 23 may not be calculated.

[0426] In one embodiment, since the numbers of samples included in each of the first sample set (2420), the second sample set (2440), the third sample set (2460), and the fourth sample set (2480) may be different from each other, the numbers of samples included in their prediction sample sets may also be different from each other. Therefore, in one embodiment, in order to compare the cost values ​​of directional modes belonging to different groups, MADs may be calculated as cost values. For example, MADs of directional modes of the first group, MADs of directional modes of the second group, MADs of directional modes of the third group, MAD of the horizontal mode, and MAD of the vertical mode may be calculated, and the image decoding apparatus (2000) may determine the directional mode with the smallest MAD as the intra prediction mode of the current block (2490).

[0427] MAD can correspond to the average of the absolute values ​​of the differences between the sample values ​​in the sample set and the sample values ​​in the predicted sample set. In other words, since the MAD can be calculated by dividing the sum of the absolute values ​​of the differences between the sample values ​​in the sample set and the sample values ​​in the predicted sample set by the number of samples, accurate cost comparisons can be made even if the number of samples in the predicted sample sets differs.

[0428] In one embodiment, if the number of samples in the prediction sample sets generated according to the multiple directional modes is the same, SAD, SSE or MR-SAD may be produced as cost values ​​for the multiple directional modes.

[0429] In one embodiment, the image decoding device (2000) can select a representative directional mode from among the directional modes belonging to each group, and compare the cost values ​​of the representative directional modes of each group to determine the intra prediction mode of the current block (2490).

[0430] As described above, when the cost values ​​of the directional modes of the first group are calculated through the embodiment described with reference to FIGS. 25a and 25b, the image decoding device (2000) can determine the directional mode with the smallest cost value as the representative directional mode of the first group. Since the number of samples of the prediction sample sets generated based on the directional modes of the first group may be the same, SAD, SSE, or MR-SAD may be used as the cost value in determining the representative directional mode.

[0431] In addition, when the cost values ​​of the directional modes of the second group and the cost values ​​of the directional modes of the third group are calculated, the image decoding device (2000) can determine the directional mode having the smallest cost value among the directional modes of the second group as the representative directional mode of the second group, and can determine the directional mode having the smallest cost value among the directional modes of the third group as the representative directional mode of the third group.

[0432] The video decoding device (2000) may compare the cost values ​​of the representative directional mode of the first group, the representative directional mode of the second group, the representative directional mode of the third group, the horizontal mode, and the vertical mode, and determine the directional mode with the smallest cost value as the intra prediction mode of the current block (2490). As an example, the cost value used to determine the intra prediction mode of the current block (2490) may be MAD. This is because the number of samples of the prediction sample sets generated according to the representative directional modes of different groups may be different from each other.

[0433] In the above, a method for deriving an intra prediction mode (i.e., CLP mode) in an image decoding device (2000) based on the difference between a given set of samples within a restored area around the image has been described.

[0434] Hereinafter, a method for deriving an intra prediction mode in an image decoding device (2000) based on the difference between a predicted value and a restored value for a template of a current block will be described with reference to FIG. 30. In the present disclosure, a method for deriving an intra prediction mode based on the difference between a predicted value and a restored value for a template may be referred to as template-based intra mode derivation (TIMD), and an intra prediction mode derived based on TIMD may be referred to as a TIMD mode.

[0435] FIG. 30 is a diagram for explaining a template-based intra prediction mode derivation method according to one embodiment of the present disclosure.

[0436] Referring to FIG. 30, the image decoding device (2000) can derive an intra prediction mode (i.e., TIMD mode) using the template (3010) of the current block (3000). The image decoding device (2000) can derive the intra prediction mode using the template (3010) of the current block (3000) and a reference sample (3020) of the template (3010).

[0437] The video decoding device (2000) can determine a template (3010) of a current block (3000). The template (3010) of the current block (3000) can include a left sample, an upper left sample, and / or an upper sample of the current block (3000). The template (3010) of the current block (3000) can include an upper template having a width N equal to that of the current block (3000) and a height L1, and a left template having a height M equal to that of the current block (3000) and a width L2. However, the present invention is not limited thereto, and the width of the upper template (3010) can be determined differently from the width of the current block, and the height of the left template (3010) can be determined differently from the height of the current block.

[0438] The video decoding device (2000) can determine a reference sample (3020) of a template (3010) of a current block (3000). The reference sample (3020) of the template (3010) can include a left sample, an upper left sample, and / or an upper sample of the template (3010). For example, the reference sample (3020) can include 2(L1+M)+1 left reference samples and 2(L2+N)+1 upper reference samples adjacent to the template (3010).

[0439] The video decoding device (2000) can perform intra prediction on the template (3010) of the current block using the reference sample (3020). For example, the video decoding device (2000) can obtain a prediction sample for the template (3010) of the current block according to a plurality of directional modes using the reference sample (3020). For example, the video decoding device (2000) can obtain a prediction sample for the template (3010) by performing intra prediction on the template (3010) of the current block according to a plurality of predetermined modes using the reference sample (3020).

[0440] The video decoding device (2000) can derive an intra prediction mode based on the difference between the predicted sample of the template (3010) obtained using the reference sample (3020) and the restored sample of the template (3010). The difference between the predicted sample of the template (3010) and the restored sample of the template (3010) can be obtained using a cost function. In one embodiment, the cost function can include at least one of a sum of absolute difference (SAD), a sum of squared difference (SSD), a sum of absolute transformed difference (SATD), a sum of squared error (SSE), or a mean removed SAD (MR-SAD).

[0441] The video decoding device (2000) can calculate a cost value for each intra prediction mode based on the difference between the predicted sample of the template (3010) obtained by a plurality of predefined intra prediction modes and the restored sample of the template (3010). The cost value for each intra prediction mode can be calculated using a cost function. The video decoding device (2000) can determine the intra prediction mode that minimizes the calculated cost value among the plurality of predefined intra prediction modes as the intra prediction mode of the current block (3000).

[0442] Hereinafter, a method for deriving an intra prediction mode in an image decoding device (2000) based on the amount of variation in sample values ​​in a reconstructed area around a current block will be described with reference to FIGS. 31 and 32. In the present disclosure, a method for deriving an intra prediction mode based on the amount of variation in sample values ​​in a reconstructed area around a current block may be referred to as decoder-side intra mode derivation (DIMD), and an intra prediction mode derived based on DIMD may be referred to as a DIMD mode. In addition, in the present disclosure, the amount of variation may be referred to as a gradient.

[0443] FIG. 31 is a diagram for explaining a method for deriving an intra prediction mode based on a change in a sample value according to one embodiment of the present disclosure.

[0444] Referring to FIG. 31, the image decoding device (2000) can derive an intra prediction mode (i.e., DIMD mode) of the current block (3100) based on the amount of change (i.e., gradient) between at least two samples belonging to the template (3110) of the current block (3100) within the restored area around the current block (3100).

[0445] In one embodiment, the image decoding device (2000) can calculate a gradient using at least two samples belonging to the template (3110) of the current block (3100). The image decoding device (2000) can accumulate the calculated gradients to generate gradient information. As an example, the intra prediction mode of the current block (3100) can be selected from among the intra prediction modes described above in FIG. 21.

[0446] DIMD according to the present disclosure is a technology for directly deriving an intra prediction mode in an image decoding device (2000) based on a gradient. When the DIMD mode is applied to a current block, the image decoding device (2000) can derive a directional mode from a template (3110) of the current block (3100). The directional mode can be derived using gradient information constructed by collecting the gradient of the template (3110) of the current block (3100).

[0447] In one embodiment, a gradient may represent a variable calculated using at least two samples belonging to a template (3110) of a current block (3100). For example, the gradient may include at least one of a horizontal gradient and a vertical gradient. In the present disclosure, the gradient may collectively refer to a calculated gradient and gradient information obtained by accumulating the calculated gradient.

[0448] The gradient information may include information about an intra prediction mode mapped to the calculated gradient and / or information about the amplitude (or intensity) of the intra prediction mode. In the present disclosure, the gradient information may be referred to as gradient intensity, gradient size, gradient amplitude, histogram of gradient (HoG), histogram, histogram intensity, histogram size, histogram amplitude, etc.

[0449] In one embodiment, the gradient between at least two samples belonging to the template (3110) of the current block (3100) can be obtained using a predefined filter. The gradient information of the current block (3110) can be generated based on the obtained gradient.

[0450] The template (3110) of the current block (3100) may include the left, upper left, and upper regions of the current block (3100). As an example, the template (3110) may be defined as an L-shaped region of three pixel lines adjacent to the current block (3100), as illustrated in FIG. 31. A gradient may be calculated using pixels belonging to the template (3110) among the surrounding regions of the current block (3100). In one embodiment, the number of pixel lines that may be used as the template (3110) may be defined in various ways.

[0451] In one embodiment, a gradient may be derived by filtering pixels belonging to a template (3110). In one embodiment, filtering may be performed on pixels within a 3x3 pixel area (3120) belonging to the template (3110). In the present disclosure, the pixel area (3120) to which filtering is applied may be referred to as a window.

[0452] In one embodiment, a 3x3 Sobel filter may be applied to a window (3120). In the present disclosure, the case where the window (3120) is 3x3 is mainly described, but this is only an example and is not limited thereto. For example, the window (3120) may be defined in a size such as 2x2, 4x4, or 5x5. As an example, the window (3120) may be determined centered on a pixel belonging to a central pixel line within a template (3110) of a 3-pixel line, and a gradient may be calculated by applying filtering to the window (3120).

[0453] The gradient may include at least one of a horizontal gradient and a vertical gradient. An intra prediction mode may be determined based on the calculated gradient. An angle (or prediction direction) may be calculated based on the gradient, and the calculated angle may be mapped to the intra prediction mode having the closest or most similar angle. In other words, an intra prediction mode may be calculated from the gradient. Gradient information may be constructed using the intra prediction mode calculated from the gradient.

[0454] In one embodiment, the image decoding device (2000) may utilize a Sobel filter to obtain a gradient. The Sobel filter may include at least one of a horizontal Sobel filter and a vertical Sobel filter. The Sobel filter may be applied to a 3x3 window (3120) centered on pixels belonging to the central pixel line of the template (3110).

[0455] FIG. 32 is a diagram illustrating gradient information according to one embodiment of the present disclosure.

[0456] Referring to FIG. 32, the angle (or prediction direction) derived through filtering for the window (3120) can be mapped (or converted) to one of the predefined intra prediction modes. The angle derived from the gradient can be a texture angle or prediction direction of the window (3120). As an example, the intra prediction mode as described above in FIG. 21 can be derived from the gradient. That is, the angle derived through filtering for the window (3120) can be mapped to one of the 65 directional intra prediction modes.

[0457] In one embodiment, the intra prediction mode corresponding to the current window (3120) can be derived according to the description in the following mathematical expression 1.

[0458]

[0459] In mathematical expression 1, G hor represents the horizontal gradient of the current window (3120), and G ver represents the vertical gradient of the current window (3120). According to mathematical expression 1, the angle of the current window (3120) can be calculated using the horizontal gradient and the vertical gradient.

[0460] In one embodiment, an intra prediction mode corresponding to an angle adjacent to an angle calculated using Equation 1 may be derived (or mapped) to an intra prediction mode of the current window (3120).

[0461] In one embodiment, the intensity (or amplitude) for the intra prediction mode corresponding to the current window (3120) can be calculated based on the following mathematical expression 2.

[0462]

[0463] Referring to mathematical expression 2, the strength of the intra prediction mode can be calculated as the sum of the absolute values ​​for the horizontal gradient of the current window (3120) and the vertical gradient of the current window (3120).

[0464] In one embodiment, gradient information as illustrated in FIG. 32 may be generated (or updated) based on an intra prediction mode and the intensity of the intra prediction mode. That is, gradient information as illustrated in FIG. 32 may be generated by accumulating an intra prediction mode derived from a gradient and an amplitude (or intensity) corresponding to the intra prediction mode. Gradient information may be generated by summing the amplitudes for each intra prediction mode collected from the template (3110) based on the intra prediction mode.

[0465] In one embodiment, the gradient information may include at least one intra prediction mode and an amplitude corresponding to the at least one intra prediction mode.

[0466] Figure 32 illustrates gradient information composed of an intra prediction mode induced by a horizontal gradient and a vertical gradient and an amplitude of the intra prediction mode.

[0467] In one embodiment, the x-axis of the gradient information may represent an intra prediction mode or angle. Here, the angle may be a prediction angle, a prediction direction, a texture angle, or a texture direction. The intra prediction mode may be mapped to the calculated angle. As an example, the angle may be calculated using the mathematical expression 1 described above. The y-axis of the gradient information represents the amplitude of the corresponding intra prediction mode or the corresponding angle.

[0468] In one embodiment, intra prediction modes at all pixel locations (pixel locations belonging to the central pixel line) within the template (3110) are derived, and by summing the intensity values ​​of the derived intra prediction modes, amplitudes for each intra prediction mode of the current block (3100) can be obtained.

[0469] In one embodiment, the image decoding device (2000) can derive a DIMD mode based on the generated gradient information. As an example, the image decoding device (2000) can derive a plurality of DIMD modes based on the gradient information. The maximum number of derived intra prediction modes can be predefined. For example, the maximum number can be defined as 2, 3, 4, 5, etc. For example, among the intra prediction modes included in the generated gradient information, a predetermined number of intra prediction modes in order of increasing amplitude can be derived as the DIMD mode of the current block.

[0470] The video decoding device (2000) can generate a prediction block of the current block by performing intra prediction on the current block using the DIMD mode. Reference samples of the current block can be used for intra prediction.

[0471] The image decoding device (2000) can generate a predictor using the DIMD mode. In the present disclosure, a predictor generated using the DIMD mode in the image decoding device (2000) may be referred to as a prediction sample, a prediction block, a temporary prediction sample, a temporary prediction block, an initial prediction sample, or an initial prediction block.

[0472] The video decoding device (2000) can generate a final prediction block by weighting the predictors generated by the DIMD mode. For example, the video decoding device (2000) can generate a final prediction block by weighting the predictors generated by the DIMD mode and the predictors generated by a predetermined intra prediction mode (e.g., planar mode).

[0473] The video decoding device (2000) can reconstruct the current block using the predicted block. For example, the video decoding device (2000) can determine the predicted block as the reconstructed current block. Alternatively, as an example, the video decoding device (2000) can generate the reconstructed current block by combining the predicted block with residual data obtained from the bitstream.

[0474] FIG. 33 is a flowchart illustrating an image decoding method according to one embodiment of the present disclosure.

[0475] Referring to FIG. 33, the image decoding device (2000) can determine a set of transform kernels of the current block based on the intra prediction mode of the current block (S3310).

[0476] The image decoding device (2000) can perform an inverse transform on the transform coefficients of the current block. The inverse transform can be performed by applying a transform kernel to the transform coefficients. In the present disclosure, the transform kernel may be referred to as a transform type, a transform matrix, a transform core, etc.

[0477] In one embodiment, a set of transform kernels may include a plurality of transform kernel candidates (in this disclosure, transform kernel candidates may be abbreviated as transform kernels). In this disclosure, a transform based on a set of transform kernels may be referred to as Multiple Transform Selection (MTS), and a set of transform kernels may be referred to as an MTS set, an MTS class, or a class.

[0478] In one embodiment, the MTS may represent a method of transforming using Discrete Cosine Transform (DCT)2 in addition to Discrete Sine Transform (DST)7, DCT8, DCT7, DST4, DST1, and / or Identity Transform (IDT). In other words, the set of transform kernels may include transform kernel candidates based on the types of DCT2, DST7, DCT8, DCT7, DST4, DST1, and / or IDT. As an example, IDT may mean transform skip.

[0479] In one embodiment, a transform kernel candidate included in a transform kernel set may be a transform kernel pair. A transform kernel pair may include a transform kernel applied in a horizontal direction and a transform kernel applied in a vertical direction. In the present disclosure, a transform kernel applied in a horizontal direction may be referred to as a horizontal transform kernel, and a transform kernel applied in a vertical direction may be referred to as a vertical transform kernel.

[0480] In one embodiment, a syntax element (e.g., mts_cu_flag) may be defined to indicate whether MTS is applied to the current block. If MTS is not applied to the current block, a predefined default transform kernel may be used for the inverse transform of the current block. For example, if the value of mts_cu_flag is 0, the default transform kernel may be applied to the current block. As an example, the default transform kernel may include a DCT2 type-based transform kernel. If MTS is not applied to the current block, the DCT2 type-based transform kernel may be applied to the horizontal and vertical directions of the current block.

[0481] When MTS is applied to the current block, syntax elements (e.g., mts_hor_flag, mts_ver_flag, mts_hor_idx, mts_ver_idx, mts_idx) indicating transformation kernels applied in the horizontal and vertical directions of the current block may be defined, respectively. For example, when the mts_cu_flag value is 1, syntax elements indicating transformation kernels applied in the horizontal and vertical directions of the current block, respectively, may be signaled. As an example, the transformation kernels applied in the horizontal and vertical directions, respectively, may be selected from a plurality of predefined transformation kernels. The plurality of predefined transformation kernels may include at least one of DST7, DCT8, DCT7, DST4, DST1, or IDT type-based transformation kernels.

[0482] In one embodiment, a set of transform kernels may be determined based on an intra prediction mode. An intra prediction mode may be mapped to a plurality of predefined transform kernel sets. As an example, a transform kernel set mapping table according to a mode number of an intra prediction mode may be defined. The intra prediction mode may be defined as described above in FIG. 21. K sets of transform kernels may be defined, and each of the intra prediction modes illustrated in FIG. 21 may be mapped to one of the K sets of transform kernels. For example, K may be an integer greater than or equal to 2, 3, 4, 5, 6, or the like.

[0483] Additionally, in one embodiment, a set of transform kernels may be determined based on an intra prediction mode and the size of a current block. The current block may be a coding block or a transform block. For example, the current block may be classified based on its size, and a plurality of transform kernel sets corresponding to each classification result may be defined. In addition, an intra prediction mode may be mapped to the plurality of transform kernel sets corresponding to each classification result. The intra prediction mode may be defined as described above in FIG. 21. A set of transform kernels mapped to the intra prediction mode of the current block may be determined as the set of transform kernels of the current block.

[0484] In one embodiment, the sizes of blocks may be classified into P groups, and the intra prediction modes may be classified into Q groups. At this time, P*Q sets of transform kernels may be defined in the image decoding device (2000). As an example, depending on the symmetry of the intra prediction modes, the sets of transform kernels may be defined redundantly, or a set of transform kernels in which each transform kernel candidate is transposed may be defined. As an example, the sizes of blocks may be classified into 16 groups, as shown in Table 1 below.

[0485]

[0486] In Table 1, M can represent a power of 2 greater than 16. The current block size can correspond to any one of the 16 groups according to the classification in Table 1. In addition, based on the block size classification results, five sets of transformation kernels can be defined, as shown in Table 2 below.

[0487]

[0488] In Table 2, MIP represents a matrix-based intra prediction mode. Modes 35 and higher can share a set of transform kernels with symmetric intra prediction modes based on symmetry with respect to the diagonal mode (mode 34). In this case, transposed transform kernel candidates can be utilized.

[0489] The image decoding device (2000) can determine a transformation kernel candidate of the current block based on the transformation kernel set of the current block (S3320).

[0490] In one embodiment, the video decoding device (2000) may determine a transform kernel candidate to be used for inverse transformation of the current block within a transform kernel set of the current block, which is specified using the intra prediction mode of the current block and / or the size of the current block. As an example, a syntax element (e.g., mts index (mts_idx)) indicating a transform kernel candidate to be applied to the current block within the transform kernel set may be signaled. Alternatively, as described above, syntax elements (e.g., mts_hor_flag, mts_ver_flag, mts_hor_idx, mts_ver_idx) indicating transform kernels to be applied in the horizontal and vertical directions of the current block, respectively, may be signaled.

[0491] As in the embodiment described below, when adaptively determining a transform kernel candidate available for inverse transformation of the current block within a transform kernel set based on the characteristics of the current block, a syntax element indicating a transform kernel candidate applicable to the current block among the transform kernel candidates available for the current block may be signaled. That is, the mts index may indicate a transform kernel candidate of the current block among the adaptively determined available transform kernel candidates. If it is determined that there is only one available transform kernel candidate, signaling for the syntax element may be omitted. The available transform kernel candidate may be determined as the transform kernel candidate applicable to the current block.

[0492] The image decoding device (2000) can generate a residual sample (or residual block) of the current block by performing an inverse transformation on the transform coefficient of the current block using the transform kernel candidate of the current block (S3330).

[0493] In one embodiment, the transform coefficients on which inverse transformation is performed may be inverse quantized transform coefficients. The image decoding device (2000) may obtain residual information for the current block from a bitstream. The image decoding device (2000) may obtain transform coefficients by performing inverse quantization on the residual information for the current block, i.e., the quantized transform coefficients. The obtained transform coefficients may be arranged in a predefined scan order in units of blocks of a predetermined size. For example, the predetermined size may be a 4x4 block size. For example, the predefined scan order may be a reverse diagonal scan order.

[0494] In one embodiment, the video decoding device (2000) can reconstruct the current block by adding a prediction sample (or prediction block) for the current block to a residual sample for the current block.

[0495] Meanwhile, the set of transformation kernels may include a predetermined number of transformation kernel candidates. If the information for specifying the transformation kernel candidate to be applied to the current block among these predetermined number of transformation kernel candidates must be signaled by allocating the same bits in all cases, this may result in inefficiency in terms of bit rate, i.e., signaling cost.

[0496] Hereinafter, a method for adaptively determining a transformation kernel candidate available for a current block based on the characteristics of the current block from among a predetermined number of transformation kernel candidates included in a transformation kernel set is described. In the present disclosure, the adaptively determined available transformation kernel may be referred to as a Most Probable Kernel (MPK).

[0497] According to one embodiment of the present disclosure, by selecting a transform kernel candidate for a current block from among available transform kernel candidates that are adaptively determined rather than all transform kernel candidates included in a transform kernel set, signaling bits for specifying a transform kernel candidate can be saved and compression performance can be improved. In other words, by adaptively adjusting the available transform kernel candidates based on the characteristics of a block, the number of bits required for signaling transform kernel selection information can be reduced.

[0498] In one embodiment of the present disclosure, the image decoding device (2000) can adaptively determine a transform kernel candidate available for inverse transformation of the current block from among a predetermined number of transform kernel candidates included in a transform kernel set based on the characteristics of the current block. In describing an embodiment according to the present disclosure, the case where the predetermined number is 6 is mainly described, but is not limited thereto. For example, the number of transform kernel candidates included in the transform kernel set may be 2, 3, 4, 5, 7, 8, or a larger integer.

[0499] The distribution characteristics of transform coefficients for the current block can represent the results of data compression. If data compression is efficient, the transform coefficients may be concentrated in low-frequency components or most of the transform coefficients may have a value of zero. In such cases, by considering a limited number of available transform kernels, focusing on those with statistically high selection probability, the signaling cost can be significantly reduced while maintaining the same or similar compression performance compared to considering a relatively large number of transform kernels. On the other hand, if data compression is inefficient, the transform coefficients may not be concentrated in low-frequency components or there may be a large distribution of non-zero transform coefficients. In such cases, compression performance can be improved by considering a relatively large number of transform kernels.

[0500] Considering the above-described characteristics, the available transformation kernel candidates can be adaptively determined, thereby reducing the number of bits required for signaling transformation kernel selection information.

[0501] In one embodiment, the characteristics of the current block used to determine available transform kernel candidates may be considered based on various conditions. For example, the characteristics of the current block may include distribution characteristics of the transform coefficients of the current block. In the present disclosure, the characteristics of the current block may be referred to or understood as coding information of the current block, attributes of the current block, transform kernel selection conditions, conditions for the number of transform kernels, and the like.

[0502] In one embodiment, based on the characteristics of the current block, a transform kernel candidate available for the current block may be determined from among six transform kernel candidates within a transform kernel set. The transform kernel set may be determined based on an intra prediction mode of the current block and / or a size of the current block, and all or some of the six transform kernel candidates stored in the determined transform kernel set may be available for inverse transformation of the current block based on the characteristics of the current block.

[0503] Meanwhile, the transformation kernel candidates available for the current block can be determined in various ways. For example, the number of available transformation kernel candidates can be adaptively determined. In the present disclosure, the number of available transformation kernel candidates can be abbreviated as the number of available candidates or the number of candidates. In this case, the available transformation kernel candidates can be composed of the transformation kernel candidates of the available number of candidates among the transformation kernel candidates included in the transformation kernel set. The transformation kernel candidates of the available number of candidates can be determined according to a predefined priority within the transformation kernel set. For example, among the transformation kernel candidates included in the transformation kernel set, the transformation kernel candidates of the available number of candidates can be composed as the available transformation kernel candidates in the order of transformation kernels assigned with lower indices.

[0504] As another example, within a set of transformation kernels, a candidate transformation kernel or a combination (or set, subset, group, or subgroup) of candidates for the current block can be determined. For example, a variable indicating the candidate transformation kernel or a combination of candidates can be defined, and the value of the variable can be determined based on the characteristics of the current block. Alternatively, the candidate transformation kernel or a combination of candidates can be defined in a table and determined based on the characteristics of the current block.

[0505] In the present disclosure, the case of determining the number of available transformation kernel candidates within a transformation kernel set based on the characteristics of the current block is mainly described, but is not limited thereto, and the image decoding device (2000) can determine the available transformation kernel candidates or combination of candidates within a transformation kernel set based on the characteristics of the current block in substantially the same manner.

[0506] In one embodiment, a block may be classified based on its characteristics, and a number of available candidates corresponding to each classification result may be defined. As described above, assuming that the transform kernel set may include six transform kernel candidates, the number of available candidates may include at least one of 1, 2, 3, 4, 5, and 6. As an example, if the number of available candidates is 1, information indicating a transform kernel candidate within the transform kernel set may not be signaled.

[0507] In one embodiment, the current block may be classified into three cases based on its characteristics, and each classification result may be associated with a number of available candidates of (1, 4, 6). Alternatively, the current block may be classified into two cases based on its characteristics, and each classification result may be associated with a number of available candidates of (1, 4), (4, 6), or (1, 6).

[0508] Below, we describe the characteristics of blocks that can be considered for determining the number of available candidates.

[0509] FIG. 34 is a diagram for explaining a conversion coefficient distribution according to one embodiment of the present disclosure.

[0510] Referring to FIG. 34, the transform coefficients of the current block (3400) may be arranged according to a predefined scan order. The transform coefficients for which inverse transformation is performed may be inversely quantized transform coefficients. For example, the predefined scan order may be a reverse diagonal scan order. The transform coefficients of the current block (3400) may be arranged in block units of a predetermined size according to the reverse diagonal scan order within the current block (3400), and the DC component coefficient (3410) may be located at the upper left position of the current block (3400).

[0511] In one embodiment, the characteristics of the current block (3400) may include at least one of a quantization parameter, a size of the current block (3400), a number of non-zero coefficients (i.e., transform coefficients), a position of the last non-zero coefficient, a sum of absolute values ​​of (all) coefficients, a sum of absolute values ​​of some coefficients, a maximum value of absolute values ​​of coefficients, a ratio of the sum of absolute values ​​of all coefficients to the sum of absolute values ​​of some coefficients, or a DC component coefficient (3410) value. The block may be a coding block or a transform block.

[0512] In one embodiment, some coefficients may be defined in a variety of ways. For example, some coefficients may represent coefficients contained within a predefined area within the current block (3400). For example, the predefined area may be a predetermined size area in the upper left corner of the block. Alternatively, some coefficients may be defined as a predetermined number of coefficients in the order of the coefficients of the low-frequency components.

[0513] Hereinafter, specific examples of determining the number of available candidates according to the characteristics of the current block (3400) will be described. Once the number of available candidates is determined, the image decoding device (2000) can determine a transform kernel candidate for the current block from among the determined number of transform kernel candidates. As an example, information indicating the transform kernel of the current block from among the available transform kernel candidates can be signaled through a bitstream. If there is only one available candidate, signaling of information indicating the transform kernel of the current block from among the available transform kernel candidates can be omitted.

[0514] In one embodiment, the number of available candidates may be determined based on the sum of the absolute values ​​of the coefficients (i.e., transform coefficients) of the current block (3400). The image decoding device (2000) may sum the absolute values ​​of the coefficients of the current block (3400). The image decoding device (2000) may compare the summed value with a predefined threshold value to determine the number of available candidates.

[0515] For example, a first threshold value and a second threshold value may be defined. If the summed value is less than or equal to (or smaller than) the first threshold value, the number of available candidates may be determined as 1. If the summed value is greater than (or greater than or equal to) the first threshold value and less than or equal to (or smaller than) the second threshold value, the number of available candidates may be determined as 4. If the summed value is greater than (or greater than or equal to) the second threshold value, the number of available candidates may be determined as 6. As an example, the first threshold value and the second threshold value may be defined as fixed values. For example, the first threshold value may be defined as 6 and the second threshold value may be defined as 32. However, the specific values ​​are merely examples, and the present disclosure is not limited thereto, and may be defined as various other values. Alternatively, the first threshold value and the second threshold value may be adaptively determined based on the size of the current block (3400) or the value of the quantization parameter.

[0516] Alternatively, for example, only one threshold value may be defined. In the present disclosure, a threshold value when only one threshold value is defined may be referred to as a third threshold value. If the summed value is less than or equal to the third threshold value, the number of available candidates may be determined as 1 or 4. If the summed value is greater than the third threshold value, the number of available candidates may be determined as 4 or 6. The third threshold value may be defined as a fixed value, or may be a value that is adaptively determined depending on the size of the current block (3400) or the value of the quantization parameter.

[0517] Additionally, in one embodiment, the number of available candidates may be determined based on the size of the current block (3400). The image decoding device (2000) may determine the number of available candidates by comparing the size of the current block (3400) with a predefined threshold. As an example, the above-described embodiment of determining the number of available candidates by comparing with one or two thresholds may be equally applicable.

[0518] Additionally, in one embodiment, the number of available candidates may be determined based on the quantization parameter value of the current block (3400). The image decoding device (2000) may determine the number of available candidates by comparing the quantization parameter value of the current block (3400) with a predefined threshold value. Similarly, the aforementioned embodiment of determining the number of available candidates by comparing with one or two threshold values ​​may be equally applied.

[0519] Also, in one embodiment, the number of available candidates may be determined based on the number of non-zero coefficients (NumNonZeroCoeff) in the current block (3400). The image decoding device (2000) may determine the number of available candidates by comparing the number of non-zero coefficients in the current block (3400) with a predefined threshold. Similarly, the above-described embodiment of determining the number of available candidates by comparing with one or two thresholds may be equally applied. For example, when determining the number of available candidates by comparing with two thresholds, the first threshold may be defined as 4, and the second threshold may be defined as 24. However, the specific values ​​are merely examples, and the present disclosure is not limited thereto, and may be defined with various other values.

[0520] Additionally, in one embodiment, the number of available candidates may be determined based on the position of the last non-zero coefficient within the current block (3400). The image decoding device (2000) may determine the number of available candidates by comparing an index (LastNonZeroPosIdx) value indicating the position of the last non-zero coefficient within the current block (3400) with a predefined threshold value. Similarly, the aforementioned embodiment of determining the number of available candidates by comparing with one or two threshold values ​​may be equally applied. For example, when determining the number of available candidates by comparing with one threshold value, the third threshold value may be defined as 512. However, the specific value is an example, and the present disclosure is not limited thereto, and may be defined with various other values.

[0521] Also, in one embodiment, the number of available candidates may be determined based on the sum of the absolute values ​​of some coefficients within the current block (3400). The image decoding device (2000) may determine the number of available candidates by comparing the sum of the absolute values ​​of some coefficients within the current block (3400) with a predefined threshold. Similarly, the aforementioned embodiment of determining the number of available candidates by comparing with one or two thresholds may be equally applicable. Here, some coefficients may be defined in various different ways. As an example, some coefficients may represent coefficients included in some predefined area within the current block (3400). For example, the predefined area may be an area of ​​a predetermined size at the upper left of the block. Alternatively, some coefficients may be defined as a predetermined number of coefficients in the order of coefficients of low-frequency components.

[0522] Also, in one embodiment, the number of available candidates may be determined based on the absolute values ​​of some coefficients in the current block (3400). The image decoding device (2000) may determine the number of available candidates by comparing the absolute values ​​of some coefficients in the current block (3400) with a predefined threshold value. Similarly, the aforementioned embodiment of determining the number of available candidates by comparing with one or two threshold values ​​may be equally applied. As an example, the image decoding device (2000) may determine the number of available candidates by comparing the absolute values ​​of at least one of the DC component coefficient (3410), the first coefficient, the third coefficient (3420, 3430, 3440) with a predefined threshold value. For example, if the first coefficient (3420) or the third coefficient (3400) is greater than the predefined threshold value, the number of available candidates may be determined as four (or six), otherwise, the number of available candidates may be determined as one (or four). At this time, the threshold value can be defined as 64. However, the specific value is only an example, and the present disclosure is not limited thereto, and can be defined as various other values.

[0523] Additionally, in one embodiment, the number of available candidates may be determined based on the maximum absolute value (MaxAbsCoeff) of the coefficients in the current block (3400). The image decoding device (2000) may determine the number of available candidates by comparing the maximum absolute value of the coefficients in the current block (3400) with a predefined threshold. Similarly, the above-described embodiment of determining the number of available candidates by comparing with one or two thresholds may be equally applied. For example, when determining the number of available candidates by comparing with one threshold, the third threshold may be defined as 16. However, the specific value is an example, and the present disclosure is not limited thereto, and may be defined with various other values.

[0524] Additionally, in one embodiment, the number of available candidates may be determined based on a ratio of the sum of the absolute values ​​of all coefficients of the current block (3400) to the sum of the absolute values ​​of some coefficients. The image decoding device (2000) may determine the number of available candidates by comparing it with a predefined threshold value. Similarly, the aforementioned embodiment of determining the number of available candidates by comparing it with one or two threshold values ​​may be equally applicable.

[0525] Additionally, in one embodiment, the number of available candidates may be determined based on the value of the DC component coefficient (3410) of the current block (3400). The image decoding device (2000) may determine the number of available candidates by comparing the value of the DC component coefficient (3410) of the current block (3400) with a predefined threshold value. Similarly, the aforementioned embodiment of determining the number of available candidates by comparing with one or two threshold values ​​may be equally applicable.

[0526] Additionally, in one embodiment, the image decoding device (2000) may determine the number of available candidates by combining one or more characteristics of the current block (3400) described above. For example, if the following mathematical expression 3 is satisfied, the number of available candidates may be determined to be 4 (or 6), and otherwise, the number of available candidates may be determined to be 1 (or 4).

[0527]

[0528] In mathematical expression 1, NumNonZeroCoeff is a variable representing the number of non-zero coefficients in the current block (3400), MaxAbsCoeff is a variable representing the maximum absolute value of the coefficients in the current block (3400), and abs(coeff0) represents the absolute value of the DC component coefficient (3410). Alternatively, if the following mathematical expression 4 is satisfied, the number of available candidates may be determined as 4 (or 6), and otherwise, the number of available candidates may be determined as 1 (or 4).

[0529]

[0530] In mathematical expression 4, coeff0 represents the DC component coefficient (3410), and LastNonZeroPosIdx is an index indicating the position of the last non-zero coefficient in the current block (3400).

[0531] Mathematical expressions 1 and 2 are examples, and in addition, the number of candidates available to the current block (3400) within the set of transformation kernels of the current block (3400) can be determined by considering one or more of the characteristics described above in various other ways.

[0532] In one embodiment, the video decoding device (2000) may obtain a syntax element from a bitstream that indicates a transformation kernel candidate to be applied to the current block among a number of available transformation kernel candidates. If the number of available candidates is determined to be 1, information indicating a transformation kernel candidate to be applied to the current block among the available transformation kernel candidates may not be signaled. An available transformation kernel candidate may be determined as a transformation kernel candidate to be applied to the current block.

[0533] Meanwhile, the set of transformation kernels of the current block (3400) may be determined based on the intra prediction mode of the current block (3400). If the mode of the current block (3400) is a regular intra mode, the set of transformation kernels mapped to the intra prediction mode of the current block (3400) may be determined as the set of transformation kernels of the current block (3400).

[0534] In the present disclosure, a regular intra mode refers to a mode included in a regular intra mode set. The regular intra mode set may refer to an intra prediction mode set including intra prediction modes predefined in a video encoding device and a video decoding device (2000). The regular intra mode set may be abbreviated as regular intra mode. As an example, the regular intra mode set may be an intra prediction mode set including intra prediction modes as described above in FIG. 21.

[0535] In one embodiment of the present disclosure, when the mode of the current block (3400) is a non-regular intra mode, an intra prediction mode for determining a transform kernel set of the current block (3400) may be derived and replaced with the intra prediction mode of the current block (3400). That is, the mode of the current block (3400) encoded with the non-regular intra mode may be replaced with the derived regular intra mode, and the transform kernel set of the current block (3400) may be determined based on this.

[0536] In the present disclosure, the non-regular intra mode may collectively refer to a mode other than the regular intra mode, and the contents of the present disclosure are not limited to this designation. For example, the non-regular intra mode according to the present disclosure may also be referred to as the irregular intra mode, the non-intra prediction mode, etc.

[0537] In one embodiment, the non-regular intra mode may include at least one of an inter mode, an intra block copy (IBC) mode, a palette mode, an intra template matching prediction (IntraTMP) mode, a geometric partitioning mode (GPM), a spatial geometric partitioning mode (SGPM), a block-based delta pulse code modulation (BDPCM) mode, an extrapolation filter-based intra prediction (EIP) mode, an intra prediction fusion mode, or a matrix-based intra prediction (MIP) mode.

[0538] In one embodiment, the image decoding device (2000) may derive the intra prediction mode of the current block (3400) using at least one of TIMD, DIMD, or CLP when the mode of the current block (3400) is a non-regular intra mode. The embodiment described in FIG. 30 may be applied to TIMD, and the embodiments described in FIGS. 31 and 32 may be applied to DIMD. The embodiments described in FIGS. 24 and 29 may be applied to CLP. Here, overlapping descriptions are omitted.

[0539] The video decoding device (2000) can determine a set of transform kernels of the current block (3400) by using the intra prediction mode of the derived current block (3400).

[0540] Below, a method is described to increase the conversion efficiency by selectively using multiple sets of conversion kernels derived based on multiple intra prediction modes for a block coded with non-regular intra mode.

[0541] FIG. 35 is a diagram for explaining a transformation method using a plurality of transformation kernel sets according to one embodiment of the present disclosure.

[0542] Referring to FIG. 35, when the mode of the current block is a non-regular intra mode, the image decoding device (2000) can derive a plurality of transformation kernel sets based on a plurality of intra prediction modes, and determine a transformation kernel set to be applied to the current block from among the derived plurality of transformation kernel sets.

[0543] In one embodiment, the image decoding device (2000) can derive two sets of transform kernels. In the present disclosure, the case of using two sets of transform kernels is mainly described, but it is not limited thereto, and even when three or more sets of transform kernels, i.e., additional sets of transform kernels, are used, the same principle can be applied substantially, except that additional intra prediction modes are used to derive additional sets of transform kernels. In addition, in the present disclosure, a transform based on multiple sets of transform kernels can be referred to as Multiple Transform Set Selection (MTSS).

[0544] According to one embodiment of the present disclosure, two sets of transform kernels may include a first set of transform kernels and a second set of transform kernels. In the present disclosure, the first set of transform kernels may be referred to as an initial set of transform kernels, a primary set of transform kernels, etc., and the second set of transform kernels may be referred to as an alternative set of transform kernels, a secondary set of transform kernels, a temporary set of transform kernels, etc.

[0545] If the mode of the current block is a non-regular intra mode, the image decoding device (2000) can derive a first intra prediction mode according to a predetermined derivation method. The predetermined derivation method can include at least one of TIMD, DIMD, and CLP. The first intra prediction mode can be an intra prediction mode having a smallest cost value according to the predetermined derivation method. The first intra prediction mode can be a directional mode. The image decoding device (2000) can determine a first transform kernel set based on the first intra prediction mode. In this case, the embodiments described above with reference to FIGS. 33 and 34 can be applied, and redundant descriptions thereof are omitted herein.

[0546] In one embodiment of the present disclosure, the image decoding device (2000) may determine a second transform kernel set based on a predefined default mode. In this case, the embodiments described above with reference to FIGS. 38 and 39 may be applied, and redundant descriptions thereof will be omitted herein. The default mode may represent a mode predefined in the image decoding device (2000) to derive the second transform kernel set. As an example, the default mode may include a non-directional mode. The non-directional mode may include at least one of a DC mode or a planar mode. As an example, the default mode may include a fixed directional mode. Alternatively, as an example, the default mode may include at least one of a planar mode, a DC mode, a horizontal mode, a vertical mode, or a diagonal mode. Here, the diagonal mode may mean one or more of a bottom-left diagonal mode, an upper-left diagonal mode, or an upper-right diagonal mode. The default mode may be predefined as modes having a statistically high selection probability. For example, the second set of transformation kernels may be a set of transformation kernels corresponding to the planar mode.

[0547] In another embodiment of the present disclosure, the image decoding device (2000) may derive the second intra prediction mode according to the aforementioned predetermined derivation method. As an example, the second intra prediction mode may be the intra prediction mode having the second lowest cost value according to the derivation method used to derive the first intra prediction mode. Alternatively, the second intra prediction mode may be the intra prediction mode having the lowest cost value according to a derivation method other than the derivation method used to derive the first intra prediction mode. The image decoding device (2000) may determine the second transform kernel set based on the second intra prediction mode.

[0548] In one embodiment, the image decoding device (2000) can determine a transform kernel set to be applied to a current block from among two transform kernel sets that are explicitly or implicitly determined. For example, the image decoding device (2000) can obtain transform kernel set selection information from a bitstream. The transform kernel set selection information can be a flag or an index. Alternatively, for example, the image decoding device (2000) can determine a transform kernel set based on predefined encoding information.

[0549] In one embodiment, selectively utilizing multiple sets of transform kernels may require additional signaling for transform kernel set selection information, which may increase signaling costs. In one embodiment of the present disclosure, the increased signaling costs can be reduced by setting the number of available candidates for the additional set of transform kernels (i.e., the second set of transform kernels).

[0550] In one embodiment, the number of available candidates for the first transform kernel set and the second transform kernel set may be determined as illustrated in FIG. 40. As described above in FIGS. 38 and 39, the number of available candidates for the first transform kernel set may be (1, 4, 6). The number of available candidates for the second transform kernel set may be (n1, n2, n3). In this case, (n1, n2, n3) may be defined as (1, 2, 3), (1, 2, 4), (1, 4, 4), (4, 4, 4). The embodiments described above in FIGS. 33 and 34 may be equally applied to determining the number of available candidates. Here, overlapping descriptions are omitted.

[0551] For example, based on the characteristics of the current block, the current block can be classified into three cases, and for the first set of transformation kernels, the available candidate numbers of (1, 4, 6) can correspond to the classification results, respectively, and for the second set of transformation kernels, the available candidate numbers of (n1, n2, n3) can correspond to the classification results, respectively.

[0552] In this way, by defining a relatively smaller or equal number of available candidates compared to the first set of transform kernels, the bits required for signaling information for specifying transform kernel candidates within the additionally utilized second set of transform kernels can be saved, thereby improving the increased bit rate due to signaling of transform kernel set selection information.

[0553] Meanwhile, a secondary transform may be additionally performed on the primary transform coefficients based on the encoding process. The secondary transform may represent a transformation into a more compact representation by utilizing the correlation existing between the primary transform coefficients. The primary transform may be a transformation from the spatial domain to the frequency domain, and the secondary transform may be a transformation that obtains modified transform coefficients from the primary transform coefficients. As an example, the secondary transform may include a non-separable transform. In the present disclosure, the secondary transform may be referred to as a low frequency non-separable transform (LFNST). The primary transform may be referred to as a core transform.

[0554] Below, the secondary transformation is described in detail with reference to FIGS. 36 and 37.

[0555] FIG. 36 is a flowchart illustrating an image decoding method according to one embodiment of the present disclosure.

[0556] Referring to FIG. 36, based on the decoding process performed in the image decoding device (2000), a residual sample of the current block can be generated by performing an inverse primary transform on the inverse secondary transformed transform coefficients. As illustrated in FIG. 36, step S3330 described above in FIG. 33 can include steps S3610 and S3620.

[0557] Specifically, the image decoding device (2000) can perform an inverse quadratic transform on the transform coefficients of the current block (S3610). Prior to this, the image decoding device (2000) can obtain the transform coefficients of the current block by performing inverse quantization on the residual information obtained from the bitstream, i.e., the quantized transform coefficients. The image decoding device (2000) can obtain modified transform coefficients by performing an inverse quadratic transform on the obtained transform coefficients.

[0558] In one embodiment, the image decoding device (2000) can obtain modified transform coefficients from the transform coefficients of the current block using the LFNST kernel. In the present disclosure, the LFNST kernel may be referred to as an LFNST type, an LFNST matrix, etc. The image decoding device (2000) can determine an LFNST set including the LFNST kernel based on the intra prediction mode of the current block. In the present disclosure, the LFNST set may also be referred to as an LFNST kernel set. The image decoding device (2000) can obtain an LFNST index indicating an LFNST kernel applied to the current block within the determined LFNST set from the bitstream.

[0559] In one embodiment, intra prediction modes may be mapped to an LFNST set. An LFNST set mapping table may be defined according to the mode number of the intra prediction mode. An LFNST set index for specifying an LFNST set may be determined according to the mode number of the intra prediction mode. An LFNST set may include a predefined number of LFNST kernel candidates. For example, the predefined number may be 2, 3, 4, 5, 6, or a larger integer. In one embodiment, 35 LFNST sets may be defined, and an LFNST set mapping table may be defined as shown in Table 3 below.

[0560]

[0561] In one embodiment, the image decoding device (2000) can derive the intra prediction mode of the current block using at least one of TIMD, DIMD, and CLP when the mode of the current block is a non-regular intra mode. The embodiment described in FIG. 30 can be applied to TIMD, and the embodiments described in FIGS. 31 and 32 can be applied to DIMD. The embodiments described in FIGS. 24 and 29 can be applied to CLP. Here, overlapping descriptions are omitted. The image decoding device (2000) can determine the LFNST set of the current block using the derived intra prediction mode of the current block.

[0562] The image decoding device (2000) can perform an inverse primary transform on the inverse secondary transformed transform coefficients (S3620). The image decoding device (2000) can generate a residual sample of the current block by performing an inverse primary transform on the transformed coefficients modified in step S4110. At this time, the method described above in FIGS. 33 to 35 can be applied. Here, redundant descriptions are omitted.

[0563] For example, as described in FIG. 33, the image decoding device (2000) can determine a set of transform kernels of the current block based on the intra prediction mode of the current block and / or the size of the current block.

[0564] As described in FIG. 34, the image decoding device (2000) can determine a transform kernel available for the inverse linear transform of the current block within the transform kernel set of the current block based on the characteristics of the current block. If the mode of the current block is a non-regular mode, the image decoding device (2000) can derive an intra prediction mode using a predetermined derivation method. The image decoding device (2000) can determine a transform kernel set based on the derived intra prediction mode.

[0565] As described in FIG. 35, the image decoding device (2000) can derive multiple intra prediction modes and determine multiple sets of transformation kernels using the derived intra prediction modes. The image decoding device (2000) can determine a set of transformation kernels to be applied to the current block from among the multiple sets of transformation kernels.

[0566] FIG. 37 is a diagram illustrating an application area of ​​a secondary transformation according to one embodiment of the present disclosure.

[0567] Referring to Fig. 37, LFNST may be applied to a predetermined area on the upper left side of the current block (3700). Fig. 37 illustrates an area to which forward LFNST is applied based on an encoding process performed in an image encoding device. As described above, the current block (3700) to which LFNST is applied may include primary transformed transform coefficients.

[0568] In one embodiment, the predetermined area on the upper left side of the current block (3700) may be the shaded area in FIG. 37. However, the area indicated in FIG. 37 is merely an example, and the present disclosure is not limited thereto, and LFNST may be applied to a portion of the upper left side of the current block (3700). For example, LFNST may be applied to a 4x4 or 8x8 area on the upper left side of the current block (3700). Alternatively, the area to which LFNST is applied may be adaptively determined depending on the size of the current block.

[0569] In one embodiment, the remaining areas except the area where LFNST is applied can be zeroed out. That is, coefficients outside the area except for the transformed coefficients in the shaded area of ​​FIG. 37 can be treated as 0.

[0570] In one embodiment, the LFNST kernel may be defined to have different sizes depending on the size of the block. For example, the LFNST kernel may include LFNST4, LFNST8, and LFNST16. LFNST4 may represent an LFNST kernel applied to a block of size 4xN or Nx4, where N may be greater than or equal to 4. LFNST4 may include a kernel of size 16x16. LFNST8 may represent an LFNST kernel applied to a block of size 8xM or Mx8, where M may be greater than or equal to 8. LFNST8 may include a kernel of size 32x64. LFNST16 may represent an LFNST kernel applied to a block of size PxQ, where P and Q may be greater than or equal to 16. LFNST16 may include a kernel of size 32x96.

[0571] In one embodiment of the present disclosure, the embodiment described above in FIG. 35 may be substantially equally applied to secondary transformation as well. That is, when the mode of the current block is a non-regular intra mode, the image decoding device (2000) may derive a plurality of transform kernel sets for secondary transformation based on a plurality of intra prediction modes, and determine a transform kernel set to be applied to the current block from among the derived plurality of transform kernel sets.

[0572] In one embodiment, when the mode of the current block is a non-regular intra mode, the image decoding device (2000) can derive multiple intra prediction modes and determine multiple LFNST kernel sets (e.g., a first LFNST kernel set and a second LFNST kernel set) using the derived intra prediction modes. The image decoding device (2000) can determine an LFNST kernel set to be applied to the current block from among the multiple LFNST kernel sets. The embodiment described above in FIG. 35 can be applied, and redundant descriptions are omitted here.

[0573] Meanwhile, in the previous drawings 33 to 35, the case where a separable transformation is applied as a primary transformation was mainly explained.

[0574] According to one embodiment of the present disclosure, the primary transform may include a non-separable primary transform (NSPT).

[0575] In one embodiment, the combination of the separable primary transform and LFNST can be replaced with NSPT. That is, the inverse transform described previously in FIGS. 33 to 35 can be applied to the modified transform coefficients using the secondary transform described in FIGS. 36 and 37. NSPT can also be applied instead of this combination of the primary and secondary transforms.

[0576] Compared to the separable transformation, which applies transformation kernels to each of the horizontal and vertical directions, the non-separable transformation requires a relatively large amount of computation. Considering this, NSPT can be set to be applied with restrictions depending on the block size. That is, the size of the block to which NSPT is applied can be defined in advance. For example, the sizes of the blocks to which NSPT is applied can include 4x4, 4x8, 8x4, 8x8, 4x16, 16x4, 8x16, and 16x8.

[0577] In one embodiment, if the size of the current block is larger than the size of the block to which NSPT is applied, it may be determined that NSPT is not applied to the current block. In this case, a separable primary transform and / or secondary transform may be applied to the current block. For example, if it is determined that NSPT is not applied to the current block, a DCT2-type based primary transform and LFNST may be applied to the current block.

[0578] In one embodiment, intra prediction modes may be mapped to an NSPT set. An NSPT set mapping table may be defined according to the mode number of the intra prediction mode. An NSPT set index for specifying an NSPT set may be determined according to the mode number of the intra prediction mode. An NSPT set may include a predefined number of NSPT kernel candidates. For example, the predefined number may be 2, 3, 4, 5, 6, or a larger integer. In one embodiment, 35 NSPT sets may be defined.

[0579] In one embodiment, the image decoding device (2000) can derive the intra prediction mode of the current block using at least one of TIMD, DIMD, and CLP when the mode of the current block is a non-regular intra mode. The embodiment described in FIG. 30 can be applied to TIMD, and the embodiments described in FIGS. 31 and 32 can be applied to DIMD. The embodiments described in FIGS. 24 and 29 can be applied to CLP. Here, overlapping descriptions are omitted. The image decoding device (2000) can determine the NSPT set of the current block using the derived intra prediction mode of the current block.

[0580] In one embodiment of the present disclosure, the embodiment described above in FIG. 35 can be substantially equally applied to non-separable primary transforms. That is, when the mode of the current block is a non-regular intra mode, the image decoding device (2000) can derive a plurality of transform kernel sets for non-separable primary transforms based on a plurality of intra prediction modes, and determine a transform kernel set to be applied to the current block from among the derived plurality of transform kernel sets.

[0581] In one embodiment, when the mode of the current block is a non-regular intra mode, the image decoding device (2000) can derive multiple intra prediction modes and determine multiple NSPT kernel sets (e.g., a first NSPT kernel set and a second NSPT kernel set) using the derived intra prediction modes. The image decoding device (2000) can determine an NSPT kernel set to be applied to the current block from among the multiple NSPT kernel sets. The embodiment described above in FIG. 35 can be applied, and redundant descriptions are omitted here.

[0582] FIG. 38 is a flowchart illustrating an image decoding method according to one embodiment of the present disclosure.

[0583] Referring to FIG. 38, the image decoding device (2000) can determine a set of transform kernels of the current block based on the intra prediction mode of the current block (S3810).

[0584] In one embodiment, the set of transformation kernels may include multiple transformation kernel candidates. The embodiment described above in FIG. 33 may be applied. Here, redundant descriptions are omitted.

[0585] A set of transform kernels according to an embodiment of the present disclosure may be a set of transform kernels for at least one of a Multiple Transform Set (MTS), a Low Frequency Non-Separable Transform (LFNST), or a Non-Separable Primary Transform (NSPT).

[0586] In one embodiment, the image decoding device (2000) may derive an intra prediction mode of the current block based on a predefined derivation method when the mode of the current block is a non-regular intra mode. The image decoding device (2000) may determine a set of transform kernels of the current block based on the derived intra prediction mode.

[0587] In one embodiment, the non-regular intra mode may include at least one of an inter mode, an intra block copy (IBC) mode, a palette mode, an intra template matching prediction (IntraTMP) mode, a geometric partitioning mode (GPM), a spatial geometric partitioning mode (SGPM), a block-based delta pulse code modulation (BDPCM) mode, an extrapolation filter-based intra prediction (EIP) mode, an intra mode fusion mode, or a matrix-based intra prediction (MIP) mode.

[0588] In one embodiment, when the mode of the current block is a non-regular intra mode, the image decoding device (2000) may derive a plurality of transform kernel sets based on a plurality of intra prediction modes, and determine a transform kernel set to be applied to the current block from among the derived plurality of transform kernel sets. The embodiment described above in FIG. 35 may be applied. Here, redundant descriptions are omitted.

[0589] In one embodiment, the image decoding device (2000) may derive a first intra prediction mode of the current block based on a predefined derivation method when the mode of the current block is a non-regular intra mode. The image decoding device (2000) may determine a first transform kernel set based on the derived first intra prediction mode.

[0590] In one embodiment, the predefined derivation scheme may include at least one of a first derivation scheme for deriving an intra prediction mode based on a gradient of sample values ​​within a reconstructed area around a current block, a second derivation scheme for deriving an intra prediction mode based on a difference between a predicted value and a reconstructed value for a template of the current block, or a third derivation scheme for deriving an intra prediction mode based on a difference between sample sets within a reconstructed area around the current block.

[0591] In one embodiment, the image decoding device (2000) may determine a second transform kernel set based on the second intra prediction mode. The image decoding device (2000) may determine a transform kernel set of the current block from among the first transform kernel set and the second transform kernel set.

[0592] In one embodiment, the second intra prediction mode may include at least one of a planar mode, a DC mode, a horizontal mode, a vertical mode, or a diagonal mode. Alternatively, the second intra prediction mode may be derived as an intra prediction mode having a second lowest cost value among the cost values ​​calculated for each intra prediction mode according to the derivation method used to derive the first intra prediction mode.

[0593] In one embodiment, the number of available transformation kernel candidates may be determined differently when the first transformation kernel set is determined as the transformation kernel set of the current block and when the second transformation kernel set is determined as the transformation kernel set of the current block.

[0594] The image decoding device (2000) can adaptively determine a transform kernel candidate available for inverse transformation of the current block from among multiple transform kernel candidates included in the transform kernel set based on the characteristics of the current block (S3820). The embodiment described above in FIG. 34 can be applied. Here, redundant descriptions are omitted.

[0595] In one embodiment, the characteristics of the current block may include at least one of the number of non-zero transform coefficients within the current block, the position index of the last non-zero transform coefficient within the current block, the maximum absolute value of the transform coefficients within the current block, the absolute value of the transform coefficients at a given position within the current block, or the sum of the absolute values ​​of the transform coefficients within a given region of the current block.

[0596] In one embodiment, the video decoding device (2000) can determine the number of available transform kernel candidates by comparing the characteristics of the current block with at least one of the number of non-zero transform coefficients in the current block, the position index of the last non-zero transform coefficient in the current block, the maximum value of the absolute value of the transform coefficients in the current block, the absolute value of the transform coefficients at a given position in the current block, or the sum of the absolute values ​​of the transform coefficients in a given area of ​​the current block, with a predefined threshold.

[0597] In one embodiment, the available transformation kernel candidates may be determined to include a number of transformation kernel candidates determined in descending order of index values ​​from among a plurality of transformation kernel candidates included in the transformation kernel set.

[0598] The video decoding device (2000) can determine a transformation kernel candidate of the current block among available transformation kernel candidates (S3830).

[0599] In one embodiment, the image decoding device (2000) may obtain information indicating a transform kernel candidate of the current block from among the available transform kernel candidates from the bitstream. If the number of available candidates is determined to be 1, information indicating a transform kernel candidate to be applied to the current block from among the available transform kernel candidates may not be signaled. The available transform kernel candidate may be determined as the transform kernel candidate to be applied to the current block.

[0600] The image decoding device (2000) can generate a residual sample of the current block by performing an inverse transformation on the transform coefficient of the current block using the transform kernel candidate of the current block (S3840).

[0601] In one embodiment, the transform coefficients on which inverse transformation is performed may be inverse quantized transform coefficients. The image decoding device (2000) may obtain residual information for the current block from a bitstream. The image decoding device (2000) may obtain transform coefficients by performing inverse quantization on the residual information for the current block, i.e., the quantized transform coefficients. The obtained transform coefficients may be arranged in a predefined scan order in units of blocks of a predetermined size. For example, the predetermined size may be a 4x4 block size. For example, the predefined scan order may be a reverse diagonal scan order.

[0602] In one embodiment, the video decoding device (2000) can reconstruct the current block by adding a prediction sample (or prediction block) for the current block to a residual sample for the current block.

[0603] FIG. 39 is a block diagram showing the configuration of an image encoding device according to one embodiment of the present disclosure.

[0604] Referring to FIG. 39, the image encoding device (3900) may include a processor (3910) and a memory (3920).

[0605] In one embodiment of the present disclosure, the processor (3910) may include processing circuitry and / or multiple processors. For example, the processor (3910) may include various processing circuitry, including at least one processor, wherein one or more of the at least one processor may be configured to individually and / or collectively perform various functions described in the present disclosure in a distributed manner.

[0606] In one embodiment of the present disclosure, the memory (3920) may include one or more storage media storing at least one instruction. The processor (3910) may control the image encoding device (3900) by executing the instructions stored in the memory (3920). For example, the processor (3910) may control the image encoding device (3900) to perform operations by individually or collectively executing the instructions stored in the memory (3920). In one embodiment of the present disclosure, the operations performed by the image encoding device (3900) may be operations performed by the processor (3910) of the image decoding device (3900).

[0607] In one embodiment of the present disclosure, the image encoding device (3900) may correspond to the image encoding device (200) illustrated in FIG. 2 and / or the encoding unit (1910) illustrated in FIG. 19.

[0608] The image encoding device (3900) may determine a prediction mode of a current block. The current block may include at least one of a maximum coding unit, an encoding unit, a transformation unit, or a prediction unit segmented from a current image to be encoded. In one embodiment of the present disclosure, the prediction mode of the current block may include at least one of an intra mode, an inter mode, a combined mode, a geometric partitioning mode (GPM), a spatial geometric partitioning mode (SGPM), a block copy mode, a template matching prediction mode, a block-based delta pulse code modulation (BDPCM) mode, an extrapolation filter-based intra prediction (EIP) mode, an intra prediction fusion mode, or a matrix-based intra prediction (MIP) mode.

[0609] In one embodiment of the present disclosure, the intra mode may include a non-directional planar mode of 0 (or Intra_Planar mode), a non-directional DC mode of 1 (or Intra_DC mode), and directional modes of 2 to 66 (or Intra-directional modes) (e.g., (Intra_Angular2.. Intra_Angular66)).

[0610] In one embodiment of the present disclosure, the planar mode may refer to a mode in which a prediction sample is determined based on a weighted average value according to the distances of the left reference sample, the upper reference sample, the lower left sample of the current block, and the upper right sample. In one embodiment of the present disclosure, the intra DC mode may refer to a mode in which the average value of the reference samples is determined as a prediction sample.

[0611] In one embodiment of the present disclosure, for intra directional modes, the positions of reference samples for generating prediction samples of samples within a current block can be identified by considering the direction indicated by each mode. For example, in mode 34, reference samples located at a 45 degree upper left direction with respect to samples within the current block can be identified. In one embodiment of the present disclosure, the intra mode can include wide-angle modes (Intra_Wide_Angular) of -14 to -1 and 67 to 80. The wide-angle modes can be used to identify reference samples of samples within a non-square current block. In one embodiment of the present disclosure, the image encoding apparatus (3900) can determine one of the wide-angle modes as an intra prediction mode of a non-square current block.

[0612] The video encoding device (3900) can determine the wide-angle mode based on the width and height of the current block. If the width of the current block is greater than the height, the video encoding device (3900) can replace the lower-left directional mode with the upper-right extended directional mode. For example, the video encoding device (3900) can replace the index value “predModeIntra” of the intra prediction mode, which is 2 or more and less than a predetermined value, with “predModeIntra + 65.”

[0613] If the height of the current block is greater than the width, the video encoding device (3900) can replace the upper-right directional mode with the lower-left extended directional mode. For example, the video encoding device (3900) can replace the index value “predModeIntra” of the intra prediction mode that is greater than or equal to a predetermined value and less than or equal to 66 with “predModeIntra - 67”.

[0614] The number and types of intra prediction modes available in the intra mode of the image encoding device (3900) according to one embodiment of the present disclosure may be set in various ways. For example, the image encoding device (3900) may determine the wide-angle mode using a predetermined method according to the ratio of the height and width of a block (e.g., 16, 8, 4, 2, 1 / 2, 1 / 4, 1 / 8, or 1 / 16).

[0615] In one embodiment of the present disclosure, the image encoding device (3900) can derive an intra prediction mode based on a surrounding restored area (or a previously encoded / restored area) similarly to the image decoding device (2000).

[0616] The method for deriving an intra prediction mode performed by the video encoding device (3900) may include at least one of a method for deriving an intra prediction mode based on a difference between a predetermined set of samples within a reconstructed area around a current block, a method for deriving an intra prediction mode based on a difference between a predicted value and a reconstructed value for a template of the current block, or a method for deriving an intra prediction mode based on a change in a sample value within a reconstructed area around the current block.

[0617] The method for deriving an intra prediction mode based on the difference between a given set of samples within a restored area around the current block is as described above with reference to FIGS. 24 to 29, and the redundant description is omitted here. The method for deriving an intra prediction mode based on the difference between a predicted value and a restored value for a template of the current block is as described above with reference to FIG. 30, and the redundant description is omitted here. The method for deriving an intra prediction mode based on the amount of change in a sample value within a restored area around the current block is as described above with reference to FIGS. 31 and 32, and the redundant description is omitted here.

[0618] In one embodiment of the present disclosure, the block copy mode may include an intra-block copy mode. In one embodiment, the block copy mode may include an intra-block copy mode. In one embodiment, the intra-block copy mode may be a sub-mode of the intra-mode, but is not limited thereto, and may represent a mode separate from the intra-mode.

[0619] In one embodiment, the template matching prediction mode may include a template matching intra prediction mode. The combined mode may include a combined inter-intra prediction (CIIP) mode that performs prediction by combining predictions according to the intra mode and predictions according to the inter mode. The geometric segmentation mode may include a mode that divides the block to include directionality. The geometric segmentation mode may perform predictions using inter prediction or intra prediction for each of the divided regions divided into blocks.

[0620] In one embodiment of the present disclosure, when the prediction mode of the current block is the CIIP mode, the video encoding device (3900) can perform prediction on the current block by combining inter prediction and intra prediction. For example, the video encoding device (3900) can perform intra prediction according to the planar mode. For example, the video encoding device (3900) can determine a motion vector of a reference block for the current block. The video encoding device (3900) can perform inter prediction using the motion vector. The video encoding device (3900) can predict the current block using a weighted sum of a prediction block according to inter prediction and a prediction block according to intra prediction. The weight can be determined based on whether a block adjacent to the current block was intra-predicted (or inter-predicted).

[0621] In one embodiment of the present disclosure, when the prediction mode of the current block is a geometric segmentation mode, the image encoding device (3900) can perform prediction by segmenting the current block. The image encoding device (3900) can determine a segmentation angle and a segmentation distance for a boundary at which segmentation is performed within the current block. The image encoding device (3900) can segment the current block based on the segmentation angle and the segmentation distance. The image encoding device (3900) can predict the current block by performing inter prediction or intra prediction on each of the segmented regions within the current block. The image encoding device (3900) can i) perform intra prediction on both segmented regions, ii) perform inter prediction on one region and intra prediction on the other region, or iii) perform inter prediction on both segmented regions.

[0622] In one embodiment of the present disclosure, when the prediction mode of the current block is the template matching prediction mode, the image encoding device (...

Claims

In the method of decrypting a video, A step (S3810) of determining a set of transformation kernels of the current block based on an intra prediction mode of the current block, wherein the set of transformation kernels includes a plurality of transformation kernel candidates; A step (S3820) of adaptively determining a transformation kernel candidate available for inverse transformation of the current block from among the plurality of transformation kernel candidates included in the transformation kernel set based on the characteristics of the current block; A step (S3830) of determining a transformation kernel candidate of the current block among the available transformation kernel candidates; and A method for decoding an image, comprising a step (S3840) of generating a residual sample of the current block by performing an inverse transformation on a transform coefficient of the current block using a transform kernel candidate of the current block. In the first paragraph, The step (S3820) of adaptively determining the above available transformation kernel candidates is: Comprising a step of determining the number of available transform kernel candidates by comparing at least one of the number of non-zero transform coefficients in the current block, the position index of the last non-zero transform coefficient in the current block, the maximum value of the absolute value of the transform coefficients in the current block, the absolute value of the transform coefficients at a predetermined position in the current block, or the sum of the absolute values ​​of the transform coefficients in a predetermined area of ​​the current block with a predefined threshold, A method for decoding an image, wherein the available transformation kernel candidates are determined to include the determined number of transformation kernel candidates in descending order of index values ​​among the plurality of transformation kernel candidates included in the transformation kernel set. In the first paragraph, The step (S3810) of determining the transformation kernel set of the current block is: When the mode of the current block is a non-regular intra mode, a step of deriving an intra prediction mode of the current block based on a predefined derivation method; and A method for decoding an image, comprising the step of determining a set of transform kernels of the current block based on the derived intra prediction mode. In the third paragraph, A method for decoding an image, wherein the non-regular intra mode comprises at least one of an inter mode, an intra block copy (IBC) mode, a palette mode, an intra template matching prediction (IntraTMP) mode, a geometric partitioning mode (GPM), a spatial geometric partitioning mode (SGPM), a block-based delta pulse code modulation (BDPCM) mode, an extrapolation filter-based intra prediction (EIP) mode, an intra mode fusion mode, or a matrix-based intra prediction (MIP) mode. In the third paragraph, A method for decoding an image, wherein the predefined derivation method comprises at least one of a first derivation method for deriving an intra prediction mode based on a gradient of sample values ​​within a reconstructed area around the current block, a second derivation method for deriving an intra prediction mode based on a difference between a predicted value and a reconstructed value for a template of the current block, or a third derivation method for deriving an intra prediction mode based on a difference between sample sets within a reconstructed area around the current block. In the first paragraph, The step (S3810) of determining the transformation kernel set of the current block is: A step of deriving a first intra prediction mode of the current block based on a predefined derivation method when the mode of the current block is a non-regular intra mode; A step of determining a first set of transform kernels based on the derived first intra prediction mode and determining a second set of transform kernels based on the second intra prediction mode; and A method for decoding an image, comprising the step of determining a transform kernel set of the current block from among the first transform kernel set and the second transform kernel set. In paragraph 6, A method for decoding an image, wherein the second intra prediction mode includes at least one of a planar mode, a DC mode, a horizontal mode, a vertical mode, or a diagonal mode. In paragraph 6, A method for decoding an image, wherein the second intra prediction mode is derived as an intra prediction mode having the second smallest cost value among cost values ​​calculated for each intra prediction mode according to the derivation method used to derive the first intra prediction mode. In paragraph 6, A method for decoding an image, wherein the number of available transformation kernel candidates is determined differently when the first transformation kernel set is determined as the transformation kernel set of the current block and when the second transformation kernel set is determined as the transformation kernel set of the current block. In the first paragraph, A method for decoding an image, wherein the above transform kernel set includes at least one kernel set from among a Multiple Transform Set (MTS), a Low Frequency Non-Separable Transform (LFNST), or a Non-Separable Primary Transform (NSPT). In the method of encoding an image, A step (S4010) of determining a set of transformation kernels of the current block based on an intra prediction mode of the current block, wherein the set of transformation kernels includes a plurality of transformation kernel candidates; A step (S4020) of adaptively determining a transformation kernel candidate available for inverse transformation of the current block from among the plurality of transformation kernel candidates included in the transformation kernel set based on the characteristics of the current block; and A step (S4030) of generating a transform coefficient of the current block by performing a transform on a residual sample of the current block using a transform kernel candidate of the current block, A method for encoding an image, wherein a transform kernel candidate of the current block is selected from among the available transform kernel candidates. A step of determining a set of transform kernels of the current block based on an intra prediction mode of the current block, wherein the set of transform kernels includes a plurality of transform kernel candidates; A step of adaptively determining a transform kernel candidate available for inverse transformation of the current block from among the plurality of transform kernel candidates included in the transform kernel set based on the characteristics of the current block; and Storing a bitstream generated by a video encoding method, comprising the step of generating a transform coefficient of the current block by performing a transform on a residual sample of the current block using a transform kernel candidate of the current block, A computer-readable recording medium in which a transformation kernel candidate of the current block is selected from among the available transformation kernel candidates.

Citation Information

Patent Citations

  • System for determining dermatitis based on artificial intelligence and method thereof

    KR1020240079359A

  • A converter

    KR1020250115519A

  • Video signal processing method and device therefor

    WO2024058637A1