Image encoding and decoding method using bidirectional prediction and method for transmitting bitstream

Bidirectional prediction techniques enhance image encoding and decoding efficiency by reducing residual data and simplifying entropy processes, addressing the challenges of high bit rates and complexity in existing technologies.

CN119182923APending Publication Date: 2024-12-24SAMSUNG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411290521.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2018-11-16
Filing Date
2019-11-15
Publication Date
2024-12-24

Smart Images

  • Figure CN119182923A_ABST
    Figure CN119182923A_ABST
Patent Text Reader

Abstract

Disclosed are an image encoding and decoding method using bi-directional prediction and a method for transmitting a bitstream, the image decoding method comprising the steps of: obtaining a first reference block and a second reference block for bi-directional prediction of a current block; obtaining weight information for combining the first reference block and the second reference block from the bitstream; performing entropy decoding on the weight information to obtain a weight index; combining the first reference block with the second reference block according to a candidate value indicated by the weight index among candidate values included in a weight candidate group; and reconstructing the current block on the basis of the combination result, in which a first binary value corresponding to the weight index is entropy decoded on the basis of a context model, and the remaining binary values corresponding to the weight index are entropy decoded by a bypass method.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with the application date of November 15, 2019, application number 201980075617.0, and invention name "Image encoding and decoding method using bidirectional prediction and image encoding and decoding device". Technical Field

[0002] The present disclosure relates to the field of image encoding and decoding. More specifically, the present disclosure relates to an image encoding method and device using bidirectional prediction and an image decoding method and device. Background Art

[0003] In image encoding and decoding, an image is divided into blocks, and each block is predictively encoded and predictively decoded by inter-frame prediction or intra-frame prediction.

[0004] Intra-frame prediction is a method of removing spatial redundancy in an image to compress the image, and inter-frame prediction is a method of removing temporal redundancy between images to compress the image. A representative example of inter-frame prediction is motion estimation coding. Motion estimation coding predicts a block of a current image by using a reference image. A reference block most similar to the current block is searched within a preset search range by using a preset evaluation function. The current block is predicted based on the reference block, and the prediction block generated as a prediction result is subtracted from the current block to generate a residual block. The residual block is then encoded. In order to perform prediction more accurately, interpolation is performed on the reference image to generate pixels in sub-pixels smaller than integer pixel units, and inter-frame prediction is performed based on pixels in sub-pixels.

[0005] In codecs such as H.264 Advanced Video Coding (AVC) and High Efficiency Video Coding (HEVC), a motion vector of a previously encoded block adjacent to a current block or a block included in a previously encoded image is used as a predicted motion vector of the current block in order to predict the motion vector of the current block. A differential motion vector, which is the difference between the motion vector of the current block and the predicted motion vector, is signaled to the decoder side by a preset method. Summary of the invention

[0006] Technical issues

[0007] According to technical purposes, the image decoding apparatus and method and the image encoding apparatus and method according to the embodiments can achieve image encoding and decoding at a low bit rate by reducing the size of residual data.

[0008] In addition, according to another technical purpose, the image decoding apparatus and method and the image encoding apparatus and method according to the embodiments can achieve simplification of entropy encoding and entropy decoding of data included in a bitstream.

[0009] Solution to the problem

[0010] According to an embodiment, an image decoding method using bidirectional prediction includes: obtaining a first reference block in a first reference image and a second reference block in a second reference image for bidirectional prediction of a current block; obtaining weight information for combining the first reference block with the second reference block from a bitstream; performing entropy decoding on the weight information to obtain a weight index; combining the first reference block with the second reference block according to a candidate value indicated by the weight index among candidate values ​​included in a weight candidate group; and reconstructing the current block based on the combined result, wherein a first binary value corresponding to the weight index is entropy decoded based on a context model, and the remaining binary values ​​corresponding to the weight index are entropy decoded by a bypass method.

[0011] Advantageous Effects of the Present Disclosure

[0012] The image decoding apparatus and method and the image encoding apparatus and method according to the embodiments may encode and decode an image at a low bit rate by reducing the size of residual data.

[0013] In addition, the image decoding apparatus and method and the image encoding apparatus and method according to the embodiments can simplify entropy encoding and decoding of data included in a bitstream.

[0014] It should be noted that the effects that can be achieved by the image decoding device and method and the image encoding device and method according to the present embodiment are not limited to the above-mentioned effects, and based on the following description, other effects not mentioned will be obvious to ordinary technicians in the field. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] A brief description of each figure is provided to provide a better understanding of the drawings referenced herein.

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

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

[0018] Figure 3 A process of determining at least one coding unit by splitting a current coding unit, performed by an image decoding apparatus according to an embodiment, is illustrated.

[0019] Figure 4 A process of determining at least one coding unit by splitting a non-square coding unit, performed by an image decoding apparatus according to an embodiment, is illustrated.

[0020] Figure 5A process of splitting a coding unit based on at least one of block shape information and division shape pattern information, performed by an image decoding apparatus according to an embodiment, is illustrated.

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

[0022] Figure 7 An order in which a plurality of coding units are processed when an image decoding apparatus determines a plurality of coding units by splitting a current coding unit according to an embodiment is illustrated.

[0023] Figure 8 A process of determining that a current coding unit is to be split into an odd number of coding units when coding units cannot be processed in a preset order, performed by an image decoding apparatus according to an embodiment, is illustrated.

[0024] Fig. 9 A process of determining at least one coding unit by splitting a first coding unit, performed by an image decoding apparatus according to an embodiment, is illustrated.

[0025] Fig.10 It is shown that shapes into which the second coding unit may be split are restricted when a second coding unit having a non-square shape determined when an image decoding apparatus splits a first coding unit satisfies a preset condition according to an embodiment.

[0026] Fig.11 A process of splitting a square coding unit when division shape pattern information indicates that the square coding unit is not to be split into four square coding units, performed by an image decoding apparatus according to an embodiment, is illustrated.

[0027] Fig.12 It is shown that a processing order among a plurality of coding units may be changed according to a process of dividing the coding units according to an embodiment.

[0028] Fig.13 A process of determining a depth of a coding unit as a shape and a size of a coding unit change when a coding unit is recursively split such that a plurality of coding units are determined according to an embodiment is illustrated.

[0029] Fig.14 Depth that may be determined based on a shape and a size of a coding unit and a partial index (PID) for distinguishing coding units according to an embodiment are illustrated.

[0030] Fig.15 It is illustrated that a plurality of coding units are determined based on a plurality of preset data units included in a picture according to an embodiment.

[0031] Fig.16A processing block serving as a criterion for determining an order of determining reference coding units included in a picture according to an embodiment is illustrated.

[0032] Fig.17 Coding units of each picture when each picture has a different combination of division shapes of coding units according to an embodiment are illustrated.

[0033] Fig.18 Various shapes of coding units that may be determined based on division shape pattern information that may be represented by a binary code, according to an embodiment are illustrated.

[0034] Fig.19 Other shapes of coding units that may be determined based on division shape pattern information that may be represented by a binary code according to an embodiment are illustrated.

[0035] Fig. 20 is a block diagram of an image encoding and decoding system that performs loop filtering.

[0036] Fig.21 is a block diagram showing the configuration of an image decoding device according to an embodiment.

[0037] Fig. 22 Shown in Fig.21 The configuration of the entropy decoder shown in .

[0038] Fig.23 It is a reference table used to determine the context information of the binary string corresponding to the weight index.

[0039] Fig.24 is a table showing candidate values ​​included in a weight candidate group and weight indices and binary strings corresponding to the candidate values.

[0040] Fig.25 A diagram for describing bidirectional prediction of a current block.

[0041] Fig.26 Blocks that are temporally and spatially related to the current block are shown.

[0042] Fig. 27 is a diagram for describing that an index assigned to a candidate value included in a weight candidate group may change according to the cumulative number of times the candidate value has been selected.

[0043] Fig.28 is a table showing candidate values ​​included in a weight candidate group and weight indices and binary strings corresponding to the candidate values.

[0044] Fig.29 is a flowchart illustrating an image decoding method according to an embodiment.

[0045] Fig.30is a block diagram showing the configuration of an image encoding device according to an embodiment.

[0046] Fig.31 Shown in Fig.30 The configuration of the entropy encoder is shown in .

[0047] Fig.32 is a flowchart illustrating an image encoding method according to an embodiment. DETAILED DESCRIPTION

[0048] Best Mode for Carrying Out the Invention

[0049] According to an embodiment, an image decoding method using bidirectional prediction includes: obtaining a first reference block in a first reference image and a second reference block in a second reference image for bidirectional prediction of a current block; obtaining weight information for combining the first reference block with the second reference block from a bitstream; obtaining a weight index by entropy decoding the weight information; combining the first reference block with the second reference block according to a candidate value indicated by the weight index among candidate values ​​included in a weight candidate group; and reconstructing the current block based on the combined result, wherein a first binary value corresponding to the weight index is entropy decoded based on a context model, and the remaining binary values ​​corresponding to the weight index are entropy decoded by a bypass method.

[0050] The image decoding method may further include adaptively determining the number of candidate values ​​included in the weight candidate group based on at least one of a picture order count (POC) of the first reference image and a POC of the second reference image.

[0051] The step of adaptively determining the number of candidate values ​​included in the weight candidate group may include determining the number of candidate values ​​included in the weight candidate group based on at least one of a comparison result between a POC of a first reference image and a POC of a current image including the current block and a comparison result between a POC of a second reference image and the POC of the current image.

[0052] The number of candidate values ​​included in the weight candidate group when the POC of the first reference image and the POC of the second reference image are less than or equal to the POC of the current image may be different from the number of candidate values ​​included in the weight candidate group when at least one of the POC of the first reference image and the POC of the second reference image is greater than the POC of the current image.

[0053] The number of binary values ​​corresponding to the weight index may vary according to the value of the weight index.

[0054] The image decoding method may further include: assigning indexes to candidate values ​​to be used for bidirectional prediction of the current block, wherein the step of combining the first reference block with the second reference block includes: combining the first reference block with the second reference block according to candidate values ​​assigned with indexes corresponding to the weight indexes.

[0055] The step of assigning the index includes assigning an index to a candidate value to be used for bidirectional prediction of the current block according to a cumulative number of times that the candidate values ​​included in the weight candidate group have been respectively selected for bidirectional prediction of a previous block.

[0056] Candidate values ​​to be used for bidirectional prediction of the current block may be assigned indices for each picture, each frame, or each tile.

[0057] The step of assigning an index may include: selecting a previous image having the same temporal layer as the temporal layer of the current image including the current block in the current group of pictures (GOP); and assigning an index to the candidate values ​​to be used for bidirectional prediction of the current block based on the cumulative number of times the candidate values ​​included in the weight candidate group have been respectively selected for bidirectional prediction of the previous block included in the selected previous image.

[0058] The step of assigning indexes may include assigning indexes to candidate values ​​to be used for bidirectional prediction of the current block according to the cumulative number of times candidate values ​​included in the weight candidate group have been selected for previous blocks that were bidirectionally predicted using the first reference image and the second reference image, respectively.

[0059] The step of combining the first reference block with the second reference block may include: determining a pairing value of the candidate value indicated by the weight index; and applying one of the candidate value indicated by the weight index and the pairing value to the first reference block and applying the remaining one to the second reference block, thereby combining the first reference block with the second reference block.

[0060] The pairing value may not be included in the weight candidate group, and the step of combining the first reference block with the second reference block may include: based on the POC of the first reference image and the POC of the second reference image, selecting a value to be applied to the first reference block and the second reference block from among the candidate value indicated by the weight index and the pairing value.

[0061] According to an embodiment, an image decoding device using bidirectional prediction includes: an obtainer, configured to obtain a bit stream including weight information for bidirectional prediction of a current block; an entropy decoder, configured to obtain a weight index by entropy decoding the weight information; and a prediction decoder, configured to obtain a first reference block in a first reference image and a second reference block in a second reference image for bidirectional prediction of the current block, combine the first reference block with the second reference block according to a candidate value indicated by the weight index among candidate values ​​included in a weight candidate group, and reconstruct the current block based on a result of the combination, wherein a first binary value corresponding to the weight index is entropy decoded based on a context model, and the remaining binary values ​​corresponding to the weight index are entropy decoded by a bypass method.

[0062] According to an embodiment, an image encoding method using bidirectional prediction includes: obtaining a first reference block in a first reference image and a second reference block in a second reference image for bidirectional prediction of the current block; selecting a candidate value for combining the first reference block with the second reference block from among candidate values ​​included in a weight candidate group; performing entropy encoding on a weight index indicating the selected candidate value; and generating a bit stream including weight information obtained as a result of entropy encoding and residual data, wherein a first binary value corresponding to the weight index is entropy encoded based on a context model, and the remaining binary values ​​corresponding to the weight index are entropy encoded by a bypass method.

[0063] Embodiments of the present disclosure

[0064] Since the present disclosure allows various changes and numerous embodiments, specific embodiments will be described in detail in the accompanying drawings and in the text description. However, this is not intended to limit the embodiments to specific implementations, and it should be understood that the present disclosure includes all changes, equivalents, and substitutes that do not depart from the spirit and technical scope of the embodiments.

[0065] In the description of the embodiments, when it is considered that some detailed explanations of the related art may unnecessarily obscure the essence of the present disclosure, some detailed explanations of the related art are omitted. In addition, the numbers (e.g., first, second, etc.) used in the description of the specification are only identification codes for distinguishing one component from another component.

[0066] Furthermore, in the present specification, it should be understood that when components are “connected” or “coupled” to each other, unless otherwise specified, the components may be directly connected or coupled to each other, but may alternatively be connected or coupled to each other with an intermediate component therebetween.

[0067] In this specification, with respect to a component represented as a "part (unit)" or a "module", two or more components may be combined into one component, or one component may be divided into two or more components according to subdivided functions. In addition, each component described below may additionally perform some or all functions performed by another component in addition to performing its own main function, and some main functions of each component may be completely performed by another component.

[0068] In addition, in this specification, "image" or "screen" may refer to a still image. In addition, "image" or "screen" may refer to a frame constituting a video or the video itself.

[0069] In addition, in this specification, "sample" or "signal" refers to data to be processed as data of a sampling position assigned to an image. For example, a pixel value on a spatial domain image and a transform coefficient on a transform domain may be a sample. A unit including at least one such sample may be defined as a block.

[0070] In the following, reference will be made to Figures 1 to 20 Disclosed are an image encoding method and apparatus and an image decoding method and apparatus based on tree-structured coding units and transformation units according to an embodiment.

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

[0072] The image decoding apparatus 100 may include a bitstream obtainer 110 and a decoder 120. The bitstream obtainer 110 and the decoder 120 may include at least one processor. In addition, the bitstream obtainer 110 and the decoder 120 may include a memory storing instructions executed by the at least one processor.

[0073] The bitstream obtainer 110 may receive a bitstream. The bitstream may include information obtained from an image encoded by an image encoding device 200 to be described later. In addition, the bitstream may be sent from the image encoding device 200. The image decoding device 100 may be connected to the image encoding device 200 in a wired or wireless manner, and the bitstream obtainer 110 may receive the bitstream in a wired or wireless manner. The bitstream obtainer 110 may receive a bitstream from a storage medium (such as an optical medium, a hard disk, etc.). The decoder 120 may reconstruct an image based on information obtained from the received bitstream. The decoder 120 may obtain syntax elements for reconstructing an image from the bitstream. The decoder 120 may reconstruct an image based on the syntax elements.

[0074] The operation of the image decoding apparatus 100 will be described in detail below. The bitstream obtainer 110 may receive a bitstream.

[0075] The image decoding device 100 may perform an operation of obtaining a binary bit string corresponding to a division shape pattern of a coding unit from a bitstream. Then, the image decoding device 100 may perform an operation of determining a division rule of the coding unit. In addition, the image decoding device 100 may perform an operation of dividing a coding unit into a plurality of coding units based on at least one of a binary bit string corresponding to the division shape pattern and a division rule. The image decoding device 100 may determine a first range as an allowable 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 division rule. The image decoding device 100 may determine a second range as an allowable size range of the coding unit according to the division shape pattern of the coding unit in order to determine the division rule.

[0076] Hereinafter, the division of coding units will be described in detail according to an embodiment of the present disclosure.

[0077] First, a picture may be divided into one or more slices or one or more tiles. A slice or a tile may be a sequence of one or more maximum coding units (coding tree units (CTUs)). Compared to the maximum coding unit (CTU), there is a maximum coding block (coding tree block (CTB)) in concept.

[0078] A maximum coding block (CTB) represents an N×N block including N×N samples (where N is an integer). Each color component may be divided into one or more maximum coding blocks.

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

[0080] One maximum coding block (CTB) may be divided into M×N coding blocks including M×N samples (M and N are integers).

[0081] When a picture has sample arrays for Y, Cr, and Cb components, a coding unit (CU) includes a coding block of luma samples, two corresponding coding blocks of chroma samples, and a syntax structure for encoding the luma samples and the chroma samples. When the picture is a monochrome picture, the coding unit includes a coding block of monochrome samples and a syntax structure for encoding monochrome samples. When the picture is a picture encoded in a color plane separated according to color components, the coding unit includes a syntax structure for encoding the picture and the samples of the picture.

[0082] 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. That is, the (maximum) coding unit represents a data structure including a (maximum) coding block including corresponding samples and a syntax structure corresponding to the (maximum) coding block. However, because a person skilled in the art understands that a (maximum) coding unit or a (maximum) coding block represents a block of a preset size including a preset number of samples, unless otherwise described, the maximum coding block and the maximum coding unit or the coding block and the coding unit are mentioned in the following specification without distinction.

[0083] The image may be divided into maximum coding units (CTUs). The size of each maximum coding unit may be determined based on information obtained from the bitstream. The shape of each maximum coding unit may be a square shape of the same size. However, the embodiment is not limited thereto.

[0084] For example, information about the maximum size of the luma coding block may be obtained from the bitstream. For example, the maximum size of the luma coding block indicated by the information about the maximum size of the luma coding block may be one of 4×4, 8×8, 16×16, 32×32, 64×64, 128×128, and 256×256.

[0085] For example, information about the luminance block size difference and the maximum size of the luminance coding block that can be divided into two may be obtained from the bitstream. The information about the luminance block size difference may represent the size difference between the luminance maximum coding unit and the maximum luminance coding block that can be divided into two. Therefore, when the information about the maximum size of the luminance coding block that can be divided into two obtained from the bitstream and the information about the luminance block size difference are combined with each other, the size of the luminance maximum coding unit may be determined. The size of the chrominance maximum coding unit may be determined by using the size of the luminance maximum coding unit. For example, when the Y:Cb:Cr ratio is 4:2:0 according to the color format, the size of the chrominance block may be half the size of the luminance block, and the size of the chrominance maximum coding unit may be half the size of the luminance maximum coding unit.

[0086] According to an embodiment, since information about the maximum size of a brightness coding block that can be divided into two is obtained from a bitstream, the maximum size of the brightness coding block that can be divided into two can be determined variably. Conversely, the maximum size of a brightness coding block that can be divided into three can be fixed. For example, the maximum size of a brightness coding block that can be divided into three in an I slice can be 32×32, and the maximum size of a brightness coding block that can be divided into three in a P slice or a B slice can be 64×64.

[0087] In addition, the maximum coding unit may be hierarchically divided into coding units based on the division shape pattern information obtained from the bitstream. At least one of information indicating whether to perform four divisions, information indicating whether to perform multi-division, division direction information, and division type information may be obtained from the bitstream as the division shape pattern information.

[0088] For example, the information indicating whether to perform four-split may indicate whether the current coding unit is divided into four (QUAD_SPLIT).

[0089] When the current coding unit is not divided into four, the information indicating whether to perform multi-split may indicate whether the current coding unit is no longer split (NO_SPLIT) or is divided into two / three.

[0090] When the current coding unit is split into two or three, the split direction information indicates that the current coding unit is split in one direction of a horizontal direction and a vertical direction.

[0091] When the current coding unit is split in a horizontal direction or a vertical direction, the split type information indicates whether the current coding unit is split into two or three.

[0092] The split mode of the current coding unit may be determined according to the split direction information and the split type information. The split mode when the current coding unit is split into two in the horizontal direction may be determined as a two-horizontal split mode (SPLIT_BT_HOR), the split mode when the current coding unit is split into three in the horizontal direction may be determined as a three-horizontal split mode (SPLIT_TT_HOR), the split mode when the current coding unit is split into two in the vertical direction may be determined as a two-vertical split mode (SPLIT_BT_VER), and the split mode when the current coding unit is split into three in the vertical direction may be determined as a three-vertical split mode (SPLIT_TT_VER).

[0093] The image decoding device 100 may obtain the division shape pattern information from a binary bit string from the bit stream. The form of the bit stream received by the image decoding device 100 may include a fixed-length binary code, a unary code, a truncated unary code, a predetermined binary code, etc. The binary bit string is information of a binary number. The binary bit string may include at least one bit. The image decoding device 100 may obtain the division shape pattern information corresponding to the binary bit string based on the division rule. The image decoding device 100 may determine whether to divide the coding unit into four, whether to not divide the coding unit, the division direction, and the division type based on a binary bit string.

[0094] The coding unit may be smaller than the maximum coding unit or the same as the maximum coding unit. For example, since the maximum coding unit is a coding unit having the maximum size, the maximum coding unit is one of the coding units. When the division shape pattern information about the maximum coding unit indicates that division is not performed, the coding unit determined in the maximum coding unit has the same size as the size of the maximum coding unit. When the division shape pattern information about the maximum coding unit indicates that division is performed, the maximum coding unit may be divided into coding units. In addition, when the division shape pattern information about the coding unit indicates that division is performed, the coding unit may be divided into smaller coding units. However, the division of the image is not limited thereto, and the maximum coding unit may not be distinguished from the coding unit. Reference will be made to Figures 3 to 16 The division of coding units is described in detail.

[0095] In addition, one or more prediction blocks for prediction may be determined from a coding unit. A prediction block may be the same as or smaller than a coding unit. In addition, one or more transform blocks for transformation may be determined from a coding unit. A transform block may be the same as or smaller than a coding unit.

[0096] The shapes and sizes of the transform block and the prediction block may be unrelated to each other.

[0097] In another embodiment, prediction may be performed by using a coding unit as a prediction unit. In addition, transformation may be performed by using a coding unit as a transformation block.

[0098] Will refer to Figures 3 to 16 The division of the coding unit is described in detail. The current block and the neighboring block of the present disclosure may indicate one of the maximum coding unit, the coding unit, the prediction block, and the transform block. In addition, the current block of the current coding unit is a block currently being decoded or encoded or a block currently being divided. The neighboring block may be a block reconstructed before the current block. The neighboring block may be adjacent to the current block in space or time. The neighboring block may be located at one of the lower left, left side, upper left, above, upper right, right side, and lower right side of the current block.

[0099] Figure 3A process of determining at least one coding unit by splitting a current coding unit, performed by an image decoding apparatus according to an embodiment, is illustrated.

[0100] The block shape may 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 may be a positive integer. The block shape information is information indicating at least one of a shape, a direction, a ratio of width to height, or a size of a coding unit.

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

[0102] When the width and height of the coding unit are different from each other (that is, 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 may determine the block shape information of the coding unit as a non-square shape. When the shape of the coding unit is non-square, the image decoding apparatus 100 may determine the ratio of the width to the height 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 may determine whether the coding unit is in the horizontal direction or in the vertical direction based on the width length and height length of the coding unit. In addition, the image decoding apparatus 100 may determine the size of the coding unit based on at least one of the width length, height length, or area of ​​the coding unit.

[0103] According to an embodiment, the image decoding apparatus 100 may determine the shape of the coding unit by using the block shape information, and may determine the division method of the coding unit by using the division shape pattern information. That is, the coding unit division method indicated by the division shape pattern information may be determined based on the block shape indicated by the block shape information used by the image decoding apparatus 100.

[0104] The image decoding device 100 may obtain the division shape pattern information from the bitstream. However, the embodiment is not limited thereto, and the image decoding device 100 and the image encoding device 200 may determine the pre-agreed division shape pattern information based on the block shape information. The image decoding device 100 may determine the pre-agreed division shape pattern information for the maximum coding unit or the minimum coding unit. For example, the image decoding device 100 may determine the division shape pattern information for the maximum coding unit as four divisions. In addition, the image decoding device 100 may determine the division shape pattern information about the minimum coding unit as "no division is performed". Specifically, the image decoding device 100 may determine the size of the maximum coding unit to be 256×256. The image decoding device 100 may determine the pre-agreed division shape pattern information to be four divisions. Four divisions are division shape patterns that divide the width and height of the coding unit equally into two. The image decoding device 100 may obtain a coding unit of 128×128 size from a maximum coding unit of 256×256 size based on the division shape pattern information. In addition, the image decoding device 100 may determine the size of the minimum coding unit to be 4×4. The image decoding apparatus 100 may obtain division shape pattern information indicating “do not perform division” for a minimum coding unit.

[0105] According to an embodiment, the image decoding apparatus 100 may use block shape information indicating that the current coding unit has a square shape. For example, the image decoding apparatus 100 may determine whether to split the square coding unit, whether to split the square coding unit vertically, whether to split the square coding unit horizontally, or whether to split the square coding unit into four coding units based on the split shape mode information. Figure 3 , when the block shape information of the current coding unit 300 indicates a square shape, the decoder 120 may not divide the coding unit 310a having the same size as the current coding unit 300 based on the division shape pattern information indicating that division is not performed, or may determine the coding units 310b, 310c, 310d, 310e or 310f divided based on the division shape pattern information indicating a preset division method.

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

[0107] Figure 4 A process of determining at least one coding unit by splitting a non-square coding unit, performed by the image decoding apparatus 100 according to an embodiment, is illustrated.

[0108] According to an embodiment, the image decoding apparatus 100 may use block shape information indicating that the current coding unit has a non-square shape. Based on the division shape mode information, the image decoding apparatus 100 may determine whether to divide the non-square current coding unit or to divide the non-square current coding unit by using a preset division method. 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 may determine a coding unit 410 or a coding unit 460 having the same size as the current coding unit 400 or 450 based on the division shape pattern information indicating that division is not performed, or may determine coding units 420a and 420b, 430a to 430c, 470a and 470b, or 480a to 480c divided based on the division shape pattern information indicating a preset division method. The preset division method for dividing the non-square coding unit will be described in detail with respect to various embodiments below.

[0109] According to an embodiment, the image decoding apparatus 100 may determine a splitting method of a coding unit by using splitting shape pattern information, and in this case, the splitting shape pattern information may indicate the number of one or more coding units generated by splitting the coding unit. Figure 4 When the division shape pattern information indicates that the current coding unit 400 or 450 is divided into two coding units, the image decoding device 100 can determine the two coding units 420a and 420b or 470a and 470b included in the current coding unit 400 or 450 by dividing the current coding unit 400 or 450 based on the division shape pattern information.

[0110] According to an embodiment, when the image decoding apparatus 100 splits the non-square current coding unit 400 or 450 based on the split shape pattern information, the image decoding apparatus 100 may split the current coding unit considering the position of the long side of the non-square current coding unit 400 or 450. For example, the image decoding apparatus 100 may determine a plurality of coding units by splitting the current coding unit 400 or 450 along a direction in which the long side of the current coding unit 400 or 450 is split considering the shape of the current coding unit 400 or 450.

[0111] According to an embodiment, when the division shape pattern information indicates that the coding unit is divided (three-divided) into an odd number of blocks, the image decoding apparatus 100 may determine an odd number of coding units included in the current coding unit 400 or 450. For example, when the division shape pattern information indicates that the current coding unit 400 or 450 is divided into three coding units, the image decoding apparatus 100 may divide the current coding unit 400 or 450 into three coding units 430a, 430b, and 430c or 480a, 480b, and 480c.

[0112] According to an embodiment, the ratio of the width to the height of the current coding unit 400 or 450 may be 4:1 or 1:4. When the ratio of the width to the height is 4:1, because the width length is longer than the height length, the block shape information may indicate the horizontal direction. When the ratio of the width to the height is 1:4, because the width length is shorter than the height length, the block shape information may indicate the vertical direction. The image decoding apparatus 100 may 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 may determine the 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 in the vertical direction, the image decoding apparatus 100 may determine the coding units 430a, 430b, and 430c by dividing the current coding unit 400 in the horizontal direction. Also, when the current coding unit 450 is in a horizontal direction, the image decoding apparatus 100 may determine the coding units 480a, 480b, and 480c by splitting the current coding unit 450 in a vertical direction.

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

[0114] According to an embodiment, when the division shape pattern information indicates that the coding unit is divided into an odd number of blocks, the image decoding apparatus 100 may determine an odd number of coding units included in the current coding unit 400 or 450, and further, may apply a preset restriction to at least one of the odd number of coding units generated by dividing the current coding unit 400 or 450. Figure 4, the image decoding apparatus 100 may set a decoding process for a coding unit 430b or a coding unit 480b that is located at a center position among three coding units 430a, 430b, and 430c or 480a, 480b, and 480c generated when the current coding unit 400 or 450 is divided to be different from a decoding process of 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 may limit the coding unit 430b or the coding unit 480b at the center position to be no longer divided or to be divided only a preset number of times.

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

[0116] According to an embodiment, the image decoding apparatus 100 may determine whether to divide the square first coding unit 500 into coding units or not to divide the square first coding unit 500 based on at least one of the block shape information and the division shape mode information. According to an embodiment, when the division shape mode information indicates that the first coding unit 500 is divided in the horizontal direction, the image decoding apparatus 100 may determine the second coding unit 510 by dividing the first coding unit 500 in the horizontal direction. The first coding unit, the second coding unit, and the third coding unit used according to the embodiment are terms for understanding the relationship between the coding unit before and after the coding unit is divided. For example, the second coding unit may be determined by dividing the first coding unit, and the third coding unit may be determined by dividing the second coding unit. It will be understood that the relationship between the first coding unit, the second coding unit, and the third coding unit follows the above description.

[0117] According to an embodiment, the image decoding apparatus 100 may determine whether to split the determined second coding unit 510 into coding units or not to split the determined second coding unit 510 based on the division shape pattern information. Figure 5, the image decoding apparatus 100 may split the non-square second coding unit 510 determined by splitting the first coding unit 500 into one or more third coding units 520a, 520b, 520c, and 520d based on the split shape pattern information, or may not split the non-square second coding unit 510. The image decoding apparatus 100 may obtain the split shape pattern information, and may obtain a plurality of second coding units (e.g., 510) of various shapes by splitting the first coding unit 500 based on the obtained split shape pattern information, and may split the second coding unit 510 by using the split method of the first coding unit 500 based on the split shape pattern information. According to an embodiment, when the first coding unit 500 is split into the second coding unit 510 based on the split shape pattern information of the first coding unit 500, the second coding unit 510 may also be split into the third coding units (520a or 520b, 520c, and 520d) based on the split shape pattern information of the second coding unit 510. That is, the coding unit may be recursively split based on the split shape pattern information of each coding unit. Thus, a square coding unit may be determined by splitting a non-square coding unit, and a non-square coding unit may be determined by recursively splitting a square coding unit.

[0118] Reference Figure 5 , the preset coding units (e.g., coding units located at the center position, or square coding units) in the odd number of third coding units 520b, 520c, and 520d determined by dividing the non-square second coding unit 510 may be recursively divided. According to an embodiment, the square third coding unit 520c in the odd number of third coding units 520b, 520c, and 520d may be divided into a plurality of fourth coding units in the horizontal direction. The non-square fourth coding unit 530b or 530d in the plurality of fourth coding units 530a, 530b, 530c, and 530d may be further divided into a plurality of coding units. For example, the non-square fourth coding unit 530b or 530d may be further divided into an odd number of coding units. A method that may be used to recursively divide a coding unit will be described below with respect to various embodiments.

[0119] According to an embodiment, the image decoding apparatus 100 may divide each of the third coding unit 520a or 520b, 520c, and 520d into coding units based on the division shape pattern information. In addition, the image decoding apparatus 100 may determine not to divide the second coding unit 510 based on the division shape pattern information. According to an embodiment, the image decoding apparatus 100 may divide the non-square second coding unit 510 into an odd number of third coding units 520b, 520c, and 520d. The image decoding apparatus 100 may impose a preset restriction on a preset third coding unit among the odd number of third coding units 520b, 520c, and 520d. For example, the image decoding apparatus 100 may limit the third coding unit 520c at the center position among the odd number of third coding units 520b, 520c, and 520d to no longer be divided or to be divided a settable number of times.

[0120] Reference Figure 5 , the image decoding apparatus 100 may limit the third coding unit 520c at the center position among the odd third coding units 520b, 520c, and 520d included in the non-square second coding unit 510 to no longer be divided, to be divided by using a preset division method (e.g., only divided into four coding units or divided by using the division method of the second coding unit 510), or to be divided only a preset number of times (e.g., only divided n times (where n>0)). However, the limitation on the third coding unit 520c at the center position is not limited to the above example, and may include various limitations for decoding the third coding unit 520c at the center position differently from the other third coding units 520b and 520d.

[0121] According to an embodiment, the image decoding apparatus 100 may obtain split shape pattern information for splitting the current coding unit from a preset position in the current coding unit.

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

[0123] Reference Figure 6 , the division shape mode information of the current coding unit 600 or 650 may be obtained from a sample at a preset position (e.g., 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 may be obtained is not limited to Figure 6, and may include various positions (e.g., top, bottom, left, right, top left, bottom left, top right, bottom right, etc.) included in the current coding unit 600. The image decoding apparatus 100 may obtain the division shape pattern information from a preset position and may determine whether to divide the current coding unit into coding units of various shapes and sizes or not to divide the current coding unit.

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

[0125] According to an embodiment, the image decoding apparatus 100 may split a current coding unit into a plurality of coding units, and may determine a coding unit at a preset position.

[0126] According to an embodiment, the image decoding apparatus 100 may determine a coding unit at a center position among the odd-numbered coding units using information indicating the positions of the odd-numbered coding units. Figure 6 , the image decoding apparatus 100 may determine the odd number of coding units 620a, 620b, and 620c or the 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 apparatus 100 may determine the middle coding unit 620b or the middle 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 apparatus 100 may determine the coding unit 620b of the center position by determining the positions of the coding units 620a, 620b, and 620c based on information indicating the positions of preset samples included in the coding units 620a, 620b, and 620c. In detail, the image decoding apparatus 100 may determine the coding unit 620b at the center position by determining the positions of the coding units 620a, 620b, and 620c based on information indicating the positions of the upper left samples 630a, 630b, and 630c of the coding units 620a, 620b, and 620c.

[0127] According to an embodiment, the information indicating the positions of the upper left sample points 630a, 630b, and 630c respectively included in the coding units 620a, 620b, and 620c may include information about the positions or coordinates of the coding units 620a, 620b, and 620c in the picture. According to an embodiment, the information indicating the positions of the upper left sample points 630a, 630b, and 630c respectively included in the coding units 620a, 620b, and 620c may include information indicating the width or height of the coding units 620a, 620b, and 620c included in the current coding unit 600, and the width or height may correspond to the information indicating the difference between the coordinates of the coding units 620a, 620b, and 620c in the picture. That is, the image decoding apparatus 100 may determine the coding unit 620b at the center position by directly using the information about the positions or coordinates of the coding units 620a, 620b, and 620c in the picture or by using the information about the width or height of the coding unit corresponding to the difference between the coordinates.

[0128] According to an embodiment, information indicating the position of the upper left sample point 630a of the upper coding unit 620a may include coordinates (xa, ya), information indicating the position of the upper left sample point 630b of the middle coding unit 620b may include coordinates (xb, yb), and information indicating the position of the upper left sample point 630c of the lower coding unit 620c may include coordinates (xc, yc). The image decoding apparatus 100 may determine the center coding unit 620b by using the coordinates of the upper left sample points 630a, 630b, and 630c respectively included in the coding units 620a, 620b, and 620c. For example, when the coordinates of the upper left sample points 630a, 630b, and 630c are sorted in ascending or descending order, the coding unit 620b including the coordinates (xb, yb) of the sample point 630b at the center position may 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 upper left sample points 630a, 630b, and 630c may include coordinates indicating absolute positions in the picture, or coordinates (dxb, dyb) indicating the relative position of the upper left sample point 630b of the middle coding unit 620b relative to the position of the upper left sample point 630a of the upper coding unit 620a and coordinates (dxc, dyc) indicating the relative position of the upper left sample point 630c of the lower coding unit 620c relative to the position of the upper left sample point 630a of the upper coding unit 620a may be used. The method of determining the coding unit at a preset position by using the coordinates of the sample points included in the coding unit as information indicating the positions of the sample points is not limited to the above method, and may include various arithmetic methods capable of using the coordinates of the sample points.

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

[0130] According to an embodiment, the image decoding apparatus 100 may determine the width or height of each of the coding units 620a, 620b, and 620c by using the coordinates (xa, ya) as information indicating the position of the upper left sample point 630a of the upper coding unit 620a, the coordinates (xb, yb) as information indicating the position of the upper left sample point 630b of the middle coding unit 620b, and the coordinates (xc, yc) as information indicating the position of the upper left sample point 630c of the lower coding unit 620c. The image decoding apparatus 100 may determine the respective sizes 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 may determine the width of the upper coding unit 620a as the width of the current coding unit 600. The image decoding apparatus 100 may determine the height of the upper coding unit 620a as yb-ya. According to an embodiment, the image decoding apparatus 100 may determine the width of the intermediate coding unit 620b as the width of the current coding unit 600. The image decoding apparatus 100 may determine the height of the intermediate coding unit 620b as yc-yb. According to an embodiment, the image decoding apparatus 100 may 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 intermediate coding unit 620b. The image decoding apparatus 100 may determine a coding unit having a size different from that of other coding units based on the determined width and height of the coding units 620a, 620b, and 620c. Referring to Figure 6 , the image decoding apparatus 100 may determine the middle coding unit 620b having a size different from the sizes 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 the coding unit having a size different from the sizes of other coding units performed by the image decoding apparatus 100 corresponds only to an example of determining the coding unit at the preset position by using the size of the coding unit determined based on the coordinates of the sample points, and therefore, various methods of determining the coding unit at the preset position by comparing the size of the coding unit determined based on the coordinates of the preset sample points may be used.

[0131] The image decoding apparatus 100 may determine the width or height of each of the coding units 660a, 660b, and 660c by using the coordinates (xd, yd) as information indicating the position of the upper left sample point 670a of the left coding unit 660a, the coordinates (xe, ye) as information indicating the position of the upper left sample point 670b of the middle coding unit 660b, and the coordinates (xf, yf) as information indicating the position of the upper left sample point 670c of the right coding unit 660c. The image decoding apparatus 100 may determine the respective sizes 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.

[0132] According to an embodiment, the image decoding apparatus 100 may determine the width of the left coding unit 660a as xe-xd. The image decoding apparatus 100 may 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 may determine the width of the middle coding unit 660b as xf-xe. The image decoding apparatus 100 may 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 may 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 may determine a coding unit having a size different from sizes of 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 may determine the middle coding unit 660b having a size different from the sizes of the left coding unit 660a and the right coding unit 660c as the coding unit at the preset position. However, the above-mentioned method of determining the coding unit having a size different from the sizes of other coding units performed by the image decoding apparatus 100 corresponds only to an example of determining the coding unit at the preset position by using the size of the coding unit determined based on the coordinates of the sample points, and therefore, various methods of determining the coding unit at the preset position by comparing the size of the coding unit determined based on the coordinates of the preset sample points may be used.

[0133] However, the position of the sample considered for determining the position of the coding unit is not limited to the above-mentioned upper left position, and information on arbitrary positions of the samples included in the coding unit may be used.

[0134] According to an embodiment, the image decoding apparatus 100 may select a coding unit at a preset position from an odd number of coding units determined by dividing the current coding unit, taking into account the shape of the current coding unit. For example, when the current coding unit has a non-square shape in which the width is longer than the height, the image decoding apparatus 100 may determine a coding unit at a preset position in the horizontal direction. That is, the image decoding apparatus 100 may determine one of the coding units at different positions in the horizontal direction and may impose restrictions on the coding unit. When the current coding unit has a non-square shape in which the height is longer than the width, the image decoding apparatus 100 may determine a coding unit at a preset position in the vertical direction. That is, the image decoding apparatus 100 may determine one of the coding units at different positions in the vertical direction and impose restrictions on the coding unit.

[0135] According to an embodiment, the image decoding apparatus 100 may use information indicating respective positions of even-numbered coding units to determine a coding unit at a preset position among the even-numbered coding units. The image decoding apparatus 100 may determine the even-numbered coding units by dividing (dividing into two) the current coding unit, and may determine the coding unit at the preset position by using information about the positions of the even-numbered coding units. The operations related thereto may be the same as those already described above with respect to Figure 6 The operation of determining a coding unit at a preset position (eg, a center position) among odd-numbered coding units is described in detail, and thus a detailed description thereof is not provided here.

[0136] According to an embodiment, when a non-square current coding unit is divided into a plurality of coding units, a coding unit at a preset position among the plurality of coding units may be determined using preset information about the coding unit at a preset position in a division operation. For example, the image decoding apparatus 100 may determine a coding unit at a center position among the plurality of coding units determined by dividing the current coding unit using at least one of block shape information and division shape pattern information stored in samples included in an intermediate coding unit in a division operation.

[0137] Reference Figure 6, the image decoding apparatus 100 may divide the current coding unit 600 into a plurality of coding units 620a, 620b, and 620c based on the division shape pattern information, and may determine the coding unit 620b at the center position among the plurality of coding units 620a, 620b, and 620c. In addition, the image decoding apparatus 100 may determine the coding unit 620b at the center position in consideration of the position at which the division shape pattern information is obtained. That is, the division shape pattern information of the current coding unit 600 may be obtained from the sample point 640 at the center position of the current coding unit 600, and when the current coding unit 600 is divided into a plurality of coding units 620a, 620b, and 620c based on the division shape pattern information, the coding unit 620b including the sample point 640 may 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 pattern information, and various types of information may be used to determine the coding unit at the center position.

[0138] According to an embodiment, preset information for identifying a coding unit at a preset position may be obtained from preset samples included in a coding unit to be determined. Figure 6 , the image decoding apparatus 100 may use the division shape pattern information obtained from the sample at the preset position in the current coding unit 600 (for example, the sample at the center position of the current coding unit 600) to determine the coding unit at the preset position (for example, the coding unit at the center position of the divided multiple coding units) among the multiple coding units 620a, 620b, and 620c determined by dividing the current coding unit 600. That is, the image decoding apparatus 100 may determine the sample at the preset position by considering the block shape of the current coding unit 600, may determine the coding unit 620b including the sample for which the preset information (for example, the division shape pattern information) may be obtained from the multiple coding units 620a, 620b, and 620c determined by dividing the current coding unit 600, and may impose a preset restriction on the coding unit 620b. Referring to Figure 6 According to an embodiment, in a decoding operation, the image decoding apparatus 100 may determine a sample 640 at a center position of a current coding unit 600 as a sample from which preset information may be obtained, and may impose a preset restriction on a coding unit 620b including the sample 640. However, the position of the sample from which preset information may be obtained is not limited to the above-mentioned position, and may include any position of the sample included in the coding unit 620b to be determined for restriction.

[0139] According to an embodiment, the position of the sample at which the preset information can be obtained may be determined based on the shape of the current coding unit 600. According to an embodiment, the block shape information may indicate whether the current coding unit has a square shape or a non-square shape, and the position of the sample at which the preset information can be obtained may be determined based on the shape. For example, the image decoding apparatus 100 may determine a sample located on a boundary for dividing at least one of the width and the height of the current coding unit in half as a sample at which the preset information can be obtained by using at least one of the information about the width of the current coding unit and the 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 may determine one of the samples adjacent to the boundary for dividing the long side of the current coding unit in half as a sample at which the preset information can be obtained.

[0140] According to an embodiment, when the current coding unit is divided into a plurality of coding units, the image decoding device 100 may use the division shape pattern information to determine the coding unit at a preset position in the plurality of coding units. According to an embodiment, the image decoding device 100 may obtain the division shape pattern information from the sample at the preset position in the coding unit, and may divide the plurality of coding units generated by dividing the current coding unit by using the division shape pattern information obtained from the sample at the preset position in each of the plurality of coding units. That is, the coding unit may be recursively divided based on the division shape pattern information obtained from the sample at the preset position in each coding unit. As has been described above, Figure 5 An operation of recursively splitting the coding unit is described, and thus a detailed description thereof will not be provided here.

[0141] According to an embodiment, the image decoding apparatus 100 may determine one or more coding units by splitting a current coding unit, and may determine an order in which to decode the one or more coding units based on a preset block (eg, the current coding unit).

[0142] Figure 7 An order in which a plurality of coding units are processed when the image decoding apparatus 100 determines a plurality of coding units by splitting a current coding unit according to an embodiment is illustrated.

[0143] 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 a vertical direction, determine the second coding units 730a and 730b by dividing the first coding unit 700 in a horizontal direction, or determine the second coding units 750a, 750b, 750c and 750d by dividing the first coding unit 700 in vertical and horizontal directions.

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

[0145] According to an embodiment, the image decoding apparatus 100 may recursively divide the coding unit. Figure 7 , the image decoding apparatus 100 may determine a plurality of coding units 710a and 710b, 730a and 730b, or 750a, 750b, 750c, and 750d by dividing the first coding unit 700, and may recursively divide each of the determined plurality of coding units 710a, 710b, 730a, 730b, 750a, 750b, 750c, and 750d. A division method of the plurality of coding units 710a and 710b, 730a and 730b, or 750a, 750b, 750c, and 750d may correspond to a division method of 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 may be independently divided into a plurality of coding units. Referring to Figure 7 , the image decoding apparatus 100 may determine the second coding units 710a and 710b by dividing the first coding unit 700 in a vertical direction, and may determine to divide each of the second coding units 710a and 710b independently or not to divide each of the second coding units 710a and 710b.

[0146] According to an embodiment, the image decoding apparatus 100 may determine the third coding units 720a and 720b by splitting the left second coding unit 710a in a horizontal direction, and may not split the right second coding unit 710b.

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

[0148] Figure 8 A process of determining that a current coding unit is to be split into an odd number of coding units when coding units may not be processed in a preset order, performed by the image decoding apparatus 100 according to an embodiment is illustrated.

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

[0150] According to an embodiment, the image decoding apparatus 100 may determine whether to split any coding unit into an odd number of coding units by determining whether the third coding units 820a and 820b and 820c, 820d, and 820e may be processed in a preset order. Figure 8, the image decoding apparatus 100 may determine the third coding units 820a and 820b and 820c, 820d, and 820e by recursively dividing the first coding unit 800. The image decoding apparatus 100 may determine whether any 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: 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 coding unit located on the right side of the second coding units 810a and 810b may be divided into an odd number of third coding units 820c, 820d, and 820e. The processing order of the multiple coding units included in the first coding unit 800 can be a preset order (for example, a zigzag scanning order 830), and the image decoding device 100 can determine whether the third coding units 820c, 820d and 820e determined by dividing the right second coding unit 810b into an odd number of coding units meet the conditions for processing in the preset order.

[0151] According to an embodiment, the image decoding apparatus 100 may 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 processing in a preset order, and the condition is related to whether at least one of the width and height of the second coding units 810a and 810b will be divided in half along the boundary 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 second coding unit 810a of a non-square shape is divided in half may satisfy the condition. Because the boundaries of the third coding units 820c, 820d, and 820e determined when the right second coding unit 810b is divided into three coding units cannot divide the width or height of the right second coding unit 810b in half, it may 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 image decoding apparatus 100 may determine that the scanning order is discontinuous, and may determine that the right second coding unit 810b is to be divided into an odd number of coding units based on the determination result. According to an embodiment, when the coding unit is divided into an odd number of coding units, the image decoding apparatus 100 may impose a preset restriction on the coding unit at a preset position in the divided coding unit, and the restriction or the preset position has been described above with respect to various embodiments, so a detailed description thereof will not be provided here.

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

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

[0154] According to an embodiment, the image decoding apparatus 100 may 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 is related to whether at least one of the width and height of the first coding unit 900 will be divided in half along the boundary of the second coding units 910a, 910b, 910c, 920a, 920b, and 920c. Fig. 9, because the boundaries of the second coding units 910a, 910b, and 910c determined by dividing the square first coding unit 900 in the vertical direction do not divide the width of the first coding unit 900 in half, it can be determined that the first coding unit 900 does not meet the condition for processing in a preset order. In addition, because the boundaries of the second coding units 920a, 920b, and 920c determined by dividing the square first coding unit 900 in the horizontal direction do not divide the height of the first coding unit 900 in half, it can be determined that the first coding unit 900 does not meet the condition for processing in a preset order. When the condition is not satisfied as described above, the image decoding apparatus 100 may decide that the scanning order is not continuous, and may determine that the first coding unit 900 is divided into an odd number of coding units based on the decision result. According to an embodiment, when the coding unit is divided into an odd number of coding units, the image decoding apparatus 100 may impose a preset restriction on the coding unit at a preset position in the divided coding unit. The restriction or the preset position has been described above with respect to various embodiments, so a detailed description thereof will not be provided here.

[0155] According to an embodiment, the image decoding apparatus 100 may determine coding units of various shapes by splitting the first coding unit.

[0156] Reference Fig. 9 , the image decoding apparatus 100 may divide the square first coding unit 900 or the non-square first coding unit 930 or 950 into coding units of various shapes.

[0157] Fig.10 It is shown that according to an embodiment, when a second coding unit having a non-square shape determined when the image decoding apparatus 100 splits the first coding unit 1000 satisfies a predetermined condition, shapes into which the second coding unit may be split are restricted.

[0158] According to an embodiment, the image decoding apparatus 100 may determine to divide the square first coding unit 1000 into non-square second coding units 1010a and 1010b, or 1020a and 1020b, based on the division shape pattern information obtained by the bitstream obtainer 110. The second coding units 1010a and 1010b or 1020a and 1020b may be independently divided. Like this, based on the division shape pattern information of each of the second coding units 1010a and 1010b or 1020a and 1020b, the image decoding apparatus 100 may determine to divide each of the second coding units 1010a and 1010b or 1020a and 1020b into a plurality of 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 apparatus 100 may determine the third coding units 1012a and 1012b by splitting the non-square left second coding unit 1010a determined by splitting the first coding unit 1000 in the vertical direction in the horizontal direction. However, when the left second coding unit 1010a is split in the horizontal direction, the image decoding apparatus 100 may restrict the right second coding unit 1010b from being split in the horizontal direction in which the left second coding unit 1010a is split. When the third coding units 1014a and 1014b are determined by splitting the right second coding unit 1010b in the same direction, since the left second coding unit 1010a and the right second coding unit 1010b are independently split in the horizontal direction, the third coding units 1012a and 1012b, or 1014a and 1014b may be determined. However, this case has the same effect as the case where the image decoding apparatus 100 divides the first coding unit 1000 into four square second coding units 1030a, 1030b, 1030c, and 1030d based on the division shape pattern information, and may be inefficient in terms of image decoding.

[0159] According to an embodiment, the image decoding apparatus 100 may determine the third coding units 1022a and 1022b, or 1024a and 1024b, by vertically splitting the non-square second coding unit 1020a or 1020b determined by splitting the first coding unit 1000 in the horizontal direction. However, when the second coding unit (e.g., the upper second coding unit 1020a) is split in the vertical direction, the image decoding apparatus 100 may restrict another second coding unit (e.g., the lower second coding unit 1020b) from being split in the vertical direction in which the upper second coding unit 1020a is split for the above-mentioned reason.

[0160] Fig.11A process of splitting a square coding unit when division shape pattern information indicates that the square coding unit is not to be split into four square coding units, performed by the image decoding apparatus 100 according to an embodiment, is illustrated.

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

[0162] According to an embodiment, the image decoding apparatus 100 may 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. may be recursively divided in a preset order, and this division method may correspond to the method of dividing the first coding unit 1100 based on the division shape pattern information.

[0163] For example, the image decoding apparatus 100 may determine square third coding units 1112a and 1112b by dividing the left second coding unit 1110a in the horizontal direction, and may determine square third coding units 1114a and 1114b by dividing the right second coding unit 1110b in the horizontal direction. In addition, the image decoding apparatus 100 may 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, a coding unit having the same shape as the four square second coding units 1130a, 1130b, 1130c, and 1130d divided from the first coding unit 1100 may be determined.

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

[0165] Fig.12 It is shown that a processing order among a plurality of coding units may be changed according to a process of dividing the coding units according to an embodiment.

[0166] According to an embodiment, the image decoding apparatus 100 may 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 that the first coding unit 1200 is divided in at least one of the horizontal direction and the vertical direction, the image decoding apparatus 100 may determine the second coding units 1210a and 1210b, or 1220a and 1220b by dividing the first coding unit 1200. Fig.12 , 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 pattern information of each coding unit. For example, the image decoding device 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 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. As has been described above, Fig.11 An operation of dividing the second coding units 1210a and 1210b, or 1220a and 1220b is described, and thus a detailed description thereof will not be provided here.

[0167] According to an embodiment, the image decoding apparatus 100 may process the coding units in a preset order. Figure 7 The operation of processing the encoding units in a preset order is described, and thus a detailed description thereof will not be provided here. Fig.12 , the image decoding apparatus 100 may determine 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 may 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 into which the first coding unit 1200 is divided.

[0168] According to an embodiment, the image decoding device 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 the third coding units 1216a, 1216b, 1216c and 1216d can be processed in the following processing order 1217: first, the third coding units 1216a and 1216c included in the left second coding unit 1210a are processed in the vertical direction, and then the third coding units 1216b and 1216d included in the right second coding unit 1210b are processed in the vertical direction.

[0169] According to an embodiment, the image decoding device 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 the third coding units 1226a, 1226b, 1226c and 1226d can be processed in the following processing order 1227: first, the third coding units 1226a and 1226b included in the upper second coding unit 1220a are processed in the horizontal direction, and then the third coding units 1226c and 1226d included in the lower second coding unit 1220b are processed in the horizontal direction.

[0170] Reference Fig.12, square third coding units 1216a, 1216b, 1216c and 1216d and 1226a, 1226b, 1226c and 1226d may be determined by dividing the second coding units 1210a and 1210b and 1220a and 1220b, respectively. Although the second coding units 1210a and 1210b determined by splitting the first coding unit 1200 in the vertical direction are different from the second coding units 1220a and 1220b determined by splitting the first coding unit 1200 in the horizontal direction, the third coding units 1216a, 1216b, 1216c, and 1216d and 1226a, 1226b, 1226c, and 1226d split from the second coding units 1210a and 1210b and the second coding units 1220a and 1220b finally show the same shape of coding units split from the first coding unit 1200. Like this, by recursively splitting the coding units in different ways based on the split shape pattern information, even if the coding units are finally determined to be the same shape, the image decoding apparatus 100 can process a plurality of coding units in different orders.

[0171] Fig.13 A process of determining a depth of a coding unit as a shape and a size of a coding unit change when a coding unit is recursively split so that a plurality of coding units are determined according to an embodiment is illustrated.

[0172] According to an embodiment, the image decoding device 100 may determine the depth of the coding unit based on a preset criterion. For example, the preset criterion may be the length of the long side of the coding unit. When the length of the long side of the coding unit before being divided is 2n (n>0) times the length of the long side of the divided current coding unit, the image decoding device 100 may determine that the depth of the current coding unit is increased by n compared to the depth of the coding unit before being divided. In the following description, a coding unit with an increased depth is represented as a coding unit of a deeper depth.

[0173] Reference Fig.13According to an embodiment, the image decoding apparatus 100 may determine a second coding unit 1302 and a third coding unit 1304 of a deeper depth by dividing the square first coding unit 1300 based on block shape information indicating a square shape (for example, the block shape information may be represented as "0: SQUARE"). Assuming that the size of the square first coding unit 1300 is 2N×2N, the second coding unit 1302 determined by dividing the width and height of the first coding unit 1300 into 1 / 2 may have a size of N×N. In addition, the third coding unit 1304 determined by dividing the width and height of the second coding unit 1302 into 1 / 2 may have a size of N / 2×N / 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 may 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 may be D+2.

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

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

[0176] According to an embodiment, the image decoding apparatus 100 may determine the second coding unit 1302, 1312, or 1322 by splitting 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 may 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 splitting the first coding unit 1320 in a vertical direction, or may determine the second coding unit 1322 having a size of N×N / 2 by splitting the first coding unit 1320 in horizontal and vertical directions.

[0177] According to an embodiment, the image decoding apparatus 100 may determine the third coding unit 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 may 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.

[0178] According to an embodiment, the image decoding apparatus 100 may determine the third coding unit 1304, 1314, or 1324 by splitting 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 may 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 splitting the second coding unit 1312 in a horizontal direction, or may determine the third coding unit 1314 having a size of N / 4×N / 2 by splitting the second coding unit 1312 in vertical and horizontal directions.

[0179] According to an embodiment, the image decoding apparatus 100 may determine the third coding unit 1304, 1314, or 1324 by splitting 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 may 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 splitting the second coding unit 1322 in a vertical direction, or may determine the third coding unit 1324 having a size of N / 2×N / 4 by splitting the second coding unit 1322 in vertical and horizontal directions.

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

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

[0182] Fig.14 Depth that may be determined based on a shape and a size of a coding unit and a partial index (PID) for distinguishing coding units according to an embodiment are illustrated.

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

[0184] According to an embodiment, the depths of the second coding units 1402a and 1402b, the second coding units 1404a and 1404b, and the second coding units 1406a, 1406b, 1406c, and 1406d determined based on the division shape pattern information of the square first coding unit 1400 may be determined based on the lengths of their long sides. For example, since the length of the side of the square first coding unit 1400 is equal to the length of the long side of the non-square second coding units 1402a and 1402b and 1404a and 1404b, the first coding unit 1400 and the non-square second coding units 1402a and 1402b and 1404a and 1404b may have the same depth (e.g., D). However, when the image decoding device 100 divides the first coding unit 1400 into four square second coding units 1406a, 1406b, 1406c and 1406d based on the division shape pattern information, because the length of the side of the square second coding units 1406a, 1406b, 1406c and 1406d is 1 / 2 of the length of the side of the first coding unit 1400, the depth 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.

[0185] According to an embodiment, the image decoding apparatus 100 may determine a plurality of second coding units 1412a and 1412b and 1414a, 1414b and 1414c by dividing the first coding unit 1410 whose height is longer than the width in the horizontal direction based on the division shape pattern information. According to an embodiment, the image decoding apparatus 100 may determine a plurality of second coding units 1422a and 1422b and 1424a, 1424b and 1424c by dividing the first coding unit 1420 whose width is longer than the height in the vertical direction based on the division shape pattern information.

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

[0187] In addition, the image decoding apparatus 100 may divide the non-square first coding unit 1410 into an odd number of second coding units 1414a, 1414b, and 1414c based on the division shape pattern information. The odd number of second coding units 1414a, 1414b, and 1414c may include the non-square second coding units 1414a and 1414c and the square second coding unit 1414b. In this case, since the length of the long side of the non-square second coding units 1414a and 1414c and the length of the side of the square second coding unit 1414b 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 may be D+1 which is 1 deeper than the depth D of the non-square first coding unit 1410. The image decoding apparatus 100 may determine the depths of the coding units split from the first coding unit 1420 having a non-square shape having a width longer than a height by using the above-described method of determining the depths of the coding units split from the first coding unit 1410 .

[0188] According to an embodiment, when the divided odd-numbered coding units do not have equal sizes, the image decoding apparatus 100 may determine a PID for identifying the divided coding units based on a size ratio between the coding units. Fig.14 , the width of the coding unit 1414b at the center position among the divided odd-numbered coding units 1414a, 1414b, and 1414c may be equal to the width of the other coding units 1414a and 1414c and its height may be twice the height of the other coding units 1414a and 1414c. That is, in this case, the coding unit 1414b at the center position may include two other coding units 1414a or 1414c. Therefore, 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 adjacent to the coding unit 1414b may increase by 2 and may therefore be 3. That is, there may be discontinuity in the PID value. According to an embodiment, the image decoding apparatus 100 may determine whether the divided odd-numbered coding units do not have equal sizes based on whether there is discontinuity in the PID for identifying the divided coding units.

[0189] According to an embodiment, the image decoding apparatus 100 may determine whether to use a specific splitting method based on a PID value for identifying a plurality of coding units determined by splitting a current coding unit. Fig.14, the image decoding apparatus 100 may determine even-numbered coding units 1412a and 1412b or odd-numbered coding units 1414a, 1414b, and 1414c by dividing the first coding unit 1410 having a rectangular shape whose height is longer than its width. The image decoding apparatus 100 may use a PID indicating each coding unit in order to identify the respective coding units. According to an embodiment, the PID may be obtained from a sample point at a preset position (e.g., an upper left sample point) of each coding unit.

[0190] According to an embodiment, the image decoding apparatus 100 may determine a coding unit at a preset position among the divided coding units by using a PID for distinguishing coding units. According to an embodiment, when the division shape pattern information of the first coding unit 1410 having a rectangular shape having a height longer than a width indicates that the coding unit is divided into three coding units, the image decoding apparatus 100 may divide the first coding unit 1410 into three coding units 1414a, 1414b, and 1414c. The image decoding apparatus 100 may assign a PID to each of the three coding units 1414a, 1414b, and 1414c. The image decoding apparatus 100 may compare the PIDs of the divided odd-numbered coding units to determine a coding unit at a center position among the divided odd-numbered coding units. The image decoding apparatus 100 may determine the coding unit 1414b having a PID corresponding to an intermediate 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 may determine a PID for distinguishing the divided coding units based on a size ratio between the coding units. Fig.14, the width of the coding unit 1414b generated by dividing the first coding unit 1410 may be equal to the width of the other coding units 1414a and 1414c, and the height of the coding unit 1414b may be twice the height 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 adjacent to the coding unit 1414b may increase by 2 and thus may be 3. When the PID is not uniformly increased as described above, the image decoding apparatus 100 may determine that the coding unit is divided into a plurality of coding units including coding units having sizes different from those of other coding units. According to an embodiment, when the division shape pattern information indicates that the coding unit is divided into an odd number of coding units, the image decoding apparatus 100 may divide the current coding unit in such a manner that the coding unit at a preset position (e.g., the coding unit at the center position) among the odd number of coding units has a size different from that of the other coding units. In this case, the image decoding apparatus 100 may determine the coding units at the center position having different sizes by using the PIDs of the coding units. However, the PID of the encoding unit at the preset position and the size or position are not limited to the above examples, and various PIDs and various positions and sizes of the encoding unit may be used.

[0191] According to an embodiment, the image decoding apparatus 100 may use a preset data unit in which a coding unit starts to be recursively divided.

[0192] Fig.15 It is illustrated that a plurality of coding units are determined based on a plurality of preset data units included in a picture according to an embodiment.

[0193] According to an embodiment, a preset data unit may be defined as a data unit that starts recursively splitting a coding unit by using split shape pattern information. That is, the preset data unit may correspond to a coding unit for determining a highest depth of a plurality of coding units split from a current picture. In the following description, for ease of explanation, a preset data unit is referred to as a reference data unit.

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

[0195] According to an embodiment, the image decoding apparatus 100 may divide the current picture into a plurality of reference data units. According to an embodiment, the image decoding apparatus 100 may divide the plurality of reference data units divided from the current picture by using the division shape pattern information of each reference data unit. The operation of dividing the reference data unit may correspond to the division operation using the quadtree structure.

[0196] According to an embodiment, the image decoding apparatus 100 may predetermine a minimum size allowed for a reference data unit included in the current picture. Therefore, the image decoding apparatus 100 may determine various reference data units having a size equal to or larger than the minimum size, and may determine one or more coding units by using the division shape pattern information with reference to the determined reference data unit.

[0197] Reference Fig.15 , the image decoding apparatus 100 may 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 may be determined based on various data units (e.g., a sequence, a picture, a slice, a slice segment, a tile, a tile group, a maximum coding unit, etc.) that can include one or more reference coding units.

[0198] According to an embodiment, the bitstream obtainer 110 of the image decoding apparatus 100 may obtain at least one of reference coding unit shape information and reference coding unit size information for each of various data units from the bitstream. Figure 3 The operation of dividing the current coding unit 300 describes the operation of dividing the square reference coding unit 1500 into one or more coding units, and the above has been about Figure 4 The operation of splitting the current coding unit 400 or 450 describes an operation of splitting the non-square reference coding unit 1502 into one or more coding units. Therefore, a detailed description thereof will not be provided here.

[0199] According to an embodiment, the image decoding apparatus 100 may determine the size and shape of the reference coding unit using a PID for identifying the size and shape of the reference coding unit according to some data units predetermined based on a preset condition. That is, the bitstream obtainer 110 may obtain only a PID for identifying the size and shape of the reference coding unit for each slice, slice segment, tile, tile group, or maximum coding unit from the bitstream, wherein each slice, slice segment, or maximum coding unit 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., a sequence, a picture, a slice, a slice segment, a tile, a tile group, a maximum coding unit, etc.) that satisfies the preset condition. The image decoding apparatus 100 may determine the size and shape of the reference data unit for each data unit that satisfies the preset condition by using the PID. When the reference coding unit shape information and the reference coding unit size information are obtained and used from the bitstream according to each data unit having a relatively small size, the efficiency of using the bitstream may not be high, and therefore, only the PID may be obtained and used 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 sizes and shapes of the reference coding units corresponding to the PID for identifying the sizes and shapes of the reference coding units may be predetermined. That is, the image decoding apparatus 100 may determine at least one of the sizes and shapes of the reference coding units included in the data unit serving as the unit for obtaining the PID by selecting at least one of the predetermined sizes and shapes of the reference coding units based on the PID.

[0200] According to an embodiment, the image decoding device 100 may use one or more reference coding units included in the maximum coding unit. That is, the maximum coding unit divided from the picture may include one or more reference coding units, and the coding unit may 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 may 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 may be obtained by dividing the maximum coding unit n times based on a quadtree structure. That is, according to various embodiments, the image decoding device 100 may determine the reference coding unit by dividing the maximum coding unit n times based on a quadtree structure, and the reference coding unit may be divided based on at least one of the block shape information and the division shape pattern information.

[0201] Fig.16 A processing block serving as a criterion for determining an order of determining reference coding units included in the picture 1600 according to an embodiment is illustrated.

[0202] According to an embodiment, the image decoding device 100 may determine one or more processing blocks for dividing a picture. A processing block may be a data unit including one or more reference coding units for dividing an image, and one or more reference coding units included in the processing block may be determined according to a specific order. That is, the order in which one or more reference coding units for each processing block are determined may correspond to one of various types of orders for determining reference coding units, and different processing blocks may have different orders for determining reference coding units. The order in which the reference coding units for each processing block are determined may be one of various orders (e.g., raster scanning, zigzag scanning, N-shaped scanning, upper right diagonal scanning, horizontal scanning, and vertical scanning), but is not limited to the above-mentioned scanning order.

[0203] According to an embodiment, the image decoding apparatus 100 may obtain processing block size information to determine the size of at least one processing block included in the image. The image decoding apparatus 100 may obtain processing block size information from a bitstream to determine the size of at least one processing block included in the image. The size of the processing block may be a preset size of a data unit indicated by the processing block size information.

[0204] According to an embodiment, the bitstream obtainer 110 of the image decoding apparatus 100 may obtain processing block size information from the bitstream for each specific data unit. For example, the processing block size information may be obtained from the bitstream by data unit (such as an image, a sequence, a picture, a slice, a slice segment, a tile, a tile group, etc.). That is, the bitstream obtainer 110 may obtain processing block size information from the bitstream for each of the various data units, and the image decoding apparatus 100 may determine the size of at least one processing block for dividing the picture by using the obtained processing block size information, wherein the size of the processing block may be an integer multiple of the reference coding unit.

[0205] According to an embodiment, the image decoding apparatus 100 may determine the sizes of the processing blocks 1602 and 1612 included in the picture 1600. For example, the image decoding apparatus 100 may determine the sizes of the processing blocks based on processing block size information obtained from a bitstream. Fig.16 According to an embodiment, the image decoding apparatus 100 may determine the horizontal size of the processing blocks 1602 and 1612 to be four times the horizontal size of the reference coding unit, and may determine the vertical size of the processing blocks 1602 and 1612 to be four times the vertical size of the reference coding unit. The image decoding apparatus 100 may determine an order in which one or more reference coding units are determined in one or more processing blocks.

[0206] According to an embodiment, the image decoding apparatus 100 may determine a processing block 1602 and a processing block 1612 included in the picture 1600 based on the size of the processing block, and may determine an order of determining one or more reference coding units included in the processing block 1602 and the processing block 1612. According to an embodiment, determining the reference coding unit may include determining the size of the reference coding unit.

[0207] According to an embodiment, the image decoding apparatus 100 may obtain information about determining the order of one or more reference coding units included in one or more processing blocks from a bitstream, and may determine the order of determining the one or more reference coding units based on the information about the determined order. The information about the determined order may be defined as an order or direction in which the reference coding units are determined in the processing block. That is, the order in which the reference coding units are determined may be determined independently for each processing block.

[0208] According to an embodiment, the image decoding apparatus 100 may obtain information about determining the order of reference coding units for each specific data unit from a bitstream. For example, the bitstream obtainer 110 may obtain information about determining the order of reference coding units from a bitstream for each data unit such as an image, a sequence, a picture, a slice, a slice segment, a tile, a tile group, a processing block, etc. Since the information about determining the order of reference coding units indicates determining the order of reference coding units in a processing block, the information about determining the order may be obtained for each specific data unit including an integer number of processing blocks.

[0209] The image decoding apparatus 100 may determine one or more reference coding units based on the order determined according to an embodiment.

[0210] According to an embodiment, the bitstream obtainer 110 may obtain information about the order of determining the reference coding units from the bitstream as information related to the processing blocks 1602 and 1612, and the image decoding apparatus 100 may determine the order of determining one or more reference coding units included in the picture 1600, and determine one or more reference coding units included in the picture 1600 according to the order of determining the reference coding units. Fig.16, the image decoding apparatus 100 may determine an order 1604 and an order 1614 of determining one or more reference coding units for the processing block 1602 and the processing block 1612, respectively. For example, when information on the order of determining the reference coding units is obtained for each processing block, the processing block 1602 and the processing block 1612 may have different orders of determining the reference coding units. When the order 1604 of the reference coding units determined for the processing block 1602 is an order of raster scanning, the reference coding units included in the processing block 1602 may be determined in the order of raster scanning. On the contrary, when the order 1614 of the reference coding units determined for another processing block 1612 is an order opposite to the raster scanning, the reference coding units included in the processing block 1612 may be determined in the order opposite to the raster scanning.

[0211] According to an embodiment, the image decoding apparatus 100 may decode one or more reference coding units. The image decoding apparatus 100 may decode an image based on the reference coding units determined by the above embodiment. A method of decoding a reference coding unit may include various image decoding methods.

[0212] According to an embodiment, the image decoding device 100 may obtain block shape information indicating the shape of the current coding unit or division shape pattern information indicating the division method of the current coding unit from the bitstream, and may use the obtained information. The division shape pattern information may be included in the bitstream associated with various data units. For example, the image decoding device 100 may use the division shape pattern information included in a sequence parameter set, a picture parameter set, a video parameter set, a slice header, a slice segment header, a parallel block header, or a parallel block group header. In addition, the image decoding device 100 may obtain a syntax element corresponding to the block shape information or the division shape pattern information from the bitstream according to each maximum coding unit, each reference coding unit, or each processing block, and may use the obtained syntax element.

[0213] Hereinafter, a method for determining a division rule according to an embodiment of the present disclosure will be described in detail.

[0214] The image decoding apparatus 100 may determine a division rule of an image. The division rule may be predetermined between the image decoding apparatus 100 and the image encoding apparatus 200. The image decoding apparatus 100 may determine a division rule of an image based on information obtained from a bitstream. The image decoding apparatus 100 may determine a division 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 parallel block header, and a parallel block group header. The image decoding apparatus 100 may determine a division rule differently according to a frame, a slice, a parallel block, a temporal layer, a maximum coding unit, or a coding unit.

[0215] The image decoding device 100 may determine the division rule based on the block shape of the coding unit. The block shape may include the size, shape, ratio of width to height, and direction of the coding unit. The image encoding device 200 and the image decoding device 100 may predetermine the division rule based on the block shape of the coding unit. However, the embodiment is not limited thereto. The image decoding device 100 may determine the division rule based on information obtained from the bit stream received from the image encoding device 200.

[0216] The shape of the coding unit may include a square and a non-square. When the width length and height length of the coding unit are the same, the image decoding apparatus 100 may determine the shape of the coding unit as a square. In addition, when the width length and height length of the coding unit are different, the image decoding apparatus 100 may determine the shape of the coding unit as a non-square.

[0217] The size of the coding unit may include various sizes such as 4×4, 8×4, 4×8, 8×8, 16×4, 16×8 to 256×256. The size of the coding unit may be classified based on the length of the long side, the length of the short side, or the area of ​​the coding unit. The image decoding device 100 may apply the same division rule to the coding units classified into the same group. For example, the image decoding device 100 may classify the coding units whose long sides are the same length as the coding units of the same size. In addition, the image decoding device 100 may apply the same division rule to the coding units whose long sides are the same length.

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

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

[0220] The division rule determined based on the size of the coding unit may 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 may determine the division rule based on information obtained from a bitstream.

[0221] The image decoding apparatus 100 may adaptively determine a split rule based on a location of a coding unit. The image decoding apparatus 100 may adaptively determine a split rule based on a location of a coding unit in an image.

[0222] In addition, the image decoding apparatus 100 may determine the division rule so that the coding units generated via different division paths do not have the same block shape. However, the embodiment is not limited thereto, and the coding units generated via different division paths have different decoding processing orders. Fig.12 The decoding process order is described, so its details will not be provided again.

[0223] Fig.17 Coding units of each picture when each picture has a different combination of division shapes of coding units according to an embodiment are illustrated.

[0224] Reference Fig.17 , the image decoding device 100 may determine a division shape combination of different coding units of each picture. For example, the image decoding device 100 may decode the image by using a picture 1700 that can be divided into four coding units, a picture 1710 that can be divided into two or four coding units, and a picture 1720 that can be divided into two, three, or four coding units, among at least one picture included in the image. The image decoding device 100 may use only the division shape information indicating division into four square coding units in order to divide the picture 1700 into a plurality of coding units. The image decoding device 100 may use only the division shape information indicating division into two or four coding units in order to divide the picture 1710. The image decoding device 100 may use only the division shape information indicating division into two, three, or four coding units to divide the picture 1720. The above-mentioned division shape combination is an embodiment for describing the operation of the image decoding device 100, and therefore, the above-mentioned division shape combination should not be interpreted as being limited to the above-mentioned embodiment. It should be understood that various division shape combinations may be used for each preset data unit.

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

[0226] Fig.18 Various shapes of coding units that may be determined based on division shape pattern information that may be represented by a binary code, according to an embodiment are illustrated.

[0227] According to an embodiment, the image decoding apparatus 100 may split the coding unit into various shapes by using block shape information and division shape pattern information obtained by the bitstream obtainer 110. The shape into which the coding unit may be divided may be various shapes including the shapes described above through the embodiment.

[0228] Reference Fig.18 , the image decoding apparatus 100 may split a coding unit having a square shape in at least one of a horizontal direction and a vertical direction and split a coding unit having a non-square shape in a horizontal direction or a vertical direction based on the division shape pattern information.

[0229] According to an embodiment, when the image decoding device 100 can divide a coding unit having a square shape in the horizontal direction and the vertical direction to determine four square coding units, the division shape pattern information for the square coding unit can represent four division shapes. According to an embodiment, the division shape pattern information can be represented by a 2-digit binary code, and each division shape can be assigned a binary code. For example, when the coding unit is not divided, the division shape pattern information can be represented as (00)b, when the coding unit is divided in the horizontal direction and the vertical direction, the division shape pattern information can be represented as (01)b, when the coding unit is divided in the horizontal direction, the division shape pattern information can be represented as (10)b, and when the coding unit is divided in the vertical direction, the division shape pattern information can be represented as (11)b.

[0230] According to an embodiment, when the image decoding apparatus 100 splits a coding unit having a non-square shape in a horizontal direction or a vertical direction, the kind of the split shape that may be represented by the split shape pattern information may depend on the number of coding units into which the coding unit is to be split. Fig.18According to an embodiment, the image decoding device 100 may divide a coding unit having a non-square shape into a maximum of three. In addition, the image decoding device 100 may divide the coding unit into two coding units. In this case, the division shape pattern information may be represented as (10)b. The image decoding device 100 may divide the coding unit into three coding units. In this case, the division shape pattern information may be represented as (11)b. The image decoding device 100 may determine not to divide the coding unit. In this case, the division shape pattern information may be represented as (0)b. That is, the image decoding device 100 may use variable length coding (VLC) instead of fixed length coding (FLC) in order to use a binary code representing the division shape pattern information.

[0231] According to the embodiment, referring to Fig.18 , the binary code of the division shape pattern information indicating that the coding unit is not divided can be represented as (0)b. In the case where the binary code of the division shape pattern information indicating that the coding unit is not divided is set to (00)b, although no division shape pattern information is set to (01)b, it may be necessary to use all 2 bits of the binary code of the division shape pattern information. However, in the case where three division shapes are used for coding units having non-square shapes, such as in Fig.18 As shown in , the image decoding apparatus 100 may determine that the coding unit is not divided by using a 1-bit binary code (0)b as the division shape pattern information, thereby efficiently using the bitstream. However, the division shape of the coding unit having a non-square shape represented by the division shape pattern information should not be interpreted as being limited to Fig.18 The three shapes shown in FIG. 1 should be interpreted as including various shapes of the above-mentioned embodiments.

[0232] Fig.19 Other shapes of coding units that may be determined based on division shape pattern information that may be represented by a binary code according to an embodiment are illustrated.

[0233] Reference Fig.19, the image decoding device 100 may divide the coding unit with a square shape in the horizontal direction or the vertical direction based on the division shape pattern information, and divide the coding unit with a non-square shape in the horizontal direction or the vertical direction. That is, the division shape pattern information may indicate that the coding unit with a square shape is divided in one direction. In this case, the binary code of the division shape pattern information indicating that the coding unit with a square shape is not divided may be represented as (0)b. In the case where the binary code of the division shape pattern information indicating that the coding unit is not divided is set to (00)b, although no division shape pattern information is set to (01)b, it may be necessary to use all 2 bits of the binary code of the division shape pattern information. However, in the case where three division shapes are used for the square-shaped coding unit, as in Fig.19 As shown in , the image decoding apparatus 100 may determine that the coding unit is not divided by using a 1-bit binary code (0)b as the division shape pattern information, thereby efficiently using the bitstream. However, the division shape of the coding unit having a square shape represented by the division shape pattern information should not be interpreted as being limited to Fig.19 The three shapes shown in FIG. 1 should be interpreted as including various shapes of the above-mentioned embodiments.

[0234] According to an embodiment, block shape information or division shape mode information can be represented by using a binary code, and the block shape information or division shape mode information can be directly generated as a bit stream. In addition, the block shape information or division shape mode information 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 bit stream.

[0235] The process of obtaining the syntax for block shape information or division shape mode information by CABAC by the image decoding device 100 according to the embodiment will be described. The image decoding device 100 may obtain a bitstream including a binary code for the syntax through the bitstream obtainer 110. The image decoding device 100 may debinarize the binary bit string included in the obtained bitstream to detect the syntax element representing the block shape information or the division shape mode information. According to the embodiment, the image decoding device 100 may obtain a set of binary bit strings corresponding to the syntax elements to be decoded, and decode each binary bit by using probability information. The image decoding device 100 may repeat this operation until the binary bit string configured with the decoded binary bit is the same as one of the binary bit strings obtained previously. The image decoding device 100 may perform debinarization on the binary bit string to determine the syntax element.

[0236] According to an embodiment, the image decoding apparatus 100 may perform a decoding process of adaptive binary arithmetic coding to determine a syntax for a binary bit string, and the image decoding apparatus 100 may update a probability model for a binary bit obtained by the bitstream obtainer 110. Fig.18 According to an embodiment, the bitstream obtainer 110 of the image decoding device 100 may obtain a bitstream representing a binary code, wherein the binary code represents the division shape pattern information. The image decoding device 100 may determine the syntax for the division shape pattern information by using the obtained binary code of 1 bit or 2 bits. The image decoding device 100 may update the probability of each bit in the 2-bit binary code in order to determine the syntax for the division shape pattern information. That is, the image decoding device 100 may update the probability that the value of the next binary bit will be 0 or 1 according to which of the values ​​of the first binary bit of the 2-bit binary code is 0 or 1 when decoding.

[0237] According to an embodiment, in the process of determining the syntax, the image decoding device 100 may update the probability of the binary bits used in the process of decoding the binary bits of the binary bit string for the syntax, and the image decoding device 100 may determine that specific bits of the binary bit string have the same probability without updating the probability of the specific bits.

[0238] Reference Fig.18, in the process of determining the syntax by using the binary bit string representing the division shape mode information for the coding unit having a non-square shape, the image decoding apparatus 100 may determine the syntax for the division shape mode information by using the binary bit having a value of 0 in a case where the coding unit having a non-square shape is not divided. That is, when the block shape information represents that the current coding unit has a non-square shape, in a case where the coding unit having a non-square shape is not divided, the first binary bit of the binary bit string for the division shape mode information may be 0, and in a case where the coding unit is divided into two or three coding units, the first binary bit of the binary bit string for the division shape mode information may be 1. Therefore, the probability that the first binary bit of the binary bit string for the division shape mode information for the coding unit having a non-square shape will be 0 may be 1 / 3, and the probability that the first binary bit will be 1 may be 2 / 3. Because the division shape mode information representing that the coding unit having a non-square shape is not divided may be represented by a binary bit string of 1 bit having a value of 0, as described above, the image decoding apparatus 100 may determine whether the second binary bit is 0 or 1 only in a case where the first binary bit of the division shape mode information is 1 to determine the syntax for the division shape mode information. According to an embodiment, when the first binary bit for the division shape pattern information is 1, the image decoding apparatus 100 may determine that the probability that the second binary bit will be 0 is equal to the probability that the second binary bit will be 1, and decode the second binary bit.

[0239] Therefore, the image decoding apparatus 100 may use various probabilities of respective bits in the process of determining the bits of the bit string for the division shape pattern information. According to an embodiment, the image decoding apparatus 100 may determine different probabilities for the bits of the division shape pattern information according to the extension direction of the non-square block. According to an embodiment, the image decoding apparatus 100 may determine different probabilities for the bits of the division shape pattern 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 may determine different probabilities for the bits of the division shape pattern 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.

[0240] According to an embodiment, for a coding unit equal to or larger than a preset size, the image decoding apparatus 100 may determine that the probability of the binary bits for the division shape pattern information is the same. For example, for a coding unit whose longer side length is equal to or larger than 64 samples, the image decoding apparatus 100 may determine that the probability of the binary bits for the division shape pattern information is the same.

[0241] According to an embodiment, the image decoding apparatus 100 may determine initial probabilities of bins constituting a bin string of division shape pattern information based on a slice type (eg, I slice, P slice, or B slice).

[0242] Fig. 20 is a block diagram of an image encoding and decoding system that performs loop filtering.

[0243] The encoder 2010 of the image encoding and decoding system 2000 may transmit an encoded bitstream of an image, and the decoder 2050 of the image encoding and decoding system 2000 may receive the bitstream and decode the bitstream to output a reconstructed image. Here, the encoder 2010 may be a configuration similar to the image encoding apparatus 200 to be described later, and the decoder 2050 may be a configuration similar to the image decoding apparatus 100.

[0244] In the encoder 2010, the prediction encoder 2015 may output prediction data through inter-frame prediction and intra-frame prediction, and the transform and quantization unit 2020 may output the quantized transform coefficient of the residual data between the current input image and the prediction data. The entropy encoder 2025 may encode the quantized transform coefficient to transform the quantized transform coefficient, and output the quantized transform coefficient as a bitstream. The quantized transform coefficient may be reconstructed into spatial domain data through the inverse quantization and inverse transform unit 2030, and the reconstructed spatial domain data may be output as a reconstructed image through the deblocking filter 2035 and the loop filter 2040. The reconstructed image may be used by the prediction encoder 2015 as a reference image for the next input image.

[0245] The encoded image data in the bitstream received by the decoder 2050 may be reconstructed into spatial domain residual data through the entropy decoder 2055 and the inverse quantization and inverse transform unit 2060. The prediction data output from the prediction decoder 2075 may be combined with the residual data to construct spatial domain image data, and the deblocking filter 2065 and the loop filter 2070 may filter the spatial domain image data and output a reconstructed image for the current original image. The reconstructed image may be used by the prediction decoder 2075 as a reference image for the next original image.

[0246] The loop filter 2040 of the encoder 2010 may perform loop filtering by using filter information input according to user input or system setting. The filter information used by the loop filter 2040 may be output to the entropy encoder 2025 and transmitted to the decoder 2050 together with the encoded image data. The loop filter 2070 of the decoder 2050 may perform loop filtering based on the filter information input from the decoder 2050.

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

[0248] Figure 2 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 division shape pattern information according to an embodiment.

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

[0250] The bitstream generator 210 may generate a bitstream based on the encoded input image. For example, the bitstream generator 210 may generate a bitstream by performing entropy encoding on syntax elements based on a context model. In addition, the image encoding apparatus 200 may transmit the bitstream to the image decoding apparatus 100.

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

[0252] According to an embodiment, the encoder 220 may determine a shape into which the coding unit is to be divided. The encoder 220 may determine the shape of at least one coding unit included in the coding unit, and the bitstream generator 210 may generate a bitstream including division shape pattern information including information about the shape of the coding unit.

[0253] According to an embodiment, the encoder 220 may determine whether to divide the coding unit. When the encoder 220 determines that the coding unit includes only one coding unit or the coding unit is not divided, the bitstream generator 210 may generate a bitstream including division shape pattern information indicating that the coding unit is not divided. In addition, the encoder 220 may divide the coding unit into a plurality of coding units included in the coding unit, and the bitstream generator 210 may generate a bitstream including division shape pattern information indicating that the coding unit will be divided into a plurality of coding units.

[0254] According to an embodiment, information indicating the number of coding units into which the coding unit is divided or the direction in which the coding unit is divided may be included in the division shape pattern information. For example, the division shape pattern information may indicate division in at least one of the vertical direction and the horizontal direction, or may indicate no division.

[0255] The image encoding apparatus 200 may determine the division shape pattern information based on the division shape pattern of the coding unit. The image encoding apparatus 200 may determine the context model based on at least one of the shape, direction, ratio of width to height, or size of the coding unit. In addition, the image encoding apparatus 200 may generate information about the division shape pattern for dividing the coding unit as a bitstream based on the context model.

[0256] In order to determine the context model, the image encoding apparatus 200 may obtain a convention for corresponding at least one of the shape, direction, aspect ratio, or size of the coding unit to the index of the context model. The image encoding apparatus 200 may obtain the index of the context model based on at least one of the shape, direction, ratio of width and height, or size of the coding unit according to the convention. The image encoding apparatus 200 may determine the context model based on the index of the context model.

[0257] In order to determine the context model, the image encoding apparatus 200 may further determine the context model based on block shape information including at least one of a shape, a direction, a ratio of width to height, or a size of a surrounding coding unit adjacent to the coding unit. In addition, the surrounding coding unit may include at least one of the coding units located at the lower left, left, upper left, upper, upper right, right, or lower right of the coding unit.

[0258] In addition, in order to determine the context model, the image encoding apparatus 200 may compare the length of the width of the upper surrounding coding unit with the length of the width of the coding unit. In addition, the image encoding apparatus 200 may compare the length of the height of the left surrounding coding unit and the right surrounding coding unit with the length of the height of the coding unit. In addition, the image encoding apparatus 200 may determine the context model based on the result of the comparison.

[0259] The operation of the image encoding device 200 includes the same Figures 3 to 20 The operations of the image decoding apparatus 100 described above are similar, and therefore, a detailed description thereof will be omitted.

[0260] In the following, reference will be made to Figures 21 to 32 An image encoding device 3000 and an image decoding device 2100 for encoding and decoding an image by bidirectional prediction are described.

[0261] Fig.21 is a block diagram showing the configuration of an image decoding apparatus 2100 according to an embodiment.

[0262] Reference Fig.21 , the image decoding apparatus 2100 according to an embodiment may include an obtainer 2110 , an entropy decoder 2130 , and a prediction decoder 2150 .

[0263] exist Fig.21 The obtainer 2110 shown in FIG. 2110 may correspond to the Figure 1 The bitstream obtainer 110 shown in FIG. 1 and the entropy decoder 2130 and the prediction decoder 2150 may correspond to the bitstream obtainer 110 shown in FIG. Figure 1 In addition, the entropy decoder 2130 and the prediction decoder 2150 may correspond to the decoder 120 shown in Fig. 20 The entropy decoder 2055 and the prediction decoder 2075 are shown in FIG.

[0264] The obtainer 2110, the entropy decoder 2130, and the prediction decoder 2150 according to an embodiment may be implemented as at least one processor. The image decoding apparatus 2100 may include one or more memories (not shown) for storing input data and output data of the obtainer 2110, the entropy decoder 2130, and the prediction decoder 2150. In addition, the image decoding apparatus 2100 may include a memory controller (not shown) for controlling data input and data output of the memory (not shown).

[0265] The obtainer 2110 may receive a bitstream generated as a result of encoding an image. The bitstream may include information for reconstructing a current block. The current block may be a block generated by being divided from an image according to a tree structure, and may correspond to a block unit such as a maximum coding unit, a coding unit, or a transform unit.

[0266] The prediction decoder 2150 may determine a current block based on block shape information and / or partition shape mode information included in a bitstream corresponding to at least one level of a sequence parameter set, a picture parameter set, a video parameter set, a slice header, and a slice segment header.

[0267] The bitstream may include information indicating a prediction mode of the current block. The prediction mode of the current block may include an intra mode, an inter mode, a merge mode, etc. The inter mode, the merge mode, etc. may be a mode for predicting and reconstructing the current block based on a reference image in order to reduce temporal redundancy between images.

[0268] According to an embodiment, one reference image (i.e., unidirectional prediction) may be used or two reference images (i.e., bidirectional prediction) may be used to reconstruct the current block based on the reference image. Whether the current block is to be unidirectionally predicted or bidirectionally predicted may be determined based on explicit information included in the bitstream, or may be implicitly determined based on a prediction mode of a surrounding block related to the current block to be unidirectionally predicted or bidirectionally predicted.

[0269] The entropy decoder 2130 may perform entropy decoding on the data included in the bitstream to obtain a syntax element to be used to reconstruct the current block. According to an embodiment, the entropy decoder 2130 may perform entropy decoding on the data included in the bitstream according to CABAC.

[0270] When the current block is bidirectionally predicted, the entropy decoder 2130 may perform entropy decoding on the weight information included in the bitstream to obtain a weight index corresponding to the syntax element. Here, the weight information may include a result value obtained by performing arithmetic coding on a binary string obtained by binarizing the weight index. Therefore, as a result of arithmetic decoding of the weight information, a binary string corresponding to the weight index may be reconstructed, and the binary string may be debinarized to obtain the weight index. The binary string obtained by binarizing the weight index and the binary string obtained by performing arithmetic decoding on the weight information may be referred to as a binary bit string.

[0271] According to an embodiment, the entropy decoder 2130 may reconstruct the first binary value of the binary string corresponding to the weight index based on the context model when the weight information is arithmetically decoded, and reconstruct the remaining binary values ​​of the binary string by a bypass method. That is, because the context model is only used for the first binary value, entropy decoding can be simplified.

[0272] Will refer to Figure 22 to Figure 24 The entropy decoder 2130 is described in detail.

[0273] Fig. 22 Shown in Fig.21 The configuration of the entropy decoder 2130 is shown in .

[0274] Reference Fig. 22 , the entropy decoder 2130 may include a context modeler 2132, a normal decoder 2134, a bypass decoder 2136, and a debinarizer 2138. The entropy decoder 2130 may perform an inverse process of an entropy encoding process performed by the entropy encoder 3030, which will be described later.

[0275] The bitstream may be configured with a binary value, and the binary value may be obtained by performing arithmetic encoding on a binary string corresponding to a syntax element determined during an image encoding process.

[0276] The data included in the bitstream may be arithmetically decoded into a binary value (ie, a binary string) corresponding to a syntax element by the regular decoder 2134 or the bypass decoder 2136. The data included in the bitstream may be input to the regular decoder 2134 or the bypass decoder 2136 according to the type of the syntax element.

[0277] The conventional decoder 2134 may perform arithmetic decoding on the binary value based on the probability model determined by the context modeler 2132. The context modeler 2132 may provide the probability model for the binary value to be currently reconstructed to the conventional decoder 2134. More specifically, the context modeler 2132 may determine the probability of a preset binary value based on a previously decoded binary value, update the probability of the binary value used to decode the previously decoded binary value, and output the updated probability to the conventional decoder 2134.

[0278] According to an embodiment, the context modeler 2132 may determine a context model by using a context index ctxldx, and determine the probability of occurrence of a minimum probability symbol (LPS) or a maximum probability symbol (MPS) that the context model has, and information valMPS about which one of 0 and 1 corresponds to the MPS. According to another embodiment, the context modeler 2132 may determine the probability of a predetermined preset binary value (e.g., P(1) representing the probability of occurrence of, for example, "1") based on a previously decoded binary value without partitioning the MPS and the LPS, and provide the probability of the preset binary value to the regular decoder 2134.

[0279] The conventional decoder 2134 may perform binary arithmetic decoding based on the probability of the preset binary value provided from the context modeler 2132 and the data included in the bitstream. More specifically, the conventional decoder 2134 may determine the occurrence probability P(1) of "1" and the occurrence probability P(0) of "0" based on the probability of the preset binary value provided from the context modeler 2132. In addition, the conventional decoder 2134 may divide a preset range representing a probability interval according to the occurrence probability P(0) of "0" and the occurrence probability P(1) of "1", and output a binary value corresponding to the interval to which the data included in the bitstream belongs.

[0280] The bypass decoder 2136 may fix the occurrence probability P(1) of "1" and the occurrence probability P(0) of "0" to a predetermined value (e.g., 0.5), divide a preset range representing a probability interval according to the occurrence probabilities P(1) and P(0), and output a binary value corresponding to the interval to which the data included in the bitstream belongs. Since the bypass decoder 2136 does not use a context model unlike the conventional decoder 2134, the bypass decoder 2136 may perform high-speed arithmetic decoding.

[0281] The debinarizer 2138 may debinarize a binary string that is an arrangement of binary values ​​output from the normal decoder 2134 and the bypass decoder 2136 to output a syntax element. For debinarization of the binary string, one of fixed-length debinarization, truncated Rice debinarization, k-order exponential Golomb debinarization (exp-golomb de-binarization), and Golomb Rice debinarization (golomb rice de-binarization) may be used.

[0282] As described above, the entropy decoder 2130 can reconstruct the first binary value based on the context model when arithmetic decoding is performed on the weight information included in the bitstream, and reconstruct the remaining binary values ​​by a bypass method. In other words, the first binary value of the binary string corresponding to the weight index can be reconstructed by the conventional decoder 2134, and the remaining binary values ​​can be reconstructed by the bypass decoder 2136.

[0283] Fig.23 It is a reference table used to determine the context information of the binary string corresponding to the weight index.

[0284] Reference Fig.23 It can be seen that the binary value whose binldx is 0 (ie, the first binary value) among the binary values ​​of Bcw_idx representing the weight index is reconstructed based on the context of 0, and the binary value whose binldx is greater than 0 is reconstructed by the bypass method.

[0285] After the entropy decoder 2130 completes arithmetic decoding of the weight information, the weight index corresponding to the syntax element may be obtained by debinarizing the binary string.

[0286] Fig.24 is a table representing candidate values ​​included in a weight candidate group and weight indices and binary strings corresponding to the candidate values.

[0287] Reference Fig.24, weight indices may be assigned to candidate values ​​for bidirectional prediction of the current block, and each weight index may be binarized by truncated Rice binarization. For example, weight index 0 may be represented by one binary value, and weight index 1 may be represented by two binary values. That is, the weight indices may be represented by different numbers of binary values. However, according to an implementation example, the weight index having the maximum value and the weight index having the second largest value may be represented by the same number of binary values ​​based on truncated Rice binarization. Fig.24 The kinds / numbers of candidate values ​​and the weight indexes assigned to the respective candidate values ​​shown in are examples and may be variously changed within a range apparent to a person of ordinary skill in the relevant art.

[0288] As described above, when arithmetically decoding weight information, the first binary value is reconstructed based on the context model, and the remaining binary values ​​are reconstructed by the bypass method. The reason may be because: i) when the selection probability of the candidate value indicated by the weight index 0 is the highest, it is effective to reconstruct the first binary value by accumulating the changes in the probability of 0 and the probability of 1 according to the context model; and ii) because the selection probability of the candidate value indicated by the other weight indexes other than 0 is lower than the selection probability of the candidate value indicated by the weight index 0, it is more effective to reconstruct the binary value by the bypass method than to reconstruct the binary value based on the context model.

[0289] The prediction decoder 2150 may use the candidate value indicated by the weight index obtained as a result of entropy decoding the weight information for bidirectional prediction of the current block. More specifically, when the weight index is 0, the candidate value 4 may be used for bidirectional prediction of the current block, and when the weight index is 1, the candidate value 5 may be used for bidirectional prediction of the current block.

[0290] Hereinafter, a method of reconstructing a current block by bidirectional prediction using weights, performed by the prediction decoder 2150, will be described.

[0291] Fig.25 It is a diagram for describing bidirectional prediction of the current block 2515.

[0292] The current block 2515 included in the current image 2510 can be unidirectionally predicted by using the first reference image 2530 included in list 0 or the second reference image 2550 included in list 1, or the current block 2515 included in the current image 2510 can be bidirectionally predicted by using the first reference image 2530 included in list 0 and the second reference image 2550 included in list 1.

[0293] The prediction decoder 2150 may determine a first reference image 2530 and a second reference image 2550 to be referenced by the current block 2515 for bidirectional prediction of the current block 2515, and determine a first motion vector mv1 indicating a first reference block 2535 in the first reference image 2530 and a second motion vector mv2 indicating a second reference block 2555 in the second reference image 2550. More specifically, the prediction decoder 2150 may select the first reference image 2530 and the second reference image 2550 as images to be referenced by the current block 2515 based on information included in a bitstream, or the prediction decoder 2150 may select the first reference image 2530 and the second reference image 2550 as images to be referenced by the current block 2515 in consideration of images referenced by surrounding blocks related to the current block 2515.

[0294] In order to determine the first motion vector mv1 and the second motion vector mv2, the prediction decoder 2150 may generate a motion vector candidate list by using a motion vector of a temporal block temporally related to the current block 2515 and a motion vector of a spatial block spatially related to the current block 2515. The prediction decoder 2150 may use the first motion vector mv1 and the second motion vector mv2 by using a motion vector candidate indicated by information included in the bitstream among the motion vector candidates included in the motion vector candidate list.

[0295] Fig.26 Blocks that are temporally and / or spatially related to the current block 2515 are shown.

[0296] Reference Fig.26 , the temporal block may include at least one of a block Co1 and a block Br, wherein the block Co1 has a different picture order count (POC) from that of the current block 2515 and is located at the same position as the current block 2515 in the reference image, and the block Br is spatially adjacent to the block Co1 located at the same position. The block Br may be located at the lower right side of the block Col located at the same position as the current block 2515.

[0297] The spatial blocks spatially related to the current block 2515 may include at least one of a lower left outer block A0, a lower left block A1, an upper right outer block B0, an upper right block B1, and an upper left outer block B2.

[0298] exist Fig.26 The positions of the time blocks and the space blocks shown in are examples, and the positions and the number of the time blocks and the space blocks may be variously changed according to implementation examples.

[0299] According to an embodiment, the prediction decoder 2150 may directly search the first reference block 2535 and the second reference block 2555 to be used to reconstruct the current block 2515 in the first reference image 2530 and the second reference image 2550. In this case, the prediction decoder 2150 may search for the first reference block 2535 and the second reference block 2555 by the same method as that performed by the image encoding apparatus 3000.

[0300] Refer again Fig.25 , after the first reference block 2535 in the first reference image 2530 and the second reference block 2555 in the second reference image 2550 are determined, the prediction decoder 2150 may combine the first reference block 2535 with the second reference block 2555, and reconstruct the current block 2515 based on the combined result. Herein, combining the first reference block 2535 with the second reference block 2555 may refer to linearly combining samples included in the first reference block 2535 with samples included in the second reference block 2555.

[0301] For example, the prediction decoder 2150 may determine the combination result of the first reference block 2535 and the second reference block 2555 as the current block 2515. As another example, the prediction decoder 2150 may apply the residual data obtained from the bitstream to the combination result of the first reference block 2535 and the second reference block 2555, thereby reconstructing the current block 2515. Here, the residual data may refer to the difference between the current block 2515 and the combination result of the first reference block 2535 and the second reference block 2555.

[0302] The prediction decoder 2150 may combine the first reference block 2535 and the second reference block 2555 according to Equation 1 below.

[0303] [Equation 1]

[0304] pbSamples[x][y]=

[0305] (w0*predSamplesL0[x][y]+w1*predSamplesL1[x][y]+offset3)

[0306] >>(shift2+3)

[0307] In Equation 1, pbSamples[x][y] represents a combination result of a sample located at a position (x, y) in the first reference block 2535 and a sample located at a position (x, y) in the second reference block 2555, predSamplesL0[x][y] represents a sample located at a position (x, y) of the first reference block in the first reference image 2530 included in List 0, and predSamplesL1[x][y] represents a sample located at a position (x, y) of the second reference block in the second reference image 2550 included in List 1. In addition, offset3 and shift2 are predetermined values.

[0308] In Equation 1, w1 represents a candidate value corresponding to a weight index, and w0 represents a pairing value of w1. A pairing value refers to a value obtained by applying a candidate value corresponding to a weight index to a preset operation equation. For example, the value of w0 is 8-w1. According to an implementation example, w0 may be a candidate value corresponding to a weight index, and w1 may be a pairing value of w0.

[0309] As described above, when a candidate value indicated by a weight index among candidate values ​​included in a weight candidate group is confirmed, the corresponding candidate value may be used as a weight for combining a first reference block with a second reference block. That is, according to an embodiment, when a first reference block is combined with a second reference block for bidirectional prediction of a current block, by selecting a weight that can derive a combination result that is most similar to the current block, the size of residual data included in a bitstream may be reduced.

[0310] In addition, since the indexes respectively indicating the candidate values ​​included in the weight candidate group are binarized to be represented by different numbers of binary values ​​by, for example, truncated Rice binarization, which indexes are assigned to which candidate values ​​may be important in terms of bit rate. In other words, when the minimum index is assigned to the candidate value having the highest probability of being used for bidirectional prediction of the current block among the candidate values ​​included in the weight candidate group, the corresponding index can be represented by a small number of bits. For example, when Fig.24 When the candidate value with the greatest probability of being used for bidirectional prediction of the current block among the candidate values ​​shown in is -2 and index 4 is assigned to candidate value -2, four binary values ​​(i.e., 1111) may be required to represent index 4, and therefore, there is a disadvantage in bit rate compared to the case where index 0 is assigned to candidate value -2.

[0311] Therefore, the prediction decoder 2150 according to the embodiment may adaptively assign indexes to the candidate values ​​included in the weight candidate group. Hereinafter, adaptively assigning indexes means that the indexes to be assigned to the candidate values ​​may be changed according to a preset standard, rather than applying the same indexes to the candidate values, respectively. Hereinafter, this will be described in detail.

[0312] According to an embodiment, the prediction decoder 2150 may adaptively set the index of the candidate value according to the cumulative number of times the candidate value has been selected for bidirectional prediction of a previous block decoded earlier than the current block. For example, the prediction decoder 2150 may assign an index of a smaller value to a candidate value having a larger cumulative number of times the candidate value has been selected.

[0313] Fig. 27 is a diagram for describing that an index of a candidate value included in a weight candidate group may change according to the cumulative number of times the candidate value has been selected.

[0314] As in Fig. 27 As shown in , when candidate value 4 has been selected 19 times, candidate value 5 has been selected 6 times, candidate value 3 has been selected 12 times, candidate value 10 has been selected 3 times, and candidate value -2 has been selected 7 times in the previous block, indices of values ​​increasing in the order of candidate value 4, candidate value 3, candidate value -2, candidate value 5, and candidate value 10 may be assigned to the corresponding candidate values, respectively.

[0315] The prediction decoder 2150 may assign indexes to the candidate values, respectively, and, as described above, combine the first reference block with the second reference block by using the candidate values ​​corresponding to the weight indexes.

[0316] According to an embodiment, the prediction decoder 2150 may reallocate indexes to candidate values ​​for each picture, each slice, each tile, or each block, respectively. Here, the block may include a maximum coding unit, a coding unit, or a transformation unit.

[0317] For example, when indices are reallocated to candidate values ​​on a picture-by-picture basis, the prediction decoder 2150 may calculate the cumulative number of times that candidate values ​​have been selected for bidirectional prediction of a previous block included in a previous image before decoding a current image including the current block, and assign indices to candidate values ​​to be used for bidirectional prediction of blocks in the current image based on the cumulative number of times.

[0318] According to another example, when the index is reallocated to the candidate value in units of slices, the prediction decoder 2150 may calculate the cumulative number of times the candidate value has been selected for bidirectional prediction of a previous block included in a previous slice before decoding the current slice including the current block, and allocate the index to the candidate value to be used for bidirectional prediction of the block in the current slice based on the calculated cumulative number of times.

[0319] According to another example, when indices are reallocated to candidate values ​​in units of parallel blocks, the prediction decoder 2150 may calculate the cumulative number of times that the candidate value has been selected for bidirectional prediction of a previous block included in a previous parallel block before decoding the current parallel block including the current block, and assign an index to the candidate value to be used for bidirectional prediction of the block in the current parallel block based on the calculated cumulative number of times.

[0320] According to another example, when indices are reallocated to candidate values ​​on a block basis, the prediction decoder 2150 may calculate the cumulative number of times that the candidate value has been selected for bidirectional prediction of a previous block before decoding the current block, and assign an index to the candidate value to be used for bidirectional prediction of the current block based on the calculated cumulative number of times.

[0321] According to an embodiment, the prediction decoder 2150 may select a previous block that is bidirectionally predicted based on a first reference image and a second reference image for bidirectionally predicting a current block among previous blocks, and set an index of a candidate value according to the cumulative number of times the candidate value has been selected for bidirectionally predicting the corresponding previous block. In other words, the cumulative number of times the candidate value has been selected may be calculated for a previous block that is bidirectionally predicted by using the same reference image as the reference image of the current image, and the index may be assigned according to the cumulative number of times. In this case, the prediction decoder 2150 may specify a reference image referenced by the current block according to information (e.g., ref_idx) indicating a reference image for bidirectional prediction of the current block, and then select a candidate value indicated by a weight index (e.g., bcw_idx). Therefore, the entropy decoder 2130 may reconstruct information (e.g., ref_idx) indicating a reference image for bidirectional prediction of the current block from a bitstream, and then reconstruct a weight index.

[0322] When there is no previous block that is bidirectionally predicted based on the first reference image and the second reference image for bidirectionally predicting the current block, the prediction decoder 2150 may assign an index of a predetermined value to the candidate value. The reason may be that for blocks that are bidirectionally predicted based on the same reference image, there is a high probability that the same weight will be selected to combine the reference blocks.

[0323] According to an embodiment, the prediction decoder 2150 may select a previous image having the same temporal layer as that of a current image in a current group of pictures (GOP) including the current image from among the previous images, and set an index of the candidate value according to the cumulative number of times the candidate value has been selected for bidirectional prediction of a previous block included in the selected previous image. The temporal layer may represent a decoding level or a decoding order of images included in the GOP.

[0324] According to an embodiment, the prediction decoder 2150 may obtain information of indexes respectively assigned to candidate values ​​from a bitstream corresponding to a level of an image, a slice, a tile, or a block, and assign the indexes to the candidate values ​​in units of a block, a tile, a slice, or an image according to the obtained information. Here, a block may include a maximum coding unit, a coding unit, or a transform unit.

[0325] According to an embodiment, the prediction decoder 2150 may assign an index of a predetermined value (e.g., index 0) to a predetermined candidate value among the candidate values, and adaptively assign the index to the remaining candidate values ​​according to a preset criterion (e.g., the cumulative number of times the candidate value has been selected in a previous block).

[0326] The prediction decoder 2150 may adaptively determine the number of candidate values ​​included in the weight candidate group for each image, each stripe, each parallel block, or each block. Here, adaptively determining the number of candidate values ​​means changing the number of candidate values ​​differently according to a preset standard, rather than determining the number of candidate values ​​to be the same. Therefore, when the number of candidate values ​​included in the weight candidate group is determined in units of images, the prediction decoder 2150 may use a weight candidate group including 5 candidate values ​​(e.g., 4, 5, 3, 10, -2) when bidirectional prediction decoding is performed on a block included in the current image, and use a weight candidate group including 3 candidate values ​​(e.g., 3, 4, 5) when bidirectional prediction decoding is performed on a block included in the next image. According to an implementation example, when the number of candidate values ​​included in the weight candidate group is determined, the prediction decoder 2150 may adaptively assign indexes to corresponding candidate values ​​as described above.

[0327] According to an embodiment, the prediction decoder 2150 may adaptively determine the number of candidate values ​​included in the weight candidate group based on at least one of the POC of the first reference image and the POC of the second reference image.

[0328] For example, the prediction decoder 2150 may adaptively determine the number of candidate values ​​included in the weight candidate group based on at least one of a comparison result between the POC of the first reference image and the POC of the current image and a comparison result between the POC of the second reference image and the POC of the current image.

[0329] For example, the prediction decoder 2150 may adaptively determine the number of candidate values ​​included in the weight candidate group, taking into account whether the POC of the first reference image and the POC of the second reference image are greater than or less than the POC of the current image. When both the POC of the first reference image and the POC of the second reference image are less than or equal to the POC of the current image, the prediction decoder 2150 may determine the number of candidate values ​​included in the weight candidate group as m (m is a natural number), and when at least one of the POC of the first reference image and the POC of the second reference image is greater than the POC of the current image, the prediction decoder 2150 may determine the number of candidate values ​​included in the weight candidate group as n (n is a natural number different from m). For example, when m is 5, the candidate values ​​included in the weight candidate group may be 4, 5, 3, 10, and -2, and when n is 3, the candidate values ​​included in the weight candidate group may be 3, 4, and 5.

[0330] For example, the prediction decoder 2150 may adaptively determine the number of candidate values ​​included in the weight candidate group based on count information included in the bitstream.

[0331] In addition, for example, the prediction decoder 2150 may adaptively determine the number of candidate values ​​included in the weight candidate group according to the type of the current image. When the current image is of a preset type, the prediction decoder 2150 may determine the number of candidate values ​​included in the weight candidate group to be 5 (e.g., 4, 5, 3, 10, -2), and when the current image is not of a preset type, the prediction decoder 2150 may determine the number of candidate values ​​included in the weight candidate group to be 3 (e.g., 3, 4, and 5).

[0332] Regarding Equation 1, it has been described that when the first reference block is combined with the second reference block, a candidate value is determined according to the weight index, a pairing value is determined from the candidate value, and the candidate value and the pairing value are applied to the first reference block and the second reference block, respectively. When the candidate value is w1, the pairing value w0 may be 8-w1. Referring to Fig.24 From the candidate values ​​shown in , it can be seen that the pairing value w0 is also included in the weight candidate group as a candidate value. For example, when the candidate value indicated by the weight index is 5, the pairing value of 5 is 3 (8-5), and 3 is also included as a candidate value. Fig.24 In the table shown in . Furthermore, when the candidate value indicated by the weight index is 10, the pairing value of 10 is -2 (8-10), and -2 is also included in the table as a candidate value.

[0333] That is to say, Fig.24Among the candidate values ​​shown in , 5 is paired with 3, and 10 is paired with -2. When 5 or 10 is selected from among the candidate values, 3 and -2 can always be inferred as paired values. By including 3 and -2 in the weight candidate group, various combinations of candidate values ​​to be applied to the first reference block and the second reference block can be determined. However, considering the bitstream, the large number of candidate values ​​included in the weight candidate group may be a disadvantage. The reason may be: because the larger number of candidate values ​​included in the weight candidate group results in a larger number of binary values ​​representing the candidate values ​​respectively.

[0334] According to an embodiment, the prediction decoder 2150 may include only candidate values ​​that are not in a pairing relationship in the weight candidate group. Fig.28 is a table representing the candidate values ​​included in the weight candidate group and the weight index and binary string corresponding to the candidate values. Fig.24 compared to, Fig.28 It is shown that there is no 3 paired with 5 and -2 paired with 10 in the weight candidate group. According to an implementation example, 3 and -2 may be included in the weight candidate group, but 5 and 10 are not included. Since the total number of candidate values ​​is 3, three binary values ​​may be used to represent the maximum index, and therefore, the number of bits required to represent the weight index may be reduced.

[0335] When the candidate values ​​included in the weight candidate group are not in a pairing relationship, the prediction decoder 2150 may select which of the candidate values ​​indicated by the weight index and the pairing values ​​of the candidate values ​​are applied to the first reference block and the second reference block, respectively. More specifically, when the preset standard is met, the prediction decoder 2150 may apply the candidate value indicated by the weight index to the first reference block, and apply the pairing value of the corresponding candidate value to the second reference block. On the contrary, when the preset standard is not met, the prediction decoder 2150 may apply the candidate value indicated by the weight index to the second reference block, and apply the pairing value of the corresponding candidate value to the first reference block.

[0336] According to an embodiment, the prediction decoder 2150 may select which of the candidate value and the pairing value to apply to the first reference block and the second reference block, respectively, based on the POC of the first reference image and the POC of the second reference image. For example, the prediction decoder 2150 may apply the candidate value to the reference block in the reference image having a POC with a larger difference from the POC of the current image among the first reference image and the second reference image, and apply the pairing value to the reference block in the other reference image. As another example, the prediction decoder 2150 may apply the candidate value to the reference block in the reference image having a POC with a smaller difference from the POC of the current image among the first reference image and the second reference image, and apply the pairing value to the reference block in the other reference image. As yet another example, the prediction decoder 2150 may apply the candidate value to the reference block in the reference image having a larger POC among the first reference image and the second reference image, and apply the pairing value to the reference block in the other reference image. Conversely, the prediction decoder 2150 may apply the candidate value to the reference block in the reference image having a smaller POC among the first reference image and the second reference image, and apply the pairing value to the reference block in the other reference image. As another example, the prediction decoder 2150 may apply the larger of the candidate value and the paired value to a reference block in a reference image having a POC with a smaller difference from the POC of the current image among the first reference image and the second reference image, and apply the smaller of the candidate value and the paired value to a reference block in a reference image having a POC with a larger difference from the POC of the current image among the first reference image and the second reference image. As yet another example, the prediction decoder 2150 may apply the larger of the candidate value and the paired value to a reference block in a reference image having a POC with a larger difference from the POC of the current image among the first reference image and the second reference image, and apply the smaller of the candidate value and the paired value to a reference block in a reference image having a POC with a smaller difference from the POC of the current image among the first reference image and the second reference image.

[0337] Fig.29 is a flowchart illustrating an image decoding method according to an embodiment.

[0338] In operation S2910, the image decoding apparatus 2100 may obtain a first reference block in a first reference image and a second reference block in a second reference image for bidirectional prediction of a current block. The image decoding apparatus 2100 may obtain information indicating a first reference image included in list 0 and a second reference image included in list 1 from a bitstream, and select the first reference image and the second reference image according to the obtained information. In addition, the image decoding apparatus 2100 may determine a first motion vector indicating a first reference block in the first reference image and a second motion vector indicating a second reference block in the second reference image.

[0339] In operation S2920, the image decoding apparatus 2100 may obtain weight information included in a bitstream, and in operation S2930, perform entropy decoding on the weight information to obtain a weight index.

[0340] The image decoding apparatus 2100 may reconstruct a first binary value corresponding to a weight index according to a context model, and reconstruct remaining binary values ​​according to a bypass method.

[0341] In operation S2940, the image decoding device 2100 may combine the first reference block with the second reference block according to the candidate value indicated by the weight index among the candidate values ​​included in the weight candidate group, and in operation S2950, ​​reconstruct the current block based on the combination result of the first reference block and the second reference block.

[0342] The image decoding device 2100 may determine the combination result of the first reference block and the second reference block as the current block, or the image decoding device 2100 may determine the combination result of the first reference block and the second reference block as a prediction block, and sum the prediction block with the residual data obtained from the bitstream to reconstruct the current block.

[0343] The image decoding apparatus 2100 may adaptively determine the number and / or type of candidate values ​​to be included in the weight candidate group for each image, each slice, each tile, or each block so as to select the candidate value indicated by the weight index. In order to adaptively determine the number and / or type of candidate values ​​to be included in the weight candidate group, the image decoding apparatus 2100 may use the same method as that performed by the image encoding apparatus 3000 to be described later.

[0344] Fig.30 is a block diagram showing the configuration of the image encoding device 3000 according to the embodiment.

[0345] Reference Fig.30 , the image encoding apparatus 3000 may include a prediction encoder 3010, an entropy encoder 3030, and a generator 3050. The prediction encoder 3010 and the entropy encoder 3030 may correspond to Figure 2 The encoder 20 shown in FIG. 1 and the generator 3050 may correspond to the encoder 20 shown in FIG. Figure 2 In addition, the prediction encoder 3010 and the entropy encoder 3030 may correspond to the bit stream generator 210 shown in Fig. 20 The prediction encoder 2015 and entropy encoder 2025 are shown in .

[0346] The prediction encoder 3010 and the entropy encoder 3030 according to an embodiment may be implemented as at least one processor. The image encoding apparatus 3000 may include at least one memory (not shown) storing input / output data of the prediction encoder 3010, the entropy encoder 3030, and the generator 3050. In addition, the image encoding apparatus 3000 may include a memory controller (not shown) for controlling data input / output of the memory (not shown).

[0347] The prediction encoder 3010 may determine a prediction mode of the current block. The prediction mode of the current block may include an intra mode, an inter mode, a merge mode, etc. The inter mode, the merge mode, etc. may be a mode for predicting the current block based on a reference image and encoding the current block to reduce temporal redundancy between images. According to an embodiment, in order to encode the current block based on a reference image, one reference image (i.e., unidirectional prediction) or two reference images (i.e., bidirectional prediction) may be used.

[0348] When the current block is bi-directionally predicted, the prediction encoder 3010 may select a reference image of the current block from among list 0 and list 1. The prediction encoder 3010 may select a first reference image from list 0 and a second reference image from list 1.

[0349] In addition, the prediction encoder 3010 may search for a first reference block for predicting the current block in the first reference image, and search for a second reference block in the second reference image. The prediction encoder 3010 may select the first reference block and the second reference block that can generate a block having a minimum difference with the current block from the first reference image and the second reference image. As described above, the prediction encoder 3010 may generate a motion vector candidate list by using a motion vector of a temporal block temporally associated with the current block and a motion vector of a spatial block spatially associated with the current block, determine a first motion vector and a second motion vector from among motion vector candidates included in the motion vector candidate list, and obtain a first reference block indicated by the first motion vector and a second reference block indicated by the second motion vector.

[0350] After obtaining the first reference block and the second reference block, the prediction encoder 3010 may select a candidate value to be used to combine the first reference block with the second reference block from among candidate values ​​included in the weight candidate group.

[0351] The prediction encoder 3010 may adaptively assign indexes to candidate values ​​included in the weight candidate group before selecting the candidate values.

[0352] According to an embodiment, the prediction encoder 3010 may adaptively assign indices to candidate values ​​based on the cumulative number of times the candidate value has been selected for bidirectional prediction of previous blocks encoded earlier than the current block. For example, the prediction encoder 3010 may assign indices of smaller sizes to candidate values ​​that have been selected for a larger cumulative number of times. Fig. 27 As shown in , when candidate value 4 has been selected 19 times, candidate value 5 has been selected 6 times, candidate value 3 has been selected 12 times, candidate value 10 has been selected 3 times, and candidate value -2 has been selected 7 times in the previous block, indices of values ​​increasing in the order of candidate value 4, candidate value 3, candidate value -2, candidate value 5, and candidate value 10 may be assigned to the corresponding candidate values, respectively.

[0353] According to an embodiment, the prediction encoder 3010 may reallocate the index to the candidate value for each picture, each slice, each tile, or each block. Here, the block may include a maximum coding unit, a coding unit, or a transformation unit.

[0354] For example, when the index is reallocated to the candidate value in units of images, the prediction encoder 3010 may calculate the cumulative number of times the candidate value has been selected for bidirectional prediction of a previous block included in a previous image before decoding the current image including the current block, and allocate the index to the candidate value to be used for bidirectional prediction of the block in the current image according to the cumulative number. According to another example, when the index is reallocated to the candidate value in units of slices, the prediction encoder 3010 may calculate the cumulative number of times the candidate value has been selected for bidirectional prediction of a previous block included in a previous slice before decoding the current slice including the current block, and allocate the index to the candidate value to be used for bidirectional prediction of the block in the current slice according to the calculated cumulative number. According to another example, when the index is reallocated to the candidate value in units of parallel blocks, the prediction encoder 3010 may calculate the cumulative number of times the candidate value has been selected for bidirectional prediction of a previous block included in a previous parallel block before decoding the current parallel block including the current block, and allocate the index to the candidate value to be used for bidirectional prediction of the block in the current parallel block according to the calculated cumulative number.

[0355] According to an embodiment, the prediction encoder 3010 may select a previous block that is bidirectionally predicted based on a first reference image and a second reference image for bidirectionally predicting a current block among previous blocks, and assign an index to a candidate value according to the cumulative number of times the candidate value has been selected for bidirectionally predicting the corresponding previous block. In this case, the entropy encoder 3030 may perform entropy encoding on information indicating a reference image for bidirectionally predicting the current block (e.g., ref_idx), and then perform entropy encoding on a weight index (e.g., bcw_idx).

[0356] According to an embodiment, the prediction decoder 2150 may select a previous image having the same temporal layer as that of the current image in the GOP including the current image from among the previous images, and assign an index to the candidate value based on the cumulative number of times the candidate value has been selected for bidirectional prediction of a previous block included in the selected previous image.

[0357] According to an embodiment, the prediction encoder 3010 may assign an index of a predetermined value (e.g., index 0) to a predetermined candidate value among the candidate values, and adaptively assign the index to the remaining candidate values ​​according to a preset criterion (e.g., the cumulative number of times the candidate value has been selected in previous blocks).

[0358] The prediction encoder 3010 may adaptively determine the number of candidate values ​​included in the weight candidate group for each image, each slice, each tile, or each block. When the number of candidate values ​​included in the weight candidate group is determined in units of images, the prediction encoder 3010 may use a weight candidate group including 5 candidate values ​​(e.g., 4, 5, 3, 10, -2) when bidirectionally predictively encoding a block included in a current image, and use a weight candidate group including 3 candidate values ​​(e.g., 3, 4, 5) when bidirectionally predictively encoding a block included in a next image.

[0359] According to an embodiment, the prediction encoder 3010 may adaptively determine the number of candidate values ​​included in the weight candidate group based on at least one of the POC of the first reference image and the POC of the second reference image.

[0360] For example, the prediction encoder 3010 may determine the number of candidate values ​​included in the weight candidate group based on at least one of a comparison result between the POC of the first reference image and the POC of the current image and a comparison result between the POC of the second reference image and the POC of the current image.

[0361] For example, the prediction encoder 3010 may determine the number of candidate values ​​included in the weight candidate group by considering whether the POC of the first reference image and the POC of the second reference image are greater than or less than the POC of the current image. When both the POC of the first reference image and the POC of the second reference image are less than or equal to the POC of the current image, the prediction encoder 3010 may determine the number of candidate values ​​included in the weight candidate group as m (m is a natural number), and when at least one of the POC of the first reference image and the POC of the second reference image is greater than the POC of the current image, the prediction encoder 3010 may determine the number of candidate values ​​included in the weight candidate group as n (n is a natural number different from m).

[0362] In addition, for example, the prediction encoder 3010 may adaptively determine the number of candidate values ​​included in the weight candidate group according to the type of the current image. When the current image is of a preset type, the prediction encoder 3010 may determine the number of candidate values ​​included in the weight candidate group to be 5 (e.g., 4, 5, 3, 10, -2), and when the current image is not of a preset type, the prediction encoder 3010 may determine the number of candidate values ​​included in the weight candidate group to be 3 (e.g., 3, 4, 5).

[0363] After selecting the candidate value for bidirectional prediction of the current block, the prediction encoder 3010 may combine the first reference block with the second reference block according to the selected candidate value, thereby encoding the current block. The prediction encoder 3010 may combine the first reference block with the second reference block according to Equation 1. The prediction encoder 3010 may determine the combination result of the first reference block and the second reference block as the current block, and transmit information for obtaining the first reference block and the second reference block (for example, information indicating the first reference image and the second reference image, information indicating the first motion vector and the second motion vector, etc.) and the weight index to the entropy encoder 3030. Optionally, the prediction encoder 3010 may determine the combination result of the first reference block and the second reference block as the prediction block, and transmit the residual data between the current block and the prediction block, the information for obtaining the first reference block and the second reference block, and the weight index to the entropy encoder 3030.

[0364] According to an embodiment, the prediction encoder 3010 may include only candidate values ​​that are not in a pairing relationship in the weight candidate group. Fig.28 The candidate values ​​shown in Fig.24 By comparing the candidate values ​​shown in Fig.28 , 3 (eg, pairing value = 8 - candidate value) which is paired with 5 and -2 which is paired with 10 do not exist as candidate values. According to an implementation example, 4, 3, and -2 may be included in the weight candidate group as candidate values.

[0365] When the candidate values ​​included in the weight candidate group are not in a pairing relationship, the prediction encoder 3010 may select which of the candidate values ​​selected from the candidate values ​​and the pairing values ​​of the candidate values ​​are applied to the first reference block and the second reference block, respectively. More specifically, when the preset criterion is met, the prediction encoder 3010 may apply the candidate value to the first reference block, and apply the pairing value of the corresponding candidate value to the second reference block. On the contrary, when the preset criterion is not met, the prediction encoder 3010 may apply the candidate value to the second reference block, and apply the pairing value of the corresponding candidate value to the first reference block.

[0366] According to an embodiment, the prediction encoder 3010 may select which of the candidate value and the pairing value are applied to the first reference block and the second reference block, respectively, based on the POC of the first reference image and the POC of the second reference image. For example, the prediction encoder 3010 may apply the candidate value to the reference block in the reference image having a POC with a larger difference from the POC of the current image among the first reference image and the second reference image, and apply the pairing value to the reference block in the other reference image. As another example, the prediction encoder 3010 may apply the candidate value to the reference block in the reference image having a POC with a smaller difference from the POC of the current image among the first reference image and the second reference image, and apply the pairing value to the reference block in the other reference image. As yet another example, the prediction encoder 3010 may apply the candidate value to the reference block in the reference image having a larger POC among the first reference image and the second reference image, and apply the pairing value to the reference block in the other reference image. Conversely, the prediction encoder 3010 may apply the candidate value to the reference block in the reference image having a smaller POC among the first reference image and the second reference image, and apply the pairing value to the reference block in the other reference image. As another example, the prediction encoder 3010 may apply the larger of the candidate value and the pairing value to a reference block in a reference image having a POC with a smaller difference from the POC of the current image among the first reference image and the second reference image, and apply the smaller of the candidate value and the pairing value to a reference block in a reference image having a POC with a larger difference from the POC of the current image among the first reference image and the second reference image. As yet another example, the prediction encoder 3010 may apply the larger of the candidate value and the pairing value to a reference block in a reference image having a POC with a larger difference from the POC of the current image among the first reference image and the second reference image, and apply the smaller of the candidate value and the pairing value to a reference block in a reference image having a POC with a smaller difference from the POC of the current image among the first reference image and the second reference image.

[0367] The entropy encoder 3030 may perform entropy encoding on the information transmitted from the prediction encoder 3010. As described above, the information transmitted from the prediction encoder 3010 may include at least one of a prediction mode of a current block, information indicating a reference image, information indicating a motion vector, residual data between a prediction block and a current block, and a weight index.

[0368] The entropy encoder 3030 may binarize the weight index to perform entropy encoding on the weight index, perform arithmetic encoding on the first binary value of the binary string corresponding to the weight index according to the context model, and perform arithmetic encoding on the remaining binary values ​​according to a bypass method.

[0369] Will refer to Fig.31The entropy encoder 3030 is described in detail.

[0370] Fig.31 A configuration of the entropy encoder 3030 according to an embodiment is shown.

[0371] Reference Fig.31 According to an embodiment, the entropy encoder 3030 may include a binarizer 3031, a context modeler 3032, and a binary arithmetic encoder 3035. The binary arithmetic encoder 3035 may include a normal encoder 3033 and a bypass encoder 3034.

[0372] Since the syntax element (information transmitted from the prediction encoder 3010) input to the entropy encoder 3030 may not be a binary value, the binarizer 3031 may binarize the syntax element and output a binary string configured with a binary value of 0 or 1. The binary string may be arithmetically encoded by CABAC.

[0373] The binarizer 3031 may apply one of fixed-length binarization, truncated Rice binarization, k-order exponential-Golomb binarization, and Golomb-Rice binarization according to the type of the syntax element to transform the value of the syntax element into binary values ​​0 and 1. According to an embodiment, the binarizer 3031 may binarize the weight index by truncated Rice binarization.

[0374] The binary value output from the binarizer 3031 may be arithmetically encoded by the normal encoder 3033 or the bypass encoder 3034. Which one of the normal encoder 3033 or the bypass encoder 3034 will encode the binary value may be determined according to the type of the syntax element.

[0375] The regular encoder 3033 may perform arithmetic coding on the binary value based on the probability model determined by the context modeler 3032. The context modeler 3032 may provide the probability model for the current binary value to the regular encoder 3033. More specifically, the context modeler 3032 may determine the probability of a preset binary value based on a previously encoded binary value, update the probability of the binary value used to encode the previous binary value, and output the updated probability to the regular encoder 3033.

[0376] According to an embodiment, the context modeler 3032 may determine a context model by using a context index ctxldx, and determine the probability of occurrence of an LPS or MPS of the context model and information valMPS about which one of 0 and 1 corresponds to the MPS. According to another embodiment, the context modeler 3032 may determine the probability of a predetermined preset binary value (P(1) representing the probability of occurrence of, for example, "1") based on a previously decoded binary value, instead of distinguishing between MPS and LPS based on a previously encoded binary value, and provide the probability of the preset binary value to the regular encoder 3033.

[0377] The conventional encoder 3033 may perform binary arithmetic coding based on the probability of the preset binary value provided from the context modeler 3032 and the binary value to be currently encoded. More specifically, the conventional encoder 3033 may determine the probability of occurrence P(1) of "1" and the probability of occurrence P(0) of "0" based on the probability of the preset binary value provided from the context modeler 3032. In addition, the conventional encoder 3033 may divide the preset range representing the probability interval according to the probability of occurrence P(0) of "0" and the probability of occurrence P(1) of "1", and output the binary value of the representative value belonging to the divided interval corresponding to the binary value to be currently encoded, thereby performing binary arithmetic coding.

[0378] The bypass encoder 3034 may fix the occurrence probability P(1) of "1" and the occurrence probability P(0) of "0" to a predetermined value (e.g., 0.5), divide the preset range representing the probability interval according to the occurrence probability P(0) and the occurrence probability P(1), and output the binary value of the representative value belonging to the divided interval corresponding to the binary value to be encoded currently. Unlike the conventional encoder 3033, the bypass encoder 3034 may perform high-speed arithmetic coding because it does not use a context model.

[0379] According to an embodiment, the entropy encoder 3030 may perform arithmetic coding on the first binary value among the binary values ​​corresponding to the weight index based on the context model when entropy coding the weight index, and perform arithmetic coding on the remaining binary values ​​by a bypass method. In other words, the first binary value of the binary string corresponding to the weight index may be arithmetically coded by the conventional encoder 3033, and the remaining binary values ​​may be arithmetically coded by the bypass encoder 3034. The reason may be because: i) when the selection probability of the candidate value indicated by the weight index 0 is the highest, it is effective to arithmetically code the first binary value by accumulating the changes in the probability of 0 and the probability of 1 according to the context model; and ii) because the selection probability of the candidate value indicated by other weight indices other than 0 is lower than the selection probability of the candidate value indicated by the weight index 0, it is more effective to arithmetically code the binary value by the bypass method than to reconstruct the binary value based on the context model.

[0380] Reference Fig.23 It can be seen that the binary value whose binldx is 0 (ie, the first binary value) among the binary values ​​of Bcw_idx representing the weight index is encoded according to the context of 0, and the binary value whose binldx is greater than 0 is encoded by the bypass method.

[0381] The generator 3050 may generate a bitstream including data output from the entropy encoder 3030. As described above, the bitstream may include information for reconstructing the current block.

[0382] Fig.32 is a flowchart illustrating an image encoding method according to an embodiment.

[0383] In operation S3210, the image encoding apparatus 3000 may obtain a first reference block in a first reference image and a second reference block in a second reference image for bidirectional prediction of a current block. The image encoding apparatus 3000 may select a first reference image included in list 0 and a second reference image included in list 1, and determine a first motion vector indicating the first reference block in the first reference image and a second motion vector indicating the second reference block in the second reference image.

[0384] In operation S3220, the image encoding apparatus 3000 may select a candidate value to be used for combining the first reference block with the second reference block from the candidate values ​​included in the weight candidate group. In order to select a candidate value to be applied to the first reference block or the second reference block, the image encoding apparatus 3000 may adaptively determine the number and / or type of candidate values ​​to be included in the weight candidate group for each image, each slice, each tile, or each block.

[0385] In operation S3230, the image encoding apparatus 3000 may perform entropy encoding on a weight index indicating a candidate value selected from among the candidate values ​​included in the weight candidate group. The image encoding apparatus 3000 may encode a first binary value corresponding to the weight index according to a context model, and encode the remaining binary values ​​according to a bypass method.

[0386] In operation S3240, the image encoding apparatus 3000 may generate a bitstream including data generated as a result of entropy encoding. In addition to weight information obtained as a result of arithmetic encoding of the weight index, the bitstream may also include at least one of information indicating a prediction mode of the current block, information indicating a reference image, information indicating a motion vector, and residual data.

[0387] In addition, the embodiments of the present disclosure may be written as a program executable on a computer, and the program may be stored in a medium or a computer program product.

[0388] The medium or computer program product may store the computer executable program continuously, or temporarily store the computer executable program for execution or downloading. In addition, the medium or computer program product may be any of various recording media or storage media combined with single or multiple pieces of hardware, and the medium or computer program product is not limited to those directly connected to a specific computer system, but may be distributed on a network. Examples of medium or computer program products include magnetic media (e.g., hard disks, floppy disks, and tapes) configured to store program instructions, optical recording media (e.g., compact disk read-only memory (CD-ROM) and digital versatile disk (DVD)), magneto-optical media (e.g., floppy disks), read-only memory (ROM), random access memory (RAM), flash memory, etc. In addition, other examples of medium or computer program products include recording media and storage media managed by application stores that distribute applications or by websites, servers, etc. that supply or distribute other various types of software.

[0389] So far, the technical concept of the present disclosure has been described based on the preferred embodiments, however, the technical concept of the present disclosure is not limited to the above embodiments, and a person of ordinary skill in the art can make various modifications and changes within the scope of the technical concept of the present disclosure.

Claims

1. An image decoding method using bidirectional prediction, the image decoding method comprising: obtaining a weight index, information about a first motion vector, and information about a second motion vector from a bitstream; Obtain a first prediction block for bidirectionally predicting a current block by using a first reference image and a first motion vector, and obtain a second prediction block for bidirectionally predicting the current block by using a second reference image and a second motion vector; obtaining a third prediction block by combining the first prediction block with the second prediction block according to a candidate value indicated by the weight index among candidate values ​​included in the weight candidate group; and reconstructing the current block by using the third prediction block, wherein a first binary value corresponding to the weight index is entropy decoded based on a context model, wherein the remaining binary values ​​corresponding to the weight index are entropy decoded by a bypass method, and Wherein, when the picture sequence count POC of the first reference image and the POC of the second reference image are less than or equal to the POC of the current image, the number of candidate values ​​in the weight candidate group that can be indicated by the weight index is greater than the number of candidate values ​​in the weight candidate group that can be indicated by the weight index when the POC of the first reference image and the POC of the second reference image are greater than the POC of the current image.

2. A method for image encoding using bidirectional prediction, the method comprising: Obtain a first prediction block for bidirectionally predicting a current block by using a first reference image and a first motion vector, and obtain a second prediction block for bidirectionally predicting the current block by using a second reference image and a second motion vector; selecting a candidate value for combining the first prediction block with the second prediction block from among candidate values ​​included in the weight candidate group; Obtaining a third prediction block by combining the first prediction block with the second prediction block according to the selected candidate value; performing entropy encoding on a weight index indicating the selected candidate value; and generating a bitstream including an entropy-coded weight index, information about the first motion vector, and information about the second motion vector, wherein a first binary value corresponding to the weight index is entropy encoded based on a context model, wherein the remaining binary values ​​corresponding to the weight index are entropy encoded by a bypass method, and Wherein, when the picture sequence count POC of the first reference image and the POC of the second reference image are less than or equal to the POC of the current image, the number of candidate values ​​in the weight candidate group that can be indicated by the weight index is greater than the number of candidate values ​​in the weight candidate group that can be indicated by the weight index when the POC of the first reference image and the POC of the second reference image are greater than the POC of the current image.

3. A method for sending a bit stream, wherein: The bit stream is generated by the image encoding method according to claim 2.