Apparatus and method for encoding motion vector, and apparatus and method for decoding motion vector

By selecting the motion vector of the adjacent block to predict the motion vector of the current block and combining it with the differential motion vector, the problems of low motion vector prediction accuracy and large differential motion vector size in the prior art are solved, and more efficient image encoding and decoding are achieved.

CN119520820APending Publication Date: 2025-02-25SAMSUNG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411969169.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2021-01-26
Filing Date
2021-01-27
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The prior art is difficult to improve the prediction accuracy of motion vectors in image encoding and decoding, and the size of the differential motion vectors in the bitstream is large, resulting in inefficiency.

Method used

By selecting the first and second adjacent blocks from the adjacent blocks adjacent to the current block, the motion vector of the current block is predicted using their motion vectors, and the predicted motion vector is combined with the differential motion vector to obtain the motion vector of the current block.

Benefits of technology

The prediction accuracy of the motion vector of the current block is improved, and the size of the differential motion vector in the bitstream is reduced, thereby improving the efficiency of encoding and decoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520820A_ABST
    Figure CN119520820A_ABST
Patent Text Reader

Abstract

Disclosed are an apparatus and a method for encoding a motion vector, and an apparatus and a method for decoding a motion vector, and specifically, provided is a method for decoding a motion vector, the method comprising: determining availability of a first neighboring block selected according to information obtained from a bitstream; when the first neighboring block is identified as unavailable by using information indicating availability of the first neighboring block, or a reference picture index of the first neighboring block in the same prediction direction as the prediction direction of the current block is the same as a predetermined value. Obtaining a predicted motion vector of the current block from a motion vector of a second neighboring block at a predetermined position, the second neighboring block being adjacent to the current block; and obtaining a motion vector of the current block by combining the predicted motion vector of the current block with the differential motion vector.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of a patent application with an application date of January 27, 2021, application number 202180027353.9, and invention name “Device and method for encoding motion vectors and device and method for decoding motion vectors”. Technical Field

[0002] The present disclosure relates to the field of image encoding and decoding. More specifically, the present disclosure relates to an apparatus and method for encoding and decoding a current motion vector by using neighboring motion vectors of the current motion vector. 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] Inter-frame prediction is a method of removing temporal redundancy between images to compress images. A representative example of inter-frame prediction is motion estimation coding. Motion estimation coding predicts a block of a current picture by using at least one reference picture. 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 picture to generate pixels in sub-pixel units smaller than integer pixel units, and inter-frame prediction is performed based on the pixels in the sub-pixel units.

[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 motion vector of a block included in a previously encoded image is used to predict a motion vector of the current block. A differential motion vector, which is a difference between the motion vector of the current block and the motion vector of the previously encoded block, is signaled to the decoder side by a preset method. Summary of the invention

[0006] Technical issues

[0007] Provided are an apparatus and method for encoding a motion vector and an apparatus and method for decoding a motion vector, thereby improving the prediction accuracy of the motion vector of a current block.

[0008] Provided are an apparatus and method for encoding a motion vector and an apparatus and method for decoding a motion vector, thereby reducing the size of a differential motion vector included in a bitstream.

[0009] Solution to the problem

[0010] According to an embodiment, a method for decoding a motion vector includes: selecting a first neighboring block from neighboring blocks adjacent to a current block based on information obtained from a bitstream; when the first neighboring block is identified as available by using information indicating the availability of the first neighboring block, and a motion vector of the first neighboring block in a prediction direction that is the same as the prediction direction of the current block does not exist, obtaining a predicted motion vector of the current block from a motion vector of a second neighboring block at a predetermined position, the second neighboring block being adjacent to the current block; and obtaining a motion vector of the current block by combining the predicted motion vector of the current block with a differential motion vector.

[0011] The beneficial effects of disclosure

[0012] In the apparatus and method for encoding a motion vector and the apparatus and method for decoding a motion vector according to an embodiment, the prediction accuracy of the motion vector of the current block may be improved.

[0013] In the apparatus and method for encoding a motion vector and the apparatus and method for decoding a motion vector according to an embodiment, the size of a differential motion vector included in a bitstream may be reduced.

[0014] It should be noted that the effects that can be achieved by the apparatus and method for encoding motion vectors and the apparatus and method for decoding motion vectors according to the embodiments are not limited to those described above, and other effects not mentioned will be obvious to a person of ordinary skill in the art based on the following description. 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 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 according to an embodiment is illustrated.

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

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

[0022] Figure 7 Illustrated is an order in which a plurality of coding units are processed when a plurality of coding units are determined by splitting a current coding unit, according to an embodiment.

[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 according to an embodiment is illustrated.

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

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

[0026] Fig.11 A process of splitting a square coding unit when the division shape pattern information indicates not a division in units of four square coding units according to an embodiment is illustrated.

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

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

[0029] Fig.14 Depth that may be determined based on the shape and 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.16 Coding units of each picture when each picture has different division shape combinations of coding units according to an embodiment are illustrated.

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

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

[0034] Fig.19 It is a block diagram of an image encoding and decoding system.

[0035] Fig. 20 is a block diagram of an image decoding apparatus according to an embodiment.

[0036] Fig.21a Shows the location of neighboring blocks when the left block of the current block is available.

[0037] Figure 21b Shows the positions of neighboring blocks when the left and right blocks of the current block are available.

[0038] Fig.21c Shows the location of neighboring blocks when the right block of the current block is available.

[0039] Fig. 22 is a table showing the matching relationship between the index of the motion vector resolution, the motion vector resolution, and the position of the neighboring block.

[0040] Fig.23a A case where the reference picture index of the first neighboring block in the same prediction direction as that of the current block is different from a predetermined value is shown.

[0041] Figure 23b A case where the reference picture index of the first neighboring block in the same prediction direction as that of the current block is the same as a predetermined value is shown.

[0042] Fig.23c It shows a case where, when the prediction direction of the current block is bidirectional, one of the reference picture index of the first neighboring block in the list 0 direction and the reference picture index of the first neighboring block in the list 1 direction is the same as a predetermined value, and the other is different from the predetermined value.

[0043] Fig.24 is a flowchart of a method of decoding a motion vector according to an embodiment.

[0044] Fig.25 is a block diagram of an image encoding apparatus according to an embodiment.

[0045] Fig.26 is a flowchart of a method of encoding a motion vector according to an embodiment.

[0046] Fig. 27 is a view for explaining a process of obtaining a predicted motion vector according to an embodiment.

[0047] Fig.28is a view for explaining a process of obtaining a predicted motion vector according to an embodiment. DETAILED DESCRIPTION

[0048] Best Practices

[0049] According to an embodiment, a method for decoding a motion vector includes: selecting a first neighboring block from neighboring blocks adjacent to a current block based on information obtained from a bitstream; when the first neighboring block is identified as available by using information indicating the availability of the first neighboring block, and a motion vector of the first neighboring block in a prediction direction that is the same as the prediction direction of the current block does not exist, obtaining a predicted motion vector of the current block from a motion vector of a second neighboring block at a predetermined position, the second neighboring block being adjacent to the current block; and obtaining a motion vector of the current block by combining the predicted motion vector of the current block with a differential motion vector.

[0050] When the reference picture index of the first neighboring block in the same prediction direction as that of the current block is -1, the motion vector of the first neighboring block in the same prediction direction as that of the current block may not exist.

[0051] The availability of the first neighboring block may be determined based on at least one of whether a parallel block including the first neighboring block is different from a parallel block including the current block, whether the first neighboring block is located outside the current picture, whether the first neighboring block has been intra-predicted, and whether the first neighboring block has been reconstructed.

[0052] Obtaining the predicted motion vector of the current block may include: when the first neighboring block is identified as available by using information indicating availability of the first neighboring block, and a motion vector of the first neighboring block in a prediction direction that is the same as a prediction direction of the current block exists, obtaining the predicted motion vector of the current block from the motion vector of the first neighboring block.

[0053] The information obtained from the bitstream may include information indicating a motion vector resolution of the current block among a plurality of motion vector resolutions, and the plurality of motion vector resolutions may be mapped to neighboring blocks at different positions.

[0054] The position of the second neighboring block may vary according to information indicating availability of left and right neighboring blocks of the current block.

[0055] Obtaining the predicted motion vector of the current block may include: when the second neighboring block is identified as available by using information indicating the availability of the second neighboring block, and a reference picture index of the second neighboring block in a prediction direction that is the same as a prediction direction of the current block is the same as a reference picture index of the current block or a motion vector of the second neighboring block in the prediction direction that is the same as the prediction direction of the current block exists, obtaining the predicted motion vector of the current block from the motion vector of the second neighboring block.

[0056] Obtaining the predicted motion vector of the current block may include: when the second neighboring block is identified as unavailable by using information indicating availability of the second neighboring block, or a motion vector of the second neighboring block in a prediction direction that is the same as a prediction direction of the current block does not exist, obtaining the predicted motion vector of the current block from a motion vector of a block decoded before the current block.

[0057] Obtaining the predicted motion vector of the current block may include obtaining the predicted motion vector of the current block from a motion vector of a second neighboring block when the first neighboring block is identified as unavailable.

[0058] According to an embodiment, an image decoding device includes: a motion vector prediction unit configured to select a first neighboring block from neighboring blocks adjacent to a current block based on information obtained from a bit stream, and when the first neighboring block is identified as available by using information indicating the availability of the first neighboring block and a motion vector of the first neighboring block in a prediction direction that is the same as the prediction direction of the current block does not exist, obtain a predicted motion vector of the current block from a motion vector of a second neighboring block at a predetermined position, the second neighboring block being adjacent to the current block; and a motion vector reconstruction unit configured to obtain a motion vector of the current block by combining the predicted motion vector of the current block with a differential motion vector.

[0059] According to an embodiment, a method for encoding a motion vector includes: when a first neighboring block selected from neighboring blocks adjacent to a current block is identified as available and a motion vector of the first neighboring block in a prediction direction that is the same as a prediction direction of the current block does not exist, obtaining a predicted motion vector of the current block from a motion vector of a second neighboring block at a predetermined position, the second neighboring block being adjacent to the current block; and generating a bit stream including a differential motion vector between the motion vector of the current block and the predicted motion vector of the current block and information indicating the first neighboring block.

[0060] Public method

[0061] Since the present disclosure allows various changes and many embodiments, specific embodiments will be shown in the drawings and described in detail in the written description. However, this is not intended to limit the present disclosure to a specific mode of practice, and it will be understood that all changes, equivalents and substitutions that do not depart from the spirit and technical scope of the present disclosure are included in the present disclosure.

[0062] In the description of the embodiments of the present disclosure, when it is considered that a specific detailed explanation of the related art may unnecessarily obscure the essence of the present disclosure, the specific detailed explanation of the related art is omitted. Although terms (such as "first", "second", etc.) can be used to describe various components, these components are not necessarily limited to the above terms. The above terms are only used to distinguish one component from another component.

[0063] When an element (for example, a first element) is “coupled to” or “connected to” another element (for example, a second element), the first element may be directly coupled to or connected to the second element, or a third element may be present therebetween unless otherwise described.

[0064] Regarding components represented as "parts (units)" or "modules" used herein, 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 of the functions performed by another component in addition to its own main functions, and some of the main functions of each component may be completely performed by another component.

[0065] Furthermore, "image" or "picture" used herein may refer to a still image or a moving picture (video) of a video.

[0066] In addition, "sample" or "signal" used herein refers to data to be processed as 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 such one or more samples may be defined as a block.

[0067] In the following, reference will be made to Figures 1 to 19 An image encoding method and apparatus and an image decoding method and apparatus based on coding units and transformation units having a tree structure according to an embodiment are described.

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

[0069] 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. The bitstream obtainer 110 and the decoder 120 may include a memory storing instructions to be executed by the at least one processor.

[0070] The bitstream obtainer 110 may receive a bitstream. The bitstream may include information encoded by an image of the image encoding device 200 to be described later. 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.

[0071] Describing the operation of the image decoding apparatus 100 in detail, the bitstream obtainer 110 may receive a bitstream.

[0072] The image decoding apparatus 100 may perform an operation of obtaining a binary bit string corresponding to a division shape pattern of a coding unit from a bitstream. The image decoding apparatus 100 may perform an operation of determining a division rule of a coding unit. The image decoding apparatus 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 a division shape pattern and a division rule. The image decoding apparatus 100 may determine a first range as an allowable size range of a 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 apparatus 100 may determine a second range as an allowable size range of a coding unit according to a division shape pattern of the coding unit in order to determine the division rule.

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

[0074] 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)). According to an implementation example, a slice includes one or more tiles, or a slice may include one or more maximum coding units. A slice including one tile or multiple tiles may be determined within a picture.

[0075] There is a maximum coding block (coding tree block (CTB)) which is conceptually comparable to a maximum coding unit (CTU). 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.

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

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

[0078] 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 luma samples and 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 samples of the picture.

[0079] As described above, the maximum coding block and the maximum coding unit are conceptually distinguished from each other, and the coding block and the coding unit are conceptually distinguished from each other. In other words, the (maximum) coding unit refers to a data structure including a (maximum) coding block containing corresponding samples and a syntax element corresponding to the (maximum) coding block. However, because a person of ordinary skill in the art understands that a (maximum) coding unit or a (maximum) coding block refers to 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 description without distinction.

[0080] 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 embodiments of the present disclosure are not limited thereto.

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

[0082] 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 refer to 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.

[0083] According to an embodiment, since information about the maximum size of a binary-dividable brightness coding block is obtained from a bitstream, the maximum size of a binary-dividable brightness coding block can be variably determined. In contrast, the maximum size of a ternary-dividable brightness coding block can be fixed. For example, the maximum size of a ternary-dividable brightness coding block in an I picture can be 32×32, and the maximum size of a ternary-dividable brightness coding block in a P picture or a B picture can be 64×64.

[0084] The maximum coding unit may be hierarchically split into coding units based on the split shape pattern information obtained from the bitstream. At least one of information indicating whether to perform quadruple splitting, information indicating whether to perform multi-splitting, split direction information, and split type information may be obtained from the bitstream as the split shape pattern information.

[0085] For example, the information indicating whether quad splitting is performed may indicate whether the current coding unit is quad split (QUAD_SPLIT) or not quad split.

[0086] When the current coding unit is not quadripartitioned, the information indicating whether multi-split is performed may indicate whether the current coding unit is no longer split (NO_SPLIT) or is binary / ternary split.

[0087] When the current coding unit is binary-split or ternary-split, the split direction information indicates that the current coding unit is split in one direction of a horizontal direction and a vertical direction.

[0088] When the current coding unit is split in the horizontal direction or the vertical direction, the split type information indicates whether the current coding unit is binary-split or ternary-split.

[0089] 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 binary-split in the horizontal direction may be determined as a binary horizontal split mode (SPLIT_BT_HOR), the split mode when the current coding unit is ternary-split in the horizontal direction may be determined as a ternary horizontal split mode (SPLIT_TT_HOR), the split mode when the current coding unit is binary-split in the vertical direction may be determined as a binary vertical split mode (SPLIT_BT_VER), and the split mode when the current coding unit is ternary-split in the vertical direction may be determined as a ternary vertical split mode (SPLIT_TT_VER).

[0090] 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 perform quadruple division on the coding unit, whether to not divide the coding unit, the division direction, and the division type based on a binary bit string.

[0091] The coding unit may be smaller than or equal to 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 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 and the coding unit may not be distinguished. Reference will be made to Figures 3 to 16 The division of coding units is described in detail.

[0092] In addition, one or more prediction blocks for prediction may be determined from the coding unit. The prediction block may be equal to or smaller than the coding unit. In addition, one or more transform blocks for transformation may be determined from the coding unit. The transform block may be equal to or smaller than the coding unit.

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

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

[0095] 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 transformation 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, upper, upper right, right side, and lower right side of the current block.

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

[0097] 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, an aspect ratio, or a size of a coding unit.

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

[0099] 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 aspect ratio in the block shape information of the coding unit as at least one of 1:2, 2:1, 1:4, 4:1, 1:8, 8:1, 1:16, 16:1, 1:32, and 32:1. In addition, the image decoding apparatus 100 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.

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

[0101] 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 a quadruple division. In addition, the image decoding device 100 may determine the division shape pattern information about the minimum coding unit as "no division is performed". In detail, the image decoding device 100 may determine that the size of the maximum coding unit is 256×256. The image decoding device 100 may determine the pre-agreed division shape pattern information as a quadruple division. Quadruple division is a division shape pattern in which the width and height of the coding unit are both divided into two equal parts. 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. Also, the image decoding apparatus 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” with respect to the minimum coding unit.

[0102] 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 not split the square coding unit, whether to vertically split the square coding unit, whether to horizontally split the square coding unit, 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 unit 310b, 310c, 310d, 310e or 310f divided based on the division shape pattern information indicating a preset division method.

[0103] 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 and horizontal directions 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 ternary division is 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 ternary division is 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. A preset division method for dividing a square coding unit will be described in detail below with respect to various embodiments.

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

[0105] 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. The image decoding apparatus 100 may determine whether to not split the non-square current coding unit or whether to split the non-square current coding unit by using a preset splitting method based on the splitting shape pattern information. 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 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.

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

[0107] 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 in consideration of 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 in a direction in which the long side of the current coding unit 400 or 450 is split in consideration of the shape of the current coding unit 400 or 450.

[0108] According to an embodiment, when the division shape pattern information indicates that the coding unit is divided (ternary division) into an odd number of blocks, the image decoding apparatus 100 may determine the 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.

[0109] According to an embodiment, the ratio of the width and height of the current coding unit 400 or 450 may be 4:1 or 1:4. When the ratio of the width and the height is 4:1, because the width length is longer than the height length, the block shape information may indicate the horizontal direction. When the ratio of the width and the height is 1:4, because the width length is shorter than the height length, the block shape information may indicate the vertical direction. The image decoding device 100 may determine the current coding unit to be divided into an odd number of blocks based on the division shape mode information. In addition, the image decoding device 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 along the vertical direction, the image decoding device 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.

[0110] 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 determined coding units may have the same size. For example, a preset coding unit 430b or 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 unit determined by dividing the current coding unit 400 or 450 may have a plurality of sizes, and in some cases, all odd number of coding units 430a, 430b, and 430c or 480a, 480b, and 480c may have different sizes.

[0111] 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 480b to be different from a decoding process of other coding units 430a and 430c or 480a and 480c, wherein the coding unit 430b or 480b is located at the center of three coding units 430a, 430b, and 430c or 480a, 480b, and 480c generated by dividing the current coding unit 400 or 450. 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 480b at the center position from being further divided or being divided only a preset number of times.

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

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

[0114] 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 at least one of the block shape information and 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 (e.g., 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.

[0115] Reference Figure 5 , a preset coding unit (e.g., a coding unit located at a central position or a square coding unit) 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, a non-square third coding unit 520b 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. A non-square fourth coding unit 530b or 530d in a plurality of fourth coding units 530a, 530b, 530c, and 530d may be divided into a plurality of coding units again. For example, a non-square fourth coding unit 530b or 530d may be divided into an odd number of coding units again. A method for recursively dividing coding units will be described below with respect to various embodiments.

[0116] 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 set number of times.

[0117] Reference Figure 5 , 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 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.

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

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

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

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

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

[0123] 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 intermediate coding unit 620b or the intermediate coding unit 660b by using information about the positions of the odd number of coding units 620a, 620b, and 620c or the odd number of coding units 660a, 660b, and 660c. For example, the image decoding 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.

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

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

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

[0127] 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 size of each of the coding units 620a, 620b, and 620c by using the coordinates (xa, ya), (xb, yb), and (xc, yc) indicating the positions of the coding units 620a, 620b, and 620c. According to an embodiment, the image decoding apparatus 100 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 sizes 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-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.

[0128] 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 size of each of the coding units 660a, 660b, and 660c by using the coordinates (xd, yd), (xe, ye), and (xf, yf) indicating the positions of the coding units 660a, 660b, and 660c.

[0129] According to an embodiment, the image decoding device 100 may determine the width of the left coding unit 660a as xe-xd. The image decoding device 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 device 100 may determine the width of the middle coding unit 660b as xf-xe. The image decoding device 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 device 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 device 100 may determine a coding unit whose size is different from that of other coding units based on the determined width and height of the coding units 660a, 660b, and 660c. Refer 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.

[0130] However, the position of the sample considered in 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.

[0131] 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 along the horizontal direction. That is, the image decoding apparatus 100 may determine one of the coding units at different positions along 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 along the vertical direction. That is, the image decoding apparatus 100 may determine one of the coding units at different positions along the vertical direction and may impose restrictions on the coding unit.

[0132] 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 (binary division) 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 the coding unit at a preset position (eg, a center position) among the odd-numbered coding units corresponds to the operation described in detail, and thus a detailed description thereof is not provided here.

[0133] According to an embodiment, when a non-square current coding unit is split 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 splitting 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 splitting the current coding unit using at least one of block shape information and split shape pattern information stored in samples included in an intermediate coding unit in a splitting operation.

[0134] 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 where 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 the coding unit at the center position may be determined using various types of information.

[0135] 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 a sample included in the coding unit 620b to be determined as subject to restriction.

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

[0137] According to an embodiment, when a current coding unit is divided into a plurality of coding units, the image decoding device 100 may use division shape pattern information to determine a coding unit at a preset position in the plurality of coding units. According to an embodiment, the image decoding device 100 may obtain division shape pattern information from a sample at a preset position in a coding unit, and may divide a plurality of coding units generated by dividing the current coding unit by using the division shape pattern information, wherein the division shape pattern information is obtained from a sample at a 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, wherein the division shape pattern information is obtained from a sample at a 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.

[0138] 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 (for example, the current coding unit).

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

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

[0141] 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 the second coding units 750a, 750b, and 750d determined by dividing the first coding unit 700 in the vertical direction and the horizontal direction according to a preset order (e.g., a raster scan order or a zigzag scan order 750e), wherein the coding units in one row are processed and then the coding units in the next row are processed.

[0142] 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 splitting the first coding unit 700 in a vertical direction, and may determine whether to independently split or not split each of the second coding units 710a and 710b.

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

[0144] 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 coding units after the division may be determined based on the processing order of the coding units immediately before the division. 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 splitting is not limited to the above example, and coding units split and determined to be various shapes may be independently processed in a preset order using various methods.

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

[0146] 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 to 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, 820d, and 820e.

[0147] According to an embodiment, the video decoding apparatus 100 may determine whether any coding unit is split into an odd number of coding units by determining whether the third coding units 820a and 820b and 820c, 820d, and 820e can be processed in a preset order. 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 information: the first coding unit 800, the second coding units 810a and 810b, or the third coding units 820a and 820b and 820c, 820d, and 820e. For example, the 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.

[0148] 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 fail to 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. The restriction or the preset position has been described above with respect to various embodiments, and therefore a detailed description thereof will not be provided herein.

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

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

[0151] 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 determine that the scanning order is not continuous, and may determine that the first coding unit 900 will 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. The restriction or the preset position has been described above with respect to various embodiments, and thus a detailed description thereof will not be provided herein.

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

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

[0154] 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 by splitting the first coding unit 1000 by the image decoding apparatus 100 satisfies a preset condition according to an embodiment.

[0155] 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. In this way, 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, based on the division shape pattern information of 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 limit the right second coding unit 1010b to not be 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.

[0156] 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 horizontally splitting the first coding unit 1000. 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 limit another second coding unit (e.g., the lower second coding unit 1020b) to not be split in the vertical direction in which the upper second coding unit 1020a is split for the above-mentioned reason.

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

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

[0159] 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 the division method may correspond to the method of dividing the first coding unit 1100 based on the division shape pattern information.

[0160] 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, coding units having the same shape as the four square second coding units 1130a, 1130b, 1130c, and 1130d divided from the first coding unit 1100 may be determined.

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

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

[0163] According to an embodiment, the image decoding apparatus 100 may divide the first coding unit 1200 based on the division shape pattern information. When the block shape indicates a square shape and the division shape pattern 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, etc. 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 may be independently divided based on the division shape pattern information of each coding unit. For example, the image decoding device 100 may 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 may 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.

[0164] According to an embodiment, the image decoding apparatus 100 may process the coding units in a preset order. Figure 7The operation of processing the encoding units in a preset order is described, and thus a detailed description thereof will not be provided herein. 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.

[0165] 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 can process the third coding units 1216a, 1216b, 1216c and 1216d 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.

[0166] 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 can process the third coding units 1226a, 1226b, 1226c and 1226d 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.

[0167] 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 the third coding units 1226a, 1226b, 1226c, and 1226d split from the second coding units 1210a and 1210b and the second coding units 1220a and 1220b ultimately show the same shape of coding units split from the first coding unit 1200. In this way, by recursively splitting the coding units in different ways based on the split shape pattern information, even if the coding units are ultimately determined to be the same shape, the image decoding apparatus 100 may process a plurality of coding units in different orders.

[0168] Fig.13 A process of determining a depth of a coding unit when a shape and a size of a coding unit are changed when a coding unit is recursively split to determine a plurality of coding units according to an embodiment is illustrated.

[0169] According to an embodiment, the image decoding apparatus 100 may determine the depth of the coding unit based on a preset standard. For example, the preset standard 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 current coding unit after being divided, the image decoding apparatus 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 lower depth.

[0170] 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 lower depth by dividing a 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.

[0171] According to an embodiment, the image decoding device 100 can determine the second coding unit 1312 or 1322 of the lower depth, and the third coding unit 1314 or 1324 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).

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

[0173] According to an embodiment, the image decoding apparatus 100 may determine the second coding unit 1302, 1312, or 1322 by dividing at least one of the width and the height of the first coding unit 1320 having a size of 2N×N. That is, the image decoding apparatus 100 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 dividing 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 dividing the first coding unit 1320 in horizontal and vertical directions.

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

[0175] 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 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 dividing 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 dividing the second coding unit 1312 in a vertical direction and a horizontal direction.

[0176] 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 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 dividing 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 dividing the second coding unit 1322 in a vertical direction and a horizontal direction.

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

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

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

[0180] 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, the second coding units 1404a and 1404b, and the second coding units 1406a, 1406b, 1406c, and 1406d by dividing the first coding unit 1400 in at least one of 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.

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

[0182] 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 horizontally dividing the first coding unit 1410 whose height is longer than the width 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 vertically dividing the first coding unit 1420 whose width is longer than the height based on the division shape pattern information.

[0183] According to an embodiment, the depth of the second coding units 1412a and 1412b and 1414a, 1414b and 1414c, or 1422a and 1422b and 1424a, 1424b and 1424c determined based on the 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 whose height is longer than the 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.

[0184] 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 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 coding units split from the first coding unit 1410 .

[0185] According to an embodiment, when the odd-numbered split coding units do not have equal sizes, the image decoding apparatus 100 may determine a PID for identifying the split 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 odd-numbered divided 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 at a position adjacent to the coding unit 1414b may increase by 2 and may thus 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 odd-numbered divided coding units do not have equal sizes based on whether there is discontinuity in the PID for identifying the divided coding units.

[0186] 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 a corresponding coding unit in order to identify the corresponding coding unit. According to an embodiment, the PID may be obtained from a sample point at a preset position of each coding unit (e.g., an upper left sample point).

[0187] 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 odd-numbered divided coding units to determine a coding unit at a center position among the coding units. The image decoding apparatus 100 may determine the coding unit 1414b corresponding to the PID and the intermediate value among the PIDs of the coding units as the coding unit at the 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 thereof 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 at the adjacent position 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, wherein the plurality of coding units include coding units having sizes different from those of the 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.

[0188] According to an embodiment, the image decoding apparatus 100 may use a preset data unit in which the coding unit is recursively split starting from the preset data unit.

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

[0190] According to an embodiment, a preset data unit may be defined as a data unit for recursively dividing a coding unit starting by using division 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 divided from a current picture. In the following description, for ease of explanation, a preset data unit is referred to as a reference data unit.

[0191] According to an embodiment, the reference data unit may have a preset size and a preset size shape. According to an embodiment, the reference data 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.

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

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

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

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

[0196] 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 the 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 the slice, slice segment, tile, tile group, 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 size and shape of the reference coding unit corresponding to the PID for identifying the size or shape of the reference coding unit may be predetermined. That is, the image decoding apparatus 100 may determine at least one of the size and shape of the reference coding unit included in the data unit serving as the unit for obtaining the PID by selecting at least one of the size and shape of the reference coding unit predetermined based on the PID.

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

[0198] 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 or each reference coding unit, and may use the obtained syntax element.

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

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

[0201] 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, aspect ratio, 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 embodiments of the present disclosure are 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.

[0202] 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 that the shape of the coding unit is a square. In addition, when the width length and height length of the coding unit are different, the image decoding apparatus 100 may determine that the shape of the coding unit is a non-square.

[0203] The size of the coding unit may include various sizes such as 4×4, 8×4, 4×8, 8×8, 16×4, 16×8, and up 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 apparatus 100 may apply the same division rule to the coding units classified into the same group. For example, the image decoding apparatus 100 may classify the coding units having the same long side length as having the same size. In addition, the image decoding apparatus 100 may apply the same division rule to the coding units having the same long side length.

[0204] The aspect ratio 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.

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

[0206] The division rule determined based on the size of the coding unit may be a division rule predetermined 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.

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

[0208] In addition, the image decoding apparatus 100 may determine a 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 the same block shape. The coding units generated via different division paths may have different decoding processing orders. Fig.12 The decoding process order is described, so its details are not provided again.

[0209] Fig.16 Coding units of each picture when each picture has different division shape combinations of coding units according to an embodiment are illustrated.

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

[0211] According to an embodiment, the bitstream obtainer 110 of the image decoding device 100 may obtain a bitstream including an index, wherein the index represents a combination of division shape information for each preset data unit (e.g., sequence, picture, slice, slice segment, tile, 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 device 100 may use the obtained index to determine, for each preset data unit, a combination of division shapes into which a coding unit may be divided, and thus, the bitstream obtainer 110 may use different division shape combinations for each preset data unit.

[0212] Fig.17 Various shapes of coding units that may be determined based on division shape pattern information that may be represented as a binary code table according to an embodiment are illustrated.

[0213] 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 through the bitstream obtainer 110. The shape into which the coding unit may be split may be various shapes including the shapes described above through the embodiment.

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

[0215] 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 as a 2-bit 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.

[0216] 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.17 According to an embodiment, the image decoding device 100 may divide a coding unit having a non-square shape into at most 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.

[0217] According to the embodiment, referring to Fig.17 , the binary code of the division shape mode 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 mode information indicating that the coding unit is not divided is set to (00)b, although there is no division shape mode information set to (01)b, it may be necessary to use the binary code of the division shape mode information of 2 bits in total. However, Fig.17As shown in FIG. 1 , in the case where three division shapes are used for a coding unit having a non-square shape, the image decoding apparatus 100 can 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 a bit stream. 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.17 The three shapes shown should be interpreted as including various shapes of the above-mentioned embodiments.

[0218] Fig.18 It is shown that other shapes of coding units according to an embodiment may be determined based on division shape pattern information that may be represented by a binary code.

[0219] Reference Fig.18 , the image decoding device 100 may divide the coding unit having a square shape in the horizontal direction or the vertical direction, and divide the coding unit having a non-square shape in the horizontal direction or the vertical direction based on the division shape pattern information. That is, the division shape pattern information may indicate that the coding unit having 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 having 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 there is no division shape pattern information set to (01)b, the binary code of the 2-bit division shape pattern information may need to be used. However, as Fig.18 As shown in FIG. 1 , in the case where three division shapes are used for the coding unit having a square shape, the image decoding apparatus 100 can 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.18 The three shapes shown should be interpreted as including various shapes of the above-mentioned embodiments.

[0220] 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 immediately generated as a bit stream. In addition, the block shape information or division shape mode information that can be represented by a binary code can be used as a binary code input in context adaptive binary arithmetic coding (CABAC) without being immediately generated as a bit stream.

[0221] The process of obtaining the syntax of 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 syntax through the bitstream obtainer 110. The image decoding device 100 may detect a syntax element representing block shape information or division shape mode information by debinarizing the binary bit string included in the obtained bitstream. According to an embodiment, the image decoding device 100 may obtain a set of binary 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 previously obtained binary bit strings. The image decoding device 100 may perform debinarization on the binary bit string to determine the syntax element.

[0222] 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.17 According to an embodiment, the bitstream obtainer 110 of the image decoding device 100 may obtain a bitstream indicating a binary code representing 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 for 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 next binary bit will have a value of 0 or 1 when decoding, depending on which of 0 or 1 the value of the first binary bit in the 2-bit binary code is.

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

[0224] Reference Fig.17, in the process of determining the syntax by using the binary bit string representing the division shape mode information of 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 the case where the coding unit having the 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 the case where the coding unit having the 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 the 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 of the division shape mode information of the coding unit having the 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. As described above, since the division shape mode information representing that the coding unit having the non-square shape is not divided may be represented by a binary bit string of 1 bit having a value of 0, the image decoding apparatus 100 may determine the syntax for the division shape mode information by determining whether the second binary bit is 0 or 1 only in the case where the first binary bit of the division shape mode information is 1. According to an embodiment, when the first binary bit of 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.

[0225] Therefore, the image decoding apparatus 100 may use various probabilities for each binary bit in the process of determining the binary bit of the binary bit string for the division shape pattern information. According to an embodiment, the image decoding apparatus 100 may determine different probabilities for the binary bit of the division shape pattern information according to the width of the current coding unit or the length of the long side of the current coding unit. According to an embodiment, the image decoding apparatus 100 may determine different probabilities for the binary bit of the division shape pattern information according to at least one of the shape of the current coding unit and the length of the long side of the current coding unit. According to an embodiment, the image decoding apparatus 100 may determine different probabilities for the binary bit of the division shape pattern information according to at least one of the shape of the current coding unit and the length of the long side of the current coding unit.

[0226] According to an embodiment, the image decoding apparatus 100 may determine that the probability of the binary bits for the division shape pattern information is the same for coding units equal to or greater than a preset size. For example, the image decoding apparatus 100 may determine that the probability of the binary bits for the division shape pattern information is the same for coding units whose long sides have a length equal to or greater than 64 samples.

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

[0228] Fig.19 It is a block diagram of an image encoding and decoding system.

[0229] The encoder 1900 of the image encoding and decoding system may transmit an encoded bitstream of an image, and the decoder 1950 of the image encoding and decoding system may receive and decode the bitstream to output a reconstructed image. Here, the decoder 1950 may be a configuration similar to the image decoding apparatus 100.

[0230] In the encoder 1900, when the prediction mode of the current block is the inter prediction mode, the inter predictor 1905 generates motion information of the current block indicating a reference block of a reference picture temporally adjacent to the current picture. The inter predictor 1905 may determine the prediction sample of the current block by using the sample of the reference block. In order to determine the prediction sample of the current block by using the neighboring samples spatially adjacent to the current block, the intra predictor 1910 may determine the intra prediction information indicating the direction in which the neighboring samples similar to the current block are located or the method of determining the prediction sample.

[0231] The inter-frame predictor 1905 may determine reference samples to be used to predict the current block from pre-reconstructed samples stored in a decoded picture buffer (DPB) 1948 .

[0232] The transformer 1920 outputs a transform coefficient by performing a transform on a residual sample value obtained by subtracting a predicted sample generated by the inter predictor 1905 or the intra predictor 1910 from an original sample of the current block. The quantizer 1925 quantizes the transform coefficient output by the transformer 1920 to output a quantized transform coefficient. The entropy encoder 1930 may encode the quantized transform coefficient into a residual syntax element including a level value to output the quantized transform coefficient in the form of a bitstream.

[0233] The quantized transform coefficients output by the quantizer 1925 may be dequantized and inversely transformed by the dequantizer 1933 and the inverse transformer 1935 , and thus, residual sample values ​​may be generated again.

[0234] The adder adds the residual sample value to the predicted sample value to output the reconstructed sample value. The post-reconstruction filter 1940 may perform post-reconstruction filtering on the reconstructed sample, and the reconstructed sample updated by the post-reconstruction filtering may be used as a reference sample value for intra prediction to be performed in the intra predictor 1910. The post-reconstruction filter 1940 may perform Hadamard transform domain filtering or bilateral filtering on the reconstructed sample value.

[0235] The in-loop filter 1945 may perform at least one of deblocking filtering and adaptive loop filtering on the reconstructed sample updated by the post-reconstruction filtering. The reconstructed sample values ​​updated by the filtering of the in-loop filter 1945 may be stored in the DPB 1948 and may be used as reference sample values ​​for inter-frame prediction to be performed by the inter-frame predictor 1905.

[0236] The entropy decoder 1955 of the decoder 1950 may parse the residual syntax element including the level value by performing entropy decoding on the received bitstream. The entropy decoder 1955 may reconstruct the quantized transform coefficient from the residual syntax element. The dequantizer 1960 may output the transform coefficient by performing dequantization on the quantized transform coefficient, and the inverse transformer 1965 may output the residual sample value by performing inverse transformation on the transform coefficient.

[0237] The inter-frame predictor 1970 of the decoder 1950 may determine a reference picture temporally adjacent to the current picture by using the motion information of the current block parsed by the entropy decoder 1955, and may determine a reference block within the reference picture. The inter-frame predictor 1970 may determine a prediction sample of the current block by using a sample of the reference block. The intra-frame predictor 1975 of the decoder 1950 may determine a reference sample spatially adjacent to the current block by using the intra-frame motion information and the motion information of the current block parsed by the entropy decoder 1955, and may determine a prediction sample of the current block by using the determined neighboring samples.

[0238] The inter predictor 1970 may determine reference samples to be used to predict the current block from pre-reconstructed samples stored in a decoded picture buffer (DPB) 1990 .

[0239] The adder 1995 of the decoder 1950 adds the residual sample value to the predicted sample value to output the reconstructed sample value of the current block. The post-reconstruction filter 1980 of the decoder 1950 may perform Hadamard transform domain filtering or bilateral filtering on the reconstructed sample value. The reconstructed sample updated by the post-reconstruction filtering of the post-reconstruction filter 1980 may be used as a reference sample value for intra prediction to be performed in the intra predictor 1975.

[0240] The in-loop filter 1985 of the decoder 1950 may perform at least one of deblocking filtering and adaptive loop filtering on the reconstructed samples updated by the post-reconstruction filtering. The reconstructed sample values ​​updated by the filtering of the in-loop filter 1985 may be stored in the DPB 1990 and may be used as reference sample values ​​for inter-frame prediction to be performed by the inter-frame predictor 1970.

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

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

[0243] 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, an incremental QP, a reference index, a prediction direction, or 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, an aspect ratio, or a size of a coding unit.

[0244] 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. The image encoding apparatus 200 may transmit the bitstream to the image decoding apparatus 100.

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

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

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

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

[0249] 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, aspect ratio, or size of the coding unit. 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.

[0250] In order to determine the context model, the image encoding apparatus 200 may obtain an arrangement 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 from the arrangement based on at least one of the shape, direction, aspect ratio, or size of the coding unit. The image encoding apparatus 200 may determine the context model based on the index of the context model.

[0251] 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, an aspect ratio, or a size of a surrounding coding unit adjacent to the coding unit. The surrounding coding unit may include at least one of coding units located at the lower left, left, upper left, above, upper right, right, or lower right of the coding unit.

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

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

[0254] Fig. 20 is a block diagram showing a structure of an image decoding apparatus 2000 according to an embodiment.

[0255] Reference Fig. 20, the image decoding apparatus 2000 may include a bitstream obtainer 2010 and a prediction decoder 2030. The prediction decoder 2030 includes a motion vector prediction unit 2032 and a motion vector reconstruction unit 2034.

[0256] Fig. 20 The bitstream obtainer 2010 shown in FIG. Figure 1 The bitstream obtainer 110 shown in FIG. 2 corresponds to the bitstream obtainer 110 shown in FIG. 2 , and the prediction decoder 2030 can be connected to Figure 1 The decoder 120 shown in FIG.

[0257] According to an embodiment, the bitstream obtainer 2010 and the prediction decoder 2030 may be implemented as at least one processor. The image decoding apparatus 2000 may include one or more memories (not shown) for storing input and output data of the bitstream obtainer 2010 and the prediction decoder 2030. The image decoding apparatus 2000 may include a memory controller (not shown) for controlling data input and output of the memory (not shown).

[0258] The bitstream obtainer 2010 obtains a bitstream as a result of picture encoding. The bitstream obtainer 2010 obtains syntax elements for decoding the picture from the bitstream. Binary values ​​corresponding to the syntax elements may be included in the bitstream according to the hierarchical structure of the picture. The bitstream obtainer 2010 may obtain the syntax elements by entropy decoding the binary values ​​included in the bitstream.

[0259] The bitstream may include information about a prediction mode of a current block within a current picture. The current block may refer to a block of a maximum coding unit, a coding unit, or a transformation unit split from a current picture desired to be decoded.

[0260] The prediction mode of the current block may include an intra prediction mode or an inter prediction mode. As described above, the inter prediction mode is a mode of reconstructing the current block by a reference block indicated by a motion vector of the current block within a reference picture.

[0261] The prediction decoder 2030 may reconstruct the current block by using intra prediction or inter prediction according to a prediction mode of the current block.

[0262] In the inter prediction mode, motion information may be used to reconstruct the current block. The motion information of the current block may include a prediction direction, a reference picture index, and a motion vector of the current block. The prediction direction, reference picture index, and motion vector of the current block may be confirmed from information included in the bitstream.

[0263] The prediction direction of the current block may be one of a list 0 direction, a list 1 direction, and a bidirectional direction. The prediction direction of the list 0 direction means using a picture included in the reference picture list 0 as a reference picture in the list 0 direction, and the prediction direction of the list 1 direction means using a picture included in the reference picture list 1 as a reference picture in the list 1 direction. The prediction direction of the bidirectional direction means using a picture included in the reference picture list 0 as a reference picture in the list 0 direction and using a picture included in the reference picture list 1 as a reference picture in the list 1 direction.

[0264] The reference picture index indicates a picture used as a reference picture of a block from among pictures included in the reference picture list 0 and / or the reference picture list 1. According to the reference picture index in the list 0 direction, a picture used as a reference picture of the reference picture list 0 is specified from among pictures included in the list 0 direction. According to the reference picture index in the list 1 direction, a picture used as a reference picture of the reference picture list 1 is specified from among pictures included in the list 1 direction.

[0265] The motion vector specifies the position of the reference block within the reference picture. The motion vector in the list 0 direction indicates the motion vector of the reference block within the reference picture in the list 0 direction, and the motion vector in the list 1 direction indicates the motion vector of the reference block within the reference picture in the list 1 direction.

[0266] When the prediction direction of the current block is the list 0 direction, the motion information of the current block includes at least one of information indicating that the prediction direction of the current block is the list 0 direction, a reference picture index in the list 0 direction, and a motion vector in the list 0 direction. When the prediction direction of the current block is the list 1 direction, the motion information of the current block includes at least one of information indicating that the prediction direction of the current block is the list 1 direction, a reference picture index in the list 1 direction, and a motion vector in the list 1 direction. When the prediction direction of the current block is bidirectional, the motion information of the current block includes at least one of information indicating that the prediction direction of the current block is bidirectional, a reference picture index in the list 0 direction, a reference picture index in the list 1 direction, a motion vector in the list 0 direction, and a motion vector in the list 1 direction.

[0267] According to an embodiment, when the prediction mode of the current block is the inter prediction mode, the bitstream obtainer 2010 may obtain information indicating the prediction direction of the current block and the reference picture index of the current block from the bitstream. The prediction decoder 2030 may obtain the differential motion vector of the current block from the information included in the bitstream, and combine the prediction motion vector of the current block with the differential motion vector to obtain the motion vector of the current block.

[0268] The prediction decoder 2030 may reconstruct the current block based on the prediction direction, the reference picture index, and the motion vector of the current block.

[0269] A method of obtaining a predicted motion vector of a current block, performed by the prediction decoder 2030, will now be described in detail.

[0270] The motion vector prediction unit 2032 according to an embodiment may obtain a predicted motion vector by using a motion vector of a neighboring block adjacent to the current block. The neighboring block, which is a block at a predetermined position used to obtain the predicted motion vector of the current block, is included in the current picture together with the current block.

[0271] The neighboring blocks may include block A0, block A1, block B0, block B1, and block B2.

[0272] The motion vector prediction unit 2032 may identify the locations of block A0 , block A1 , block B0 , block B1 , and block B2 based on information indicating availability of left and right blocks of the current block.

[0273] In a general video codec, decoding in a raster scan direction is performed on a screen. In this case, the left block of the current block is completely decoded before the current block and is available, and the right block of the current block is not completely decoded and is unavailable.

[0274] In the present disclosure, the direction of the decoded blocks divided from the picture can be adaptively determined. In other words, the encoding efficiency can be improved by decoding some of the blocks divided from the picture in the right-to-left direction instead of decoding all the blocks divided from the picture in the raster scanning direction. Therefore, the right block of the current block is available and the left block of the current block is not available, or both the left block and the right block of the current block are available.

[0275] The determination as to whether the left block and the right block are available may be made in the same manner as the determination as to the availability of the first neighboring block which will be described later.

[0276] The following will refer to Figures 21a to 21c Describes the location of neighboring blocks that vary depending on the availability of blocks to the left and right of the current block.

[0277] Fig.21a Shown are the positions of neighboring blocks when the left block of the current block 2100 is available.

[0278] When the left block of the current block 2100 is available, the position of the neighboring block may be the same as the position of the spatial neighboring block defined in the HEVC standard.

[0279] Reference Fig.21a , the neighboring blocks may include the lower left corner block A0, the lower left block A1, the upper right corner block B0, the upper right block B1 and the upper left corner block B2 of the current block 2100. Fig.21a As shown, the lower left block A1 may be located above the lower left corner block A0, and the upper right block B1 may be located on the left side of the upper right corner block B0.

[0280] Figure 21b The positions of neighboring blocks are shown when both the left block and the right block of the current block 2100 are available.

[0281] Reference Figure 21b , the neighboring blocks may include the upper right corner block A0, the lower left block A1, the upper left block B0, the lower right block B1 and the upper left corner block B2 of the current block 2100. Figure 21b As shown, the upper left corner block B2 may be located to the left of the upper left block B0.

[0282] Fig.21c Shown are the positions of neighboring blocks when the right block of the current block 2100 is available.

[0283] Reference Fig.21c , the neighboring blocks may include the lower right corner block A0, the lower right block A1, the upper left corner block B0, the upper left block B1 and the upper right corner block B2 of the current block 2100. Fig.21c As shown, the lower right block A1 may be located above the lower right corner block A0, and the upper left block B1 may be located to the right of the upper left corner block B0.

[0284] Figure 21a to Figure 21c The positions of the neighboring blocks shown in are only examples. According to embodiments, the positions of the neighboring blocks and the number of the neighboring blocks may vary.

[0285] The motion vector prediction unit 2032 may determine the availability of left and right blocks of the current block, and may specify the position of a neighboring block to be used to obtain a predicted motion vector of the current block from information indicating the availability of left and right blocks of the current block.

[0286] According to an embodiment, the motion vector prediction unit 2032 selects the first neighboring block through information obtained from the bitstream. The first neighboring block may be one of blocks A0, A1, B0, B1, and B2 corresponding to the neighboring block.

[0287] According to an embodiment, the information obtained from the bitstream may be information indicating a motion vector resolution of the current block. The motion vector prediction unit 2032 may confirm the information indicating the motion vector resolution of the current block from a plurality of predetermined motion vector resolutions according to the information obtained from the bitstream, and may select a first neighboring block for obtaining a predicted motion vector.

[0288] The motion vector resolution may refer to the accuracy of the position of a pixel indicated by a motion vector determined by inter-frame prediction from among pixels included in a reference picture (or an interpolated reference picture). A motion vector resolution having N pixel units (where N is a rational number) means that the motion vector may have an accuracy of N pixel units. For example, a motion vector resolution of 1 / 4 pixel units may mean that the motion vector may indicate a pixel of 1 / 4 pixel units (i.e., sub-pixel units) in the interpolated reference picture, and a motion vector resolution of 1 pixel unit may mean that the motion vector may indicate a pixel of 1 pixel unit (i.e., integer pixel units) in the interpolated reference picture. The motion vector resolution capable of indicating the motion vector of the current block may be adaptively determined from among several motion vector resolutions.

[0289] According to an embodiment, the information indicating the motion vector resolution obtained from the bitstream may indicate a first neighboring block among neighboring blocks at different positions while indicating one motion vector resolution among several motion vector resolutions.

[0290] Fig. 22 is a table showing the matching relationship between the index of the motion vector resolution, the motion vector resolution, and the position of the neighboring block.

[0291] Reference Fig. 22 , the motion vector resolution and the neighboring block corresponding to the first neighboring block may be determined according to the value of the AMVR index. For example, when the AMVR index is 0, the motion vector resolution of the current block may be selected as a 1 / 4 pixel unit (pel), and the first neighboring block may be selected as block A1. When the AMVR index is 1, the motion vector resolution of the current block may be selected as a 1 / 2 pixel unit (pel), and the first neighboring block may be selected as block B1.

[0292] In the existing HEVC standard, several neighboring blocks are included in a candidate list, and the motion vector of the neighboring block in the candidate list selected from the information signaled through the bitstream is used as the predicted motion vector. However, according to the present disclosure, the first neighboring block used to obtain the predicted motion vector of the current block can be specified based on the information obtained from the bitstream (i.e., information indicating the motion vector resolution of the current block). Therefore, special information indicating a neighboring block included in the candidate list (e.g., mvp_l0_flag and mvp_l1_flag in HEVC) is not included in the bitstream.

[0293] The motion vector prediction unit 2032 determines the availability of the first neighboring block selected according to the information indicating the motion vector resolution. In detail, the motion vector prediction unit 2032 determines the availability of the first neighboring block according to at least one of whether a tile including the first neighboring block is different from a tile including the current block, whether the first neighboring block is located outside the current picture, whether the first neighboring block has been intra-predicted, and whether reconstruction of the first neighboring block has been completed.

[0294] For example, when any one of the following four conditions is satisfied, the motion vector prediction unit 2032 may determine that the first neighboring block is unavailable.

[0295] (Condition 1) The tile including the first neighboring block is different from the tile including the current block.

[0296] (Condition 2) The first neighboring block is located outside the current picture.

[0297] (Condition 3) The first neighboring block is not reconstructed.

[0298] (Condition 4) The first neighboring block has been encoded in the intra prediction mode or the intra block copy (IBC) mode.

[0299] In IBC mode, a prediction block corresponding to the current block is searched from the current picture. The prediction block may be found by motion estimation for the current picture. For example, the prediction block may be searched in the current picture in units of integer pixels, and the positional relationship between the current block and the found prediction block may be signaled to the decoder.

[0300] According to an embodiment, when it is identified from the information indicating the availability of the first neighboring block that the first neighboring block is available and the reference picture index of the first neighboring block in the same prediction direction as the prediction direction of the current block is different from a predetermined value (e.g., -1), the motion vector prediction unit 2032 may determine that the motion vector of the first neighboring block is available as a predicted motion vector. When the motion vector of the first neighboring block is available as a predicted motion vector, the motion vector prediction unit 2032 derives the predicted motion vector of the current block from the motion vector of the first neighboring block.

[0301] Even when it is identified from the information indicating the availability of the first neighboring block that the first neighboring block is unavailable or the first neighboring block is available, when the reference picture index of the first neighboring block in the same prediction direction as the prediction direction of the current block is the same as the predetermined value, it can be determined that the motion vector of the first neighboring block is unavailable as the predicted motion vector. In this case, the motion vector prediction unit 2032 can obtain a default motion vector according to a default motion vector derivation process to be described later, and can obtain the predicted motion vector of the current block by using the default motion vector.

[0302] When the reference picture index of the first neighboring block in the same prediction direction as that of the current block is different from a predetermined value, this may indicate that there is a motion vector of the first neighboring block indicating a reference picture in the same prediction direction as that of the current block. On the other hand, when the reference picture index of the first neighboring block in the same prediction direction as that of the current block is the same as a predetermined value, this may indicate that there is no motion vector of the first neighboring block indicating a reference picture in the same prediction direction as that of the current block.

[0303] The reference picture index of the first neighboring block includes a reference picture index in the list 0 direction and a reference picture index in the list 1 direction. The values ​​of the reference picture index in the list 0 direction and the reference picture index in the list 1 direction may be determined according to the prediction direction of the first neighboring block.

[0304] For example, when the prediction direction of the first neighboring block is the list 0 direction, the reference picture index of the list 0 direction is set to the value of the index (e.g., ref_idx_10) obtained from the bitstream, and the reference picture index of the list 1 direction is set to a predetermined value. Since the pictures included in the reference picture list have indexes of 0 to n (where n is a natural number), the predetermined value may be a value other than 0 to n, such as -1.

[0305] When the prediction direction of the first neighboring block is a list 1 direction, the reference picture index of the list 1 direction is set to the value of the index (eg, ref_idx_l1) obtained from the bitstream, and the reference picture index of the list 0 direction is set to a predetermined value.

[0306] When the prediction direction of the first neighboring block is bidirectional, the reference picture index in the list 0 direction and the list

[0307] The reference picture indices for the 1-way are all set to the indices obtained from the bitstream (e.g., ref_idx_10 and

[0308] ref_idx_l1).

[0309] Now refer to Figures 23a to 23c Describes a case where a reference picture index of a first neighboring block in a prediction direction that is the same as a prediction direction of a current block is the same as or different from a predetermined value.

[0310] Fig.23a A case where the reference picture index of the first neighboring block in the same prediction direction as that of the current block is different from a predetermined value is shown.

[0311] Reference Fig.23a, the corresponding prediction directions of the current block 2312 and the first neighboring block 2314 are both list 0 directions. Therefore, the motion vector MV of the first neighboring block 2314 indicates a reference block within the reference picture 2330 included in the reference picture list 0. The reference picture index of the first neighboring block 2314 in the list 0 direction is set according to the information obtained from the bitstream, and the reference picture index of the first neighboring block 2314 in the list 1 direction is set to a predetermined value. Because the reference picture index of the first neighboring block 2314 in the same prediction direction as the prediction direction of the current block 2312 (i.e., the list 0 direction) is different from the predetermined value, the motion vector prediction unit 2032 obtains the predicted motion vector of the current block 2312 by using the motion vector MV of the first neighboring block 2314.

[0312] Similarly, when the corresponding prediction directions of the current block 2312 and the first neighboring block 2314 are both list 1 directions, because the reference picture index of the first neighboring block 2314 in the same prediction direction as the prediction direction of the current block 2312 (i.e., list 1 direction) is different from the predetermined value, the motion vector prediction unit 2032 obtains the predicted motion vector of the current block 2312 by using the motion vector MV of the first neighboring block 2314.

[0313] Figure 23b A case where the reference picture index of the first neighboring block in the same prediction direction as that of the current block is the same as a predetermined value is shown.

[0314] Reference Figure 23b , the prediction direction of the current block 2312 is the list 1 direction, and the prediction direction of the first neighboring block 2314 is the list 0 direction. The motion vector MV of the first neighboring block 2314 indicates a reference block within the reference picture 2330 included in the reference picture list 0. The reference picture index of the first neighboring block 2314 in the list 0 direction is set according to the information obtained from the bitstream, and the reference picture index of the first neighboring block 2314 in the list 1 direction is set to a predetermined value. Because the reference picture index of the first neighboring block 2314 in the same prediction direction as the prediction direction of the current block 2312 (that is, the list 1 direction) is the same as the predetermined value, the motion vector prediction unit 2032 obtains the predicted motion vector of the current block 2312 by using a default motion vector to be described later.

[0315] Similarly, when the prediction direction of the current block 2312 is the list 0 direction and the prediction direction of the first neighboring block 2314 is the list 1 direction, because the reference picture index of the first neighboring block 2314 in the same prediction direction as the prediction direction of the current block 2312 (i.e., the list 0 direction) is the same as the predetermined value, the motion vector prediction unit 2032 obtains the predicted motion vector of the current block 2312 by using the default motion vector.

[0316] Fig.23c It shows a case where, when the prediction direction of the current block is bidirectional, one of the reference picture index of the first neighboring block in the list 0 direction and the reference picture index of the first neighboring block in the list 1 direction is the same as a predetermined value, and the other is different from the predetermined value.

[0317] Reference Fig.23c , the prediction direction of the current block 2312 is bidirectional, and the prediction direction of the first neighboring block 2314 is the list 1 direction. The motion vector MV of the first neighboring block 2314 indicates a reference block within the reference picture 2350 included in the reference picture list 1. The reference picture index of the first neighboring block 2314 in the list 0 direction is set to a predetermined value, and the reference picture index of the first neighboring block 2314 in the list 1 direction is set according to the information obtained from the bitstream. As described above, the prediction direction as bidirectional includes both the list 0 direction and the list 1 direction. Because the reference picture index of the first neighboring block 2314 in the list 0 direction is the same as the predetermined value, the motion vector prediction unit 2032 obtains the prediction motion vector of the current block 2312 in the list 0 direction by using the default motion vector. Because the reference picture index of the first neighboring block 2314 in the list 1 direction is not the same as the predetermined value, the motion vector prediction unit 2032 obtains the prediction motion vector of the current block 2312 in the list 1 direction by using the motion vector MV of the first neighboring block 2314 in the list 1 direction.

[0318] When the prediction direction of the current block 2312 is bidirectional and the prediction direction of the first neighboring block 2314 is the list 0 direction, the motion vector prediction unit 2032 obtains the predicted motion vector of the current block 2312 in the list 0 direction by using the motion vector MV of the first neighboring block 2314 in the list 0 direction, and obtains the predicted motion vector of the current block 2312 in the list 1 direction by using the default motion vector.

[0319] In the present disclosure, when a first neighboring block is available and a reference picture index of the first neighboring block in a prediction direction that is the same as a prediction direction of a current block is different from a predetermined value, it is determined that a motion vector of the first neighboring block is available as a predicted motion vector. The predicted motion vector of the current block is obtained from the motion vector of the first neighboring block.

[0320] When it is determined that the motion vector of the first neighboring block is available as a predicted motion vector, the predicted motion vector of the first neighboring block may be set to a zero vector, that is, (0, 0), only according to the condition that the first neighboring block should be available. In other words, when the first neighboring block is available but there is no motion vector of the first neighboring block in the same prediction direction as the prediction direction of the current block, the motion vector of the first neighboring block may not be used as the predicted motion vector of the current block. Therefore, the predicted motion vector of the current block may be determined to be a zero vector, and thus becomes a factor that increases the number of bits required to express the differential motion vector.

[0321] In the present disclosure, when not only the condition that the first neighboring block should be available but also the condition that there should be a motion vector of the first neighboring block in a prediction direction that is the same as the prediction direction of the current block is satisfied, the motion vector of the first neighboring block is used to obtain the predicted motion vector of the current block, thereby reducing the number of bits required to express the differential motion vector.

[0322] A process of deriving a default motion vector when the motion vector of the first neighboring block is not available as a predicted motion vector will now be described.

[0323] According to an embodiment, when the motion vector of the first neighboring block is not available as a predicted motion vector, the motion vector prediction unit 2032 may set the motion vector of the second neighboring block at a predetermined position as a default motion vector. A plurality of second neighboring blocks may be provided. In this case, the motion vector of the second neighboring block may be set as the default motion vector by determining the availability of the plurality of second neighboring blocks.

[0324] The second neighboring block may correspond to at least one of the neighboring blocks. For example, the second neighboring block may include block A1 and block B1. As another example, the position of the second neighboring block may be different from the positions of A0 block, A1 block, B0 block, B1 block, and B2 block.

[0325] When the second neighboring block includes block A1 and block B1, as described above, the positions of block A1 and block B1 may vary according to the availability of the left block and the right block of the current block. Figures 21a to 21c , when the left block of the current block is available, block A1 may be located at the upper left of the current block, and block B1 may be located at the upper right of the current block. When both the left block and the right block of the current block are available, block A1 may be located at the lower left of the current block, and block B1 may be located at the lower right of the current block. When the right block of the current block is available, block A1 may be located at the lower right of the current block, and block B1 may be located at the upper left of the current block.

[0326] The motion vector prediction unit 2032 may determine the availability of block A1, and when block A1 is identified as available according to the information indicating whether block A1 is available, the motion vector of block A1 may be determined as a default motion vector. When block A1 is not available, the motion vector prediction unit 2032 may determine the availability of block B1, and when block B1 is identified as available according to the information indicating whether block B1 is available, the motion vector of block B1 may be determined as a default motion vector. In other words, the motion vector prediction unit 2032 may check whether the motion vectors of block A1 and block B1 can be used as a default motion vector in the order of block A1→block B1.

[0327] The availability of the block A1 and the availability of the block B1 may be determined based on the above-described four conditions for determining the availability of the first neighboring block.

[0328] According to an embodiment, when the second neighboring block is identified as available based on information indicating whether the second neighboring block is available and the reference picture index of the second neighboring block in the same prediction direction as the prediction direction of the current block is the same as the reference picture index of the current block or is not the same as a predetermined value (i.e., when there is a motion vector of the second neighboring block in the same prediction direction as the prediction direction of the current block), the motion vector prediction unit 2032 may set the motion vector of the second neighboring block to a default motion vector.

[0329] When it is identified from the information indicating the availability of the second neighboring block that the second neighboring block is not available or there is no motion vector of the second neighboring block in the same prediction direction as the prediction direction of the current block, the motion vector prediction unit 2032 may set the motion vector of the block decoded before the current block as a default motion vector.

[0330] The motion vector prediction unit 2032 may determine the motion vector of the first neighboring block or the default motion vector as the predicted motion vector of the current block.

[0331] When the motion vector of the first neighboring block is determined as the predicted motion vector and the reference picture index of the first neighboring block in the same prediction direction as the prediction direction of the current block is different from the reference picture index of the current block, the motion vector prediction unit 2032 can update the predicted motion vector of the current block by scaling the predicted motion vector of the current block according to the distance between the current picture and the reference picture of the current block and the distance between the current picture and the reference picture of the first neighboring block.

[0332] According to an embodiment, when the reference picture index of the second neighboring block (or a block decoded before the current block, which is used to obtain the default motion vector) in the same prediction direction as the prediction direction of the current block is the same as the reference picture index of the current block, the motion vector prediction unit 2032 may determine the default motion vector as the prediction motion vector of the current block. When the reference picture index of the second neighboring block (or a block decoded before the current block, which is used to obtain the default motion vector) in the same prediction direction as the prediction direction of the current block is different from the reference picture index of the current block, the motion vector prediction unit 2032 may scale the default motion vector according to the distance between the current picture and the reference picture of the current block and the distance between the current picture and the reference picture of the second neighboring block (or a block decoded before the current block), and may determine the scaled default motion vector as the prediction motion vector of the current block.

[0333] After obtaining the predicted motion vector of the current block, when the motion vector resolution of the current block is different from the predetermined motion vector resolution (e.g., the minimum motion vector resolution among multiple motion vector resolutions), the motion vector prediction unit 2032 may adjust the predicted motion vector of the current block. The reason for adjusting the predicted motion vector is to match the motion vector resolution of the current block with the resolution of the predicted motion vector.

[0334] In order to adjust the predicted motion vector expressed in coordinates within the picture interpolated according to the minimum motion vector resolution to the motion vector resolution of the current block, the motion vector prediction unit 2032 may adjust the predicted motion vector so that the predicted motion vector indicates neighboring pixels rather than the pixels indicated by the predicted motion vector.

[0335] For example, when the minimum motion vector resolution is 1 / 4 pixel unit and the motion vector resolution of the current block is 1 pixel unit, the motion vector prediction unit 2032 may adjust the predicted motion vector of (19, 27) to (20, 28). This is because when the minimum motion vector resolution is 1 / 4 pixel unit, the integer pixel has a coordinate of (4n, 4m) in the interpolation picture.

[0336] According to an embodiment, when the predicted motion vector is adjusted according to the motion vector resolution of the current block, the motion vector prediction unit 2032 may allow the adjusted predicted motion vector to indicate a pixel located to the upper right of the pixel indicated by the predicted motion vector that has not been adjusted. According to another embodiment, the motion vector prediction unit 2032 may allow the adjusted predicted motion vector to indicate a pixel located to the upper left of the pixel indicated by the predicted motion vector that has not been adjusted, a pixel located to the lower left of the pixel indicated by the predicted motion vector that has not been adjusted, or a pixel located to the lower right of the pixel indicated by the predicted motion vector that has not been adjusted.

[0337] In summary, according to the above content of the embodiment, when the motion vector of the first neighboring block is available as a predicted motion vector, the motion vector of the first neighboring block is determined as the predicted motion vector of the current block. When the reference picture index of the first neighboring block in the same prediction direction as the prediction direction of the current block is different from the reference picture index of the current block, the predicted motion vector is scaled. When the motion vector resolution of the current block is different from a predetermined motion vector resolution among a plurality of motion vector resolutions, the predicted motion vector or the scaled predicted motion vector is adjusted according to the motion vector resolution of the current block.

[0338] When the motion vector of the first neighboring block is not available as a predicted motion vector, a default motion vector is derived. When the reference picture index of the block in the same prediction direction as the prediction direction of the current block (the block used to derive the default motion vector) is different from the reference picture index of the current block, the default motion vector is scaled and the scaled default motion vector is determined as the predicted motion vector of the current block. When the motion vector resolution of the current block is different from a predetermined motion vector resolution among a plurality of motion vector resolutions, the predicted motion vector is adjusted according to the motion vector resolution of the current block.

[0339] The motion vector reconstruction unit 2034 obtains the motion vector of the current block by combining the predicted motion vector of the current block with the differential motion vector obtained from the bitstream. The motion vector reconstruction unit 2034 may obtain the motion vector of the current block by adding the predicted motion vector of the current block to the differential motion vector.

[0340] The prediction decoder 2030 may reconstruct the current block by inter-predicting the current block according to the prediction direction, the reference picture index, and the motion vector of the current block.

[0341] Fig.24 is a flowchart of a method of decoding a motion vector according to an embodiment.

[0342] In operation S2410, the image decoding apparatus 2000 determines availability of a first neighboring block selected from neighboring blocks adjacent to a current block according to information obtained from a bitstream.

[0343] According to an embodiment, the information obtained from the bitstream may include information indicating a motion vector resolution of the current block among a plurality of motion vector resolutions.

[0344] In operation S2420, the image decoding apparatus 2000 determines whether a first neighboring block is available and whether a motion vector of the first neighboring block in the same prediction direction as that of the current block exists.

[0345] In operation S2430, when the first neighboring block is available and a motion vector of the first neighboring block in the same prediction direction as that of the current block exists, the image decoding apparatus 2000 obtains a predicted motion vector of the current block from the motion vector of the first neighboring block.

[0346] In operation S2440, when the first neighboring block is unavailable or a motion vector of the first neighboring block in the same prediction direction as that of the current block does not exist, the image decoding apparatus 2000 obtains a predicted motion vector of the current block from a motion vector of the second neighboring block.

[0347] As described above, when the second neighboring block is unavailable, the predicted motion vector of the current block may be obtained from a motion vector of a block decoded before the current block.

[0348] In operation S2450, the image decoding apparatus 2000 obtains a motion vector of the current block by combining the predicted motion vector of the current block with the differential motion vector.

[0349] Fig.25 is a block diagram of a structure of an image encoding apparatus 2500 according to an embodiment.

[0350] Reference Fig.25 , the image encoding apparatus 2500 includes a prediction encoder 2510 and a bitstream generator 2530. The prediction encoder 2510 may include a motion vector prediction unit 2512 and a motion vector encoding unit 2514.

[0351] The predictive encoder 2510 can be used with Figure 2 The encoder 220 shown in FIG. 1 corresponds to the encoder 220 shown in FIG. 1 , and the bitstream generator 2530 can be connected to the Figure 2 Corresponding to the bitstream generator 210 shown in .

[0352] The prediction encoder 2510 and the bitstream generator 2530 according to an embodiment may be implemented as at least one processor. The image encoding apparatus 2500 may include one or more memories (not shown) for storing input and output data of the prediction encoder 2510 and the bitstream generator 2530. The image encoding apparatus 2500 may include a memory controller (not shown) for controlling data input and output of the memory (not shown).

[0353] The prediction encoder 2510 encodes a picture according to a prediction mode, and the bitstream generator 2530 generates a bitstream including information generated as a result of encoding the picture.

[0354] The prediction encoder 2510 may determine a prediction mode of a current block within a current image. When the prediction mode of the current block is determined to be an inter prediction mode, the bitstream generator 2530 includes motion information of the current block in a bitstream.

[0355] The motion vector prediction unit 2512 predicts a motion vector of a current block encoded in an inter prediction mode.

[0356] The motion vector prediction unit 2512 according to an embodiment may obtain a predicted motion vector by using a motion vector of a neighboring block adjacent to the current block. The positions of the neighboring blocks have been described above, and thus a detailed description thereof will be omitted.

[0357] According to an embodiment, the motion vector prediction unit 2512 selects a first neighboring block from the neighboring blocks. The first neighboring block may be one of blocks A0, A1, B0, B1, and B2 corresponding to the neighboring block.

[0358] According to an embodiment, the motion vector prediction unit 2512 may select a first neighboring block mapped to a motion vector resolution of the current block from among a plurality of motion vector resolutions.

[0359] The motion vector prediction unit 2512 determines the availability of the first neighboring block. In detail, the motion vector prediction unit 2512 determines the availability of the first neighboring block according to at least one of whether the tile including the first neighboring block is different from the tile including the current block, whether the first neighboring block is located outside the current picture, whether the first neighboring block has been intra-predicted, and whether reconstruction of the first neighboring block has been completed.

[0360] According to an embodiment, when it is identified from the information indicating the availability of the first neighboring block that the first neighboring block is available and the reference picture index of the first neighboring block in the same prediction direction as the prediction direction of the current block is different from the predetermined value (that is, when the motion vector of the first neighboring block in the same prediction direction as the prediction direction of the current block exists), the motion vector prediction unit 2512 may determine that the motion vector of the first neighboring block is available as a predicted motion vector. The predetermined value may be, for example, -1. When the motion vector of the first neighboring block is available as a predicted motion vector, the motion vector prediction unit 2512 derives the predicted motion vector of the current block from the motion vector of the first neighboring block.

[0361] When it is identified from the information indicating the availability of the first neighboring block that the first neighboring block is unavailable or the reference picture index of the first neighboring block in the same prediction direction as the prediction direction of the current block is the same as the predetermined value, it can be determined that the motion vector of the first neighboring block is unavailable as the predicted motion vector. In this case, the motion vector prediction unit 2512 can obtain the predicted motion vector of the current block by using a default motion vector.

[0362] According to an embodiment, when the motion vector of the first neighboring block is not available as a predicted motion vector, the motion vector prediction unit 2512 may set the motion vector of the second neighboring block at a predetermined position as a default motion vector. A plurality of second neighboring blocks may be provided. In this case, the motion vector of the second neighboring block may be set as the default motion vector by determining the availability of the plurality of second neighboring blocks.

[0363] When the second neighboring block includes block A1 and block B1, the motion vector prediction unit 2512 may determine the availability of block A1, and when block A1 is identified as available according to the information indicating whether block A1 is available, the motion vector of block A1 may be determined as a default motion vector. When block A1 is not available, the motion vector prediction unit 2512 may determine the availability of block B1, and when block B1 is identified as available according to the information indicating whether block B1 is available, the motion vector of block B1 may be determined as a default motion vector. In other words, the motion vector prediction unit 2512 may check whether the motion vectors of block A1 and block B1 can be used as a default motion vector in the order of block A1→block B1.

[0364] According to an embodiment, when the second neighboring block is identified as available based on information indicating whether the second neighboring block is available and the reference picture index of the second neighboring block in the prediction direction that is the same as the prediction direction of the current block is the same as the reference picture index of the current block or is not the same as a predetermined value (i.e., when there is a motion vector of the second neighboring block in the prediction direction that is the same as the prediction direction of the current block), the motion vector prediction unit 2512 may set the motion vector of the second neighboring block to a default motion vector.

[0365] When it is identified from the information indicating the availability of the second neighboring block that the second neighboring block is unavailable or the reference picture index of the second neighboring block in the prediction direction that is the same as the prediction direction of the current block is the same as a predetermined value, the motion vector prediction unit 2512 may set the motion vector of the block encoded before the current block to a default motion vector.

[0366] The motion vector prediction unit 2512 may determine the motion vector of the first neighboring block or the default motion vector as the predicted motion vector of the current block.

[0367] When the motion vector of the first neighboring block is determined as the predicted motion vector and the reference picture index of the first neighboring block in the same prediction direction as the prediction direction of the current block is different from the reference picture index of the current block, the motion vector prediction unit 2512 can update the predicted motion vector of the current block by scaling the predicted motion vector of the current block according to the distance between the current picture and the reference picture of the current block and the distance between the current picture and the reference picture of the first neighboring block.

[0368] When obtaining the default motion vector, according to an embodiment, when the reference image index of the second neighboring block (or a block decoded before the current block, which is used to obtain the default motion vector) in the same prediction direction as the prediction direction of the current block is the same as the reference image index of the current block, the motion vector prediction unit 2512 may determine the default motion vector as the prediction motion vector of the current block. When the reference picture index of the second neighboring block (or a block decoded before the current block, which is used to obtain the default motion vector) in the same prediction direction as the prediction direction of the current block is different from the reference picture index of the current block, the motion vector prediction unit 2512 may scale the default motion vector according to the distance between the current picture and the reference picture of the current block and the distance between the current picture and the reference picture of the second neighboring block (or a block decoded before the current block), and may determine the scaled default motion vector as the prediction motion vector of the current block.

[0369] After obtaining the predicted motion vector of the current block, when the motion vector resolution of the current block is different from a predetermined motion vector resolution (eg, a minimum motion vector resolution among multiple motion vector resolutions), the motion vector prediction unit 2512 may adjust the predicted motion vector of the current block.

[0370] The motion vector encoding unit 2514 obtains a differential motion vector between the motion vector of the current block and the predicted motion vector. The motion vector encoding unit 2514 may obtain the differential motion vector by subtracting the predicted motion vector from the motion vector of the current block.

[0371] The bitstream generator 2530 generates a bitstream including information indicating a differential motion vector and information indicating a first neighboring block among neighboring blocks. As described above, the information indicating the first neighboring block may be information indicating a motion vector resolution of a current block among a plurality of motion vector resolutions.

[0372] Fig.26 is a flowchart of a method of encoding a motion vector according to an embodiment.

[0373] In operation S2610, the image encoding apparatus 2500 determines availability of a first neighboring block selected from neighboring blocks adjacent to a current block. According to an embodiment, the image encoding apparatus 2500 may select a first neighboring block corresponding to a motion vector resolution of the current block.

[0374] In operation S2620, the image encoding apparatus 2500 determines whether a first neighboring block is available and whether a motion vector of the first neighboring block in a prediction direction identical to that of the current block exists.

[0375] In operation S2630, when the first neighboring block is available and a motion vector of the first neighboring block in the same prediction direction as that of the current block exists, the image encoding apparatus 2500 obtains a predicted motion vector of the current block from the motion vector of the first neighboring block.

[0376] In operation S2640, when the first neighboring block is unavailable or a motion vector of the first neighboring block in the same prediction direction as that of the current block does not exist, the image encoding apparatus 2500 obtains a predicted motion vector of the current block from a motion vector of the second neighboring block.

[0377] When the second neighboring block is unavailable, the predicted motion vector of the current block may be obtained from a motion vector of a block encoded before the current block.

[0378] In operation S2650, the image encoding apparatus 2500 obtains a differential motion vector between a motion vector of a current block and a predicted motion vector, and generates a bitstream including information indicating the differential motion vector and information indicating a first neighboring block. The information indicating the first neighboring block may be information indicating a motion vector resolution of the current block among a plurality of motion vector resolutions.

[0379] Fig. 27 and Fig.28 is a view for explaining a process of obtaining a predicted motion vector according to an embodiment.

[0380] Fig. 27 and Fig.28 An example of the above embodiment is shown. Fig. 27 and Fig.28 In the example, LX included in mvpLX and mvLX indicates a prediction direction of the current block. In other words, when the prediction direction of the current block is the L0 direction, X is 0, and when the prediction direction of the current block is the L1 direction, X is 1. When the prediction direction of the current block is bidirectional, X may sequentially have values ​​of 0 and 1.

[0381] In S2710 , the flag mvpAvailFlag indicating the availability of the predicted motion vector is set to 0.

[0382] In S2720, a block to be used to obtain a predicted motion vector of the current block is specified according to information amvr_idx indicating a motion vector resolution of the current block. When the information amvr_idx is 1, block B1 is selected. Availability of block B1 is determined. Determination of availability of block B1 may be performed according to the above four conditions for determining availability of the first neighboring block. Fig. 27 Only the processing when amvr_idx is 1 is shown to omit redundant description, but blocks at different positions are selected according to the value of amvr_idx. Fig. 22As shown, a block mapped with the information amvr_idx can be selected.

[0383] In S2730, when block B1 is identified as available from the information availableB1 indicating the availability of block B1 and the reference picture index RefIdxLX of block B1 in the prediction direction that is the same as the prediction direction of the current block is not the same as -1, the flag mvpAvailFlag indicating the availability of the predicted motion vector is set to 1, and the motion vector of block B1 is set to the predicted motion vector mvpLX.

[0384] In S2740, when the reference picture index refIdxLX of the current block is equal to the reference picture index RefIdxLX[xNbB 1 ][yNb 1 ] are not the same, according to the reference picture RefPicListX[RefIdxLX[xNbB 1 ][yNb 1 The predicted motion vector mvpLX is scaled by the ratio distScaleFactorLX between the distance currPocDiffLX between the current picture and the reference picture RefPicListX[refIdxLX] of the current block and the distance targetPocDiffLX between the current picture and the reference picture RefPicListX[refIdxLX] of the current block.

[0385] In S2750, when amvr_idx is not 0, that is, when the motion vector resolution of the current block is different from the predetermined motion vector resolution (e.g., the minimum motion vector resolution), the predicted motion vector mvpLX is adjusted. When amvr_idx is 0, that is, when the predicted motion vector is obtained from the motion vector of block A1, the predicted motion vector is not adjusted.

[0386] Next, refer to Fig.28 In S2810, when the flag mvpAvailFlag indicating the availability of the predicted motion vector is 0, that is, when the block B1 is identified as unavailable from the information availableB1 indicating the availability of the block B1, or when the reference picture index RefIdxLX[xNbB of the block B1 in the same prediction direction as the current block is 1 ][yNb 1 ] is the same as -1, the process of deriving the default motion vector through S2820 to S2890 is performed.

[0387] In S2820, the availability of block A1 and the availability of block B1 are determined. The determination regarding the availability of block A1 and the availability of block B1 may be performed according to the above four conditions for determining the availability of the first neighboring block.

[0388] In S2830 , both the x-axis component and the y-axis component of the default motion vector DefaultMvLX are set to zero.

[0389] In S2840, when block A1 is identified as available from the information availableA1 indicating the availability of block A1 and the reference picture index refIdxLx of the current block is equal to the reference picture index RefIdxLx[xNbA] of block A1, 1 ][yNb 1 ] are the same, the motion vector of block A1 is set to the default motion vector.

[0390] In S2850, when the condition mentioned in S2840 is not satisfied, block B1 is identified as available from information availableB1 indicating the availability of block B1, and the reference picture index refIdxLX of the current block is equal to the reference picture index RefIdxLX[xNbB 1 ][yNb 1 ] is the same as that of block B1, and the motion vector of block B1 is set to the default motion vector.

[0391] In S2860, when the condition mentioned in S2850 is not satisfied, block A1 is identified as available from the information availableA1 indicating the availability of block A1, and the reference picture index RefIdxLX[xNbA 1 ][yNbA 1 ] is not the same as -1, setting the motion vector of block A1 to the default motion vector.

[0392] In S2870, when the condition mentioned in S2860 is not satisfied, the block B1 is identified as available from the information availableB1 indicating the availability of the block B1, and the reference picture index RefIdxLX[xNbB 1 ][yNb 1 ] is different from -1, and the motion vector of block B1 is set to the default motion vector.

[0393] In S2880, when the motion vector of the block A1 or the motion vector of the block B1 is not set as the default motion vector, the motion vector of a block decoded before the current block is set as the default motion vector.

[0394] In S2890, when the reference picture index refIdxLX of the current block is different from the default reference picture index DefaultRefIdxLX, the default motion vector is scaled according to a ratio distScaleFactorLX between a distance currPocDiffLX between the current picture and a picture RefPicListX[DefaultRefIdxLX] indicated by the default reference picture index DefaultRefIdxLX and a distance targetPocDiffLX between the current picture and the reference picture RefPicListX[refIdxLX] of the current block. The default reference picture index DefaultRefIdxLX may refer to a reference picture index of a block used to obtain a default motion vector.

[0395] In S2895, the default motion vector DefaultMvLX is set as the predicted motion vector mvpLX of the current block.

[0396] Although not in Fig.28 As shown in , however, when amvr_idx is not 0, that is, when the motion vector resolution of the current block is different from the predetermined motion vector resolution (eg, the minimum motion vector resolution), the predicted motion vector mvpLX is adjusted.

[0397] The above-described embodiments of the present disclosure may be written as a computer-executable program, and the written computer-executable program may be stored in a medium.

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

[0399] Although one or more embodiments of the present disclosure have been described with reference to the drawings, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope defined by the following claims.

Claims

1. A method for decoding a motion vector by an image decoding device, the method comprising: obtaining, from a bitstream, information indicating a motion vector resolution of a current block among a plurality of motion vector resolutions; selecting a first neighboring block among a plurality of neighboring blocks adjacent to the current block using information indicating a motion vector resolution of the current block; If the first neighboring block is available according to the information indicating the availability of the first neighboring block, and if the current block refers to a reference picture in list 0 and the first neighboring block refers to a reference picture in list 0, determining a motion vector predictor using a motion vector of the first neighboring block; If the current block refers to a reference picture in list 0 and the first neighboring block refers to a reference picture in list 1, determining the motion vector predictor using a motion vector of a second neighboring block among the plurality of neighboring blocks adjacent to the current block; adjusting the motion vector predictor based on information indicating a motion vector resolution of the current block; and determining a motion vector of the current block using the adjusted motion vector predictor, The availability of the first neighboring block is determined according to whether the first neighboring block is included in a parallel block different from the current block, whether the first neighboring block is located outside the current picture, whether the first neighboring block has been intra-predicted, and whether the first neighboring block is reconstructed.

2. A method for encoding a motion vector by an image encoding device, the method comprising: determining a motion vector resolution of a current block among a plurality of motion vector resolutions; Selecting a first neighboring block from among a plurality of neighboring blocks adjacent to the current block using a motion vector resolution of the current block; If the first neighboring block is available according to the information indicating the availability of the first neighboring block, and if the current block refers to a reference picture in list 0 and the first neighboring block refers to a reference picture in list 0, determining a motion vector predictor using a motion vector of the first neighboring block; If the current block refers to a reference picture in list 0 and the first neighboring block refers to a reference picture in list 1, determining the motion vector predictor using a motion vector of a second neighboring block among the plurality of neighboring blocks adjacent to the current block; adjusting the motion vector predictor based on a motion vector resolution of the current block; as well as generating a bitstream including information indicating a motion vector resolution of the current block and a differential motion vector determined using the motion vector of the current block and the adjusted motion vector predictor, The availability of the first neighboring block is determined according to whether the first neighboring block is included in a parallel block different from the current block, whether the first neighboring block is located outside the current picture, whether the first neighboring block has been intra-predicted, and whether the first neighboring block is reconstructed.

3. A method for transmitting a bit stream, the bit stream being generated by the method according to claim 2.