Encoding device and method, and decoding device and method

By determining the availability of predicted motion vectors in video encoding and decoding and using default motion vectors, the problem of insufficient accuracy of motion vector prediction is solved, and bit rate reduction and image quality improvement is achieved.

CN116389748BActive Publication Date: 2025-07-22SAMSUNG ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310357043.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2017-09-13
Filing Date
2018-03-30
Publication Date
2025-07-22
Estimated Expiration
2038-03-30

AI Technical Summary

Technical Problem

The existing video encoding and decoding methods have insufficient accuracy in motion vector prediction, resulting in poor reconstruction image quality and high bit rate problems.

Method used

Improve prediction accuracy by determining the availability of the predicted motion vector and using the default motion vector when it is not available.

Benefits of technology

The bit rate representing the residual motion vector is reduced, and the quality of the reconstructed image is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116389748B_ABST
    Figure CN116389748B_ABST
Patent Text Reader

Abstract

Provided is an encoding device and method, and a decoding device and method. Disclosed is a method for decoding a motion vector according to an embodiment, the method including: a step of determining at least one PMV candidate block for determining a predicted motion vector of a current block; a step of determining the availability of motion vectors of the at least one PMV candidate block; a step of determining the predicted motion vector of the current block by using a basic motion vector (MV) if there is a PMV candidate block determined to be unavailable; and a step of obtaining the motion vector of the current block based on the determined predicted 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 for invention with the application date of March 30, 2018, application number "201880056184.X", and title "Device and Method for Encoding Motion Vectors by Using Basic Motion Vectors and Decoding Device and Method". Technical Field

[0002] The present disclosure relates to the field of video encoding and decoding. More specifically, the present disclosure relates to a method and device for encoding a motion vector of a video and a method and device for decoding a motion vector of a video. Background Art

[0003] In video encoding and decoding methods, in order to encode an image, a picture may be divided into macroblocks, and each of the macroblocks may be encoded by using inter prediction or intra prediction.

[0004] Inter prediction refers to a method of compressing an image by removing temporal redundancy between pictures, and a representative example of this method is motion estimation encoding. In motion estimation encoding, each block of a current picture is predicted by using at least one reference picture. A reference block most similar to the current block is found within a predetermined search range by using a predetermined evaluation function.

[0005] The current block is predicted based on the reference block, and a residual block obtained by subtracting a predicted block generated as a prediction result from the current block is encoded. In this case, in order to perform prediction more precisely, interpolation is performed on a search range of the reference picture, pixels of a sub-pel-unit smaller than pixels of an integer-pel-unit may be generated, and inter prediction may be performed on the generated pixels of the sub-pel-unit.

[0006] In codecs such as H.264 Advanced Video Coding (AVC) and High Efficiency Video Coding (HEVC), in order to predict a motion vector of a current block, a motion vector of a previously encoded block adjacent to the current block or a block included in a previously encoded picture is used as a predicted motion vector of the current block. Summary of the Invention

[0007] Solution to the Problem

[0008] According to an embodiment, a method for decoding a motion vector may include: determining at least one PMV candidate block for determining a predicted motion vector (PMV) of a current block; determining availability of motion vectors of the at least one PMV candidate block; when there is a PMV candidate block determined to be unavailable, determining the PMV of the current block by using a default motion vector (MV); obtaining a motion vector of the current block based on the determined PMV.

[0009] Advantageous Effects of the Present Disclosure

[0010] The apparatus and method for encoding a motion vector and the apparatus and method for decoding a motion vector according to an embodiment can determine an accurate predicted motion vector for a current block by using a default motion vector, thereby reducing the bit rate for representing a residual motion vector and improving the quality of a reconstructed image. Brief Description of the Drawings

[0011] A brief description of each drawing is provided to more fully understand the drawings.

[0012] Figure 1 is a block diagram of an image decoding apparatus for decoding an image based on at least one of block shape information and partition shape information according to an embodiment.

[0013] Figure 2 is a block diagram of an image encoding apparatus for encoding an image based on at least one of block shape information and partition shape information according to an embodiment.

[0014] Figure 3 illustrates a process of dividing a current coding unit to determine at least one coding unit according to an embodiment.

[0015] Figure 4 illustrates a process of determining at least one coding unit by dividing a non-square coding unit according to an embodiment.

[0016] Figure 5 illustrates a process of dividing a coding unit based on at least one of block shape information and partition shape information according to an embodiment.

[0017] Figure 6 illustrates a method of determining a predetermined coding unit from an odd number of coding units according to an embodiment.

[0018] Figure 7 illustrates an order of processing a plurality of coding units when determining the plurality of coding units by dividing a current coding unit according to an embodiment.

[0019] Figure 8 illustrates a process of determining that a current coding unit is to be divided into an odd number of coding units when coding units cannot be processed in a predetermined order according to an embodiment.

[0020] Figure 9 illustrates a process of determining at least one coding unit by dividing a first coding unit according to an embodiment.

[0021] Figure 10It shows that when a second coding unit having a non-square shape determined by dividing a first coding unit satisfies a predetermined condition according to an embodiment, the shape into which the second coding unit can be divided is restricted.

[0022] Figure 11 It shows the process of dividing a square coding unit according to an embodiment when the division shape information indicates that the square coding unit will not be divided into four square coding units.

[0023] Figure 12 It shows that according to an embodiment, the processing order between multiple coding units can be changed based on the process of dividing coding units.

[0024] Figure 13 It shows the process of determining the depth of a coding unit as the shape and size of the coding unit change when the coding unit is recursively divided so that multiple coding units are determined according to an embodiment.

[0025] Figure 14 It shows the depth that can be determined based on the shape and size of a coding unit and the partial index (PID) used to distinguish the coding unit according to an embodiment.

[0026] Figure 15 It shows determining multiple coding units based on multiple predetermined data units included in a picture according to an embodiment.

[0027] Figure 16 It shows a processing block that serves as a criterion for determining the determination order of a reference coding unit included in a picture according to an embodiment.

[0028] Figure 17 It shows the coding units that can be determined for each picture according to an embodiment when the combination of shapes into which a coding unit can be divided is different for each picture.

[0029] Figure 18 It shows various shapes of coding units that can be determined based on division shape information that can be represented as a binary code according to an embodiment.

[0030] Figure 19 It shows other shapes of coding units that can be determined based on division shape information that can be represented as a binary code according to an embodiment.

[0031] Figure 20 It is a block diagram of an image encoding and decoding system for performing loop filtering.

[0032] Figure 21 It shows an example of a filtering unit included in a maximum coding unit and filtering execution information of the filtering unit according to an embodiment.

[0033] Figure 22Shows a process of performing merging or splitting between coding units determined according to a predetermined coding method according to an embodiment.

[0034] Figure 23 Shows an index according to the zigzag scan order of a coding unit according to an embodiment.

[0035] Figure 24 Is a diagram of reference sample points for intra prediction of a coding unit according to an embodiment.

[0036] Figure 25 Is a block diagram showing the configuration of a motion vector decoding device according to an embodiment.

[0037] Figure 26 Is a flowchart for describing a method of decoding a motion vector according to an embodiment.

[0038] Figure 27 Is a block diagram showing the configuration of a motion vector coding device according to an embodiment.

[0039] Figure 28 Is a flowchart for describing a method of coding a motion vector according to an embodiment.

[0040] Figure 29 Is a diagram showing spatial blocks and temporal blocks associated with a current block.

[0041] Figure 30 Is a diagram showing a default MV candidate block for determining a default motion vector (MV).

[0042] Figure 31 and Figure 32 Is a diagram showing a PMV candidate block for determining a predicted motion vector (PMV).

[0043] Figure 33 Is a diagram showing the positions of pixels that can be indicated by motion vectors of 1 / 4 pixel unit MVR, 1 / 2 pixel unit MVR, 1 pixel unit MVR, and 2 pixel unit MVR when the minimum motion vector resolution (MVR) selectable for a current block is 1 / 4 pixel unit MVR.

[0044] Figure 34 and Figure 35 Is a diagram for describing a method of adjusting a default MV.

[0045] Figure 36 Is a diagram showing an example syntax for describing a process of obtaining an MVR index of a current block. Detailed Description

[0046] Best Mode

[0047] According to an embodiment, a method for decoding a motion vector may include: determining at least one PMV candidate block for determining a predicted motion vector (PMV) of a current block; determining the availability of motion vectors of the at least one PMV candidate block; when there is a PMV candidate block determined to be unavailable, determining the PMV of the current block by using a default motion vector (MV); and obtaining the motion vector of the current block based on the determined PMV.

[0048] The method may further include: determining the default MV based on motion vectors of a plurality of default MV candidate blocks associated with the current block.

[0049] The step of determining the default MV may include: sequentially determining whether there is a motion vector for the plurality of default MV candidate blocks based on a priority order; and determining the default MV based on motion vectors of the plurality of default MV candidate blocks according to the order in which motion vectors are identified.

[0050] The method may further include: determining a motion vector derived by decoder-side motion vector derivation (DMVD) as the default MV.

[0051] The step of determining the default MV may include: determining the default MV based on a motion vector of a default MV candidate block having the same reference picture index as the reference picture index of the current block.

[0052] The step of determining the default MV may include: changing the priority order by considering the reference picture index of the current block and reference picture indexes of the plurality of default MV candidate blocks.

[0053] The step of determining the default MV may include: selecting at least one default MV candidate block based on magnitudes of motion vectors of the plurality of default MV candidate blocks; and determining the default MV based on the motion vector of the selected at least one default MV candidate block.

[0054] The step of selecting at least one default MV candidate block may include: selecting a default MV candidate block having the largest or smallest motion vector from the plurality of default MV candidate blocks.

[0055] The step of determining the default MV may include: determining the default MV based on an average value or a median value of motion vectors of the plurality of default MV candidate blocks.

[0056] The step of determining the default MV may include: determining the default MV by using the motion vector of a default MV candidate block selected from the plurality of default MV candidate blocks, where the default MV candidate block is selected based on the number of times the default MV candidate block is determined as a PMV in a previously decoded picture, a previously decoded slice, or a previously decoded largest coding unit.

[0057] The step of determining the default MV may include: determining a plurality of default MVs respectively corresponding to one direction from a plurality of default MV candidate blocks where the current blocks are respectively in different directions from each other.

[0058] The plurality of default MVs may include a first default MV and a second default MV, and the step of determining the default MV may include: determining the first default MV by using the motion vector of the default MV candidate block where the current block is in the first direction, and determining the second default MV by using the motion vector of the default MV candidate block where the current block is in the second direction.

[0059] The step of determining the PMV of the current block may include: when the at least one PMV candidate block includes a PMV candidate block where the current block is in the first direction and a PMV candidate block where the current block is in the second direction, when there is no motion vector in the PMV candidate block in the first direction, assigning the first default MV as the motion vector of the PMV candidate block in the first direction; and when there is no motion vector in the PMV candidate block in the second direction, assigning the second default MV as the motion vector of the PMV candidate block in the second direction to determine the PMV of the current block.

[0060] The method may further include: determining the motion vector resolution for the current block, and the step of determining the PMV of the current block may include: when there is no motion vector in the at least one PMV candidate block determined to be for the PMV according to the motion vector resolution based on the result of determining the availability of the motion vector, assigning the default MV to the PMV candidate block without a motion vector.

[0061] The step of determining the PMV of the current block may include: adjusting the default MV based on the motion vector resolution of the current block; and determining the PMV of the current block based on the adjusted default MV.

[0062] The step of determining the PMV of the current block may include: based on the result of determining the availability of the motion vector, constructing a prediction candidate list from the motion vectors of the at least one PMV candidate block; when the number of prediction candidates included in the prediction candidate list is less than a predetermined number, adding the default MV to the prediction candidate list so that the number of prediction candidates becomes the predetermined number; and determining the PMV of the current block based on the prediction candidates included in the prediction candidate list.

[0063] The step of determining the PMV of the current block may include: assigning the default MV to the PMV candidate block without a motion vector in at least one PMV candidate block at a predetermined position.

[0064] According to an embodiment, an apparatus for decoding a motion vector includes: a default motion vector determiner configured to determine a default motion vector (MV) of a current block; and a prediction decoder configured to determine the availability of at least one PMV candidate block for determining a predicted motion vector (PMV) of the current block, and when there is a PMV candidate block determined to be unavailable, configured to determine the PMV of the current block by using the determined default MV and obtain the motion vector of the current block based on the determined PMV.

[0065] According to an embodiment, a method for encoding a motion vector includes: determining the availability of motion vectors of at least one PMV candidate block for determining a predicted motion vector (PMV) of a current block; and when there is a PMV candidate block determined to be unavailable, determining the PMV of the current block by using a default motion vector (MV).

[0066] Disclosed mode

[0067] Since the present disclosure allows various changes and multiple embodiments, exemplary 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.

[0068] In the description of the present disclosure, when it is considered that specific detailed explanations in the relevant art may unnecessarily obscure the essence of the present disclosure, specific detailed explanations in the relevant art are omitted. In addition, the numbers (e.g., first and second) used in the description of the embodiments of the present disclosure are only intended to distinguish one component from another component.

[0069] When a component is referred to as being "connected" or "accessed" to any other component or being "connected" or "accessed" by any other component, it should be understood that the component can be directly connected or accessed to the other component or can be connected or accessed by the other component, but unless otherwise specifically stated, another new component can also be inserted between them.

[0070] Regarding elements having a suffix such as "unit" or "module", two or more elements can be combined into one element, or one element can be divided into two or more elements according to functions. In addition, each of the various components described below can additionally perform some or all of the functions of other components in addition to performing the main functions that each component is responsible for, and some of the main functions that each component is responsible for can be specifically performed by other components.

[0071] In addition, the term "image" or "picture" used herein may refer to a still image or a moving image of an image, that is, the image itself.

[0072] In addition, the term "sample point" used herein refers to the sampling positions assigned to an image and the data to be processed. For example, pixels in an image in the spatial domain or transform coefficients in the transform domain can be sample points. A unit including one or more sample points can be defined as a block.

[0073] In addition, the term "current block" used herein may refer to a block of the largest coding unit, coding unit, prediction unit, or transform unit of the current image to be encoded or decoded.

[0074] In addition, the term "Motion Vector Resolution (MVR)" used herein may refer to the precision of the positions of pixels in a reference image (or an interpolated reference image) that can be indicated by a motion vector determined by inter-frame prediction. When the MVR has an N-pixel unit (N is a rational number), this means that the motion vector can have a precision of N-pixel units. For example, an MVR of 1 / 4 pixel unit can indicate that the motion vector can indicate the pixel position of 1 / 4 pixel unit (i.e., sub-pixel unit) in the interpolated reference image, and an MVR of 1 pixel unit can indicate that the motion vector can indicate the pixel position corresponding to 1 pixel unit (i.e., integer pixel unit) in the interpolated reference image.

[0075] In addition, the term "candidate MVR" used herein refers to one or more MVRs that can be selected as the MVR of a block, and the term "candidate block" refers to one or more blocks mapped to the candidate MVR and can be used as the predicted motion vector of the block to be inter-frame predicted.

[0076] In addition, the term "pixel unit" used herein can be used interchangeably with the terms "pixel precision" and "pixel accuracy".

[0077] Hereinafter, reference will be made to Figures 1 to 24 Describe an image encoding method and apparatus and an image decoding method and apparatus based on coding units and transform units according to a tree structure according to an embodiment. Reference will be made to Figures 1 to 24 The described image encoding apparatus 200 and image decoding apparatus 100 may respectively include a motion vector encoding apparatus 2700 and a motion vector decoding apparatus 2500 described with reference to Figures 25 to 36 described.

[0078] Figure 1 is a block diagram of an image decoding apparatus 100 for decoding an image based on at least one of block shape information and partitioning shape information according to an embodiment.

[0079] Refer to Figure 1, according to an embodiment, the image decoding device 100 may include a bitstream acquirer 110 and a decoder 120. Among them, the bitstream acquirer 110 is configured to acquire predetermined information such as partition shape information or block shape information from a bitstream, and the decoder 120 is configured to decode an image by using the acquired information. According to an embodiment, when the bitstream acquirer 110 of the image decoding device 100 acquires at least one of the block shape information and the partition shape information, the decoder 120 of the image decoding device 100 may determine at least one coding unit for partitioning the image based on the at least one of the block shape information and the partition shape information.

[0080] According to an embodiment, the decoder 120 of the image decoding device 100 may determine the shape of a coding unit based on the block shape information. For example, the block shape information may include information indicating whether the coding unit has a square shape or a non-square shape. The decoder 120 may determine the shape of the coding unit by using the block shape information.

[0081] According to an embodiment, the decoder 120 may determine the shape into which the coding unit is to be partitioned based on the partition shape information. For example, the partition shape information may indicate information about the shape of at least one coding unit included in the coding unit.

[0082] According to an embodiment, the decoder 120 may determine whether the coding unit is to be partitioned or not according to the partition shape information. The partition shape information may include information about at least one coding unit included in the coding unit, and when the partition shape information indicates that only one coding unit is included in the coding unit or it is not to be partitioned, the decoder 120 may determine that the coding unit including the partition shape information is not to be partitioned. When the partition shape information indicates that the coding unit is to be partitioned into a plurality of coding units, the decoder 120 may partition the coding unit into the plurality of coding units included in the coding unit based on the partition shape information.

[0083] According to an embodiment, the partition shape information may indicate the number of coding units into which the coding unit is to be partitioned or the direction in which the coding unit is to be partitioned. For example, the partition shape information may indicate that the coding unit is partitioned or not partitioned in at least one of the vertical direction and the horizontal direction.

[0084] Figure 3 Illustrates the process of the image decoding device 100 according to an embodiment determining at least one coding unit by partitioning a current coding unit.

[0085] The block shape may include 4N×4N, 4N×2N, 2N×4N, 4N×N, or N×4N. N may be a positive integer. The block shape information is information indicating at least one of the ratio or size, direction, width, and height of the shape of the coding unit.

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

[0087] When the width and height of the coding unit are different from each other (4N×2N, 2N×4N, 4N×N, or N×4N), the image decoding device 100 may determine the block shape information of the coding unit as a non-square shape. When the shape of the coding unit is a non-square shape, the image decoding device 100 may determine the ratio of the width to the height in the block shape information of the coding unit as at least one of 1:2, 2:1, 1:4, 4:1, 1:8, and 8:1. In addition, the image decoding device 100 may determine whether the coding unit is in the horizontal direction or the vertical direction based on the width length and height length of the coding unit. In addition, the image decoding device 100 may determine the size of the coding unit based on at least one of the width length, height length, and area of the coding unit.

[0088] According to an embodiment, the image decoding device 100 may determine the shape of the coding unit by using the block shape information, and may determine which shape the coding unit is divided into by using the information on the division shape pattern. That is, the coding unit division method indicated by the information on the division shape pattern may be determined according to which block shape is indicated by the block shape information used by the image decoding device 100.

[0089] The image decoding device 100 may obtain the information on the division shape pattern from the bitstream. However, the present disclosure is not limited thereto, and the image decoding device 100 and the image encoding device 200 may obtain the information on the division shape pattern pre-agreed based on the block shape information. The image decoding device 100 may obtain the information on the division shape pattern pre-agreed for the largest coding unit or the smallest coding unit. For example, the image decoding device 100 may determine the size of the largest coding unit as 256×256. The image decoding device 100 may determine the information on the pre-agreed division shape pattern by using four-way division. Four-way division is a division shape pattern that bisects the width and height of the coding unit. The image decoding device 100 may obtain a coding unit of size 128×128 from the largest coding unit of size 256×256 based on the information on the division shape pattern. In addition, the image decoding device 100 may determine the size of the smallest coding unit as 4×4. The image decoding device 100 may obtain the information on the division shape pattern indicating "no division is performed" for the smallest coding unit.

[0090] According to an embodiment, the image decoding device 100 may use block shape information indicating that the current coding unit has a square shape. For example, the image decoding device 100 may determine whether to not divide the square coding unit, vertically divide the square coding unit, horizontally divide the square coding unit, or divide the square coding unit into four coding units based on information about the partitioning shape mode. Refer to Figure 3 , when the block shape information of the current coding unit 300 indicates a square shape, the decoder 120 may determine not to divide the coding unit 310a having the same size as the current coding unit 300 based on the information about the partitioning shape mode indicating no partitioning, or may determine the coding units 310b, 310c, or 310d divided based on the information about the partitioning shape mode indicating a predetermined partitioning method.

[0091] Refer to Figure 3 , according to an embodiment, the image decoding device 100 may determine two coding units 310b obtained by vertically dividing the current coding unit 300 based on the information about the partitioning shape mode indicating vertical partitioning. The image decoding device 100 may determine two coding units 310c obtained by horizontally dividing the current coding unit 300 based on the information about the partitioning shape mode indicating horizontal partitioning. The image decoding device 100 may determine four coding units 310d obtained by vertically and horizontally dividing the current coding unit 300 based on the information about the partitioning shape mode indicating vertical and horizontal partitioning. However, the method of dividing the square coding unit is not limited to the above method, and the information about the partitioning shape mode may indicate various methods. A predetermined partitioning method for dividing the square coding unit will be described in detail with respect to various embodiments below.

[0092] Figure 4 Shows a process of determining at least one coding unit by dividing a non-square coding unit performed by the image decoding device 100 according to an embodiment.

[0093] According to an embodiment, the image decoding device 100 may use block shape information indicating that the current coding unit has a non-square shape. The image decoding device 100 may determine whether to not divide the non-square current coding unit or divide the non-square current coding unit by using a predetermined partitioning method based on the information about the partitioning shape mode. Refer to Figure 4, when the block shape information of the current coding unit 400 or 450 indicates a non-square shape, the image decoding device 100 may determine that the coding unit 410 or 460 having the same size as the current coding unit 400 or 450 is not divided based on the information about the partition shape pattern indicating not to perform partitioning, or determine the coding units 420a and 420b, 430a to 430c, 470a and 470b, or 480a to 480c that are partitioned based on the information about the partition shape pattern indicating a predetermined partitioning method. The predetermined partitioning method for partitioning a non-square coding unit will be described in detail with respect to various embodiments below.

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

[0095] According to an embodiment, when the image decoding device 100 partitions the non-square current coding unit 400 or 450 based on the information about the partition shape pattern, the position of the long side of the non-square current coding unit 400 or 450 may be considered. For example, the image decoding device 100 may consider the shape of the current coding unit 400 or 450 and determine a plurality of coding units by partitioning the long side of the current coding unit 400 or 450.

[0096] According to an embodiment, when the information about the partition shape pattern indicates that the coding unit is partitioned into an odd number of blocks, the image decoding device 100 may determine an odd number of coding units included in the current coding unit 400 or 450. For example, when the information about the partition shape pattern indicates that the current coding unit 400 or 450 is partitioned into three coding units, the image decoding device 100 may partition the current coding unit 400 or 450 into three coding units 430a, 430b, and 430c or 480a, 480b, and 480c.

[0097] According to an embodiment, the ratio between the width and the height of the current coding unit 400 or 450 may be 4:1 or 1:4. When the ratio between the width and the height is 4:1, the width length is greater than the height length, and thus the block shape information may be horizontal. When the ratio between the width and the height is 1:4, the width length is less than the height length, and thus the block shape information may be vertical. The image decoding device 100 may determine to divide the current coding unit into an odd number of blocks based on the information about the partitioning shape mode. In addition, the image decoding device 100 may determine the partitioning direction of the current coding unit 400 or 450 based on the block shape information of the current coding unit 400 or 450. For example, when the current coding unit 400 is in the vertical direction, the image decoding device 100 may horizontally divide the current coding unit 400 and may determine the coding units 430a, 430b, and 430c. In addition, when the current coding unit 450 is in the horizontal direction, the image decoding device 100 may vertically divide the current coding unit 450 and may determine the coding units 480a, 480b, and 480c.

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

[0099] According to an embodiment, when the information about the partitioning shape mode indicates that the coding unit is to be divided into an odd number of blocks, the image decoding device 100 may determine an odd number of coding units included in the current coding unit 400 or 450, and may impose a predetermined restriction on at least one of the odd number of coding units generated by dividing the current coding unit 400 or 450. Refer to Figure 4, the image decoding device 100 may allow the decoding method of the coding unit 430b or 480b to be different from the decoding methods of the other coding units 430a and 430c or 480a and 480c, where the coding unit 430b or 480b is at the central position among the three coding units 430a, 430b, and 430c or 480a, 480b, and 480c generated by dividing the current coding unit 400 or 450. For example, different from the other coding units 430a and 430c or 480a and 480c, the image decoding device 100 may limit the coding unit 430b or 480b at the central position from being further divided or only divided a predetermined number of times.

[0100] Figure 5 Illustrates the process of dividing a coding unit based on at least one of block shape information and information on a division shape pattern performed by the image decoding device 100 according to an embodiment.

[0101] According to an embodiment, the image decoding device 100 may determine to divide the first square coding unit 500 into coding units or not divide the first square coding unit 500 based on at least one of block shape information and information on a division shape pattern. According to an embodiment, when the information on the division shape pattern indicates dividing the first coding unit 500 in the horizontal direction, the image decoding device 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 an embodiment are terms for understanding the relationship before and after dividing the coding unit. 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 among the first coding unit, the second coding unit, and the third coding unit follows the above description.

[0102] According to an embodiment, the image decoding device 100 may determine to divide the determined second coding unit 510 into coding units or not divide the determined second coding unit 510 based on at least one of block shape information and information on a division shape pattern. Refer to Figure 5, the image decoding device 100 may or may not divide the non-square second coding unit 510 determined by dividing the first coding unit 500 into one or more third coding units 520a or 520b, 520c, and 520d based on at least one of the block shape information and the information about the division shape pattern. The image decoding device 100 may obtain at least one of the block shape information and the information about the division shape pattern, and divide the first coding unit 500 to divide out a plurality of second coding units (e.g., 510) of various shapes based on at least one of the obtained block shape information and the information about the division shape pattern, and may divide the second coding unit 510 based on at least one of the block shape information and the information about the division shape pattern by using the division method of the first coding unit 500. According to an embodiment, when the first coding unit 500 is divided into the second coding unit 510 based on at least one of the block shape information of the first coding unit 500 and the information about the division shape pattern, the second coding unit 510 may also be divided into the third coding unit 520a or 520b, 520c, and 520d based on at least one of the block shape information of the second coding unit 510 and the information about the division shape pattern. That is, the coding unit may be recursively divided based on at least one of the block shape information of each coding unit and the information about the division shape pattern. Therefore, the square coding unit may be determined by dividing the non-square coding unit, and the non-square coding unit may be determined by recursively dividing the square coding unit.

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

[0104] According to an embodiment, the image decoding device 100 may divide each of the third coding units 520a or 520b, 520c, and 520d into coding units based on at least one of the block shape information and the information on the partitioning shape mode. In addition, the image decoding device 100 may determine not to divide the second coding unit 510 based on at least one of the block shape information and the information on the partitioning shape mode. According to an embodiment, the image decoding device 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 device 100 may impose a predetermined restriction on a predetermined third coding unit among the odd number of third coding units 520b, 520c, and 520d. For example, the image decoding device 100 may restrict the third coding unit 520c at the central position among the odd number of third coding units 520b, 520c, and 520d from being further divided or from being divided a settable number of times.

[0105] Referring to Figure 5 , the image decoding device 100 may restrict the third coding unit 520c at the central position among the odd number of third coding units 520b, 520c, and 520d included in the non-square second coding unit 510 from being further divided, from being divided by using a predetermined partitioning method (e.g., only divided into four coding units or divided by using the partitioning method of the second coding unit 510), or from being divided only a predetermined number of times (e.g., only divided n times (where n > 0)). However, the restriction on the third coding unit 520c at the central position is not limited to the above examples and may include various restrictions for decoding the third coding unit 520c at the central position differently from the other third coding units 520b and 520d.

[0106] According to an embodiment, the image decoding device 100 may obtain at least one of the block shape information and the information on the partitioning shape mode for partitioning the current coding unit from a predetermined position in the current coding unit.

[0107] Figure 6 FIG. shows a method of determining a predetermined coding unit from an odd number of coding units performed by the image decoding device 100 according to an embodiment.

[0108] Referring to Figure 6 , at least one of the block shape information and the information on the partitioning shape mode of the current coding unit 600 or 650 may be obtained from a sample at a predetermined position (e.g., the sample 640 or 690 at the central position) among the plurality of samples included in the current coding unit 600 or 650. However, the predetermined position in the current coding unit 600 from which at least one of the block shape information and the information on the partitioning shape mode can be obtained is not limited to Figure 6in the central position, and may include various positions included in the current coding unit 600 (e.g., upper, lower, left, right, upper left, lower left, upper right, and lower right positions). The image decoding device 100 may obtain at least one of block shape information and information on a partitioning shape mode from the predetermined position, and determine to partition the current coding unit into coding units of various shapes and various sizes or not to partition the current coding unit.

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

[0110] According to an embodiment, the image decoding device 100 may partition the current coding unit into a plurality of coding units, and may determine the coding unit at the predetermined position.

[0111] According to an embodiment, the image decoding device 100 may use information indicating the position of an odd number of coding units to determine the coding unit at the central position among the odd number of coding units. Referring to Figure 6 FIG., the image decoding device 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 partitioning the current coding unit 600 or the current coding unit 650. The image decoding device 100 may determine the coding unit 620b at the central position or the coding unit 660b at the central position by using information on the positions of the odd number of coding units 620a, 620b, and 620c or the odd number of coding units 660a, 660b, and 660c. For example, the image decoding device 100 may determine the position of the coding unit 620b at the central position by determining the positions of the coding units 620a, 620b, and 620c based on information indicating the position of a predetermined sample point included in the coding units 620a, 620b, and 620c. Specifically, the image decoding device 100 may determine the position of the coding unit 620b at the central position by determining the positions of the coding units 620a, 620b, and 620c based on information indicating the positions of the upper left sample points 630a, 630b, and 630c of the coding units 620a, 620b, and 620c.

[0112] According to an embodiment, the information indicating the positions of the upper-left samples 630a, 630b, and 630c included in the coding units 620a, 620b, and 620c, respectively, 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 samples 630a, 630b, and 630c included in the coding units 620a, 620b, and 620c, respectively, may include information indicating the widths or heights 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 differences between the coordinates of the coding units 620a, 620b, and 620c in the picture. That is, the image decoding device 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 widths or heights of the coding units corresponding to the differences between the coordinates.

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

[0114] According to an embodiment, the image decoding device 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 predetermined criterion. For example, the image decoding device 100 may select the coding unit 620b having a size different from the sizes of the other coding units from among the coding units 620a, 620b, and 620c.

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

[0116] The image decoding device 100 can determine the width or height of each of the coding units 660a, 660b, and 660c by using the coordinates (xd, yd) which are information indicating the position of the upper left sample 670a of the left coding unit 660a, the coordinates (xe, ye) which are information indicating the position of the upper left sample 670b of the middle coding unit 660b, and the coordinates (xf, yf) which are information indicating the position of the upper left sample 670c of the right coding unit 660c. The image decoding device 100 can determine the size 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.

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

[0118] However, the position of the sample considered for determining the position of the coding unit is not limited to the upper left position described above, and information on any position of the samples included in the coding unit can be used.

[0119] According to an embodiment, the image decoding device 100 may select a coding unit at a predetermined position from among an odd number of coding units determined by dividing a current coding unit, considering the shape of the current coding unit. For example, when the current coding unit has a non-square shape with a width greater than the height, the image decoding device 100 may determine a coding unit at a predetermined position along the horizontal direction. That is, the image decoding device 100 may determine one coding unit among coding units at different positions along the horizontal direction and may impose a restriction on the coding unit. When the current coding unit has a non-square shape with a height greater than the width, the image decoding device 100 may determine a coding unit at a predetermined position along the vertical direction. That is, the image decoding device 100 may determine one coding unit among coding units at different positions along the vertical direction and may impose a restriction on the coding unit.

[0120] According to an embodiment, the image decoding device 100 may use information indicating the respective positions of an even number of coding units to determine a coding unit at a predetermined position among the even number of coding units. The image decoding device 100 may determine the even number of coding units by dividing the current coding unit and may determine a coding unit at a predetermined position by using information about the positions of the even number of coding units. Operations related thereto may correspond to the operations of determining a coding unit at a predetermined position (e.g., a center position) among an odd number of coding units described in detail above, and thus detailed descriptions thereof are not provided here. Figure 6 Detailed description of the operation of determining a coding unit at a predetermined position (e.g., a center position) among an odd number of coding units has been provided above, and thus detailed descriptions thereof are not provided here.

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

[0122] Refer to Figure 6, the image decoding device 100 may divide the current coding unit 600 into a plurality of coding units 620a, 620b, and 620c based on at least one of the block shape information and the information about the partitioning shape mode, and may determine the coding unit 620b at the central position among the plurality of coding units 620a, 620b, and 620c. In addition, the image decoding device 100 may determine the coding unit 620b at the central position by considering the position where at least one of the block shape information and the information about the partitioning shape mode is obtained. That is, at least one of the block shape information and the information about the partitioning shape mode of the current coding unit 600 may be obtained from the sample point 640 at the central 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 at least one of the block shape information and the information about the partitioning shape mode, the coding unit 620b including the sample point 640 may be determined as the coding unit at the central position. However, the information for determining the coding unit at the central position is not limited to at least one of the block shape information and the information about the partitioning shape mode, and various types of information may be used to determine the coding unit at the central position.

[0123] According to an embodiment, predetermined information for identifying a coding unit at a predetermined position may be obtained from a predetermined sample point included in the coding unit to be determined. Refer to Figure 6 , the image decoding device 100 may use at least one of the block shape information and the information about the partitioning shape mode obtained from a sample point at a predetermined position in the current coding unit 600 (e.g., the sample point at the central position of the current coding unit 600) to determine the coding unit at a predetermined position (e.g., the coding unit at the central position among the divided plurality of coding units) among the plurality of coding units 620a, 620b, and 620c determined by dividing the current coding unit 600. That is, the image decoding device 100 may determine the sample point at the predetermined position by considering the block shape of the current coding unit 600, determine the coding unit 620b including the sample point from which predetermined information (e.g., at least one of the block shape information and the information about the partitioning shape mode) can be obtained among the plurality of coding units 620a, 620b, and 620c determined by dividing the current coding unit 600, and may impose a predetermined restriction on the coding unit 620b. Refer to Figure 6 , according to an embodiment, in the decoding operation, the image decoding device 100 may determine the sample point 640 at the central position of the current coding unit 600 as the sample point from which predetermined information can be obtained, and may impose a predetermined restriction on the coding unit 620b including the sample point 640. However, the position of the sample point from which predetermined information can be obtained is not limited to the above position, and may include any position of the sample point to be determined for restriction included in the coding unit 620b.

[0124] According to an embodiment, the positions of sample points from which predetermined 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 positions of sample points from which predetermined information can be obtained may be determined based on the shape. For example, the image decoding device 100 may determine, by using at least one of the information on the width of the current coding unit and the information on the height of the current coding unit, a sample point located on a boundary that divides at least one of the width and the height of the current coding unit in half as a sample point from which predetermined information can be obtained. As another example, when the block shape information of the current coding unit indicates a non-square shape, the image decoding device 100 may determine one of the sample points adjacent to the boundary that divides the long side of the current coding unit in half as a sample point from which predetermined information can be obtained.

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

[0126] According to an embodiment, the image decoding device 100 may determine one or more coding units by dividing the current coding unit, and may determine the decoding order of the one or more coding units based on a predetermined block (e.g., the current coding unit).

[0127] Figure 7 FIG. shows the order of processing the plurality of coding units when the image decoding device 100 determines the plurality of coding units by dividing the current coding unit according to an embodiment.

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

[0129] Referring to Figure 7 , the image decoding device 100 may determine to process the second coding units 710a and 710b determined by partitioning the first coding unit 700 in the vertical direction in the horizontal direction order 710c. The image decoding device 100 may determine to process the second coding units 730a and 730b determined by partitioning the first coding unit 700 in the horizontal direction in the vertical direction order 730c. The image decoding device 100 may determine to process the second coding units 750a to 750d determined by partitioning the first coding unit 700 in both the vertical and horizontal directions in a predetermined order (e.g., in a raster scan order or a zigzag scan order 750e), where the predetermined order is for processing the coding units in a row and then processing the coding units in the next row.

[0130] According to an embodiment, the image decoding device 100 may recursively partition the coding units. Referring to Figure 7 , the image decoding device 100 may determine a plurality of coding units 710a, 710b, 730a, 730b, 750a, 750b, 750c, and 750d by partitioning the first coding unit 700, and may recursively partition each of the determined plurality of coding units 710a, 710b, 730a, 730b, 750a, 750b, 750c, and 750d. The partitioning method of the plurality of coding units 710a, 710b, 730a, 730b, 750a, 750b, 750c, and 750d may correspond to the partitioning method of the first coding unit 700. Thus, each of the plurality of coding units 710a, 710b, 730a, 730b, 750a, 750b, 750c, and 750d may be independently partitioned into a plurality of coding units. Referring to Figure 7 , the image decoding device 100 may determine second coding units 710a and 710b by partitioning the first coding unit 700 in the vertical direction, and may determine to independently partition each of the second coding units 710a and 710b or not partition each of the second coding units 710a and 710b.

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

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

[0133] Figure 8 Illustrates the process of determining that the current coding unit is to be divided into an odd number of coding units when the coding units cannot be processed in a predetermined order, which is performed by the image decoding device 100 according to an embodiment.

[0134] According to an embodiment, the image decoding device 100 may determine whether the current coding unit is divided into an odd number of coding units based on the obtained block shape information and information on the division shape pattern. Refer to 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 device 100 may determine a plurality of third coding units 820a and 820b by dividing the second coding unit 810a on the left in the horizontal direction, and may divide the second coding unit 810b on the right into an odd number of third coding units 820c to 820e.

[0135] According to an embodiment, the image decoding device 100 may determine whether to divide any coding unit into an odd number of coding units by determining whether the third coding units 820a, 820b, and 820c to 820e can be processed in a predetermined order. Refer to Figure 8 , the image decoding device 100 may determine the third coding units 820a, 820b, and 820c to 820e by recursively dividing the first coding unit 800. The image decoding device 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 information about the division shape pattern: the first coding unit 800, the second coding units 810a and 810b, and the third coding units 820a, 820b, 820c, 820d, and 820e. For example, the second coding unit 810b on the right side 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 may be a predetermined order (e.g., the zigzag scan order 830), and the image decoding device 100 may determine whether the third coding units 820c, 820d, and 820e determined by dividing the second coding unit 810b on the right side into an odd number of coding units satisfy the conditions for processing in a predetermined order.

[0136] According to an embodiment, the image decoding device 100 may determine whether the third coding units 820a, 820b, 820c, 820d, and 820e included in the first coding unit 800 satisfy the conditions for processing in a predetermined order, and the conditions relate to whether at least one of the width and height of the second coding units 810a and 810b is halved along the boundaries of the third coding units 820a, 820b, 820c, 820d, and 820e. For example, the third coding units 820a and 820b determined by halving the height of the non-square second coding unit 810a on the left side satisfy the above conditions. However, since the boundaries of the third coding units 820c, 820d, and 820e determined by dividing the second coding unit 810b on the right side into three coding units do not halve the width or height of the second coding unit 810b on the right side, it can be determined that the third coding units 820c, 820d, and 820e do not satisfy the above conditions. When the above conditions are not satisfied as described above, the image decoding device 100 may determine that the scan order is discontinuous, and based on the determination result, determine that the second coding unit 810b on the right side is divided into an odd number of coding units. According to an embodiment, when a coding unit is divided into an odd number of coding units, the image decoding device 100 may impose a predetermined restriction on the coding unit at a predetermined position among the divided coding units. The above restrictions or the predetermined positions have been described with respect to various embodiments, so their detailed descriptions will not be provided here.

[0137] Figure 9 The process of determining at least one coding unit by dividing a first coding unit 900, which is performed by the image decoding device 100 according to an embodiment, is shown.

[0138] According to an embodiment, the image decoding device 100 may divide the first coding unit 900 based on at least one of block shape information and information on a division shape mode obtained by the bitstream acquirer 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. For example, referring to Figure 9 , when the block shape information indicates that the first coding unit 900 has a square shape and the information on the division shape mode indicates that the first coding unit 900 is to be divided into non-square coding units, the image decoding device 100 may divide the first coding unit 900 into a plurality of non-square coding units. Specifically, when the information on the division shape mode indicates that an odd number of coding units are to be determined by dividing the first coding unit 900 in the horizontal or vertical direction, the image decoding device 100 may divide the square first coding unit 900 into an odd number of coding units (e.g., second coding units 910a, 910b, and 910c determined by dividing the square first coding unit 900 in the vertical direction, or second coding units 920a, 920b, and 920c determined by dividing the square first coding unit 900 in the horizontal direction).

[0139] According to an embodiment, the image decoding device 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 predetermined order, and the condition is related to whether at least one of the width and height of the first coding unit 900 is halved along the boundaries of the second coding units 910a, 910b, 910c, 920a, 920b, and 920c. Referring to Figure 9, since the boundaries of the second coding units 910a, 910b, and 910c determined by dividing the first coding unit 900 of a square in the vertical direction do not divide the width of the first coding unit 900 into two equal parts, it can be determined that the first coding unit 900 does not satisfy the condition for being processed in a predetermined order. In addition, since the boundaries of the second coding units 920a, 920b, and 920c determined by dividing the first coding unit 900 of a square in the horizontal direction do not divide the height of the first coding unit 900 into two equal parts, it can be determined that the first coding unit 900 does not satisfy the condition for being processed in a predetermined order. When the above-mentioned condition is not satisfied as described above, the image decoding device 100 can determine that the scanning order is not continuous, and can determine that the first coding unit 900 is divided into an odd number of coding units based on the determination result. According to an embodiment, when a coding unit is divided into an odd number of coding units, the image decoding device 100 can impose a predetermined restriction on the coding unit at a predetermined position among the divided coding units. The above-mentioned restriction or the predetermined position has been described with respect to various embodiments, and thus its detailed description will not be provided here.

[0140] According to an embodiment, the image decoding device 100 can determine coding units of various shapes by dividing the first coding unit.

[0141] Referring to Figure 9 , the image decoding device 100 can divide the first coding unit 900 of a square or the first coding units 930 or 950 of non-square shapes into coding units of various shapes.

[0142] Figure 10 It shows that when the second coding units of non-square shapes determined by dividing the first coding unit 1000 according to an embodiment satisfy a predetermined condition, the shapes into which the image decoding device 100 can divide the second coding units are restricted.

[0143] According to an embodiment, the image decoding device 100 may determine to divide a first square coding unit 1000 into non-square second coding units 1010a, 1010b, 1020a, and 1020b based on at least one of block shape information and information on a partitioning shape pattern obtained by the bitstream acquirer 110. The second coding units 1010a, 1010b, 1020a, and 1020b may be independently partitioned. Thus, based on at least one of the block shape information and the information on the partitioning shape pattern for each of the second coding units 1010a, 1010b, 1020a, and 1020b, the image decoding device 100 may determine to divide the first coding unit 1000 into a plurality of coding units or not to divide the first coding unit 1000. According to an embodiment, the image decoding device 100 may determine third coding units 1012a and 1012b by partitioning a non-square left second coding unit 1010a determined by partitioning the first coding unit 1000 in the vertical direction in the horizontal direction. However, when the left second coding unit 1010a is partitioned in the horizontal direction, the image decoding device 100 may restrict the right second coding unit 1010b from being partitioned in the horizontal direction in which the left second coding unit 1010a is partitioned. When determining third coding units 1014a and 1014b by partitioning 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 partitioned in the horizontal direction, the third coding units 1012a, 1012b, 1014a, and 1014b may be determined. However, this situation has the same effect as the case where the image decoding device 100 divides the first coding unit 1000 into four square second coding units 1030a, 1030b, 1030c, and 1030d based on at least one of the block shape information and the information on the partitioning shape pattern, and may be inefficient in terms of image decoding.

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

[0145] Figure 11Shows the process of dividing a square coding unit when information about a division shape pattern indicates that the square coding unit will not be divided into four square coding units, which is performed by the image decoding device 100 according to an embodiment.

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

[0147] According to an embodiment, the image decoding device 100 may independently divide non-square second coding units 1110a, 1110b, 1120a, 1120b, etc. Each of the second coding units 1110a, 1110b, 1120a, 1120b, etc. may be recursively divided in a predetermined order, and the division method may correspond to the method of dividing the first coding unit 1100 based on at least one of block shape information and information about a division shape pattern.

[0148] For example, the image decoding device 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 device 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.

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

[0150] Figure 12 It is shown that according to an embodiment, the processing order between multiple coding units may be changed according to the process of dividing coding units.

[0151] According to an embodiment, the image decoding device 100 may divide the first coding unit 1200 based on block shape information and information on a division shape pattern. When the block shape information indicates a square shape and the information on the division shape pattern indicates that the first coding unit 1200 is divided in at least one of the horizontal and vertical directions, the image decoding device 100 may determine second coding units 1210a, 1210b, 1220a, and 1220b by dividing the first coding unit 1200. Referring to Figure 12 , the non-square second coding units 1210a, 1210b, 1220a, and 1220b determined by dividing the first coding unit 1200 only in the horizontal or vertical direction may be independently divided based on the block shape information of each coding unit and the information on the division shape pattern. For example, the image decoding device 100 may determine third coding units 1216a, 1216b, 1216c, and 1216d by dividing the second coding units 1210a and 1210b generated by dividing the first coding unit 1200 in the vertical direction in the horizontal direction, and may determine third coding units 1226a, 1226b, 1226c, and 1226d by dividing the second coding units 1220a and 1220b generated by dividing the first coding unit 1200 in the horizontal direction in the vertical direction. The operations of dividing the second coding units 1210a, 1210b, 1220a, and 1220b have been described above with respect to Figure 11 and thus a detailed description thereof will not be provided here.

[0152] According to an embodiment, the image decoding device 100 may process coding units in a predetermined order. It has been described above with respect to Figure 7The operation of processing coding units in a predetermined order is described, and thus its detailed description will not be provided here. Refer to Figure 12 , the image decoding device 100 may determine four square third coding units 1216a, 1216b, 1216c, and 1216d and 1226a, 1226b, 1226c, and 1226d by dividing the first coding unit 1200 of a square. According to an embodiment, the image decoding device 100 may determine the processing order of the third coding units 1216a, 1216b, 1216c, and 1216d and 1226a, 1226b, 1226c, and 1226d based on the division method of the first coding unit 1200.

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

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

[0155] Refer to Figure 12, the third coding units 1216a, 1216b, 1216c, 1216d and 1226a, 1226b, 1226c, 1226d of a square can be determined by respectively dividing the second coding units 1210a, 1210b, 1220a and 1220b. Although the second coding units 1210a and 1210b determined by dividing the first coding unit 1200 in the vertical direction are different from the second coding units 1220a and 1220b determined by dividing the first coding unit 1200 in the horizontal direction, the third coding units 1216a, 1216b, 1216c, 1216d and 1226a, 1226b, 1226c, 1226d divided from the second coding units 1210a and 1210b and the second coding units 1220a and 1220b finally show coding units of the same shape divided from the first coding unit 1200. Thus, by recursively dividing coding units in different ways based on at least one of block shape information and information on a division shape pattern, even if the coding units are finally determined to be of the same shape, the image decoding device 100 can process multiple coding units in different orders.

[0156] Figure 13 Shows the process of determining the depth of a coding unit as the shape and size of the coding unit change when recursively dividing the coding unit such that multiple coding units are determined according to an embodiment.

[0157] According to an embodiment, the image decoding device 100 can determine the depth of a coding unit based on a predetermined criterion. For example, the predetermined criterion can 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 division, the image decoding device 100 can determine that the depth of the current coding unit is increased by n compared to the depth of the coding unit before division. In the following description, a coding unit with an increased depth is represented as a coding unit with a deeper depth.

[0158] Refer to Figure 13, According to an embodiment, the image decoding device 100 may determine a second coding unit 1302 and a third coding unit 1304 with a deeper depth by dividing a first coding unit 1300 of a square shape based on block shape information indicating a square shape (e.g., the block shape information may be represented as "0:SQUARE"). Assuming that the size of the first coding unit 1300 of the square is 2N×2N, the second coding unit 1302 determined by dividing the width and height of the first coding unit 1300 to 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 to 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 with a width and height that 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 with a width and height that are 1 / 4 of the width and height of the first coding unit 1300 may be D+2.

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

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

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

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

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

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

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

[0166] 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 having a width and height that 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 having a width and height that are 1 / 4 of the width and height of the first coding unit 1310 or 1320 may be D + 2.

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

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

[0169] 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 information on the partitioning shape pattern of the square-based 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-based first coding unit 1400 is equal to the lengths of the long sides of the non-square second coding units 1402a and 1402b and 1404a and 1404b, the first coding unit 1400 and the non-square second coding units 1402a and 1402b and 1404a and 1404b may have the same depth, e.g., D. However, when the image decoding device 100 partitions the first coding unit 1400 into four square second coding units 1406a, 1406b, 1406c, and 1406d based on the information on the partitioning shape pattern, since the lengths of the sides of the square second coding units 1406a, 1406b, 1406c, and 1406d are 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 may be D + 1, which is 1 deeper than the depth D of the first coding unit 1400.

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

[0171] According to an embodiment, the depths of the second coding units 1412a and 1412b, the second coding units 1414a, 1414b, and 1414c, the second coding units 1422a and 1422b, and the second coding units 1424a, 1424b, and 1424c determined based on the information on the partitioning shape pattern of the non-square first coding unit 1410 or 1420 may be determined based on the lengths of their long sides. For example, since the lengths of the sides of the square second coding units 1412a and 1412b are 1 / 2 of the length of the long side of the non-square first coding unit 1410 having a height longer than its 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.

[0172] In addition, the image decoding device 100 may divide the non-square first coding unit 1410 into an odd number of second coding units 1414a, 1414b, and 1414c based on information about the partitioning shape pattern. The odd number of second coding units 1414a, 1414b, and 1414c may include non-square second coding units 1414a and 1414c and a 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 device 100 may determine the depth of the coding units divided from the first coding unit 1420 having a non-square shape with a width longer than the height by using the method of determining the depth of the coding units divided from the first coding unit 1410 described above.

[0173] According to an embodiment, when the odd number of divided coding units do not have equal sizes, the image decoding device 100 may determine the PID for identifying the divided coding units based on the size ratio between the coding units. Referring to Figure 14 , the width of the coding unit 1414b at the center position among the odd number of divided coding units 1414a, 1414b, and 1414c may be equal to the widths 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 adjacent to the coding unit 1414b in position may increase by 2 and thus may be 3. That is, there may be a discontinuity in the PID values. According to an embodiment, the image decoding device 100 may determine whether the odd number of divided coding units do not have equal sizes based on whether there is a discontinuity in the PIDs for identifying the divided coding units.

[0174] According to an embodiment, the image decoding device 100 may determine whether to use a specific partitioning method based on the PID values for identifying the multiple coding units determined by partitioning the current coding unit. Referring to Figure 14, the image decoding device 100 may determine an even number of coding units 1412a and 1412b or an odd number of coding units 1414a, 1414b, and 1414c by dividing a first coding unit 1410 having a rectangular shape with a height longer than a width. The image decoding device 100 may use a PID to identify each coding unit. According to an embodiment, the PID may be obtained from samples at a predetermined position of each coding unit (e.g., the upper left sample).

[0175] According to an embodiment, the image decoding device 100 may determine a coding unit at a predetermined position in the divided coding units by using the PID for differentiating coding units. According to an embodiment, when the information on the division shape pattern of the first coding unit 1410 having a rectangular shape with a height longer than a width indicates that the coding unit is divided into three coding units, the image decoding device 100 may divide the first coding unit 1410 into three coding units 1414a, 1414b, and 1414c. The image decoding device 100 may assign a PID to each of the three coding units 1414a, 1414b, and 1414c. The image decoding device 100 may compare the PIDs of the odd number of divided coding units to determine the coding unit at the central position among the odd number of divided coding units. The image decoding device 100 may determine the coding unit 1414b having a PID corresponding to the median value among the PIDs of the coding units as the coding unit at the central 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 device 100 may determine the PID for differentiating the divided coding units based on the size ratio between the coding units. Refer to Figure 14, the width of the coding unit 1414b generated by dividing the first coding unit 1410 may be equal to the widths of the other coding units 1414a and 1414c, and its height may be twice the heights of the other coding units 1414a and 1414c. In this case, when the PID of the coding unit 1414b at the center position is 1, the PID of the coding unit 1414c adjacent to the coding unit 1414b in position may be increased by 2 and thus may be 3. When the PID does not increase uniformly as described above, the image decoding device 100 may determine that the coding unit is divided into a plurality of coding units, where the plurality of coding units includes a coding unit having a size different from the sizes of the other coding units. According to an embodiment, when the information about the division shape pattern indicates that the coding unit is divided into an odd number of coding units, the image decoding device 100 may divide the current coding unit in such a way that the coding unit at a predetermined position (e.g., the coding unit at the center position) among the odd number of coding units has a size different from the sizes of the other coding units. In this case, the image decoding device 100 may determine the coding unit at the center position having a different size by using the PID of the coding unit. However, the PID, size, or position of the coding unit at the predetermined position is not limited to the above examples, and various PIDs, positions, and sizes of the coding unit may be used.

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

[0177] Figure 15 Illustrates determining a plurality of coding units based on a plurality of predetermined data units included in a picture according to an embodiment.

[0178] According to an embodiment, the predetermined data unit may be defined as a data unit in which the coding unit starts to be recursively divided by using at least one of block shape information and information about the division shape pattern. That is, the predetermined data unit may correspond to the coding unit for determining the highest depth of the plurality of coding units divided from the current picture. In the following description, for ease of explanation, the predetermined data unit is referred to as a reference data unit.

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

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

[0181] According to an embodiment, the image decoding device 100 may pre-determine a minimum size allowed for a reference data unit included in the current picture. Accordingly, the image decoding device 100 may determine various reference data units having a size equal to or greater than the minimum size, and may determine one or more coding units by referring to the determined reference data units and using block shape information and information on a partitioning shape pattern.

[0182] Refer to Figure 15 , the image decoding device 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., sequence, picture, slice, slice segment, largest coding unit, etc.) capable of including one or more reference coding units.

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

[0184] According to an embodiment, the image decoding device 100 may determine the size and shape of a reference coding unit by using a PID for identifying the size and shape of the reference coding unit according to some data units previously determined based on a predetermined condition. That is, the bitstream acquirer 110 may acquire from the bitstream only the PID for identifying the size and shape of the reference coding unit for each slice, slice segment, or largest coding unit, where each slice, slice segment, or largest coding unit is a data unit (e.g., sequence, picture, slice, slice segment, largest coding unit, etc.) among various data units that satisfies the predetermined condition (e.g., a data unit having a size equal to or smaller than the slice). The image decoding device 100 may determine the size and shape of the reference data unit for each data unit that satisfies the predetermined condition by using the PID. When the reference coding unit shape information and the reference coding unit size information are acquired 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. Therefore, only the PID may be acquired and used instead of directly acquiring the reference coding unit shape information and the reference coding unit size information. In this case, at least one of the size and shape of the reference coding unit corresponding to the PID for identifying the size and shape of the reference coding unit may be determined in advance. That is, the image decoding device 100 may determine at least one of the size and shape of the reference coding unit included in the data unit used as the unit for acquiring the PID by selecting at least one of the size and shape of the reference coding unit determined in advance based on the PID.

[0185] According to an embodiment, the image decoding device 100 may use one or more reference coding units included in the largest coding unit. That is, the largest coding unit divided from a picture may include one or more reference coding units, and the coding units may be determined by recursively dividing each reference coding unit. According to an embodiment, at least one of the width and height of the largest 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 largest 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 largest coding unit n times based on a quadtree structure, and may divide the reference coding unit based on at least one of the block shape information and the information on the division shape pattern.

[0186] Figure 16 A processing block serving as a unit for determining the determination order of the reference coding units included in the picture 1600 according to an embodiment is shown.

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

[0188] According to an embodiment, the image decoding device 100 may obtain processing block size information and may determine the sizes of one or more processing blocks included in a picture. The image decoding device 100 may obtain the processing block size information from a bitstream and may determine the sizes of one or more processing blocks included in the picture. The size of a processing block may be a predetermined size of a data unit indicated by the processing block size information.

[0189] According to an embodiment, the bitstream acquirer 110 of the image decoding device 100 may obtain the processing block size information from the bitstream according to each specific data unit. For example, the processing block size information may be obtained from the bitstream according to data units such as an image, a sequence, a picture, a slice, or a slice segment. That is, the bitstream acquirer 110 may obtain the processing block size information from the bitstream according to each of various data units, the image decoding device 100 may determine the sizes of one or more processing blocks divided from a picture by using the obtained processing block size information, and the size of a processing block may be an integer multiple of the size of a reference coding unit.

[0190] According to an embodiment, the image decoding device 100 may determine the sizes of the processing blocks 1602 and 1612 included in the picture 1600. For example, the image decoding device 100 may determine the size of a processing block based on the processing block size information obtained from the bitstream. Refer to Figure 16 According to an embodiment, the image decoding device 100 may determine the width of the processing blocks 1602 and 1612 to be four times the width of a reference coding unit and may determine the height of the processing blocks 1602 and 1612 to be four times the height of a reference coding unit. The image decoding device 100 may determine the determination order of one or more reference coding units in one or more processing blocks.

[0191] According to an embodiment, the image decoding device 100 may determine processing blocks 1602 and 1612 included in picture 1600 based on the size of the processing blocks, and may determine the determination order of one or more reference coding units included in the processing blocks 1602 and 1612. According to an embodiment, determining the reference coding units may include determining the size of the reference coding units.

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

[0193] According to an embodiment, the image decoding device 100 may obtain determination order information of reference coding units from the bitstream according to each specific data unit. For example, the bitstream acquirer 160 may obtain determination order information of reference coding units from the bitstream according to each data unit (such as an image, a sequence, a picture, a slice, a slice segment, or a processing block). Since the determination order information of reference coding units indicates the order for determining reference coding units in a processing block, the determination order information may be obtained for each specific data unit including an integer number of processing blocks.

[0194] According to an embodiment, the image decoding device 100 may determine one or more reference coding units based on the determined determination order.

[0195] According to an embodiment, the bitstream acquirer 110 may obtain determination order information of reference coding units from the bitstream as information related to the processing blocks 1602 and 1612, and the image decoding device 100 may determine the determination order of one or more reference coding units included in the processing blocks 1602 and 1612, and determine one or more reference coding units included in picture 1600 based on the determined determination order. Refer to Figure 16, the image decoding device 100 may respectively determine the determination orders 1604 and 1614 of one or more reference coding units in the processing blocks 1602 and 1612. For example, when the determination order information of the reference coding units is obtained for each processing block, different types of determination order information of the reference coding units may be obtained for the processing blocks 1602 and 1612. When the determination order 1604 of the reference coding units in the processing block 1602 is the raster scan order, the reference coding units included in the processing block 1602 may be determined according to the raster scan order. On the contrary, when the determination order 1614 of the reference coding units in another processing block 1612 is the reverse raster scan order, the reference coding units included in the processing block 1612 may be determined according to the reverse raster scan order.

[0196] According to an embodiment, the image decoding device 100 may decode the determined one or more reference coding units. The image decoding device 100 may decode an image based on the reference coding units determined as described above. The method of decoding the reference coding units may include various image decoding methods.

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

[0198] Figure 17 Shows the coding units that can be determined for each picture when the combination of shapes into which the coding unit can be divided is different for each picture according to an embodiment.

[0199] Refer to Figure 17, the image decoding device 100 may determine, differently for each picture, the combination of shapes into which a coding unit can be divided. For example, the image decoding device 100 may decode an image by using picture 1700 that can be divided into 4 coding units, picture 1710 that can be divided into 2 or 4 coding units, and picture 1720 that can be divided into 2, 3, or 4 coding units, which are included in at least one picture of the image. To divide picture 1700 into multiple coding units, the image decoding device 100 may use only the partitioning shape information indicating that picture 1700 is divided into 4 square coding units. To divide picture 1710, the image decoding device 100 may use only the partitioning shape information indicating that picture 1710 is divided into 2 or 4 coding units. To divide picture 1720, the image decoding device 100 may use only the partitioning shape information indicating that picture 1720 is divided into 2, 3, or 4 coding units. Since such a combination of partitioning shapes is merely an example for describing the operation of the image decoding device 100, the combination of partitioning shapes should not be construed as being limited to this example, but various combinations of partitioning shapes may be used according to a predetermined data unit.

[0200] According to an embodiment, the bitstream acquirer 110 of the image decoding device 100 may acquire a bitstream including an index according to a predetermined data unit (e.g., sequence, picture, or slice), where the index indicates a combination of partitioning shape information. For example, the bitstream acquirer 110 may acquire an index indicating a combination of partitioning shape information from a sequence parameter set, a picture parameter set, or a slice header. The image decoding device 100 may determine, according to the predetermined data unit, the combination of partitioning shapes into which a coding unit can be divided by using the acquired index, and thus may use different combinations of partitioning shapes according to the predetermined data unit.

[0201] Figure 18 Shows various shapes of coding units that can be determined based on partitioning shape information representable as a binary code according to an embodiment.

[0202] According to an embodiment, the image decoding device 100 may divide a coding unit into various shapes by using the block shape information and the partitioning shape information acquired by the bitstream acquirer 110. The shapes into which a coding unit can be divided may correspond to various shapes including the shapes described in the above embodiments.

[0203] Referring to Figure 18 , based on the partitioning shape information, the image decoding device 100 may divide a coding unit having a square shape in at least one of the horizontal and vertical directions and may divide a coding unit having a non-square shape in the horizontal or vertical direction.

[0204] According to an embodiment, when the image decoding device 100 is capable of dividing a coding unit having a square shape in the horizontal and vertical directions to obtain four square coding units, the number of division shapes indicated by the division shape information related to the coding unit having a square shape may be 4. According to an embodiment, the division shape information may be represented as a 2-bit binary code, and the binary code may be assigned to each division shape. For example, when the coding unit is not divided, the division shape information may be represented as (00)b; when the coding unit is divided in the horizontal and vertical directions, the division shape information may be represented as (01)b; when the coding unit is divided in the horizontal direction, the division shape information may be represented as (10)b; and when the coding unit is divided in the vertical direction, the division shape information may be represented as (11)b.

[0205] According to an embodiment, when the image decoding device 100 divides a coding unit having a non-square shape in the horizontal or vertical direction, the type of division shape indicated by the division shape information may be determined according to the number of coding units into which the coding unit is divided. Referring to Figure 18 , according to an embodiment, the image decoding device 100 may divide a coding unit having a non-square shape into 3 coding units. The image decoding device 100 may divide the coding unit into two coding units, and in this case, the division shape information may be represented as (10)b. The image decoding device 100 may divide the coding unit into three coding units, and in this case, the division shape information may be represented as (11)b. The image decoding device 100 may determine not to divide the coding unit, and in this case, the division shape information may be represented as (0)b. That is, in order to use the binary code indicating the division shape information, the image decoding device 100 may use variable length coding (VLC) instead of fixed length coding (FLC).

[0206] According to an embodiment, referring to Figure 18 , the binary code of the division shape information indicating that the coding unit is not divided may be represented as (0)b. When the binary code of the division shape information indicating that the coding unit is not divided is set to (00)b, although there is no division shape information set to (01)b, all 2-bit binary codes of the division shape information must also be used. However, as shown in Figure 18 , when 3 division shapes are used for a coding unit having a non-square shape, even if the 1-bit binary code (0)b is used as the division shape information, the image decoding device 100 can determine not to divide the coding unit, thereby effectively using the bitstream. However, the division shapes indicated by the division shape information of the coding unit having a non-square shape should not be construed as limited to the 3 shapes shown in Figure 18 and should be construed as including various shapes of the above embodiments.

[0207] Figure 19 Shows other shapes of coding units that can be determined based on partition shape information that can be represented as a binary code according to an embodiment.

[0208] Referring to Figure 19 , based on the partition shape information, the image decoding device 100 can partition a coding unit having a square shape in the horizontal or vertical direction and can partition a coding unit having a non-square shape in the horizontal or vertical direction. That is, the partition shape information can indicate that a coding unit having a square shape is partitioned in one direction. In this case, the binary code of the partition shape information indicating that a coding unit having a square shape is not partitioned can be represented as (0)b. When the binary code of the partition shape information indicating that a coding unit is not partitioned is set to (00)b, although there is no partition shape information set to (01)b, all 2-bit binary codes of the partition shape information must also be used. However, as Figure 19 shown, when 3 partition shapes are used for a coding unit having a square shape, even by using the 1-bit binary code (0)b as the partition shape information, the image decoding device 100 can determine not to partition the coding unit, thus effectively using the bitstream. However, the partition shape indicated by the partition shape information for a coding unit having a square shape should not be construed as limited to Figure 19 the 3 shapes shown, and should be construed as including various shapes of the above embodiments.

[0209] According to an embodiment, block shape information or partition shape information can be represented by using a binary code, and such information can be immediately generated as a bitstream. Alternatively, the block shape information or partition shape information that can be represented as a binary code may not be immediately generated in the bitstream, and the block shape information or partition shape information that can be represented as a binary code can be used as the binary code input during context adaptive binary arithmetic coding (CABAC).

[0210] According to an embodiment, a process of obtaining a syntax regarding block shape information or partition shape information by CABAC performed by the image decoding device 100 will be described. A bitstream including a binary code for the syntax may be obtained by the bitstream acquirer 110. The image decoding device 100 may detect a syntax element indicating the block shape information or the partition shape information by de-binarizing a binary bitstring included in the obtained bitstream. According to an embodiment, the image decoding device 100 may obtain a set of binary bitstrings corresponding to the syntax element to be decoded, and may decode each binary bit by using probability information, and the image decoding device 100 may repeatedly perform this process until the binary bitstring including such decoded binary bits is the same as one of the pre-obtained binary bitstrings. The image decoding device 100 may determine the syntax element by de-binarizing the binary bitstring.

[0211] According to an embodiment, the image decoding device 100 may determine a syntax regarding a binary bitstring by performing a decoding process of adaptive binary arithmetic coding, and may update a probability model for the binary bits obtained by the bitstream acquirer 110. Refer to Figure 18 According to an embodiment, the bitstream acquirer 110 of the image decoding device 100 may obtain a bitstream indicating a binary code, where the binary code indicates partition shape information. The image decoding device 100 may determine a syntax regarding the partition shape information by using the obtained binary code of size 1 bit or 2 bits. To determine the syntax regarding the partition shape information, the image decoding device 100 may update the probability of each of the 2 bits of the binary code. That is, the image decoding device 100 may update the probability that may have a value of 0 or 1 when decoding the next binary bit according to whether the value of the first binary bit of the 2 bits of the binary code is 0 or 1.

[0212] According to an embodiment, when 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 bitstring for the syntax, and the image decoding device 100 may determine that specific bits in the binary bitstring have the same probability without updating the probability.

[0213] Refer to Figure 18, when determining the syntax by using a binary bit string indicating partition shape information related to a coding unit having a non-square shape, when the coding unit having a non-square shape is not partitioned, the image decoding device 100 can determine the syntax regarding the partition shape information by using one binary bit having a value of 0. That is, when the block shape information indicates that the current coding unit has a non-square shape, the first binary bit of the binary bit string regarding the partition shape information can be 0 when the coding unit having a non-square shape is not partitioned, and the first binary bit of the binary bit string regarding the partition shape information can be 1 when the coding unit having a non-square shape is partitioned into two or three coding units. Therefore, the probability that the first binary bit of the binary bit string regarding the partition shape information related to the coding unit having a non-square shape is 0 can be 1 / 3, and the probability that the first binary bit of the binary bit string regarding the partition shape information related to the coding unit having a non-square shape is 1 can be 2 / 3. As described above, since the partition shape information indicating that the coding unit having a non-square shape is not partitioned can represent only a 1-bit binary bit string having a value of 0, the image decoding device 100 can determine the syntax regarding the partition shape information by determining whether the second binary bit is 0 or 1 only when the first binary bit of the partition shape information is 1. According to an embodiment, when the first binary bit regarding the partition shape information is 1, the image decoding device 100 can decode the binary bits by determining that the probability that the second binary bit is 0 is the same as the probability that the second binary bit is 1.

[0214] According to an embodiment, the image decoding device 100 can use various probabilities for each binary bit when determining the binary bits of the binary bit string regarding the partition shape information. According to an embodiment, the image decoding device 100 can determine the probabilities of the binary bits regarding the partition shape information differently according to the direction of the non-square block. According to an embodiment, the image decoding device 100 can determine the probabilities of the binary bits regarding the partition shape information differently according to the area of the current coding unit or the length of the long side. According to an embodiment, the image decoding device 100 can determine the probabilities of the binary bits regarding the partition shape information differently according to at least one of the shape of the current coding unit and the length of the long side.

[0215] According to an embodiment, the image decoding device 100 can determine that the probabilities of the binary bits regarding the partition shape information are the same for coding units having a predetermined size or larger. For example, the image decoding device 100 can determine that the probabilities of the binary bits regarding the partition shape information are the same for coding units having a size equal to or larger than 64 samples based on the length of the long side of each coding unit.

[0216] According to an embodiment, the image decoding device 100 may determine an initial probability of a binary bit of a binary bit string constituting partition shape information based on a strip type (e.g., an I strip, a P strip, a B strip, etc.).

[0217] Figure 20 is a block diagram of an image encoding and decoding system 2000 for performing loop filtering.

[0218] The encoding end 2010 of the image encoding and decoding system 2000 transmits an encoded bitstream of an image, and the decoding end 2050 receives the bitstream, decodes the bitstream, and outputs a reconstructed image. The encoding end 2010 may have a configuration similar to that of the image encoding device 200 to be described below, and the decoding end 2050 may have a configuration similar to that of the image decoding device 100.

[0219] At the encoding end 2010, the prediction encoder 2015 outputs a reference image through inter-frame prediction and intra-frame prediction, and the transformer and quantizer 2020 transform and quantize the residual data between the reference image and the current input image into quantized transform coefficients and output the quantized transform coefficients. The entropy encoder 2025 encodes the quantized transform coefficients into a bitstream and outputs the bitstream. The quantized transform coefficients are reconstructed into data in the spatial domain by the inverse quantizer and inverse transformer 2030, and the reconstructed data in the spatial domain is output as a reconstructed image by the deblocking filter 2035 and the loop filter 2040. The reconstructed image may be used as a reference image for the next input image by the prediction encoder 2015.

[0220] The encoded image data in the bitstream received by the decoding end 2050 is reconstructed into residual data in the spatial domain by the entropy decoder 2055 and the inverse quantizer and inverse transformer 2060. As the residual data and the reference image output from the prediction decoder 2075 are combined, image data in the spatial domain is formed, and the deblocking filter 2065 and the loop filter 2070 may filter the image data in the spatial domain and may output a reconstructed image for the current original image. The reconstructed image may be used as a reference image for the next original image by the prediction decoder 2075.

[0221] The loop filter 2040 at the encoding end 2010 performs loop filtering by using filter information input according to a user input or a system setting. The filter information used by the loop filter 2040 is output to the entropy encoder 2025 and is transmitted to the decoding end 2050 together with the encoded image data. The loop filter 2070 at the decoding end 2050 may perform loop filtering based on the filter information input from the decoding end 2050.

[0222] Figure 21An example of a filtering unit included in a maximum coding unit and filtering execution information of the filtering unit according to an embodiment is shown.

[0223] When the filtering units of the loop filter 2040 at the encoding end 2010 and the loop filter 2070 at the decoding end 2050 include data units similar to the coding units of the embodiment described with reference to Figures 3 to 5 The filter information may include block shape information and division shape information of the data unit for indicating the filtering unit, and loop filtering execution information indicating whether loop filtering is performed on the filtering unit.

[0224] The filtering unit included in the maximum coding unit 2100 according to an embodiment may have the same block shape and division shape as the coding unit included in the maximum coding unit 2100. In addition, the filtering unit included in the maximum coding unit 2100 according to an embodiment may be divided based on the size of the coding unit included in the maximum coding unit 2100. Referring to Figure 21 , for example, the filtering unit may include a filtering unit 2140 having a square shape and a depth of D, filtering units 2132 and 2134 having a non-square shape and a depth of D, filtering units 2112, 2114, 2116, 2152, 2154, and 2164 having a square shape and a depth of D + 1, filtering units 2162 and 2166 having a non-square shape and a depth of D + 1, and filtering units 2122, 2124, 2126, and 2128 having a square shape and a depth of D + 2.

[0225] As shown in Table 1, the block shape information, division shape information (depth), and loop filtering execution information of the filtering unit included in the maximum coding unit 2100 may be encoded.

[0226] [Table 1]

[0227]

[0228]

[0229] The process of determining a plurality of coding units by recursively dividing the coding unit according to the block shape information and block division information according to an embodiment is the same as the process described with reference to Figure 13 The loop filtering execution information of the filtering unit according to an embodiment indicates that loop filtering is performed on the filtering unit when the flag value is 1, and indicates that loop filtering is not performed on the filtering unit when the flag value is 0. Referring to Table 1, the information of the data unit for determining the filtering unit to be filtered by the loop filters 2040 and 2070 may all be encoded as filter information and sent.

[0230] Since the coding unit configured according to the embodiment is a coding unit configured to minimize the error with the original image, it is desirable to have high spatial correlation in the coding unit. Therefore, since the filtering unit is determined based on the coding unit according to the embodiment, the operation of determining the filtering unit separate from the operation of determining the coding unit can be omitted. In addition, therefore, since the filtering unit is determined based on the coding unit according to the embodiment and thus the information on the partitioning shape for determining the filtering unit can be omitted, the transmission bit rate of the filter information can be saved.

[0231] Although it is described in the above embodiments that the filtering unit is determined based on the coding unit according to the embodiment, the filtering unit can be partitioned based on the coding unit until an arbitrary depth, and thus the shape of the filtering unit can be determined only until the arbitrary depth.

[0232] The operation of determining the filtering unit described in the above embodiments can be applied not only to loop filtering but also to various embodiments such as deblocking filtering and adaptive loop filtering.

[0233] According to an embodiment, the image decoding device 100 may partition a current coding unit by using at least one of block shape information and partitioning shape information, and the block shape information may be predetermined to indicate only a square shape and the partitioning shape information may be predetermined to indicate that the current coding unit is not partitioned or is partitioned into 4 square coding units. That is, the coding unit of the current coding unit may always have a square shape according to the block shape information, and the current coding unit may not be partitioned or may be partitioned into 4 square coding units based on the partitioning shape information. The image decoding device 100 may obtain a bitstream generated by using a predetermined coding method through the bitstream acquirer 110, where the predetermined coding method is predetermined to use only such block shapes and partitioning shapes, and the image decoding device 100 may use only the predetermined block shapes and partitioning shapes. In this case, since the image decoding device 100 can solve the compatibility problem with the predetermined coding method by using a predetermined decoding method similar to the predetermined coding method. According to an embodiment, when the image decoding device 100 uses the predetermined decoding method only by using the predetermined block shapes and partitioning shapes among the various shapes that can be indicated by the block shape information and the partitioning shape information, the block shape information only indicates a square shape, and thus the image decoding device 100 may not perform the process of obtaining the block shape information from the bitstream. A syntax indicating whether to use the predetermined decoding method can be used, and such a syntax can be obtained from the bitstream according to a data unit having various shapes, where the data unit may include various coding units such as a sequence, a picture, a slice unit, and a largest coding unit. That is, the bitstream acquirer 110 may determine whether to obtain the syntax indicating the block shape information from the bitstream based on the syntax indicating whether to use the predetermined decoding method.

[0234] Figure 23 Shows the index of a coding unit according to the zigzag scan order according to an embodiment.

[0235] The image decoding device 100 according to an embodiment may scan the lower layer data units included in the upper layer data unit according to the zigzag scan order. In addition, the image decoding device 100 according to an embodiment may sequentially access data according to the zigzag scan index in the coding units included in the processing block or the largest coding unit.

[0236] As referred to Figures 13 to 14 As described above, the image decoding device 100 according to an embodiment may divide a reference coding unit into at least one coding unit. In this case, coding units having a square shape and coding units having a non-square shape may coexist in the reference coding unit. The image decoding device 100 according to an embodiment may access data according to the zigzag scan index included in each coding unit in the reference coding unit. In this case, the method of applying the zigzag scan index may change according to whether there is a coding unit having a non-square shape in the reference coding unit.

[0237] According to an embodiment, when there is no coding unit having a non-square shape in the reference coding unit, the coding units with a lower depth in the reference coding unit may have consecutive zigzag scan indexes. For example, according to an embodiment, a coding unit with a higher depth may include four coding units with a lower depth. The boundaries of the four coding units with a lower depth may be consecutive, and the coding units with a lower depth may be scanned in the zigzag scan order according to the index indicating the zigzag scan order. The index indicating the zigzag scan order according to an embodiment may be set to a number that increases according to the zigzag scan order for the coding unit. In this case, the deeper coding units with the same depth may be scanned in the zigzag scan order.

[0238] According to an embodiment, when there is at least one coding unit having a non-square shape in the reference coding unit, the image decoding device 100 may divide each of the coding units in the reference coding unit into sub-blocks, and may scan the divided sub-blocks in the zigzag scan order. For example, when there is a coding unit having a non-square shape in the vertical or horizontal direction in the reference coding unit, zigzag scanning may be performed by using the divided sub-blocks. In addition, for example, when the reference coding unit is divided into an odd number of coding units, zigzag scanning may be performed by using sub-blocks. A sub-block is a coding unit that is no longer divided or a coding unit obtained by dividing any coding unit, and may have a square shape. For example, four sub-blocks having a square shape may be divided from a coding unit having a square shape. In addition, for example, two sub-blocks having a square shape may be divided from a coding unit having a non-square shape.

[0239] Referring to Figure 23 , for example, the image decoding device 100 according to an embodiment may scan the encoding units 2302, 2304, 2306, 2308, and 2310 of a lower depth in the encoding unit 2300 in a zigzag scan order. The encoding unit 2300 and the encoding units 2302, 2304, 2306, 2308, and 2310 are an upper-layer encoding unit and lower-layer encoding units, respectively. The encoding unit 2300 includes the encoding units 2306 and 2310 having a non-square shape along the horizontal direction. The encoding units 2306 and 2310 having a non-square shape have discontinuous boundaries with the encoding units 2302 and 2304 adjacent to each other and having a square shape. In addition, the encoding unit 2308 has a square shape and is the encoding unit at the center when the encoding units having a non-square shape are divided into an odd number of encoding units. Similar to the encoding units 2306 and 2310 having a non-square shape, the encoding unit 2308 has discontinuous boundaries with the encoding units 2302 and 2304 adjacent to each other and having a square shape. When the encoding unit 2300 includes the encoding units 2306 and 2310 having a non-square shape or the encoding unit 2308 at the center when the encoding units having a non-square shape are divided into an odd number of encoding units, since the adjacent boundaries between the encoding units are discontinuous, it may not be possible to set a continuous zigzag scan index. Therefore, the image decoding device 100 may continuously set the zigzag scan index by dividing the encoding unit into sub-blocks. In addition, the image decoding device 100 may perform a continuous zigzag scan on the encoding units 2306 and 2310 having a non-square shape or the encoding unit 2308 at the center of an odd number of encoding units.

[0240] Figure 23 The encoding unit 2320 of

[0241] In the above embodiments, the data units are scanned in a zigzag scan order for data storage, data loading, and data access.

[0242] In addition, in the above embodiments, although the data units may be scanned according to the zigzag scan order, the scan order of the data units may be one of various orders (such as raster scan order, N-shaped scan order, upper right diagonal scan order, horizontal scan order, and vertical scan order), and should not be limited to the zigzag scan order.

[0243] In addition, in the above embodiments, although the coding units in the reference coding unit are scanned, the present disclosure is not limited thereto, and the target to be scanned may be any block in the processing block or the largest coding unit.

[0244] In addition, in the above embodiments, although the block is divided into sub-blocks and scanned according to the zigzag scan order only when there is at least one block having a non-square shape, the block may be divided into sub-blocks and scanned according to the zigzag scan order even when there is no block having a non-square shape for a simplified embodiment.

[0245] The image decoding apparatus 100 according to an embodiment may generate prediction data by performing inter prediction or intra prediction on a coding unit, may generate residual data by performing inverse transformation on a transform unit included in the current coding unit, and may reconstruct the current coding unit by using the generated prediction data and residual data.

[0246] The prediction mode of the coding unit according to an embodiment may be at least one of an intra mode, an inter mode, and a skip mode. According to an embodiment, the prediction mode may be independently selected according to the coding unit.

[0247] According to an embodiment, when a coding unit having a 2N×2N shape is divided into two coding units having a 2N×N shape or an N×2N shape, inter mode prediction and intra mode prediction may be respectively performed on each coding unit. In addition, according to an embodiment, the skip mode may be applied to a coding unit having a 2N×N or N×2N shape.

[0248] The image decoding device 100 according to an embodiment may allow dual prediction to be performed in a skip mode of a coding unit having a shape of 8×4 or 4×8. Since only skip mode information regarding the coding unit is received in the skip mode, the use of residual data for the coding unit is omitted. Accordingly, in this case, the overhead of inverse quantization and inverse transformation can be reduced. Alternatively, the image decoding device 100 according to an embodiment may allow dual prediction to be performed on a coding unit to which the skip mode is applied, thereby improving decoding efficiency. In addition, while allowing dual prediction to be performed on a coding unit having a shape of 8×4 or 4×8, the image decoding device 100 according to an embodiment may set the number of interpolation taps to a relatively small value during motion compensation, thereby effectively using the storage bandwidth. For example, an interpolation filter having a number of taps less than 8 (e.g., a 2-tap interpolation filter) may be used instead of an 8-tap interpolation filter.

[0249] In addition, the image decoding device 100 according to an embodiment may signal intra prediction information or inter prediction information regarding each region included in a current coding unit by dividing the region into a preset shape (e.g., division based on a diagonal).

[0250] The image decoding device 100 according to an embodiment may obtain predicted samples of a current coding unit in an intra mode by using neighboring samples of the current coding unit. In this case, intra prediction is performed by using pre-reconstructed neighboring samples, and the samples are referred to as reference samples.

[0251] Figure 24 is a diagram of reference samples for intra prediction of a coding unit according to an embodiment. Referring to Figure 24 , for a coding unit 2400 having a non-square block shape, a horizontal length of w, and a vertical length of h, w+h upper reference samples 2402, w+h left reference samples 2404, and one upper-left reference sample 2406 are required, that is, a total of 2(w+h)+1 reference samples are required. To prepare the reference samples, padding may be performed on a portion where no reference sample exists, and reference sample filtering processing may be performed for each prediction mode to reduce quantization errors included in the reconstructed reference samples.

[0252] Although the number of reference samples when the block shape of the current coding unit is a non-square shape has been described in the above embodiment, the number of reference samples is equally applicable even when the current coding unit is a rectangular shape.

[0253] The above-described various embodiments describe operations related to an image decoding method performed by the image decoding device 100. Operations of an image encoding device 200 for performing an image encoding method corresponding to the reverse process of the image decoding method will be described through various embodiments.

[0254] Figure 2 It is a block diagram of an image encoding device 200 for encoding an image based on at least one of block shape information and division shape information according to an embodiment.

[0255] The image encoding device 200 may include an encoder 220 and a bitstream generator 210. The encoder 220 may receive an input image and may encode the input image. The encoder 220 may encode the input image and may 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, an encoded block mode, an encoded block flag, an intra prediction mode, a direction flag, a merge flag, a delta QP, a reference index, a prediction direction, and a transform index. The encoder 220 may determine a context model based on block shape information including at least one of a size or ratio, a direction, a width, and a height of the shape of an encoding unit.

[0256] 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 the syntax element based on the context model. In addition, the image encoding device 200 may send the bitstream to the image decoding device 100.

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

[0258] According to an embodiment, the encoder 220 may determine what shape the encoding unit will be divided into. The encoder 220 may determine the shape of at least one encoding unit included in the encoding unit, and the bitstream generator 210 may generate a bitstream including division shape information, where the division shape information includes information about the shape of the encoding unit.

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

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

[0261] The image coding device 200 determines information about the partitioning shape pattern based on the partitioning shape pattern of the coding unit. The image coding device 200 determines a context model based on at least one of the ratio or size, direction, width, and height of the shape of the coding unit. The image coding device 200 generates information about the partitioning shape pattern for partitioning the coding unit as a bitstream based on the context model.

[0262] To determine the context model, the image coding device 200 may obtain an arrangement for corresponding at least one of the ratio or size, direction, width, and height of the shape of the coding unit to an index for the context model. The image coding device 200 may obtain an index for the context model based on at least one of the ratio or size, direction, width, and height of the shape of the coding unit in the arrangement. The image coding device 200 may determine the context model based on the index for the context model.

[0263] To determine the context model, the image coding device 200 may further determine the context model based on block shape information, where the block shape information includes at least one of the ratio or size, direction, width, and height of the shape of neighboring coding units adjacent to the coding unit. In addition, the neighboring coding units may include at least one of the coding units located at the lower left side, left side, upper left side, upper side, upper right side, right side, or lower right side of the coding unit.

[0264] In addition, to determine the context model, the image coding device 200 may compare the width length of the upper neighboring coding unit with the width length of the coding unit. In addition, the image coding device 200 may compare the height lengths of the left neighboring coding unit and the right neighboring coding unit with the height length of the coding unit. In addition, the image coding device 200 may determine the context model based on the comparison results.

[0265] The operation of the image coding device 200 is similar to the operation of the image decoding device 100 described with reference to Figures 13 to 34 and thus a detailed explanation thereof is not provided here.

[0266] Hereinafter, a device and method for decoding a motion vector and a device and method for encoding a motion vector according to an embodiment will be described with reference to Figures 25 to 36 and

[0267] Figure 25It is a block diagram showing the configuration of a motion vector decoding device 2500 according to an embodiment.

[0268] Referring to Figure 25 , the motion vector decoding device 2500 according to an embodiment may include a bitstream acquirer 2510, a default motion vector determiner 2530, and a prediction decoder 2550.

[0269] The motion vector decoding device 2500 may be included in the above-mentioned image decoding device 100. For example, the bitstream acquirer 2510 may be included in the bitstream acquirer 110 of the image decoding device 100 shown in Figure 1 , and the default motion vector determiner 2530 and the prediction decoder 2550 may be included in the decoder 120 of the image decoding device 100.

[0270] In image encoding and decoding, inter-frame prediction refers to a prediction method that uses the similarity between the current image and another image. A reference block similar to the current block of the current image is detected from a reference image decoded earlier than the current image, and the distance between the coordinates of the current block and the coordinates of the reference block is represented by using a motion vector. In addition, the difference in pixel values between the current block and the reference block may be represented as residual data. Therefore, the information output via the inter-frame prediction of the current block is not the image information of the current block, but may be an index indicating the reference block, a motion vector, and residual data, thereby improving the encoding and decoding efficiency.

[0271] The motion vector decoding device 2500 may determine a motion vector for reconstructing a current block encoded by using inter-frame prediction.

[0272] The type of the block may be a square shape or a rectangular shape, or may be any geometric shape. The block according to an embodiment is not limited to a data unit of a specific size, and may include a maximum coding unit, a coding unit, a prediction unit, and a transform unit in a coding unit according to a tree structure.

[0273] The bitstream acquirer 2510 may acquire a bitstream including information for decoding an image. According to the prediction mode of the current block, the bitstream may include information about at least one of the following: a residual motion vector, a predicted motion vector, whether a default motion vector (MV) is determined, a prediction direction (unidirectional prediction or bidirectional prediction), a reference image index, and a motion vector resolution.

[0274] The default motion vector determiner 2530 may determine a default motion vector (hereinafter, default MV) of the current block.

[0275] The default MV can be used to determine the predicted motion vector of the current block. For example, in a method of determining the PMV of the current block by using the MV of at least one predicted motion vector (PMV) candidate block, when there is a PMV candidate block without the availability of an MV among the at least one PMV candidate block, the PMV of the current block can be determined by using the default MV.

[0276] In other words, the default MV can be an alternative MV to the MV of the PMV candidate block for determining the PMV of the current block.

[0277] The default motion vector determiner 2530 can determine one default MV or multiple default MVs based on the MVs of multiple default MV candidate blocks associated with the current block.

[0278] The positions or the number of multiple default MV candidate blocks can be predetermined in the default motion vector determiner 2530. The multiple default MV candidate blocks can include previously decoded spatial blocks and / or previously decoded temporal blocks associated with the current block. The spatial blocks can include at least one block adjacent to the current block spatially. The temporal blocks can include the block at the same position as the current block in the reference image and at least one block adjacent to the block at the same position spatially, where the reference image has a different picture order count (POC) from the POC of the current block.

[0279] Figure 29 Shows the spatial blocks and temporal blocks associated with the current block 2900. Refer to Figure 29 , the spatial blocks associated with the current block 2900 spatially can include the upper left block a, the upper right block b, the left upper block c, the right upper block d, the outer upper left block e, the outer upper right block f, the outer lower left block g, the outer lower right block h, the lower left block i, the lower right block j, the left lower block k, the right lower block l, the left block m, the right block n, the upper block o, and the lower block p. In addition, the temporal blocks associated with the current block 2900 temporally can include the block q at the same position included in the reference frame and the adjacent block r adjacent to the block q at the same position, where the reference frame has a different POC from the POC of the current block 2900. Figure 29 The spatial blocks and temporal blocks associated with the current block 2900 shown in Figure 29 are examples, and the multiple default MV candidate blocks can include

[0280] at least some of the blocks shown in

[0281] Figure 30 Shows the default MV candidate blocks for determining the default MV.

[0282] Referring to Figure 30 , the default MV candidate blocks may include a left block C0, an upper left block C1, an upper left block C2, an upper right block C3, an upper left external block C4, and a lower left external block C5 with respect to the current block 2900. However, the number or positions of the illustrated default MV candidate blocks are examples and may be variously modified within the scope obvious to those of ordinary skill in the art.

[0283] According to an embodiment, the default motion vector determiner 2530 may set a priority order for the default MV candidate blocks and may determine whether there is an MV for each default MV candidate block according to the priority order. The default motion vector determiner 2530 may determine the MV of the default MV candidate blocks as the default MV according to the order in which the presence of the MV is recognized. The priority order may be predetermined in the default motion vector determiner 2530, or the default motion vector determiner 2530 may determine the priority order in a specific manner.

[0284] The default motion vector determiner 2530 may determine whether each default MV candidate block has an MV according to the priority order and may determine the MV of the default MV candidate block that first recognizes the availability of the MV as the default MV.

[0285] In addition, the default motion vector determiner 2530 may determine whether there is an MV for each default MV candidate block according to the priority order and may determine the MVs of multiple default MV candidate blocks as multiple default MVs according to the order in which the presence of the MV is recognized for the default MV candidate blocks.

[0286] For example, it may be assumed that the priority order is set in the order of block C0 to block C5, and there are MVs in blocks C1, C2, and C4. When the default motion vector determiner 2530 is to determine one default MV, the default motion vector determiner 2530 may determine the MV of block C1 having the MV and the highest priority order as the default MV. In addition, when the default motion vector determiner 2530 is to determine two default MVs, the default motion vector determiner 2530 may determine the MV of block C1 having the MV and the highest priority order and the MV of block C2 having the second highest priority order as the two default MVs.

[0287] The default motion vector determiner 2530 can change the priority order set for multiple default MV candidate blocks by comparing the reference image index of the current block with the reference image indices of the multiple default MV candidate blocks. For example, the default motion vector determiner 2530 can increase the priority order of a default MV candidate block having the same reference image index as the reference image index of the current block. When there are multiple default MV candidate blocks having the same reference image index as the current block, the order among the multiple default MV candidate blocks can follow a predetermined priority order.

[0288] For example, when the priority order is set in the order of block C0 to block C5 and only the reference image index of block C5 is the same as the reference image index of the current block, the priority order of block C5 can be changed to the first. Accordingly, the priority order can be changed to the order having block C5, C0, C1, C2, C3, and C4. Further, for example, when the priority order is set in the order of block C0 to block C5 and the reference image indices of block C4 and block C5 are the same as the reference image index of the current block, the priority orders of block C4 and block C5 can be increased. Further, the priority order can be changed to the order of block C4, C5, C0, C1, C2, and C3 such that the priority order of block C4 is higher than the priority order of block C5 according to the original priority order.

[0289] According to an embodiment, the default motion vector determiner 2530 can determine whether the reference image index of each default MV candidate block is the same as the reference image index of the current block according to the priority order, and can determine the MV of at least one default MV candidate block as at least one default MV according to the order in which it is determined that the reference image index is the same as the reference image index of the current block. When there is no default MV candidate block having the same reference image index as the current block, the default motion vector determiner 2530 can determine whether each default MV candidate block has an MV according to the priority order, and can determine the MV of at least one default MV candidate block as at least one default MV according to the order in which it is recognized that there is an MV.

[0290] According to an embodiment, the default motion vector determiner 2530 can determine the MV of one or more default MV candidate blocks having the same reference image index as the current block as one or more default MVs regardless of whether the priority order is set.

[0291] In addition, according to an embodiment, the default motion vector determiner 2530 may select a predetermined number of default MV candidate blocks based on the magnitudes of the MVs of the default MV candidate blocks, and may determine each of the MVs of the selected default MV candidate blocks as a default MV. For example, the default motion vector determiner 2530 may select a predetermined number of default MV candidate blocks based on the order in which the default MV candidate blocks have larger MVs, and may determine each of the MVs of the selected default MV candidate blocks as a default MV. In addition, for example, the default motion vector determiner 2530 may select a predetermined number of default MV candidate blocks based on the order in which the default MV candidate blocks have smaller MVs, and may determine each of the MVs of the selected default MV candidate blocks as a default MV.

[0292] According to an embodiment, the default motion vector determiner 2530 may determine a value obtained by combining the MVs of a plurality of default MV candidate blocks (e.g., the average value or the median value of the MVs) as a default MV. Referring to Figure 30 , when MVs exist in all of the blocks C0 to C5, the average value or the median value of the MVs may be determined as a default MV. When MVs exist only in the blocks C0, C1, and C2, the average value or the median value of the MVs in the blocks C0, C1, and C2 may be determined as a default MV.

[0293] In addition, according to an embodiment, the default motion vector determiner 2530 may determine a default MV corresponding to a specific direction from the default MV candidate blocks based on the current block being located in the specific direction. For example, when the default motion vector determiner 2530 is to determine a default MV corresponding to the left direction, the default motion vector determiner 2530 may determine the default MV according to the MV of the default MV candidate blocks based on the current block being located in the left direction. In addition, for example, when the default motion vector determiner 2530 is to determine a default MV corresponding to the upper direction, the default motion vector determiner 2530 may determine the default MV according to the MV of the default MV candidate blocks based on the current block being located in the upper direction.

[0294] Referring to Figure 30 , the default MV candidate blocks corresponding to the left direction may include the blocks C0, C1, C4, and C5, and the default motion vector determiner 2530 may determine the default MV corresponding to the left direction by using the MV of at least one of the blocks C0, C1, C4, and C5. The default motion vector determiner 2530 may determine whether an MV exists in the blocks C0, C1, C4, and C5 according to a priority order, and may determine the MV of the block in which an MV is first identified as the default MV corresponding to the left direction.

[0295] In addition, the default MV candidate blocks corresponding to the upper direction may include blocks C2, C3, and C4, and the default motion vector determiner 2530 may determine the default MV corresponding to the upper direction by using the MV of at least one of blocks C2, C3, and C4. The default motion vector determiner 2530 may determine whether there is an MV in blocks C2, C3, and C4 according to the priority order, and may determine the MV of the block in which the MV is first identified as the default MV corresponding to the upper direction.

[0296] As described below, the default MV corresponding to a specific direction may be assigned to a PMV block that is not available. Here, the type of the assigned default MV may vary according to the direction in which the PMV candidate block is located based on the current block.

[0297] According to an embodiment, the default motion vector determiner 2530 may determine the MV of a default MV candidate block in at least one default MV candidate block as the default MV of the current block, where the default MV candidate block is at the position most frequently selected for the PMV in a previously decoded picture, a previously decoded slice, or a previously decoded largest coding unit. For example, when the block most frequently selected for the PMV among the left block C0, the upper left block C1, the upper left block C2, the upper right block C3, the upper left outer block C4, and the lower left outer block C5 shown in Figure 30 is the left block C0 in the previously decoded picture, the default motion vector determiner 2530 may determine the default MV by using the MV of block C0. When multiple default MVs are to be determined, the default motion vector determiner 2530 may select multiple default MV candidate blocks according to the order in which the default MV candidate blocks are selected for the PMV in the previously decoded picture, slice, or largest coding unit, and may determine the multiple default MVs by using the MVs of the selected default MV candidate blocks.

[0298] According to an embodiment, the default motion vector determiner 2530 may determine the default MV before determining the PMV for the current block encoded by using inter prediction. Alternatively, based on the determination of the availability of the PMV candidate blocks described below, the default MV may be determined when necessary. Alternatively, when the bitstream obtained by the bitstream acquirer 2510 includes information for which the default MV of the current block is determined, the default motion vector determiner 2530 may determine the default MV for the current block.

[0299] According to an embodiment, when the default motion vector determiner 2530 determines the default MV by using the MV of at least one default MV candidate block selected from multiple default MV candidate blocks based on a specific criterion, the default motion vector determiner 2530 may determine the MV of the at least one default MV candidate block as the default MV without modification, or may change the MV of the at least one default MV candidate block and determine the changed MV as the default MV.

[0300] According to an embodiment, when the default motion vector determiner 2530 determines a default MV by using the MV of at least one default MV candidate block selected from among a plurality of default MV candidate blocks based on a specific criterion, the default motion vector determiner 2530 may scale the MV of the at least one default MV candidate block by considering the reference picture index of the current block, and determine the scaled MV as the default MV.

[0301] According to an embodiment, the default motion vector determiner 2530 may determine the default MV of the current block by using the MV derived via decoder-side MV derivation (DMVD). DMVD may include, for example, a template matching method or a bilateral matching method.

[0302] The prediction decoder 2550 may determine the PMV of the current block by using the MV of at least one PMV candidate block.

[0303] According to an embodiment, the PMV of the current block may include a previously decoded spatial block and / or a previously decoded temporal block associated with the current block. At least one PMV candidate block may be selected from the blocks spatially associated with the current block and the blocks temporally associated with the current block shown in Figure 29 .

[0304] The positions and the number of at least one PMV candidate block for determining the PMV of the current block may be the same as those of the default MV candidate block for determining the default MV described above. According to an embodiment, at least one of the positions and the number of the at least one PMV candidate block and the at least one default MV candidate block may be different from each other.

[0305] The number and positions of the PMV candidate blocks may be predetermined in the prediction decoder 2550, or may be determined by the prediction decoder 2550 for a picture unit, a slice unit, or a block unit based on a predetermined criterion. According to an embodiment, the number and positions of the PMV candidate blocks may be determined based on information included in the bitstream (e.g., information about the MV resolution of the current block described below).

[0306] The prediction decoder 2550 may determine the availability of the MV of at least one PMV candidate block, and when there is a PMV candidate block determined to be unavailable, the prediction decoder 2550 may determine the PMV of the current block by using the default MV.

[0307] According to an embodiment, the availability of the MV of the PMV candidate block may be determined based on at least one of the following cases: whether there is an MV in the PMV candidate block and whether the MV is the same as the MV of another PMV candidate block previously determined to be available.

[0308] When any block is intra-predicted, it can be determined that there is no MV in the block. In addition, when determining availability, the case where any one MV is the same as another MV can include the case where both the MV and the reference picture index are the same.

[0309] For example, when there is no MV in any one PMV candidate block, it can be determined that the PMV candidate block is unavailable. In addition, for example, when the MV of any one PMV candidate block is the same as the MV of another PMV candidate block that has been previously determined to be available, the PMV candidate block can be determined to be unavailable. Determining availability based on whether the MVs are the same as each other can represent the type of pruning applied.

[0310] According to an embodiment, the prediction decoder 2550 can construct a prediction candidate list including a predetermined number of prediction candidates from the MVs of each of at least one PMV candidate block based on the determination of availability. In addition, the prediction decoder 2550 can determine the PMV of the current block by using one or more prediction candidates included in the prediction candidate list. The prediction decoder 2550 can determine the PMV of the current block by using one or more prediction candidates identified from the information included in the bitstream among the prediction candidates included in the prediction candidate list.

[0311] For example, the prediction decoder 2550 can determine any one prediction candidate as the PMV of the current block as it is, or can change the prediction candidate and determine the changed prediction candidate as the PMV of the current block. In addition, the prediction decoder 2550 can determine the value obtained by combining a plurality of prediction candidates (e.g., the average or median of a plurality of prediction candidates) as the PMV of the current block.

[0312] The prediction decoder 2550 can construct a prediction candidate list by determining the availability of the MVs of each PMV candidate block.

[0313] For example, the prediction decoder 2550 can determine the availability of each PMV candidate block according to the priority order. Refer to Figure 31, when the priority order is set in the order of blocks A0, A1, B0, B1, B2, C3, and H, and when the block A0 with the highest priority order includes an MV, the MV of the block A0 can be included in the prediction candidate list as a prediction candidate. Next, when there is no MV in the block A1 with the second highest priority order, or even when there is an MV in the block A1 with the second highest priority order, but when the MV is the same as the MV of the block A0 already included in the prediction candidate list, the block A1 can be determined to be unavailable, and the availability of the block B0 with the next priority order can be determined. The prediction decoder 2550 can determine the availability of each block from block A0 to block H according to the priority order until the prediction candidate list is constructed. After the prediction decoder 2550 constructs the prediction candidate list by determining the availability of each block from block A0 to block H, when the number of prediction candidates included in the prediction candidate list is less than a predetermined number, the prediction decoder 2550 can add a default MV to the prediction candidate list.

[0314] For example, when the number of prediction candidates to be included in the prediction candidate list is 3, and when a single prediction candidate is included in the prediction candidate list constructed based on the availability determination, the prediction decoder 2550 can add two default MVs to the prediction candidate list. In addition, when two prediction candidates are included in the prediction candidate list constructed based on the availability determination, the prediction decoder 2550 can add one default MV to the prediction candidate list.

[0315] The number of prediction candidates to be included in the prediction candidate list can be determined in advance. According to an embodiment, the default motion vector determiner 2530 can determine default MVs corresponding to the predetermined number of prediction candidates to be included in the prediction candidate list.

[0316] According to an embodiment, the prediction decoder 2550 can determine the availability of each PMV candidate block, and assign a default MV to the PMV candidate block determined to be unavailable. Then, the prediction decoder 2550 can construct a prediction candidate list according to the priority order of the PMV candidate blocks. For example, the prediction decoder 2550 can determine Figure 31 the availability of blocks A0 to H, and when the block A1 is determined to be unavailable, the prediction decoder 2550 can assign a default MV to the block A1. Then, the prediction decoder 2550 can include the MVs of each block from block A0 to block H in the prediction candidate list according to the priority order.

[0317] The prediction decoder 2550 can determine the PMV of the current block by using at least one prediction candidate of the prediction candidate list including the default MV or the prediction candidate list not including the default MV.

[0318] In an embodiment of determining the PMV of the current block, the prediction decoder 2550 may determine the PMV of the current block based on the MVs of at least one PMV candidate block in a predetermined position. The prediction decoder 2550 may determine the availability of the at least one PMV candidate block in the predetermined position, and may assign a default MV to a PMV candidate block determined to be unavailable. Here, assigning a default MV to a PMV candidate block may mean using the default MV as the MV of the PMV candidate block.

[0319] As Figure 32 shown, when the PMV of the current block is determined to be a value obtained by combining the MVs of block D1, block D2, and block D3, and when there is no MV in block D2, a default MV may be assigned as the MV of block D2. According to an embodiment, the default motion vector determiner 2530 may determine the same number of default MVs as the number of PMV candidate blocks in the predetermined position.

[0320] In addition, according to an embodiment, the prediction decoder 2550 may determine the PMV of the current block by using the MVs of PMV candidate blocks in a predetermined position. In this case, when a PMV candidate block is determined to be unavailable, the prediction decoder 2550 may assign a default MV to the PMV candidate block. The prediction decoder 2550 may determine the default MV assigned to the PMV candidate block as the PMV of the current block without change, or may change the default MV and determine the changed default MV as the PMV of the current block.

[0321] According to an embodiment, the prediction decoder 2550 may assign a default MV to a PMV candidate block in a predetermined position that does not have availability. When there are multiple PMV candidate blocks that do not have availability, the prediction decoder 2550 may assign multiple default MVs to the multiple PMV candidate blocks that do not have availability, respectively.

[0322] For example, in Figure 32 , in a method of determining the PMV of the current block by using the MV of block D1, when there is no MV in block D1, the prediction decoder 2550 may assign a default MV to block D1. In addition, in a method of determining the PMV of the current block by using the MVs of blocks D1, D2, and D3, when there are no MVs in blocks D1 and D2, the prediction decoder 2550 may assign default MVs to blocks D1 and D2, respectively.

[0323] When the default MV is assigned to a PMV candidate block that is not available, the position of the PMV candidate block can be considered. As described above, the default motion vector determiner 2530 can determine a default MV corresponding to a corresponding specific direction from default MV candidate blocks based on the current block being in a specific direction. The prediction decoder 2550 can assign the corresponding default MV to the PMV candidate block by considering the PMV candidate block that is not available based on the direction in which the current block is located.

[0324] For example, when there is no MV in block D1 based on the current block being in the left direction in Figure 32 , the prediction decoder 2550 can assign the default MV determined corresponding to the left direction to block D1, and when there is no MV in block D2 based on the current block being in the upper direction, the prediction decoder 2550 can assign the default MV determined corresponding to the upper direction to block D2. When there is no MV in block D3, the prediction decoder 2550 can assign the default MV determined corresponding to the upper direction to block D3, or assign a value determined by combining at least some of the plurality of default MVs to block D3.

[0325] According to an embodiment, the number and type of the at least one PMV candidate block can be determined based on the motion vector resolution of the current block (hereinafter, referred to as MVR). The prediction decoder 2550 can directly determine the MVR of the current block based on a predetermined condition, or can determine the MVR of the current block with reference to information included in the bitstream obtained by the bitstream acquirer 2510.

[0326] According to an embodiment, the bitstream acquirer 2510 can obtain information about MVR for each coding unit that has undergone inter-frame prediction. Figure 36 Shows the syntax for obtaining information about MVR from the bitstream.

[0327] Referring to Figure 36 , when the slice including the current coding unit in phrase a is not slice I, cu_skip_flag is extracted in phrase b. cu_skip_flag indicates whether the skip mode is applied to the current coding unit. When it is checked in phrase c that the skip mode is applied, the current coding unit is processed in the skip mode. When it is checked in phrase d that the skip mode is not applied, pred_mode_flag is extracted in phrase e. pred_mode_flag indicates whether the current coding unit is intra-frame predicted or inter-frame predicted. When the current coding unit is not intra-frame predicted in phrase f, that is, the current coding unit is inter-frame predicted, pred_mvr_idx is extracted in phrase g. pred_mvr_idx is an index indicating the MVR of the current coding unit, and the MVR corresponding to each index is shown in Table 2.

[0328] [Table 2]

[0329]

[0330]

[0331] The MVR of the current block may represent the accuracy of the positions of the pixels included in the reference image (or the interpolated reference image) that can be indicated by the MV of the current block. The MVR of the current block may be selected from at least one candidate MVR. The at least one candidate MVR may include, for example, at least one of the following MVRs: an MVR in 1 / 8 pixel unit, an MVR in 1 / 4 pixel unit, an MVR in 1 / 2 pixel unit, an MVR in 1 pixel unit, an MVR in 2 pixel units, an MVR in 4 pixel units, and an MVR in 8 pixel units, but is not limited thereto.

[0332] The number and type of PMV candidate blocks for determining the PMV of the current block may be predetermined according to the type of the MVR of the current block. For example, when the MVR of the current block is an MVR in 1 / 4 pixel unit, the PMV candidate blocks may include the left block and the upper block, and when the MVR of the current block is an MVR in 1 pixel unit, the PMV candidate blocks may include the lower left block. In addition, when the MVR of the current block is an MVR in 2 pixel units, the PMV candidate blocks may include the right block. Thus, when the MVR of the current block is determined, the type and number of PMV candidate blocks for determining the PMV may be automatically determined. According to an embodiment, for each MVR, the number of PMV candidate blocks for determining the PMV may be 1. However, for each MVR, the positions of the PMV candidate blocks may be different from each other.

[0333] When the MVR of the current block is determined and the PMV candidate blocks are determined according to the determined MVR, as described above, the prediction decoder 2550 may determine the availability of the MV of each of the PMV candidate blocks. In addition, the prediction decoder 2550 may assign a default MV as the MV of the PMV candidate block determined not to have availability, and may determine the PMV of the current block.

[0334] When assigning a default MV to the PMV candidate block, the prediction decoder 2550 may compare the minimum MVR among the candidate MVRs selectable for the current block with the MVR of the current block to adjust the default MV. The default MV is determined from the MV of the default MV candidate block. The MV of the default MV candidate block is predicted to indicate the pixel coordinates in the image interpolated according to the minimum MVR, and thus, the default MV may be adjusted to correspond to the MVR of the current block.

[0335] When the number of PMV candidate blocks for determining PMV based on the MVR of the current block is 1, and since the PMV candidate block is determined to be unavailable, the default MV is assigned to the PMV candidate block, the default MV may need to be adjusted. When the number of PMV candidate blocks for determining PMV is 1 and the PMV candidate block is available, and when the number of PMV candidate blocks for determining PMV is greater than 1 and one or more of the multiple PMV candidate blocks are available, the MV of the available PMV candidate blocks can be used to determine PMV. Therefore, the MV of the PMV candidate blocks determined to be available may also need to be adjusted like the default MV.

[0336] Reference will be made to Figures 33 to 35 describe in detail the process of adjusting the default MV.

[0337] When the PMV of the current block is determined, the prediction decoder 2550 can obtain the MV of the current block from the PMV. When the prediction mode of the current block is the skip mode or the merge mode, the prediction decoder 2550 can determine the PMV as the MV of the current block, and when the prediction mode of the current block is the advanced motion vector prediction (AMVP) mode, the prediction decoder 2550 can obtain the MV of the current block by combining the residual MV and the PMF.

[0338] In addition, the prediction decoder 2550 can amplify the residual MV obtained from the bitstream by comparing the MVR of the current block with the minimum MVR, and can obtain the MV of the current block by combining the amplified residual MV and the PMV. The amplification of the residual MV will be described below.

[0339] Figure 26 is a flowchart for describing a method of decoding an MV according to an embodiment.

[0340] In operation S2610, the motion vector decoding device 2500 can determine the PMV of the current block.

[0341] The motion vector decoding device 2500 can determine the PMV of the current block by using at least one PMV candidate block associated with the current block.

[0342] As described above, the motion vector decoding device 2500 can determine the availability of the MV of at least one PMV candidate block. When there is a PMV candidate block determined to be unavailable, the motion vector decoding device 2500 can determine the PMV of the current block by using the default MV determined from multiple default MV candidate blocks.

[0343] When the MVR of the current block is determined, the motion vector decoding device 2500 can determine the PMV of the current block by using the default MV adjusted according to the MVR of the current block.

[0344] In operation S2620, the motion vector decoding device 2500 may obtain the MV of the current block based on the PMV of the current block.

[0345] The motion vector decoding device 2500 may obtain the PMV of the current block as the MV of the current block, or may obtain the result of combining the PMV and the residual MV as the MV of the current block. According to an embodiment, when the MVR of the current block is determined, the motion vector decoding device 2500 may selectively amplify the residual MV, and then may obtain the MV of the current block by combining the selectively amplified residual MV and the PMV.

[0346] Figure 27 is a block diagram showing the configuration of a motion vector encoding device 2700 according to an embodiment.

[0347] Referring to Figure 27 , the motion vector encoding device 2700 according to an embodiment may include a default motion vector determiner 2710, a prediction encoder 2730, and a bitstream generator 2750. The motion vector encoding device 2700 may be included in the above image encoding device 200. For example, the default motion vector determiner 2710 and the prediction encoder 2730 of the motion vector encoding device 2700 may be included in the encoder 220 of the image encoding device 200, and the bitstream generator 2750 of the motion vector encoding device 2700 may be included in the bitstream generator 210 of the image encoding device 200.

[0348] The default motion vector determiner 2710 may determine the default MV of the current block.

[0349] The default MV may be used to determine the predicted motion vector of the current block. For example, in a method of determining the PMV of the current block by using the MV of at least one PMV candidate block, when there is a PMV candidate block without MV availability among the at least one PMV candidate block, the PMV of the current block may be determined by using the default MV.

[0350] The default motion vector determiner 2710 may determine one default MV or multiple default MVs based on the MVs of a plurality of default MV candidate blocks associated with the current block.

[0351] The positions or the number of the plurality of default MV candidate blocks may be predetermined in the default motion vector determiner 2710. The plurality of default MV candidate blocks may include previously encoded spatial blocks and / or previously encoded temporal blocks associated with the current block. The spatial blocks may include at least one block adjacent to the current block spatially. The temporal blocks may include the block at the same position as the current block in the reference image and at least one block adjacent to the block at the same position spatially, where the reference image has a different picture order count (POC) from the POC of the current block.

[0352] According to an embodiment, the default motion vector determiner 2710 may set a priority order for default MV candidate blocks, and may determine whether there is an MV for each default MV candidate block according to the priority order. The default motion vector determiner 2710 may determine at least one default MV based on the MVs of at least one default MV candidate block according to the order in which the presence of an MV is recognized.

[0353] The default motion vector determiner 2710 may determine whether each default MV candidate block has an MV according to the priority order, and may determine the MV of the default MV candidate block in which the availability of the MV is first recognized as the default MV.

[0354] In addition, the default motion vector determiner 2710 may determine whether there is an MV for each default MV candidate block according to the priority order, and may determine the MVs of multiple default MV candidate blocks as multiple default MVs according to the order in which the presence of an MV is recognized for the default MV candidate blocks.

[0355] The default motion vector determiner 2710 may change the priority order set for the multiple default MV candidate blocks by comparing the reference image index of the current block with the reference image indices of the multiple default MV candidate blocks. For example, the default motion vector determiner 2710 may increase the priority order of the default MV candidate block having the same reference image index as the reference image index of the current block. When there are multiple default MV candidate blocks having the same reference image index as the current block, the order among the multiple default MV candidate blocks may follow a predetermined priority order.

[0356] According to an embodiment, the default motion vector determiner 2710 may determine whether the reference image index of each default MV candidate block is the same as the reference image index of the current block according to the priority order, and may determine the MVs of at least one default MV candidate block as at least one default MV according to the order in which it is determined that the reference image index is the same as the reference image index of the current block. When there is no default MV candidate block having the same reference image index as the current block, the default motion vector determiner 2710 may determine whether each default MV candidate block has an MV according to the priority order, and may determine the MVs of at least one default MV candidate block as at least one default MV according to the order in which the presence of an MV is recognized. According to an embodiment, the default motion vector determiner 2710 may determine the MVs of one or more default MV candidate blocks having the same reference image index as the current block as the default MV, regardless of whether a priority order is set.

[0357] In addition, according to an embodiment, the default motion vector determiner 2710 may select a predetermined number of default MV candidate blocks based on the magnitude of the MV of the default MV candidate blocks, and may determine the MVs of the selected predetermined number of default MV candidate blocks as the default MV. For example, the default motion vector determiner 2710 may select a predetermined number of default MV candidate blocks based on the order in which the default MV candidate blocks have larger MVs, and may determine the MVs of the selected predetermined number of default MV candidate blocks as the default MV. In addition, for example, the default motion vector determiner 2710 may select a predetermined number of default MV candidate blocks based on the order in which the default MV candidate blocks have smaller MVs, and may determine the MVs of the selected predetermined number of default MV candidate blocks as the default MV.

[0358] According to an embodiment, the default motion vector determiner 2710 may determine, as the default MV, a value obtained by combining the MVs of a plurality of default MV candidate blocks (e.g., the average value or the median value of the MVs).

[0359] In addition, according to an embodiment, the default motion vector determiner 2710 may determine a default MV corresponding to a specific direction from among the default MV candidate blocks based on the current block being located in the specific direction. For example, when the default motion vector determiner 2710 is to determine a default MV corresponding to the left direction, the default motion vector determiner 2710 may determine the default MV based on the MV of the default MV candidate block based on the current block being located in the left direction. In addition, for example, when the default motion vector determiner 2710 is to determine a default MV corresponding to the upper direction, the default motion vector determiner 2710 may determine the default MV based on the MV of the default MV candidate block based on the current block being located in the upper direction.

[0360] According to an embodiment, the default motion vector determiner 2710 may determine the MV of a default MV candidate block among at least one default MV candidate block as the default MV, where the one default MV candidate block is at a position where the PMV is most frequently selected in a previously encoded picture, a previously encoded slice, or a previously encoded largest coding unit. When a plurality of default MVs are to be determined, the default motion vector determiner 2710 may select a plurality of default MV candidate blocks according to the order in which the default MV candidate blocks are selected for the PMV in a previously encoded picture, slice, or largest coding unit, and may determine the plurality of default MVs by using the MVs of the selected default MV candidate blocks.

[0361] According to an embodiment, the default motion vector determiner 2710 may determine the default MV before determining the PMV for the current block. Alternatively, based on the determination of the availability of the PMV candidate blocks described below, the default MV may be determined as needed.

[0362] According to an embodiment, when the default motion vector determiner 2710 determines a default MV by using the MV of at least one default MV candidate block selected from among a plurality of default MV candidate blocks based on a specific criterion, the default motion vector determiner 2710 may determine the MV of the at least one default MV candidate block as the default MV without change, or may change the MV of the at least one default MV candidate block and determine the changed MV as the default MV.

[0363] According to an embodiment, when the default motion vector determiner 2710 determines a default MV by using the MV of at least one default MV candidate block selected from among a plurality of default MV candidate blocks based on a specific criterion, the default motion vector determiner 2710 may scale the MV of the at least one default MV candidate block by considering the reference picture index of the current block, and determine the scaled MV as the default MV.

[0364] According to an embodiment, the default motion vector determiner 2710 may determine the default MV of the current block by using an MV derived via DMVD. DMVD may include, for example, a template matching method or a bilateral matching method. Generally, an encoding device includes a decoding device, and thus, the default motion vector determiner 2710 of the motion vector encoding device 2700 may also determine an MV via DMVD.

[0365] The prediction encoder 2730 may determine the MV of the current block. According to an embodiment, the prediction encoder 2730 may interpolate a reference picture for inter prediction of the current block, detect a block most similar to the current block from the reference picture, and determine the distance between the coordinates of the current block and the coordinates of the reference block as the MV of the current block.

[0366] According to an embodiment, the prediction encoder 2730 may determine the MVR of the current block, and determine the MV according to the determined MVR.

[0367] The prediction encoder 2730 may determine any one of at least one candidate MVRs selectable for the current block as the MVR of the current block. The prediction encoder 2730 may interpolate a reference picture according to the minimum MVR among at least one candidate MVRs selectable for the current block, and may determine the MV of the current block by using the MVR. For example, when candidate MVRs selectable for the current block include an MVR in 1 / 4 pixel units, an MVR in 1 / 2 pixel units, an MVR in 1 pixel unit, and an MVR in 2 pixel units, and the MVR in 1 pixel unit is selected as the MVR of the current block, the prediction encoder 2730 may interpolate the reference picture by using 1 / 4 pixel units having the minimum MVR, and may determine the MV by using 1 pixel unit in the interpolated reference picture.

[0368] The prediction encoder 2730 may determine the PMV of the current block in order to encode the MV of the current block. According to an embodiment, the PMV of the current block may be determined from at least one PMV candidate block including a spatial block and / or a temporal block associated with the current block.

[0369] The number and position of the PMV candidate blocks may be predetermined in the prediction encoder 2730, or may be determined by the prediction encoder 2730 for a picture unit, a slice unit, or a block unit. According to an embodiment, the number and position of the PMV candidate blocks may be determined based on the MVR of the current block.

[0370] The prediction encoder 2730 may determine the availability of the MV of at least one PMV candidate block, and when there is a PMV candidate block determined to be unavailable, the prediction encoder 2730 may determine the PMV of the current block by using a default MV.

[0371] According to an embodiment, the availability of the MV of the PMV candidate block may be determined based on at least one of the following: whether there is an MV in the PMV candidate block and whether the MV is the same as the MV of another PMV candidate block previously determined to be available.

[0372] According to an embodiment, the prediction encoder 2730 may construct a prediction candidate list including a predetermined number of prediction candidates from the MVs of each of the at least one PMV candidate block based on the determination of availability. In addition, the prediction encoder 2730 may determine the PMV of the current block by using one or more prediction candidates included in the prediction candidate list.

[0373] For example, the prediction encoder 2730 may determine any one prediction candidate as the PMV of the current block as it is, or may change the prediction candidate and determine the changed prediction candidate as the PMV of the current block. In addition, the prediction encoder 2730 may determine a value obtained by combining a plurality of prediction candidates (e.g., an average value or a median value of the plurality of prediction candidates) as the PMV of the current block.

[0374] The prediction encoder 2730 may construct a prediction candidate list by determining the availability of the MV of each PMV candidate block. For example, the prediction encoder 2730 may determine the availability of each PMV candidate block according to a priority order. Refer to Figure 31, when the priority order is set in the order of blocks A0, A1, B0, B1, B2, C3, and H, and when the block A0 with the highest priority order includes an MV, the MV of the block A0 can be included in the prediction candidate list as a prediction candidate. Next, when there is no MV in the block A1 with the second highest priority order, or even when there is an MV in the block A1 with the second highest priority order, but when the MV is the same as the MV of the block A0 already included in the prediction candidate list, the block A1 can be determined to be unavailable, and the availability of the block B0 with the next priority order can be determined. The prediction encoder 2730 can determine the availability of each of the blocks A0 to H according to the priority order until the prediction candidate list is constructed. After the prediction encoder 2730 constructs the prediction candidate list by determining the availability of each of the blocks A0 to H, when the number of prediction candidates included in the prediction candidate list is less than a predetermined number, the prediction decoder 2550 can include the default MV in the prediction candidate list.

[0375] According to an embodiment, the prediction encoder 2730 can determine the availability of each of the PMV candidate blocks, and assign the default MV to the PMV candidate blocks determined to be unavailable. Then, the prediction encoder 2730 can construct the prediction candidate list according to the priority order of the PMV candidate blocks. The number of prediction candidates to be included in the prediction candidate list can be determined in advance. According to an embodiment, the default motion vector determiner 2710 can determine the number of default MVs corresponding to a predetermined number of prediction candidates to be included in the prediction candidate list.

[0376] The prediction encoder 2730 can determine the PMV of the current block by using at least one prediction candidate of the prediction candidate list including the default MV or the prediction candidate list not including the default MV.

[0377] According to an embodiment, the prediction encoder 2730 can determine the PMV of the current block based on the MVs of at least one PMV candidate block in a predetermined position. The prediction encoder 2730 can determine the availability of the at least one PMV candidate block in the predetermined position, and can assign the default MV as the MV of the PMV candidate block determined to be unavailable. As Figure 32 shown, when the PMV of the current block is determined to be a value obtained by combining the MVs of the block D1, the block D2, and the block D3, and when there is no MV in the block D2, the default MV can be assigned as the MV of the block D2.

[0378] In addition, according to an embodiment, the prediction encoder 2730 may determine the PMV of the current block by using the MVs of the PMV candidate blocks at predetermined positions. In this case, when a PMV candidate block is determined to be unavailable, the prediction encoder 2730 may assign a default MV to the PMV candidate block. The prediction encoder 2730 may determine the default MV assigned to the PMV candidate block as the PMV of the current block without change, or may change the default MV and determine the changed default MV as the PMV of the current block.

[0379] According to an embodiment, the prediction encoder 2730 may assign a default MV to a PMV candidate block that is not available among the PMV candidate blocks at a predetermined position, and when there are multiple PMV candidate blocks that are not available, the prediction decoder 2550 may assign multiple default MVs to the multiple PMV candidate blocks that are not available, respectively. According to an embodiment, the default motion vector determiner 2530 may determine the same number of default MVs as the PMV candidate blocks at the predetermined position.

[0380] When a default MV is assigned to a PMV candidate block that is not available, the position of the PMV candidate block may be considered. As described above, the default motion vector determiner 2710 may determine a default MV corresponding to a corresponding specific direction from default MV candidate blocks based on the current block being located in a specific direction. The prediction encoder 2730 may assign the corresponding default MV to the PMV candidate block by considering the PMV candidate block without an MV based on the direction in which the current block is located.

[0381] When the MV and PMV of the current block are determined, the prediction encoder 2730 may obtain a residual MV that is the difference between the MV and PMV of the current block based on the prediction mode of the current block.

[0382] When the prediction mode of the current block is the skip mode or the merge mode, the prediction encoder 2730 may omit the operation of obtaining the residual MV, and when the prediction mode of the current block is the AMVP mode, the prediction encoder 2730 may obtain the residual MV.

[0383] According to an embodiment, the prediction encoder 2730 may generate information about the PMV of the current block. For example, when the PMV of the current block is determined from a predetermined number of prediction candidates, the prediction encoder 2730 may generate information indicating which prediction candidate among the predetermined number of prediction candidates is used as the PMV of the current block.

[0384] When the PMV of the current block is determined from the MVs of the PMV candidate blocks at a predetermined position, the prediction encoder 2730 may omit the operation of generating information about the PMV. This is because the motion vector decoding device 2500 may also determine the PMV by using the same PMV candidate blocks at the predetermined position in order to determine the MV of the current block.

[0385] According to an embodiment, the prediction encoder 2730 may generate information indicating that a default MV is determined to determine the PMV of the current block. For example, when the default motion vector determiner 2710 determines the default MV, flag 1 may be generated, and when the operation of determining the default MV is omitted, flag 0 may be generated.

[0386] According to an embodiment, the prediction encoder 2730 may generate information indicating the MVR of the current block.

[0387] The bitstream generator 2750 may generate a bitstream including at least one of the following information generated by the prediction encoder 2730: information corresponding to the residual MV, information about the PMV, information about whether the default MV is determined, information about the MVR of the current block, information about the prediction direction (unidirectional or bidirectional), and information about the reference image index.

[0388] Figure 28 is a flowchart for describing a method of encoding an MV according to an embodiment.

[0389] In operation S2810, the motion vector encoding device 2700 may determine the MV of the current block. The motion vector encoding device 2700 may search for a reference block most similar to the current block in the reference image, and may determine the MV indicating the distance between the coordinates of the reference block and the coordinates of the current block.

[0390] According to an embodiment, when the MVR of the current block is determined, the motion vector encoding device 2700 may determine the MV according to the MVR of the current block in the image based on minimum MVR interpolation.

[0391] In operation S2820, the motion vector encoding device 2700 may determine the PMV of the current block.

[0392] The motion vector encoding device 2700 may determine the PMV of the current block by using the MV of at least one PMV candidate block.

[0393] As described above, the motion vector encoding device 2700 may determine the availability of the MV of at least one PMV candidate block. When there is a PMV candidate block determined to be unavailable, the motion vector encoding device 2700 may determine the PMV of the current block by using the default MV determined from multiple default MV candidate blocks.

[0394] When the MVR of the current block is determined, the motion vector encoding device 2700 may determine the PMV of the current block by using the default MV adjusted according to the MVR of the current block.

[0395] Hereinafter, reference will be made to Figures 33 to 35 Describe the process of adjusting the default MV when the MVR of the current block is determined.

[0396] As described above, when any one of at least one candidate MVR selectable for the current block is selected as the MVR of the current block, it may be necessary to adjust the default MV according to the resolution of the current block when the default MV is used to determine the PMV of the current block.

[0397] Figure 33 Shows the positions of pixels indicated by MVs of MVRs of 1 / 4 pixel unit, 1 / 2 pixel unit, 1 pixel unit, and 2 pixel units when the minimum MVR selectable for the current block is an MVR of 1 / 4 pixel unit.

[0398] Figure 33 (a), (b), (c), and (d) of show the coordinates of pixels (marked by black squares) indicated by MVs of MVRs of 1 / 4 pixel unit, 1 / 2 pixel unit, 1 pixel unit, and 2 pixel units based on the coordinates (0, 0).

[0399] When the minimum MVR is an MVR of 1 / 4 pixel unit, the coordinates of the pixels indicated by the MV of the MVR of 1 / 4 pixel unit become (a / 4, b / 4) (a and b are integers), the coordinates of the pixels indicated by the MV of the MVR of 1 / 2 pixel unit become (2c / 4, 2d / 4) (c and d are integers), the coordinates of the pixels indicated by the MV of the MVR of 1 pixel unit become (4e / 4, 4f / 4) (e and f are integers), and the coordinates of the pixels indicated by the MV of the MVR of 2 pixel units become (8g / 4, 8h / 4) (g and h are integers). That is, when the minimum MVR has 2 m (m is an integer) pixel units, the coordinates of the pixels indicated by the MV of the MVR of 2 n (n is an integer) pixel units become (2 n-m *i / 2 -m , 2 n-m *j / 2 -m ) (i and j are integers). Although the MV is determined according to a specific MVR, the MV is represented by coordinates in the image interpolated according to 1 / 4 pixel unit corresponding to the minimum MVR.

[0400] In the embodiment, since the motion vector encoding device 2700 determines the MV in the image interpolated according to the minimum MVR, in order to represent the MV by using integers, the MV can be multiplied by the reciprocal of the pixel unit value of the minimum MVR (for example, 2 when the minimum MVR has 2 m (m is an integer) pixel units of 2 -m) to represent the MV in integer units. The MV multiplied by 2 can be used in the motion vector encoding device 2700 and the motion vector decoding device 2500 -m of the MV in integer units.

[0401] When the MV of the MVR in 1 / 2 pixel units starting from the coordinate (0, 0) indicates the coordinate (2 / 4, 6 / 4) and the minimum MVR has 1 / 4 pixel units, the motion vector encoding device 2700 can determine (2, 6) obtained by multiplying the MV by the integer 4 as the MV.

[0402] Figure 34 is a diagram for describing a method of adjusting the default MV.

[0403] When the MVR of the current block is greater than the minimum MVR among the selectable candidate MVRs, the motion vector encoding device 2700 and the motion vector decoding device 2500 can adjust the default MV that will be used as the PMV of the current block. That the MVR of the current block is greater than the minimum MVR can indicate that the pixel unit of the MVR of the current block is greater than the pixel unit of the minimum MVR. For example, the MVR in 1 pixel unit is greater than the MVR in 1 / 2 pixel units, and the MVR in 1 / 2 pixel units can be greater than the MVR in 1 / 4 pixel units.

[0404] In order to adjust the default MV represented by the coordinates in the image interpolated according to the minimum MVR to the MVR of the current block, the motion vector encoding device 2700 and the motion vector decoding device 2500 can adjust the default MV to indicate a neighboring pixel instead of the pixel indicated by the default MV.

[0405] For example, in Figure 34 in order to adjust the default MV A indicating the pixel 3410 with the coordinates (19, 27) based on the coordinate (0, 0) to the MVR in 1 pixel unit as the MVR of the current block, the coordinates (19, 27) of the pixel 3410 indicated by the default MV A can be divided by the integer 4 (i.e., can be shrunk), and the coordinates (19 / 4, 27 / 4) obtained as the division result may not indicate an integer pixel unit.

[0406] The motion vector encoding device 2700 and the motion vector decoding device 2500 may adjust the reduced default MV to indicate integer pixel units. For example, the coordinates of neighboring integer pixels around the coordinates (19 / 4, 27 / 4) are (16 / 4, 28 / 4), (16 / 4, 24 / 4), (20 / 4, 28 / 4), and (20 / 4, 24 / 4). In this case, after the motion vector encoding device 2700 and the motion vector decoding device 2500 may adjust the reduced default MV A to indicate the coordinates (20 / 4, 28 / 4) in the upper right rather than the coordinates (19 / 4, 27 / 4), and may multiply by the integer 4 (i.e., magnify) so that the finally adjusted default MV D indicates the pixel 3440 corresponding to the coordinates (20, 28).

[0407] According to an embodiment, the motion vector encoding device 2700 and the motion vector decoding device 2500 may adjust the reduced default MV to indicate coordinates in the lower left, coordinates in the upper left, or coordinates in the lower right.

[0408] According to an embodiment, when any one of the x coordinate value and the y coordinate value indicated by the reduced default MV indicates an integer pixel, the motion vector encoding device 2700 and the motion vector decoding device 2500 may only increase or only decrease the coordinate value that does not indicate an integer pixel to indicate an integer pixel. That is, when the x coordinate value indicated by the reduced default MV indicates an integer pixel, the motion vector encoding device 2700 and the motion vector decoding device 2500 may cause the adjusted default MV to indicate an integer pixel above or below the pixel indicated by the default MV before adjustment. Alternatively, when the y coordinate value indicated by the reduced default MV indicates an integer pixel, the motion vector encoding device 2700 and the motion vector decoding device 2500 may cause the adjusted default MV to indicate an integer pixel to the left or right of the pixel indicated by the default MV before adjustment.

[0409] When the default MV is adjusted, the motion vector encoding device 2700 and the motion vector decoding device 2500 may differently select the point indicated by the adjusted default MV according to the MVR of the current block.

[0410] For example, referring to Figure 35, when the MVR of the current block is the MVR in 1 / 2 pixel unit, the motion vector encoding device 2700 and the motion vector decoding device 2500 can make the adjusted default MV indicate the pixel 3530 at the upper left of the pixel indicated by the default MV before adjustment; when the MVR of the current block is the MVR in 1 pixel unit, the motion vector encoding device 2700 and the motion vector decoding device 2500 can make the adjusted default MV indicate the pixel 3520 at the upper right of the pixel indicated by the default MV before adjustment; and when the MVR of the current block is the MVR in 2 pixel units, the motion vector encoding device 2700 and the motion vector decoding device 2500 can make the adjusted default MV indicate the pixel 3540 at the lower right of the pixel indicated by the default MV before adjustment.

[0411] When adjusting the default MV considering the MVR of the current block and the minimum MVR, the motion vector encoding device 2700 and the motion vector decoding device 2500 can adjust the default MV according to Equation 1 below.

[0412] [Equation 1]

[0413] Default MV' = ((Default MV >> k) + Offset) << k

[0414] In Equation 1, Default MV' represents the adjusted default MV, and k is a value determined according to the difference between the MVR of the current block and the minimum MVR, where, when the MVR of the current block is 2 m pixel units (m is an integer), the minimum MVR is 2 n pixel units (n is an integer), and when m > n, k can be m - n.

[0415] According to the embodiment, k can be the index of the MVR, and when the candidate MVRs include the MVR in 1 / 4 pixel unit, the MVR in 1 / 2 pixel unit, the MVR in 1 pixel unit, the MVR in 2 pixel units, and the MVR in 4 pixel units, the MVRs corresponding to the indices are shown in Table 2. When receiving the MVR index from the bitstream, the motion vector decoding device 2500 can adjust the default MV according to Equation 1 by using the MVR index as k.

[0416] In addition, in Equation 1, >> or << as the shift operation refers to the operation of reducing or increasing the size of the default MV. In addition, Offset represents the value added or subtracted to indicate an integer pixel when the default MV reduced according to the k value does not indicate an integer pixel. The Offset can be determined differently according to each of the x coordinate value and the y coordinate value of the default MV.

[0417] According to an embodiment, when the reduced default MV is changed to indicate an integer pixel, the motion vector encoding device 2700 and the motion vector decoding device 2500 may change the reduced default MV according to the same criteria.

[0418] According to an embodiment, when the x - coordinate value and the y - coordinate value of the reduced default MV do not indicate an integer pixel, the motion vector encoding device 2700 and the motion vector decoding device 2500 may always increase or decrease the x - coordinate value and the y - coordinate value of the reduced default MV to indicate an integer pixel. Alternatively, the motion vector encoding device 2700 and the motion vector decoding device 2500 may round the x - coordinate value and the y - coordinate value of the reduced default MV to indicate an integer pixel.

[0419] According to an embodiment, when the default MV is adjusted, the motion vector encoding device 2700 and the motion vector decoding device 2500 may omit the reduction and enlargement of the default MV, and may adjust the default MV in the coordinate plane of the reference image interpolated according to the minimum MVR to indicate the pixel unit corresponding to the MVR of the current block.

[0420] In addition, according to an embodiment, when adjusting the default MV considering the MVR of the current block and the minimum MVR, the motion vector encoding device 2700 and the motion vector decoding device 2500 may adjust the default MV according to Equation 2 below instead of Equation 1.

[0421] [Equation 2]

[0422] Default MV' = ((Default MV+Offset) >> k) << k

[0423] Although Equation 2 is similar to Equation 1, different from the equation where the offset is applied to the reduced default MV, the offset is applied to the original default MV and then reduced according to k.

[0424] The motion vector encoding device 2700 finds the MV of the current block by using the MVR of the current block, and obtains the difference between the MV of the current block and the PMV as the residual MV.

[0425] As shown in Equation 3 below, the motion vector encoding device 2700 may determine the residual MV and encode the residual MV. In Equation 3, MV represents the motion vector of the current block, PMV represents the predicted motion vector of the current block, and MVD represents the residual MV. The PMV may represent the PMV determined based on the adjusted default MV and / or the adjusted MV of the PMV candidate block.

[0426] [Equation 3]

[0427] MVD = MV – PMV

[0428] When the MVR of the current block is higher than the minimum MVR, as shown in Equation 4, the motion vector encoding device 2700 may scale down the residual MV and may generate a bitstream including information indicating the scaled-down residual MV.

[0429] [Equation 4]

[0430] MVD' = (MVD >> k)

[0431] In Equation 4, MVD' represents the scaled-down residual MV, and k, which is a value determined according to the difference between the minimum MVR and the MVR of the current block, is the same as k in Equation 1.

[0432] According to an embodiment, the motion vector encoding device 2700 may scale down the MV and PMV of the current block according to the k value, and then may encode the difference between the two values as the residual MV.

[0433] According to an embodiment, the motion vector encoding device 2700 may calculate the scaled-down residual MV according to Equation 5 below instead of Equation 3 and Equation 4.

[0434] [Equation 5]

[0435] MVD' = (MV - PMV) / (R * S)

[0436] In Equation 5, MVD' represents the scaled-down residual MV, MV represents the MV of the current block, and PMV represents the predicted motion vector of the current block. In addition, R represents the pixel unit value of the MVR of the current block (for example, 1 / 4 when the MVR of the current block is a 1 / 4 pixel unit MVR). In addition, S represents the reciprocal of the pixel unit value of the minimum MVR (for example, 4 when the minimum MVR is a 1 / 4 pixel unit).

[0437] The motion vector decoding device 2500 may reconstruct the MV of the current block by using the PMV and the residual MV of the current block.

[0438] When the MVR of the current block is higher than the minimum MVR, as shown in Equation 6 below, the motion vector decoding device 2500 may scale up the residual motion data.

[0439] [Equation 6]

[0440] MVD” = (MVD' << k)

[0441] In Equation 6, MVD' represents the residual MV scaled down by the encoding device, and MVD” represents the scaled-up residual MV. k, which is a value determined according to the difference between the minimum MVR and the MVR of the current block, is the same as k in Equation 1.

[0442] The motion vector decoding device 2500 can decode the MV of the current block by adding the residual MV selectively amplified according to the difference between the minimum MVR and the MVR of the current block to the PMV.

[0443] According to an embodiment, the motion vector decoding device 2500 can determine the amplified residual MV according to Equation 7 below instead of Equation 6 above.

[0444] [Equation 7]

[0445] MVD” = MVD' * (R * S)

[0446] In Equation 7, MVD' represents the scaled residual MV, and R represents the pixel unit value of the MVR of the current block (e.g., 1 / 4 when the MVR of the current block is a 1 / 4 pixel unit MVR). In addition, S represents the reciprocal of the pixel unit value of the minimum MVR (e.g., 4 when the minimum MVR is a 1 / 4 pixel unit).

[0447] According to an embodiment, when the MVR of the current block is less than the MVR of 1 pixel unit, the motion vector decoding device 2500 can interpolate the reference image according to the minimum MVR, and then can search for the prediction block of the current block according to the MV of the current block. In addition, when the MVR of the current block is equal to or higher than the MVR of 1 pixel unit, the motion vector decoding device 2500 can search for the prediction block of the current block according to the MV of the current block without interpolating the reference image. The motion vector decoding device 2500 can reconstruct the current block by adding the prediction block to the residual data that has been inverse-transformed and inverse-quantized.

[0448] An embodiment can be implemented as a computer-executable program, and the program can be stored in a medium.

[0449] The medium can continuously store the computer-executable program, or can temporarily store the computer-executable program to execute or download the computer-executable program. In addition, the medium can be any of various recording means or storage means including a combination of a single piece of hardware or multiple pieces of hardware, and can be distributed in a network, and is not limited to the medium directly connected to the computer system. The medium can be configured to store program instructions, and examples of the medium can include magnetic media (such as hard disks, floppy disks, or magnetic tapes), optical recording media (such as compact disc read-only memory (CD-ROM) or digital versatile disc (DVD)), magneto-optical media (such as magneto-optical discs, ROM, random access memory (RAM), and flash memory). In addition, other examples of the medium can include recording media and storage media managed by an application store that distributes applications or a website or server that supplies or distributes various other software.

[0450] Although the present disclosure has been specifically shown and described with reference to embodiments thereof, those of ordinary skill in the art will understand that various changes in form and detail may be made therein without departing from the spirit and scope of the present disclosure as defined by the appended claims.

Claims

1. A method for decoding a motion vector, the method comprising: Obtaining information about a residual motion vector and information indicating a specific motion vector resolution of a current block among a plurality of motion vector resolutions including a first motion vector resolution from a bitstream; When a motion vector of a first candidate block corresponding to the first motion vector resolution indicated by the information indicating the specific motion vector resolution is available, determining the motion vector of the first candidate block as the predicted motion vector of the current block, wherein the position of the first candidate block is determined based on the information indicating the specific motion vector resolution; When the motion vector of the first candidate block is not available, determining a default motion vector from default motion vector candidates according to a priority, and determining the default motion vector as the predicted motion vector of the current block; Adjusting the predicted motion vector by applying a shift operation based on the information indicating the specific motion vector resolution to the predicted motion vector; Using the information indicating the specific motion vector resolution to amplify the residual motion vector; and Obtaining the motion vector of the current block by using the amplified residual motion vector and the adjusted predicted motion vector of the current block.

2. A method for encoding a motion vector, the method comprising: Selecting a specific motion vector resolution of a current block among a plurality of motion vector resolutions including a first motion vector resolution; When a motion vector of a first candidate block corresponding to the first motion vector resolution selected as the specific motion vector resolution of the current block is available, determining the motion vector of the first candidate block as the predicted motion vector of the current block; When the motion vector of the first candidate block is not available, determining a default motion vector from default motion vector candidates according to a priority, and determining the default motion vector as the predicted motion vector of the current block; Adjusting the predicted motion vector by applying a shift operation based on the information indicating the specific motion vector resolution of the current block to the predicted motion vector; Obtaining a residual motion vector by using the motion vector of the current block and the adjusted predicted motion vector of the current block; Using the information indicating the specific motion vector resolution to shrink the residual motion vector; And Generating a bitstream, the bitstream including the information indicating the specific motion vector resolution and the information about the shrunk residual motion vector, wherein the position of the first candidate block is determined based on the information indicating the specific motion vector resolution.

3. A device for decoding a motion vector, the device comprising: An obtainer configured to obtain information about a residual motion vector and information indicating a specific motion vector resolution of a current block among a plurality of motion vector resolutions including a first motion vector resolution from a bitstream; And A decoder configured to: When the motion vector of the first candidate block corresponding to the first motion vector resolution indicated by the information indicating a specific motion vector resolution is available, determine the motion vector of the first candidate block as the predicted motion vector of the current block, where the position of the first candidate block is determined based on the information indicating a specific motion vector resolution; When the motion vector of the first candidate block is not available, determine a default motion vector from default motion vector candidates according to a priority, and determine the default motion vector as the predicted motion vector of the current block; Adjust the predicted motion vector by applying a shift operation based on the information indicating a specific motion vector resolution to the predicted motion vector; Use the information indicating a specific motion vector resolution to magnify the residual motion vector; and Obtain the motion vector of the current block by using the magnified residual motion vector and the adjusted predicted motion vector of the current block.

4. An apparatus for encoding a motion vector, the apparatus comprising: An encoder, configured to: Select a specific motion vector resolution of a current block from a plurality of motion vector resolutions including a first motion vector resolution; When the motion vector of the first candidate block corresponding to the first motion vector resolution selected as the specific motion vector resolution of the current block is available, determine the motion vector of the first candidate block as the predicted motion vector of the current block; When the motion vector of the first candidate block is not available, determine a default motion vector from default motion vector candidates according to a priority, and determine the default motion vector as the predicted motion vector of the current block; Adjust the predicted motion vector by applying a shift operation based on the information indicating the specific motion vector resolution of the current block to the predicted motion vector; Use the motion vector of the current block and the adjusted predicted motion vector of the current block to obtain a residual motion vector; And Use the information indicating a specific motion vector resolution to shrink the residual motion vector; And A generator, configured to generate a bitstream, the bitstream including the information indicating the specific motion vector resolution of the current block and the information about the shrunk residual motion vector, wherein the position of the first candidate block is determined based on the information indicating a specific motion vector resolution.

5. A method for transmitting a bitstream, wherein, The bitstream is generated by the method according to claim 2.

Citation Information

Patent Citations

  • Method for selecting motion vector predictor and device using same

    CN103535040A

  • Method and apparatus for complexity scalable video decoder

    CN1939066A