Apparatus and method for encoding and decoding image by using reference block

By using template matching and intra-frame prediction modes, reference blocks are determined and prediction blocks are generated, solving the problem of low efficiency in image encoding and decoding in existing technologies and achieving more efficient image compression and reconstruction.

CN121533023APending Publication Date: 2026-02-13SAMSUNG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202480038355.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-08-29
Filing Date
2024-04-12
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Existing image encoding and decoding techniques suffer from inefficiency and high redundancy in inter-frame and intra-frame prediction, especially in motion vector prediction and spatial redundancy removal.

Method used

By using template matching technology, the reference block reconstructed before the current block or the reference block in the previous frame is determined, and a prediction block is generated based on the intra-frame prediction mode. The processor is used to perform encoding and decoding operations to achieve more accurate prediction and removal of redundancy.

Benefits of technology

It improves the efficiency of image encoding and decoding, reduces redundancy, and enhances image reconstruction quality and compression efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121533023A_ABST
    Figure CN121533023A_ABST
Patent Text Reader

Abstract

An image decoding method according to an embodiment may include: determining, based on template matching, at least one of a first reference block reconstructed prior to a current block in a current picture or a second reference block in a previous picture reconstructed prior to the current block; identifying a position corresponding to a predetermined position within the current block from at least one of the first reference block or the second reference block; generating a prediction block by performing intra prediction on the current block according to an intra prediction mode for reconstructing the sample points at the identified corresponding positions; and reconstructing the current block by using the prediction block.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The disclosure relates to the field of image encoding and decoding, and more particularly, to an apparatus and method for encoding and decoding an image by using a reference block included in at least one of a current image or a previous image. BACKGROUND

[0002] In image encoding and decoding, an image is divided into blocks, and each block is predictively encoded and predictively decoded through inter prediction or intra prediction.

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

[0004] In standards such as H.264 Advanced Video Coding (AVC) and High Efficiency Video Coding (HEVC), a motion vector of a previously encoded block adjacent to the current block or a block included in a previously encoded image is used as a motion vector predictor of the current block in order to predict a motion vector of the current block. A motion vector difference that is a difference between the motion vector of the current block and the motion vector predictor of the current block can be signaled to a decoder side through a specific method.

[0005] Intra prediction is a technique for compressing an image by removing spatial redundancy in an image. Intra prediction can generate a prediction block based on neighboring pixels of a current block according to an intra prediction mode. Then, a residual block can be generated by subtracting the prediction block from the current block.

[0006] The residual block generated through inter prediction or intra prediction can be transmitted to a decoder through transformation and quantization. The decoder can dequantize and inverse-transform the residual block, and can reconstruct the current block by combining a prediction block of the current block with the residual block. In some cases, the decoder can remove artifacts from the reconstructed current block by filtering the reconstructed current block. SUMMARY

[0007] Solution to the problem The image decoding method according to an embodiment can include determining at least one of a first reference block reconstructed before a current block in a current picture or a second reference block in a previous picture reconstructed before the current block, based on template matching.

[0008] The image decoding method according to an embodiment can include identifying a corresponding position of a predetermined position within the current block from at least one of the first reference block or the second reference block.

[0009] The image decoding method according to an embodiment can include generating a prediction block by performing intra prediction on the current block according to an intra prediction mode used to reconstruct a sample at the identified corresponding position.

[0010] The image decoding method according to an embodiment can include reconstructing the current block by using the prediction block.

[0011] The image decoding apparatus according to an embodiment can include at least one memory storing at least one instruction and at least one processor operating according to the at least one instruction.

[0012] According to an embodiment, the at least one processor can determine at least one of a first reference block reconstructed before the current block in a current picture or a second reference block in a previous picture reconstructed before the current block based on template matching.

[0013] According to an embodiment, the at least one processor can identify a corresponding position of a predetermined position within the current block from at least one of the first reference block or the second reference block.

[0014] According to an embodiment, the at least one processor can generate a prediction block by performing intra prediction on the current block according to an intra prediction mode used to reconstruct a sample at the identified corresponding position.

[0015] According to an embodiment, the at least one processor can reconstruct the current block by using the prediction block.

[0016] The image encoding method according to an embodiment can include determining at least one of a first reference block encoded before a current block in a current picture or a second reference block in a previous picture encoded before the current block based on template matching.

[0017] The image encoding method according to an embodiment can include identifying a corresponding position of a predetermined position within the current block from at least one of the first reference block or the second reference block.

[0018] The image encoding method according to an embodiment can include generating a prediction block by performing intra prediction on the current block according to an intra prediction mode used to encode a sample at the identified corresponding position.

[0019] The image decoding method according to an embodiment can include encoding the current block by using the prediction block.

[0020] The image encoding apparatus according to an embodiment can include at least one memory storing at least one instruction and at least one processor operating according to the at least one instruction.

[0021] According to an embodiment, the at least one processor can determine at least one of a first reference block coded before the current block in the current picture or a second reference block in a previous picture coded before the current block based on template matching.

[0022] According to an embodiment, the at least one processor can identify a corresponding position of a predetermined position within the current block from at least one of the first reference block or the second reference block.

[0023] According to an embodiment, the at least one processor can generate a prediction block by performing intra prediction on the current block according to an intra prediction mode used to encode a sample at the identified corresponding position.

[0024] According to an embodiment, the at least one processor can encode the current block by using the prediction block.

[0025] In a computer-readable recording medium having a bitstream recorded thereon, according to an embodiment, the bitstream can include a result of encoding the current block.

[0026] According to an embodiment, the result of encoding the current block can be generated by determining at least one of a first reference block coded before the current block in the current picture or a second reference block in a previous picture coded before the current block based on template matching.

[0027] According to an embodiment, the result of encoding the current block can be generated by identifying a corresponding position of a predetermined position within the current block from at least one of the first reference block or the second reference block.

[0028] According to an embodiment, the result of encoding the current block can be generated by generating a prediction block by performing intra prediction on the current block according to an intra prediction mode used to encode a sample at the identified corresponding position.

[0029] According to an embodiment, the result of encoding the current block can be generated by encoding the current block by using the prediction block. BRIEF DESCRIPTION OF DRAWINGS

[0030] Figure 1 is a block diagram of an image decoding apparatus according to an embodiment.

[0031] Figure 2 is a block diagram of an image encoding apparatus according to an embodiment.

[0032] Figure 3 shows a process of determining at least one coding unit by partitioning a current coding unit according to an embodiment.

[0033] Figure 4A process of determining at least one coding unit by dividing a non-square coding unit according to an embodiment is shown.

[0034] Figure 5 A process of dividing a coding unit based on at least one of block shape information and division shape mode information according to an embodiment is shown.

[0035] Figure 6 A method of determining a preset coding unit from an odd number of coding units according to an embodiment is shown.

[0036] Figure 7 An order of processing a plurality of coding units when the plurality of coding units is determined by dividing a current coding unit according to an embodiment is shown.

[0037] Figure 8 A process of determining that a current coding unit will be divided into an odd number of coding units when the coding unit cannot be processed in a preset order according to an embodiment is shown.

[0038] Figure 9 A process of determining at least one coding unit by dividing a first coding unit according to an embodiment is shown.

[0039] Figure 10 A shape into which a second coding unit determined by dividing a first coding unit is limited to be divided when the second coding unit is non-square and satisfies a preset condition according to an embodiment is shown.

[0040] Figure 11 A process of dividing a square coding unit when division shape mode information does not indicate division in units of four square coding units according to an embodiment is shown.

[0041] Figure 12 A process of changing an order of processing among a plurality of coding units according to a process of dividing the coding units according to an embodiment is shown.

[0042] Figure 13 A process of determining a depth of a coding unit as a shape and size of the coding unit change when the coding unit is recursively divided such that a plurality of coding units are determined according to an embodiment is shown.

[0043] Figure 14 A depth that can be determined based on a shape and size of a coding unit and a partial index (PID) for distinguishing the coding unit according to an embodiment is shown.

[0044] Figure 15 A plurality of coding units is determined based on a plurality of preset data units included in a picture according to an embodiment.

[0045] Figure 16 FIG. 1 illustrates coding units of respective pictures when the respective pictures have different combinations of partition shape according to an embodiment.

[0046] Figure 17 FIG. 3 illustrates various shapes of coding units that can be determined based on partition shape mode information represented with a binary code according to an embodiment.

[0047] Figure 18 FIG. 4 illustrates other shapes of coding units that can be determined based on partition shape mode information represented with a binary code according to an embodiment.

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

[0049] Figure 20 FIG. 6 is a block diagram of an image decoding apparatus according to an embodiment.

[0050] Figure 21 FIG. 7 is a diagram illustrating types of intra prediction modes according to an embodiment.

[0051] Figure 22 FIG. 8 is a diagram illustrating neighboring samples that can be used for intra prediction for a current block according to an embodiment.

[0052] Figure 23 FIG. 9 is a diagram for explaining a process of predicting a current block by using neighboring samples according to an intra prediction mode according to an embodiment.

[0053] Figure 24 FIG. 10 is a diagram for explaining a method of determining a reference block of a current block according to an embodiment.

[0054] Figure 25 FIG. 11 is a diagram illustrating positions of neighboring blocks related to a current block according to an embodiment.

[0055] Figure 26 FIG. 12 is a diagram for explaining a method of determining an intra prediction mode of a reference block as an intra prediction mode of a current block according to an embodiment.

[0056] Figure 27 FIG. 13 is a diagram illustrating neighboring samples that can be used for intra prediction of a neighboring sample set with respect to a current block according to an embodiment.

[0057] Figure 28 FIG. 14 is a diagram for explaining a process of predicting a neighboring sample set by using neighboring samples of the neighboring sample set according to an intra prediction mode according to an embodiment.

[0058] Figure 29 FIG. 15 is a diagram for explaining a method of determining an intra prediction mode of a reference block as an intra prediction mode of a current block according to an embodiment.

[0059] Figure 30 is a diagram for describing a process of propagating an intra prediction mode according to an embodiment.

[0060] Figure 31 is a flowchart of an image decoding method according to an embodiment.

[0061] Figure 32 is a block diagram of an image encoding apparatus according to an embodiment.

[0062] Figure 33 is a flowchart of an image encoding method according to an embodiment. DETAILED DESCRIPTION

[0063] The image decoding method according to an embodiment can include determining at least one of a first reference block reconstructed before the current block in a current picture or a second reference block in a previous picture reconstructed before the current block based on template matching.

[0064] The image decoding method according to an embodiment can include identifying a corresponding position of a predetermined position within the current block from at least one of the first reference block or the second reference block.

[0065] The image decoding method according to an embodiment can include generating a prediction block by performing intra prediction on the current block according to an intra prediction mode used to reconstruct a sample at the identified corresponding position.

[0066] The image decoding method according to an embodiment can include reconstructing the current block by using the prediction block.

[0067] MODE FOR INVENTION Since the present disclosure allows various changes and numerous embodiments, particular embodiments will be shown in the drawings and described in detail in the written description. However, this is not intended to limit the present disclosure to specific modes of practice, and all changes, equivalents, and alternatives falling within the spirit and technical scope of the present disclosure are included in the present disclosure.

[0068] In the description of embodiments of the present disclosure, when it is considered that certain detailed descriptions of related art can unnecessarily obscure the essence of the present disclosure, it can be omitted. Terms used to describe embodiments (for example, "first" and "second") can correspond to identifiers for distinguishing one component from another component.

[0069] Throughout the disclosure, the expression "at least one of a, b, or c" can indicate only a, only b, only c, both a and b, both a and c, both b and c, all of a, b, and c, or variations thereof.

[0070] When a component "is coupled to" or "is connected to" another component, the component can be directly coupled or connected to the other component, or one or more intervening components can be present between them.

[0071] As to components denoted as "a (unit) or (module)" or "a module" used herein, two or more components can be combined into one component, or one component can be divided into two or more components. Also, each component described below can additionally perform some or all of the functions performed by another component, and some of the functions of each component can be performed entirely by another component, in addition to its own main function.

[0072] An "image" used herein can indicate a picture, a still image, a frame, a moving image consisting of a plurality of consecutive still images, or a video.

[0073] A "sample" used herein can refer to data to be processed as data assigned to a sampling position of an image. For example, a pixel in a frame of a spatial domain can correspond to a sample. A unit including a plurality of samples can be defined as a block.

[0074] Hereinafter, an image encoding method and apparatus and an image decoding method and apparatus based on a coding unit and a transform unit having a tree structure according to an embodiment will be described with reference to Figures 1 to 19 An image encoding method and apparatus and an image decoding method and apparatus based on a coding unit and a transform unit having a tree structure according to an embodiment are described.

[0075] Figure 1 is a block diagram of an image decoding apparatus 100 according to an embodiment.

[0076] The image decoding apparatus 100 can include a bitstream obtainer 110 and a decoder 120. The bitstream obtainer 110 and the decoder 120 can include at least one processor. The bitstream obtainer 110 and the decoder 120 can include a memory storing instructions to be executed by the at least one processor.

[0077] The bitstream obtainer 110 can receive a bitstream. The bitstream can include information obtained by image encoding by the image encoding apparatus 200 which will be described later. The bitstream can be transmitted from the image encoding apparatus 200. The image decoding apparatus 100 can be connected to the image encoding apparatus 200 in a wired or wireless manner, and the bitstream obtainer 110 can receive the bitstream in a wired or wireless manner. The bitstream obtainer 110 can receive the bitstream from a storage medium such as an optical medium, a hard disk, or the like. The decoder 120 can reconstruct an image based on information obtained from the received bitstream. The decoder 120 can obtain a syntax element for reconstructing an image from the bitstream. The decoder 120 can reconstruct an image based on the syntax element.

[0078] The operation of the image decoding apparatus 100 is described in detail, the bitstream obtainer 110 can receive a bitstream.

[0079] The image decoding apparatus 100 can perform an operation of obtaining a bin string corresponding to a partition shape mode of a coding unit from a bitstream. The image decoding apparatus 100 can perform an operation of determining a partitioning rule of the coding unit. The image decoding apparatus 100 can perform an operation of partitioning the coding unit into a plurality of coding units based on at least one of the bin string corresponding to the partition shape mode and the partitioning rule. The image decoding apparatus 100 can determine a first range of a permissible size range of the coding unit according to a ratio of a height to a width of the coding unit in order to determine the partitioning rule. The image decoding apparatus 100 can determine a second range of the permissible size range of the coding unit according to a partition shape mode of the coding unit in order to determine the partitioning rule.

[0080] Hereinafter, the partitioning of a coding unit will be described in detail according to embodiments of the disclosure.

[0081] First, one picture can be partitioned into one or more slices or one or more parallel blocks. One slice or one parallel block can be a sequence of one or more largest coding units (coding tree units (CTUs)). According to an embodiment example, one slice includes one or more parallel blocks, or one slice can include one or more largest coding units. A slice including one parallel block or a plurality of parallel blocks can be determined within a picture.

[0082] There is a largest coding block (coding tree block (CTB)) conceptually compared to a largest coding unit (CTU). The largest coding block (CTB) denotes an NxN block including NxN samples (where N is an integer). Each color component can be partitioned into one or more largest coding blocks.

[0083] When a picture has three sample arrays (sample arrays for Y, Cr, and Cb components), a largest coding unit (CTU) includes a largest coding block of luma samples, two corresponding largest coding blocks of chroma samples, and a syntax structure for coding the luma and chroma samples. When a picture is a monochrome picture, a largest coding unit includes a largest coding block of monochrome samples and a syntax structure for coding the monochrome samples. When a picture is a picture coded in color planes separated according to color components, a largest coding unit includes a syntax structure for coding the picture and samples of the picture.

[0084] One largest coding block (CTB) can be partitioned into an MxN coding block including MxN samples (M and N are integers).

[0085] When a picture has an array of samples for a Y component, a Cr component, and a Cb component, a coding unit (CU) includes a coding block of luma samples, two corresponding coding blocks of chroma samples, and a syntax structure for coding the luma samples and the chroma samples. When a picture is a monochrome picture, a coding unit includes a coding block of monochrome samples and a syntax structure for coding the monochrome samples. When a picture is a picture coded in color planes separated according to color components, a coding unit includes a syntax structure for coding the picture and samples of the picture.

[0086] As described above, the maximum coding block and the maximum coding unit are conceptually distinguished from each other, and the coding block and the coding unit are conceptually distinguished from each other. In other words, the (maximum) coding unit refers to a data structure including the (maximum) coding block including corresponding samples and a syntax structure corresponding to the (maximum) coding block. However, because the (maximum) coding unit or the (maximum) coding block refers to a block of a preset size including a preset number of samples as understood by one of ordinary skill in the art, unless otherwise described, the maximum coding block and the maximum coding unit or the coding block and the coding unit are referred to without distinction in the following description.

[0087] A picture can be divided into maximum coding units (CTUs). The size of each maximum coding unit can be determined based on information obtained from a bitstream. The shape of each maximum coding unit can be a square shape of the same size. However, embodiments are not limited thereto.

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

[0089] For example, information about a luma block size difference and the maximum size of a luma coding block that can be halved can be obtained from a bitstream. The information about the luma block size difference can refer to a size difference between a luma maximum coding unit and a maximum luma coding block that can be halved. Accordingly, when the information about the maximum size of a luma coding block that can be halved and the information about the luma block size difference obtained from a bitstream are combined with each other, the size of the luma maximum coding unit can be determined. The size of a chroma maximum coding unit can be determined by using the size of the luma maximum coding unit. For example, when a Y:Cb:Cr ratio is 4:2:0 according to a color format, the size of a chroma block can be half of the size of a luma block, and the size of a chroma maximum coding unit can be half of the size of a luma maximum coding unit.

[0090] According to an embodiment, because information on the maximum size of the binarizable luma coding block is obtained from the bitstream, the maximum size of the binarizable luma coding block can be variably determined. In contrast, the maximum size of the ternarizable luma coding block can be fixed. For example, the maximum size of the ternarizable luma coding block in an I picture can be 32x32, and the maximum size of the ternarizable luma coding block in a P picture or a B picture can be 64x64.

[0091] The maximum coding unit can be hierarchically divided into coding units based on division shape mode information obtained from the bitstream. 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 as the division shape mode information.

[0092] For example, the information indicating whether quad division is performed can indicate whether the current coding unit is quad divided (QUAD_SPLIT) or not.

[0093] When the current coding unit is not quad divided, the information indicating whether multi-division is performed can indicate whether the current coding unit is no longer divided (NO_SPLIT) or binarized / trinarized.

[0094] When the current coding unit is binarized or trinarized, the division direction information indicates that the current coding unit is divided in one of a horizontal direction and a vertical direction.

[0095] When the current coding unit is divided in the horizontal direction or the vertical direction, the division type information indicates that the current coding unit is binarized or trinarized.

[0096] A division mode of the current coding unit can be determined according to the division direction information and the division type information. The division mode when the current coding unit is binarized in the horizontal direction can be determined as a binarized horizontal division mode (SPLIT_BT_HOR), the division mode when the current coding unit is trinarized in the horizontal direction can be determined as a trinarized horizontal division mode (SPLIT_TT_HOR), the division mode when the current coding unit is binarized in the vertical direction can be determined as a binarized vertical division mode (SPLIT_BT_VER), and the division mode when the current coding unit is trinarized in the vertical direction can be determined as a trinarized vertical division mode (SPLIT_TT_VER).

[0097] Image decoding device 100 can obtain partitioning shape pattern information from a binary bit string in a bit stream. The bit stream received by image decoding device 100 may be in the form of fixed-length binary code, unary code, truncated unary code, predetermined binary code, etc. The binary bit string is information about binary numbers. The binary bit string may include at least one bit. Image decoding device 100 can obtain partitioning shape pattern information corresponding to the binary bit string based on partitioning rules. Image decoding device 100 can determine, based on a binary bit string, whether to perform quaternion partitioning on the coding unit, whether not to partition the coding unit, the partitioning direction, and the partitioning type.

[0098] A coding unit can be less than or equal to the largest coding unit. For example, since the largest coding unit is the coding unit with the largest size, it is one of the coding units. When the partitioning shape pattern information regarding the largest coding unit indicates that partitioning is not performed, the coding units determined within the largest coding unit have the same size as that largest coding unit. When the partitioning shape pattern information regarding the largest coding unit indicates that partitioning is performed, the largest coding unit can be partitioned into coding units. Furthermore, when the partitioning shape pattern information regarding coding units indicates that partitioning is performed, the coding unit can be partitioned into smaller coding units. However, the partitioning of an image is not limited to this, and the largest coding unit and coding units may not be distinguished. (Refer to...) Figures 3 to 16 Describe in detail the division of coding units.

[0099] Furthermore, one or more prediction blocks for prediction can be determined from the coding unit. The prediction blocks may be equal to or smaller than the coding unit. Furthermore, one or more transform blocks for transform can be determined from the coding unit. The transform blocks may be equal to or smaller than the coding unit.

[0100] The shapes and sizes of the transform blocks and the prediction blocks can be independent of each other.

[0101] In another embodiment, prediction can be performed by using the coding unit as a predictor. Furthermore, transformation can be performed by using the coding unit as a transform block.

[0102] Reference Figures 3 to 16 The division of coding units is described in detail. The current block and adjacent blocks in this disclosure can refer to one of the maximum coding unit, coding unit, prediction block, and transform block. Furthermore, the current block of the current coding unit is the block currently being decoded or encoded, or the block currently being divided. Adjacent blocks can be blocks reconstructed before the current block. Adjacent blocks can be spatially or temporally adjacent to the current block. Adjacent blocks can be located at one of the following locations: below left, left side, above left, above, above right, right side, or below right of the current block.

[0103] Figure 3A process of determining at least one coding unit by partitioning a current coding unit, which is performed by the image decoding apparatus 100 according to an embodiment, is shown.

[0104] The block shape can include 4N×4N, 4N×2N, 2N×4N, 4N×N, N×4N, 32N×N, N×32N, 16N×N, N×16N, 8N×N, or N×8N. Here, N can be a positive integer. The block shape information is information indicating at least one of a shape, a direction, an aspect ratio, or a size of a coding unit.

[0105] The shape of the coding unit can include a square and a non-square. When the width length and the height length of the coding unit are the same (i.e., when the block shape of the coding unit is 4N×4N), the image decoding apparatus 100 can determine the block shape information of the coding unit as a square. The image decoding apparatus 100 can determine the shape of the coding unit as a non-square.

[0106] When the width and the height of the coding unit are not the same as each other (i.e., when the block shape of the coding unit is 4N×2N, 2N×4N, 4N×N, N×4N, 32N×N, N×32N, 16N×N, N×16N, 8N×N, or N×8N), the image decoding apparatus 100 can determine the block shape information of the coding unit as a non-square shape. When the shape of the coding unit is a non-square, the image decoding apparatus 100 can determine the aspect ratio in the block shape information of the coding unit as 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. In addition, the image decoding apparatus 100 can determine whether the coding unit is along a horizontal direction or a vertical direction based on the width length and the height length of the coding unit. In addition, the image decoding apparatus 100 can determine the size of the coding unit based on at least one of the width length, the height length, or the area of the coding unit.

[0107] According to an embodiment, the image decoding apparatus 100 can determine the shape of the coding unit by using the block shape information, and can determine the partitioning method of the coding unit by using the partition shape mode information. That is, the coding unit partitioning method indicated by the partition shape mode information can be determined based on the block shape indicated by the block shape information used by the image decoding apparatus 100.

[0108] The image decoding apparatus 100 can obtain the division shape mode information from the bitstream. However, embodiments are not limited thereto, and the image decoding apparatus 100 and the image encoding apparatus 200 can determine the pre-agreed division shape mode information based on the block shape information. The image decoding apparatus 100 can determine the pre-agreed division shape mode information for a maximum coding unit or a minimum coding unit. For example, the image decoding apparatus 100 can determine the division shape mode information for the maximum coding unit as quad division. Also, the image decoding apparatus 100 can determine the division shape mode information about the minimum coding unit as "no division is performed". In detail, the image decoding apparatus 100 can determine the size of the maximum coding unit as 256x256. The image decoding apparatus 100 can determine the pre-agreed division shape mode information as quad division. The quad division is a division shape mode in which the width and the height of the coding unit are both bisected. The image decoding apparatus 100 can obtain a coding unit of 128x128 size from the maximum coding unit of 256x256 size based on the division shape mode information. Also, the image decoding apparatus 100 can determine the size of the minimum coding unit as 4x4. The image decoding apparatus 100 can obtain the division shape mode information indicating "no division is performed" for the minimum coding unit.

[0109] According to embodiments, the image decoding apparatus 100 can use the block shape information indicating that the current coding unit has a square shape. For example, the image decoding apparatus 100 can determine whether to not divide the square coding unit, whether to divide the square coding unit vertically, whether to divide the square coding unit horizontally, or whether to divide the square coding unit into four coding units based on the division shape mode information. Referring to Figure 3 When the block shape information of the current coding unit 300 indicates a square shape, the decoder 120 can not divide the coding unit 310a having the same size as the current coding unit 300 based on the division shape mode information indicating that no division is performed, or can determine the coding units 310b, 310c, 310d, 310e, or 310f divided based on the division shape mode information indicating a pre-set division method.

[0110] Referring to Figure 3According to embodiments, the image decoding apparatus 100 can determine two coding units 310b obtained by dividing the current coding unit 300 in the vertical direction, based on the division shape mode information indicating that division is performed in the vertical direction. The image decoding apparatus 100 can determine two coding units 310c obtained by dividing the current coding unit 300 in the horizontal direction, based on the division shape mode information indicating that division is performed in the horizontal direction. The image decoding apparatus 100 can determine four coding units 310d obtained by dividing the current coding unit 300 in the vertical and horizontal directions, based on the division shape mode information indicating that division is performed in the vertical and horizontal directions. According to embodiments, the image decoding apparatus 100 can determine three coding units 310e obtained by dividing the current coding unit 300 in the vertical direction, based on the division shape mode information indicating that ternary division is performed in the vertical direction. The image decoding apparatus 100 can determine three coding units 310f obtained by dividing the current coding unit 300 in the horizontal direction, based on the division shape mode information indicating that ternary division is performed in the horizontal direction. However, the division method of a square coding unit is not limited to the above-described methods, and the division shape mode information can indicate various methods. The preset division methods of dividing a square coding unit will be described in detail with respect to various embodiments below.

[0111] Figure 4 A process of determining at least one coding unit by dividing a non-square coding unit, performed by the image decoding apparatus 100 according to embodiments, is shown.

[0112] According to embodiments, the image decoding apparatus 100 can use block shape information indicating that the current coding unit has a non-square shape. The image decoding apparatus 100 can determine whether to not divide the non-square current coding unit or to divide the non-square current coding unit by using a preset division method, based on the division shape mode information. Referring to Figure 4 When the block shape information of the current coding unit 400 or 450 indicates a non-square shape, the image decoding apparatus 100 can determine a coding unit 410 or 460 having the same size as the current coding unit 400 or 450, based on the division shape mode information indicating that no division is performed, or can determine coding units 420a and 420b, 430a to 430c, 470a and 470b, or 480a to 480c divided based on the division shape mode information indicating a preset division method. The preset division methods of dividing a non-square coding unit will be described in detail with respect to various embodiments below.

[0113] According to an embodiment, the image decoding apparatus 100 can determine a partitioning method of a coding unit by using the partition shape mode information, and in this case, the partition shape mode information can indicate a number of one or more coding units generated by partitioning the coding unit. Referring to Figure 4 When the partition shape mode information indicates that the current coding unit 400 or 450 is partitioned into two coding units, the image decoding apparatus 100 can determine two coding units 420a and 420b or 470a and 470b included in the current coding unit 400 or 450 by partitioning the current coding unit 400 or 450 based on the partition shape mode information.

[0114] According to an embodiment, when the image decoding apparatus 100 partitions the current coding unit 400 or 450 having a non-square shape based on the partition shape mode information, the image decoding apparatus 100 can consider a position of a long side of the current coding unit 400 or 450 having a non-square shape to partition the current coding unit. For example, the image decoding apparatus 100 can determine a plurality of coding units by partitioning the current coding unit 400 or 450 in a direction in which a long side of the current coding unit 400 or 450 is partitioned, considering a shape of the current coding unit 400 or 450.

[0115] According to an embodiment, when the partition shape mode information indicates that the coding unit is partitioned (ternary partitioning) into an odd number of blocks, the image decoding apparatus 100 can determine an odd number of coding units included in the current coding unit 400 or 450. For example, when the partition shape mode information indicates that the current coding unit 400 or 450 is partitioned into three coding units, the image decoding apparatus 100 can partition the current coding unit 400 or 450 into three coding units 430a, 430b, and 430c or 480a, 480b, and 480c.

[0116] According to an embodiment, a ratio of a width and a height of the current coding unit 400 or 450 can be 4:1 or 1:4. When the ratio of the width and the height is 4:1, because the width length is longer than the height length, the block shape information can indicate a horizontal direction. When the ratio of the width and the height is 1:4, because the width length is shorter than the height length, the block shape information can indicate a vertical direction. The image decoding apparatus 100 can determine to divide the current coding unit into an odd number of blocks based on the division shape mode information. In addition, the image decoding apparatus 100 can determine a division direction of the current coding unit 400 or 450 based on the block shape information of the current coding unit 400 or 450. For example, when the current coding unit 400 is along the vertical direction, the image decoding apparatus 100 can determine the coding units 430a, 430b, and 430c by dividing the current coding unit 400 in the horizontal direction. In addition, when the current coding unit 450 is along the horizontal direction, the image decoding apparatus 100 can determine the coding units 480a, 480b, and 480c by dividing the current coding unit 450 in the vertical direction.

[0117] According to an embodiment, the image decoding apparatus 100 can determine an odd number of coding units included in the current coding unit 400 or 450, and not all of the determined coding units can have the same size. For example, a predetermined coding unit 430b or 480b among the determined odd number of coding units 430a, 430b, and 430c or 480a, 480b, and 480c can have a size different from that of the other coding units 430a and 430c or 480a and 480c. That is, the coding units that can be determined by dividing the current coding unit 400 or 450 can have a plurality of sizes, and in some cases, all of the odd number of coding units 430a, 430b, and 430c or 480a, 480b, and 480c can have different sizes.

[0118] According to an embodiment, when the division shape mode information indicates to divide a coding unit into an odd number of blocks, the image decoding apparatus 100 can determine an odd number of coding units included in the current coding unit 400 or 450, and in addition, can apply a predetermined restriction to at least one coding unit among the odd number of coding units generated by dividing the current coding unit 400 or 450. Referring to Figure 4, the image decoding apparatus 100 can set a decoding process for the coding unit 430b or 480b, which is located at the center of three coding units 430a, 430b, and 430c or 480a, 480b, and 480c generated by partitioning the current coding unit 400 or 450, to be different from a decoding process for other coding units 430a and 430c or 480a and 480c. For example, unlike other coding units 430a and 430c or 480a and 480c, the image decoding apparatus 100 can limit the coding unit 430b or 480b at the center position from being partitioned any more or from being partitioned only a predetermined number of times.

[0119] Figure 5 A process of partitioning a coding unit based on at least one of block shape information and partition shape mode information, performed by the image decoding apparatus 100 according to an embodiment, is illustrated.

[0120] According to an embodiment, the image decoding apparatus 100 can determine to partition or not to partition the first coding unit 500 having a square shape into coding units based on at least one of the block shape information and the partition shape mode information. According to an embodiment, when the partition shape mode information indicates to partition the first coding unit 500 in a horizontal direction, the image decoding apparatus 100 can determine a second coding unit 510 by partitioning the first coding unit 500 in the horizontal direction. The first, second, and third coding units used according to an embodiment are terms used to understand a relationship before and after partitioning a coding unit. For example, a second coding unit can be determined by partitioning a first coding unit, and a third coding unit can be determined by partitioning the second coding unit. It will be understood that the relationship of the first, second, and third coding units follows the above description.

[0121] According to an embodiment, the image decoding apparatus 100 can determine to partition or not to partition the determined second coding unit 510 into coding units based on the partition shape mode information. Referring to Figure 5, the image decoding apparatus 100 can divide the second coding unit 510 having a non-square shape determined by dividing the first coding unit 500 into one or more third coding units 520a, 520b, 520c, and 520d based on at least one of the block shape information and the division shape mode information, or can not divide the second coding unit 510 having a non-square shape. The image decoding apparatus 100 can obtain the division shape mode information, and can obtain a plurality of second coding units (for example, 510) of various shapes by dividing the first coding unit 500 based on the obtained division shape mode information, and can divide the second coding unit 510 by using a division method of the first coding unit 500 based on the division shape mode information. According to an embodiment, when the first coding unit 500 is divided into the second coding unit 510 based on the division shape mode information of the first coding unit 500, the second coding unit 510 can also be divided into third coding units (for example, 520a, or 520b, 520c, and 520d) based on the division shape mode information of the second coding unit 510. That is, the coding units can be recursively divided based on the division shape mode information of each coding unit. Accordingly, the coding units having a square shape can be determined by dividing the coding units having a non-square shape, and the coding units having a non-square shape can be determined by recursively dividing the coding units having a square shape.

[0122] Referring to Figure 5 A predetermined coding unit (for example, a coding unit located at a center position or a coding unit having a square shape) among the odd number of third coding units 520b, 520c, and 520d determined by dividing the second coding unit 510 having a non-square shape can be recursively divided. According to an embodiment, the third coding unit 520c, which is a square among the odd number of third coding units 520b, 520c, and 520d, can be divided into a plurality of fourth coding units in a horizontal direction. The fourth coding units 530b or 530d having a non-square shape among the plurality of fourth coding units 530a, 530b, 530c, and 530d can be again divided into a plurality of coding units. For example, the fourth coding units 530b or 530d having a non-square shape can be again divided into an odd number of coding units. Methods that can be used to recursively divide the coding units will be described below with respect to various embodiments.

[0123] According to an embodiment, the image decoding apparatus 100 can divide each of the third coding units 520a, or 520b, 520c, and 520d, based on the division shape mode information. Also, the image decoding apparatus 100 can determine not to divide the second coding unit 510 based on the division shape mode information. According to an embodiment, the image decoding apparatus 100 can divide the second coding unit 510 having a non-square shape into an odd number of third coding units 520b, 520c, and 520d. The image decoding apparatus 100 can apply a preset restriction to a preset third coding unit among the odd number of third coding units 520b, 520c, and 520d. For example, the image decoding apparatus 100 can restrict the third coding unit 520c at a center position among the odd number of third coding units 520b, 520c, and 520d not to be divided any more or to be divided a settable number of times.

[0124] Referring to Figure 5 , the image decoding apparatus 100 can restrict the third coding unit 520c at a center position among the odd number of third coding units 520b, 520c, and 520d included in the non-square second coding unit 510 not to be divided any more, to be divided by using a preset division method (for example, to be divided into only four coding units or to be divided by using the division method of the second coding unit 510), or to be divided only a preset number of times (for example, to be divided only n times (where n > 0)). However, the restriction on the third coding unit 520c at the center position is not limited to the above-described example, and can include various restrictions for decoding the third coding unit 520c at the center position differently from the other third coding units 520b and 520d.

[0125] According to an embodiment, the image decoding apparatus 100 can obtain the division shape mode information for dividing the current coding unit from a preset position in the current coding unit.

[0126] Figure 6 A method of determining a preset coding unit from among odd number of coding units, performed by the image decoding apparatus 100 according to an embodiment, is illustrated.

[0127] Referring to Figure 6 , the division shape mode information of the current coding unit 600 or 650 can be obtained from a preset position (for example, a sample 640 or 690 at a center position) among a plurality of samples included in the current coding unit 600 or 650. However, the preset position in the current coding unit 600 from which at least one piece of division shape mode information can be obtained is not limited to Figure 6The center position in the image can be included, and may include various positions included in the current encoding unit 600 (e.g., above, below, left, right, upper left, lower left, upper right, lower right, etc.). The image decoding device 100 can obtain the division shape pattern information from the preset position, and can determine whether to divide the current encoding unit into encoding units of various shapes and sizes or not to divide the current encoding unit.

[0128] According to an embodiment, when the current coding unit is divided into a preset number of coding units, the image decoding device 100 can select one coding unit from the coding units. As will be described below with respect to various embodiments, various methods can be used to select one coding unit from a plurality of coding units.

[0129] According to an embodiment, the image decoding device 100 can divide the current encoding unit into multiple encoding units and determine the encoding unit at a preset position.

[0130] According to an embodiment, the image decoding device 100 can use information indicating the positions of an odd number of coding units to determine the coding unit at the center position among the odd number of coding units. (See also...) Figure 6 The image decoding device 100 can determine an odd number of coding units 620a, 620b, and 620c or an odd number of coding units 660a, 660b, and 660c by dividing the current coding unit 600 or the current coding unit 650. The image decoding device 100 can determine an intermediate coding unit 620b or an intermediate coding unit 660b by using information about the positions of the odd number of coding units 620a, 620b, and 620c or the odd number of coding units 660a, 660b, and 660c. For example, the image decoding device 100 can determine the coding unit 620b at the center position by determining the positions of coding units 620a, 620b, and 620c based on information indicating the positions of preset samples included in coding units 620a, 620b, and 620c. In detail, the image decoding device 100 can determine the position of the encoding units 620a, 620b and 620c based on the information indicating the positions of the upper left samples 630a, 630b and 630c of the encoding units 620a, 620b and 620c, and determine the encoding unit 620b at the center position.

[0131] According to an embodiment, the information indicating the positions of the top-left samples 630a, 630b, and 630c included in the coding units 620a, 620b, and 620c, respectively, can include information on positions or coordinates of the coding units 620a, 620b, and 620c in a picture. According to an embodiment, the information indicating the positions of the top-left samples 630a, 630b, and 630c included in the coding units 620a, 620b, and 620c, respectively, can include information indicating widths or heights of the coding units 620a, 620b, and 620c included in the current coding unit 600, and the widths or heights can correspond to information indicating differences between the coordinates of the coding units 620a, 620b, and 620c in the picture. That is, the image decoding apparatus 100 can determine the coding unit 620b at the center position by directly using the information on the positions or coordinates of the coding units 620a, 620b, and 620c in the picture or by using the information on the widths or heights of the coding units corresponding to the differences between the coordinates.

[0132] According to an embodiment, the information indicating the position of the top-left sample 630a of the upper coding unit 620a can include coordinates (xa, ya), the information indicating the position of the top-left sample 630b of the center coding unit 620b can include coordinates (xb, yb), and the information indicating the position of the top-left sample 630c of the lower coding unit 620c can include coordinates (xc, yc). The image decoding apparatus 100 can determine the middle coding unit 620b by using the coordinates of the top-left samples 630a, 630b, and 630c included in the coding units 620a, 620b, and 620c, respectively. For example, when the coordinates of the top-left samples 630a, 630b, and 630c are ordered in ascending order or descending order, the coding unit 620b including the coordinates (xb, yb) of the sample 630b at the center position can be determined as the coding unit at the center position among the coding units 620a, 620b, and 620c determined by dividing the current coding unit 600. However, the coordinates indicating the positions of the top-left samples 630a, 630b, and 630c can include coordinates indicating absolute positions in a picture, or can use coordinates (dxb, dyb) indicating a relative position of the top-left sample 630b of the middle coding unit 620b with respect to the position of the top-left sample 630a of the upper coding unit 620a and coordinates (dxc, dyc) indicating a relative position of the top-left sample 630c of the lower coding unit 620c with respect to the position of the top-left sample 630a of the upper coding unit 620a. The method of determining a coding unit at a predetermined position by using the coordinates of a sample included in a coding unit as information indicating the position of the sample is not limited to the above-described method, and can include various arithmetic methods capable of using the coordinates of the sample.

[0133] According to an embodiment, the image decoding apparatus 100 can divide the current coding unit 600 into a plurality of coding units 620a, 620b, and 620c, and can select one of the coding units 620a, 620b, and 620c based on a preset criterion. For example, the image decoding apparatus 100 can select the coding unit 620b having a size different from those of the other coding units from among the coding units 620a, 620b, and 620c.

[0134] According to an embodiment, the image decoding apparatus 100 can determine the width or height of each of the coding units 620a, 620b, and 620c by using a coordinate (xa, ya) that is information indicating the position of the top-left sample 630a of the upper coding unit 620a, a coordinate (xb, yb) that is information indicating the position of the top-left sample 630b of the middle coding unit 620b, and a coordinate (xc, yc) that is information indicating the position of the top-left sample 630c of the lower coding unit 620c. The image decoding apparatus 100 can determine the size of each of the coding units 620a, 620b, and 620c by using the coordinates (xa, ya), (xb, yb), and (xc, yc) indicating the positions of the coding units 620a, 620b, and 620c. According to an embodiment, the image decoding apparatus 100 can determine the width of the upper coding unit 620a as the width of the current coding unit 600. The image decoding apparatus 100 can determine the height of the upper coding unit 620a as yb-ya. According to an embodiment, the image decoding apparatus 100 can determine the width of the middle coding unit 620b as the width of the current coding unit 600. The image decoding apparatus 100 can determine the height of the middle coding unit 620b as yc-yb. According to an embodiment, the image decoding apparatus 100 can determine the width or height of the lower coding unit 620c by using the width or height of the current coding unit 600 or the width or height of the upper coding unit 620a and the middle coding unit 620b. The image decoding apparatus 100 can determine a coding unit having a size different from those of the other coding units based on the determined widths and heights of the coding units 620a, 620b, and 620c. Referring to Figure 6 , the image decoding apparatus 100 can determine the middle coding unit 620b having a size different from those of the upper coding unit 620a and the lower coding unit 620c as the coding unit at the preset position. However, the above-described method of determining a coding unit having a size different from those of the other coding units performed by the image decoding apparatus 100 corresponds to only an example of determining a coding unit at a preset position by using the sizes of the coding units determined based on the coordinates of the samples, and thus various methods of determining a coding unit at a preset position by comparing the sizes of the coding units determined based on the coordinates of the preset samples can be used.

[0135] The image decoding apparatus 100 can determine the width or height of each of the coding units 660a, 660b, and 660c by using the coordinates (xd, yd) that are information indicating the position of the top-left sample 670a of the left coding unit 660a, the coordinates (xe, ye) that are information indicating the position of the top-left sample 670b of the middle coding unit 660b, and the coordinates (xf, yf) that are information indicating the position of the top-left sample 670c of the right coding unit 660c. The image decoding apparatus 100 can determine the size of each of the coding units 660a, 660b, and 660c by using the coordinates (xd, yd), (xe, ye), and (xf, yf) indicating the positions of the coding units 660a, 660b, and 660c.

[0136] According to an embodiment, the image decoding apparatus 100 can determine the width of the left coding unit 660a as xe-xd. The image decoding apparatus 100 can determine the height of the left coding unit 660a as the height of the current coding unit 650. According to an embodiment, the image decoding apparatus 100 can determine the width of the middle coding unit 660b as xf-xe. The image decoding apparatus 100 can determine the height of the middle coding unit 660b as the height of the current coding unit 650. According to an embodiment, the image decoding apparatus 100 can determine the width or height of the right coding unit 660c by using the width or height of the current coding unit 650 or the width or height of the left coding unit 660a and the middle coding unit 660b. The image decoding apparatus 100 can determine a coding unit having a size different from those of the other coding units based on the determined widths and heights of the coding units 660a, 660b, and 660c. Referring to Figure 6 , the image decoding apparatus 100 can determine the middle coding unit 660b having a size different from those of the left coding unit 660a and the right coding unit 660c as a coding unit at a preset position. However, the above-described method of determining a coding unit having a size different from those of the other coding units performed by the image decoding apparatus 100 corresponds to only an example of determining a coding unit at a preset position by using the sizes of the coding units determined based on the coordinates of the samples, and thus various methods of determining a coding unit at a preset position by comparing the sizes of the coding units determined based on the coordinates of the preset samples can be used.

[0137] However, the positions of the samples considered in determining the positions of the coding units are not limited to the above-described top-left positions, and information on arbitrary positions of the samples included in the coding units can be used.

[0138] According to an embodiment, the image decoding apparatus 100 can select a coding unit at a preset position from among the odd number of coding units determined by partitioning the current coding unit, considering a shape of the current coding unit. For example, when the current coding unit has a non-square shape with a width longer than a height, the image decoding apparatus 100 can determine a coding unit at a preset position in a horizontal direction. That is, the image decoding apparatus 100 can determine one of the coding units at different positions in the horizontal direction and can impose a restriction on the coding unit. When the current coding unit has a non-square shape with a height longer than a width, the image decoding apparatus 100 can determine a coding unit at a preset position in a vertical direction. That is, the image decoding apparatus 100 can determine one of the coding units at different positions in the vertical direction and can impose a restriction on the coding unit.

[0139] According to an embodiment, the image decoding apparatus 100 can use information indicating respective positions of the even number of coding units to determine a coding unit at a preset position among the even number of coding units. The image decoding apparatus 100 can determine the even number of coding units by partitioning (binary partitioning) the current coding unit and can determine a coding unit at a preset position by using information about positions of the even number of coding units. Operations related thereto can correspond to the operations of determining a coding unit at a preset position (e.g., a center position) among the odd number of coding units that have been described above with respect to FIGS. 1 to 6, and thus a detailed description thereof will not be provided here. Figure 6 The operations of determining a coding unit at a preset position (e.g., a center position) among the odd number of coding units that have been described in detail above correspond, and thus a detailed description thereof will not be provided here.

[0140] According to an embodiment, when a non-square current coding unit is partitioned into a plurality of coding units, a coding unit at a preset position among the plurality of coding units can be determined using preset information about the coding unit at the preset position in a partitioning operation. For example, the image decoding apparatus 100 can determine a coding unit at a center position among the plurality of coding units determined by partitioning the current coding unit using at least one of block shape information and partition shape mode information stored in samples included in the center coding unit in the partitioning operation.

[0141] Referring to Figure 6, the image decoding apparatus 100 can divide the current coding unit 600 into the plurality of coding units 620a, 620b, and 620c based on the division shape mode information, and can determine the coding unit 620b at the center position among the plurality of coding units 620a, 620b, and 620c. Also, the image decoding apparatus 100 can determine the coding unit 620b at the center position in consideration of a position at which the division shape mode information is obtained. That is, the division shape mode information of the current coding unit 600 can be obtained from the sample 640 at the center position of the current coding unit 600, and when the current coding unit 600 is divided into the plurality of coding units 620a, 620b, and 620c based on the division shape mode information, the coding unit 620b including the sample 640 can be determined as the coding unit at the center position. However, information for determining the coding unit at the center position is not limited to the division shape mode information, and the coding unit at the center position can be determined using various types of information.

[0142] According to an embodiment, the preset information for identifying the coding unit at the preset position can be obtained from a preset sample included in the coding unit to be determined. Referring to Figure 6 , the image decoding apparatus 100 can determine the coding unit at the preset position (e.g., the coding unit at the center position among the divided plurality of coding units) among the plurality of coding units 620a, 620b, and 620c determined by dividing the current coding unit 600 using the division shape mode information obtained from the sample at the preset position (e.g., the sample at the center position of the current coding unit 600) in the current coding unit 600. That is, the image decoding apparatus 100 can determine the sample at the preset position by considering the block shape of the current coding unit 600, can determine the coding unit 620b including the sample from which the preset information (e.g., the division shape mode information) can be obtained from among the plurality of coding units 620a, 620b, and 620c determined by dividing the current coding unit 600, and can apply the preset restriction to the coding unit 620b. Referring to Figure 5 , according to an embodiment, in the decoding operation, the image decoding apparatus 100 can determine the sample 640 at the center position of the current coding unit 600 as the sample from which the preset information can be obtained, and can apply the preset restriction to the coding unit 620b including the sample 640. However, the position of the sample from which the preset information can be obtained is not limited to the above-described position, and can include any position of the sample included in the coding unit 620b to be determined to be restricted.

[0143] According to an embodiment, the image decoding apparatus 100 can determine the position of the sample from which the preset information is obtainable based on the shape of the current coding unit 600. According to an embodiment, the block shape information can indicate whether the current coding unit has a square shape or a non-square shape, and the position of the sample from which the preset information is obtainable can be determined based on the shape. For example, the image decoding apparatus 100 can determine a sample located on a boundary for equally dividing at least one of a width and a height of the current coding unit as a sample from which the preset information is obtainable by using at least one of information about the width of the current coding unit and information about the height of the current coding unit. As another example, when the block shape information of the current coding unit indicates a non-square shape, the image decoding apparatus 100 can determine one of samples adjacent to a boundary for equally dividing a long side of the current coding unit as a sample from which the preset information is obtainable.

[0144] According to an embodiment, when the current coding unit is divided into a plurality of coding units, the image decoding apparatus 100 can determine a coding unit at a preset position among the plurality of coding units using division shape mode information. According to an embodiment, the image decoding apparatus 100 can obtain the division shape mode information from a sample at the preset position in a coding unit, and can divide a plurality of coding units generated by dividing the current coding unit by using the division shape mode information obtained from a sample at the preset position in each of the plurality of coding units. That is, the coding units can be recursively divided based on the division shape mode information obtained from a sample at the preset position in each of the coding units. The above has been described with respect to FIG. 2. Figure 7 The operation of recursively dividing the coding units is described, and thus a detailed description thereof will not be provided here.

[0145] According to an embodiment, the image decoding apparatus 100 can determine one or more coding units by dividing the current coding unit, and can determine an order in which the one or more coding units are decoded based on a preset block (e.g., the current coding unit).

[0146] Figure 7 An order in which the image decoding apparatus 100 processes a plurality of coding units when the image decoding apparatus 100 determines the plurality of coding units by dividing a current coding unit is shown according to an embodiment.

[0147] According to an embodiment, based on the division shape pattern information, the image decoding device 100 can determine the second coding units 710a and 710b by dividing the first coding unit 700 in the vertical direction, determine the second coding units 730a and 730b by dividing the first coding unit 700 in the horizontal direction, or determine the second coding units 750a, 750b, 750c and 750d by dividing the first coding unit 700 in both the vertical and horizontal directions.

[0148] Reference Figure 7 The image decoding device 100 can determine to process second coding units 710a and 710b, determined by dividing the first coding unit 700 in the vertical direction, in a horizontal direction sequence 710c. The image decoding device 100 can also determine to process second coding units 730a and 730b, determined by dividing the first coding unit 700 in the horizontal direction, in a vertical direction sequence 730c. The image decoding device 100 can determine second coding units 750a, 750b, 750c, and 750d, determined by dividing the first coding unit 700 in both the vertical and horizontal directions, according to a preset order (e.g., raster scan order or zigzag scan order 750e), wherein coding units in one row are processed according to the preset order, and then coding units in the next row are processed.

[0149] According to an embodiment, the image decoding device 100 can recursively divide encoding units. (See also...) Figure 7 The image decoding device 100 can determine a plurality of coding units 710a and 710b, 730a and 730b, or 750a, 750b, 750c and 750d by dividing a first coding unit 700, and can recursively divide each of the determined plurality of coding units 710a, 710b, 730a, 730b, 750a, 750b, 750c and 750d. The method of dividing the plurality of coding units 710a and 710b, 730a and 730b, or 750a, 750b, 750c and 750d can correspond to the method of dividing the first coding unit 700. Therefore, each of the plurality of coding units 710a and 710b, 730a and 730b, or 750a, 750b, 750c and 750d can be independently divided into a plurality of coding units. (Refer to...) Figure 8 The image decoding device 100 can determine the second coding units 710a and 710b by dividing the first coding unit 700 in the vertical direction, and can determine whether to divide or not divide each of the second coding units 710a and 710b independently.

[0150] According to an embodiment, the image decoding apparatus 100 can determine the third coding units 720a and 720b by dividing the left second coding unit 710a in the horizontal direction, and can not divide the right second coding unit 710b.

[0151] According to an embodiment, the processing order of coding units can be determined based on the operation of dividing the coding units. In other words, the processing order of divided coding units can be determined based on the processing order of the coding unit immediately before being divided. The image decoding apparatus 100 can determine the processing order of the third coding units 720a and 720b determined by dividing the left second coding unit 710a independently of the right second coding unit 710b. Since the third coding units 720a and 720b are determined by dividing the left second coding unit 710a in the horizontal direction, the third coding units 720a and 720b can be processed in the vertical direction order 720c. Since the left second coding unit 710a and the right second coding unit 710b are processed in the horizontal direction order 710c, the right second coding unit 710b can be processed after the third coding units 720a and 720b included in the left second coding unit 710a are processed in the vertical direction order 720c. The operation of determining the processing order of coding units based on the coding unit before being divided is not limited to the above-described example, and various methods can be used to independently process the divided coding units determined to be various shapes in a preset order.

[0152] Figure 8 A process in which the image decoding apparatus 100 determines that a current coding unit is to be divided into an odd number of coding units when the coding unit cannot be processed in a preset order according to an embodiment is shown.

[0153] According to an embodiment, the image decoding apparatus 100 can determine that a current coding unit is to be divided into an odd number of coding units based on the obtained division shape mode information. Referring to Figure 8 , the square first coding unit 800 can be divided into the non-square second coding units 810a and 810b, and the second coding units 810a and 810b can be independently divided into the third coding units 820a and 820b and 820c, 820d, and 820e. According to an embodiment, the image decoding apparatus 100 can determine the plurality of third coding units 820a and 820b by dividing the left second coding unit 810a in the horizontal direction, and can divide the right second coding unit 810b into an odd number of third coding units 820c, 820d, and 820e.

[0154] According to an embodiment, the video decoding apparatus 100 can determine whether an arbitrary coding unit is divided into an odd number of coding units by determining whether the third coding units 820a and 820b and 820c, 820d and 820e can be processed in a preset order. Referring to Figure 9 , the video decoding apparatus 100 can determine the third coding units 820a and 820b and 820c, 820d and 820e by recursively dividing the first coding unit 800. The video decoding apparatus 100 can determine whether an arbitrary one of the following coding units is divided into an odd number of coding units based on at least one of the block shape information and the division shape mode information: the first coding unit 800, the second coding units 810a and 810b, or the third coding units 820a and 820b and 820c, 820d and 820e. For example, the right-side one of the second coding units 810a and 810b can be divided into an odd number of third coding units 820c, 820d and 820e. The processing order of the plurality of coding units included in the first coding unit 800 can be a preset order (e.g., the zigzag scan order 830), and the video decoding apparatus 100 can determine whether the third coding units 820c, 820d and 820e determined by dividing the right-side second coding unit 810b into an odd number of coding units satisfy a condition for being processed in the preset order.

[0155] According to an embodiment, the video decoding apparatus 100 can determine whether the third coding units 820a and 820b and 820c, 820d and 820e included in the first coding unit 800 satisfy a condition for being processed in a preset order, and the condition relates to whether at least one of the width or the height of the second coding units 810a and 810b will be halved along the boundaries of the third coding units 820a and 820b and 820c, 820d and 820e. For example, the third coding units 820a and 820b determined when the height of the left-side second coding unit 810a of a non-square shape is halved can satisfy the condition. Since the boundaries of the third coding units 820c, 820d and 820e determined when the right-side second coding unit 810b is divided into three coding units fail to halve the width or the height of the right-side second coding unit 810b, it can be determined that the third coding units 820c, 820d and 820e do not satisfy the condition. When the condition is not satisfied as described above, the video decoding apparatus 100 can determine that the scan order is discontinuous, and can determine based on the determination result that the right-side second coding unit 810b will be divided into an odd number of coding units. According to an embodiment, when a coding unit is divided into an odd number of coding units, the video decoding apparatus 100 can impose a preset restriction on a coding unit at a preset position among the divided coding units. The restriction or the preset position has been described above with respect to various embodiments, and thus a detailed description thereof will not be provided here.

[0156] Figure 9 A process of determining at least one coding unit by dividing the first coding unit 900 according to an embodiment, which is performed by the image decoding apparatus 100, is illustrated.

[0157] According to an embodiment, the image decoding apparatus 100 can divide the first coding unit 900 based on the division shape mode information obtained through the bitstream obtainer 110. The square first coding unit 900 can be divided into four square coding units, or can be divided into a plurality of non-square coding units. For example, referring to FIG. 9, the square first coding unit 900 can be divided into the second coding units 910a, 910b, 910c, 920a, 920b, and 920c. Figure 9 When the first coding unit 900 has a square shape and the division shape mode information indicates that the first coding unit 900 is divided into non-square coding units, the image decoding apparatus 100 can divide the first coding unit 900 into a plurality of non-square coding units. In detail, when the division shape mode information indicates that an odd number of coding units are determined by dividing the first coding unit 900 in a horizontal direction or a vertical direction, the image decoding apparatus 100 can divide the square first coding unit 900 into the odd number of coding units (for example, the second coding units 910a, 910b, and 910c determined by dividing the square first coding unit 900 in the vertical direction, or the second coding units 920a, 920b, and 920c determined by dividing the square first coding unit 900 in the horizontal direction).

[0158] According to an embodiment, the image decoding apparatus 100 can determine whether the second coding units 910a, 910b, 910c, 920a, 920b, and 920c included in the first coding unit 900 satisfy a condition for processing in a preset order, and the condition relates to whether at least one of a width and a height of the first coding unit 900 is to be halved along a boundary of the second coding units 910a, 910b, 910c, 920a, 920b, and 920c. Referring to Figure 9Because the boundaries of the second encoding units 910a, 910b, and 910c determined by dividing the first encoding unit 900, which is a square, in the vertical direction do not divide the width of the first encoding unit 900 in half, it can be determined that the first encoding unit 900 does not satisfy the condition for processing in the preset order. Also, because the boundaries of the second encoding units 920a, 920b, and 920c determined by dividing the first encoding unit 900, which is a square, in the horizontal direction do not divide the height of the first encoding unit 900 in half, it can be determined that the first encoding unit 900 does not satisfy the condition for processing in the preset order. When the condition is not satisfied as described above, the image decoding apparatus 100 can determine that the scan order is discontinuous, and can determine, based on the determination result, that the first encoding unit 900 is to be divided into an odd number of encoding units. According to an embodiment, when an encoding unit is divided into an odd number of encoding units, the image decoding apparatus 100 can apply a preset restriction to an encoding unit at a preset position among the divided encoding units. The restriction or the preset position has been described above with respect to various embodiments, and thus a detailed description thereof will not be provided here.

[0159] According to an embodiment, the image decoding apparatus 100 can determine various shapes of encoding units by dividing a first encoding unit.

[0160] Referring to Figure 10 , the image decoding apparatus 100 can divide a first encoding unit 900, which is a square, or a first encoding unit 930 or 950, which is not a square, into various shapes of encoding units.

[0161] Figure 11 It is shown that, according to an embodiment, when a second encoding unit determined by the image decoding apparatus 100 by dividing a first encoding unit 1000 has a non-square shape and satisfies a preset condition, the shape into which the second encoding unit can be divided is restricted.

[0162] According to an embodiment, the image decoding device 100 can determine, based on the partitioning shape pattern information obtained by the bitstream acquirer 110, to divide the square first coding unit 1000 into non-square second coding units 1010a and 1010b, or 1020a and 1020b. The second coding units 1010a and 1010b, or 1020a and 1020b, can be divided independently. Thus, the image decoding device 100 can determine, based on the partitioning shape pattern information of each of the second coding units 1010a and 1010b, or 1020a and 1020b, to divide each of the second coding units 1010a and 1010b, or 1020a and 1020b, into multiple coding units, or not to divide each of the second coding units 1010a and 1010b, or 1020a and 1020b. According to an embodiment, the image decoding device 100 can determine the third coding units 1012a and 1012b by dividing the non-square left second coding unit 1010a, determined by dividing the first coding unit 1000 in the vertical direction, in the horizontal direction. However, when the left second coding unit 1010a is divided in the horizontal direction, the image decoding device 100 can restrict the right second coding unit 1010b to not be divided in the horizontal direction in which the left second coding unit 1010a is divided. When the third coding units 1014a and 1014b are determined by dividing the right second coding unit 1010b in the same direction, since the left second coding unit 1010a and the right second second coding unit 1010b are divided independently in the horizontal direction, the third coding units 1012a and 1012b, or 1014a and 1014b, can be determined. However, this situation works in the same way as when the image decoding device 100 divides the first encoding unit 1000 into four squares, namely the second encoding units 1030a, 1030b, 1030c and 1030d, based on the division shape pattern information, and may be inefficient in terms of image decoding.

[0163] According to an embodiment, the image decoding device 100 can determine the third coding units 1022a and 1022b, or 1024a and 1024b, by dividing the non-square second coding units 1020a or 1020b, which are determined by dividing the first coding unit 1000 in the horizontal direction, in the vertical direction. However, when the second coding unit (e.g., the upper second coding unit 1020a) is divided in the vertical direction, for the reasons described above, the image decoding device 100 can restrict another second coding unit (e.g., the lower second coding unit 1020b) to not be divided in the vertical direction in which the upper second coding unit 1020a is divided.

[0164] Figure 12A process of dividing a square coding unit performed by the image decoding apparatus 100 when the division shape mode information indicates that the square coding unit will not be divided into four square coding units according to an embodiment is shown.

[0165] According to an embodiment, the image decoding apparatus 100 can determine second coding units 1110a and 1110b, or 1120a and 1120b, etc. by dividing the first coding unit 1100 based on the division shape mode information. The division shape mode information can include information on various methods of dividing coding units, but the information on the various division methods can not include information for dividing a coding unit into four square coding units. According to such division shape mode information, the image decoding apparatus 100 can not divide the square first coding unit 1100 into four square coding units 1130a, 1130b, 1130c, and 1130d. The image decoding apparatus 100 can determine the non-square second coding units 1110a and 1110b, or 1120a and 1120b, etc. based on the division shape mode information.

[0166] According to an embodiment, the image decoding apparatus 100 can independently divide the non-square second coding units 1110a and 1110b, or 1120a and 1120b, etc. Each of the second coding units 1110a and 1110b, or 1120a and 1120b, etc. can be recursively divided in a predetermined order, and the division method can correspond to the method of dividing the first coding unit 1100 based on the division shape mode information.

[0167] For example, the image decoding apparatus 100 can determine square third coding units 1112a and 1112b by dividing the left second coding unit 1110a in the horizontal direction, and can determine square third coding units 1114a and 1114b by dividing the right second coding unit 1110b in the horizontal direction. Also, the image decoding apparatus 100 can determine square third coding units 1116a, 1116b, 1116c, and 1116d by dividing both the left second coding unit 1110a and the right second coding unit 1110b in the horizontal direction. In this case, coding units having the same shape as the four square second coding units 1130a, 1130b, 1130c, and 1130d divided from the first coding unit 1100 can be determined.

[0168] As another example, the image decoding apparatus 100 can determine square third coding units 1122a and 1122b by dividing the upper second coding unit 1120a in the vertical direction, and can determine square third coding units 1124a and 1124b by dividing the lower second coding unit 1120b in the vertical direction. Also, the image decoding apparatus 100 can determine square third coding units 1126a, 1126b, 1126c, and 1126d by dividing both the upper second coding unit 1120a and the lower second coding unit 1120b in the vertical direction. In this case, coding units having the same shape as the four square second coding units 1130a, 1130b, 1130c, and 1130d divided from the first coding unit 1100 can be determined.

[0169] Figure 12 The processing order between the plurality of coding units according to the embodiment is shown, and can change according to the processing of dividing the coding units.

[0170] According to the embodiment, the image decoding apparatus 100 can divide the first coding unit 1200 based on the division shape mode information. When the block shape indicates a square shape and the division shape mode information indicates to divide the first coding unit 1200 in at least one of the horizontal direction and the vertical direction, the image decoding apparatus 100 can determine second coding units 1210a and 1210b, or 1220a and 1220b, etc. by dividing the first coding unit 1200. Referring to Figure 11 The non-square second coding units 1210a and 1210b, or 1220a and 1220b determined by dividing the first coding unit 1200 only in the horizontal direction or the vertical direction can be independently divided based on the division shape mode information of each coding unit. For example, the image decoding apparatus 100 can determine third coding units 1216a, 1216b, 1216c, and 1216d by dividing the second coding units 1210a and 1210b generated by dividing the first coding unit 1200 in the vertical direction in the horizontal direction, and can determine third coding units 1226a, 1226b, 1226c, and 1226d by dividing the second coding units 1220a and 1220b generated by dividing the first coding unit 1200 in the horizontal direction in the vertical direction. The operation of dividing the second coding units 1210a and 1210b, or 1220a and 1220b has been described above with respect to Figure 7 Therefore, a detailed description thereof will not be provided here.

[0171] According to the embodiment, the image decoding apparatus 100 can process the coding units in a predetermined order. The processing order between the plurality of coding units according to the embodiment has been described above with respect to Figure 12The operation of processing the coding units in the preset order is described, and thus detailed description thereof will not be provided here. Referring to Figure 12 The image decoding apparatus 100 can determine the four square third coding units 1216a, 1216b, 1216c, and 1216d and 1226a, 1226b, 1226c, and 1226d by dividing the square first coding unit 1200. According to an embodiment, the image decoding apparatus 100 can determine a processing order of the third coding units 1216a, 1216b, 1216c, and 1216d and 1226a, 1226b, 1226c, and 1226d based on a division shape of dividing the first coding unit 1200.

[0172] According to an embodiment, the image decoding apparatus 100 can determine the third coding units 1216a, 1216b, 1216c, and 1216d by dividing the second coding units 1210a and 1210b generated by dividing the first coding unit 1200 in the vertical direction in the horizontal direction, and can process the third coding units 1216a, 1216b, 1216c, and 1216d in the following processing order 1217: first processing the third coding units 1216a and 1216c included in the left second coding unit 1210a in the vertical direction, and then processing the third coding units 1216b and 1216d included in the right second coding unit 1210b in the vertical direction.

[0173] According to an embodiment, the image decoding apparatus 100 can determine the third coding units 1226a, 1226b, 1226c, and 1226d by dividing the second coding units 1220a and 1220b generated by dividing the first coding unit 1200 in the horizontal direction in the vertical direction, and can process the third coding units 1226a, 1226b, 1226c, and 1226d in the following processing order 1227: first processing the third coding units 1226a and 1226b included in the upper second coding unit 1220a in the horizontal direction, and then processing the third coding units 1226c and 1226d included in the lower second coding unit 1220b in the horizontal direction.

[0174] Referring to Figure 13The square third coding units 1216a, 1216b, 1216c, and 1216d and 1226a, 1226b, 1226c, and 1226d can be determined by dividing the second coding units 1210a and 1210b and 1220a and 1220b, respectively. Although the second coding units 1210a and 1210b are determined by dividing the first coding unit 1200 in the vertical direction and the second coding units 1220a and 1220b are determined by dividing the first coding unit 1200 in the horizontal direction, the third coding units 1216a, 1216b, 1216c, and 1216d and the third coding units 1226a, 1226b, 1226c, and 1226d divided from the second coding units 1210a and 1210b and the second coding units 1220a and 1220b finally show the same shape of coding units divided from the first coding unit 1200. As such, by recursively dividing coding units in different ways based on the division shape mode information, even if the coding units are finally determined to be the same shape, the image decoding apparatus 100 can process the plurality of coding units in different orders.

[0175] Figure 13 A process of determining a depth of a coding unit when a shape and a size of the coding unit are changed when the coding unit is recursively divided to determine a plurality of coding units according to an embodiment is shown.

[0176] According to an embodiment, the image decoding apparatus 100 can determine a depth of a coding unit based on a preset criterion. For example, the preset criterion can be a length of a long side of the coding unit. When a length of a long side of a coding unit before being divided is 2n (n > 0) times a length of a long side of a current coding unit after being divided, the image decoding apparatus 100 can determine that the depth of the current coding unit is increased by n from the depth of the coding unit before being divided. In the following description, a coding unit having an increased depth is denoted as a coding unit of a lower depth.

[0177] Referring to Figure 14According to an embodiment, the image decoding apparatus 100 can determine the second coding unit 1302 and the third coding unit 1304 of a lower depth by dividing the first coding unit 1300 of a square shape based on the block shape information indicating the square shape (e.g., the block shape information can be represented as "0:SQUARE"). Assuming that the size of the first coding unit 1300 of a square shape is 2Nx2N, the second coding unit 1302 determined by dividing the width and height of the first coding unit 1300 by 1 / 2 can have a size of NxN. Also, the third coding unit 1304 determined by dividing the width and height of the second coding unit 1302 by 1 / 2 can have a size of N / 2xN / 2. In this case, the width and height of the third coding unit 1304 are 1 / 4 of the width and height of the first coding unit 1300. When the depth of the first coding unit 1300 is D, the depth of the second coding unit 1302 whose width and height are 1 / 2 of the width and height of the first coding unit 1300 can be D+1, and the depth of the third coding unit 1304 whose width and height are 1 / 4 of the width and height of the first coding unit 1300 can be D+2.

[0178] According to an embodiment, the image decoding apparatus 100 can determine the second coding unit 1312 or 1322 and the third coding unit 1314 or 1324 of a lower depth by dividing the first coding unit 1310 or 1320 of a non-square shape based on the block shape information indicating the non-square shape (e.g., the block shape information can be represented as "1:NS_VER" indicating a non-square shape in which the height is longer than the width, or can be represented as "2:NS_HOR" indicating a non-square shape in which the width is longer than the height).

[0179] The image decoding apparatus 100 can determine the second coding unit 1302, 1312, or 1322 by dividing at least one of the width and height of the first coding unit 1310 having a size of Nx2N. That is, the image decoding apparatus 100 can determine the second coding unit 1302 having a size of NxN or the second coding unit 1322 having a size of NxN / 2 by dividing the first coding unit 1310 in the horizontal direction, or can determine the second coding unit 1312 having a size of N / 2xN by dividing the first coding unit 1310 in the horizontal and vertical directions.

[0180] According to an embodiment, the image decoding apparatus 100 can determine the second coding units 1302, 1312, or 1322 by dividing at least one of the width and the height of the first coding unit 1320 having a size of 2N×N. That is, the image decoding apparatus 100 can determine the second coding unit 1302 having a size of N×N or the second coding unit 1312 having a size of N / 2×N by dividing the first coding unit 1320 in the vertical direction, or can determine the second coding unit 1322 having a size of N×N / 2 by dividing the first coding unit 1320 in the horizontal direction and the vertical direction.

[0181] According to an embodiment, the image decoding apparatus 100 can determine the third coding units 1304, 1314, or 1324 by dividing at least one of the width and the height of the second coding unit 1302 having a size of N×N. That is, the image decoding apparatus 100 can determine the third coding unit 1304 having a size of N / 2×N / 2, the third coding unit 1314 having a size of N / 4×N / 2, or the third coding unit 1324 having a size of N / 2×N / 4 by dividing the second coding unit 1302 in the vertical direction and the horizontal direction.

[0182] According to an embodiment, the image decoding apparatus 100 can determine the third coding units 1304, 1314, or 1324 by dividing at least one of the width and the height of the second coding unit 1312 having a size of N / 2×N. That is, the image decoding apparatus 100 can determine the third coding unit 1304 having a size of N / 2×N / 2 or the third coding unit 1324 having a size of N / 2×N / 4 by dividing the second coding unit 1312 in the horizontal direction, or can determine the third coding unit 1314 having a size of N / 4×N / 2 by dividing the second coding unit 1312 in the vertical direction and the horizontal direction.

[0183] According to an embodiment, the image decoding apparatus 100 can determine the third coding units 1304, 1314, or 1324 by dividing at least one of the width and the height of the second coding unit 1322 having a size of N×N / 2. That is, the image decoding apparatus 100 can determine the third coding unit 1304 having a size of N / 2×N / 2 or the third coding unit 1314 having a size of N / 4×N / 2 by dividing the second coding unit 1322 in the vertical direction, or can determine the third coding unit 1324 having a size of N / 2×N / 4 by dividing the second coding unit 1322 in the vertical direction and the horizontal direction.

[0184] According to an embodiment, the image decoding apparatus 100 can divide the square coding unit 1300, 1302, or 1304 in a horizontal direction or a vertical direction. For example, the image decoding apparatus 100 can determine a first coding unit 1310 having a size of N×2N by dividing the first coding unit 1300 having a size of 2N×2N in a vertical direction, or can determine a first coding unit 1320 having a size of 2N×N by dividing the first coding unit 1300 in a horizontal direction. According to an embodiment, when a depth is determined based on a length of a longest side of a coding unit, the depth of a coding unit determined by dividing the first coding unit 1300 having a size of 2N×2N in a horizontal direction or a vertical direction can be the same as the depth of the first coding unit 1300.

[0185] According to an embodiment, the width and height of the third coding unit 1314 or 1324 can be 1 / 4 of the width and height 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 having a width and height of 1 / 2 of the width and height of the first coding unit 1310 or 1320 can be D+1, and the depth of the third coding unit 1314 or 1324 having a width and height of 1 / 4 of the width and height of the first coding unit 1310 or 1320 can be D+2.

[0186] Figure 14 A depth that can be determined based on a shape and size of a coding unit and a partial index (PID) for distinguishing coding units are shown according to an embodiment.

[0187] According to an embodiment, the image decoding apparatus 100 can determine second coding units of various shapes by dividing the square first coding unit 1400. Referring to Figure 14 , the image decoding apparatus 100 can determine the second coding units 1402a and 1402b, the second coding units 1404a and 1404b, and the second coding units 1406a, 1406b, 1406c, and 1406d by dividing the first coding unit 1400 in at least one of a vertical direction and a horizontal direction based on the division shape mode information. That is, the image decoding apparatus 100 can determine the second coding units 1402a and 1402b, 1404a and 1404b, and 1406a, 1406b, 1406c, and 1406d based on the division shape mode information of the first coding unit 1400.

[0188] According to an embodiment, depths of the second coding units 1402a and 1402b, 1404a and 1404b, and 1406a, 1406b, 1406c, and 1406d determined based on the partition shape mode information of the first coding unit 1400 having a square shape can be determined based on lengths of their long sides. For example, because a length of a side of the first coding unit 1400 having a square shape is equal to a length of a long side of each of the second coding units 1402a and 1402b and 1404a and 1404b having a non-square shape, the first coding unit 1400 and the non-square second coding units 1402a and 1402b and 1404a and 1404b can have the same depth, e.g., D. However, when the image decoding apparatus 100 partitions the first coding unit 1400 into four square second coding units 1406a, 1406b, 1406c, and 1406d based on the partition shape mode information, because lengths of sides of the square second coding units 1406a, 1406b, 1406c, and 1406d are 1 / 2 of a length of a side of the first coding unit 1400, depths of the second coding units 1406a, 1406b, 1406c, and 1406d can be D+1, which is 1 deeper than the depth D of the first coding unit 1400.

[0189] According to an embodiment, the image decoding apparatus 100 can determine a plurality of second coding units 1412a and 1412b and 1414a, 1414b, and 1414c by partitioning a first coding unit 1410 having a height longer than a width in a horizontal direction based on the partition shape mode information. According to an embodiment, the image decoding apparatus 100 can determine a plurality of second coding units 1422a and 1422b and 1424a, 1424b, and 1424c by partitioning a first coding unit 1420 having a width longer than a height in a vertical direction based on the partition shape mode information.

[0190] According to an embodiment, depths of the second coding units 1412a and 1412b and 1414a, 1414b, and 1414c, or 1422a and 1422b and 1424a, 1424b, and 1424c determined based on the partition shape mode information of the non-square first coding unit 1410 or 1420 can be determined based on lengths of their long sides. For example, because lengths of sides of the square second coding units 1412a and 1412b are 1 / 2 of a length of a long side of the first coding unit 1410 having a non-square shape having a height longer than a width, depths of the square second coding units 1412a and 1412b are D+1, which is 1 lower than a depth D of the non-square first coding unit 1410.

[0191] Further, the image decoding apparatus 100 can divide the first coding unit 1410, which is not a square, into an odd number of second coding units 1414a, 1414b, and 1414c based on the division shape mode information. The odd number of second coding units 1414a, 1414b, and 1414c can include the second coding units 1414a and 1414c, which are not squares, and the second coding unit 1414b, which is a square. In this case, because the length of the long side of the second coding units 1414a and 1414c, which are not squares, and the length of the side of the second coding unit 1414b, which is a square, are 1 / 2 of the length of the long side of the first coding unit 1410, the depth of the second coding units 1414a, 1414b, and 1414c can be D+1, which is 1 lower than the depth D of the first coding unit 1410, which is not a square. The image decoding apparatus 100 can determine the depth of the coding units divided from the first coding unit 1420 having a non-square shape in which the width is longer than the height by using the above-described method of determining the depth of the coding units divided from the first coding unit 1410.

[0192] According to an embodiment, when the odd number of divided coding units do not have equal sizes, the image decoding apparatus 100 can determine the PIDs for identifying the divided coding units based on a size ratio between the coding units. Referring to Figure 14 , the width of the coding unit 1414b at the center position among the odd number of divided coding units 1414a, 1414b, and 1414c can be equal to the widths of the other coding units 1414a and 1414c and its height is twice the heights of the other coding units 1414a and 1414c. That is, in this case, the coding unit 1414b at the center position can include two other coding units 1414a or 1414c. Accordingly, when the PID of the coding unit 1414b at the center position is 1 based on the scanning order, the PID of the coding unit 1414c located at a position adjacent to the coding unit 1414b can increase by 2 and thus can be 3. That is, there can be discontinuity in the PID values. According to an embodiment, the image decoding apparatus 100 can determine whether the odd number of divided coding units do not have equal sizes based on whether there is discontinuity in the PIDs for identifying the divided coding units.

[0193] According to an embodiment, the image decoding apparatus 100 can determine whether to use a specific division method based on the PID values for identifying a plurality of coding units determined by dividing a current coding unit. Referring to Figure 14, the image decoding apparatus 100 can determine an even number of coding units 1412a and 1412b or an odd number of coding units 1414a, 1414b, and 1414c by dividing the first coding unit 1410 having a rectangular shape with a height longer than a width. The image decoding apparatus 100 can use a PID indicating a corresponding coding unit in order to identify the corresponding coding unit. According to an embodiment, the PID can be obtained from a sample at a preset position (e.g., a top-left sample) of each coding unit.

[0194] According to an embodiment, the image decoding apparatus 100 can determine a coding unit at a preset position among divided coding units by using a PID for distinguishing the coding units. According to an embodiment, when the division shape mode information of the first coding unit 1410 having a rectangular shape with a height longer than a width indicates that the coding unit is divided into three coding units, the image decoding apparatus 100 can divide the first coding unit 1410 into three coding units 1414a, 1414b, and 1414c. The image decoding apparatus 100 can assign a PID to each of the three coding units 1414a, 1414b, and 1414c. The image decoding apparatus 100 can compare the PIDs of the odd number of divided coding units to determine a coding unit at a center position among the coding units. The image decoding apparatus 100 can determine the coding unit 1414b to which the PID corresponding to a middle value among the PIDs of the coding units as a coding unit at a center position among the coding units determined by dividing the first coding unit 1410. According to an embodiment, when the divided coding units do not have equal sizes, the image decoding apparatus 100 can determine a PID for distinguishing the divided coding units based on a size ratio between the coding units. Referring to Figure 15The width of the coding unit 1414b generated by dividing the first coding unit 1410 can be equal to the widths of the other coding units 1414a and 1414c, and the height thereof can be twice the heights of the other coding units 1414a and 1414c. In this case, when the PID of the coding unit 1414b at the center position is 1, the PID of the coding unit 1414c located at a position adjacent to the coding unit 1414b can increase by 2 and thus can be 3. When the PIDs are not uniformly increased as described above, the image decoding apparatus 100 can determine that the coding unit is divided into a plurality of coding units including a coding unit having a size different from those of the other coding units. According to an embodiment, when the division shape mode information indicates that the coding unit is divided into an odd number of coding units, the image decoding apparatus 100 can divide the current coding unit in such a manner that a coding unit at a predetermined position (e.g., a coding unit at a center position) among the odd number of coding units has a size different from those of the other coding units. In this case, the image decoding apparatus 100 can determine the coding unit at the center position having the different size by using the PIDs of the coding units. However, the PID of the coding unit at the predetermined position and the size or position are not limited to the above-described example, and various PIDs of the coding units and various positions and sizes can be used.

[0195] According to an embodiment, the image decoding apparatus 100 can use a predetermined data unit in which the coding unit is recursively divided is started.

[0196] Figure 15 A determination of a plurality of coding units based on a plurality of predetermined data units included in a picture according to an embodiment is illustrated.

[0197] According to an embodiment, the predetermined data unit can be defined as a data unit in which the coding unit is recursively divided is started by using the division shape mode information. That is, the predetermined data unit can correspond to a coding unit used to determine the highest depth of a plurality of coding units divided from a current picture. In the following description, the predetermined data unit is referred to as a reference data unit for convenience of explanation.

[0198] According to an embodiment, the reference data unit can have a predetermined size and a predetermined shape. According to an embodiment, the reference data unit can include MxN samples. Here, M and N can be equal to each other and can be an integer expressed as a power of 2. That is, the reference data unit can have a square shape or a non-square shape and can be divided into an integer number of coding units.

[0199] According to an embodiment, the image decoding apparatus 100 can divide the current picture into a plurality of reference data units. According to an embodiment, the image decoding apparatus 100 can divide the plurality of reference data units divided from the current picture by using the division shape mode information of each of the reference data units. The operation of dividing the reference data units can correspond to the division operation using the quad-tree structure.

[0200] According to an embodiment, the image decoding apparatus 100 can predefine a minimum size allowed for the reference data units included in the current picture. Accordingly, the image decoding apparatus 100 can determine various reference data units having a size equal to or greater than the minimum size, and can determine one or more coding units by using the division shape mode information with reference to the determined reference data units.

[0201] Referring to Figure 3 , the image decoding apparatus 100 can use a square reference coding unit 1500 or a non-square reference coding unit 1502. According to an embodiment, the shape and size of the reference coding unit can be determined based on various data units (e.g., a sequence, a picture, a slice, a slice segment, a parallel block, a parallel block group, a largest coding unit, etc.) capable of including one or more reference coding units.

[0202] According to an embodiment, the bitstream obtainer 110 of the image decoding apparatus 100 can obtain, from a bitstream, at least one of reference coding unit shape information and reference coding unit size information for each of various data units. The operation of dividing the current coding unit 300 has been described above with respect to Figure 4 the operation of dividing the current coding unit 300, and the operation of dividing the current coding unit 400 or 450 has been described above with respect to Figure 12 the operation of dividing the current coding unit 400 or 450. Accordingly, a detailed description thereof will not be provided here.

[0203] According to an embodiment, the image decoding apparatus 100 can use the PID for identifying the size and shape of the reference coding unit to determine the size and shape of the reference coding unit from some data units predetermined based on a preset condition. That is, the bitstream obtainer 110 can obtain from the bitstream only the PID for identifying the size and shape of the reference coding unit for each slice, slice segment, parallel block, parallel block group, or maximum coding unit, which is a data unit (e.g., a data unit having a size equal to or smaller than a slice) among various data units (e.g., sequence, picture, slice, slice segment, parallel block, parallel block group, maximum coding unit, etc.) satisfying the preset condition. The image decoding apparatus 100 can determine the size and shape of the reference data unit for each data unit satisfying the preset condition by using the PID. When the reference coding unit shape information and the reference coding unit size information are obtained from the bitstream according to each data unit having a relatively small size and used, the efficiency of using the bitstream can not be high, and thus, the PID can be obtained and used only, instead of directly obtaining the reference coding unit shape information and the reference coding unit size information. In this case, at least one of the size and shape of the reference coding unit corresponding to the PID for identifying the size and shape of the reference coding unit can be predetermined. That is, the image decoding apparatus 100 can determine at least one of the size and shape of the reference coding unit included in the data unit used as a unit for obtaining the PID by selecting at least one of the size and shape of the reference coding unit predetermined based on the PID.

[0204] According to an embodiment, the image decoding apparatus 100 can use one or more reference coding units included in a maximum coding unit. That is, the maximum coding unit divided from a picture can include one or more reference coding units, and the coding units can be determined by recursively dividing each reference coding unit. According to an embodiment, at least one of the width and height of the maximum coding unit can be an integer multiple of at least one of the width and height of the reference coding unit. According to an embodiment, the size of the reference coding unit can be obtained by dividing the maximum coding unit n times based on a quad-tree structure. That is, according to various embodiments, the image decoding apparatus 100 can determine the reference coding unit by dividing the maximum coding unit n times based on a quad-tree structure, and can divide the reference coding unit based on at least one of block shape information and division shape mode information.

[0205] According to an embodiment, the image decoding apparatus 100 can obtain block shape information indicating a shape of a current coding unit or partition shape mode information indicating a partition method of the current coding unit from a bitstream, and can use the obtained information. The partition shape mode information can be included in the bitstream in relation to various data units. For example, the image decoding apparatus 100 can use the partition 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, or a tile group header. Also, the image decoding apparatus 100 can obtain syntax elements corresponding to the block shape information or the partition shape mode information from the bitstream according to each largest coding unit or each reference coding unit, and can use the obtained syntax elements.

[0206] Hereinafter, a method of determining a partition rule according to an embodiment of the disclosure will be described in detail.

[0207] The image decoding apparatus 100 can determine a partition rule of an image. The partition rule can be determined in advance between the image decoding apparatus 100 and the image encoding apparatus 200. The image decoding apparatus 100 can determine the partition rule of the image based on information obtained from a bitstream. The image decoding apparatus 100 can determine the partition 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 image decoding apparatus 100 can determine the partition rule differently according to a frame, a slice, a tile, a temporal layer, a largest coding unit, or a coding unit.

[0208] The image decoding apparatus 100 can determine a partition rule based on a block shape of a coding unit. The block shape can include a size, a shape, an aspect ratio, and a direction of the coding unit. The image encoding apparatus 200 and the image decoding apparatus 100 can determine the partition rule based on the block shape of the coding unit in advance. However, embodiments are not limited thereto. The image decoding apparatus 100 can determine the partition rule based on information obtained from a bitstream received from the image encoding apparatus 200.

[0209] A shape of a coding unit can include a square and a non-square. When a width length and a height length of the coding unit are the same, the image decoding apparatus 100 can determine the shape of the coding unit as a square. Also, when the width length and the height length of the coding unit are not the same, the image decoding apparatus 100 can determine the shape of the coding unit as a non-square.

[0210] The size of the coding unit can include various sizes such as 4x4, 8x4, 4x8, 8x8, 16x4, 16x8, and up to 256x256. The size of the coding unit can be classified based on a long side length, a short side length, or an area of the coding unit. The image decoding apparatus 100 can apply the same division rule to the coding units classified into the same group. For example, the image decoding apparatus 100 can classify the coding units having the same long side length as having the same size. Also, the image decoding apparatus 100 can apply the same division rule to the coding units having the same long side length.

[0211] The aspect ratio of the coding unit can include 1:2, 2:1, 1:4, 4:1, 1:8, 8:1, 1:16, 16:1, 32:1, 1:32, etc. Also, the direction of the coding unit can include a horizontal direction and a vertical direction. The horizontal direction can indicate a case where the width length of the coding unit is longer than the height length of the coding unit. The vertical direction can indicate a case where the width length of the coding unit is shorter than the height length of the coding unit.

[0212] The image decoding apparatus 100 can adaptively determine the division rule based on the size of the coding unit. The image decoding apparatus 100 can differently determine the allowable division shape mode based on the size of the coding unit. For example, the image decoding apparatus 100 can determine whether to allow division based on the size of the coding unit. The image decoding apparatus 100 can determine the division direction according to the size of the coding unit. The image decoding apparatus 100 can determine the allowable division type according to the size of the coding unit.

[0213] The division rule determined based on the size of the coding unit can be a division rule determined in advance between the image encoding apparatus 200 and the image decoding apparatus 100. Also, the image decoding apparatus 100 can determine the division rule based on information obtained from the bitstream.

[0214] The image decoding apparatus 100 can adaptively determine the division rule based on the position of the coding unit. The image decoding apparatus 100 can adaptively determine the division rule based on the position of the coding unit in the image.

[0215] Also, the image decoding apparatus 100 can determine the division rule such that the coding units generated via different division paths do not have the same block shape. However, embodiments are not limited thereto, and the coding units generated via different division paths have the same block shape. The coding units generated via different division paths can have different decoding processing orders. Because the decoding processing order is described above with reference to Figure 16 The details thereof are not provided again.

[0216] Figure 16 FIGS. 6A and 6B illustrate coding units of respective pictures when the respective pictures have different division shape combinations of coding units according to an embodiment.

[0217] Referring to Figure 17 , the image decoding apparatus 100 can determine different partition shape combinations of coding units for each picture. For example, the image decoding apparatus 100 can decode a picture by using a picture 1600 that can be partitioned into four coding units, a picture 1610 that can be partitioned into two or four coding units, and a picture 1620 that can be partitioned into two, three, or four coding units, included in at least one picture of the picture. The image decoding apparatus 100 can partition the picture 1600 into coding units using only partition shape information indicating a partition into four square coding units. The image decoding apparatus 100 can partition the picture 1610 using only partition shape information indicating a partition into two or four coding units. The image decoding apparatus 100 can partition the picture 1620 using only partition shape information indicating a partition into two, three, or four coding units. The above-described partition shape combinations are embodiments for describing the operation of the image decoding apparatus 100, and thus, the above-described partition shape combinations should not be construed as being limited to the above-described embodiments. It should be construed that various partition shape combinations can be used for each preset data unit.

[0218] According to an embodiment, the bitstream obtainer 110 of the image decoding apparatus 100 can obtain a bitstream including an index representing a combination of partition shape information for each preset data unit (e.g., a sequence, a picture, a slice, a slice segment, a parallel block, a parallel block group, etc.). For example, the bitstream obtainer 110 can obtain an index representing a combination of partition shape information from a sequence parameter set, a picture parameter set, a slice header, a parallel block header, or a parallel block group header. The bitstream obtainer 110 of the image decoding apparatus 100 can determine a partition shape combination into which a coding unit can be partitioned for each preset data unit using the obtained index, and thus, the bitstream obtainer 110 can use different partition shape combinations for each preset data unit.

[0219] Figure 17 Various shapes of coding units that can be determined based on partition shape mode information that can be expressed with a binary code are shown according to an embodiment.

[0220] According to an embodiment, the image decoding apparatus 100 can partition a coding unit into various shapes by using block shape information and partition shape mode information obtained via the bitstream obtainer 110. The shapes into which a coding unit can be partitioned can be various shapes including the shapes described above through embodiments.

[0221] Referring to Figure 17, the image decoding apparatus 100 can divide the coding unit having a non-square shape in at least one of a horizontal direction and a vertical direction based on the division shape mode information.

[0222] According to embodiments, when the image decoding apparatus 100 can divide the coding unit having a square shape in the horizontal direction and the vertical direction to determine four square coding units, the division shape mode information of the square coding unit can indicate a four division shape. According to embodiments, the division shape mode information can be expressed in a binary code of 2 bits, and each division shape can be assigned a binary code. For example, when the coding unit is not divided, the division shape mode information can be expressed as (00)b, when the coding unit is divided in the horizontal direction and the vertical direction, the division shape mode information can be expressed as (01)b, when the coding unit is divided in the horizontal direction, the division shape mode information can be expressed as (10)b, and when the coding unit is divided in the vertical direction, the division shape mode information can be expressed as (11)b.

[0223] According to embodiments, when the image decoding apparatus 100 divides the coding unit having a non-square shape in the horizontal direction or the vertical direction, various division shapes that can be indicated by the division shape mode information can depend on the number of coding units into which the coding unit is to be divided. Referring to Figure 17 According to embodiments, the image decoding apparatus 100 can divide the coding unit having a non-square shape into at most three. Further, the image decoding apparatus 100 can divide the coding unit into two coding units. In this case, the division shape mode information can be expressed as (10)b. The image decoding apparatus 100 can divide the coding unit into three coding units. In this case, the division shape mode information can be expressed as (11)b. The image decoding apparatus 100 can determine not to divide the coding unit. In this case, the division shape mode information can be expressed as (0)b. That is, the image decoding apparatus 100 can use variable length coding (VLC) rather than fixed length coding (FLC) in order to use a binary code expressing the division shape mode information.

[0224] According to embodiments, referring to Figure 17 A binary code of the division shape mode information indicating that the coding unit is not divided can be expressed as (0)b. In the case where the binary code of the division shape mode information indicating that the coding unit is not divided is set to (00)b, although there is no division shape mode information set to (01)b, the binary code of the division shape mode information of 2 bits can need to be used all together. However, in the case of using three division shapes of the coding unit having a non-square shape, as Figure 17As shown in FIG. 1, the image decoding apparatus 100 can determine that the coding unit is not divided by using a binary code (0) b as the division shape mode information, thereby efficiently using the bitstream. However, the division shape of the coding unit having a non-square shape represented by the division shape mode information should not be interpreted as being limited to the three shapes shown in FIG. 1, but should be interpreted as including various shapes of the above-described embodiments. Figure 18

[0225] Figure 18 FIG. 2 shows other shapes of the coding unit that can be determined based on the division shape mode information that can be represented by a binary code according to an embodiment.

[0226] Referring to Figure 18 , the image decoding apparatus 100 can divide the coding unit having a square shape in a horizontal direction or a vertical direction and divide the coding unit having a non-square shape in the horizontal direction or the vertical direction based on the division shape mode information. That is, the division shape mode information can indicate that the coding unit having a square shape is divided in one direction. In this case, the binary code of the division shape mode information indicating that the coding unit having a square shape is not divided can be represented as (0) b. In the case where the binary code of the division shape mode information indicating that the coding unit is not divided is set to (00) b, although there is no division shape mode information set to (01) b, the binary code of the division shape mode information of 2 bits can need to be all used. However, in the case of using the three division shapes of the coding unit having a square shape, as shown in FIG. 1, the image decoding apparatus 100 can determine that the coding unit is not divided by using a binary code (0) b as the division shape mode information, thereby efficiently using the bitstream. However, the division shape of the coding unit having a square shape represented by the division shape mode information should not be interpreted as being limited to the three shapes shown in FIG. 1, but should be interpreted as including various shapes of the above-described embodiments. Figure 18 Figure 17

[0227] According to an embodiment, the block shape information or the division shape mode information can be represented by using a binary code, and the block shape information or the division shape mode information can be directly generated as a bitstream. Further, the block shape information or the division shape mode information that can be represented by a binary code can be used as an input binary code in context adaptive binary arithmetic coding (CABAC) instead of being directly generated as a bitstream.

[0228] ​​​The process of obtaining, by the image decoding apparatus 100 according to an embodiment, a syntax for block shape information or partition shape mode information through CABAC will be described. The image decoding apparatus 100 can obtain a bitstream including a binary code for the syntax through the bitstream obtainer 110. The image decoding apparatus 100 can de-binarize a bin string included in the obtained bitstream to detect a syntax element representing the block shape information or the partition shape mode information. According to an embodiment, the image decoding apparatus 100 can obtain a set of bin strings corresponding to a syntax element to be decoded and decode each bin by using probability information. The image decoding apparatus 100 can repeat this operation until a bin string configured with decoded bins is identical to one of previously obtained bin strings. The image decoding apparatus 100 can perform de-binarization on the bin string to determine the syntax element.

[0229] According to an embodiment, the image decoding apparatus 100 can perform a decoding process of adaptive binary arithmetic coding to determine a syntax for a bin string, and the image decoding apparatus 100 can update a probability model for bins obtained through the bitstream obtainer 110. Referring to Figure 17 , according to an embodiment, the bitstream obtainer 110 of the image decoding apparatus 100 can obtain a bitstream representing a binary code representing partition shape mode information. The image decoding apparatus 100 can determine a syntax for the partition shape mode information by using the obtained binary code having a size of 1 bit or 2 bits. The image decoding apparatus 100 can update probabilities for each bit of the binary code of 2 bits in order to determine the syntax for the partition shape mode information. That is, the image decoding apparatus 100 can update a probability that a next bin will have a value of 0 or 1 at the time of decoding according to which one of 0 or 1 is the value of a first bin of the binary code of 2 bits.

[0230] According to an embodiment, in the process of determining a syntax, the image decoding apparatus 100 can update a probability for a bin used in the process of decoding the bin of a bin string for the syntax, and the image decoding apparatus 100 can determine that a specific bit of the bin string has the same probability without updating the probability of the specific bit.

[0231] Referring to Figure 19In the process of determining the syntax by using the bin string representing the partition shape mode information of the coding unit having the non-square shape, the image decoding apparatus 100 can determine the syntax for the partition shape mode information by using the bin having a value of 0 in a case where the coding unit having the non-square shape is not partitioned. That is, when the block shape information indicates that the current coding unit has the non-square shape, the first bin of the bin string for the partition shape mode information can be 0 in a case where the coding unit having the non-square shape is not partitioned, and the first bin of the bin string for the partition shape mode information can be 1 in a case where the coding unit is partitioned into two or three coding units. Accordingly, the probability that the first bin of the bin string of the partition shape mode information of the coding unit having the non-square shape will be 0 can be 1 / 3, and the probability that the first bin will be 1 can be 2 / 3. As described above, because the partition shape mode information indicating that the coding unit having the non-square shape is not partitioned can be represented with the bin string of 1 bit having a value of 0, the image decoding apparatus 100 can determine whether the second bin is 0 or 1 only in a case where the first bin of the partition shape mode information is 1, to determine the syntax for the partition shape mode information. According to an embodiment, when the first bin for the partition shape mode information is 1, the image decoding apparatus 100 can determine that the probability that the second bin will be 0 is equal to the probability that the second bin will be 1, and decode the second bin.

[0232] Accordingly, the image decoding apparatus 100 can use various probabilities for the bins of the bin string for the partition shape mode information in the process of determining the bins. According to an embodiment, the image decoding apparatus 100 can determine different probabilities for the bins of the partition shape mode information according to the width of the current coding unit or the length of the longer side of the current coding unit. According to an embodiment, the image decoding apparatus 100 can determine different probabilities for the bins of the partition shape mode information according to at least one of the shape of the current coding unit and the length of the longer side of the current coding unit. According to an embodiment, the image decoding apparatus 100 can determine different probabilities for the bins of the partition shape mode information according to at least one of the shape of the current coding unit and the length of the longer side of the current coding unit.

[0233] According to an embodiment, the image decoding apparatus 100 can determine that the probabilities for the bins of the partition shape mode information are the same for the coding units equal to or greater than a preset size. For example, the image decoding apparatus 100 can determine that the probabilities for the bins of the partition shape mode information are the same for the coding units having a length of the longer side equal to or greater than 64 samples.

[0234] According to an embodiment, the image decoding apparatus 100 can determine initial probabilities of bins constituting a bin string of the partition shape mode information based on a slice type (e.g., I slice, P slice, or B slice).

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

[0236] An encoding end 1910 of the image encoding and decoding system 1900 can transmit an encoded bitstream of an image, and a decoding end 1950 of the image encoding and decoding system 1900 can receive and decode the bitstream to output a reconstructed image. Here, the encoding end 1910 can be a configuration similar to the image encoding apparatus 200 to be described below, and the decoding end 1950 can be a configuration similar to the image decoding apparatus 100.

[0237] In the encoding end 1910, a prediction encoder 1915 outputs prediction data through inter prediction and intra prediction, and a transformer and quantizer 1920 outputs quantized transform coefficients of residual data between the prediction data and a current input image. An entropy encoder 1925 encodes the quantized transform coefficients and outputs the encoded quantized transform coefficients as a bitstream. The quantized transform coefficients are reconstructed as spatial domain data via a dequantizer and inverse transformer 1930, and the reconstructed spatial domain data can be output as a reconstructed image via a deblocking filter 1935 and a loop filter 1940. The reconstructed image can be used as a reference image for a next input image in the prediction encoder 1915.

[0238] Encoded image data in the bitstream received by the decoding end 1950 is reconstructed as spatial domain residual data via an entropy decoder 1955 and a dequantizer and inverse transformer 1960. When prediction data output by a prediction decoder 1975 and the residual data are combined, spatial domain image data can be configured, and a deblocking filter 1965 and a loop filter 1970 can output a reconstructed image for a current original image by performing filtering on the spatial domain image data. The reconstructed image can be used as a reference image for a next original image by the prediction decoder 1975.

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

[0240] The various embodiments described above describe operations related to an image decoding method performed by the image decoding apparatus 100. Hereinafter, operations of an image encoding apparatus 200 performing an image encoding method corresponding to the reverse order of the image decoding method will be described through various embodiments.

[0241] Figures 3 to 19 is a block diagram of an image encoding apparatus 200 capable of encoding an image based on at least one of block shape information and partition shape mode information according to an embodiment.

[0242] The image encoding apparatus 200 can include an encoder 220 and a bitstream generator 210. The encoder 220 can receive an input image and encode the input image. The encoder 220 can encode the input image to obtain at least one syntax element. The syntax element can include at least one of a skip flag, a prediction mode, a motion vector difference, a motion vector prediction method (or index), a transform quantization coefficient, an encoding block mode, an encoding block flag, an intra prediction mode, a direct flag, a merge flag, a delta QP, a reference index, a prediction direction, or a transform index. The encoder 220 can determine a context model based on block shape information, wherein the block shape information includes at least one of a shape, a direction, a ratio of height and width, or a size of an encoding unit.

[0243] The bitstream generator 210 can generate a bitstream based on the encoded input image. For example, the bitstream generator 210 can generate the bitstream by performing entropy encoding on the syntax element based on the context model. The image encoding apparatus 200 can transmit the bitstream to the image decoding apparatus 100.

[0244] According to an embodiment, the encoder 220 of the image encoding apparatus 200 can determine a shape of an encoding unit. For example, the encoding unit can have a square shape or a non-square shape, and information representing such a shape can be included in the block shape information.

[0245] According to an embodiment, the encoder 220 can determine a shape into which the encoding unit is to be partitioned. The encoder 220 can determine a shape of at least one encoding unit included in the encoding unit, and the bitstream generator 210 can generate a bitstream including partition shape mode information including information about the shape of the encoding unit.

[0246] According to an embodiment, the encoder 220 can determine whether to split the coding unit. When the encoder 220 determines that the coding unit includes only one coding unit or the coding unit is not split, the bitstream generator 210 can generate a bitstream including split shape mode information indicating that the coding unit is not split. The encoder 220 can split the coding unit into a plurality of coding units included in the coding unit, and the bitstream generator 210 can generate a bitstream including split shape mode information indicating that the coding unit is to be split into the plurality of coding units.

[0247] According to an embodiment, information indicating a number of coding units into which the coding unit is split or a direction in which the coding unit is split can be included in the split shape mode information. For example, the split shape mode information can indicate a split in at least one of a vertical direction and a horizontal direction, or can indicate no split.

[0248] The image encoding apparatus 200 can determine the split shape mode information based on a split shape mode of the coding unit. The image encoding apparatus 200 can determine a context model based on at least one of a shape, a direction, a ratio of a width and a height, or a size of the coding unit. The image encoding apparatus 200 can generate information about the split shape mode for splitting the coding unit as a bitstream based on the context model.

[0249] To determine the context model, the image encoding apparatus 200 can obtain an arrangement for corresponding at least one of a shape, a direction, a ratio of a width and a height, or a size of the coding unit to an index for the context model. The image encoding apparatus 200 can obtain the index for the context model from the arrangement based on at least one of a shape, a direction, a ratio of a width and a height, or a size of the coding unit. The image encoding apparatus 200 can determine the context model based on the index for the context model.

[0250] To determine the context model, the image encoding apparatus 200 can further determine the context model based on block shape information including at least one of a shape, a direction, a ratio of a width and a height, or a size of surrounding coding units adjacent to the coding unit. The surrounding coding units can include at least one of a coding unit located at a lower left side, a left side, an upper left side, an upper side, an upper right side, a right side, or a lower right side of the coding unit.

[0251] To determine the context model, the image encoding apparatus 200 can compare a length of a width of an upper surrounding coding unit with a length of a width of the coding unit. The image encoding apparatus 200 can compare a length of a height of a left surrounding coding unit and a right surrounding coding unit with a length of a height of the coding unit. The image encoding apparatus 200 can determine the context model based on a result of the comparison.

[0252] The operation of the image encoding apparatus 200 includes contents similar to those of the image decoding apparatus 100 described above with reference to FIGS. 1A and 1B, and thus a detailed description thereof will be omitted. Figure 20 The contents described above with reference to FIGS. 1A and 1B are similar to those of the image decoding apparatus 100, and thus a detailed description thereof will be omitted.

[0253] Figure 20 FIG. 2B is a block diagram of a structure of an image decoding apparatus 2000 according to an embodiment.

[0254] Referring to FIGS. 2A and 2B, Figure 19 The image decoding apparatus 2000 can include an obtainer 2010 and a prediction decoder 2030.

[0255] According to an embodiment, the obtainer 2010 and the prediction decoder 2030 can be implemented as at least one processor. According to an embodiment, the obtainer 2010 and the prediction decoder 2030 can operate according to at least one instruction stored in at least one memory.

[0256] The image decoding apparatus 2000 can include at least one memory for storing input and output data of the obtainer 2010 and the prediction decoder 2030. The image decoding apparatus 2000 can include a memory controller for controlling data input / output of the at least one memory.

[0257] According to an embodiment, the obtainer 2010 can correspond to the entropy decoder 1955 shown in Figure 19 , and the prediction decoder 2030 can correspond to the prediction decoder 1975 shown in Figures 24 to 29 .

[0258] The obtainer 2010 can obtain a bitstream generated as a result of encoding a picture. The bitstream can include an encoding result with respect to a current block. The current block can be a largest coding unit, a coding unit, or a transform unit divided from a current picture expected to be decoded.

[0259] According to an embodiment, the obtainer 2010 can receive the bitstream from the image encoding apparatus through a network.

[0260] According to an embodiment, the obtainer 2010 can obtain the bitstream from a data storage medium including a magnetic medium such as a hard disk, a floppy disk, or a magnetic tape, an optical recording medium such as a CD-ROM or a DVD, or a magneto-optical medium such as a floptical disk.

[0261] The obtainer 2010 can obtain, from the bitstream, syntax elements used for decoding a picture. Values corresponding to the syntax elements can be included in the bitstream according to a layer structure of the picture.

[0262] The obtainer 2010 can obtain the syntax elements by entropy-decoding binary bits included in the bitstream.

[0263] According to an embodiment, the bitstream can include information on a prediction mode of a current block within a current picture. The prediction mode of the current block can be one of a plurality of prediction modes including an intra mode and an inter mode.

[0264] The prediction decoder 2030 can generate a prediction block of the current block by performing intra prediction or inter prediction with respect to the current block according to the prediction mode of the current block, and can reconstruct the current block by utilizing the prediction block.

[0265] According to an embodiment, when the prediction mode of the current block is the intra mode, the obtainer 2010 can obtain information on the intra prediction mode of the current block from the bitstream.

[0266] According to an embodiment, the information on the intra prediction mode of the current block can include information indicating a method of determining the intra prediction mode. According to an embodiment, the method of determining the intra prediction mode can include a method of determining the intra prediction mode by using a reference block or a method of determining the intra prediction mode by using information obtained from the bitstream.

[0267] According to an embodiment, the information indicating the method of determining the intra prediction mode can be included in a sequence parameter set, a picture parameter set, a slice header, or slice data of the bitstream.

[0268] According to an embodiment, the information indicating the method of determining the intra prediction mode can not be included in the bitstream. In this case, the prediction decoder 2030 can determine the intra prediction mode of the current block according to a predetermined method.

[0269] According to an embodiment, when the method of determining the intra prediction mode is the method of using information obtained from the bitstream, the prediction decoder 2030 can determine, as the intra prediction mode of the current block, an intra prediction mode of a plurality of intra prediction modes indicated by the information obtained from the bitstream. For example, the information indicating the intra prediction mode of the current block can include a flag or an index indicating one of the plurality of intra prediction modes.

[0270] When the method of determining the intra prediction mode is the method of using a reference block, the prediction decoder 2030 according to an embodiment can determine the intra prediction mode of the current block by using at least one of a reference block reconstructed earlier than the current block in the current picture (hereinafter, a spatial reference block) or a reference block in a previous picture reconstructed earlier than the current block (hereinafter, a temporal reference block).

[0271] According to an embodiment, in order to determine the spatial reference block, the obtainer 2010 can obtain information on a block vector indicating the spatial reference block from the bitstream.

[0272] According to an embodiment, to determine the temporal reference block, the obtainer 2010 can obtain, from the bitstream, an index of a previous picture including the temporal reference block and / or information about a motion vector indicating the temporal reference block.

[0273] Reference will now be made to Figures 21 to 23 A method of determining an intra prediction mode of a current block by using a spatial reference block and / or a temporal reference block will now be described.

[0274] When a prediction block is generated by intra prediction with respect to the current block, the prediction decoder 2030 can obtain a reconstructed current block by using the prediction block.

[0275] According to an embodiment, the prediction decoder 2030 can determine the prediction block as the reconstructed current block.

[0276] According to an embodiment, the prediction decoder 2030 can generate the reconstructed current block by combining the residual data obtained from the bitstream by the obtainer 2010 with the prediction block.

[0277] In a standard such as High Efficiency Video Coding (HEVC) and Versatile Video Coding (VVC), an intra prediction mode indicated by information obtained from a bitstream can be determined as an intra prediction mode of a current block. The bit rate can be increased by including information indicating the intra prediction mode of the current block among a number of intra prediction modes in the bitstream. According to an embodiment, the prediction decoder 2030 determines at least one of a spatial reference block or a temporal reference block by a predetermined method, and determines an intra prediction mode derived from the at least one of the spatial reference block or the temporal reference block as the intra prediction mode of the current block, thereby reducing the bit rate of the bitstream.

[0278] Reference will now be made to Figure 21 An intra prediction performed with respect to a current block will now be described.

[0279] Figure 21 is a diagram illustrating types of intra prediction modes according to an embodiment.

[0280] An intra prediction mode of a current block can be determined to perform intra prediction on the current block.

[0281] According to an embodiment, when a prediction mode of a current block is an intra mode, the obtainer 2010 can obtain, from the bitstream, information about an intra prediction mode of the current block.

[0282] The intra prediction mode of the current block can be one of a plurality of intra prediction modes.

[0283] According to an embodiment, the plurality of intra prediction modes can include directional intra prediction modes and non-directional intra prediction modes.

[0284] Reference will now be made to Figure 21According to embodiments, the plurality of intra prediction modes can include a non-directional Intra_Planar mode numbered 0, a non-directional Intra_DC mode numbered 1, and directional Intra_Angular modes numbered 2 to 34.

[0285] In the Intra_Angular modes, a position of a reference sample for generating a prediction sample of a sample in the current block can be identified based on a direction or an angle indicated by the Intra_Angular mode. For example, in the mode numbered 18, a reference sample located in a -32 degree direction can be identified with respect to a sample in the current block.

[0286] Figure 21 The intra prediction modes shown in FIG. 1 are examples, and the number and types of the intra prediction modes available in the intra mode according to embodiments can be set in various ways. For example, Figure 22 The intra prediction modes shown in FIG. 1 can be 35 intra prediction modes defined in the HEVC standard, and according to embodiments, the number of the intra prediction modes available in the intra mode can be 67 as defined in the VVC standard.

[0287] Figure 22 is a diagram showing neighboring samples that can be used for intra prediction with respect to a current block according to embodiments.

[0288] According to embodiments, the prediction decoder 2030 can identify neighboring samples 2210 within the current picture 2200 neighboring the current block 2250 to perform intra prediction on the current block 2250.

[0289] The prediction decoder 2030 can generate a prediction block of the current block 2250 according to the intra prediction mode by using the identified neighboring samples 2210 as reference samples.

[0290] According to embodiments, when the neighboring samples 2210 are identified, filtering according to the intra prediction mode can be applied to the identified neighboring samples 2210, and a prediction block of the current block 2250 can be generated based on the filtered samples.

[0291] Referring to Figure 22 According to embodiments, the neighboring samples 2210 can include left samples 2211 of the current block 2250 and above samples 2212 of the current block 2250.

[0292] Figure 22 is a diagram showing the current block 2250 having a size of 4x4, nine left samples 2211, and eight above samples 2212. The number of the left samples 2211 and the number of the above samples 2212 for intra prediction of the current block 2250 can be set in various ways.

[0293] For example, for intra prediction of the current block 2250, the prediction decoder 2030 can identify 2n+1 left-side samples 2211 (where n is a height of the current block 2250 and is an integer equal to or greater than 1) and can identify 2m top samples 2212 (where m is a width of the current block 2250 and is an integer equal to or greater than 1).

[0294] According to embodiments, Figure 23 The left-side samples 2211 are shown to be arranged in one column. However, according to embodiments, the left-side samples 2211 can be arranged in two or more columns. In addition, the top samples 2212 can also be arranged in two or more rows.

[0295] According to embodiments, when some neighboring samples 2210 required for intra prediction have not been reconstructed before the current block 2250, the prediction decoder 2030 can generate the unreconstructed neighboring samples by padding.

[0296] According to embodiments, when the neighboring samples 2210 of the current block 2250 are identified, the prediction decoder 2030 can generate a prediction block of the current block 2250 by using the neighboring samples 2210.

[0297] According to embodiments, to generate the prediction block, the prediction decoder 2030 can filter the neighboring samples 2210 according to the intra prediction mode, and can identify, from the filtered neighboring samples, samples respectively corresponding to the samples in the current block 2250 according to the intra prediction mode. In addition, the prediction decoder 2030 can generate the prediction samples of the samples in the current block 2250 by applying the identified samples to a certain operation equation, etc.

[0298] Reference will be made to Figure 23 A process of performing intra prediction on the current block 2250 by using the neighboring samples 2210 of the current block 2250 will be described.

[0299] Figure 23 is a diagram for explaining a process of predicting a current block by using neighboring samples according to an intra prediction mode according to embodiments.

[0300] As described above, when the neighboring samples 2210 of the current block 2250 are identified, the prediction decoder 2030 can generate prediction samples of the samples in the current block 2250 based on the neighboring samples 2210.

[0301] Some of the Intra_Angular modes can require only the left-side samples 2211 of the neighboring samples 2210, and other modes can require only the top samples 2212 of the neighboring samples 2210. Another mode can require both the left-side samples 2211 and the top samples 2212.

[0302] In the intra prediction mode numbered 18, as shown in FIG. 22A, both the left-side sample 2211 and the above sample 2212 can be used to generate the prediction sample of the sample in the current block 2250. Figure 23

[0303] The left-side sample 2211 is shown to be disposed left of the above sample 2212, which can mean that the sample values of the left-side sample 2211 and the sample values of the above sample 2212 are stored contiguously in a memory. Figure 21 According to an embodiment, the prediction decoder 2030 can identify, from the neighboring samples 2210, the neighboring samples respectively corresponding to the samples in the current block 2250, and can apply the sample values of the identified neighboring samples to a certain operation equation to calculate the sample values of the prediction samples.

[0304] For example, to obtain the prediction sample of the sample 2301 located at (3, 1) in the current block 2250, the neighboring sample 2303 in the left-side sample 2211 can be identified on the direction 2300 indicated by the intra prediction mode. When the sample value of the identified neighboring sample 2303 is applied to a certain operation equation, the prediction sample value of the sample 2301 located at (3, 1) in the current block 2250 can be obtained.

[0305] In addition, to obtain the prediction sample of the sample 2302 located at (1, 3) in the current block 2250, the neighboring sample 2304 in the above sample 2212 can be identified on the direction 2300 indicated by the intra prediction mode. When the sample value of the identified neighboring sample 2304 is applied to a certain operation equation, the prediction sample value of the sample 2302 located at (1, 3) in the current block 2250 can be obtained.

[0306] When the prediction sample values of the samples in the current block 2250 are obtained based on the neighboring samples 2210, the prediction decoder 2030 can reconstruct the current block 2250 by using the obtained prediction sample values.

[0307] As described above, the intra prediction mode of the current block 2250 needs to be determined to perform the intra prediction on the current block 2250. When information indicating one of the plurality of intra prediction modes shown in FIG. 22B is included in the bitstream, this can increase the bit rate.

[0308] Figure 24 According to an embodiment, the bit rate can be reduced by determining the intra prediction mode derived from the spatial reference block and / or the temporal reference block as the intra prediction mode of the current block 2250.

[0309] A method of determining the spatial reference block and the temporal reference block will be described with reference to FIGS. 23 and 24.

[0310] Figure 24 ​​​

[0311] Figure 22 is a diagram for explaining a method of determining a reference block of a current block according to an embodiment.

[0312] According to an embodiment, the prediction decoder 2030 can determine at least one of a spatial reference block 2280 in the current picture 2200 reconstructed before the current block 2250 or a temporal reference block 2480 in a previous picture 2400 reconstructed before the current block 2250 according to template matching. According to an embodiment, the previous picture 2400 can be a picture reconstructed before the current picture 2200.

[0313] During the template matching, a neighboring sample set reconstructed before the current block 2250 can be used as a template 2220. According to an embodiment, the template 2220 of the current block 2250 can include at least some of the neighboring samples 2210 shown in Figure 24 .

[0314] According to an embodiment, the prediction decoder 2030 can search for a template 2270 most similar to the template 2220 from the current picture 2200 by using the neighboring sample set of the current block 2250 as the template 2220, and can determine a block neighboring the found template 2270 as the spatial reference block 2280.

[0315] Because the template 2220 is located at the left and top side of the current block 2250 in Figure 24 , a block located at the right and bottom side of the similar template 2270 found from the current picture 2200 can be determined as the spatial reference block 2280. According to an embodiment, the size of the spatial reference block 2280 can be the same as that of the current block 2250.

[0316] According to an embodiment, the prediction decoder 2030 can search for a template 2470 most similar to the template 2220 from the previous picture 2400 by using the neighboring sample set of the current block 2250 as the template 2220, and can determine a block neighboring the found template 2470 as the temporal reference block 2480. Because the template 2220 is located at the left and top side of the current block 2250 in Figure 25 , a block located at the right and bottom side of the similar template 2470 found from the previous picture 2400 can be determined as the temporal reference block 2480. According to an embodiment, the size of the temporal reference block 2480 can be the same as that of the current block 2250.

[0317] When searching for the similar templates 2270 and 2470 to the template 2220 of the current block 2250, a difference between sample values can be used. For example, the similar templates 2270 and 2470 including sample values most similar to the sample values included in the template 2220 of the current block 2250 can be determined within the current picture 2200 and / or the previous picture 2400.

[0318] To search for the similar template 2270 and 2470, the prediction decoder 2030 can determine a base motion vector. For example, a predetermined motion vector (e.g., a zero vector) or a motion vector of a block at a predetermined position can be determined as the base motion vector.

[0319] The prediction decoder 2030 can search for the template 2270 and 2470 most similar to the template 2200 within a preset range from a point indicated by the base motion vector, and can determine a block adjacent to the similar template 2270 and 2470 as the spatial reference block 2280 or the temporal reference block 2480.

[0320] According to an embodiment, the base motion vector used to search for the similar template 2270 within the current picture 2200 can be referred to as a base block vector.

[0321] In the aforementioned template matching, the spatial reference block 2280 and the temporal reference block 2480 are directly searched by the prediction decoder 2030. According to an embodiment, the prediction decoder 2030 can determine the spatial reference block 2280 and the temporal reference block 2480 by using information signaled through a bitstream. The direct search of the spatial reference block 2280 and the temporal reference block 2480 by the prediction decoder 2030 can be understood as the prediction decoder 2030 determining the positions of the spatial reference block 2280 and the temporal reference block 2480 by itself without obtaining information indicating the positions of the spatial reference block 2280 and the temporal reference block 2480.

[0322] According to an embodiment, the obtainer 2010 can obtain information about a block vector 2262 indicating the spatial reference block 2280 from a bitstream, and the prediction decoder 2030 can determine the spatial reference block 2280 within the current picture 2200 by using the block vector 2262.

[0323] According to an embodiment, the information about the block vector 2262 indicating the spatial reference block 2280 can include information (e.g., a flag or an index) indicating any one of block vector candidates included in a pre-constructed block vector candidate set.

[0324] According to an embodiment, the prediction decoder 2030 can construct a block vector candidate set by using motion vectors or block vectors of at least some of neighboring blocks (e.g., the neighboring blocks shown in FIG. 2B) temporally or spatially related to the current block 2250, and can determine the block vector 2262 for indicating the spatial reference block 2280 based on information obtained from a bitstream. Figure 25

[0325] ​According to an embodiment, the prediction decoder 2030 can determine the block vector 2262 used to indicate the spatial reference block 2280 by combining a block vector candidate indicated by the information obtained from the bitstream among the block vector candidates in the block vector candidate set and a block vector difference obtained from the bitstream.

[0326] According to an embodiment, when constructing the block vector candidate set, the prediction decoder 2030 can determine each of the block vector candidates included in the block vector candidate set by template matching based on motion vectors or block vectors of the temporal neighboring blocks and / or the spatial neighboring blocks (e.g., at least some of the neighboring blocks shown in FIG. 22). Figure 25

[0327] According to an embodiment, the prediction decoder 2030 can also determine the spatial reference block 2280 within the current picture 2200 indicated by a predetermined block vector. The predetermined block vector can be, for example, a block vector of a block at a predetermined position or a zero vector.

[0328] According to an embodiment, the obtainer 2010 can obtain information about the motion vector 2264 indicating the temporal reference block 2480 from the bitstream, and the prediction decoder 2030 can determine the temporal reference block 2480 within the previous picture 2400 by using the motion vector 2264.

[0329] According to an embodiment, the information about the motion vector 2264 indicating the temporal reference block 2480 can include information (e.g., a flag or an index) indicating any one of the motion vector candidates included in a motion vector candidate set constructed in advance.

[0330] According to an embodiment, the prediction decoder 2030 can construct the motion vector candidate set by using motion vectors or block vectors of neighboring blocks (e.g., at least some of the neighboring blocks shown in FIG. 22) temporally or spatially related to the current block 2250, and can determine the motion vector 2264 used to indicate the temporal reference block 2480 based on the information obtained from the bitstream. Figure 25

[0331] According to an embodiment, the prediction decoder 2030 can determine the motion vector 2264 used to indicate the temporal reference block 2480 by combining a motion vector candidate indicated by the information obtained from the bitstream among the motion vector candidates in the motion vector candidate set and a motion vector difference obtained from the bitstream.

[0332] According to an embodiment, when constructing the motion vector candidate set, the prediction decoder 2030 can determine each of the motion vector candidates included in the motion vector candidate set by template matching based on motion vectors or block vectors of the temporal neighboring blocks and / or the spatial neighboring blocks (e.g., at least some of the neighboring blocks shown in FIG. 22). Figure 25

[0333] ​​​According to an embodiment, the predictive decoder 2030 can further determine a temporal reference block 2480 within the previous picture 2400 indicated by a predetermined motion vector. The predetermined motion vector can be, for example, a motion vector of a block at a predetermined position or a zero vector.

[0334] Reference will be made to Figure 25 blocks neighboring the current block 2250 that can be used to derive the block vector 2262 or the motion vector 2264 of the current block 2250 will be described.

[0335] Figure 25 is a diagram showing positions of neighboring blocks related to the current block according to an embodiment.

[0336] Reference will be made to Figure 25 The temporal neighboring block can include at least one of a block Col located at the same point as the current block 2250 or a block Br spatially adjacent to the block Col located at the same position in a picture having a picture order count (POC) (e.g., POC A) different from a POC (e.g., POC B) of the current picture 2200 including the current block 2250. The POC can refer to a value assigned to a picture according to an output order.

[0337] The block Br can be located at a lower right side of the block Col located at the same point as the current block 2250. The block Col located at the same point as the current block 2250 can be a block including a sample corresponding to a center sample in the current block 2250 among samples in the picture including the POC A.

[0338] The spatial neighboring block can include at least one of a lower left corner block A0, a lower left block A1, an upper right corner block B0, an upper right block B1, or an upper left corner block B2.

[0339] Figure 24 The positions of the temporal neighboring block and the spatial neighboring block shown in FIG. 2B are examples, and the positions of the temporal neighboring block and the spatial neighboring block and the number thereof can be changed in various ways.

[0340] As described above with reference to Figure 26 The spatial reference block 2280 and the temporal reference block 2480 can be determined in various ways.

[0341] For example, both the spatial reference block 2280 and the temporal reference block 2480 can be determined through template matching.

[0342] Further, for example, the spatial reference block 2280 can be determined using a block vector 2262 determined based on information obtained from a bitstream or a predetermined block vector, and the temporal reference block 2480 can be determined through template matching.

[0343] Furthermore, for example, the spatial reference block 2280 can be determined based on template matching, and the temporal reference block 2480 can be determined using the motion vector 2264 determined based on information obtained from the bitstream or a predetermined motion vector.

[0344] Furthermore, for example, the spatial reference block 2280 can be determined using the block vector 2262 determined based on information obtained from the bitstream or a predetermined block vector, and the temporal reference block 2480 can be determined using the motion vector 2264 determined based on information obtained from the bitstream or a predetermined motion vector.

[0345] According to an embodiment, the prediction decoder 2030 can determine the spatial reference block 2280 based on the block vector 2262, a predetermined block vector, or template matching, and can determine the temporal reference block 2480 based on the motion vector 2292 of the spatial reference block 2280. This considers the case where the motion vector 2292 and the reference picture index are stored for the spatial reference block 2280.

[0346] For example, when the spatial reference block 2280 is reconstructed from the block indicated by the motion vector 2292 in the previous picture 2400 indicated by the reference picture index, i.e., when the spatial reference block 2280 is reconstructed by inter prediction, the prediction decoder 2030 can use the block used to reconstruct the spatial reference block 2280 as the temporal reference block 2480.

[0347] When the spatial reference block 2280 is determined by template matching or a predetermined block vector and the temporal reference block 2480 is determined based on the motion vector 2292 of the spatial reference block 2280, information indicating the positions of the spatial reference block 2280 and the temporal reference block 2480 of the current block 2250 does not need to be included in the bitstream, thus the bit rate of the bitstream can be reduced.

[0348] As described below, the prediction decoder 2030 can determine the spatial reference block 2280 within the current picture 2200, and when it is not possible to derive an intra prediction mode from the spatial reference block 2280, can determine the temporal reference block 2480 within the previous picture 2400. According to an embodiment, the prediction decoder 2030 can determine the temporal reference block 2480 within the previous picture 2400, and when it is not possible to derive an intra prediction mode from the temporal reference block 2480, can determine the spatial reference block 2280 within the current picture 2200.

[0349] Figure 26 FIG. 2 is a diagram for explaining a method of determining an intra prediction mode of a reference block as an intra prediction mode of a current block according to an embodiment.

[0350] The prediction decoder 2030 can identify a predetermined position within the current block 2250 in order to obtain an intra prediction mode of the current block 2250 from at least one of the spatial reference block 2280 or the temporal reference block 2480.

[0351] The predetermined position can be agreed upon between the image decoding apparatus 2000 and the image encoding apparatus. For example, when a position of a top-left sample of the current block 2250 is (x, y) (where x and y are integers greater than or equal to 0), the predetermined position can be (x+w / 2, y+h / 2). Here, w (w is an integer greater than or equal to 1) can be a width of the current block 2250, and h (h is an integer greater than or equal to 1) can be a height of the current block 2250.

[0352] According to an embodiment, the predetermined position within the current block 2250 can be identified based on information obtained from a bitstream. According to an embodiment, information about the predetermined position within the current block 2250 can be signaled via a separate packet from the bitstream.

[0353] According to an embodiment, the prediction decoder 2030 can identify a respective position of the predetermined position within the current block 2250 from at least one of the spatial reference block 2280 or the temporal reference block 2480.

[0354] Since the spatial reference block 2280 and the temporal reference block 2480 correspond to regions determined through, for example, template matching, the spatial reference block 2280 and the temporal reference block 2480 can be divided into one or more blocks reconstructed according to different prediction modes.

[0355] For example, Figure 26 The spatial reference block 2280 illustrated in FIG. 2A can be reconstructed by being divided into a first sub-block 2280-1, a second sub-block 2280-2, a third sub-block 2280-3, and a fourth sub-block 2280-4. In this case, the first sub-block 2280-1, the second sub-block 2280-2, the third sub-block 2280-3, and the fourth sub-block 2280-4 can be reconstructed independently of each other. For example, the first sub-block 2280-1 and the third sub-block 2280-3 can be reconstructed according to an inter mode, and the second sub-block 2280-2 and the fourth sub-block 2280-4 can be reconstructed according to an intra mode. When the second sub-block 2280-2 and the fourth sub-block 2280-4 are reconstructed according to the intra mode, an intra prediction mode of the second sub-block 2280-2 and an intra prediction mode of the fourth sub-block 2280-4 can be the same or different from each other.

[0356] Figure 26The time reference block 2480 shown can be reconstructed by dividing it into a first sub-block 2480-1, a second sub-block 2480-2, and a third sub-block 2480-3. In this case, the first sub-block 2480-1, the second sub-block 2480-2, and the third sub-block 2480-3 can be reconstructed independently of each other. For example, the first sub-block 2480-1 and the third sub-block 2480-3 can be reconstructed according to the inter-frame mode, and the second sub-block 2480-2 can be reconstructed according to the intra-frame mode.

[0357] The first sub-block 2280-1, the second sub-block 2280-2, the third sub-block 2280-3, and the fourth sub-block 2280-4 of the spatial reference block 2280, as well as the first sub-block 2480-1, the second sub-block 2480-2, and the third sub-block 2480-3 of the time reference block 2480, can all correspond to the coding units divided from the current frame 2200 or the previous frame 2400.

[0358] Since the spatial reference block 2280 and the temporal reference block 2480 may include multiple coding units, the prediction decoder 2030 can identify a position corresponding to a predetermined position in the current block 2250 from at least one of the spatial reference block 2280 or the temporal reference block 2480, and can obtain an intra-frame prediction mode for reconstructing the sample at the identified corresponding position.

[0359] For example, when the position of the upper left sample of the current block 2250 based on the upper left sample of the current frame 2200 is (x, y) (where x and y are integers greater than or equal to 0), the predetermined position is (a, b) (where a and b are integers greater than or equal to 0), and the position of the upper left sample of the spatial reference block 2280 or the temporal reference block 2480 based on the upper left sample of the current frame 2200 or the previous frame 2400 is (m, n) (where m and n are integers greater than or equal to 0), the corresponding position in the spatial reference block 2280 or the temporal reference block 2480 can be (m+ax, n+by).

[0360] like Figure 27 As shown, the corresponding positions 2281 and 2481 of the predetermined position 2251 within the current block 2250 can be included in the first sub-block 2280-1 of the spatial reference block 2280 and the second sub-block 2480-2 of the time reference block 2480.

[0361] The prediction decoder 2030 can determine the intra prediction mode of the current block 2250 by using the intra prediction mode of samples at corresponding positions 2281 and 2481 (or sub-blocks 2280-1 and 2480-2 including corresponding positions 2281 and 2481) included in at least one of the spatial reference block 2280 or the temporal reference block 2480.

[0362] According to an embodiment, the prediction decoder 2030 can determine the spatial reference block 2280 within the current picture 2200 and can determine the intra prediction mode used to reconstruct the samples at the respective positions 2281 within the spatial reference block 2280 as the intra prediction mode of the current block 2250.

[0363] According to an embodiment, when the intra prediction mode is not used to reconstruct the samples at the respective positions 2281 within the spatial reference block 2280, the prediction decoder 2030 can determine the temporal reference block 2480 within the previous picture 2400 and can determine the intra prediction mode used to reconstruct the samples at the respective positions 2481 within the temporal reference block 2480 as the intra prediction mode of the current block 2250. For example, when the samples at the respective positions 2281 within the spatial reference block 2280 are reconstructed according to an inter mode, the prediction decoder 2030 can determine the temporal reference block 2480 within the previous picture 2400 and can determine the intra prediction mode used to reconstruct the samples at the respective positions 2281 within the temporal reference block 2480 as the intra prediction mode of the current block 2250.

[0364] According to an embodiment, when the intra prediction mode is not used to reconstruct the samples at the respective positions 2481 within the temporal reference block 2480, the prediction decoder 2030 can determine the spatial reference block 2280 within the current picture 2200 and can determine the intra prediction mode used to reconstruct the samples at the respective positions 2281 within the spatial reference block 2280 as the intra prediction mode of the current block 2250.

[0365] According to an embodiment, when the intra prediction mode is not used to reconstruct the samples at the respective positions 2281 within the spatial reference block 2280 and the intra prediction mode is not used to reconstruct the samples at the respective positions 2481 within the temporal reference block 2480, the prediction decoder 2030 can determine a predetermined intra prediction mode (e.g., the planar mode) as the intra prediction mode of the current block 2250.

[0366] According to an embodiment, the prediction decoder 2030 can select one of the intra prediction mode used to reconstruct the samples at the respective positions 2281 within the spatial reference block 2280 and the intra prediction mode used to reconstruct the samples at the respective positions 2481 within the temporal reference block 2480 and can determine the selected intra prediction mode as the intra prediction mode of the current block 2250.

[0367] According to an embodiment, information obtained from the bitstream can be used to select one of the intra prediction mode used to reconstruct the samples at the respective positions 2281 within the spatial reference block 2280 and the intra prediction mode used to reconstruct the samples at the respective positions 2481 within the temporal reference block 2480.

[0368] For example, the obtainer 2010 can obtain, from the bitstream, information indicating one of the intra prediction mode for reconstructing the samples at the respective positions 2281 within the spatial reference block 2280 and the intra prediction mode for reconstructing the samples at the respective positions 2481 within the temporal reference block 2480, and the prediction decoder 2030 can determine the intra prediction mode indicated by the obtained information as the intra prediction mode of the current block 2250.

[0369] According to an embodiment, the prediction decoder 2030 can apply the intra prediction mode of the spatial reference block 2280 and the intra prediction mode of the temporal reference block 2480 to the neighboring sample set of the current block 2250 in order to select one of the intra prediction mode for reconstructing the samples at the respective positions 2281 within the spatial reference block 2280 (hereinafter, referred to as the intra prediction mode of the spatial reference block 2280) and the intra prediction mode for reconstructing the samples at the respective positions 2481 within the temporal reference block 2480 (hereinafter, referred to as the intra prediction mode of the temporal reference block 2480). This will be described with reference to Figure 28 and Figure 27 This will be described with reference to

[0370] Figure 22 is a diagram illustrating neighboring samples that can be used for intra prediction with respect to the neighboring sample set of the current block according to an embodiment.

[0371] According to an embodiment, the neighboring sample set 2230 of the current block 2250 can correspond to the neighboring samples 2210 for intra prediction with respect to the current block 2250 as illustrated in Figure 24

[0372] According to an embodiment, the neighboring sample set 2230 of the current block 2250 can correspond to the template 2220 of the current block 2250 as illustrated in Figure 28

[0373] Because the neighboring sample set 2230 of the current block 2250 includes samples reconstructed before the current block 2250, the intra prediction according to the intra prediction mode of the spatial reference block 2280 and the intra prediction mode of the temporal reference block 2480 can be performed and then which intra prediction mode is more useful for the current block 2250 can be selected.

[0374] For the intra prediction of the neighboring sample set 2230 of the current block 2250, neighboring samples 2240 adjacent to the neighboring sample set 2230 can be identified.

[0375] ​​When the height of the neighboring sample set 2230 is k (where k is an integer greater than or equal to 1), 2k+1 samples neighboring the left side of the neighboring sample set 2230 can be identified, and when the width of the neighboring sample set 2230 is l (where l is an integer greater than or equal to 1), 2l samples neighboring the top of the neighboring sample set 2230 can be identified.

[0376] According to an embodiment, the prediction decoder 2030 can obtain a first predicted sample set of the neighboring sample set 2230 by using the neighboring samples 2240 of the neighboring sample set 2230 as reference samples according to the intra prediction mode of the spatial reference block 2280, and can obtain a second predicted sample set of the neighboring sample set 2230 by using the neighboring samples 2240 of the neighboring sample set 2230 as reference samples according to the intra prediction mode of the temporal reference block 2480.

[0377] According to an embodiment, in order to perform intra prediction with respect to the neighboring sample set 2230 based on the intra prediction mode of the spatial reference block 2280, the neighboring samples 2240 can be filtered according to the intra prediction mode of the spatial reference block 2280. Also, according to an embodiment, in order to perform intra prediction with respect to the neighboring sample set 2230 based on the intra prediction mode of the temporal reference block 2480, the neighboring samples 2240 can be filtered according to the intra prediction mode of the temporal reference block 2480.

[0378] Figure 23 is a diagram for explaining a process of predicting a neighboring sample set by using neighboring samples of the neighboring sample set according to an intra prediction mode according to an embodiment.

[0379] As described above with reference to Figure 29 According to an embodiment, the prediction decoder 2030 can identify samples respectively corresponding to the samples in the neighboring sample set 2230 from the neighboring samples 2240 of the neighboring sample set 2230, and can apply sample values of the identified samples to a pre-set operation equation to calculate a predicted sample set of the neighboring sample set 2230.

[0380] For example, in order to obtain a predicted sample of a lower-left sample 2701 in the neighboring sample set 2230, a neighboring sample 2702 among the neighboring samples 2240 of the neighboring sample set 2230 can be identified along a direction 2700 indicated by the intra prediction mode of the spatial reference block 2280 or the intra prediction mode of the temporal reference block 2480. When a sample value of the identified neighboring sample 2702 is applied to a pre-set operation equation, a predicted sample value of the lower-left sample 2701 in the neighboring sample set 2230 can be obtained.

[0381] The prediction decoder 2030 can obtain a first prediction sample set or a second prediction sample set of the neighboring sample set 2230 by performing intra prediction with respect to the neighboring sample set 2230 according to an intra prediction mode of the spatial reference block 2280 or an intra prediction mode of the temporal reference block 2480 based on the neighboring samples 2240 of the neighboring sample set 2230.

[0382] When the first prediction sample set and the second prediction sample set are obtained, the prediction decoder 2030 can select one of the intra prediction mode of the spatial reference block 2280 and the intra prediction mode of the temporal reference block 2480 based on a comparison result of a comparison between the neighboring sample set 2230 and the first prediction sample set and a comparison result of a comparison between the neighboring sample set 2230 and the second prediction sample set.

[0383] According to an embodiment, the comparison result can be based on a difference between sample values within the neighboring sample set 2230 and sample values within the first prediction sample set and the second prediction sample set. For example, when a sum of the differences between the sample values of the neighboring sample set 2230 and the sample values in the first prediction sample set is less than a sum of the differences between the sample values of the neighboring sample set 2230 and the sample values in the second prediction sample set, the prediction decoder 2030 can select the intra prediction mode of the spatial reference block 2280 as the intra prediction mode of the current block 2250.

[0384] According to an embodiment, the comparison result between the neighboring sample set 2230 and the first prediction sample set (or the second prediction sample set) can use a sum of absolute difference (SAD), a sum of absolute transformed difference (SATD), or a histogram of oriented gradients (HoG).

[0385] When the intra prediction mode of the current block 2250 is determined, the prediction decoder 2030 can obtain a prediction block of the current block 2250 by performing intra prediction on the current block 2250 according to the intra prediction mode of the current block 2250.

[0386] The above has described an embodiment in which the intra prediction on the current block 2250 is performed according to one intra prediction mode. However, according to an embodiment, the intra prediction on the current block 2250 can be performed according to two or more intra prediction modes.

[0387] According to an embodiment, the prediction decoder 2030 can obtain the first prediction block by performing intra prediction on the current block 2250 according to the intra prediction mode of the spatial reference block 2280 or the intra prediction mode of the temporal reference block 2480.

[0388] For example, when it is possible to derive an intra prediction mode from the spatial reference block 2280, the first prediction block can be obtained based on the intra prediction mode of the spatial reference block 2280. When it is not possible to derive an intra prediction mode from the spatial reference block 2280, the first prediction block can be obtained based on the intra prediction mode of the temporal reference block 2480. Also, for example, when it is possible to derive an intra prediction mode from the temporal reference block 2480, the first prediction block can be obtained based on the intra prediction mode of the temporal reference block 2480. When it is not possible to derive an intra prediction mode from the temporal reference block 2480, the first prediction block can be obtained based on the intra prediction mode of the spatial reference block 2280. Also, for example, when it is possible to derive an intra prediction mode from both the spatial reference block 2280 and the temporal reference block 2480, the first prediction block can be obtained according to an intra prediction mode selected from the intra prediction mode of the spatial reference block 2280 and the intra prediction mode of the temporal reference block 2480.

[0389] The prediction decoder 2030 can obtain the second prediction block by performing intra prediction on the current block 2250 according to a predetermined intra prediction mode (e.g., a planar mode). The prediction decoder 2030 can obtain the third prediction block through a weighted sum of the first prediction block and the second prediction block, and reconstruct the current block 2250 by using the third prediction block.

[0390] According to an embodiment, the prediction decoder 2030 can obtain the first prediction block by performing intra prediction on the current block 2250 according to the intra prediction mode of the spatial reference block 2280 or the intra prediction mode of the temporal reference block 2480, and can determine the spatial reference block 2280 or the temporal reference block 2480 as the second prediction block. The prediction decoder 2030 can also obtain the third prediction block through a weighted sum of the first prediction block and the second prediction block, and reconstruct the current block 2250 by using the third prediction block.

[0391] According to an embodiment, when the first prediction block is generated according to the intra prediction mode of the spatial reference block 2280, the spatial reference block 2280 can be determined as the second prediction block. When the first prediction block is generated according to the intra prediction mode of the temporal reference block 2480, the temporal reference block 2480 can be determined as the second prediction block. Since the spatial reference block 2280 and the temporal reference block 2480 also correspond to blocks found to be similar to the current block 2250, the accuracy of prediction can be improved by using the spatial reference block 2280 or the temporal reference block 2480 as a prediction block.

[0392] According to an embodiment, the prediction decoder 2030 can obtain a first prediction block by performing intra prediction on the current block 2250 according to an intra prediction mode of the spatial reference block 2280, and can obtain a second prediction block by performing intra prediction on the current block 2250 according to an intra prediction mode of the temporal reference block 2480. The prediction decoder 2030 can also obtain a third prediction block by a weighted sum of the first prediction block and the second prediction block, and reconstruct the current block 2250 by using the third prediction block.

[0393] According to an embodiment, when it is not possible to derive the intra prediction mode from both the spatial reference block 2280 and the temporal reference block 2480, the prediction decoder 2030 can obtain a first prediction block by performing intra prediction on the current block 2250 according to a predetermined first intra prediction mode (e.g., planar mode), and can obtain a second prediction block by performing intra prediction on the current block 2250 according to a predetermined second intra prediction mode (e.g., DC mode). The prediction decoder 2030 can also obtain a third prediction block by a weighted sum of the first prediction block and the second prediction block, and reconstruct the current block 2250 by using the third prediction block.

[0394] For the above-mentioned weighted sum or the below-mentioned weighted sum, according to an embodiment, the weight applied to the first prediction block and the weight applied to the second prediction block can be determined according to information obtained from a bitstream.

[0395] According to an embodiment, the weight applied to the first prediction block and the weight applied to the second prediction block can be predetermined. For example, the weight applied to the first prediction block and the weight applied to the second prediction block can each be predetermined as 1 / 2.

[0396] Figure 29 is a diagram for explaining a method of determining an intra prediction mode of a reference block as an intra prediction mode of a current block according to an embodiment.

[0397] According to an embodiment, the number of predetermined positions within the current block 2250 for determining the intra prediction mode of the current block 2250 can be plural.

[0398] The plural predetermined positions can be agreed upon between the image decoding apparatus 2000 and the image encoding apparatus. For example, when a position of a top-left sample of the current block 2250 is (x, y) (where x and y are integers greater than or equal to 0), the plural predetermined positions can be (x, y) and (x+w / 2, y+h / 2). Here, w (w is an integer greater than or equal to 1) can be a width of the current block 2250, and h (h is an integer greater than or equal to 1) can be a height of the current block 2250.

[0399] According to an embodiment, the plurality of predetermined positions within the current block 2250 can be identified based on information obtained from the bitstream. According to an embodiment, the information about the plurality of predetermined positions within the current block 2250 can be signaled via a separate packet from the bitstream.

[0400] According to an embodiment, the prediction decoder 2030 can identify the plurality of respective positions of the plurality of predetermined positions within the current block 2250 from at least one of the spatial reference block 2280 or the temporal reference block 2480.

[0401] For example, when a position of a top-left sample of the current block 2250 based on a top-left sample of the current picture 2200 is (x, y), a predetermined first position 2251 is (a, b) (where a and b are integers greater than or equal to 0), and a position of a top-left sample of the spatial reference block 2280 or the temporal reference block 2480 based on a top-left sample of the current picture 2200 or the previous picture 2400 is (m, n) (where m and n are integers greater than or equal to 0), the plurality of respective positions 2281, 2282, 2481, and 2482 of the spatial reference block 2280 or the temporal reference block 2480 can be (m+a-x, n+b-y) and (m+c-x, n+d-y).

[0402] Referring to Figure 27 The respective positions 2281 and 2481 corresponding to the predetermined first position 2251 within the current block 2250 can be identified from the first sub-block 2280-1 of the spatial reference block 2280 and the second sub-block 2480-2 of the temporal reference block 2480. The respective positions 2282 and 2482 corresponding to the predetermined second position 2252 within the current block 2250 can be identified from the third sub-block 2280-3 of the spatial reference block 2280 and the third sub-block 2480-3 of the temporal reference block 2480.

[0403] When the plurality of respective positions 2281, 2282, 2481, and 2482 are identified from at least one of the spatial reference block 2280 or the temporal reference block 2480, the prediction decoder 2030 can perform intra prediction on the current block 2250 according to at least one intra prediction mode used to reconstruct samples at the plurality of respective positions 2281, 2282, 2481, and 2482.

[0404] According to an embodiment, when it is not possible to derive an intra prediction mode from the plurality of respective positions 2281 and 2282 of the spatial reference block 2280, the prediction decoder 2030 can determine the temporal reference block 2480, and can perform intra prediction on the current block 2250 according to at least one intra prediction mode used to reconstruct samples at the plurality of respective positions 2481 and 2482 within the temporal reference block 2480.

[0405] According to an embodiment, when it is not possible to derive an intra prediction mode from the plurality of respective positions 2481 and 2482 of the temporal reference block 2480, the prediction decoder 2030 can determine the spatial reference block 2280 and can perform intra prediction of the current block 2250 according to at least one intra prediction mode used for reconstructing samples at the plurality of respective positions 2281 and 2282 within the spatial reference block 2280.

[0406] According to an embodiment, the prediction decoder 2030 can determine the spatial reference block 2280 and the temporal reference block 2480 within the current picture 2200 and the previous picture 2400, respectively, and can perform intra prediction of the current block 2250 according to at least one intra prediction mode used for reconstructing samples at the plurality of respective positions 2281, 2282, 2481 and 2482 within the spatial reference block 2280 and the temporal reference block 2480.

[0407] According to an embodiment, when one intra prediction mode is used for reconstructing samples at the plurality of respective positions 2281, 2282, 2481 and 2482, i.e. when an intra prediction mode is used for reconstructing samples at one respective position and an intra prediction mode is not used for reconstructing samples at other respective positions, the prediction decoder 2030 can perform intra prediction of the current block 2250 according to one available intra prediction mode.

[0408] According to an embodiment, when one intra prediction mode is used for reconstructing samples at the plurality of respective positions 2281, 2282, 2481 and 2482, the prediction decoder 2030 can obtain a first prediction block by performing intra prediction of the current block 2250 according to one available intra prediction mode. The prediction decoder 2030 can obtain a second prediction block by performing intra prediction of the current block 2250 according to a predetermined intra prediction mode (e.g. planar mode), or can determine the temporal reference block 2480 or the spatial reference block 2280 as the second prediction block. The prediction decoder 2030 can reconstruct the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0409] According to an embodiment, when two intra prediction modes are used for reconstructing samples at the plurality of respective positions 2281, 2282, 2481 and 2482, the prediction decoder 2030 can obtain a first prediction block by performing intra prediction of the current block 2250 according to one of the two intra prediction modes. The prediction decoder 2030 can obtain a second prediction block by performing intra prediction of the current block 2250 according to the other of the two intra prediction modes. The prediction decoder 2030 can reconstruct the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0410] According to an embodiment, the prediction decoder 2030 can select one intra prediction mode from among a plurality of intra prediction modes for reconstructing samples at a plurality of respective positions 2281, 2282, 2481, and 2482, and can generate a prediction block by performing intra prediction on the current block 2250 according to the selected intra prediction mode. To select one intra prediction mode, the prediction decoder 2030 can perform intra prediction on the neighboring sample set 2230 of the current block 2250 according to a plurality of intra prediction modes, and can consider a difference between each of a plurality of predicted sample sets generated as a result of performing intra prediction and the neighboring sample set 2230. Because the above has been described with reference to FIGS. 22A and 22B, a detailed description thereof will be omitted here. Figure 28 and Figure 30 The process of performing intra prediction on the neighboring sample set 2230 in order to select one intra prediction mode from among a plurality of intra prediction modes is described above, and thus a detailed description thereof will be omitted here.

[0411] According to an embodiment, the prediction decoder 2030 can obtain a first prediction block by performing intra prediction on the current block 2250 according to one intra prediction mode selected from among a plurality of intra prediction modes. The prediction decoder 2030 can obtain a second prediction block by performing intra prediction on the current block 2250 according to a predetermined intra prediction mode (e.g., the planar mode), or can determine the temporal reference block 2480 or the spatial reference block 2280 as the second prediction block. The prediction decoder 2030 can reconstruct the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0412] According to an embodiment, the prediction decoder 2030 can select a first intra prediction mode and a second intra prediction mode from among a plurality of intra prediction modes, and obtain a first prediction block by performing intra prediction on the current block 2250 according to the first intra prediction mode. The prediction decoder 2030 can obtain a second prediction block by performing intra prediction on the current block 2250 according to the second intra prediction mode, and reconstruct the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0413] According to an embodiment, to select a first intra prediction mode and a second intra prediction mode from among a plurality of intra prediction modes, the prediction decoder 2030 can perform intra prediction on the neighboring sample set 2230 of the current block 2250 according to a plurality of intra prediction modes, and can consider a difference between each of a plurality of predicted sample sets generated as a result of performing intra prediction and the neighboring sample set 2230. The prediction decoder 2030 can determine two predicted sample sets in order of a smallest difference from the neighboring sample set 2230, and can select two intra prediction modes used to generate the two predicted sample sets as the first intra prediction mode and the second intra prediction mode, respectively.

[0414] According to an embodiment, when the intra prediction mode is not used to reconstruct the samples at the plurality of respective positions 2281, 2282, 2481, and 2482, the prediction decoder 2030 can perform intra prediction on the current block 2250 according to a predetermined intra prediction mode (e.g., planar mode).

[0415] According to an embodiment, when the intra prediction mode is not used to reconstruct the samples at the plurality of respective positions 2281, 2282, 2481, and 2482, the prediction decoder 2030 can obtain a first prediction block by performing intra prediction on the current block 2250 according to a predetermined first intra prediction mode (e.g., planar mode), or can obtain a second prediction block by performing intra prediction on the current block 2250 according to a predetermined second intra prediction mode (e.g., DC mode). The prediction decoder 2030 can reconstruct the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0416] According to the above-described embodiments, even when the respective positions of the predetermined positions within the current block 2250 are identified from at least one of the spatial reference block 2280 or the temporal reference block 2480, it becomes impossible to derive the intra prediction mode of the current block 2250 from the respective positions when the inter mode is used to reconstruct the samples at the respective positions.

[0417] According to an embodiment, the intra prediction mode of the current block 2250 can be derived from the samples reconstructed in the inter mode by a propagation process of the intra prediction mode. This will be described with reference to Figure 30 .

[0418] Figure 30 is a diagram for describing a process of propagating an intra prediction mode according to an embodiment.

[0419] Referring to Figure 26 , the first picture 3010 is an intra picture, and all blocks within the first picture 3010 can be reconstructed by the intra mode. The intra prediction mode of the blocks within the first picture 3010 can be determined by a bitstream, or can be determined from spatial reference blocks of the blocks. For example, the intra prediction mode of the first block 3011 in the first picture 3010 can be derived from a spatial reference block of the first block 3011 in the first picture 3010.

[0420] The second picture 3030 can be a picture that is decoded later than the first picture 3010. Some blocks in the second picture 3030 can be reconstructed according to the intra mode, and other blocks can be reconstructed according to the inter mode.

[0421] For example, when a second block 3031 in a second picture 3030 is inter-predicted using a first block 3011 in a first picture 3010 as a reference block, an intra-prediction mode of the first block 3011 indicated by a motion vector mv1 of the second block 3031 can be propagated to the second block 3031. For blocks in the second picture 3030 to which an intra-mode is applied, an intra-prediction mode can be determined from a spatial reference block or a temporal reference block according to the above-described embodiments.

[0422] A third picture 3050 can be a picture decoded later than the second picture 3030, and when an intra-mode is applied to a third block 3051 in the third picture 3050, an intra-prediction mode of the third block 3051 can be derived from a fourth block 3052 that is a spatial reference block of the third block 3051. Even when an inter-mode is applied to the fourth block 3052, an intra-prediction mode of the second block 3031 indicated by a motion vector mv2 of the fourth block 3052 can be propagated to the fourth block 3052, and thus the intra-prediction mode of the third block 3051 can be derived from the fourth block 3052.

[0423] According to the above-described embodiments with reference to Figure 29 and Figure 30 when a sample at a corresponding position within a spatial reference block 2280 is reconstructed according to an inter-mode, an intra-prediction mode can not be derived from the corresponding position. However, by the propagation process of the intra-prediction mode shown in Figure 30 , the intra-prediction mode can be derived from the sample reconstructed according to the inter-mode.

[0424] According to an embodiment, Figure 30 The blocks into which the first picture 3010, the second picture 3030, and the third picture 3050 shown in Figure 31 may be divided can each be a storage unit of an intra-prediction mode. For example, the blocks into which the first picture 3010, the second picture 3030, and the third picture 3050 are divided can each have a size of 4x4, which can mean that the intra-prediction mode is stored in units of blocks each having a size of 4x4 for the first picture 3010, the second picture 3030, and the third picture 3050. According to an embodiment, each of the first picture 3010, the second picture 3030, and the third picture 3050 can be reconstructed based on blocks divided based on a division form different from the division form shown in Figure 31 .

[0425] The method of determining the intra prediction mode of the current block 2250 and the method of performing the intra prediction on the current block 2250 have been described through the above-described embodiments. However, the above-described embodiments can be independently applied to each of the luma component and the chroma component of the current block 2250. For example, the intra prediction mode for the luma component of the current block 2250 can be determined from the spatial reference block 2280 and / or the temporal reference block 2480, and the intra prediction can be applied to the luma component of the current block 2250 according to the determined intra prediction mode. Also, the intra prediction mode for the chroma component of the current block 2250 can be determined from the spatial reference block 2280 and / or the temporal reference block 2480 (which can be different from the spatial reference block 2280 and / or the temporal reference block 2480 for the luma component), and the intra prediction can be applied to the chroma component of the current block 2250 according to the determined intra prediction mode.

[0426] According to an embodiment, the intra prediction mode determined for the luma component of the current block 2250 can also be equally applied to the chroma component of the current block 2250.

[0427] Figures 21 to 23 is a flowchart of an image decoding method according to an embodiment.

[0428] At operation S3110, the image decoding apparatus 2000 can determine at least one of a first reference block reconstructed before the current block 2250 in the current picture 2200 or a second reference block reconstructed before the current block 2250 in the previous picture 2400 based on template matching.

[0429] The first reference block can be referred to as a spatial reference block 2280, and the second reference block can be referred to as a temporal reference block 2480.

[0430] According to an embodiment, both the first reference block and the second reference block can be determined through template matching.

[0431] According to an embodiment, the first reference block can be determined using a block vector determined based on information obtained from a bitstream or a predetermined block vector, and the temporal reference block can be determined through template matching.

[0432] According to an embodiment, the first reference block can be determined based on template matching, and the second reference block can be determined using a motion vector determined based on information obtained from a bitstream or a predetermined motion vector.

[0433] According to an embodiment, the first reference block can be determined using a block vector determined based on information obtained from a bitstream or a predetermined block vector, and the second reference block can be determined using a motion vector determined based on information obtained from a bitstream or a predetermined motion vector.

[0434] According to an embodiment, the first reference block can be determined based on a block vector or template matching, and the second reference block can be determined based on a motion vector of the first reference block.

[0435] According to an embodiment, when it is not possible to derive the intra prediction mode from the first reference block, the second reference block can be determined within the previous picture 2400.

[0436] According to an embodiment, when it is not possible to derive the intra prediction mode from the second reference block, the first reference block can be determined within the current picture 2200.

[0437] In operation S3120, the image decoding apparatus 2000 can identify respective positions 2281 and 2481 of predetermined positions 2251 within the current block 2250 from at least one of the first reference block or the second reference block.

[0438] According to an embodiment, the number of predetermined positions 2251 and 2252 can be plural. In this case, a plurality of respective positions 2281, 2282, 2481, and 2482 can be identified from at least one of the first reference block or the second reference block.

[0439] In operation S3130, the image decoding apparatus 2000 can generate a prediction block by performing intra prediction on the current block 2250 according to an intra prediction mode used to reconstruct samples at the identified respective positions 2281 and 2481.

[0440] According to an embodiment, the image decoding apparatus 2000 can generate a first prediction block by performing intra prediction on the current block 2250 according to one intra prediction mode, or can generate a second prediction block by performing intra prediction on the current block 2250 according to another intra prediction mode. The image decoding apparatus 2000 can also generate a third prediction block by a weighted sum of the first prediction block and the second prediction block.

[0441] The method of determining the intra prediction mode of the current block 2250 and the method of generating a prediction block by performing intra prediction on the current block 2250 have been described above with reference to Figures 26 to 30 and Figure 32 , and thus a detailed description thereof will be omitted.

[0442] In operation S3140, the image decoding apparatus 2000 can reconstruct the current block 2250 by using the prediction block or the third prediction block.

[0443] According to an embodiment, the image decoding apparatus 2000 can determine the prediction block or the third prediction block as the reconstructed current block.

[0444] According to an embodiment, the image decoding apparatus 2000 can generate the reconstructed current block by combining residual data obtained from the bitstream with the prediction block or the third prediction block.

[0445] Figure 32 is a block diagram of an image encoding apparatus according to an embodiment.

[0446] Referring to Figure 19 , the image encoding apparatus 3200 can include a prediction encoder 3210 and a generator 3230.

[0447] The prediction encoder 3210 and the generator 3230 according to an embodiment can be implemented as at least one processor. According to an embodiment, the prediction encoder 3210 and the generator 3230 can operate according to at least one instruction stored in at least one memory.

[0448] The image encoding apparatus 3200 can include at least one memory for storing input / output data of the prediction encoder 3210 and the generator 3230. The image encoding apparatus 3200 can further include a memory controller for controlling data input / output of the memory.

[0449] According to an embodiment, the obtainer 3210 can correspond to the prediction encoder 1915 shown in FIG. 19, and the generator 3630 can correspond to the entropy encoder 1925 shown in FIG. 19. Figure 19 Figure 21

[0450] The prediction encoder 3210 can determine a prediction mode of the current block 2250. The current block 2250 can be a largest coding unit, a coding unit, a transform unit, or a prediction unit, which is divided from a current picture 2200 desired to be encoded.

[0451] According to an embodiment, the prediction mode of the current block 2250 can be determined as one of a plurality of prediction modes including an intra mode and an inter mode.

[0452] According to an embodiment, when the prediction mode of the current block 2250 is the intra mode, the prediction encoder 3210 can determine an intra prediction mode of the current block 2250.

[0453] The intra prediction mode of the current block 2250 can be one of a plurality of intra prediction modes. As described above with reference to Figure 33 , the plurality of intra prediction modes can include a non-directional intra mode and a directional intra mode.

[0454] According to an embodiment, the prediction encoder 3210 can perform intra prediction or inter prediction on the current block 2250 according to the prediction mode of the current block 2250, and encode the current block 2250 by using a prediction block generated as a result of performing the intra prediction or the inter prediction.

[0455] ​​According to embodiments, encoding the current block 2250 can refer to a process of generating information allowing the image decoding device 2000 to reconstruct the current block 2250. The information generated by encoding can be included in a bitstream.

[0456] According to embodiments, the prediction encoder 3210 can generate residual data corresponding to a difference between the prediction block and the current block 2250. When the prediction block is determined as the current block 2250, the residual data can not be generated.

[0457] When the prediction mode of the current block 2250 is an intra mode, the prediction encoder 3210 according to embodiments can determine a method of determining an intra prediction mode. Information indicating the method of determining the intra prediction mode can be included in a bitstream by the generator 3230.

[0458] According to embodiments, the method of determining the intra prediction mode can include a method of deriving the intra prediction mode from a reference block or a method of selecting one intra prediction mode from a plurality of intra prediction modes based on a cost.

[0459] According to embodiments, the information indicating the method of determining the intra prediction mode can be included in a sequence parameter set, a picture parameter set, a slice header, or slice data of the bitstream.

[0460] According to embodiments, the prediction encoder 3210 can determine the intra prediction mode of the current block 2250 according to one predetermined method.

[0461] According to embodiments, when the method of determining the intra prediction mode is the method of selecting one intra prediction mode from a plurality of intra prediction modes based on a cost, the prediction encoder 3210 can select, from the plurality of intra prediction modes, an intra prediction mode that produces a least cost when encoding the current block 2250. Information indicating the selected intra prediction mode can be included in a bitstream. For example, the information indicating the intra prediction mode of the current block 2250 can include a flag or an index indicating one intra prediction mode from the plurality of intra prediction modes.

[0462] When the method of determining the intra prediction mode is the method of deriving the intra prediction mode from a reference block, the prediction encoder 3210 according to embodiments can determine at least one reference block from a reference block (hereinafter, referred to as a spatial reference block 2280) that is earlier encoded than the current block 2250 in the current picture 2200 or a reference block (hereinafter, referred to as a temporal reference block 2480) that is earlier encoded than the current block 2250 in the previous picture 2400.

[0463] The prediction encoder 3210 can determine the intra prediction mode derived from at least one of the spatial reference block 2280 or the temporal reference block 2480 as the intra prediction mode of the current block 2250.

[0464] To determine the spatial reference block 2280, the prediction encoder 3210 can determine a block vector indicating the spatial reference block 2280.

[0465] To determine the temporal reference block 2480, the prediction encoder 3210 can determine an index of the previous picture 2400 including the temporal reference block 2480 and / or a motion vector indicating the temporal reference block 2480.

[0466] When the prediction block is generated through the intra prediction with respect to the current block 2250, the prediction encoder 3210 can encode the current block 2250 by using the prediction block.

[0467] According to an embodiment, the prediction encoder 3210 can generate residual data corresponding to a difference between the prediction block and the current block 2250. The residual data can be included in the bitstream.

[0468] The generator 3230 can generate a bitstream generated as a result of encoding the picture. The bitstream can include an encoding result with respect to the current block 2250.

[0469] According to an embodiment, the generator 3230 can transmit the bitstream to the image decoding apparatus 2000 through a network.

[0470] According to an embodiment, the generator 3230 can store the bitstream in a data storage medium including a magnetic medium such as a hard disk, a floppy disk, and a magnetic tape, an optical recording medium such as a CD-ROM and a DVD, and a magneto-optical medium such as a floptical disk.

[0471] The generator 3230 can generate a bitstream including syntax elements generated by encoding the picture. Values corresponding to the syntax elements can be included in the bitstream according to a layer structure of the picture.

[0472] The generator 3230 can obtain binary bits included in the bitstream by entropy-encoding the syntax elements.

[0473] According to an embodiment, the bitstream can include information about a prediction mode of the current block 2250 within the current picture 2200.

[0474] According to an embodiment, when the prediction mode 2250 of the current block 2250 is an intra mode, the bitstream can include at least one of information indicating how the intra prediction mode of the current block 2250 is determined, information indicating positions of reference blocks, i.e., the spatial reference block 2280 and / or the temporal reference block 2480, or information about residual data.

[0475] A method of determining the spatial reference block 2280 and the temporal reference block 2480 performed by the prediction encoder 3210 will now be described.

[0476] According to an embodiment, the prediction encoder 3210 can determine at least one of a spatial reference block 2280 in the current block 2250 or a temporal reference block 2480 in the previous picture 2400 coded before the current block 2250 according to template matching. According to an embodiment, the previous picture 2400 can be a picture coded before the current picture 2200.

[0477] During the template matching, a neighboring sample set coded before the current block 2250 can be used as a template 2220.

[0478] According to an embodiment, the prediction encoder 3210 can search for a template 2270 most similar to the template 2220 from the current picture 2200 by using the neighboring sample set of the current block 2250 as the template 2220, and can determine a block neighboring the found template 2270 as the spatial reference block 2280.

[0479] According to an embodiment, the prediction encoder 3210 can search for a template 2470 most similar to the template 2220 from the previous picture 2400 by using the neighboring sample set of the current block 2250 as the template 2220, and can determine a block neighboring the found template 2470 as the temporal reference block 2480.

[0480] To search for the similar templates 2270 and 2470, the prediction encoder 3210 can determine a base motion vector. For example, a predetermined motion vector (e.g., a zero vector) or a motion vector of a block at a predetermined position can be determined as the base motion vector.

[0481] The prediction encoder 3210 can search for the templates 2270 and 2470 most similar to the template 2220 within a preset range from a point indicated by the base motion vector, and can determine a block neighboring the similar templates 2270 and 2470 as the spatial reference block 2280 or the temporal reference block 2480.

[0482] According to an embodiment, the base motion vector used to search for the similar template 2270 within the current picture 2200 can be referred to as a base block vector.

[0483] When at least one of the spatial reference block 2280 or the temporal reference block 2480 is determined by the prediction encoder 3210 through the template matching, the aforementioned prediction decoder 2030 can also determine at least one of the spatial reference block 2280 or the temporal reference block 2480 through the template matching.

[0484] According to an embodiment, the prediction encoder 3210 can determine a block vector 2262 indicating a position of the spatial reference block 2280. Information indicating the block vector 2262 can be included in the bitstream.

[0485] According to an embodiment, the information indicative of the block vector 2262 can include information representative of any one of the block vector candidates included in the block vector candidate set. According to an embodiment, the information indicative of the block vector 2262 can include a block vector difference between the block vector candidate selected from the block vector candidate set and the block vector 2262 indicative of the spatial reference block 2280.

[0486] According to an embodiment, the prediction encoder 3210 can determine a motion vector 2264 indicative of a location of the temporal reference block 2480. The information indicative of the motion vector 2264 can be included in the bitstream.

[0487] According to an embodiment, the information indicative of the motion vector 2264 can include information representative of any one of the motion vector candidates included in the motion vector candidate set. According to an embodiment, the information indicative of the motion vector 2264 can include a motion vector difference between the motion vector candidate selected from the motion vector candidate set and the motion vector 2264 indicative of the temporal reference block 2480.

[0488] According to an embodiment, the prediction encoder 3210 can further determine a spatial reference block 2280 within the current picture 2200 indicated by a predetermined block vector. According to an embodiment, the prediction encoder 3210 can further determine a temporal reference block 2480 within the previous picture 2400 indicated by a predetermined motion vector. The predetermined block vector and the predetermined motion vector can represent both a block vector and a motion vector agreed upon in advance between the image encoding device 3200 and the image decoding device 2000.

[0489] According to an embodiment, the spatial reference block 2280 and the temporal reference block 2480 can be determined in various ways.

[0490] For example, both the spatial reference block 2280 and the temporal reference block 2480 can be determined by template matching.

[0491] Further, for example, the spatial reference block 2280 can be determined using the block vector 2262, and the temporal reference block 2480 can be determined by template matching.

[0492] Further, for example, the spatial reference block 2280 can be determined based on template matching, and the temporal reference block 2480 can be determined using the motion vector 2264.

[0493] Further, for example, the spatial reference block 2280 can be determined using the block vector 2262, and the temporal reference block 2480 can be determined using the motion vector 2264.

[0494] Further, for example, the spatial reference block 2280 can be determined based on a block vector or template matching, and the temporal reference block 2480 can be determined based on a motion vector 2292 of the spatial reference block 2280.

[0495] According to an embodiment, the prediction encoder 3210 can determine the spatial reference block 2280 within the current picture 2200, and when it is not possible to derive the intra prediction mode from the spatial reference block 2280, can determine the temporal reference block 2480 within the previous picture 2400.

[0496] According to an embodiment, the prediction encoder 3210 can determine the temporal reference block 2480 within the previous picture 2400, and when it is not possible to derive the intra prediction mode from the temporal reference block 2480, can determine the spatial reference block 2280 within the current picture 2200.

[0497] When at least one of the spatial reference block 2280 or the temporal reference block 2480 is determined, the prediction encoder 3210 can identify a predetermined position within the current block 2250 in order to obtain the intra prediction mode of the current block 2250 from at least one of the spatial reference block 2280 or the temporal reference block 2480.

[0498] The predetermined position can be agreed upon between the image decoding apparatus 2000 and the image encoding apparatus 3200. For example, when the position of the top-left sample of the current block 2250 is (x, y) (where x and y are integers greater than or equal to 0), the predetermined position can be (x+w / 2, y+h / 2). Here, w (w is an integer greater than or equal to 1) can be the width of the current block 2250, and h (h is an integer greater than or equal to 1) can be the height of the current block 2250.

[0499] According to an embodiment, the prediction encoder 3210 can determine a position within the current block 2250 for deriving the intra prediction mode, and information about the determined position can be included in the bitstream.

[0500] According to an embodiment, the prediction encoder 3210 can identify respective positions 2281 and 2481 of the predetermined position 2251 within the current block 2250 from at least one of the spatial reference block 2280 or the temporal reference block 2480.

[0501] The prediction encoder 3210 can determine the intra prediction mode of the current block 2250 using the intra prediction mode used to encode the samples at the respective positions 2281 and 2481 included in at least one of the spatial reference block 2280 or the temporal reference block 2480.

[0502] According to an embodiment, the prediction encoder 3210 can determine the spatial reference block 2280 within the current picture 2200, and can determine the intra prediction mode used to encode the samples at the respective positions 2281 within the spatial reference block 2280 as the intra prediction mode of the current block 2250.

[0503] According to an embodiment, when the intra prediction mode is not used to encode the sample at the corresponding position 2281 within the spatial reference block 2280, the prediction encoder 3210 can determine the temporal reference block 2480 within the previous picture 2400, and can determine the intra prediction mode used to encode the sample at the corresponding position 2481 within the temporal reference block 2480 as the intra prediction mode of the current block 2250.

[0504] According to an embodiment, when the intra prediction mode is not used to encode the sample at the corresponding position 2281 within the spatial reference block 2280 and the intra prediction mode is not used to encode the sample at the corresponding position 2481 within the temporal reference block 2480, the prediction encoder 3210 can determine a predetermined intra prediction mode (e.g., planar mode) as the intra prediction mode of the current block 2250.

[0505] According to an embodiment, when the intra prediction mode is not used to encode the sample at the corresponding position 2281 within the spatial reference block 2280 and the intra prediction mode is not used to encode the sample at the corresponding position 2481 within the temporal reference block 2480, the prediction encoder 3210 can determine a predetermined intra prediction mode (e.g., planar mode) as the intra prediction mode of the current block 2250.

[0506] According to an embodiment, the prediction encoder 3210 can select one of the intra prediction mode used to encode the sample at the corresponding position 2281 within the spatial reference block 2280 and the intra prediction mode used to encode the sample at the corresponding position 2481 within the temporal reference block 2480, and can determine the selected intra prediction mode as the intra prediction mode of the current block 2250.

[0507] According to an embodiment, information indicating one of the intra prediction mode used to encode the sample at the corresponding position 2281 within the spatial reference block 2280 and the intra prediction mode used to encode the sample at the corresponding position 2481 within the temporal reference block 2480 can be included in the bitstream.

[0508] According to an embodiment, the prediction encoder 3210 can apply the intra prediction mode of the spatial reference block 2280 and the intra prediction mode of the temporal reference block 2480 to the neighboring sample set 2230 of the current block 2250 in order to select one of the intra prediction mode of the spatial reference block 2280 and the intra prediction mode of the temporal reference block 2480.

[0509] Because the neighboring sample set 2230 of the current block 2250 includes samples coded prior to the current block 2250, the prediction encoder 3210 can perform intra prediction according to the intra prediction mode of the spatial reference block 2280 and the intra prediction mode of the temporal reference block 2480 and determine which intra prediction mode is more useful for the current block 2250.

[0510] When the intra prediction mode of the current block 2250 is determined, the prediction encoder 3210 can obtain a prediction block of the current block 2250 by performing intra prediction on the current block 2250 according to the intra prediction mode of the current block 2250.

[0511] According to an embodiment, the prediction encoder 3210 can obtain a first prediction block by performing intra prediction on the current block 2250 according to the intra prediction mode of the spatial reference block 2280 or the intra prediction mode of the temporal reference block 2480. The prediction encoder 3210 can obtain a second prediction block by performing intra prediction on the current block 2250 according to a predetermined intra prediction mode (e.g., a planar mode). The prediction encoder 3210 can also obtain a third prediction block by a weighted sum of the first prediction block and the second prediction block and encode the current block 2250 by using the third prediction block.

[0512] According to an embodiment, the prediction encoder 3210 can obtain a first prediction block by performing intra prediction on the current block 2250 according to the intra prediction mode of the spatial reference block 2280 or the intra prediction mode of the temporal reference block 2480 and can determine the spatial reference block 2280 or the temporal reference block 2480 as a second prediction block. The prediction encoder 3210 can also obtain a third prediction block by a weighted sum of the first prediction block and the second prediction block and encode the current block 2250 by using the third prediction block.

[0513] According to an embodiment, the prediction encoder 3210 can obtain a first prediction block by performing intra prediction on the current block 2250 according to the intra prediction mode of the spatial reference block 2280 or can obtain a second prediction block by performing intra prediction on the current block 2250 according to the intra prediction mode of the temporal reference block 2480. The prediction encoder 3210 can also obtain a third prediction block by a weighted sum of the first prediction block and the second prediction block and encode the current block 2250 by using the third prediction block.

[0514] According to an embodiment, when it is not possible to derive the intra prediction mode from both the spatial reference block 2280 and the temporal reference block 2480, the prediction encoder 3210 can obtain a first prediction block by performing intra prediction on the current block 2250 according to a predetermined first intra prediction mode (e.g., planar mode), or can obtain a second prediction block by performing intra prediction on the current block 2250 according to a predetermined second intra prediction mode (e.g., DC mode). The prediction encoder 3210 can also obtain a third prediction block by a weighted sum of the first prediction block and the second prediction block, and encode the current block 2250 by using the third prediction block.

[0515] According to an embodiment, information about the weight applied to the first prediction block and the weight applied to the second prediction block can be included in the bitstream.

[0516] According to an embodiment, the weight applied to the first prediction block and the weight applied to the second prediction block can be predetermined. For example, the weight applied to the first prediction block and the weight applied to the second prediction block can each be predetermined as 1 / 2.

[0517] According to an embodiment, the number of predetermined positions within the current block 2250 for determining the intra prediction mode of the current block 2250 can be plural.

[0518] The plural predetermined positions can be agreed upon between the image decoding apparatus 2000 and the image encoding apparatus 3200. For example, when the position of the top-left sample of the current block 2250 is (x, y) (where x and y are integers greater than or equal to 0), the plural predetermined positions can be (x, y) and (x+w / 2, y+h / 2). Here, w (w is an integer greater than or equal to 1) can be the width of the current block 2250, and h (h is an integer greater than or equal to 1) can be the height of the current block 2250.

[0519] According to an embodiment, the prediction encoder 3210 can determine plural positions within the current block 2250. Information about the determined plural positions can be included in the bitstream. According to an embodiment, the information about the determined plural positions within the current block 2250 can be signaled via a packet separate from the bitstream.

[0520] According to an embodiment, the prediction encoder 3210 can identify plural respective positions 2281, 2282, 2481, and 2482 of the plural predetermined positions 2251 and 2252 within the current block 2250 from at least one of the spatial reference block 2280 or the temporal reference block 2480.

[0521] When the plurality of respective positions 2281, 2282, 2481, and 2482 are identified from at least one of the spatial reference block 2280 or the temporal reference block 2480, the prediction encoder 3210 can perform intra prediction on the current block 2250 according to at least one intra prediction mode used to encode samples at the plurality of respective positions 2281, 2282, 2481, and 2482.

[0522] According to embodiments, when it is not possible to derive an intra prediction mode from the plurality of respective positions 2281 and 2282 of the spatial reference block 2280, the prediction encoder 3210 can determine the temporal reference block 2480, and can perform intra prediction on the current block 2250 according to at least one intra prediction mode used to encode samples at the plurality of respective positions 2481 and 2482 within the temporal reference block 2480.

[0523] According to embodiments, when it is not possible to derive an intra prediction mode from the plurality of respective positions 2481 and 2482 of the temporal reference block 2480, the prediction encoder 3210 can determine the spatial reference block 2280, and can perform intra prediction on the current block 2250 according to at least one intra prediction mode used to encode samples at the plurality of respective positions 2281 and 2282 within the spatial reference block 2280.

[0524] According to embodiments, the prediction encoder 3210 can determine the spatial reference block 2280 and the temporal reference block 2280 within the current picture 2200 and the previous picture 2400, respectively, and can perform intra prediction on the current block 2250 according to at least one intra prediction mode used to encode samples at the plurality of respective positions 2281, 2282, 2481, and 2482 within the spatial reference block 2280 and the temporal reference block 2480.

[0525] According to embodiments, when one intra prediction mode is used to encode samples at the plurality of respective positions 2281, 2282, 2481, and 2482, i.e., when an intra prediction mode is used to encode samples at one respective position and an intra prediction mode is not used to encode samples at other respective positions, the prediction encoder 3210 can perform intra prediction on the current block 2250 according to one available intra prediction mode.

[0526] According to an embodiment, when one intra prediction mode is used to encode samples at the plurality of respective positions 2281, 2282, 2481, and 2482, the prediction encoder 3210 can obtain a first prediction block by performing intra prediction on the current block 2250 according to the one available intra prediction mode. The prediction encoder 3210 can obtain a second prediction block by performing intra prediction on the current block 2250 according to a predetermined intra prediction mode (e.g., planar mode), or can determine the temporal reference block 2480 or the spatial reference block 2280 as the second prediction block. The prediction encoder 3210 can encode the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0527] According to an embodiment, when two intra prediction modes are used to encode samples at the plurality of respective positions 2281, 2282, 2481, and 2482, the prediction encoder 3210 can obtain a first prediction block by performing intra prediction on the current block 2250 according to one of the two intra prediction modes. The prediction encoder 3210 can obtain a second prediction block by performing intra prediction on the current block 2250 according to the other of the two intra prediction modes. The prediction encoder 3210 can encode the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0528] According to an embodiment, the prediction encoder 3210 can select one intra prediction mode from a plurality of intra prediction modes used to encode samples at the plurality of respective positions 2281, 2282, 2481, and 2482, and can generate a prediction block by performing intra prediction on the current block 2250 according to the selected intra prediction mode. To select one intra prediction mode, the prediction encoder 3210 can perform intra prediction on the neighboring sample set 2230 of the current block 2250 according to the plurality of intra prediction modes, and can consider a difference between each of a plurality of prediction sample sets generated as a result of performing intra prediction and the neighboring sample set 2230.

[0529] According to an embodiment, the prediction encoder 3210 can obtain a first prediction block by performing intra prediction on the current block 2250 according to one intra prediction mode selected from a plurality of intra prediction modes. The prediction encoder 3210 can obtain a second prediction block by performing intra prediction on the current block 2250 according to a predetermined intra prediction mode (e.g., planar mode), or can determine the temporal reference block 2480 or the spatial reference block 2280 as the second prediction block. The prediction encoder 3210 can encode the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0530] According to an embodiment, the prediction encoder 3210 can select the first intra prediction mode and the second intra prediction mode from among a plurality of intra prediction modes, and obtain a first prediction block by performing intra prediction on the current block 2250 according to the first intra prediction mode. The prediction encoder 3210 can obtain a second prediction block by performing intra prediction on the current block 2250 according to the second intra prediction mode, and encode the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0531] According to an embodiment, in order to select the first intra prediction mode and the second intra prediction mode from among a plurality of intra prediction modes, the prediction encoder 3210 can perform intra prediction on the neighboring sample set 2230 of the current block 2250 according to the plurality of intra prediction modes, and can consider a difference between each of a plurality of predicted sample sets generated as a result of performing the intra prediction and the neighboring sample set 2230.

[0532] According to an embodiment, when the intra prediction mode is not used to encode the samples at the plurality of respective positions 2281, 2282, 2481, and 2482, the prediction encoder 3210 can perform intra prediction on the current block 2250 according to a predetermined intra prediction mode (e.g., planar mode).

[0533] According to an embodiment, when the intra prediction mode is not used to encode the samples at the plurality of respective positions 2281, 2282, 2481, and 2482, the prediction encoder 3210 can obtain a first prediction block by performing intra prediction on the current block 2250 according to a predetermined first intra prediction mode (e.g., planar mode), or can obtain a second prediction block by performing intra prediction on the current block 2250 according to a predetermined second intra prediction mode (e.g., DC mode). The prediction encoder 3210 can encode the current block 2250 by using a third prediction block generated via a weighted sum of the first prediction block and the second prediction block.

[0534] According to an embodiment, the operation of the prediction encoder 3210 of the image encoding apparatus 3200 can be the same as that of the prediction decoder 2030 of the image decoding apparatus 2000, and thus the description of the operation of the prediction decoder 2030 given above can be equally applied to the prediction encoder 3210.

[0535] Figures 21 to 23 is a flowchart of an image encoding method according to an embodiment.

[0536] In operation S3310, the image encoding apparatus 3200 can determine at least one of a first reference block encoded before the current block 2250 in the current picture 2200 or a second reference block in a previous picture 2400 encoded before the current block 2250 based on template matching.

[0537] The first reference block can be referred to as a spatial reference block 2280, and the second reference block can be referred to as a temporal reference block 2480.

[0538] According to an embodiment, both the first reference block and the second reference block can be determined through template matching.

[0539] According to an embodiment, the first reference block can be determined using a block vector, and the second reference block can be determined through template matching.

[0540] According to an embodiment, the first reference block can be determined based on template matching, and the second reference block can be determined using a motion vector.

[0541] According to an embodiment, the first reference block can be determined using a block vector, and the second reference block can be determined using a motion vector.

[0542] According to an embodiment, the first reference block can be determined based on a block vector or template matching, and the second reference block can be determined based on a motion vector of the first reference block.

[0543] According to an embodiment, the second reference block can be determined when it is not possible to derive an intra prediction mode from the first reference block.

[0544] According to an embodiment, the first reference block can be determined when it is not possible to derive an intra prediction mode from the second reference block.

[0545] In operation S3320, the image encoding apparatus 3200 can identify respective positions 2281 and 2481 of predetermined positions 2251 within the current block 2250 from at least one of the first reference block or the second reference block.

[0546] According to an embodiment, the number of predetermined positions 2251 and 2252 can be plural. In this case, a plurality of respective positions 2281, 2282, 2481, and 2482 can be identified from at least one of the first reference block or the second reference block.

[0547] In operation S3330, the image encoding apparatus 3200 can generate a prediction block by performing intra prediction on the current block 2250 according to an intra prediction mode used to encode samples at the identified respective positions 2281 and 2481.

[0548] According to an embodiment, the image encoding apparatus 3200 can generate a first prediction block by performing intra prediction on the current block 2250 according to one intra prediction mode, or can generate a second prediction block by performing intra prediction on the current block 2250 according to another intra prediction mode. The image encoding apparatus 3200 can also generate a third prediction block through a weighted sum of the first prediction block and the second prediction block.

[0549] The above has been described with reference toFigures 26 to 30 and ​ A method of determining an intra prediction mode of the current block 2250 and a method of generating a prediction block by performing intra prediction on the current block 2250 are described, and thus a detailed description thereof will be omitted.

[0550] In operation S3340, the image encoding apparatus 3200 can encode the current block 2250 by using the prediction block or the third prediction block.

[0551] As a result of encoding the current block 2250, a bitstream can be generated.

[0552] According to an embodiment, the image encoding apparatus 3200 can obtain residual data corresponding to a difference between the prediction block or the third prediction block and the current block 2250, and information about the residual data can be included in the bitstream.

[0553] The image encoding method, the image encoding apparatus 3200, the image decoding method, and the image decoding apparatus 2000 according to an embodiment are intended to improve performance of prediction encoding and prediction decoding with respect to the current block 2250.

[0554] The image encoding method, the image encoding apparatus 3200, the image decoding method, and the image decoding apparatus 2000 according to an embodiment are intended to reduce an amount of data required to signal an intra prediction mode.

[0555] The image encoding method, the image encoding apparatus 3200, the image decoding method, and the image decoding apparatus 2000 according to an embodiment are intended to reduce a bit rate of a bitstream.

[0556] The technical problems to be solved by the disclosure are not limited to the above-mentioned technical problems, and other technical problems not mentioned will be clearly understood by those skilled in the art to which the disclosure pertains from the following description.

[0557] The image decoding method according to an embodiment can include determining at least one of a first reference block reconstructed before the current block 2250 in the current picture 2200 or a second reference block in a previous picture 2400 reconstructed before the current block 2250 based on template matching.

[0558] The image decoding method according to an embodiment can include identifying a corresponding position of a predetermined position within the current block 2250 from at least one of the first reference block or the second reference block.

[0559] The image decoding method according to an embodiment can include generating a prediction block by performing intra prediction on the current block 2250 according to an intra prediction mode used to reconstruct a sample at the identified corresponding position.

[0560] The image decoding method according to an embodiment can include reconstructing the current block 2250 by using the prediction block.

[0561] According to embodiments, the intra prediction mode of the current block 2250 can be derived from the reference block, so that the bit rate of the bitstream can be reduced.

[0562] According to embodiments, generating the prediction block can comprise intra predicting the current block 2250 according to the intra prediction mode used for reconstructing the samples at the respective positions of the first reference block, and, when the intra prediction mode is not used for reconstructing the samples at the respective positions of the first reference block, intra predicting the current block 2250 according to the intra prediction mode used for reconstructing the samples at the respective positions of the second reference block.

[0563] According to embodiments, a determination can be made first whether the intra prediction mode of the first reference block in the current picture 2200 is available, and then whether the intra prediction mode of the second reference block in the previous picture 2400 is available, so that the process for deriving the intra prediction mode of the current block 2250 can be simplified.

[0564] According to embodiments, determining at least one of the first reference block or the second reference block can comprise determining the first reference block by template matching; and, when the intra prediction mode is not used for reconstructing the samples at the respective positions of the first reference block, determining the second reference block within the previous picture 2400 based on motion vectors used for reconstructing the samples at the respective positions of the first reference block.

[0565] According to embodiments, because the first reference block is determined by template matching and the second reference block is determined by motion vectors of the first reference block, information indicating the first reference block and the second reference block can not need to be included in the bitstream.

[0566] According to embodiments, generating the prediction block can comprise performing intra prediction of the current block 2250 according to a predetermined intra prediction mode, when the intra prediction mode is not used for reconstructing the samples at the respective positions of the identified.

[0567] According to embodiments, when it is not possible to derive the intra prediction mode from the reference block, a default intra prediction mode can be used to enable efficient intra prediction.

[0568] According to embodiments, generating the prediction block can comprise selecting one of a first intra prediction mode used for reconstructing the samples at the respective positions of the first reference block and a second intra prediction mode used for reconstructing the samples at the respective positions of the second reference block; and performing intra prediction of the current block 2250 according to the selected intra prediction mode.

[0569] According to embodiments, one of the intra prediction modes useful for predicting the current block can be selected, so that the accuracy of the prediction can be improved.

[0570] According to an embodiment, the selecting can comprise selecting one of the first intra prediction mode and the second intra prediction mode based on information obtained from the bitstream.

[0571] According to an embodiment, selecting one of the intra prediction modes based on information obtained from the bitstream can reduce the load on the image decoding device 2000.

[0572] According to an embodiment, the selecting can comprise obtaining a first set of predicted samples of the neighboring sample set by applying intra prediction according to the first intra prediction mode to the neighboring sample set reconstructed prior to the current block, obtaining a second set of predicted samples of the neighboring sample set by applying intra prediction according to the second intra prediction mode to the neighboring sample set, and selecting one of the first intra prediction mode and the second intra prediction mode based on a result of comparing the first set of predicted samples with the neighboring sample set and a result of comparing the second set of predicted samples with the neighboring sample set.

[0573] According to an embodiment, the image decoding device 2000 directly applies intra prediction to the neighboring sample set in order to select one of the intra prediction modes, which can reduce the bit rate of the bitstream.

[0574] According to an embodiment, generating the prediction block can comprise obtaining a first prediction block by performing intra prediction on the current block 2250 according to a first intra prediction mode used to reconstruct samples at respective positions of a first reference block, obtaining a second prediction block by performing intra prediction on the current block 2250 according to a second intra prediction mode used to reconstruct samples at respective positions of a second reference block, and obtaining a third prediction block by a weighted sum of the first prediction block and the second prediction block, and reconstructing the current block 2250 can comprise reconstructing the current block 2250 by using the third prediction block.

[0575] According to an embodiment, using two intra prediction modes for reconstructing the current block 2250 can improve the accuracy of the prediction.

[0576] According to an embodiment, generating the prediction block can comprise obtaining a first prediction block by performing intra prediction on the current block 2250 according to an intra prediction mode used to reconstruct samples at respective positions, obtaining a second prediction block by performing intra prediction on the current block 2250 according to a predetermined intra prediction mode, and obtaining a third prediction block by a weighted sum of the first prediction block and the second prediction block, and reconstructing the current block 2250 can comprise reconstructing the current block 2250 by using the third prediction block.

[0577] According to an embodiment, using two intra prediction modes for reconstructing the current block 2250 can improve the accuracy of the prediction.

[0578] According to an embodiment, reconstructing the current block 2250 can comprise reconstructing the current block 2250 by using a result of combining at least one of the first reference block or the second reference block with the prediction block.

[0579] According to an embodiment, the accuracy of the prediction can be improved by using the reference block as the prediction block.

[0580] According to an embodiment, the identifying can comprise identifying a plurality of respective positions of a plurality of predetermined positions within the current block 2250 from at least one of the first reference block or the second reference block, and the generating the prediction block can comprise generating the prediction block by performing intra prediction on the current block 2250 according to at least one intra prediction mode used to reconstruct a sample at at least one of the identified plurality of respective positions.

[0581] According to an embodiment, determining a number of positions within the current block 2250 for deriving an intra prediction mode of the current block 2250 can make it possible to more reliably determine the intra prediction mode of the current block 2250.

[0582] According to an embodiment, the generating the prediction block can comprise obtaining a first prediction block by performing intra prediction on the current block 2250 according to a first intra prediction mode used to reconstruct a sample at a first of the identified plurality of respective positions, obtaining a second prediction block by performing intra prediction on the current block 2250 according to a second intra prediction mode used to reconstruct a sample at a second of the identified plurality of respective positions, and obtaining a third prediction block by a weighted sum of the first prediction block and the second prediction block, and the reconstructing the current block 2250 can comprise reconstructing the current block 2250 by using the third prediction block.

[0583] According to an embodiment, two intra prediction modes are used to reconstruct the current block 2250, which can improve the accuracy of the prediction.

[0584] According to an embodiment, the generating the prediction block can comprise obtaining a first prediction block by performing intra prediction on the current block 2250 according to a first intra prediction mode selected from a plurality of intra prediction modes used to reconstruct samples at the plurality of respective positions, obtaining a second prediction block by performing intra prediction on the current block 2250 according to a second intra prediction mode selected from the plurality of intra prediction modes used to reconstruct samples at the plurality of respective positions, and obtaining a third prediction block by a weighted sum of the first prediction block and the second prediction block, and the reconstructing the current block 2250 can comprise reconstructing the current block 2250 by using the third prediction block.

[0585] According to an embodiment, two intra prediction modes that are most suitable for the current block 2250 are used to reconstruct the current block 2250, which can improve the accuracy of the prediction.

[0586] According to an embodiment, generating the prediction block can include obtaining a set of predicted samples of the set of neighboring samples by applying intra prediction according to each of a plurality of intra prediction modes to the set of neighboring samples reconstructed before the current block 2250, and selecting the first intra prediction mode and the second intra prediction mode from the plurality of intra prediction modes based on a result of comparing each of the set of predicted samples with the set of neighboring samples.

[0587] According to an embodiment, the two intra prediction modes that are most suitable for the current block 2250 can be selected by intra prediction of the set of neighboring samples of the current block 2250.

[0588] An image decoding apparatus according to an embodiment can include at least one memory storing at least one instruction, and at least one processor operating according to the at least one instruction.

[0589] According to an embodiment, the at least one processor can determine at least one of a first reference block reconstructed before the current block 2250 in the current picture 2200 or a second reference block in a previous picture 2400 reconstructed before the current block 2250 based on template matching.

[0590] According to an embodiment, the at least one processor can identify a corresponding position of a predetermined position within the current block 2250 from at least one of the first reference block or the second reference block.

[0591] According to an embodiment, the at least one processor can generate a prediction block by performing intra prediction on the current block 2250 according to an intra prediction mode used to reconstruct a sample at the identified corresponding position.

[0592] According to an embodiment, the at least one processor can reconstruct the current block 2250 by using the prediction block.

[0593] According to an embodiment, an intra prediction mode of the current block 2250 can be derived from a reference block, and thus a bit rate of a bitstream can be reduced.

[0594] An image encoding method according to an embodiment can include determining at least one of a first reference block encoded before a current block 2250 in a current picture 2200 or a second reference block in a previous picture 2400 encoded before the current block 2250 based on template matching.

[0595] An image encoding method according to an embodiment can include identifying a corresponding position of a predetermined position within the current block 2250 from at least one of the first reference block or the second reference block.

[0596] An image encoding method according to an embodiment can include generating a prediction block by performing intra prediction on the current block 2250 according to an intra prediction mode used to encode a sample at the identified corresponding position.

[0597] The image encoding method according to an embodiment can include encoding the current block 2250 by using the prediction block.

[0598] According to an embodiment, an intra prediction mode of the current block 2250 can be derived from the reference block, and thus a bit rate of a bitstream can be reduced.

[0599] The image encoding apparatus according to an embodiment can include at least one memory storing at least one instruction, and at least one processor operating according to the at least one instruction.

[0600] According to an embodiment, the at least one processor can determine at least one of a first reference block, which is encoded before the current block 2250 in the current picture 2200, or a second reference block, which is encoded before the current block 2250 in a previous picture 2400, based on template matching.

[0601] According to an embodiment, the at least one processor can identify a corresponding position of a predetermined position within the current block 2250 from at least one of the first reference block or the second reference block.

[0602] According to an embodiment, the at least one processor can generate the prediction block by performing intra prediction on the current block 2250 according to an intra prediction mode used to encode a sample at the identified corresponding position.

[0603] According to an embodiment, the at least one processor can encode the current block 2250 by using the prediction block.

[0604] According to an embodiment, an intra prediction mode of the current block 2250 can be derived from the reference block, and thus a bit rate of a bitstream can be reduced.

[0605] In a computer-readable recording medium having a bitstream recorded thereon, according to an embodiment, the bitstream can include a result of encoding the current block 2250.

[0606] According to an embodiment, the result of encoding the current block 2250 can be generated by determining at least one of a first reference block, which is encoded before the current block 2250 in the current picture 2200, or a second reference block, which is encoded before the current block 2250 in a previous picture 2400, based on template matching.

[0607] According to an embodiment, the result of encoding the current block 2250 can be generated by identifying a corresponding position of a predetermined position within the current block 2250 from at least one of the first reference block or the second reference block.

[0608] According to an embodiment, a result of encoding the current block 2250 can be generated by generating a prediction block by intra-predicting the current block 2250 according to an intra-prediction mode used to encode the identified sample at the corresponding position.

[0609] According to an embodiment, a result of encoding the current block 2250 can be generated by encoding the current block 2250 using the prediction block.

[0610] According to an embodiment, an intra-prediction mode of the current block 2250 can be derived from the reference block, and thus a bit rate of a bitstream can be reduced.

[0611] The image encoding method, the image encoding apparatus 3200, the image decoding method, and the image decoding apparatus 2000 according to an embodiment can improve performance of prediction encoding and prediction decoding with respect to the current block 2250.

[0612] The image encoding method, the image encoding apparatus 3200, the image decoding method, and the image decoding apparatus 2000 according to an embodiment can reduce an amount of data required to signal an intra-prediction mode.

[0613] The image encoding method, the image encoding apparatus 3200, the image decoding method, and the image decoding apparatus 2000 according to an embodiment can reduce a bit rate of a bitstream.

[0614] Effects obtainable from the present disclosure are non-limited the above-mentioned technical effects, and other unmentioned effects can be clearly understood from the following description by those having ordinary skill in the technical field to which the present disclosure pertains.

[0615] The above-described embodiments of the present disclosure can be configured as a computer-readable program and be stored in a machine-readable storage medium.

[0616] A machine-readable storage medium can be provided as a non-transitory storage medium. The "non-transitory storage medium" is a tangible device and only means that it does not include a signal (for example, an electromagnetic wave). The term "non-transitory" only means that it does not include a signal (for example, an electromagnetic wave), and does not limit the scope of a non-transitory storage medium to storage media that semi-permanently store data. For example, the non-transitory storage medium can include a buffer.

[0617] According to an embodiment of the disclosure, the method according to various disclosed embodiments can be provided by being included in a computer program product. The computer program product as a commodity can be traded between a seller and a buyer. The computer program product is distributed in the form of a device readable storage medium (e.g., a compact disc read only memory (CD-ROM)) or can be distributed (e.g., downloaded or uploaded) through an application store or directly and online between two user devices (e.g., smart phones). In the case of online distribution, at least a part (e.g., a downloadable app) of the computer program product can be at least temporarily stored in a device readable storage medium such as a manufacturer's server, an application store's server, or a relay server's memory, or can be temporarily generated.

[0618] While one or more embodiments of the disclosure have been described with reference to the figures, it will be understood by those of ordinary skill in the art that various changes in form and details can be made therein without departing from the spirit and scope defined by the following claims.

Claims

1. An image decoding method, comprising: Based on template matching, determine at least one of the following: a first reference block reconstructed before the current block (2250) in the current frame (2200) or a second reference block in a previous frame (2400) reconstructed before the current block (2250); Identify the corresponding position of the predetermined position within the current block (2250) from at least one of the first reference block or the second reference block; A prediction block is generated by performing intra-frame prediction on the current block (2250) based on the intra-frame prediction mode of the sample points at the corresponding locations used for reconstruction identification; as well as The current block (2250) is reconstructed using the predicted block.

2. The image decoding method according to claim 1, wherein, Generating the prediction block includes: Intra-prediction is performed on the current block (2250) based on the intra-prediction mode of the samples at the corresponding locations used to reconstruct the first reference block, and When the intra-prediction mode is not used to reconstruct the samples at the corresponding positions of the first reference block, intra-prediction is performed on the current block (2250) according to the intra-prediction mode used to reconstruct the samples at the corresponding positions of the second reference block.

3. The image decoding method according to any one of claims 1 and 2, wherein, Determining at least one of the first reference block or the second reference block includes: The first reference block is determined by template matching; and When the intra-frame prediction mode is not used to reconstruct the samples at the corresponding positions of the first reference block, the second reference block in the previous frame (2400) is determined based on the motion vectors of the samples at the corresponding positions used to reconstruct the first reference block.

4. The image decoding method according to any one of claims 1 to 3, wherein, Generating the prediction block includes: When the intra-frame prediction mode is not used to reconstruct the samples at the corresponding locations identified, intra-frame prediction is performed on the current block (2250) according to the predetermined intra-frame prediction mode.

5. The image decoding method according to any one of claims 1 to 4, wherein, Generating the prediction block includes: An intra-frame prediction mode is selected from a first intra-frame prediction mode for reconstructing samples at the corresponding locations of the first reference block and a second intra-frame prediction mode for reconstructing samples at the corresponding locations of the second reference block; and Intra-prediction is performed on the current block (2250) according to the selected intra-prediction mode.

6. The image decoding method according to any one of claims 1 to 5, wherein, The selection includes: Choose the intra-prediction mode indicated by information obtained from the bitstream from the first intra-prediction mode and the second intra-prediction mode.

7. The image decoding method according to any one of claims 1 to 6, wherein, The selection includes: The first predicted sample set of the neighboring sample set is obtained by applying the intra-prediction according to the first intra-prediction mode to the neighboring sample set reconstructed before the current block (2250). A second predicted sample set of the neighboring sample set is obtained by applying intra-prediction based on a second intra-prediction mode to the neighboring sample set; and Based on the results of comparing the first prediction sample set with the neighboring sample set and the results of comparing the second prediction sample set with the neighboring sample set, an intra-prediction mode is selected from the first intra-prediction mode and the second intra-prediction mode.

8. The image decoding method according to any one of claims 1 to 7, wherein, Generating the prediction block includes: The first prediction block is obtained by performing intra-frame prediction on the current block (2250) according to the first intra-frame prediction mode of the sample points at the corresponding positions used to reconstruct the first reference block; The second prediction block is obtained by performing intra-frame prediction on the current block (2250) according to the second intra-frame prediction mode of the samples at the corresponding positions used to reconstruct the second reference block; and The third prediction block is obtained by weighting the first and second prediction blocks, and Reconstructing the current block (2250) includes: The current block (2250) is reconstructed using a third prediction block.

9. The image decoding method according to any one of claims 1 to 8, wherein, Generating the prediction block includes: A first prediction block is obtained by performing intra-frame prediction on the current block (2250) according to the intra-frame prediction mode used to reconstruct the samples at the corresponding locations; A second prediction block is obtained by performing intra-prediction on the current block (2250) according to a predetermined intra-prediction mode; and The third prediction block is obtained by weighting the first and second prediction blocks, and Reconstructing the current block (2250) includes: The current block (2250) is reconstructed using a third prediction block.

10. The image decoding method according to any one of claims 1 to 9, wherein, Reconstructing the current block (2250) includes: The current block (2250) is reconstructed by combining the result of at least one of the first reference block or the second reference block with the predicted block.

11. The image decoding method according to any one of claims 1 to 10, wherein, The identification includes: Identify multiple corresponding positions of multiple predetermined positions within the current block (2250) from at least one of the first reference block or the second reference block, and Generating the prediction block includes: The prediction block is generated by performing intra-frame prediction on the current block (2250) according to at least one intra-frame prediction mode for reconstructing samples at at least one of the plurality of corresponding locations.

12. The image decoding method according to any one of claims 1 to 11, wherein, Generating the prediction block includes: A first prediction block is obtained by performing intra-frame prediction on the current block (2250) based on a first intra-frame prediction mode of samples at a first corresponding position among the plurality of corresponding positions used for reconstruction identification; A second prediction block is obtained by performing intra-frame prediction on the current block (2250) based on a second intra-frame prediction mode of samples at a second corresponding location among the plurality of corresponding locations used for reconstruction identification; and The third prediction block is obtained by weighting the first and second prediction blocks, and Reconstructing the current block (2250) includes: The current block (2250) is reconstructed using a third prediction block.

13. The image decoding method according to any one of claims 1 to 12, wherein, Generating the prediction block includes: A first prediction block is obtained by performing intra prediction on the current block (2250) according to a first intra prediction mode selected from multiple intra prediction modes of samples at the multiple corresponding locations used for reconstruction identification; A second prediction block is obtained by performing intra-prediction on the current block (2250) according to a second intra-prediction mode selected from the plurality of intra-prediction modes of samples at the plurality of corresponding locations used for reconstruction identification; and The third prediction block is obtained by weighting the first and second prediction blocks, and Reconstructing the current block (2250) includes: The current block (2250) is reconstructed using a third prediction block.

14. An image encoding method, comprising: Based on template matching, at least one of the following is determined: a first reference block encoded before the current block (2250) in the current frame (2200) or a second reference block in a previous frame (2400) encoded before the current block (2250); Identify the corresponding position of the predetermined position within the current block (2250) from at least one of the first reference block or the second reference block; A prediction block is generated by performing intra-frame prediction on the current block (2250) according to an intra-frame prediction mode used to encode samples at the corresponding locations of the identification. as well as The current block (2250) is encoded by using the prediction block.

15. A computer-readable recording medium having a recorded bit stream thereon, in, The bitstream includes the result of encoding the current block (2250), and The result of encoding the current block (2250) is generated as follows: Based on template matching, at least one of a first reference block encoded before the current block (2250) in the current frame (2200) or a second reference block in a previous frame (2400) encoded before the current block (2250) is determined; Identify the corresponding position of the predetermined position within the current block (2250) from at least one of the first reference block or the second reference block; A prediction block is generated by performing intra-frame prediction on the current block (2250) according to an intra-frame prediction mode used to encode samples at the corresponding locations of the identification. as well as The current block (2250) is encoded by using the prediction block.