Methods and equipment for decoding images using content prediction, and methods and equipment for encoding images using content prediction.

VN127260APending Publication Date: 2026-07-15SAMSUNG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
VN1202604655
Authority / Receiving Office
VN · VN
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-04-03
Filing Date
2024-10-14
Publication Date
2026-07-15

AI Technical Summary

Technical Problem

Existing image encoding and decoding technologies face challenges in efficiently utilizing intra prediction to compress images, particularly in determining the optimal directional mode for predicting image blocks.

Method used

The proposed method involves identifying sample sets before a current block, obtaining predictive sample sets through intra prediction using these sample sets as references, determining the directional mode based on cost values, and restoring the current block using the determined directional mode.

Benefits of technology

This approach enhances the efficiency of image compression by accurately predicting image blocks and improving the decoding process, leading to better image quality and compression performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure VN1202604655_0
    Figure VN1202604655_0
Patent Text Reader

Abstract

The invention relates to a method for decoding an image in a scheme, which includes the following steps: identifying the first and second sample sets reconstructed prior to the current block; performing an internal prediction using any one of the first and second sample sets as a reference set for each of the first and second sample sets to obtain a number of predicted sample sets corresponding to the remaining of the first and second sample sets; determining the orientation for the current block from among the number of orientations based on the cost values ​​corresponding to the results of comparing each of the number of predicted sample sets with the remaining of the first and second sample sets; and reconstructing the current block by performing an internal prediction on the current block according to the determined orientation.
Need to check novelty before this filing date? Find Prior Art

Description

Method and device for decoding an image using intra prediction, and method and device for encoding an image using intra prediction

[0001] The present disclosure relates to the field of image encoding and decoding, and more particularly, to a device and method for encoding and decoding an image using intra prediction.

[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 can generate a predicted block based on the surrounding pixels of the current block, depending on the intra prediction mode. Then, the predicted block can be subtracted from the current block to generate a residual block. The intra prediction mode used to generate the predicted block can be signaled to the decoder through a predetermined method.

[0006] The residual block 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 block, and combine the predicted block of the current block with the residual 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 identifying a first sample set and a second sample set that were restored before a current block.

[0008] A method for decoding an image according to one embodiment may include a step of performing intra prediction using one of a first sample set and a second sample set as a reference sample set, according to each of a plurality of directional modes, to obtain a plurality of predicted sample sets corresponding to the other sample set.

[0009] A method of decoding an image according to one embodiment may include a step of determining a directional mode for a current block from among a plurality of directional modes based on cost values ​​corresponding to a comparison result of each of a plurality of prediction sample sets with another sample set.

[0010] A method for decoding an image according to one embodiment may include a step of performing intra prediction on a current block according to a determined directional mode to restore the current block.

[0011] A method of encoding an image according to one embodiment may include a step of identifying a first set of samples and a second set of samples encoded prior to a current block.

[0012] A method for encoding an image according to one embodiment may include a step of performing intra prediction using one of a first sample set and a second sample set as a reference sample set, according to each of a plurality of directional modes, to obtain a plurality of predicted sample sets corresponding to the other sample set.

[0013] A method of encoding an image according to one embodiment may include a step of determining a directional mode for a current block among a plurality of directional modes based on cost values ​​corresponding to a comparison result of each of a plurality of prediction sample sets with another sample set.

[0014] A method of encoding an image according to one embodiment may include a step of encoding a current block by performing intra prediction on the current block according to a determined directional mode.

[0015] A computer-readable recording medium according to one embodiment can record a bitstream including an encoding result of a current block.

[0016] In one embodiment, the encoding result of the current block can be generated by identifying a first set of samples and a second set of samples that were encoded prior to the current block.

[0017] In one embodiment, the encoding result of the current block can be generated by performing intra prediction using one of the first sample set and the second sample set as a reference sample set, according to each of the plurality of directional modes, to obtain a plurality of predicted sample sets corresponding to the other sample set.

[0018] In one embodiment, the encoding result of the current block can be generated by determining a directional mode for the current block among a plurality of directional modes based on cost values ​​corresponding to a comparison result of each of the plurality of prediction sample sets with another sample set.

[0019] In one embodiment, the encoding result of the current block can be generated by performing intra prediction on the current block according to the determined directional mode.

[0020] An image decoding device according to one embodiment may include at least one memory storing at least one instruction; and at least one processor.

[0021] In one embodiment, at least one processor can identify a first set of samples and a second set of samples that were restored before the current block.

[0022] In one embodiment, at least one processor can perform intra prediction using one of the first sample set and the second sample set as a reference sample set, according to each of the plurality of directional modes, to obtain a plurality of predicted sample sets corresponding to the other sample set.

[0023] In one embodiment, at least one processor can determine a directional mode for a current block from among a plurality of directional modes based on cost values ​​corresponding to a comparison result of each of a plurality of predicted sample sets with another sample set.

[0024] In one embodiment, at least one processor can perform intra prediction on the current block according to the determined directional mode to reconstruct the current block.

[0025] An image encoding device according to one embodiment may include at least one memory storing at least one instruction; and at least one processor.

[0026] In one embodiment, at least one processor can identify a first set of samples and a second set of samples encoded prior to the current block.

[0027] In one embodiment, at least one processor can perform intra prediction using one of the first sample set and the second sample set as a reference sample set, according to each of the plurality of directional modes, to obtain a plurality of predicted sample sets corresponding to the other sample set.

[0028] In one embodiment, at least one processor can determine a directional mode for a current block among a plurality of directional modes based on cost values ​​corresponding to a comparison result of each of the plurality of predicted sample sets with another sample set.

[0029] In one embodiment, at least one processor can encode the current block by performing intra prediction on the current block according to the determined directional mode.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0050] FIG. 21 is a diagram for explaining an intra sub-partition mode according to one embodiment.

[0051] FIG. 22 is a drawing for explaining a multiple reference line mode according to one embodiment.

[0052] FIG. 23 is a diagram showing types of intra prediction modes according to one embodiment.

[0053] FIG. 24 is a diagram illustrating sample sets required to derive an intra prediction mode according to one embodiment.

[0054] FIG. 25a is a diagram for explaining a method for calculating a cost value corresponding to a directional mode of a first group according to one embodiment.

[0055] FIG. 25b is a diagram for explaining a method for calculating a cost value corresponding to a directional mode of a first group according to one embodiment.

[0056] FIG. 26a is a diagram for explaining a method for calculating a cost value corresponding to a directional mode of a second group according to one embodiment.

[0057] FIG. 26b is a diagram for explaining a method for calculating a cost value corresponding to a directional mode of a second group according to one embodiment.

[0058] FIG. 27a is a diagram for explaining a method for calculating a cost value corresponding to a directional mode of a third group according to one embodiment.

[0059] FIG. 27b is a diagram for explaining a method for calculating a cost value corresponding to a directional mode of a third group according to one embodiment.

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

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

[0062] FIG. 30 is a diagram illustrating a method for determining sample values ​​of unavailable samples when some samples required to derive an intra prediction mode according to one embodiment are unavailable.

[0063] FIG. 31 is a diagram illustrating sample sets required to derive an intra prediction mode when a multiple reference line mode according to one embodiment is applied to a current block.

[0064] FIG. 32 is a diagram illustrating sample sets required to derive an intra prediction mode according to one embodiment when a block to the right of a current block is restored before the current block.

[0065] FIG. 33 is a diagram illustrating sample sets required to derive an intra prediction mode according to one embodiment when the left and right blocks of the current block are restored before the current block.

[0066] FIG. 34a is a diagram for explaining a process of deriving intra prediction modes of each of the sub-blocks divided from the upper block when the current block corresponds to a sub-block divided from the upper block according to one embodiment.

[0067] FIG. 34b is a diagram for explaining a process of deriving intra prediction modes of each of the sub-blocks divided from the upper block when the current block corresponds to a sub-block divided from the upper block according to one embodiment.

[0068] FIG. 35 is a diagram for explaining a method for restoring a current block through intra prediction using reference samples according to one embodiment.

[0069] FIG. 36 is a diagram illustrating a syntax structure related to an intra prediction mode of a luma block according to one embodiment.

[0070] FIG. 37 is a diagram illustrating a syntax structure related to an intra prediction mode of a luma block according to one embodiment.

[0071] FIG. 38 is a diagram illustrating a syntax structure related to an intra prediction mode of a luma block according to one embodiment.

[0072] FIG. 39 is a diagram illustrating a syntax structure related to an intra prediction mode of a luma block according to one embodiment.

[0073] FIG. 40 is a diagram illustrating a syntax structure related to an intra prediction mode of a luma block according to one embodiment.

[0074] FIG. 41 is a diagram illustrating a syntax structure related to an intra prediction mode of a chroma block according to one embodiment.

[0075] FIG. 42 is a diagram illustrating a syntax structure related to an intra prediction mode of a chroma block according to one embodiment.

[0076] Figure 43 is a flowchart of an image decoding method according to one embodiment.

[0077] Fig. 44 is a block diagram illustrating the configuration of an image encoding device according to one embodiment.

[0078] Figure 45 is a flowchart of an image encoding method according to one embodiment.

[0079] A method of decoding an image according to one embodiment may include a step of identifying a first sample set and a second sample set that were restored before a current block.

[0080] A method for decoding an image according to one embodiment may include a step of performing intra prediction using one of a first sample set and a second sample set as a reference sample set, according to each of a plurality of directional modes, to obtain a plurality of predicted sample sets corresponding to the other sample set.

[0081] A method of decoding an image according to one embodiment may include a step of determining a directional mode for a current block from among a plurality of directional modes based on cost values ​​corresponding to a comparison result of each of a plurality of prediction sample sets with another sample set.

[0082] A method for decoding an image according to one embodiment may include a step of performing intra prediction on a current block according to a determined directional mode to restore the current block.

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

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

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

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

[0087] In this 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 performed by other components.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0112] 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).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0131] 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).

[0132] 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).

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

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

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

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

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

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

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

[0140] 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).

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

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

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

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

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

[0146] 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).

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

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

[0149] 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).

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

[0151] 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).

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

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

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

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

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

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

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

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

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

[0161] 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).

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

[0163] 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).

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

[0165] 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).

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

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

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

[0169] 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).

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

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

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

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

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

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

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

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

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

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

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

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

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

[0183] 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).

[0184] 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).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0200] 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).

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

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

[0203] 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).

[0204] 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).

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

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

[0207] 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).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0224] 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).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0243] 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).

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

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

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

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

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

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

[0250] 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).

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

[0252] 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).

[0253] 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).

[0254] 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).

[0255] 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).

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

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

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

[0259] 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).

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

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

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

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

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

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

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

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

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

[0269] FIG. 20 is a block diagram illustrating the configuration of an image decoding device (2000) according to one embodiment.

[0270] Referring to FIG. 20, the image decoding device (2000) may include an acquisition unit (2010) and a prediction decoding unit (2030).

[0271] The acquisition unit (2010) and the prediction decoding unit (2030) may be implemented with at least one processor. The at least one processor may include various processing circuitry.

[0272] The acquisition unit (2010) and the prediction decoding unit (2030) can operate according to at least one instruction stored in at least one memory.

[0273] In one embodiment, the image decoding device (2000) may include at least one memory for storing input / output data of the acquisition unit (2010) and the prediction decoding unit (2030). The image decoding device (2000) may include a memory control unit for controlling data input / output of the at least one memory.

[0274] In one embodiment, the acquisition unit (2010) may correspond to the entropy decoding unit (1955) illustrated in FIG. 19, and the prediction decoding unit (2030) may correspond to the prediction decoding unit (1975) illustrated in FIG. 19.

[0275] The acquisition unit (2010) can acquire a bitstream generated as a result of encoding a picture. The bitstream can include an encoding result for the current block.

[0276] The current block may be a maximum coding unit, encoding unit, transformation unit, or prediction unit split from the current picture to be decoded. In one embodiment, the current block may be a sub-block split from a maximum coding unit, encoding unit, transformation unit, or prediction unit. In this case, a maximum coding unit, encoding unit, transformation unit, or prediction unit that includes multiple sub-blocks may be referred to as an upper block.

[0277] In one embodiment, the acquisition unit (2010) can receive a bitstream from an image encoding device over a network.

[0278] In one embodiment, the acquisition unit (2010) may acquire a bitstream from a data storage medium including a magnetic medium (e.g., a hard disk, a floppy disk, or a magnetic tape), an optical recording medium (e.g., a CD-ROM or DVD), and a magneto-optical medium (e.g., a floptical disk).

[0279] The acquisition unit (2010) can acquire syntax elements for decoding a picture from a bitstream. Values ​​corresponding to the syntax elements can be included in the bitstream according to the syntax structure.

[0280] The acquisition unit (2010) can obtain syntax elements by entropy decoding the bins constituting the bitstream.

[0281] The bitstream may include information about the prediction mode of the current block within the current picture. The prediction mode of the current block may be any one of a plurality of prediction modes, including an intra mode and an inter mode.

[0282] The prediction decoding unit (2030) can perform intra prediction or inter prediction on the current block according to the prediction mode of the current block to generate a prediction block of the current block, and can restore the current block using the prediction block.

[0283] The acquisition unit (2010) can acquire information about the intra prediction mode of the current block from the bitstream when the prediction mode of the current block is the intra mode.

[0284] Information about the intra prediction mode of the current block may include information indicating how the intra prediction mode is determined. The method for determining the intra prediction mode may include a method for deriving the intra prediction mode on the decoder side and a method for determining the intra prediction mode indicated by information included in the bitstream.

[0285] In one embodiment, information indicating how to determine the intra prediction mode may not be included in the bitstream, and the prediction decoding unit (2030) may determine the intra prediction mode of the current block according to a predetermined method.

[0286] In one embodiment, if information indicating an intra prediction mode is included in the bitstream, the prediction decoding unit (2030) may determine an intra prediction mode indicated by information obtained from the bitstream among a plurality of intra prediction modes as the intra prediction mode of the current block. The information indicating the intra prediction mode of the current block may include a flag or index indicating any one of the plurality of intra prediction modes.

[0287] In one embodiment, the prediction decoding unit (2030) can determine the intra prediction mode of the current block using samples restored before the current block, if the method of determining the intra prediction mode is a method of deriving the intra prediction mode on the decoder side.

[0288] The prediction decoding unit (2030) can determine which intra prediction mode among several intra prediction modes applicable to the current block is appropriate for the current block using samples restored before the current block. The prediction decoding unit (2030) can determine the intra prediction mode appropriate for the current block as the intra prediction mode of the current block.

[0289] The process of determining the intra prediction mode of the current block using samples restored before the current block is described later.

[0290] When a prediction block is generated through intra prediction or inter prediction for the current block, the prediction decoding unit (2030) can obtain a restored current block using the prediction block.

[0291] In one embodiment, the prediction decoding unit (2030) may determine the prediction block as the reconstructed current block. In one embodiment, the prediction decoding unit (2030) may combine the prediction block with residual data obtained from the bitstream by the acquisition unit (2010) to generate the reconstructed current block. The reconstructed current block may be used to decode the next block.

[0292] Below, tools available in the intra prediction process are described with reference to FIGS. 21 and 22.

[0293] FIG. 21 is a diagram for explaining an intra sub-partition mode according to one embodiment.

[0294] In intra-subpartition mode, a block (or upper block) is divided into sub-blocks, and intra prediction can be performed independently for each sub-block. The upper block can be divided in the horizontal direction and / or vertical direction. In one embodiment, the upper block can be a maximum coding unit, coding unit, transformation unit, or prediction unit divided from a picture.

[0295] In intra-subpartition mode, the intra-prediction mode determined for the upper block can be applied to all sub-blocks. For example, if the intra-prediction mode of the upper block is directional mode 34, the sub-blocks can be intra-predicted according to directional mode 34.

[0296] According to one embodiment, first information indicating whether intra sub-partition mode is applied and second information indicating a division type of an upper block may be included in the bitstream. The decoder may determine whether intra sub-partition mode is applied to the upper block based on the first information obtained from the bitstream, and if intra sub-partition mode is applied to the upper block, determine in what form the upper block should be divided into sub-blocks based on the second information.

[0297] Referring to FIG. 21, as the upper block (2100) is vertically divided into four, intra prediction can be sequentially performed for each of the four sub-blocks (2110, 2120, 2130, 2140).

[0298] If the decoding order of the first sub-block (2110) on the leftmost side among the four sub-blocks (2110, 2120, 2130, 2140) is the fastest, the first sub-block (2110) can be intra-predicted from reference samples located in the prediction direction indicated by the intra-prediction mode among the previously restored reference samples (2105).

[0299] The previously restored reference samples (2105) may be samples included in a block encoded or decoded before the upper block (2100). The previously restored reference samples (2105) may include samples located on the left side of the upper block (2100) and samples located above the upper block (2100).

[0300] When the reconstruction of the first sub-block (2110) is completed through intra prediction for the first sub-block (2110), the second sub-block (2120) can be intra-predicted according to the intra-prediction mode. Since the reconstruction of the first sub-block (2110) is completed, the intra-prediction for the second sub-block (2120) can use a newly reconstructed reference sample (2115) located on the left side of the second sub-block (2120) and a reference sample located on the upper side of the second sub-block (2120) among the previously reconstructed reference samples (2105). The newly reconstructed reference sample (2115) located on the left side of the second sub-block (2120) can be included in the first sub-block (2110).

[0301] When the restoration of the second sub-block (2120) is completed, the third sub-block (2130) can be intra-predicted according to the intra-prediction mode. Similar to the second sub-block (2120), intra-prediction for the third sub-block (2130) can use a newly restored reference sample (2125) located on the left side of the third sub-block (2130) and a reference sample located on the upper side of the third sub-block (2130) among the previously restored reference samples (2105). The newly restored reference sample (2125) located on the left side of the third sub-block (2130) can be included in the second sub-block (2120).

[0302] Similarly, intra prediction for the fourth sub-block (2140) may use a newly reconstructed reference sample (2135) located on the left side of the fourth sub-block (2140) and a reference sample located on the upper side of the fourth sub-block (2140) among the previously reconstructed reference samples (2105). The newly reconstructed reference sample (2135) located on the left side of the fourth sub-block (2140) may be included in the third sub-block (2130).

[0303] FIG. 21 illustrates a case where the upper block (2100) is divided in the vertical direction. Even if the upper block (2100) is divided in the horizontal direction, the first sub-block (e.g., the uppermost sub-block) among the sub-blocks can be intra-predicted from previously restored reference samples (2105) adjacent to the upper block (2100). In addition, among the sub-blocks divided from the upper block (2100), sub-blocks other than the first sub-block can be intra-predicted using samples included in previously restored sub-blocks as reference samples.

[0304] In one embodiment, since the intra sub-partition mode may deteriorate encoding / decoding efficiency when applied to very small blocks, the application of the intra sub-partition mode may be limited based on the size of the upper block (2100). For example, if the size of the upper block (2100) is smaller than a predetermined size, the intra sub-partition mode may not be applied to the upper block (2100), and information indicating whether the intra sub-partition mode is applied may be omitted from the bitstream.

[0305] FIG. 21 illustrates rectangular sub-blocks (2110, 2120, 2130, 2140), and in one embodiment, multiple square sub-blocks may be obtained through division of the upper block (2100).

[0306] In one embodiment, a minimum size (e.g., minimum width, minimum height, or minimum area) that a sub-block can have in intra-sub-partition mode may be preset. In this case, the sizes of the sub-blocks (2110, 2120, 2130, 2140) obtained through partitioning of the upper block (2100) may be equal to or larger than the minimum size.

[0307] FIG. 22 is a drawing for explaining a multiple reference line mode according to one embodiment.

[0308] In the multi-reference line mode, samples of a reference line selected from among multiple reference lines can be used as reference samples for intra prediction of the block (2100).

[0309] In one embodiment, information indicating a reference line used for intra prediction of a block (2100) may be included in the bitstream. A decoder may determine a reference line used for intra prediction of a block (2100) based on the information included in the bitstream, and perform intra prediction on the block (2100) using samples included in the determined reference line.

[0310] In one embodiment, when the information (intra_luma_ref_idx) indicating the reference line points to 0, samples of a line (2210) that are offset (or sample distance) of 1 in the x-axis direction and / or the y-axis direction from samples of the left boundary within the block (2100) and samples of the upper boundary within the block (2100) can be used for intra prediction of the block (2100).

[0311] In one embodiment, when the information (intra_luma_ref_idx) indicating the reference line points to 1, samples of a line (2220) that is offset by 2 in the x-axis direction and / or the y-axis direction from samples of the left boundary within the block (2100) and samples of the upper boundary within the block (2100) can be used for intra prediction of the block (2100).

[0312] In one embodiment, when the information indicating the reference line (intra_luma_ref_idx) points to 2, samples of a line (2230) that are offset by 3 in the x-axis direction and / or the y-axis direction from samples of the left boundary within the block (2100) and samples of the upper boundary within the block (2100) can be used for intra prediction of the block (2100).

[0313] In the multi-reference line mode, not only the samples immediately adjacent to the block (2100), but also samples that are offset by more than 1 from the boundary of the block (2100) can be used as reference samples, so that the accuracy of prediction can be improved.

[0314] The number and positions of the reference lines (2210, 2220, 2230) illustrated in FIG. 22 may vary.

[0315] Below, a method for determining the intra prediction mode of the current block is described.

[0316] FIG. 23 is a diagram showing types of intra prediction modes according to one embodiment.

[0317] To perform intra prediction for the current block, the prediction decoding unit (2030) can determine the intra prediction mode of the current block.

[0318] The intra prediction mode of the current block can be any one of multiple intra prediction modes.

[0319] In one embodiment, the plurality of intra prediction modes may include directional intra prediction modes and non-directional intra prediction modes. Hereinafter, the directional intra prediction mode may be referred to as a directional mode, and the non-directional intra prediction mode may be referred to as a non-directional mode.

[0320] Referring to FIG. 23, in one embodiment, the plurality of intra prediction modes may include a non-directional Planar mode of 0, a non-directional DC mode of 1, and a directional Angular mode of 2 to 66.

[0321] As wide angle intra prediction is adopted in the VVC standard, directional modes of -14 to -1 and directional modes of 67 to 80 can be used for rectangular blocks.

[0322] In angular modes, the locations of reference samples for generating prediction samples of the current block can be identified based on the prediction direction indicated by the angular modes. For example, in mode 34, reference samples located at a -32 degree angle relative to the samples in the current block can be identified, and the prediction block of the current block can be generated from the identified reference samples.

[0323] The predicted direction indicated by the angular modes can be referred to as the predicted angle. For example, the predicted angle indicated by the angular modes can be represented by the variable intraPredAngle.

[0324] The intra prediction modes illustrated in Fig. 23 are examples, and the number and types of intra prediction modes available for intra prediction can be set in various ways.

[0325] In standards such as High Efficiency Video Coding (HEVC) and Versatile Video Coding (VVC), the intra prediction mode indicated by information obtained from the bitstream can be determined as the intra prediction mode of the current block. In standards such as HEVC and VVC, which support dozens of intra prediction modes, an index or flag indicating one of the multiple intra prediction modes can be a factor that increases the bitrate.

[0326] In one embodiment, the prediction decoding unit (2030) may determine the intra prediction mode of the current block using samples reconstructed before the current block. In this case, information indicating one of the multiple intra prediction modes may be omitted from the bitstream, thereby reducing the bitrate of the bitstream.

[0327] Hereinafter, with reference to FIGS. 24 to 29, a method for deriving an intra prediction mode of a current block using samples restored before the current block is described.

[0328] FIG. 24 is a diagram illustrating sample sets required to derive an intra prediction mode according to one embodiment.

[0329] The prediction decoding unit (2030) can identify sample sets restored before the current block (2490) to determine the intra prediction mode of the current block (2490).

[0330] 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).

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

[0332] 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).

[0333] 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)).

[0334] In one embodiment, the prediction decoding unit (2030) 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.

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

[0336] 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).

[0337] 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).

[0338] 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).

[0339] 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).

[0340] The prediction decoding unit (2030) 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 prediction 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.

[0341] The prediction decoding unit (2030) 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 direction indicated by the plurality of directional modes.

[0342] The prediction decoding unit (2030) can determine which directional mode is appropriate for the current block (2490) by considering the prediction sample sets generated for 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).

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

[0344] In one embodiment, the prediction decoding unit (2030) can identify directional modes applicable to the current block (2490) before testing multiple directional modes, and determine an intra prediction mode of the current block (2490) from among the identified directional modes.

[0345] The prediction decoding unit (2030) 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 prediction decoding unit (2030) can identify that directional modes 8 to 72 are applicable to the current block (2490). In this case, the prediction decoding unit (2030) 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 prediction decoding unit (2030) can identify that directional modes 2 to 66 are applicable to the current block (2490). In this case, the prediction decoding unit (2030) can determine the intra prediction mode of the current block (2490) by testing directional modes 2 to 66.

[0346] In one embodiment, the predictive decoding unit (2030) can identify directional modes applicable to the current block (2490) based on the directional mode of a previous block 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.

[0347] 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).

[0348] The prediction decoding unit (2030) 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.

[0349] The prediction decoding unit (2030) 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.

[0350] For example, if the intra prediction mode of the previous block is a directional mode of k (where k is an integer), the prediction decoding unit (2030) may determine that a directional mode of k (where a is an integer) or a directional mode of k+a can be applied to the current block (2490).

[0351] Once the directional modes applicable to the current block (2490) are identified, the prediction decoding unit (2030) can test which of the identified directional modes is suitable for the current block (2490).

[0352] In one embodiment, the prediction decoding unit (2030) may 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.

[0353] For example, the prediction decoding unit (2030) 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.

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

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

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

[0357] 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 prediction decoding unit (2030). In other words, in one embodiment, the prediction decoding unit (2030) 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 prediction decoding unit (2030) can test the specific directional mode using predetermined sample sets without a separate grouping operation.

[0358] Referring to FIGS. 25a to 29, a method for calculating a cost value for each of a plurality of directional modes to determine an intra prediction mode of a current block (2490) is described.

[0359] FIG. 25a and FIG. 25b are diagrams for explaining a method for calculating a cost value corresponding to a directional mode of a first group according to one embodiment.

[0360] 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 located below the upper left sample (2410) restored before the current block (2490), and the second sample set (2440) may be located to the right of the upper left sample (2410) restored before the current block (2490).

[0361] The prediction decoding unit (2030) 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.

[0362] 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).

[0363] 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) with respect to that sample may be used.

[0364] 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, height of the current block (2490), edge strength of the first sample set (2420), or edge strength of the second sample set (2440). A method for calculating edge strength will be described later.

[0365] In one embodiment, the prediction decoding unit (2030) 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).

[0366] The prediction decoding unit (2030) can compare the prediction 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 prediction sample set and sample values ​​in the second sample set (2440).

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

[0368] 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).

[0369] 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 located above the upper left sample (2410) restored before the current block (2490), and the fourth sample set (2480) may be located to the left of the upper left sample (2410) restored before the current block (2490).

[0370] The prediction decoding unit (2030) 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.

[0371] 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).

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

[0373] 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 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).

[0374] In one embodiment, the prediction decoding unit (2030) 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).

[0375] 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).

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

[0377] The prediction decoding unit (2030) 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.

[0378] In one embodiment, the first preliminary cost value may be determined as the cost value of the directional mode of the first group.

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

[0380] Additionally, in one embodiment, a smaller value between 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.

[0381] Additionally, in one embodiment, an 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.

[0382] The prediction decoding unit (2030) can calculate cost values ​​for each of the plurality of directional modes when there are multiple directional modes classified into the first group.

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

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

[0385] The prediction decoding unit (2030) 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.

[0386] 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 fourth sample set (2480) located in the prediction direction (d2) 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 fourth sample set (2480) to generate a prediction sample of one sample in a first sample set (2420), where 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).

[0389] In one embodiment, the prediction decoding unit (2030) 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).

[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. 26b, a second sample set (2440) and a third sample set (2460) may be used for testing the directional mode of the second group.

[0392] The prediction decoding unit (2030) 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.

[0393] 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).

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

[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 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).

[0396] In one embodiment, the prediction decoding unit (2030) 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).

[0397] 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).

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

[0399] The prediction decoding unit (2030) 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.

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

[0401] Additionally, 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.

[0402] Additionally, in one embodiment, a 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.

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

[0404] The prediction decoding unit (2030) can calculate cost values ​​for each of the plurality of directional modes when there are multiple directional modes classified into the second group.

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

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

[0407] The prediction decoding unit (2030) 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.

[0408] 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).

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

[0410] 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), where 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).

[0411] In one embodiment, the prediction decoding unit (2030) 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).

[0412] 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).

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

[0414] The prediction decoding unit (2030) 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.

[0415] 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).

[0416] To generate a prediction sample of any 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.

[0417] 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).

[0418] In one embodiment, the prediction decoding unit (2030) 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).

[0419] 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).

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

[0421] The prediction decoding unit (2030) 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.

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

[0423] Additionally, 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.

[0424] Additionally, in one embodiment, a 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.

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

[0426] The prediction decoding unit (2030) can calculate cost values ​​for each of the plurality of directional modes when there are multiple directional modes classified into the third group.

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

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

[0429] The prediction decoding unit (2030) 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).

[0430] 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).

[0431] 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).

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

[0433] The prediction decoding unit (2030) 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.

[0434] 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).

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

[0436] The prediction decoding unit (2030) 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.

[0437] In one embodiment, the first preliminary cost value of the horizontal mode may be determined as the cost value of the horizontal mode.

[0438] Additionally, in one embodiment, the second preliminary cost value of the horizontal mode may be determined as the cost value of the horizontal mode.

[0439] Additionally, 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.

[0440] Additionally, 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.

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

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

[0443] The prediction decoding unit (2030) 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).

[0444] 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).

[0445] 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).

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

[0447] The prediction decoding unit (2030) 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.

[0448] 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).

[0449] For vertical mode, the cost value calculated based on the first sample set (2420) and the upper left sample (2410) may 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) may be referred to as the second preliminary cost value.

[0450] The prediction decoding unit (2030) 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.

[0451] In one embodiment, the first preliminary cost value of the vertical mode may be determined as the cost value of the vertical mode.

[0452] Additionally, in one embodiment, the second preliminary cost value of the vertical mode may be determined as the cost value of the vertical mode.

[0453] Additionally, 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.

[0454] Additionally, 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.

[0455] 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 prediction decoding unit (2030) 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).

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

[0457] 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 prediction decoding unit (2030) may determine the directional mode with the smallest MAD as the intra prediction mode of the current block (2490).

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

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

[0460] In one embodiment, the prediction decoding unit (2030) may 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).

[0461] 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 prediction decoding unit (2030) can determine the directional mode with the smallest cost value as the representative directional mode of the first group. Since the numbers 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.

[0462] 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 prediction decoding unit (2030) 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.

[0463] The prediction decoding unit (2030) can 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). Here, 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.

[0464] According to the embodiment described above, multiple directional modes can be tested based on sample sets reconstructed prior to the current block (2490), and the intra prediction mode of the current block (2490) can be determined based on the test results. The reason for testing multiple directional modes based on sample sets is because it is assumed that the current block (2490) and sample sets adjacent to the current block (2490) will share a certain directionality.

[0465] Therefore, if there is no directionality (or edge) within the sample sets, it may be desirable to determine the intra prediction mode of the current block (2490) as a non-directional mode.

[0466] The prediction decoding unit (2030) can determine whether an edge exists in at least one of the first sample set (2420), the second sample set (2440), the third sample set (2460), or the fourth sample set (2480) illustrated in FIG. 24.

[0467] In one embodiment, the prediction decoding unit (2030) can determine the intra prediction mode of the current block (2490) through the testing process of the directional modes described above, if an edge exists in at least one sample set.

[0468] In one embodiment, the prediction decoding unit (2030) may determine the prediction mode of the current block (2490) to be non-directional mode if there is no edge within at least one sample set.

[0469] For example, if there is no edge in the first sample set (2420) and the second sample set (2440), the prediction decoding unit (2030) may determine the intra prediction mode of the current block (2490) as a non-directional Planar mode of number 0 or a non-directional DC mode of number 1. If there is an edge in at least one of the first sample set (2420) and the second sample set (2440), the prediction decoding unit (2030) may perform a test on directional modes and determine the intra prediction mode of the current block (2490) among the directional modes based on the test result.

[0470] The prediction decoding unit (2030) can calculate the edge strength of the sample set to determine whether an edge exists.

[0471] In one embodiment, the edge strength of a sample set can be determined through the second derivative (Laplacian) value.

[0472] In one embodiment, when the coordinates of the upper left sample included in the current block (2490) are (0, 0), the coordinates of the samples included in the first sample set (2420) or the third sample set (2460) are (x, y), and the sample value of the sample of (x, y) is p[x][y], the edge strength of the first sample set (2420) or the third sample set (2460) can be calculated according to the following mathematical expression 1.

[0473]

[0474] The x-coordinates of the samples in the first sample set (2420) or the third sample set (2460) may all be the same. When the coordinate of the sample located at the topmost position in the first sample set (2420) or the third sample set (2460) is (x, a), and the coordinate of the sample located at the bottommost position in the first sample set (2420) or the third sample set (2460) is (x, b), y may have a value of a to b.

[0475] In one embodiment, when the coordinates of the upper left sample included in the current block (2490) are (0, 0), the coordinates of the samples included in the second sample set (2440) or the fourth sample set (2480) are (x, y), and the sample value of the sample of (x, y) is p[x][y], the edge strength of the second sample set (2440) or the fourth sample set (2480) can be calculated according to the following mathematical expression 2.

[0476]

[0477] The y-coordinates of the samples in the second sample set (2440) or the fourth sample set (2480) may all be the same. When the coordinate of the leftmost sample in the second sample set (2440) or the fourth sample set (2480) is (c, y), and the coordinate of the rightmost sample in the second sample set (2440) or the fourth sample set (2480) is (d, y), x may have a value of c to d.

[0478] In one embodiment, the prediction decoding unit (2030) may calculate an edge strength according to Equation 1 or Equation 2 for at least one of the first sample set (2420), the second sample set (2440), the third sample set (2460), or the fourth sample set (2480), and if the calculated edge strength is less than a predetermined threshold value, it may be determined that no edge exists in the sample set.

[0479] For example, the prediction decoding unit (2030) can calculate the edge strength for the first sample set (2420) according to Equation 1 and can calculate the edge strength for the second sample set (2440) according to Equation 2. Then, the prediction decoding unit (2030) can determine the intra prediction mode of the current block (2490) as a non-directional mode if the edge strength for the first sample set (2420) is less than a predetermined threshold value and the edge strength for the second sample set (2440) is less than a predetermined threshold value. The prediction decoding unit (2030) can perform a test on directional modes to determine the intra prediction mode of the current block (2490) if at least one of the edge strength for the first sample set (2420) or the edge strength for the second sample set (2440) is greater than or equal to a predetermined threshold value.

[0480] In one embodiment, the prediction decoding unit (2030) may calculate the absolute value of the difference between the maximum sample value and the minimum sample value within the sample set as the edge strength of the sample set. If the edge strength of the sample set is less than a predetermined threshold value, the prediction decoding unit (2030) may determine that no edge exists in the sample set. If the edge strength of the sample set is greater than or equal to a predetermined threshold value, the prediction decoding unit (2030) may determine that an edge exists in the sample set.

[0481] The prediction decoding unit (2030) may determine the intra prediction mode of the current block (2490) as a non-directional mode if the absolute value of the difference between the maximum sample value and the minimum sample value in the first sample set (2420) is less than a predetermined threshold value and the absolute value of the difference between the maximum sample value and the minimum sample value in the second sample set (2440) is less than a predetermined threshold value. The prediction decoding unit (2030) may perform a test on directional modes to determine the intra prediction mode of the current block (2490) if at least one of the absolute value of the difference between the maximum sample value and the minimum sample value in the first sample set (2420) or the absolute value of the difference between the maximum sample value and the minimum sample value in the second sample set (2440) is greater than or equal to a predetermined threshold value.

[0482] In one embodiment, the prediction decoding unit (2030) may also calculate the edge strength of the sample set as the absolute value of the difference between the maximum sample value and the minimum sample value within the sample set divided by the width or height of the current block (2490).

[0483] For example, the absolute value of the difference between the maximum sample value and the minimum sample value in the first sample set (2420) or the third sample set (2460) divided by the width of the current block (2490) may be calculated as the edge strength of the first sample set (2420) or the third sample set (2460). Additionally, for example, the absolute value of the difference between the maximum sample value and the minimum sample value in the second sample set (2440) or the fourth sample set (2480) divided by the height of the current block (2490) may be calculated as the edge strength of the second sample set (2440) or the fourth sample set (2480).

[0484] The reason why the absolute value of the difference between the maximum sample value and the minimum sample value in the first sample set (2420) or the third sample set (2460) is divided by the width of the current block (2490) is because even if an edge exists on the left side of the current block (2490), the influence of the left side edge on the current block (2490) varies depending on the width of the current block (2490). For example, even if a strong edge exists on the left side of the current block (2490), if the width of the current block (2490) is large, the possibility that the left side edge exists inside the current block (2490) may be small. Conversely, even if a weak edge exists on the left side of the current block (2490), the possibility that the left side edge exists inside the current block (2490) may be large if the width of the current block (2490) is small.

[0485] Similarly, even if an edge exists on the upper side of the current block (2490), the influence of the upper edge on the current block (2490) may vary depending on the height of the current block (2490), so the absolute value of the difference between the maximum sample value and the minimum sample value in the second sample set (2440) or the fourth sample set (2480) divided by the height of the current block (2490) may be calculated as the edge strength.

[0486] In one embodiment, the threshold value to be compared with the edge strength can be determined in various ways.

[0487] For example, the threshold value may have a value predetermined between the image encoding device and the image decoding device (2000).

[0488] Additionally, as an example, the threshold value can be adaptively determined based on the bit depth of the image. For example, the threshold value can be determined using the following mathematical expression 3.

[0489]

[0490] In mathematical expression 3, << can be a bitwise operator, bitDepth can be a bit depth, and N can be a predetermined constant.

[0491] In addition, as an example, the threshold value may be adaptively determined based on the color component of the current block (2490). For example, one of several values ​​predetermined between the image encoding device and the image decoding device (2000) may be determined as the threshold value based on whether the color component of the current block (2490) is a luma component or a chroma component. In addition, for example, N in mathematical expression 3 may have a different value depending on whether the color component of the current block (2490) is a luma component or a chroma component.

[0492] Below, we describe how to determine the samples used to derive the intra prediction mode of the current block in various situations.

[0493] FIG. 30 is a diagram illustrating a method for determining sample values ​​of unavailable samples when some samples required to derive an intra prediction mode according to one embodiment are unavailable.

[0494] To derive the intra prediction mode of the current block (2490), at least one of the upper left sample (2410) restored before the current block (2490), the first sample set (2420) located below the upper left sample (2410), the second sample set (2440) located to the right of the upper left sample (2410), the third sample set (2460) located above the upper left sample (2410), or the fourth sample set (2480) located to the left of the upper left sample (2410) may be used.

[0495] The prediction decoding unit (2030) can determine the sample values ​​of samples that are necessary for deriving the intra prediction mode of the current block (2490) among the upper left sample (2410) and the samples included in the first sample set (2420) to the fourth sample set (2480), but are unavailable, according to a predetermined method.

[0496] The unavailability of a sample may include at least one of the following: the sample is located outside the boundary of the image, or the sample is contained in a different upper block (e.g., a tile) than the upper block containing the current block (2490).

[0497] In one embodiment, the prediction decoding unit (2030) may determine the sample values ​​of unavailable samples as predetermined values ​​(e.g., 0). For example, the sample values ​​of unavailable samples may be predetermined between the image decoding device (2000) and the image encoding device, or may be determined from information included in the bitstream.

[0498] In one embodiment, the prediction decoding unit (2030) can determine the sample values ​​of the unavailable samples by using the sample values ​​of the available samples closest to the unavailable samples.

[0499] Referring to FIG. 30, when the left boundary of the current block (2490) corresponds to the left boundary of the current image (2400), the upper left sample (2410) of the current block (2490), the samples included in the first sample set (2420), the samples included in the third sample set (2460), and the samples included in the fourth sample set (2480) may be located outside the current image (2400). The samples located outside the current image (2400) may be identified as unavailable samples.

[0500] Since the samples (2401, 2402, 2403, 2404, 2405, 2406) located at the left boundary of the current image (2400) are closest to the sample (2461) located at the bottom of the third sample set (2460), the upper left sample (2410), and the samples (2421, 2422, 2423, 2424) included in the first sample set (2420), the prediction decoding unit (2030) compares the sample values ​​of each of the samples (2401, 2402, 2403, 2404, 2405, 2406) located at the left boundary of the current image (2400) to each of the unavailable samples (2461, 2410, 2421, 2422, 2423, 2424). It can be determined by the sample value. The arrow shown in Fig. 30 can indicate the direction in which the sample value is copied.

[0501] Since the closest available sample from among the samples included in the fourth sample set (2480) is the sample (2402) located to the right of the upper left sample (2410), the sample values ​​of the samples included in the fourth sample set (2480) can be determined as the sample value of the right sample (2402) of the upper left sample (2410). In addition, since the closest available sample from among the samples included in the third sample set (2460) is the upper left sample (2401) in the current image (2400), the sample values ​​of the samples included in the third sample set (2460) can be determined as the sample value of the upper left sample (2401) in the current image (2400).

[0502] In one embodiment, the prediction decoding unit (2030) can identify samples (or a set of samples) required for testing a specific directional mode, and if at least some of the identified samples are unavailable, determine sample values ​​of the unavailable samples according to a predetermined method.

[0503] In one embodiment, the prediction decoding unit (2030) may determine a non-directional mode as the intra prediction mode of the current block (2490) if at least one of the upper left sample (2410), the first sample set (2420), the second sample set (2440), the third sample set (2460), or the fourth sample set (2480) of the current block (2490) is unavailable. For example, if the first sample set (2420) or the second sample set (2440) is unavailable, the prediction decoding unit (2030) may determine a Planar mode or a DC mode as the intra prediction mode of the current block (2490).

[0504] FIG. 31 is a diagram illustrating sample sets required to derive an intra prediction mode when a multiple reference line mode according to one embodiment is applied to a current block.

[0505] As described above, in the multi-reference line mode, samples of a reference line selected from among multiple reference lines can be used as reference samples for intra prediction of the current block (2490).

[0506] The prediction decoding unit (2030) can identify sample sets used to derive the intra prediction mode of the current block (2490) based on a reference line selected from among multiple reference lines.

[0507] In one embodiment, the prediction decoding unit (2030) may identify sample sets used to derive an intra prediction mode from a reference line used for intra prediction. For example, if the reference line used for intra prediction is offset by 2 from the current block (2490), sample sets may be identified at locations offset by 2 from the current block (2490).

[0508] In one embodiment, the prediction decoding unit (2030) may identify sample sets for deriving an intra prediction mode based on a reference line at a predetermined location, regardless of the reference line used for intra prediction.

[0509] FIG. 31 illustrates sample sets (3120, 3140, 3160, 3180) identified based on a reference line that is offset (or sample distance) of 2 in the x-axis direction and / or the y-axis direction from samples of the left boundary of the current block (2490) and samples of the upper boundary of the current block (2490). For example, the sample sets (3120, 3140, 3160, 3180) illustrated in FIG. 31 may be sample sets when information indicating the reference line (intra_luma_ref_idx) indicates 1.

[0510] When the coordinates of the upper left sample in the current block (2490) are (x, y), the coordinates of the upper left sample (3110) restored before the current block (2490) may be (x-2, y-2). The upper left sample (3110) used in the multi-reference line mode may be located at the upper left of the upper left sample (2410) described above with reference to FIG. 24. The first sample set (3120), the second sample set (3140), the third sample set (3160), and the fourth sample set (3180) may be identified in the downward, rightward, upward, and leftward directions of the upper left sample (3110) at the (x-2, y-2) coordinates, respectively.

[0511] In one embodiment, when sample sets are identified based on a reference line that is an offset (or sample distance) of 3 in the x-axis direction and / or the y-axis direction from samples of the left boundary of the current block (2490) and samples of the upper boundary of the current block (2490), the coordinates of the upper left sample may be (x-3, y-3). Then, a first sample set, a second sample set, a third sample set, and a fourth sample set may be identified in the lower direction, rightward direction, upper direction, and leftward direction of the upper left sample of the (x-3, y-3) coordinate, respectively.

[0512] In one embodiment, when a multiple reference line mode is applied to the current block (2490), the same reference line can be used when deriving the intra prediction mode of the current block (2490) and when generating prediction samples of the current block (2490), so that the accuracy of the prediction can be further improved.

[0513] FIG. 32 is a diagram illustrating sample sets used to derive an intra prediction mode according to one embodiment when a block to the right of a current block is restored before the current block.

[0514] In one embodiment, the left block of the current block (2490) may be restored before the current block (2490), or the right block of the current block (2490) may be restored before the current block (2490).

[0515] If the left block of the current block (2490) is restored before the current block (2490), sample sets can be identified centered on the upper left sample (2410) restored before the current block (2490), as shown in FIG. 24.

[0516] In one embodiment, if the right block of the current block (2490) is restored before the current block (2490), sample sets can be identified centered around the upper right sample (3210) restored before the current block (2490), as illustrated in FIG. 32.

[0517] Specifically, a first sample set (3220) may be identified in the lower direction of the upper right sample (3210) restored before the current block (2490), and a second sample set (3240) may be identified in the left direction of the upper right sample (3210). In addition, a third sample set (3260) may be identified in the upper direction of the upper right sample (3210), and a fourth sample set (3280) may be identified in the right direction of the upper right sample (3210).

[0518] In one embodiment, when the coordinates of the upper left sample inside the current block (2490) are (x, y), the coordinates of the upper right sample (3210) restored before the current block (2490) may be (x+w, y-1). Here, w may be the width of the current block (2490).

[0519] In one embodiment, when the coordinates of the upper right sample (3210) are (x+w, y-1), the coordinates of the samples included in the first sample set (3220) may be (x+w, y) to (x+w, y+a) (a+1 is the number of samples included in the first sample set (3220)). In addition, the coordinates of the samples included in the second sample set (3240) may be (x+wb, y-1) to (x+w-1, y-1) (b is the number of samples included in the second sample set (3240)). In addition, the coordinates of the samples included in the third sample set (3260) may be (x+w, yc) to (x+w, y-2) (c-1 is the number of samples included in the third sample set (3260)). Additionally, the coordinates of the samples included in the fourth sample set (3280) may be (x+w+1, y-1) to (x+w+d, y-1) (d is the number of samples included in the fourth sample set (3280)).

[0520] In one embodiment, for testing the directional mode of the first group illustrated in FIGS. 25A and 25B, the first sample set (3220) or the second sample set (3240) may be used as a reference sample set, and a prediction sample set of the fourth sample set (3280) or the third sample set (3260) may be generated.

[0521] In one embodiment, for testing the directional mode of the second group illustrated in FIGS. 26a and 26b, the second sample set (3240) or the third sample set (3260) may be used as a reference sample set, and a prediction sample set of the first sample set (3220) or the fourth sample set (3280) may be generated.

[0522] In one embodiment, for testing the directional mode of the third group illustrated in FIGS. 27a and 27b, the fourth sample set (3280) or the third sample set (3260) may be used as a reference sample set, and a prediction sample set of the first sample set (3220) or the second sample set (3240) may be generated.

[0523] In one embodiment, for testing the horizontal mode illustrated in FIG. 28, the second sample set (3240) may be used as a reference sample set, and a prediction sample of the upper right sample (3210) may be generated. Alternatively, the upper right sample (3210) may be used as a reference sample, and a prediction sample set of the fourth sample set (3280) may be generated.

[0524] In one embodiment, for testing the vertical mode illustrated in FIG. 29, the third sample set (3260) may be used as a reference sample set, and a prediction sample of the upper right sample (3210) may be generated. Alternatively, the upper right sample (3210) may be used as a reference sample, and a prediction sample set of the first sample set (3220) may be generated.

[0525] In one embodiment, if the right block of the current block (2490) is reconstructed before the current block (2490), the sample sets used to derive the intra prediction mode of the current block (2490) may be identified based on a reference line that is a predetermined offset (or sample distance) in the x-axis direction and / or the y-axis direction from the samples of the right boundary of the current block (2490) and the samples of the upper boundary of the current block (2490).

[0526] FIG. 33 is a diagram illustrating sample sets used to derive an intra prediction mode according to one embodiment when the left and right blocks of the current block are restored before the current block.

[0527] In one embodiment, the left and right blocks of the current block (2490) may be restored before the current block (2490).

[0528] If both the left block and the right block of the current block (2490) are restored before the current block (2490), sample sets can be identified centered on the upper left sample (3310) and the upper right sample (3360) that were restored before the current block (2490).

[0529] As illustrated in FIG. 33, a first sample set (3320) can be identified in the lower direction of the upper left sample (3310) restored before the current block (2490), and a second sample set (3330) can be identified in the right direction of the upper left sample (3310). Additionally, a third sample set (3340) can be identified in the upper direction of the upper left sample (3310), and a fourth sample set (3350) can be identified in the left direction of the upper left sample (3310). Additionally, a fifth sample set (3370) can be identified in the lower direction of the upper right sample (3360) restored before the current block (2490), a sixth sample set (3380) can be identified in the upper direction of the upper right sample (3360), and a seventh sample set (3390) can be identified in the right direction of the upper right sample (3360).

[0530] In one embodiment, the prediction decoding unit (2030) can test directional modes using at least one of the upper left sample (3310), the upper right sample (3360), the first sample set (3320), the second sample set (3330), the third sample set (3340), the fourth sample set (3350), the fifth sample set (3370), the sixth sample set (3380), or the seventh sample set (3390).

[0531] For example, for testing the directional mode of the first group, the first sample set (3320) may be used as a reference sample set, and a prediction sample set of the second sample set (3330) may be generated. Alternatively, the fourth sample set (3350) may be used as a reference sample set, and a prediction sample set of the third sample set (3340) may be generated. Alternatively, the fifth sample set (3370) may be used as a reference sample set, and a prediction sample set of the seventh sample set (3390) may be generated. Alternatively, the second sample set (3330) may be used as a reference sample set, and a prediction sample set of the sixth sample set (3380) may be generated.

[0532] Additionally, for example, for testing the directional mode of the second group, the fourth sample set (3350) may be used as a reference sample set, and a prediction sample set of the first sample set (3320) may be generated. Alternatively, the third sample set (3340) may be used as a reference sample set, and a prediction sample set of the second sample set (3330) may be generated. Alternatively, the second sample set (3330) may be used as a reference sample set, and a prediction sample set of the fifth sample set (3370) may be generated. Alternatively, the sixth sample set (3380) may be used as a reference sample set, and a prediction sample set of the seventh sample set (3390) may be generated.

[0533] Additionally, for example, for testing the directional mode of the third group, the second sample set (3330) may be used as a reference sample set, and a prediction sample set of the first sample set (3320) may be generated. Alternatively, the third sample set (3340) may be used as a reference sample set, and a prediction sample set of the fourth sample set (3350) may be generated. Alternatively, the seventh sample set (3390) may be used as a reference sample set, and a prediction sample set of the fifth sample set (3370) may be generated. Alternatively, the sixth sample set (3380) may be used as a reference sample set, and a prediction sample set of the second sample set (3330) may be generated.

[0534] Also, for example, for testing in horizontal mode, the fourth sample set (3350) may be used as a reference sample set, and a prediction sample of the upper left sample (3310) may be generated. Alternatively, the upper left sample (3310) may be used as a reference sample, and a prediction sample set of the second sample set (3330) may be generated. Alternatively, the second sample set (3330) may be used as a reference sample set, and a prediction sample of the upper right sample (3360) may be generated. Alternatively, the upper right sample (3360) may be used as a reference sample, and a prediction sample set of the seventh sample set (3390) may be generated.

[0535] Also, for example, for testing in vertical mode, the third sample set (3340) may be used as a reference sample set, and a prediction sample of the upper left sample (3310) may be generated. Alternatively, the upper left sample (3310) may be used as a reference sample, and a prediction sample set of the first sample set (3320) may be generated. Alternatively, the sixth sample set (3380) may be used as a reference sample set, and a prediction sample of the upper right sample (3360) may be generated. Alternatively, the upper right sample (3360) may be used as a reference sample, and a prediction sample set of the fifth sample set (3370) may be generated.

[0536] FIG. 34a and FIG. 34b are diagrams for explaining a process of deriving intra prediction modes of each of the sub-blocks divided from the upper block when the current block corresponds to a sub-block divided from the upper block according to one embodiment.

[0537] As described with reference to FIG. 21, when the intra sub-partition mode is applied to a higher-order block including sub-blocks, intra prediction can be performed independently for each sub-block. At this time, the first sub-block in the decoding order can use samples restored before the higher-order block as reference samples, and each of the sub-blocks decoded after the first sub-block can use samples within the sub-block for which decoding has been completed as reference samples.

[0538] In one embodiment, the prediction decoding unit (2030) may independently derive the intra prediction mode of each sub-block when the intra sub-partition mode is applied to the upper block including the sub-blocks.

[0539] As illustrated in FIG. 34a, when four sub-blocks (3410, 3420, 3430, 3440) are determined as the upper block (3400) is vertically divided, sample sets (3450, 3460, 3470, 3480) adjacent to each of the four sub-blocks (3410, 3420, 3430, 3440) can be used to derive intra prediction modes for each of the four sub-blocks (3410, 3420, 3430, 3440).

[0540] In one embodiment, a set of samples (3450) reconstructed before the upper block (3400) may be used to derive an intra prediction mode of the first sub-block (3410). Once the intra prediction mode of the first sub-block (3410) is determined, intra prediction using reference samples reconstructed before the upper block (3400) may be performed on the first sub-block (3410) according to the determined intra prediction mode. In one embodiment, at least a portion of the set of samples (3450) reconstructed before the upper block (3400) may be used as reference samples for intra prediction.

[0541] Next, a set of samples (3460) reconstructed before the second sub-block (3420) may be used to derive an intra prediction mode of the second sub-block (3420), and at least a portion of the set of samples (3460) reconstructed before the second sub-block (3420) may be included in the first sub-block (3410). Once the intra prediction mode of the second sub-block (3420) is determined, intra prediction using reference samples reconstructed before the second sub-block (3420) may be performed on the second sub-block (3420) according to the determined intra prediction mode. In one embodiment, at least a portion of the set of samples (3460) reconstructed before the second sub-block (3420) (e.g., samples included in the first sub-block (3410)) may be used as reference samples for intra prediction.

[0542] Similarly, a set of samples (3470) reconstructed before the third sub-block (3430) may be used to derive an intra prediction mode of the third sub-block (3430), and at least a portion of the set of samples (3470) reconstructed before the third sub-block (3430) may be included in the second sub-block (3420). Furthermore, a set of samples (3480) reconstructed before the fourth sub-block (3440) may be used to derive an intra prediction mode of the fourth sub-block (3440), and at least a portion of the set of samples (3480) reconstructed before the fourth sub-block (3440) may be included in the third sub-block (3430).

[0543] In one embodiment, when deriving intra prediction modes of the second sub-block (3420), the third sub-block (3430), and the fourth sub-block (3440) among the plurality of sub-blocks (3410, 3420, 3430, 3440), the intra prediction mode of the previous sub-block may be considered. For example, when deriving the intra prediction mode of the second sub-block (3420), the intra prediction mode of the first sub-block (3410) may be considered, and when deriving the intra prediction mode of the third sub-block (3430), the intra prediction mode of the second sub-block (3420) may be considered. Considering the intra prediction mode of the previous sub-block may mean that only directional modes adjacent to the directional mode of the previous sub-block are tested to determine the intra prediction mode of the next sub-block. Directional modes adjacent to the directional mode of the previous sub-block may mean directional modes having mode numbers that are identical / similar to the mode number of the directional mode of the previous sub-block.

[0544] For example, when the intra prediction mode of the first sub-block (3410) is a directional mode of k (where k is an integer), the prediction decoding unit (2030) can test the directional mode of k (where a is an integer) to the directional mode of k+a to determine the intra prediction mode of the second sub-block (3420).

[0545] FIG. 34a illustrates that the sub-blocks (3410, 3420, 3430, 3440) are rectangular in shape, but as illustrated in FIG. 34b, the sub-blocks (3410, 3420, 3430, 3440) divided from the upper block (3400) may also be square in shape.

[0546] When four square-shaped sub-blocks (3410, 3420, 3430, 3440) are determined as the upper block (3400) is divided in the vertical and horizontal directions, sample sets (3450, 3460, 3470, 3480) adjacent to each of the four sub-blocks (3410, 3420, 3430, 3440) can be used to derive intra prediction modes for each of the four sub-blocks (3410, 3420, 3430, 3440).

[0547] In one embodiment, when the decoding order of the first sub-block (3410) is the earliest in the raster scan order, a sample set (3450) reconstructed before the upper block (3400) may be used to derive an intra prediction mode of the first sub-block (3410). Once the intra prediction mode of the first sub-block (3410) is determined, intra prediction using reference samples reconstructed before the upper block (3400) may be performed on the first sub-block (3410) according to the determined intra prediction mode. In one embodiment, at least a portion of the sample set (3450) reconstructed before the upper block (3400) may be used as reference samples for intra prediction.

[0548] Next, a set of samples (3460) reconstructed before the second sub-block (3420) may be used to derive an intra prediction mode of the second sub-block (3420), and at least a portion of the set of samples (3460) reconstructed before the second sub-block (3420) may be included in the first sub-block (3410). Once the intra prediction mode of the second sub-block (3420) is determined, intra prediction using reference samples reconstructed before the second sub-block (3420) may be performed on the second sub-block (3420) according to the determined intra prediction mode. In one embodiment, at least a portion of the set of samples (3460) reconstructed before the second sub-block (3420) (e.g., samples included in the first sub-block (3410)) may be used as reference samples for intra prediction.

[0549] A set of samples (3470) reconstructed before the third sub-block (3430) may be used to derive an intra prediction mode of the third sub-block (3430), and at least a part of the set of samples (3470) reconstructed before the third sub-block (3430) may be included in the first sub-block (3410).

[0550] A sample set (3480) reconstructed before the fourth sub-block (3440) may be used to derive an intra prediction mode of the fourth sub-block (3440). A part of the sample set (3480) reconstructed before the fourth sub-block (3440) may be included in the first sub-block (3410), another part may be included in the second sub-block (3420), and another part may be included in the third sub-block (3430).

[0551] In one embodiment, as described with reference to FIG. 34A, when deriving the intra prediction modes of the second sub-block (3420), the third sub-block (3430), and the fourth sub-block (3440) among the plurality of sub-blocks (3410, 3420, 3430, 3440), the intra prediction modes of the previous sub-blocks may be considered. For example, when deriving the intra prediction mode of the second sub-block (3420), the intra prediction mode of the first sub-block (3410) may be considered, and when deriving the intra prediction mode of the third sub-block (3430), the intra prediction mode of at least one of the first sub-block (3410) or the second sub-block (3420) may be considered. Additionally, for example, when deriving the intra prediction mode of the fourth sub-block (3440), the intra prediction mode of at least one of the first sub-block (3410), the second sub-block (3420), or the third sub-block (3430) may be considered.

[0552] In one embodiment, the upper block (3400) may be split into sub-blocks (3410, 3420, 3430, 3440) if the size (e.g., width, height, or area) of the upper block (3400) is greater than or equal to a predetermined minimum size. In other words, the intra sub-partition mode may be applied to the upper block (3400) if the size of the upper block (3400) is greater than or equal to a predetermined minimum size.

[0553] In one embodiment, the size of the sub-blocks (3410, 3420, 3430, 3440) may be equal to or greater than a predetermined minimum size.

[0554] In one embodiment, the minimum size of an upper block that can be divided into sub-blocks and / or the minimum size that the sub-blocks can have may be predetermined between the image encoding device and the image decoding device (2000).

[0555] In one embodiment, information about the minimum size of an upper block that can be divided into sub-blocks and / or information about the minimum size that the sub-blocks can have may be transmitted from an image encoding device to an image decoding device (2000).

[0556] In one embodiment, if the current block (2490) described above corresponds to a sub-block divided from an upper block, and there is a sub-block reconstructed before the current block (2490), a sample included in the sub-block reconstructed before the current block (2490) may be included in a sample set for deriving an intra-prediction mode of the current block (2490). In one embodiment, the intra-prediction mode of a sub-block reconstructed before the current block (2490) may be considered to derive the intra-prediction mode of the current block (2490).

[0557] In one embodiment, if the current block (2490) described above corresponds to a sub-block divided from an upper block, and there is no sub-block restored before the current block (2490), a sample outside the upper block restored before the current block (2490) may be included in the sample set for deriving the intra prediction mode of the current block (2490).

[0558] According to one embodiment, in the intra sub-partition mode, samples included in a previous sub-block can be used to derive an intra prediction mode of a next sub-block and can also be used to generate prediction samples of the next sub-block, so that the accuracy of prediction of sub-blocks can be improved.

[0559] FIG. 35 is a diagram for explaining a method for restoring a current block through intra prediction using reference samples adjacent to the current block according to one embodiment.

[0560] Once the intra prediction mode of the current block (2490) is determined, the prediction decoding unit (2030) can generate prediction samples of the current block (2490) using reference samples (3500) adjacent to the current block (2490). In one embodiment, the size of the prediction block including the prediction samples can be the same as the size of the current block (2490). In one embodiment, filtering according to the intra prediction mode can be applied to the reference samples (3500).

[0561] As illustrated in FIG. 35, reference samples (3500) adjacent to the current block (2490) may include samples located to the left of the current block (2490) and samples located above the current block (2490). In one embodiment, at least some of the reference samples (3500) adjacent to the current block (2490) may be included in a sample set used to derive an intra prediction mode of the current block (2490).

[0562] The prediction decoding unit (2030) can obtain a restored current block using the prediction block of the current block (2490).

[0563] In one embodiment, the prediction decoding unit (2030) may determine a prediction block as the reconstructed current block. In one embodiment, the prediction decoding unit (2030) may combine residual data obtained from a bitstream with the prediction block to generate the reconstructed current block.

[0564] Below, a method for generating a prediction block used to determine the restored current block is described.

[0565] In one embodiment, the prediction decoding unit (2030) can obtain a prediction block of the current block (2490) by using reference samples located in the prediction direction indicated by the intra prediction mode when one of the directional modes is determined as the intra prediction mode of the current block (2490) through testing for multiple directional modes.

[0566] In one embodiment, if there is no edge included in the sample sets, the non-directional mode may be determined as the intra prediction mode of the current block (2490), and the prediction decoding unit (2030) may obtain a prediction block of the current block (2490) according to the non-directional mode.

[0567] In one embodiment, when one directional mode is selected through testing for multiple directional modes, the prediction decoding unit (2030) can generate a first preliminary prediction block through intra prediction according to the selected directional mode. Then, the prediction decoding unit (2030) can generate a second preliminary prediction block through intra prediction according to a predetermined non-directional mode (e.g., Planar mode or DC mode), and can generate a final prediction block by combining the first preliminary prediction block and the second preliminary prediction block. In one embodiment, the final prediction block can be generated through a weighted sum of samples in the first preliminary prediction block and samples in the second preliminary prediction block.

[0568] In one embodiment, a directional mode suitable for the current block (2490) may be selected based on a cost value corresponding to each of a plurality of directional modes. The prediction decoding unit (2030) may generate a first preliminary prediction block through intra prediction according to the directional mode corresponding to the smallest cost value, and may then generate a second preliminary prediction block through intra prediction according to the directional mode corresponding to the next smallest cost value. The prediction decoding unit (2030) may generate a final prediction block by combining (e.g., weighting) the first preliminary prediction block and the second preliminary prediction block.

[0569] In one embodiment, the prediction decoding unit (2030) may select two or more directional modes based on cost values ​​corresponding to the plurality of directional modes, and generate two or more preliminary prediction blocks through intra prediction according to the two or more directional modes. In addition, the prediction decoding unit (2030) may combine (e.g., weighted sum) the plurality of preliminary prediction blocks to generate a final prediction block.

[0570] In one embodiment, the prediction decoding unit (2030) may generate two or more preliminary prediction blocks according to two or more directional modes selected based on cost values ​​corresponding to the plurality of directional modes. The prediction decoding unit (2030) may also generate a final prediction block by combining (e.g., weighting) two or more preliminary prediction blocks corresponding to two or more directional modes with a preliminary prediction block generated according to a non-directional mode.

[0571] In one embodiment, the final predicted block may be determined as the reconstructed current block, or the reconstructed current block may be generated from a combination of the final predicted block and residual data.

[0572] Below, the process of obtaining syntax elements related to the intra prediction mode of the current block is described.

[0573] Figures 36, 37, 38, 39 and 40 illustrate syntax structures related to intra prediction modes when the current block is a luma block.

[0574] First, referring to FIG. 36, in S3605, dimd_flag can be obtained from the bitstream. dimd_flag can indicate whether the dimd (decoder-side intra prediction mode derivation) tool is applied to the current block.

[0575] The dimd tool may refer to a technique for deriving an intra prediction mode of a current block using sample sets adjacent to the current block.

[0576] In the above-described embodiment, since a directional mode suitable for the current block can be selected through testing of directional modes, the dimd tool may also be referred to as a clp (cross line prediction) tool.

[0577] When dimd_flag indicates that the dimd tool is applied to the current block (e.g., dimd_flag has a value of 1), in S3610, intra_luma_ref_idx can be obtained from the bitstream. intra_luma_ref_idx can point to any one of several reference lines in multiple reference line mode. As described above with reference to FIG. 22, when intra_luma_ref_idx points to 0, samples of a line that is offset 1 (or sample distance) from the current block can be used for intra prediction of the current block. In addition, when intra_luma_ref_idx points to 1, samples of a line that is offset 2 from the current block can be used for intra prediction of the current block. In addition, when intra_luma_ref_idx points to 2, samples of a line that is offset 3 from the current block can be used for intra prediction of the current block.

[0578] If intra_luma_ref_idx points to 0 and the width (cbwidth) and height (cbheight) of the current block are less than or equal to a predetermined size (MaxTbSizeY), then in S3615, intra_subpartitions_mode_flag can be obtained from the bitstream.

[0579] The intra_subpartitions_mode_flag may indicate whether the intra sub-partition mode is applied to the current block. In one embodiment, if the intra_subpartitions_mode_flag indicates that the intra sub-partition mode is applied to the current block, information indicating the partitioning pattern of the current block may be further obtained from the bitstream.

[0580] Since intra_subpartitions_mode_flag is acquired when intra_luma_ref_idx points to 0, we can see that the intra sub-partition mode can be applied to the current block only if a line that is an offset (or sample distance) of 1 from the current block is used for intra prediction of the current block.

[0581] When intra_subpartitions_mode_flag points to 1, intra prediction for each sub-block can be performed independently, as described with reference to FIG. 21.

[0582] In S3620, dimd_intra_prediction() may be executed. As dimd_intra_prediction() is executed, an intra prediction mode of the current block may be derived based on the aforementioned sample sets.

[0583] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), sample sets necessary for deriving the intra prediction mode of the current block can be identified based on the value pointed to by intra_luma_ref_idx, as described with reference to FIG. 31.

[0584] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), the intra prediction mode of each of the sub-blocks partitioned from the current block may be independently determined according to the intra sub-partition mode, as described with reference to FIGS. 34A and 34B . In one embodiment, in deriving the intra prediction mode of the first sub-block in the decoding order, samples reconstructed before the current block may be used. In order to derive the intra prediction mode of the sub-blocks after the first sub-block, samples adjacent to the sub-block may be used, and in this case, some of the samples adjacent to the sub-block may be included in a previously reconstructed sub-block.

[0585] If the dimd tool is not applied to the current block (e.g., dimd_flag has a value of 0), in step S3625, intra_mip_flag can be obtained from the bitstream.

[0586] intra_mip_flag can indicate whether the mip (Matrix-based Intra Prediction) tool is applied to the current block, where prediction samples can be generated by multiplying a preset matrix with reference samples.

[0587] When the mip tool is applied to the current block, that is, when intra_mip_flag has a value of 1, in S3630, intra_mip_mode can be obtained from the bitstream. intra_mip_mode can indicate the type of matrix used in the mip tool.

[0588] If the mip tool is not applied to the current block, i.e., if intra_mip_flag has a value of 0, then in S3635, intra_luma_ref_idx can be obtained from the bitstream.

[0589] If intra_luma_ref_idx points to 0 and the width (cbwidth) and height (cbheight) of the current block are less than or equal to a predetermined size (MaxTbSizeY), then in S3640, intra_subpartitions_mode_flag can be acquired from the bitstream. In one embodiment, if intra_subpartitions_mode_flag indicates that the intra sub-partition mode is applied to the current block, information indicating the partitioning form of the current block can be further acquired from the bitstream.

[0590] If intra_luma_ref_idx points to 0, intra_luma_mpm_flag can be acquired in S3645. intra_luma_mpm_flag can indicate whether the intra prediction mode of the current block is determined from the most probable mode (mpm) derived based on the intra prediction modes of neighboring blocks adjacent to the current block.

[0591] In one embodiment, if the intra prediction mode of a neighboring block adjacent to the current block is determined according to the dimd tool, the intra prediction mode determined according to the dimd tool may be determined by mpm.

[0592] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is determined from mpm, intra_luma_mpm_idx can be obtained from the bitstream in S3650. intra_luma_mpm_idx can point to the intra prediction mode of the current block among the intra prediction modes corresponding to mpm.

[0593] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is not determined from the mpm, in S3655, intra_luma_mpm_remainder can be obtained from the bitstream. The intra_luma_mpm_remainder can point to the intra prediction mode of the current block among the intra prediction modes excluding the intra prediction modes corresponding to the mpm.

[0594] In one embodiment, a dimd_flag indicating whether the dimd tool is applied may be included in the bitstream for each block segmented from the image. For example, dimd_flags for each coding unit to which the intra mode is applied may be included in the bitstream.

[0595] In one embodiment, information indicating whether a dimd tool is available may be included in the bitstream for a higher-order block (e.g., a slice, a tile, or a maximum coding unit) that includes the current block, and if the information indicates that the dimd tool is available, a dimd_flag for the current block (e.g., the current coding unit) may be included in the bitstream. If the information indicating whether a dimd tool is available indicates that the dimd tool is not available, dimd_flags for lower-order blocks included in the higher-order block may be omitted from the bitstream.

[0596] In one embodiment, information indicating whether the dimd tool is available may be included in the sequence parameter set, picture parameter set, or slice header of the bitstream. In one embodiment, dimd_flag may be included in the slice data of the bitstream.

[0597] In one embodiment, when dimd_flag is 1, information indicating whether combining multiple preliminary prediction blocks is required to generate a prediction block of the current block may be further included in the bitstream. For example, when combining multiple preliminary prediction blocks is required, the prediction decoding unit (2030) may combine multiple preliminary prediction blocks described with reference to FIG. 35 to generate a prediction block of the current block.

[0598] In one embodiment, when dimd_flag is 1, it may be determined that intra sub-partition mode and / or multiple reference line mode are not applicable to the current block. In this case, information related to intra sub-partition mode (e.g., intra_subpartitions_mode_flag) and / or information related to multiple reference line mode (e.g., intra_luma_ref_idx) may be omitted from the bitstream.

[0599] Next, referring to FIG. 37, in S3705, intra_mip_flag can be obtained from the bitstream.

[0600] In S3710, intra_mip_mode can be obtained from the bitstream when intra_mip_flag indicates that the mip tool is applied to the current block.

[0601] If intra_mip_flag indicates that the mip tool is not applied to the current block, then in S3715, dimd_flag can be obtained from the bitstream.

[0602] If dimd_flag indicates that the dimd tool is applied to the current block (e.g., dimd_flag has a value of 1), in S3720, intra_luma_ref_idx can be obtained from the bitstream.

[0603] If intra_luma_ref_idx points to 0 and the width (cbwidth) and height (cbheight) of the current block are less than or equal to a predetermined size (MaxTbSizeY), then in S3725, intra_subpartitions_mode_flag can be acquired from the bitstream. In one embodiment, if intra_subpartitions_mode_flag indicates that the intra sub-partition mode is applied to the current block, information indicating the partitioning form of the current block can be further acquired from the bitstream.

[0604] In S3730, dimd_intra_prediction() may be executed. As dimd_intra_prediction() is executed, an intra prediction mode of the current block may be derived based on the aforementioned sample sets.

[0605] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), sample sets necessary for deriving the intra prediction mode of the current block can be identified based on the value pointed to by intra_luma_ref_idx, as described with reference to FIG. 31.

[0606] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), the intra prediction mode of each of the sub-blocks partitioned from the current block can be independently determined according to the intra sub-partition mode, as described with reference to FIGS. 34a and 34b.

[0607] If the dimd tool is not applied to the current block (e.g., dimd_flag has a value of 0), in S3735, the intra_luma_ref_idx can be obtained from the bitstream.

[0608] If intra_luma_ref_idx points to 0 and the width (cbwidth) and height (cbheight) of the current block are less than or equal to a predetermined size (MaxTbSizeY), then in S3740, intra_subpartitions_mode_flag can be obtained from the bitstream.

[0609] If intra_luma_ref_idx points to 0, intra_luma_mpm_flag can be acquired in S3745.

[0610] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is determined from mpm, intra_luma_mpm_idx can be obtained from the bitstream in S3750.

[0611] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is not determined from mpm, in S3755, intra_luma_mpm_remainder can be obtained from the bitstream.

[0612] Next, referring to FIG. 38, in S3805, intra_mip_flag can be obtained from the bitstream.

[0613] In S3810, intra_mip_mode can be obtained from the bitstream when intra_mip_flag indicates that the mip tool is applied to the current block.

[0614] If intra_mip_flag indicates that the mip tool is not applied to the current block, then at S3815, intra_luma_ref_idx can be obtained from the bitstream, and at S3820, dimd_flag can be obtained from the bitstream.

[0615] If dimd_flag indicates that the dimd tool is applied to the current block (e.g., dimd_flag has a value of 1), intra_luma_ref_idx indicates 0, and the width (cbwidth) and height (cbheight) of the current block are less than or equal to a predetermined size (MaxTbSizeY), then in S3825, intra_subpartitions_mode_flag can be acquired from the bitstream. In one embodiment, if intra_subpartitions_mode_flag indicates that the intra sub-partition mode is applied to the current block, information indicating a partitioning form of the current block can be further acquired from the bitstream.

[0616] In S3830, dimd_intra_prediction() may be executed. As dimd_intra_prediction() is executed, an intra prediction mode of the current block may be derived based on the aforementioned sample sets.

[0617] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), sample sets necessary for deriving the intra prediction mode of the current block can be identified based on the value pointed to by intra_luma_ref_idx, as described with reference to FIG. 31.

[0618] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), the intra prediction mode of each of the sub-blocks partitioned from the current block can be independently determined according to the intra sub-partition mode, as described with reference to FIGS. 34a and 34b.

[0619] If the dimd tool is not applied to the current block (e.g., dimd_flag has a value of 0), intra_luma_ref_idx points to 0, and the width (cbwidth) and height (cbheight) of the current block are less than or equal to a predetermined size (MaxTbSizeY), then in S3835, intra_subpartitions_mode_flag can be obtained from the bitstream.

[0620] If intra_luma_ref_idx points to 0, intra_luma_mpm_flag can be acquired in S3840.

[0621] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is determined from mpm, intra_luma_mpm_idx can be obtained from the bitstream in S3845.

[0622] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is not determined from mpm, in S3850, intra_luma_mpm_remainder can be obtained from the bitstream.

[0623] Next, referring to FIG. 39, in S3905, intra_mip_flag can be obtained from the bitstream.

[0624] In S3910, intra_mip_mode can be obtained from the bitstream when intra_mip_flag indicates that the mip tool is applied to the current block.

[0625] If intra_mip_flag indicates that the mip tool is not applied to the current block, in S3915, the intra_luma_ref_idx can be obtained from the bitstream.

[0626] If intra_luma_ref_idx points to 0 and the width (cbwidth) and height (cbheight) of the current block are less than or equal to a predetermined size (MaxTbSizeY), then in S3920, intra_subpartitions_mode_flag can be acquired from the bitstream. In one embodiment, if intra_subpartitions_mode_flag indicates that the intra sub-partition mode is applied to the current block, information indicating the partitioning form of the current block can be further acquired from the bitstream.

[0627] If intra_mip_flag indicates that the mip tool is not applied to the current block, then in S3925, dimd_flag can be obtained from the bitstream.

[0628] If dimd_flag indicates that the dimd tool is applied to the current block (e.g., if dimd_flag has a value of 1), then in S3930, dimd_intra_prediction() may be executed. As dimd_intra_prediction() is executed, an intra prediction mode of the current block may be derived based on the aforementioned sample sets.

[0629] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), sample sets necessary for deriving the intra prediction mode of the current block can be identified based on the value pointed to by intra_luma_ref_idx, as described with reference to FIG. 31.

[0630] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), the intra prediction mode of each of the sub-blocks partitioned from the current block can be independently determined according to the intra sub-partition mode, as described with reference to FIGS. 34a and 34b.

[0631] If the dimd tool is not applied to the current block (e.g., dimd_flag has a value of 0), and intra_luma_ref_idx points to 0, intra_luma_mpm_flag can be obtained from S3935.

[0632] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is determined from mpm, intra_luma_mpm_idx can be obtained from the bitstream in S3940.

[0633] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is not determined from mpm, in S3945, intra_luma_mpm_remainder can be obtained from the bitstream.

[0634] Next, referring to FIG. 40, in S4005, intra_mip_flag can be obtained from the bitstream.

[0635] In S4010, intra_mip_mode can be obtained from the bitstream when intra_mip_flag indicates that the mip tool is applied to the current block.

[0636] If intra_mip_flag indicates that the mip tool is not applied to the current block, in S4015, the intra_luma_ref_idx can be obtained from the bitstream.

[0637] If intra_luma_ref_idx points to 0 and the width (cbwidth) and height (cbheight) of the current block are less than or equal to a predetermined size (MaxTbSizeY), then in S4020, intra_subpartitions_mode_flag can be acquired from the bitstream. In one embodiment, if intra_subpartitions_mode_flag indicates that the intra sub-partition mode is applied to the current block, information indicating the partitioning form of the current block can be further acquired from the bitstream.

[0638] If intra_luma_ref_idx points to 0, intra_luma_mpm_flag can be acquired in S4025.

[0639] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is determined from mpm, intra_luma_mpm_idx can be obtained from the bitstream in S4030.

[0640] If intra_luma_mpm_flag indicates that the intra prediction mode of the current block is not determined from mpm, in S4035, dimd_flag can be obtained from the bitstream.

[0641] If dimd_flag indicates that the dimd tool is applied to the current block (e.g., if dimd_flag has a value of 1), then in S4040, dimd_intra_prediction() may be executed. As dimd_intra_prediction() is executed, an intra prediction mode of the current block may be derived based on the aforementioned sample sets.

[0642] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), sample sets necessary for deriving the intra prediction mode of the current block can be identified based on the value pointed to by intra_luma_ref_idx, as described with reference to FIG. 31.

[0643] In one embodiment, when the intra prediction mode of the current block is derived by executing dimd_intra_prediction(), the intra prediction mode of each of the sub-blocks partitioned from the current block can be independently determined according to the intra sub-partition mode, as described with reference to FIGS. 34a and 34b.

[0644] If the dimd tool is not applied to the current block (e.g., dimd_flag has a value of 0), in S4045, intra_luma_mpm_remainder can be obtained from the bitstream.

[0645] Comparing the syntax structures illustrated in FIGS. 36 to 40, in FIG. 36, dimd_flag can be acquired first, and in FIG. 37, after intra_mip_flag is acquired, dimd_flag can be acquired when intra_mip_flag points to 0. In FIG. 38, when intra_mip_flag is acquired and intra_mip_flag points to 0, dimd_flag can be acquired following intra_luma_ref_idx. In FIG. 39, when intra_mip_flag is acquired and intra_mip_flag points to 0, dimd_flag can be acquired following intra_luma_ref_idx and intra_subpartitions_mode_flag. In Fig. 40, it can be seen that after intra_luma_mpm_flag is acquired, dimd_flag is acquired when intra_luma_mpm_flag points to 0.

[0646] That is, when referring to the syntax structures illustrated in FIGS. 36 to 40, dimd_flag according to one embodiment may be included in the bitstream in various orders together with other syntax elements.

[0647] Figures 41 and 42 illustrate syntax structures related to intra prediction modes when the current block is a chroma block.

[0648] Referring to FIG. 41, in S4105, dimd_flag can be obtained from the bitstream. In one embodiment, dimd_flag for a luma block and dimd_flag for a chroma block can be included separately in the bitstream.

[0649] If dimd_flag indicates that the dimd tool is applied to the current block (e.g., if dimd_flag has a value of 1), then in S4110, dimd_intra_prediction() may be executed. As dimd_intra_prediction() is executed, an intra prediction mode of the current block may be derived based on the aforementioned sample sets.

[0650] If the dimd tool is not applied to the current block (e.g., dimd_flag has a value of 0), in S4115, cclm_mode_flag can be obtained from the bitstream. cclm_mode_flag can indicate whether the cross-component linear model (CCLM) tool is applied to the current block.

[0651] The CCLM tool is a technique for determining predicted sample values ​​of chroma blocks from sample values ​​of a restored luma block, and can be based on the high correlation characteristic between the luminance block and the chroma block. In the CCLM tool, the sample values ​​of the chroma block can be predicted by applying the sample values ​​of the restored luma block to a linear model.

[0652] When the CCLM tool is applied to the current block, cclm_mode_idx can be obtained from the bitstream in S4120. cclm_mode_idx can point to one of several CCLM modes. Depending on the CCLM mode, the location of samples within the luma block applied to the linear model may vary.

[0653] If the CCLM tool is not applied to the current block, in S4125, intra_chroma_pred_mode can be obtained from the bitstream.

[0654] intra_chroma_pred_mode may indicate an intra prediction mode of the current block among several intra prediction modes. Several intra prediction modes may be determined in advance between the image decoding device (2000) and the image encoding device.

[0655] In one embodiment, the multiple intra prediction modes may include a direct mode. If intra_chroma_pred_mode indicates a direct mode, the intra prediction mode of the luma block may be determined as the intra prediction mode of the chroma block.

[0656] In the syntax structure illustrated in FIG. 41, since dimd_flag is acquired for a chroma block separately from a luma block, if the intra prediction mode of the luma block is determined through the dimd tool, the direct mode may be omitted among the multiple intra prediction modes that intra_chroma_pred_mode may indicate. This is because, if the dimd_flag of the luma block has a value of 1 and the dimd_flag of the chroma block has a value of 0, and intra_chroma_pred_mode indicates the direct mode, a contradiction may occur in which the intra prediction mode of the chroma block is determined by the dimd tool even though the dimd_flag has a value of 0. In summary, in one embodiment, if the intra prediction mode of the luma block is not determined through the dimd tool, intra_chroma_pred_mode may point to any one of n intra prediction modes (where n is a natural number greater than 1) including the direct mode, and if the intra prediction mode of the luma block is determined through the dimd tool, intra_chroma_pred_mode may point to any one of n-1 intra prediction modes not including the direct mode.

[0657] Next, referring to FIG. 42, at S4205, cclm_mode_flag can be obtained from the bitstream.

[0658] When the CCLM tool is applied to the current block, in S4210, cclm_mode_idx can be obtained from the bitstream.

[0659] If the CCLM tool is not applied to the current block, in S4215, the dimd_flag can be obtained from the bitstream. In one embodiment, the dimd_flag for the luma block and the dimd_flag for the chroma block can be included separately in the bitstream.

[0660] If dimd_flag indicates that the dimd tool is applied to the current block (e.g., if dimd_flag has a value of 1), then at S4220, dimd_intra_prediction() may be executed. As dimd_intra_prediction() is executed, an intra prediction mode of the current block may be derived based on the aforementioned sample sets.

[0661] If the dimd tool is not applied to the current block (e.g., dimd_flag has a value of 0), in S4225, intra_chroma_pred_mode can be obtained from the bitstream.

[0662] intra_chroma_pred_mode may indicate an intra prediction mode of the current block among multiple intra prediction modes. The multiple intra prediction modes may be predetermined, and in one embodiment, the multiple intra prediction modes may include a direct mode. If intra_chroma_pred_mode indicates a direct mode, the intra prediction mode of the luma block may be determined as the intra prediction mode of the chroma block.

[0663] As described with reference to FIG. 41, when the intra prediction mode of the luma block is determined through the dimd tool, the direct mode may be omitted from among the multiple intra prediction modes that intra_chroma_pred_mode may point to. In other words, when the intra prediction mode of the luma block is not determined through the dimd tool, intra_chroma_pred_mode may point to any one of n intra prediction modes (where n is a natural number greater than 1) including the direct mode, and when the intra prediction mode of the luma block is determined through the dimd tool, intra_chroma_pred_mode may point to any one of n-1 intra prediction modes not including the direct mode.

[0664] In one embodiment, in the syntax structure illustrated in FIG. 42, the dimd_flag may not be included in the bitstream. Instead, the dimd tool may be included among the multiple intra prediction modes that intra_chroma_pred_mode may indicate. Accordingly, if intra_chroma_pred_mode indicates the dimd tool, the intra prediction mode of the current block may be determined based on the dimd tool.

[0665] In one embodiment, values ​​0 to k-1 may be assigned to k intra prediction modes (where k is a natural number greater than 1), and the intra prediction mode of the current block may be determined from among the intra prediction modes having values ​​0 to k-1 from a bin string corresponding to intra_chroma_pred_mode.

[0666] The correspondence between the empty string corresponding to intra_chroma_pred_mode and the value it points to can be illustrated as follows. In the example below, (a, b) can mean that the value of a corresponds to the empty string of b. For example, the empty string of 100 can point to the value 0.

[0667] (0, 100), (1, 101), (2, 110), (3, 111), (4, 00), (5, 01)

[0668] The above example shows the case where the number of intra prediction modes that intra_chroma_pred_mode can point to is 6. The number of intra prediction modes that intra_chroma_pred_mode can point to is not limited to 6.

[0669] In one embodiment, if the intra prediction modes that intra_chroma_pred_mode can point to include dimd tool and direct mode, the values ​​corresponding to the shortest length binstring, for example, 4 and 5 in the above example, can be assigned to dimd tool and direct mode. This can reduce the number of bits included in the bitstream by using a short length binstring to point to values ​​corresponding to dimd tool and direct mode when there is a high probability that dimd tool and direct mode will be used in the chroma block.

[0670] In one embodiment, if intra_chroma_pred_mode points to direct mode and the intra prediction mode of the luma block is determined according to the dimd tool, the intra prediction mode of the luma block determined according to the dimd tool may be determined as the intra prediction mode of the chroma block.

[0671] In one embodiment, if intra_chroma_pred_mode points to direct mode and the intra prediction mode of the luma block is determined according to the dimd tool, the intra prediction mode of the chroma block may also be determined according to the dimd tool.

[0672] Figure 43 is a flowchart of an image decoding method according to one embodiment.

[0673] At step S4310, the image decoding device (2000) can identify the first sample set and the second sample set that were restored before the current block.

[0674] In one embodiment, the first sample set may be located below the upper left sample restored before the current block, and the second sample set may be located to the right of the upper left sample.

[0675] The image decoding device (2000) can identify a third sample set located above the upper left sample and a fourth sample set located to the left of the upper left sample, along with the first sample set and the second sample set.

[0676] In one embodiment, the image decoding device (2000) can identify sample sets based on the upper right sample restored before the current block, if the right block of the current block is restored before the current block.

[0677] In one embodiment, the image decoding device (2000) can identify sample sets based on samples that are located a predetermined offset in the x-axis direction and the y-axis direction from the upper left sample within the current block.

[0678] In one embodiment, the image decoding device (2000) may determine sample values ​​of unavailable samples according to a predetermined method when some of the samples constituting the upper left sample and the sample sets are unavailable.

[0679] In step S4320, the image decoding device (2000) can perform intra prediction using one of the first sample set and the second sample set as a reference sample set, according to each of the plurality of directional modes, to obtain a plurality of predicted sample sets corresponding to the other sample set.

[0680] In one embodiment, for a directional mode belonging to one group, a first sample set may be used as a reference sample set, and a prediction sample set corresponding to the second sample set may be generated. And, for a directional mode belonging to another group, a second sample set may be used as a reference sample set, and a prediction sample set corresponding to the first sample set may be generated.

[0681] In one embodiment, for vertical mode, the upper left sample reconstructed before the current block may be used as a reference sample, and a set of predicted samples corresponding to the first set of samples may be generated. Furthermore, for horizontal mode, the upper left sample reconstructed before the current block may be used as a reference sample, and a set of predicted samples corresponding to the second set of samples may be generated.

[0682] A detailed description of a method for generating prediction sample sets based on multiple directional modes is omitted as it has been described with reference to FIGS. 25a to 29.

[0683] In step S4330, the image decoding device (2000) can determine a directional mode for the current block among a plurality of directional modes based on cost values ​​corresponding to the plurality of directional modes.

[0684] In one embodiment, cost values ​​corresponding to a plurality of directional modes can be derived from a comparison result between a plurality of prediction sample sets generated based on the plurality of directional modes and sample sets that are targets of prediction.

[0685] In one embodiment, the cost values ​​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 multiple prediction sample sets and the sample sets.

[0686] In one embodiment, MAD may be used to compare cost values ​​of directional modes belonging to different groups, and SAD, SSE, or MR-SAD may be used to compare cost values ​​of directional modes belonging to the same group. In one embodiment, even if directional modes belong to different groups, SAD, SSE, or MR-SAD may also be used if the number of samples included in the prediction sample sets is the same.

[0687] In one embodiment, when a plurality of directional modes are classified by group, the image decoding device (2000) can select a representative directional mode from each group, compare cost values ​​of the representative directional modes of each group, and select one of the representative directional modes as a directional mode for the current block.

[0688] At step S4340, the image decoding device (2000) can perform intra prediction on the current block according to the directional mode for the current block to restore the current block.

[0689] When a prediction block of a current block is generated, the video decoding device (2000) can obtain a current block restored from the prediction block.

[0690] In one embodiment, the video decoding device (2000) may determine a prediction block as a reconstructed current block. In one embodiment, the video decoding device (2000) may generate a reconstructed current block by combining residual data obtained from a bitstream and the prediction block.

[0691] In one embodiment, the image decoding device (2000) can obtain a prediction block of the current block according to a non-directional mode when no edge is included in the sample sets.

[0692] In one embodiment, the video decoding device (2000) may generate a first preliminary prediction block according to a directional mode for a current block, and may generate a second preliminary prediction block according to a predetermined non-directional mode (e.g., Planar mode or DC mode). The video decoding device (2000) may combine the first preliminary prediction block and the second preliminary prediction block to generate a final prediction block.

[0693] In one embodiment, the video decoding device (2000) may generate a first preliminary prediction block according to a directional mode corresponding to a smallest cost value among cost values ​​corresponding to each of a plurality of directional modes, and may generate a second preliminary prediction block according to a directional mode corresponding to a next smallest cost value. The video decoding device (2000) may generate a third prediction block by combining (e.g., weighting) the first preliminary prediction block and the second preliminary prediction block.

[0694] In one embodiment, the image decoding device (2000) may select two or more directional modes based on cost values ​​corresponding to each of the plurality of directional modes, and generate two or more preliminary prediction blocks according to each of the two or more directional modes. Then, the image decoding device (2000) may combine (e.g., weighted sum) the plurality of preliminary prediction blocks to generate a final prediction block.

[0695] In one embodiment, the video decoding device (2000) may generate a preliminary prediction block through intra prediction according to a predetermined non-directional mode. The video decoding device (2000) may also generate a final prediction block by combining (e.g., weighting) two or more preliminary prediction blocks generated according to each of two or more directional modes and a preliminary prediction block generated according to the non-directional mode.

[0696] In one embodiment, the final predicted block may be determined as the reconstructed current block, or the reconstructed current block may be generated from a combination of the final predicted block and residual data.

[0697] Fig. 44 is a block diagram illustrating the configuration of an image encoding device according to one embodiment.

[0698] Referring to FIG. 44, the image encoding device (4400) may include a prediction encoding unit (4410) and a generation unit (4430).

[0699] According to one embodiment, the prediction encoding unit (4410) and the generation unit (4430) may be implemented with at least one processor. The at least one processor may include various processing circuitry.

[0700] In one embodiment, the prediction encoder (4410) and the generator (4430) may operate according to at least one instruction stored in at least one memory.

[0701] The image encoding device (4400) may include at least one memory that stores input / output data of the prediction encoding unit (4410) and the generation unit (4430). In addition, the image encoding device (4400) may include a memory control unit that controls data input / output of the memory.

[0702] In one embodiment, the prediction encoding unit (4410) may correspond to the prediction encoding unit (1915) illustrated in FIG. 19, and the generation unit (4430) may correspond to the entropy encoding unit (1925) illustrated in FIG. 19.

[0703] The prediction encoding unit (4410) can determine the prediction mode of the current block. The current block may be a maximum coding unit, coding unit, transformation unit, or prediction unit divided from the current picture to be encoded.

[0704] In one embodiment, the current block may be a sub-block split from a maximum coding unit, encoding unit, transformation unit, or prediction unit. In this case, a maximum coding unit, encoding unit, transformation unit, or prediction unit that includes multiple sub-blocks may be referred to as a higher-order block.

[0705] In one embodiment, the prediction mode of the current block may be determined as one of a plurality of prediction modes including an intra mode and an inter mode.

[0706] In one embodiment, the prediction encoder (4410) can determine the intra prediction mode of the current block when the prediction mode of the current block is the intra mode.

[0707] The intra prediction mode of the current block can be selected from among multiple intra prediction modes. As described with reference to FIG. 23, the multiple intra prediction modes can include a non-directional intra prediction mode and a directional intra prediction mode.

[0708] In one embodiment, the prediction encoding unit (4410) may perform intra prediction or inter prediction on the current block according to the prediction mode of the current block, and may encode the current block using a prediction block generated as a result of performing intra prediction or inter prediction.

[0709] In one embodiment, encoding of a current block may refer to a process in which an image decoding device (2000) generates information (or syntax elements) necessary to restore the current block. The information generated through encoding may be included in a bitstream.

[0710] In one embodiment, the prediction encoding unit (4410) may generate residual data corresponding to the difference between the predicted block and the current block. If the predicted block is determined to be the current block, residual data may not be generated. Information regarding the residual data may be transmitted to the image decoding device (2000) via a bitstream.

[0711] According to one embodiment, the prediction encoding unit (4410) may determine a determination method for the intra prediction mode when the prediction mode of the current block is the intra mode. Information indicating the determination method for the intra mode may be included in the bitstream.

[0712] In one embodiment, the method for determining the intra prediction mode may include a method for deriving the intra prediction mode using a set of samples encoded before the current block or a method for selecting the intra prediction mode from among a plurality of intra prediction modes on a cost basis.

[0713] A method of selecting an intra prediction mode based on cost may mean a method of selecting an intra prediction mode that causes the smallest cost when performing intra prediction on a current block according to multiple intra prediction modes.

[0714] In one embodiment, information indicating how to determine the intra prediction mode may be included in a sequence parameter set, a picture parameter set, a slice header, or slice data of the bitstream.

[0715] In one embodiment, the prediction encoding unit (4410) may determine the intra prediction mode of the current block according to a method predetermined between the image decoding device (2000) and the image encoding device (4400).

[0716] In one embodiment, the prediction encoding unit (4410) may select an intra prediction mode that causes the smallest cost for encoding the current block among the plurality of intra prediction modes, if the method for determining the intra prediction mode is a method for selecting one of the plurality of intra prediction modes based on cost. Information indicating the selected intra prediction mode may be included in the bitstream. For example, the information indicating the intra prediction mode of the current block may include a flag or index indicating one of the plurality of intra prediction modes.

[0717] In one embodiment, the prediction encoding unit (4410) can derive the intra prediction mode in the same manner as the prediction decoding unit (2030) according to the embodiment described with reference to FIGS. 24 to 34, if the method of determining the intra prediction mode is a method of deriving the intra prediction mode by using a set of samples encoded before the current block.

[0718] The process of deriving the intra prediction mode using the sample set has been described above, so a detailed description is omitted here.

[0719] When a prediction block is generated through intra prediction for the current block, the prediction encoding unit (4410) can encode the current block using the prediction block.

[0720] The generation unit (4430) can generate a bitstream including the encoding result of the picture. The bitstream can include the encoding result for the current block.

[0721] In one embodiment, the generation unit (4430) can transmit the bitstream to the image decoding device (2000) over a network.

[0722] In one embodiment, the generation unit (4430) may store the bitstream on a data storage medium including a magnetic medium (e.g., a hard disk, a floppy disk, or a magnetic tape), an optical recording medium (e.g., a CD-ROM or DVD), and a magneto-optical medium (e.g., a floptical disk).

[0723] The generation unit (4430) can generate a bitstream including syntax elements generated through encoding of a picture. Values ​​corresponding to the syntax elements can be included in the bitstream according to the syntax structure.

[0724] The generation unit (4430) can obtain bins included in the bitstream by entropy encoding syntax elements.

[0725] In one embodiment, the bitstream may include information about the prediction mode of the current block within the current picture.

[0726] In one embodiment, if the prediction mode of the current block is intra mode, the bitstream may include information indicating the intra prediction mode of the current block.

[0727] In one embodiment, information related to the intra prediction mode may be included in the bitstream according to the syntax structure described with reference to FIGS. 36 to 42.

[0728] Figure 45 is a flowchart of an image encoding method according to one embodiment.

[0729] In step S4510, the video encoding device (4400) can identify a first sample set and a second sample set encoded before the current block.

[0730] In one embodiment, the first set of samples may be located below the upper left sample encoded before the current block, and the second set of samples may be located to the right of the upper left sample.

[0731] The video encoding device (4400) can identify a third sample set located above the upper left sample and a fourth sample set located to the left of the upper left sample, along with the first sample set and the second sample set.

[0732] In one embodiment, the video encoding device (4400) can identify sample sets based on the upper right sample encoded before the current block, if the right block of the current block is encoded before the current block.

[0733] In one embodiment, the video encoding device (4400) can identify sample sets based on samples that are located a predetermined offset in the x-axis direction and the y-axis direction from the upper left sample within the current block.

[0734] In one embodiment, the video encoding device (4400) may determine sample values ​​of the unavailable samples according to a predetermined method when the upper left sample and some of the samples constituting the sample sets are unavailable.

[0735] In step S4520, the image encoding device (4400) can perform intra prediction using one of the first sample set and the second sample set as a reference sample set, according to each of the plurality of directional modes, to obtain a plurality of predicted sample sets corresponding to the other sample set.

[0736] In one embodiment, for a directional mode belonging to one group, a first sample set may be used as a reference sample set, and a prediction sample set corresponding to the second sample set may be generated. And, for a directional mode belonging to another group, a second sample set may be used as a reference sample set, and a prediction sample set corresponding to the first sample set may be generated.

[0737] In one embodiment, for vertical mode, the upper left sample encoded before the current block may be used as a reference sample, and a set of predicted samples corresponding to the first set of samples may be generated. And, for horizontal mode, the upper left sample encoded before the current block may be used as a reference sample, and a set of predicted samples corresponding to the second set of samples may be generated.

[0738] A detailed description of a method for generating prediction sample sets based on multiple directional modes is omitted as it has been described with reference to FIGS. 25a to 29.

[0739] In step S4530, the image encoding device (4400) can determine a directional mode for the current block among a plurality of directional modes based on cost values ​​corresponding to the plurality of directional modes.

[0740] In one embodiment, cost values ​​corresponding to a plurality of directional modes can be derived from a comparison result between a plurality of prediction sample sets generated based on the plurality of directional modes and sample sets that are targets of prediction.

[0741] In one embodiment, the cost values ​​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 multiple prediction sample sets and the sample sets.

[0742] In one embodiment, MAD may be used to compare cost values ​​of directional modes belonging to different groups, and SAD, SSE, or MR-SAD may be used to compare cost values ​​of directional modes belonging to the same group. In one embodiment, even for directional modes belonging to different groups, SAD, SSE, or MR-SAD may be used if the number of samples included in the prediction sample sets is the same.

[0743] In one embodiment, when a plurality of directional modes are classified by group, the image encoding device (4400) can select a representative directional mode from each group, compare cost values ​​of the representative directional modes of each group, and select one of the representative directional modes as the directional mode for the current block.

[0744] At step S4540, the video encoding device (4400) may encode the current block by performing intra prediction on the current block according to a directional mode for the current block. A bitstream resulting from the encoding of the current block may be generated.

[0745] In one embodiment, the video encoding device (4400) may generate residual data using the current block and the predicted block. Information about the residual data may be included in the bitstream.

[0746] In one embodiment, it may be determined that the predicted block corresponds to the current block. In this case, residual data may not be generated.

[0747] In one embodiment, the video encoding device (4400) can obtain a prediction block of the current block according to a non-directional mode when no edge is included in the sample sets.

[0748] In one embodiment, the video encoding device (4400) can generate a first preliminary prediction block according to a directional mode for a current block, and can generate a second preliminary prediction block according to a predetermined non-directional mode (e.g., Planar mode or DC mode). The video encoding device (4400) can combine the first preliminary prediction block and the second preliminary prediction block to generate a final prediction block.

[0749] In one embodiment, the video encoding device (4400) may generate a first preliminary prediction block according to a directional mode corresponding to a smallest cost value among cost values ​​corresponding to each of a plurality of directional modes, and may generate a second preliminary prediction block according to a directional mode corresponding to a next smallest cost value. The video encoding device (4400) may generate a final prediction block by combining (e.g., weighting) the first preliminary prediction block and the second preliminary prediction block.

[0750] In one embodiment, the video encoding device (4400) ...

Claims

1. A step of identifying a first sample set and a second sample set restored before the current block (S4310); A step (S4320) of performing intra prediction using one of the first sample set and the second sample set as a reference sample set according to each of the plurality of directional modes to obtain a plurality of predicted sample sets corresponding to the other sample set; A step (S4330) of determining a directional mode for the current block among the plurality of directional modes based on cost values ​​corresponding to the comparison results of each of the plurality of predicted sample sets and the other sample set; and A method for decoding an image, comprising a step (S4340) of performing intra prediction on the current block according to the determined directional mode to restore the current block.

2. In paragraph 1, The step of obtaining the above multiple prediction sample sets is: According to the directional mode of the first group, a step of performing intra prediction using the first sample set as the reference sample set to obtain a prediction sample set corresponding to the second sample set; and According to the directional mode of the second group, a step of performing intra prediction using the second sample set as the reference sample set to obtain a prediction sample set corresponding to the first sample set is included. The step of determining the directional mode for the current block is: A method for decoding an image, comprising the step of determining a directional mode for the current block among the plurality of directional modes based on a cost value corresponding to the directional mode of the first group and a cost value corresponding to the directional mode of the second group.

3. In any one of paragraphs 1 and 2, The step of determining the directional mode for the current block is: A step of selecting a first representative directional mode among the directional modes of the first group based on cost values ​​corresponding to the directional modes of the first group, and selecting a second representative directional mode among the directional modes of the second group based on cost values ​​corresponding to the directional modes of the second group; and A method for decoding an image, comprising the step of determining a directional mode for the current block by comparing a cost value corresponding to the first representative directional mode with a cost value corresponding to the second representative directional mode.

4. In any one of the clauses 1 to 3, The cost values ​​corresponding to the directional modes of the first group and the cost values ​​corresponding to the directional modes of the second group include SAD (sum of absolute difference), SSE (sum of squared error) or MR-SAD (mean removed SAD), A method for decoding an image, wherein a cost value corresponding to the first representative directional mode and a cost value corresponding to the second representative directional mode include a mean of absolute difference (MAD).

5. In any one of paragraphs 1 to 4, The above first sample set is located below the upper left sample restored before the current block, A method for decoding an image, wherein the second sample set is located to the right of the upper left sample.

6. In any one of paragraphs 1 to 5, The above identifying step is, A step of identifying a third set of samples restored before the current block, wherein the third set of samples is located above the upper left sample or to the left of the upper left sample, The step of obtaining the above multiple prediction sample sets is: According to the directional mode of the third group, intra prediction is performed using the third sample set as a reference sample set to obtain a predicted sample set corresponding to the first sample set or the second sample set, The step of determining the directional mode for the current block is: A method for decoding an image, comprising the step of determining a directional mode for the current block by further considering a cost value corresponding to the directional mode of the third group.

7. In any one of paragraphs 1 to 6, There is a horizontal mode between the directional mode of the first group and the directional mode of the third group, A method for decoding an image, wherein a vertical mode exists between the directional mode of the second group and the directional mode of the third group.

8. In any one of paragraphs 1 to 7, The above multiple directional modes include a vertical mode and a horizontal mode, The step of obtaining the above multiple prediction sample sets is: According to the above vertical mode, a step of performing intra prediction using the upper left sample of the current block restored before the current block as a reference sample to obtain a prediction sample set of the first sample set; and A method for decoding an image, comprising the step of performing intra prediction using an upper left sample of the current block as a reference sample according to a horizontal mode to obtain a prediction sample set of the second sample set.

9. In any one of paragraphs 1 to 8, A method for decoding an image, wherein the sample values ​​of unavailable samples among the samples included in the first sample set and the second sample set are generated based on the available sample closest to the unavailable sample.

10. In any one of the clauses 1 to 9, The step of identifying the first sample set and the second sample set comprises: a step of determining whether the first sample set and the second sample set include an edge; and A method for decoding an image, comprising the step of determining a non-directional mode as an intra prediction mode of the current block if the edge is not included in the first sample set and the second sample set.

11. In any one of clauses 1 to 10, A method for decoding an image, wherein if the current block corresponds to any one of a plurality of sub-blocks divided from an upper block, an intra prediction mode is independently determined for each of the plurality of sub-blocks.

12. In any one of paragraphs 1 to 11, The steps to restore the current block above are: A step of obtaining a third prediction block by combining a first prediction block generated through intra prediction according to the above-determined directional mode and a second prediction block generated through intra prediction according to a predetermined non-directional mode; and A method for decoding an image, comprising the step of restoring the current block based on the third prediction block.

13. In any one of paragraphs 1 to 12, The method of decrypting the above video is as follows: A step of obtaining first information indicating a method of determining an intra prediction mode from a bitstream; If the method of determining the intra prediction mode is not a method of deriving the intra prediction mode on the decoder side, a step of obtaining second information indicating the intra prediction mode of the current block from the bitstream; and A method for decoding an image, comprising the step of performing intra prediction on the current block according to an intra prediction mode indicated by the second information to restore the current block.

14. A step of identifying a first sample set and a second sample set encoded before the current block (S4510); A step (S4520) of performing intra prediction using one of the first sample set and the second sample set as a reference sample set according to each of the plurality of directional modes to obtain a plurality of predicted sample sets corresponding to the other sample set; A step (S4530) of determining a directional mode for the current block among the plurality of directional modes based on cost values ​​corresponding to the comparison results of each of the plurality of predicted sample sets and the other sample set; and A method for encoding an image, comprising a step (S4540) of performing intra prediction on the current block according to the determined directional mode to encode the current block.

15. A method for transmitting a bitstream generated by the video encoding method of Article 14.