Apparatus and method for encoding and decoding motion vectors

By adaptively determining the motion vector resolution and one-to-one mapping relationship, and selecting the optimal candidate block for motion vector encoding and decoding, the problem of low motion vector prediction efficiency in existing technologies is solved, and efficient video encoding and decoding at low bit rates is achieved.

CN116016922BActive Publication Date: 2025-11-28SAMSUNG ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310026758.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2017-07-07
Filing Date
2018-03-30
Publication Date
2025-11-28
Estimated Expiration
2038-03-30

AI Technical Summary

Technical Problem

Existing video coding techniques suffer from inefficiency in motion vector prediction, especially in high-resolution video coding, where existing methods struggle to effectively utilize motion vector information at different resolutions for encoding and decoding.

Method used

By adaptively determining the motion vector resolution (MVR), the optimal candidate block is selected from the candidate blocks as the predicted motion vector. Encoding and decoding are performed using a one-to-one mapping relationship. The information of the candidate MVR and the candidate block is combined to achieve an efficient representation of the motion vector.

Benefits of technology

It enables efficient encoding and decoding of video at low bit rates, improving encoding efficiency, reducing bit rate requirements, and enhancing the quality of reconstructed images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016922B_ABST
    Figure CN116016922B_ABST
Patent Text Reader

Abstract

The present disclosure provides apparatuses and methods for encoding and decoding motion vectors. According to one embodiment of the present disclosure, a method for decoding a motion vector is disclosed, the method comprising the steps of: obtaining, from a bitstream, information indicating a motion vector resolution of a current block; determining one candidate block among at least one candidate block based on the motion vector resolution of the current block; and obtaining a motion vector of the current block corresponding to the motion vector resolution of the current block by using a motion vector of the determined one candidate block as a predicted motion vector of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with the application date of 2018.03.30, the application number of "201880045543.1", and the title of "Apparatus and method for encoding and decoding motion vector". 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 apparatus for encoding motion vectors of a video and a method and apparatus for decoding motion vectors of a video. BACKGROUND

[0003] In a video encoding and decoding method, in order to encode an image, one picture can be divided into a plurality of macroblocks, and each macroblock can 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 thereof 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 in 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 prediction block generated as a prediction result from the current block is encoded. In this case, in order to more accurately perform prediction, interpolation is performed on a search range of a reference picture, sub-pixel unit pixels smaller than integer pixel unit pixels can be generated, and inter prediction can be performed on the generated sub-pixel unit pixels.

[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 prediction motion vector of the current block. SUMMARY

[0007] TECHNICAL SOLUTION

[0008] According to an embodiment, a method of decoding a motion vector can include obtaining information indicating a motion vector resolution (MVR) of a current block from a bitstream, determining one candidate block from at least one candidate block based on the MVR of the current block, and obtaining a motion vector corresponding to the MVR of the current block of the current block by using a motion vector of the determined one candidate block as a prediction motion vector of the current block.

[0009] OPTIMAL IMPLEMENTATION

[0010] A method of decoding a motion vector according to an embodiment includes obtaining, from a bitstream, information indicating a motion vector resolution (MVR) of a current block; determining one candidate block from at least one candidate block based on the MVR of the current block; and obtaining a motion vector of the current block corresponding to the MVR of the current block by using a motion vector of the determined one candidate block as a predicted motion vector of the current block.

[0011] A method of decoding a motion vector according to an embodiment includes obtaining, from a bitstream, information indicating one candidate block for a current block; determining one candidate motion vector resolution (MVR) from at least one candidate MVR as the MVR of the current block based on the information indicating the one candidate block; and obtaining a motion vector of the current block corresponding to the MVR of the current block by using a motion vector of the one candidate block as a predicted motion vector of the current block.

[0012] The MVR of the current block can be determined from the at least one candidate MVR.

[0013] The at least one candidate MVR and the at least one candidate block can be mapped in a one-to-one (1:1) manner.

[0014] The method can further include determining a number and a type of the at least one candidate MVR based on information about at least one of the current block, a previously decoded block, a current slice, a previously decoded slice, a current picture, and a previously decoded picture.

[0015] The method can further include determining a position of the at least one candidate block to be mapped to the at least one candidate MVR based on information about at least one of the current block, a previously decoded block, a current slice, a previously decoded slice, a current picture, and a previously decoded picture.

[0016] The step of determining the MVR of the current block can include obtaining, from a bitstream, an index indicating the MVR of the current block; and determining a candidate MVR corresponding to the obtained index from the at least one candidate MVR as the MVR of the current block.

[0017] The method can further include determining a motion vector of a block other than the at least one candidate block as the predicted motion vector when there is no motion vector in the one candidate block.

[0018] The method can further include replacing some of the candidate blocks having the same motion vector with blocks other than the at least one candidate block when there are candidate blocks having the same motion vector in the at least one candidate block mapped to at least one candidate MVR selectable for the current block.

[0019] The step of obtaining the motion vector of the current block can include scaling up the residual motion vector obtained from the bitstream when the MVR of the current block is higher than the minimum MVR among the at least one candidate MVR.

[0020] The step of obtaining the motion vector of the current block can include adjusting the predicted motion vector when the MVR of the current block is higher than the minimum MVR among the at least one candidate MVR.

[0021] The adjusting step can include scaling down the predicted motion vector based on a difference between the MVR of the current block and the minimum MVR, changing the scaled-down predicted motion vector to indicate an integer pixel unit when the scaled-down predicted motion vector does not indicate the integer pixel unit, and obtaining the adjusted predicted motion vector by scaling up the changed scaled-down predicted motion vector.

[0022] An apparatus for decoding a motion vector includes an obtainer configured to obtain, from a bitstream, information indicating a motion vector resolution (MVR) of a current block, a prediction decoder configured to determine one candidate block from at least one candidate block based on the MVR of the current block, and obtain a motion vector of the current block corresponding to the MVR of the current block by using a motion vector of the determined one candidate block as a predicted motion vector of the current block.

[0023] A method of encoding a motion vector includes determining a motion vector resolution (MVR) of a current block, determining one candidate block from at least one candidate block based on the determined MVR, obtaining a motion vector of the current block according to the determined MVR, and generating a bitstream including at least one of information indicating the MVR of the current block and information indicating the one candidate block and a residual motion vector between the motion vector of the current block and a motion vector of the one candidate block.

[0024] A bitstream stored in a storage medium includes information indicating a motion vector resolution (MVR) of a current block or information indicating one candidate block for the current block, and information corresponding to a residual motion vector obtained by using a motion vector of the current block determined according to the MVR of the current block and a motion vector of the one candidate block, wherein the information indicating the MVR of the current block and the information indicating the one candidate block for the current block are mapped to each other.

[0025] Advantageous Effects

[0026] The apparatus and method for encoding a motion vector and the apparatus and method for decoding a motion vector according to the embodiments can efficiently encode and decode an image at a low bit rate by representing a residual motion vector based on an adaptively determined motion vector resolution. BRIEF DESCRIPTION OF DRAWINGS

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

[0028] Figure 1 is a block diagram illustrating a configuration of a motion vector encoding apparatus according to an embodiment.

[0029] Figure 2 is a flowchart for describing a motion vector encoding method according to an embodiment.

[0030] Figure 3 is a block diagram illustrating a configuration of a motion vector decoding apparatus according to an embodiment.

[0031] Figure 4 is a flowchart for describing a motion vector decoding method according to an embodiment.

[0032] Figure 5 is a diagram for describing at least one candidate block mapped to at least one candidate motion vector resolution (MVR) in a one-to-one (1:1) manner.

[0033] Figure 6 is a diagram illustrating a mapping relationship between at least one candidate MVR and at least one candidate block.

[0034] Figure 7 is a diagram for describing interpolation for determining a motion vector according to various MVRs.

[0035] Figure 8 is a diagram illustrating positions of pixels that can be indicated by motion vectors according to ¼-pixel unit MVR, ½-pixel unit MVR, 1-pixel unit MVR, and 2-pixel unit MVR when a usable minimum MVR is ¼-pixel unit MVR.

[0036] Figure 9a and Figure 9b is a diagram for describing a method of adjusting a predicted motion vector.

[0037] Figure 10 is a diagram illustrating syntax for describing a process of obtaining an MVR index of a current block.

[0038] Figure 11 is a block diagram of a video decoding apparatus for decoding an image based on at least one piece of information among block shape information and partition shape information according to an embodiment.

[0039] Figure 12 is a block diagram of a video encoding apparatus for encoding an image based on at least one piece of information among block shape information and partition shape information according to an embodiment.

[0040] Figure 13A process of determining at least one coding unit by dividing a current coding unit according to an embodiment is shown.

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

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

[0043] Figure 16 A method of determining a predetermined coding unit from an odd number of coding units according to an embodiment is shown.

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

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

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

[0047] Figure 20 A shape into which a second coding unit having a non-square shape determined by dividing a first coding unit is limited when the second coding unit satisfies a predetermined condition according to an embodiment is shown.

[0048] Figure 21 A process of dividing a square coding unit when division shape information indicates that the square coding unit will not be divided into four square coding units according to an embodiment is shown.

[0049] Figure 22 A processing order among a plurality of coding units can be changed depending on a process of dividing the coding units according to an embodiment is shown.

[0050] Figure 23 A process of determining a depth of a coding unit as a shape and size of the coding unit change when the coding unit is recursively divided to determine a plurality of coding units according to an embodiment is shown.

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

[0052] Figure 25 A determination of a plurality of coding units based on a plurality of predetermined data units included in a picture is shown according to an embodiment.

[0053] Figure 26 A processing block used as a unit for determining a determination order of a reference coding unit included in a picture is shown according to an embodiment.

[0054] Figure 27 A coding unit determinable per picture when a shape combination in which a coding unit is divisible is different for each picture is shown according to an embodiment.

[0055] Figure 28 Various shapes of a coding unit determinable based on division shape information representable as a binary code are shown according to an embodiment.

[0056] Figure 29 Other shapes of a coding unit determinable based on division shape information representable as a binary code are shown according to an embodiment.

[0057] Figure 30 is a block diagram of a video encoding and decoding system for performing in-loop filtering.

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

[0059] Figure 32 An index according to a zigzag scan order of a coding unit is shown according to an embodiment.

[0060] Figure 33 is a diagram of reference samples for intra prediction of a coding unit according to an embodiment.

[0061] DETAILED DESCRIPTION

[0062] Since the present disclosure allows various changes and various embodiments, exemplary embodiments will be shown in the accompanying drawings and will be 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 substitutes included in the present disclosure are included in the present disclosure without departing from the spirit and technical scope of the present disclosure.

[0063] In the description of the present disclosure, when it is considered that a specific detailed explanation of the prior art can unnecessarily obscure the gist of the present disclosure, such a specific detailed explanation is omitted. Also, numbers (for example, first and second) used in the description of the embodiments of the present disclosure are intended to distinguish only one component from another component.

[0064] When a component is referred to as being "connected" or "accessed" to 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 to the other component with another component interposed therebetween, unless otherwise specifically stated.

[0065] As to an element having a suffix such as "unit" or "module", two or more elements can be combined into one element according to a function thereof, or one element can be divided into two or more elements. Further, each of the respective components to be described below can perform some or all of the functions of other components, in addition to a primary function thereof, and some of the primary functions of the respective components can be performed by other components.

[0066] Further, the term "image" or "picture" used herein can refer to a still image of a video or to a moving image, i.e., a video itself.

[0067] Further, the term "sample" used herein refers to data allocated to a sample position of an image and to be processed. For example, a pixel in a spatial domain image or a transform coefficient in a transform domain can be a sample. A unit including one or more samples can be defined as a block.

[0068] Further, the term "current block" used herein can refer to a block of a maximum coding unit, a coding unit, a prediction unit, or a transform unit of a current image to be encoded or decoded.

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

[0070] Further, the term "candidate MVR" used herein refers to one or more MVRs that can be selected as an MVR of a block, and the term "candidate block" refers to one or more blocks mapped to a candidate MVR and usable as a block for a predicted motion vector of a block to be inter predicted.

[0071] Further, the term "pixel unit" used herein can be used interchangeably with the terms "pixel precision" and "pixel accuracy".

[0072] Reference Figures 1 to 4 The invention describes apparatus and methods for encoding motion vectors according to embodiments, as well as apparatus and methods for decoding motion vectors.

[0073] Motion vector encoding device 10 and motion vector encoding method may be included in video encoding device 200 and method described below. Furthermore, motion vector decoding device 30 and motion vector decoding method may be included in video decoding device 100 and method described below.

[0074] Figure 1 This is a block diagram illustrating the configuration of a motion vector encoding device 10 according to an embodiment.

[0075] Inter-frame prediction in video coding refers to a prediction method that uses the similarity between the current image and another image. It detects reference blocks similar to the current block in the current image from a reference image decoded earlier than the current image, and represents the distance between the current block and the reference block using motion vectors. Furthermore, the difference in pixel values ​​between the current block and the reference block can be represented as residual data. Therefore, the information output by inter-frame prediction of the current block is not image information of the current block, but can be an index, motion vector, and residual data indicating the reference block, thereby improving encoding and decoding efficiency.

[0076] According to the embodiment, the motion vector encoding device 10 can encode motion vectors used for inter-frame prediction of each block of each image in a video.

[0077] The block type can be square or rectangular, or any geometric shape. According to the embodiments, the block is not limited to data units of a specific size, and may include the largest coding unit, coding unit, prediction unit, and transform unit among coding units in a tree structure.

[0078] The following will refer to Figures 11 to 33 Describes a video encoding and decoding method based on coding units with a tree structure.

[0079] like Figure 1 As shown, the motion vector encoding device 10 according to an embodiment may include a predictive encoder 11 and a generator 13. As described above, the motion vector encoding device 10 may include... Figure 12 In the video encoding device 200, the predictive encoder 11 may be included in the encoder 220 of the video encoding device 200, and the generator 13 may be included in the bitstream generator 210 of the video encoding device 200.

[0080] The motion vector coding device 10 can encode motion vectors by performing inter-frame prediction according to block units divided from the frame.

[0081] With respect to a current block including a coding unit or a prediction unit divided from a coding unit, the motion vector encoding apparatus 10 according to an embodiment can search for a prediction block most similar to the current block in a reference image through motion estimation, and can determine a motion vector indicating motion information between the current block and the prediction block.

[0082] In an embodiment, the prediction encoder 11 can select one of the at least one candidate MVR as an MVR of the current block, and can determine a motion vector of the current block according to the selected MVR. The prediction encoder 11 can use a motion vector of a candidate block of the at least one candidate block mapped to the selected MVR of the current block as a prediction motion vector of the current block.

[0083] In an embodiment, the prediction encoder 11 can select one of the at least one candidate block for the current block, and can determine one of the at least one candidate MVR mapped to the selected candidate block as an MVR of the current block.

[0084] In an embodiment, a one-to-one (1:1) mapping relationship or a correspondence between the at least one candidate MVR and the at least one candidate block can be preset in the motion vector encoding apparatus 10. When the at least one candidate MVR and the at least one candidate block are mapped in a 1:1 manner, this means that when one of the at least one candidate MVR is determined as an MVR of the current block, a position of one candidate block to be used as a prediction motion vector of the current block is determined accordingly, and conversely, when one candidate block to be used as a prediction motion vector of the current block is determined from the at least one candidate block, one candidate MVR is determined as an MVR of the current block accordingly. That is, in an embodiment of the disclosure, it will be understood that one candidate block is assigned to each of the at least one candidate MVR.

[0085] The at least one candidate MVR can include at least one of an MVR of 1 / 8-pixel unit, an MVR of 1 / 4-pixel unit, an MVR of 1 / 2-pixel unit, an MVR of 1-pixel unit, an MVR of 2-pixel unit, an MVR of 4-pixel unit, and an MVR of 8-pixel unit. However, the candidate MVR is not limited to the above examples, and MVRs having various values can be included in the candidate MVR.

[0086] In the present specification, when a first MVR is higher than a second MVR, it means that the pixel unit of the first MVR is higher than the pixel unit of the second MVR. For example, an MVR of 1 pixel unit is higher than an MVR of 1 / 2 pixel unit, and an MVR of 1 / 2 pixel unit is higher than an MVR of 1 / 4 pixel unit. In fact, although prediction when determining a motion vector by using an MVR of 1 / 4 pixel unit is more accurate than prediction when determining a motion vector by using an MVR of 1 pixel unit, the present specification will describe the size difference of each MVR based on the size of the pixel unit of each MVR for the convenience of explanation.

[0087] The at least one candidate block can be selected from blocks including a temporal block and a spatial block associated with the current block. The spatial block associated with the current block can include at least one block spatially adjacent to the current block. The temporal block can include a block at the same position as the current block in a reference picture and at least one block spatially adjacent to the block at the same position, wherein a picture order count (POC) of the reference picture is different from a POC of the current block.

[0088] In an embodiment, when the at least one candidate MVR includes an MVR of 1 / 4 pixel unit, an MVR of 1 / 2 pixel unit, an MVR of 1 pixel unit, and an MVR of 2 pixel unit and the at least one candidate block includes a left block, an above block, a left-above block, and an above-left block, a mapping relationship or a corresponding relationship between (the MVR of 1 / 4 pixel unit and the left block), (the MVR of 1 / 2 pixel unit and the above block), (the MVR of 1 pixel unit and the left-above block), and (the MVR of 2 pixel unit and the above-left block) can be set in the motion vector encoding device 10. Accordingly, when the MVR of 1 / 4 pixel unit is selected as the MVR of the current block, the prediction encoder 11 can use the motion vector of the left block as the prediction motion vector of the current block accordingly. In addition, when the above block is selected as the prediction motion vector of the current block, the prediction encoder 11 can determine the MVR of 1 / 2 pixel unit as the MVR of the current block accordingly.

[0089] In an embodiment, the prediction encoder 11 can determine the number and type of selectable candidate MVRs in a block unit, a slice unit, or a picture unit based on information about at least one of the current block, a previously encoded block, the current slice, a previously encoded slice, the current picture, and a previously encoded picture. The prediction encoder 11 can determine one candidate MVR from the selectable candidate MVRs for the current block determined in a block unit, a slice unit, or a picture unit as the MVR of the current block.

[0090] For example, the prediction encoder 11 can determine at least one candidate MVR selectable for a current block and at least one candidate MVR selectable for a subsequent block differently. For example, a MVR of 1 / 4-pixel unit and a MVR of 1 / 2-pixel unit can be determined as at least one candidate MVR selectable for the current block, and a MVR of 1-pixel unit and a MVR of 2-pixel unit can be determined as at least one candidate MVR for the subsequent block. Alternatively, only one MVR can be determined as a candidate MVR for any block.

[0091] For example, when determining at least one candidate MVR selectable in units of blocks, the prediction encoder 11 can compare a size of a current block with a predetermined size, and can cause only one MVR to be included in the candidate MVRs, or can cause a plurality of MVRs to be included in the candidate MVRs. Alternatively, when determining at least one candidate MVR selectable in units of blocks, the prediction encoder 11 can determine a number and a type of candidate MVRs selectable for a current block based on MVRs of previously encoded neighboring blocks.

[0092] Further, for example, when determining at least one candidate MVR selectable in units of slices or pictures, the prediction encoder 11 can determine a number and a type of candidate MVRs selectable for a current slice or a current picture according to a type of the slice or the picture. Further, for example, when determining at least one candidate MVR selectable in units of slices or pictures, the prediction encoder 11 can determine a number and a type of candidate MVRs selectable for a current slice or a current picture according to whether the slice or the picture is referred to by another slice or picture.

[0093] In an embodiment, the prediction encoder 11 can determine a position of at least one candidate block mapped to each of the at least one candidate MVR in units of blocks, in units of slices, or in units of pictures based on information about at least one of a current block, a previously encoded block, a current slice, a previously encoded slice, a current picture, and a previously encoded picture.

[0094] For example, the prediction encoder 11 can determine at least one candidate block selectable for a current block and at least one candidate block selectable for a subsequent block differently. For example, when determining a position of a selectable candidate block in units of blocks, an above block and a left block can be mapped to a MVR of 1-pixel unit and a MVR of 2-pixel unit, respectively, corresponding to a candidate MVR of the current block, and an above-left block and a left-below block can be mapped to a MVR of 1-pixel unit and a MVR of 2-pixel unit, respectively, corresponding to a candidate MVR of the subsequent block.

[0095] In an embodiment, the number and type of the at least one candidate MVR and the position of the at least one candidate block to be respectively mapped to the at least one candidate MVR can be fixed and set to default values for the video to be encoded.

[0096] In an embodiment, the prediction encoder 11 can determine one candidate MVR from the at least one candidate MVR as the MVR of the current block, and can determine the motion vector of the current block according to the MVR of the current block.

[0097] To determine the motion vector of the current block, the prediction encoder 11 can interpolate the reference picture by using the smallest MVR among the at least one candidate MVR.

[0098] In an embodiment, when the smallest pixel unit candidate MVR (i.e., the smallest MVR) among the at least one candidate MVR has 1 / n pixel unit (n is a natural number), the prediction encoder 11 can generate a 1 / n pixel unit sub-pixel from an integer pixel of the reference picture for motion estimation, and can determine the motion vector of the current block indicating the smallest 1 / n pixel unit sub-pixel according to the MVR of the current block.

[0099] Determining the motion vector by using the MVR of the small pixel unit can always be less efficient than determining the motion vector by using the MVR of the large pixel unit according to the characteristics of the current picture. The case of determining the motion vector by using the MVR of the small pixel unit can require more bits to represent the size of the motion vector (or the residual motion vector) than the case of determining the motion vector by using the MVR of the large pixel unit, and can be less efficient in terms of bit rate. Therefore, for example, the MVR can be adaptively determined according to the resolution of the picture to reduce the bit rate and minimize the degradation of the quality of the reconstructed picture.

[0100] The prediction encoder 11 according to an embodiment can adaptively determine the MVR of the current block, and can determine the motion vector by using the pixel unit of the determined MVR. For example, when the pixel unit of the MVR of the current block is 1 / 2, the prediction encoder 11 can determine the motion vector indicating the pixel of the 1 / 2 pixel unit in the reference picture interpolated according to the smallest MVR.

[0101] The prediction encoder 11 according to an embodiment can use the motion vector of an arbitrary candidate block as the predicted motion vector of the current block, or can change the motion vector of the arbitrary candidate block, and can use the changed motion vector as the predicted motion vector of the current block.

[0102] In an embodiment, the prediction encoder 11 can adjust the motion vector of the candidate block for the current block based on a difference between the minimum MVR among the available candidate MVRs and the MVR of the current block, and then can determine the motion vector of the current block by using the adjusted motion vector.

[0103] Because the motion vector of the candidate block is predicted to indicate a pixel coordinate in the picture interpolated according to the minimum MVR, the motion vector of the candidate block is adjusted to correspond to the MVR of the current block. Also, the reason for adjusting the motion vector of the candidate block is to express the residual motion vector in integer units, as described below.

[0104] For example, when the MVR of the current block is 1 pixel unit, the motion vector of the current block must be determined to indicate a pixel of 1 pixel unit in the picture interpolated according to the minimum MVR. However, when the motion vector of the candidate block does not indicate a pixel of 1 pixel unit, the motion vector of the candidate block is adjusted to indicate a pixel of 1 pixel unit.

[0105] The method of adjusting the motion vector of the candidate block will be described below with reference to Figure 9a and Figure 9b

[0106] The prediction encoder 11 determines the motion vector of the current block by using each candidate MVR by using the motion vector of an arbitrary candidate block mapped to the at least one candidate MVR as a predicted motion vector, and determines one candidate MVR from the at least one candidate MVR based on a cost. When the cost is calculated, a rate-distortion cost can be used.

[0107] To determine the motion vector of the current block, the prediction encoder 11 can determine a search start position in a reference picture by using the motion vector (or the adjusted motion vector) of the candidate block assigned to each candidate MVR, and can determine the motion vector of the current block according to each candidate MVR by searching for an optimal reference block according to each candidate MVR. For example, first, the prediction encoder 11 can perform a box search within a search range of 5 pixels around the search start position. Second, the prediction encoder 11 can perform a diamond search in various step lengths. Alternatively, the prediction encoder 11 can determine an optimal position by performing a raster search.

[0108] The prediction encoder 11 can compare rate-distortion costs based on a difference between the motion vector of the current block determined according to each candidate MVR and the motion vector of the candidate block assigned to each candidate MVR, and can determine the candidate MVR and the candidate block having the minimum cost as the MVR of the current block and the candidate block of the predicted motion vector for the current block.

[0109] ​For example, when a 1 / 4 pel unit MVR mapped to a left block, a 1 / 2 pel unit MVR mapped to an above block, and a 1 pel unit MVR mapped to an above right block are included in the at least one candidate MVR, the prediction encoder 11 can determine a motion vector of a current block in a 1 / 4 pel unit of a reference image interpolated according to the 1 / 4 pel unit MVR as a minimum MVR by using a motion vector of the left block, can determine a motion vector of the current block in a 1 / 2 pel unit of the reference image interpolated according to the 1 / 4 pel unit MVR by using a motion vector of the above block, and can determine a motion vector of the current block in a 1 pel unit of the reference image interpolated according to the 1 / 4 pel unit MVR by using a motion vector of the above right block. The prediction encoder 11 can determine one candidate MVR selected based on the cost as an MVR of the current block.

[0110] In an embodiment, when there is no motion vector in a candidate block among a plurality of candidate blocks mapped to candidate MVRs for a current block, respectively, the prediction encoder 11 can exclude the candidate block having no motion vector, and can use another block having a motion vector as a candidate block. In this case, the other block newly used as the candidate block can include a block other than the candidate blocks mapped to the candidate MVRs, respectively. The prediction encoder 11 can use a motion vector of the other block determined according to the candidate MVR as a predicted motion vector of the current block. When a block is intra-predicted, the intra-predicted block can be determined as a block having no motion vector.

[0111] For example, when it is assumed that at least one candidate MVR available for a current block includes a 1 / 4 pel unit MVR mapped to a left block, a 1 / 2 pel unit MVR mapped to an above block, a 1 pel unit MVR mapped to an above right block, and there is no motion vector in the above right block, the prediction encoder 11 can map the 1 pel unit MVR to a block other than the at least one candidate block, for example, an above left block.

[0112] In an embodiment, when there is no motion vector in some candidate blocks among at least one candidate block mapped to a candidate MVR, a position of a block to be newly mapped and a mapping priority can be determined in advance.

[0113] Further, in an embodiment, when there is no motion vector in some candidate blocks among at least one candidate block mapped to at least one candidate MVR available for a current block, the prediction encoder 11 can use an arbitrary motion vector, for example, a zero vector, as a motion vector of the some candidate blocks.

[0114] Further, in an embodiment, when there are candidate blocks having the same motion vector among the at least one candidate block mapped to the at least one candidate MVR available for the current block, some of the candidate blocks having the same motion vector can be replaced by blocks other than the at least one candidate block. For example, when the motion vector of the left block mapped to the 1 / 4-pel unit MVR and the motion vector of the above block mapped to the 1 / 2-pel unit MVR are the same, the prediction encoder 11 can replace one of the left block and the above block (e.g., the above block) with another block (e.g., the above left block), and can map the replaced block to a candidate MVR (e.g., 1 / 2-pel resolution).

[0115] In an embodiment, whether the motion vectors of two or more candidate blocks are the same can be determined by adjusting the motion vectors of the candidate blocks and then comparing the adjusted motion vectors.

[0116] When there are multiple candidate blocks having the same motion vector, the priority indicating which of the multiple candidate blocks is to be replaced by another block and the position and priority of the block to be a new block can be determined in advance.

[0117] In an embodiment, when determining the motion vector of the current block and the candidate block, the prediction encoder 11 can obtain a residual motion vector between the motion vector of the current block and the predicted motion vector.

[0118] The generator 13 can generate a bitstream including at least one of information indicating the MVR of the current block and information indicating the candidate block used as the predicted motion vector of the current block. As described above, because the candidate MVR and the candidate block have a 1:1 mapping relationship, when the MVR of the current block is determined, the position of the candidate block can be determined accordingly, and conversely, when the candidate block is determined, the MVR of the current block can be determined accordingly. Therefore, the generator 13 can generate a bitstream including at least one of information about the MVR of the current block and information for specifying the candidate block.

[0119] The generator 13 can include at least one of an index indicating the MVR of the current block and an index indicating the candidate block as at least one of information indicating the MVR of the current block and information indicating the candidate block used as the predicted motion vector of the current block.

[0120] In an embodiment, when an index is assigned to each of the candidate MVRs available for the current block in unary and one index is selected by the prediction encoder 11, the generator 13 can generate a bitstream including the selected index. For example, when the available candidate MVRs include an MVR of 1 / 4-pixel unit, an MVR of 1 / 2-pixel unit, an MVR of 1-pixel unit, an MVR of 2-pixel unit, an MVR of 4-pixel unit, and an MVR of 8-pixel unit, the MVR of 1 / 4-pixel unit, the MVR of 1 / 2-pixel unit, the MVR of 1-pixel unit, the MVR of 2-pixel unit, the MVR of 4-pixel unit, and the MVR of 8-pixel unit can be represented by indices 0, 10, 110, 1110, 11110, and 11111, respectively.

[0121] In an embodiment, when an index is assigned to each of the candidate blocks mapped to at least one candidate MVR in unary and one index is selected by the prediction encoder 11, the generator 13 can generate a bitstream including the selected index. For example, when the at least one candidate block includes a left block, an above block, a left-above block, a left-below block, an above-left block, and an above-right block, the left block, the above block, the left-above block, the left-below block, the above-left block, and the above-right block can be represented by indices 0, 10, 110, 1110, 11110, and 11111, respectively.

[0122] In an embodiment, when there is one candidate MVR available for the current block, the prediction encoder 11 omits the operation of generating information indicating the MVR of the current block and the candidate block. Accordingly, the information indicating the MVR of the current block and the candidate block can not be included in the bitstream generated by the generator 13.

[0123] In an embodiment, when there are two or more candidate MVRs available for the current block, the prediction encoder 11 can generate at least one of the information indicating the MVR of the current block and the candidate block by using a flag or an index.

[0124] In an embodiment, the prediction encoder 11 can downscale a residual motion vector that is a difference between a motion vector of the current block and a prediction motion vector.

[0125] For example, when the MVR of the current block is higher than a minimum MVR among the candidate MVRs, the prediction encoder 11 can downscale the residual motion vector based on a difference between the minimum MVR and the MVR of the current block. For example, when the minimum MVR has 1 / 4-pixel unit and the MVR of the current block has 1 / 2-pixel unit, the prediction encoder 11 can downscale the residual motion vector by half.

[0126] In an embodiment, because the residual motion vector is adaptively or selectively reduced according to the MVR adaptively selected for the current block, the motion vector of the current block can be encoded by using less bits.

[0127] Figure 2 is a flowchart for describing a motion vector encoding method according to an embodiment.

[0128] In operation S21, the motion vector encoding apparatus 10 can determine one candidate MVR from among at least one candidate MVR available for the current block as the MVR of the current block, and can determine a candidate block mapped to the selected MVR from among at least one candidate block as a candidate block for a prediction motion vector of the current block.

[0129] Alternatively, in an embodiment, the motion vector encoding apparatus 10 can select a candidate block to be used as a prediction motion vector from among the at least one candidate block, and can determine a candidate MVR mapped to the selected candidate block as the MVR of the current block.

[0130] The at least one available candidate MVR can be mapped to the at least one candidate block in a 1:1 manner, and the motion vector encoding apparatus 10 can determine a motion vector of the current block according to each candidate MVR by using the motion vector of each available candidate MVR and the candidate block mapped to each available candidate MVR. The motion vector encoding apparatus 10 can select one candidate MVR and a candidate block selected based on a cost as the MVR of the current block and the candidate block for a prediction motion vector of the current block.

[0131] In an embodiment, the motion vector encoding apparatus 10 can determine the number and type of the at least one candidate MVR in a block unit, a slice unit, or a picture unit based on at least one of the current block, the previously encoded block, the current slice, the previously encoded slice, the current picture, and the previously encoded picture.

[0132] In an embodiment, the motion vector encoding apparatus 10 can determine the positions of the at least one candidate block to be respectively mapped to the at least one candidate MVR in a block unit, a slice unit, or a picture unit based on information about at least one of the current block, the previously encoded block, the current slice, the previously encoded slice, the current picture, and the previously encoded picture.

[0133] In an embodiment, when there is no motion vector in a candidate block among the at least one candidate block respectively mapped to the at least one candidate MVR, the motion vector encoding apparatus 10 can newly map a block other than the at least one candidate block mapped to the candidate MVR as a candidate block instead of the candidate block not including the motion vector, and can use the motion vector of the newly mapped block as a prediction motion vector of the current block.

[0134] Further, in an embodiment, when there is no motion vector in a candidate block among the at least one candidate block mapped to the at least one candidate MVR, the motion vector encoding apparatus 10 can use an arbitrary motion vector (e.g., a zero vector) as a motion vector of the candidate block not including a motion vector.

[0135] Further, in an embodiment, when there are candidate blocks having the same motion vector among the at least one candidate block mapped to the at least one candidate MVR, respectively, the motion vector encoding apparatus 10 can replace some candidate blocks having the same motion vector with blocks other than the at least one candidate block mapped to the candidate MVR, and can newly map the replaced blocks to the candidate MVR.

[0136] In operation S22, the motion vector encoding apparatus 10 determines a motion vector of the current block in the interpolated reference image according to the MVR of the current block.

[0137] The motion vector encoding apparatus 10 can adjust the motion vector of the candidate block by comparing the minimum MVR among the at least one candidate MVR selectable for the current block with the MVR of the current block. The motion vector encoding apparatus 10 can determine a search start position in the reference image according to the adjusted motion vector of the candidate block, can search for an optimal reference block in the reference image, and can determine the motion vector of the current block according to the MVR of the current block.

[0138] In operation S23, the motion vector encoding apparatus 10 obtains a residual motion vector between the motion vector of the current block and the motion vector (or the adjusted motion vector) of the candidate block.

[0139] In operation S24, the motion vector encoding apparatus 10 generates at least one of information about the MVR of the current block and information indicating the candidate block used as a prediction motion vector, and information indicating the residual motion vector.

[0140] The at least one of information about the MVR of the current block and information indicating the candidate block used as a prediction motion vector, and information indicating the residual motion vector can be included in a bitstream.

[0141] As described above, the motion vector encoding apparatus 10 can narrow the residual motion vector by comparing the MVR of the current block with the minimum MVR among the at least one candidate MVR.

[0142] Figure 3 FIG. 3 is a block diagram illustrating a configuration of a motion vector decoding apparatus 30 according to an embodiment. Figure 3The motion vector decoding apparatus 30 can be included in the video decoding apparatus 100. In detail, the obtainer 31 can be included in the bitstream obtainer 110 of the video decoding apparatus 100, and the prediction decoder 33 can be included in the decoder 120 of the video decoding apparatus 100.

[0143] The motion vector decoding apparatus 30 can determine a motion vector for performing inter prediction of a current block by parsing the obtained bitstream.

[0144] The obtainer 31 can obtain at least one of information on an MVR of the current block and information indicating a candidate block and information indicating a residual motion vector from the bitstream.

[0145] The information on the MVR of the current block can include an index indicating the MVR of the current block, and the information indicating the candidate block can include an index indicating the candidate block.

[0146] When the information on the MVR of the current block is obtained by the obtainer 31, the prediction decoder 33 can determine the candidate block to be used as a prediction motion vector of the current block according to the MVR of the current block.

[0147] In an embodiment, the obtainer 31 can obtain information on an MVR for each inter prediction coded unit. Figure 10 is a diagram illustrating a syntax for obtaining information on an MVR from a bitstream.

[0148] Referring to Figure 10 When it is checked in phrase "a" that a slice of a current coding unit is not an I slice, cu_skip_flag is extracted in phrase "b". The cu_skip_flag indicates whether a 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". The pred_mode_flag indicates whether the current coding unit is intra predicted or inter predicted. When the current coding unit is not intra predicted in phrase "f", i.e., the current coding unit is inter predicted, pred_mvr_idx is extracted in phrase "g". The pred_mvr_idx is an index indicating an MVR of the current coding unit, and an MVR corresponding to each index is as shown in Table 1.

[0149] [Table 1]

[0150] MVR index 0 1 2 3 4 Pixel resolution (R) 1 / 4 1 / 2 1 2 4

[0151] In an embodiment, when the information indicating the candidate block to be used as the prediction motion vector of the current block is obtained by the obtainer 31, the prediction decoder 33 can determine one candidate MVR from the at least one candidate MVR as the MVR of the current block.

[0152] The prediction decoder 33 can pre-store information about a 1:1 mapping relationship (or correspondence) between the at least one candidate MVR and the at least one candidate block selectable for the current block. Accordingly, when the information about the MVR of the current block is obtained by the obtainer 31, the candidate block mapped to the obtained information of the current block can be selected, or when the information indicating the candidate block is obtained by the obtainer 31, the MVR mapped to the obtained information of the current block can be selected.

[0153] In an embodiment, the MVR index shown in Table 1 can be used as the index of the at least one candidate block. The candidate MVR and the candidate block determined according to the index are shown in Table 2.

[0154] [Table 2]

[0155] Index 0 1 2 3 4 Pixel resolution 1 / 4 1 / 2 1 2 4 Nth MVP 1st MVP 2nd MVP 3rd MVP 4th MVP 5th MVP

[0156] In Table 2, the 1st MVP, the 2nd MVP, the 3rd MVP, the 4th MVP, and the 5th MVP indicate different candidate blocks.

[0157] In an embodiment, the at least one candidate MVR can include at least one of an MVR of 1 / 8-pixel unit, an MVR of 1 / 4-pixel unit, an MVR of 1 / 2-pixel unit, an MVR of 1-pixel unit, an MVR of 2-pixel unit, an MVR of 4-pixel unit, and an MVR of 8-pixel unit. However, the at least one candidate MVR usable is not limited to the above examples, and MVRs having various values can be included in the candidate MVRs.

[0158] In an embodiment, the at least one candidate block can be selected from blocks including spatial blocks and temporal blocks associated with the current block. The spatial blocks can include at least one block adjacent to the current block in space. The temporal blocks can include a block located at the same point as the current block in a reference image and at least one block adjacent to the block at the same position in space, wherein the POC of the reference image is different from the POC of the current block.

[0159] In an embodiment, when the at least one candidate MVR includes a 1 / 4-pixel unit MVR, a 1 / 2-pixel unit MVR, a 1-pixel unit MVR, and a 2-pixel unit MVR and the at least one candidate block includes a left block, an above block, a left-above block, and an above-left block, a mapping relationship or a corresponding relationship between (the 1 / 4-pixel unit MVR and the left block), (the 1 / 2-pixel unit MVR and the above block), (the 1-pixel unit MVR and the left-above block), and (the 2-pixel unit MVR and the above-left block) can be set in the motion vector decoding device 30. Thus, when it is checked that the 1 / 4-pixel unit MVR is the MVR of the current block, the prediction decoder 33 can correspondingly use the motion vector of the left block as the prediction motion vector of the current block. In addition, when the above block is checked as the prediction motion vector of the current block, the prediction decoder 33 can correspondingly determine the 1 / 2-pixel unit MVR as the MVR of the current block.

[0160] In an embodiment, the prediction decoder 33 can determine the number and the type of the at least one candidate MVR in a block unit, a slice unit, or a picture unit based on information about at least one of the current block, the previously decoded block, the current slice, the previously decoded slice, the current picture, and the previously decoded picture.

[0161] For example, the prediction decoder 33 can differently determine the at least one candidate MVR selectable for the current block and the at least one candidate MVR selectable for the subsequent block. For example, a 1 / 4-pixel unit MVR and a 1 / 2-pixel unit MVR can be determined as the at least one candidate MVR selectable for the current block, and a 1-pixel unit MVR and a 2-pixel unit MVR can be determined as the at least one candidate MVR selectable for the subsequent block. Alternatively, only one MVR can be included as a candidate MVR for an arbitrary block.

[0162] For example, when the at least one candidate MVR is determined in a block unit, the prediction decoder 33 can compare the size of the current block with a predetermined size, and can include only one MVR in the candidate MVR or can include a plurality of MVRs in the candidate MVR. Alternatively, when the at least one candidate MVR is determined in a block unit, the prediction decoder 33 can determine the number and the type of the candidate MVR of the current block based on the MVR of the previously decoded block.

[0163] Further, for example, when determining the selectable at least one candidate MVR in units of slices or pictures, the prediction decoder 33 can determine the number and type of candidate MVRs available for the current slice or the current picture according to the type of the slice or the picture. Further, for example, when determining the selected at least one candidate MVR in units of slices or pictures, the prediction decoder 33 can determine the number and type of candidate MVRs selectable for the current slice or the current picture according to whether the slice or the picture is referred to by another slice or picture.

[0164] In an embodiment, the prediction decoder 33 can determine the position of the at least one candidate block to be mapped to the at least one candidate MVR based on information on at least one of the current block, the previously decoded block, the current slice, the previously decoded slice, the current picture, and the previously decoded picture, in units of blocks, in units of slices, or in units of pictures.

[0165] For example, the prediction decoder 33 can determine the position of the candidate block to be mapped to the candidate MVR selectable for the current block in a 1:1 manner based on information on at least one of the current block, the previously decoded block, the current slice, the previously decoded slice, the current picture, and the previously decoded picture. For example, the prediction decoder 33 can determine the position of each candidate block to be mapped to the candidate MVR selectable for the current block according to information such as the prediction mode (intra or inter mode) of the previously decoded block, the motion vector, the MVR, the presence of a reference picture, or bi-prediction.

[0166] For example, the prediction decoder 33 can differently determine the at least one candidate block selectable for the current block and the at least one candidate block selectable for the subsequent block. For example, when determining the position of the candidate block in units of blocks, the above block and the left block can be mapped to the 1-pixel unit MVR and the 2-pixel unit MVR corresponding to the candidate MVR of the current block, respectively, and the left upper block and the left lower block can be mapped to the 1-pixel unit MVR and the 2-pixel unit MVR corresponding to the candidate MVR of the subsequent block, respectively.

[0167] In an embodiment, an index can be assigned to each candidate MVR selectable for the current block in a unary manner, and the prediction decoder 33 can select the MVR of the current block according to the index indicating the MVR of the current block obtained by the obtainer 31. For example, when the available candidate MVRs include 1 / 4-pixel unit MVR, 1 / 2-pixel unit MVR, 1-pixel unit MVR, 2-pixel unit MVR, 4-pixel unit MVR, and 8-pixel unit MVR, the indexes 0, 10, 110, 1110, 11110, and 11111 can be assigned to the 1 / 4-pixel unit MVR, the 1 / 2-pixel unit MVR, the 1-pixel unit MVR, the 2-pixel unit MVR, the 4-pixel unit MVR, and the 8-pixel unit MVR, respectively.

[0168] In an embodiment, the index can be assigned to each candidate block mapped to at least one candidate MVR in a unary manner, and the prediction decoder 33 can select a candidate block used as a prediction motion vector of the current block according to the candidate block index obtained by the obtainer 31. For example, when the at least one candidate block includes a left block, an above block, a left-above block, a left-below block, an above-left block, and an above-right block, indexes 0, 10, 110, 1110, 11110, and 11111 can be assigned to the left block, the above block, the left-above block, the left-below block, the above-left block, and the above-right block, respectively.

[0169] In an embodiment, when there is one candidate MVR available for the current block, the obtainer 31 can skip or omit an operation of obtaining information indicating a candidate block and an MVR of the current block used for a prediction motion vector of the current block. When the operation of obtaining the information is skipped, this can mean that the information is not obtained from the bitstream.

[0170] In an embodiment, when there are two or more candidate MVRs available for the current block, the obtainer 31 can obtain a flag or an index indicating at least one of information indicating an MVR of the current block and information indicating a candidate block used for determining a prediction motion vector of the current block.

[0171] The prediction decoder 33 according to an embodiment can directly use a motion vector of a candidate block as a prediction motion vector of the current block, or can change the motion vector of the candidate block and can use the changed motion vector as the prediction motion vector of the current block.

[0172] In an embodiment, when there is no motion vector in a candidate block mapped to an MVR of the current block, the prediction decoder 33 can map a block having a motion vector other than the candidate blocks mapped to the candidate MVRs, respectively, to the MVR of the current block. The prediction decoder 33 can use a motion vector of the newly mapped block as a prediction motion vector of the current block. When a particular block is intra-predicted, the block can be determined as a block not including a motion vector.

[0173] For example, when it is assumed that at least one candidate MVR available for the current block includes an MVR of 1 / 4-pixel unit mapped to a left block, an MVR of 1 / 2-pixel unit mapped to an above block, and an MVR of 1-pixel unit mapped to an above-right block, and there is no motion vector in the above-right block, the prediction decoder 33 can map the MVR of 1-pixel unit to a block other than the at least one candidate block, for example, an above-left block.

[0174] In an embodiment, when there is no motion vector in a candidate block mapped to an MVR of the current block, a position and a priority of another block to be newly used can be determined in advance.

[0175] Further, in an embodiment, when there is no motion vector in the candidate block mapped to the MVR of the current block, the prediction decoder 33 can use an arbitrary motion vector (e.g., a zero vector) as the prediction motion vector of the current block.

[0176] Further, in an embodiment, when there is no motion vector in the candidate block mapped to the MVR of the current block, the prediction decoder 33 can derive the motion vector of the candidate block corresponding to the current block by using the motion vector of another candidate block.

[0177] Further, in an embodiment, when there are candidate blocks having the same motion vector in the at least one candidate block mapped to the at least one candidate MVR available for the current block, the prediction decoder 33 can replace some of the candidate blocks having the same motion vector with blocks other than the at least one candidate block mapped to each candidate MVR. For example, when the motion vector of the left block mapped to the 1 / 4-pel unit MVR and the motion vector of the above block mapped to the 1 / 2-pel unit MVR are the same, the prediction decoder 33 can replace one of the left block and the above block (e.g., the above block) with another block (e.g., the above left block), and can map the replaced block to the candidate MVR (e.g., 1 / 2-pel resolution).

[0178] When there are a plurality of candidate blocks having the same motion vector, a priority indicating which block of the plurality of candidate blocks is to be replaced with another block, and a type and priority of the block to be newly mapped can be determined in advance.

[0179] In an embodiment, when there are candidate blocks having the same motion vector in the at least one candidate block mapped to the at least one candidate MVR available for the current block, the prediction decoder 33 can assign an arbitrary motion vector (e.g., a zero vector) to some of the candidate blocks having the same motion vector. In this case, a priority of the candidate block to which the arbitrary motion vector is to be assigned can be determined in advance.

[0180] In an embodiment, when there are candidate blocks having the same motion vector in the at least one candidate block mapped to the at least one candidate MVR available for the current block, the prediction decoder 33 can derive the motion vector of any of the candidate blocks having the same motion vector by using the motion vector of another candidate block.

[0181] In an embodiment, whether the motion vectors of two or more candidate blocks are the same can be determined by adjusting the motion vectors of the candidate blocks and then comparing the adjusted motion vectors, as described below.

[0182] Further, in an embodiment, the prediction decoder 33 can receive the related information from the bitstream without directly determining whether there is a candidate block having the same motion vector in the at least one candidate block. In an embodiment, the obtainer 31 can obtain information indicating that a candidate block is replaced from the bitstream, and the prediction decoder 33 can use a motion vector of the replaced block as a prediction motion vector. When the information indicating that a candidate block is replaced is obtained, the type and priority of a block to be used as a prediction motion vector of the current block according to the MVR of the current block can be determined in advance.

[0183] In an embodiment, the prediction decoder 33 can scale the residual motion vector obtained by the obtainer 31 based on a difference between the MVR of the current block and a minimum MVR among the at least one candidate MVR. For example, when the MVR of the current block is higher than the minimum MVR, the prediction decoder 33 can scale the residual motion vector.

[0184] Further, in an embodiment, the prediction decoder 33 can selectively adjust a motion vector of a candidate block mapped to the MVR of the current block.

[0185] The prediction decoder 33 can obtain a motion vector of the current block by using the adjusted motion vector of the selected candidate block and the selectively scaled residual motion vector.

[0186] The operations of scaling the residual motion vector and adjusting the motion vector of the candidate block will be described in detail.

[0187] The prediction decoder 33 can search for a prediction block in a reference image by using the motion vector of the current block, and can reconstruct the current block by adding the residual data that has been dequantized and inverse-transformed to the prediction block.

[0188] In an embodiment, when the MVR of the current block is equal to or greater than 1 pixel unit, the prediction decoder 33 can search for a prediction block in a reference image that is not interpolated, and when the MVR of the current block is less than 1 pixel unit, the prediction decoder 33 can search for a prediction block in a reference image that is interpolated.

[0189] Figure 4 is a flowchart for describing a motion vector decoding method according to an embodiment.

[0190] In operation S41, the motion vector decoding apparatus 30 determines an MVR of a current block and a candidate block for determining a prediction motion vector of the current block. The MVR of the current block determined by the motion vector decoding apparatus 30 can correspond to one of at least one candidate MVR selectable for the current block, and the candidate block for the prediction motion vector of the current block can correspond to one of at least one candidate block mapped to each of the at least one candidate MVR.

[0191] The motion vector decoding apparatus 30 can obtain at least one of information indicating the MVR of the current block and information indicating the candidate block and the residual motion vector from the bitstream.

[0192] When the information indicating the MVR of the current block is obtained from the bitstream, the motion vector decoding apparatus 30 can determine the candidate block to be used as the predicted motion vector based on the obtained information, and when the information indicating the candidate block is obtained from the bitstream, the motion vector decoding apparatus 30 can determine the MVR of the current block based on the obtained information.

[0193] In operation S42, the motion vector decoding apparatus 30 obtains the motion vector of the current block by using the motion vector of the candidate block and the residual motion vector.

[0194] In an embodiment, the motion vector decoding apparatus 30 can selectively adjust the motion vector of the candidate block according to a difference between the MVR of the current block and a minimum MVR, and can selectively amplify the residual motion vector according to a difference between the minimum MVR and the MVR of the current block.

[0195] Figure 5 is a diagram for describing at least one candidate block mapped to at least one candidate MVR in a 1:1 manner.

[0196] At least one candidate block selected from spatial blocks and temporal blocks associated with the current block 50 can be mapped to each candidate MVR.

[0197] For example, the spatial blocks can include a left-top block a, a right-top block b, a top-left block c, a top-right block d, a left-top outer block e, a right-top outer block f, a left-bottom outer block g, a right-bottom outer block h, a left-bottom block i, a right-bottom block j, a left block k, a right block l, and a top block m adjacent to the current block 50. The temporal blocks can include a block n at the same position as the current block 50 in a reference image having a POC different from that of the current block 50 and a block o adjacent to the block n at the same position.

[0198] The at least one candidate block selected from the spatial blocks and the temporal blocks can be mapped to each candidate MVR, and as shown in Figure 6 a 1 / 8-pixel unit MVR can be mapped to the left block k, a 1 / 4-pixel unit MVR can be mapped to the top block m, a 1 / 2-pixel unit MVR can be mapped to the left-top block a, a 1-pixel unit MVR can be mapped to the top-left block c, and a 2-pixel unit MVR can be mapped to the left-bottom block i. The mapping relationship shown can be an example, and various mapping relationships can be set.

[0199] According to Figure 6In an embodiment of the motion vector encoding apparatus 10, when the MVR of the current block is determined to be 1 / 8-pixel unit, the motion vector encoding apparatus 10 uses the motion vector of the left block as the predicted motion vector of the current block. In addition, when the motion vector of the upper block is used as the predicted motion vector of the current block, the motion vector encoding apparatus 10 can determine the MVR of the current block to be 1 / 4-pixel unit.

[0200] In addition, when it is checked that the MVR of the current block is 1 / 8-pixel unit, the motion vector decoding apparatus 30 uses the motion vector of the left block as the predicted motion vector of the current block. In addition, when it is checked that the motion vector of the upper block is used as the predicted motion vector of the current block, the motion vector decoding apparatus 30 can determine the MVR of the current block to be 1 / 4-pixel unit.

[0201] In an embodiment, when the motion vectors of the blocks in a predetermined number of pictures are determined by using the MVR of an arbitrary pixel unit, the positions of the candidate blocks to be mapped to at least one candidate MVR can be determined in the order selected as the predicted motion vector. For example, when the number of available candidate MVRs is 5, each of 5 blocks frequently selected as the predicted motion vector among the blocks including the spatial blocks and the temporal blocks can be mapped to each candidate MVR.

[0202] In an embodiment, when the candidate MVRs and the candidate blocks are mapped in a 1:1 manner, the candidate MVRs can be arranged in ascending order according to the size of the pixel unit, the candidate blocks can be arranged in descending order according to the number of times selected as the predicted motion vector, and then the candidate blocks and the candidate MVRs having mutually corresponding orders are mapped.

[0203] As described above, the type and the number of the candidate MVRs selectable for the current block can vary according to information about at least one of the current block, the previously decoded block, the current slice, the previously decoded slice, the current picture, and the previously decoded picture.

[0204] In addition, the positions of the candidate blocks respectively mapped to the candidate MVRs selectable for the current block can vary according to information about at least one of the current block, the previously decoded block, the current slice, the previously decoded slice, the current picture, and the previously decoded picture.

[0205] The type and the number of the candidate MVRs selectable for the current block and the positions of the candidate blocks respectively mapped to the candidate MVRs selectable for the current block can be determined by the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 by using the same criteria, and thus, although the motion vector encoding apparatus 10 encodes the index indicating the MVR of the current block or the index indicating the candidate block for the current block and transmits the encoded index to the motion vector decoding apparatus 30, the motion vector decoding apparatus 30 can determine the MVR or the candidate block corresponding to each index.

[0206] Figure 7 is a diagram for describing interpolation for determining a motion vector according to various MVRs.

[0207] The motion vector encoding apparatus 10 can determine a motion vector of a current block according to at least one candidate MVR to inter-predict the current block. The available candidate MVRs can include 2 k pixel units (k is an integer). When k is greater than 0, the motion vector can indicate only integer pixels in the interpolated reference picture, and when k is less than 0, the motion vector can indicate sub-pixels and integer pixels.

[0208] For example, when the minimum MVR has a 1 / 4 pixel unit, the motion vector encoding apparatus 10 can interpolate a reference picture to generate a 1 / 4 pixel unit sub-pixel, and can determine a motion vector such that the motion vector indicates a pixel corresponding to each candidate MVR (e.g., a 1 / 4 pixel unit MVR, a 1 / 2 pixel unit MVR, a 1 pixel unit MVR, or a 2 pixel unit MVR).

[0209] For example, the motion vector encoding apparatus 10 can interpolate a reference picture to generate 1 / 2 pixel unit sub-pixels (a to l) by using an n-tap finite impulse response (FIR) filter. In checking a vertical 1 / 2 sub-pixel, the motion vector encoding apparatus 10 can generate a sub-pixel "a" by interpolating using A1, A2, A3, A4, A5, and A6 of integer pixel units, and can generate a sub-pixel "b" by interpolating using B1, B2, B3, B4, B5, and B6 of integer pixel units. Sub-pixels "c", "d", "e", and "f" can be generated by using the same method.

[0210] Pixel values of the vertical sub-pixels can be calculated as follows. For example, pixel values of the sub-pixels "a" and "b" can be calculated as a = (A1 - 5xA2 + 20xA3 + 20xA4 - 5xA5 + A6) / 32 and b = (B1 - 5xB2 + 20xB3 + 20xB4 - 5xB5 + B6) / 32. Pixel values of the sub-pixels "c", "d", "e", and "f" can be calculated by using the same method.

[0211] Similar to the vertical sub-pixels, the motion vector encoding apparatus 10 can generate horizontal sub-pixels by interpolating using a 6-tap FIR filter. A sub-pixel "g" can be generated by using A1, B1, C1, D1, E1, and F1, and a sub-pixel "h" can be generated by using A2, B2, C2, D2, E2, and F2.

[0212] The pixel value of the horizontal sub-pixel is calculated by using the same method as that used for calculating the pixel value of the vertical sub-pixel. For example, the pixel value of the sub-pixel "g" can be calculated as g = (A1-5xB1+20xC1+20xD1-5xE1+F1) / 32.

[0213] The sub-pixel "m" in the diagonal direction of the 1 / 2 pixel unit can be interpolated by using another sub-pixel of the 1 / 2 pixel unit. In other words, the pixel value of the sub-pixel "m" can be calculated as m = (a-5xb+20xc+20xd-5xe+f) / 32.

[0214] When the sub-pixel of the 1 / 2 pixel unit is generated, the motion vector encoding apparatus 10 can generate a sub-pixel of the 1 / 4 pixel unit by using the sub-pixel of the 1 / 2 pixel unit and the integer pixel. The motion vector encoding apparatus 10 can generate the sub-pixel of the 1 / 4 pixel unit by performing interpolation using two adjacent pixels. Alternatively, the sub-pixel of the 1 / 4 pixel unit can be generated by directly applying an interpolation filter to the pixel value of the integer pixel without using the pixel value of the sub-pixel of the 1 / 2 pixel unit.

[0215] Although the interpolation filter is, for example, a 6-tap filter in the above, the motion vector encoding apparatus 10 can interpolate the picture by using a filter having another number of taps. Examples of the interpolation filter can include a 4-tap filter, a 7-tap filter, an 8-tap filter, and a 12-tap filter.

[0216] Figure 8 (a), (b), (c), and (d) of FIG. 1 show 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 available MVR is 1 / 4 pixel unit MVR.

[0217] Figure 8 (a), (b), (c), and (d) of FIG. 1 show 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 available MVR is 1 / 4 pixel unit MVR.

[0218] When the minimum MVR is 1 / 4-pel unit MVR, the coordinates of a pixel that can be indicated by a motion vector of 1 / 4-pel unit MVR become (a / 4, b / 4) (a and b are integers), the coordinates of a pixel that can be indicated by a motion vector of 1 / 2-pel unit MVR become (2c / 4, 2d / 4) (c and d are integers), the coordinates of a pixel that can be indicated by a motion vector of 1-pel unit MVR become (4e / 4, 4f / 4) (e and f are integers), and the coordinates of a pixel that can be indicated by a motion vector of 2-pel unit MVR 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 a pixel that can be indicated by a motion vector of 2 n (n is an integer) pixel unit MVR become (2 n-m× i / 2 -m , 2 n-m× j / 2 -m ) (i and j are integers). Although the motion vector is determined according to a certain MVR, the motion vector is expressed by coordinates in an image that is interpolated according to 1 / 4-pel unit.

[0219] In an embodiment, because the motion vector encoding apparatus 10 determines a motion vector in an image that is interpolated according to the minimum MVR to express the motion vector (and a predicted motion vector) by using an integer, the motion vector in integer units can be expressed by multiplying the motion vector (and the predicted motion vector) by the reciprocal of the pixel unit value of the minimum MVR (for example, 2 m (m is an integer) when the minimum MVR has 2 -m ). The motion vector in integer units multiplied by 2 -m may be used in the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30.

[0220] When a motion vector of 1 / 2-pel unit MVR starting from coordinates (0, 0) indicates coordinates (2 / 4, 6 / 4) and the minimum MVR has 1 / 4-pel unit, the motion vector encoding apparatus 10 can determine (2, 6) obtained by multiplying the motion vector by an integer 4 as the motion vector.

[0221] When the size of the MVR is less than 1-pel unit, in order to perform motion prediction in sub-pel units, the motion vector encoding apparatus 10 according to an embodiment can search for a block similar to the current block in a reference image based on sub-pel units according to a motion vector determined in integer-pel units.

[0222] For example, when the MVR of the current block is a 1 / 4-pel unit MVR, the motion vector encoding apparatus 10 can determine a motion vector in integer-pel units, interpolate a reference picture to generate sub-pixels in 1 / 2-pel units, and then search for a most similar prediction block in a range of (-1~1, -1~1) based on the motion vector determined in integer-pel units. Next, the motion vector encoding apparatus 10 can interpolate the reference picture again to generate sub-pixels in 1 / 4-pel units, and then search for a most similar prediction block in a range of (-1~1, -1~1) based on the motion vector determined in 1 / 2-pel units, thereby determining a final motion vector of the 1 / 4-pel unit MVR.

[0223] For example, when the motion vector in integer-pel units based on the coordinates (0, 0) is (-4, -3), the motion vector of the 1 / 2-pel unit MVR becomes (-8, -6) (= (-4×2, -3×2)), and when the motion vector is moved by (0, -1), the motion vector of the 1 / 2-pel unit MVR is finally determined as (-8, -7) (= (-8, -6-1)). When the motion vector of the 1 / 4-pel unit MVR becomes (-16, -14) (= (-8×2, -7×2)), and when the motion vector is moved again by (-1, 0), the final motion vector of the 1 / 4-pel unit MVR can be determined as (-17, -14) (= (-16-1, -14)).

[0224] When the MVR of the current block is higher than the 1-pel unit MVR, in order to perform motion prediction in large-pel units, the motion vector encoding apparatus 10 according to an embodiment can search for a block similar to the current block in a reference picture based on a pixel unit larger than 1 pixel unit from the motion vector determined in integer-pel units. A pixel in which a pixel unit larger than 1 pixel unit (e.g., 2-pel units, 3-pel units, or 4-pel units) is located can be referred to as a super-pixel.

[0225] A prediction motion vector adjustment method selectively performed by the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 according to an embodiment will be described with reference to Figure 9a and Figure 9b A prediction motion vector adjustment method selectively performed by the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 according to an embodiment will be described with reference to

[0226] When the MVR of the current block is higher than the minimum MVR among the selectable candidate MVRs, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can adjust the motion vector of a candidate block used as a prediction motion vector of the current block.

[0227] In order to adjust the prediction motion vector represented by the coordinates in the picture interpolated according to the minimum MVR to the MVR of the current block, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can adjust the prediction motion vector to indicate a neighboring pixel instead of a pixel indicated by the prediction motion vector.

[0228] For example, in order to adjust the prediction motion vector A indicating the pixel 71 of the coordinates (19, 27) based on the coordinates (0, 0) to a 1-pixel unit MVR as the MVR of the current block, the coordinates (19, 27) of the pixel 71 indicated by the prediction motion vector A can be divided by the integer 4 (i.e., the prediction motion vector A can be scaled down), and the coordinates (19 / 4, 27 / 4) obtained as a result of the division can not indicate integer pixel units. Figure 9a The motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can adjust the scaled-down prediction motion vector to indicate an integer pixel unit. For example, the coordinates of the 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, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can adjust the scaled-down prediction motion vector A to indicate the coordinates (20 / 4, 28 / 4) located at the upper right rather than the coordinates (19 / 4, 27 / 4), and can multiply by the integer 4 (i.e., scale up) so that the finally adjusted prediction motion vector D indicates the pixel 74 corresponding to the coordinates (20, 28).

[0229] Referring to FIG. 7,

[0230] , the prediction motion vector A before adjustment can indicate the pixel 71, and the finally adjusted prediction motion vector D can indicate the pixel 74 located at the upper right of the pixel 71 by an integer unit. Figure 9a

[0231] When adjusting the prediction motion vector according to the MVR of the current block, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 according to an embodiment can cause the adjusted prediction motion vector to indicate a pixel located at the upper right of a pixel indicated by the prediction motion vector before adjustment. The motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 according to another embodiment can cause the adjusted prediction motion vector to indicate a pixel located at the upper left of a pixel indicated by the prediction motion vector before adjustment, a pixel located at the lower left of a pixel indicated by the prediction motion vector before adjustment, or a pixel located at the lower right of a pixel indicated by the prediction motion vector before adjustment.

[0232] ​In an embodiment, when any one of the x-coordinate value and the y-coordinate value indicated by the scaled-down prediction motion vector indicates an integer pixel, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can increase or decrease only the coordinate value not indicating the integer pixel to indicate the integer pixel. That is, when the x-coordinate value indicated by the scaled-down prediction motion vector indicates an integer pixel, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can make the adjusted prediction motion vector indicate an integer pixel located at the top or the bottom of the pixel indicated by the prediction motion vector before the adjustment. Alternatively, when the y-coordinate value indicated by the scaled-down prediction motion vector indicates an integer pixel, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can make the adjusted prediction motion vector indicate an integer pixel located at the left or the right of the pixel indicated by the prediction motion vector before the adjustment.

[0233] When the prediction motion vector is adjusted, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can differently select a point indicated by the adjusted prediction motion vector according to the MVR of the current block.

[0234] For example, referring to Figure 9b When the MVR of the current block is the 1 / 2-pel unit MVR, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can make the adjusted prediction motion vector indicate the pixel 83 at the upper left of the pixel 81 indicated by the prediction motion vector before the adjustment; when the MVR of the current block is the 1-pel unit MVR, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can make the adjusted prediction motion vector indicate the pixel 82 at the upper right of the pixel 81 indicated by the prediction motion vector before the adjustment; and when the MVR of the current block is the 2-pel unit MVR, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can make the adjusted prediction motion vector indicate the pixel 84 at the lower right of the pixel 81 indicated by the prediction motion vector before the adjustment.

[0235] The motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can determine which pixel will be indicated by the adjusted prediction motion vector based on at least one of the MVR of the current block, the prediction motion vector, information of the neighboring block, the encoding information, and any mode.

[0236] When adjusting the motion vector of the candidate block in consideration of the MVR of the current block and the minimum MVR, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can adjust the motion vector of the candidate block according to Equation 1.

[0237] [Equation 1]

[0238] pMV' = ((pMV » k) + offset) « k

[0239] In Equation 1, when pMV' denotes an adjusted predicted motion vector, and the MVR of the current block is 2 m pixel unit (m is an integer), the minimum MVR is 2 n pixel unit (n is an integer), and m > n, k, which is a value determined depending on a difference between the MVR of the current block and the minimum MVR, can be m - n.

[0240] In an embodiment, k can be an index of the MVR, and when the candidate MVR includes a 1 / 4-pixel unit MVR, a 1 / 2-pixel unit MVR, a 1-pixel unit MVR, a 2-pixel unit MVR, and a 4-pixel unit MVR, the MVR corresponding to the index is as shown in Table 1. When the MVR index is received from the bitstream, the motion vector decoding apparatus 30 can adjust the motion vector of the candidate block according to Equation 1 by using the MVR index as k.

[0241] Further, in Equation 1, >> or <<, which is a shift operation, means an operation of reducing or increasing the size of the predicted motion vector. Further, offset denotes a value added or subtracted to indicate an integer pixel when the pMV reduced depending on the k value does not indicate an integer pixel. The offset can be differently determined depending on each of the x-coordinate value and the y-coordinate value of the base pMV.

[0242] In an embodiment, when the reduced pMV is changed to indicate an integer pixel, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can change the reduced pMV according to the same criterion.

[0243] In an embodiment, when the x-coordinate value and the y-coordinate value of the reduced pMV do not indicate an integer pixel, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can always increase or decrease the x-coordinate value and the y-coordinate value of the reduced pMV to indicate an integer pixel. Alternatively, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can round the x-coordinate value and the y-coordinate value of the reduced pMV to indicate an integer pixel.

[0244] In an embodiment, when the motion vector of the candidate block is adjusted, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can omit the reduction and enlargement of the motion vector, and can adjust the motion vector under the coordinate plane in the reference image interpolated according to the minimum MVR to indicate a pixel unit corresponding to the MVR of the current block.

[0245] Further, in an embodiment, when the motion vector of the candidate block is adjusted considering the MVR of the current block and the minimum MVR, the motion vector encoding apparatus 10 and the motion vector decoding apparatus 30 can adjust the motion vector according to Equation 2 instead of Equation 1.

[0246] [Equation 2]

[0247] pMV' = ((pMV + offset) » k) « k

[0248] Although Equation 2 is similar to Equation 1, unlike Equation 1 in which offset is applied to the reduced pMV, offset is applied to the original pMV and then reduced according to k.

[0249] The motion vector encoding apparatus 10 finds the motion vector of the current block by using the MVR of the current block, and obtains a difference between the motion vector of the current block and the selectively adjusted predicted motion vector as a residual motion vector.

[0250] The motion vector encoding apparatus 10 can determine and encode the residual motion vector as shown in Equation 3. In Equation 3, MV denotes the motion vector of the current block, pMV' denotes the adjusted predicted motion vector, and MVD denotes the residual motion vector.

[0251] [Equation 3]

[0252] MVD = MV - pMV'

[0253] When the MVR of the current block is higher than the minimum MVR, the motion vector encoding apparatus 10 can reduce the residual motion vector as shown in Equation 4, and can generate a bitstream including information indicating the reduced residual motion vector.

[0254] [Equation 4]

[0255] MVD' = (MVD » k)

[0256] In Equation 4, MVD' denotes the reduced residual motion vector, and k, which is a value determined according to a difference between the minimum MVR and the MVR of the current block, is the same as k of Equation 1.

[0257] In an embodiment, the motion vector encoding apparatus 10 can reduce the motion vector of the current block and the predicted motion vector (or the adjusted predicted motion vector) according to the k value, and then can encode a difference between the two values as the residual motion vector.

[0258] In an embodiment, the motion vector encoding apparatus 10 can calculate the reduced residual motion vector according to Equation 5 instead of Equation 3 and Equation 4.

[0259] [Equation 5]

[0260] MVD' = (MV - pMV') / (R x S)

[0261] In Equation 5, MVD' denotes a scaled-down residual motion vector, MV denotes a motion vector of the current block, and pMV' denotes an adjusted predicted motion vector. Also, R denotes a 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). Also, S denotes an inverse of a pixel unit value of the minimum MVR (e.g., 4 when the minimum MVR is a 1 / 4 pixel unit).

[0262] The motion vector decoding apparatus 30 can reconstruct the motion vector of the current block by using at least one of information indicating a candidate block and information indicating the MVR of the current block obtained from the bitstream, and a residual motion vector.

[0263] The motion vector decoding apparatus 30 can scale down the predicted motion vector as shown in Equation 1 or Equation 2 when the MVR of the current block is higher than the minimum MVR.

[0264] The motion vector decoding apparatus 30 can scale up the residual motion data as shown in Equation 6 when the MVR of the current block is higher than the minimum MVR.

[0265] [Equation 6]

[0266] MVD" = (MVD' << k)

[0267] In Equation 6, MVD' denotes a scaled-down residual motion vector, and MVD" indicates a scaled-up residual motion vector. k, which is a value determined according to a difference between the minimum MVR and the MVR of the current block, is the same as k of Equation 1.

[0268] The motion vector decoding apparatus 30 can decode the motion vector of the current block by adding the predicted motion vector selectively scaled according to a size difference between the minimum MVR and the MVR of the current block to the residual motion vector selectively scaled up.

[0269] In an embodiment, the motion vector decoding apparatus 30 can determine the scaled-up residual motion vector according to Equation 7 instead of Equation 6.

[0270] [Equation 7]

[0271] MVD" = MVD' x (R x S)

[0272] In Equation 7, MVD' denotes a scaled-down residual motion vector, and R denotes a 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). Also, S denotes an inverse of a pixel unit value of the minimum MVR (e.g., 4 when the minimum MVR is a 1 / 4 pixel unit).

[0273] In an embodiment, when the MVR of the current block is less than 1 pel unit MVR, the motion vector decoding apparatus 30 can interpolate a reference picture according to the minimum MVR, and then can search for a prediction block according to the motion vector of the current block. Also, when the MVR of the current block is equal to or higher than 1 pel unit MVR, the motion vector decoding apparatus 30 can search for a prediction block according to the motion vector of the current block without interpolating a reference picture.

[0274] A video encoding method and apparatus and a video decoding method and apparatus based on a coding unit and a transform unit having a tree structure according to an embodiment will be described with reference to the accompanying drawings. Figures 11 to 33 A video encoding method and apparatus and a video decoding method and apparatus based on a coding unit and a transform unit having a tree structure according to an embodiment will be described with reference to the accompanying drawings.

[0275] Figure 11 is a block diagram of a video decoding apparatus 100 for decoding an image based on at least one piece of information among block shape information and partition shape information according to an embodiment.

[0276] Referring to Figure 11 , according to an embodiment, the video decoding apparatus 100 can include a bitstream obtainer 110 for obtaining predetermined information such as partition shape information or block shape information from a bitstream, and a decoder 120 for decoding an image by using the obtained information. According to an embodiment, when the bitstream obtainer 110 of the video decoding apparatus 100 obtains at least one piece of information among block shape information and partition shape information, the decoder 120 of the video decoding apparatus 100 can determine at least one coding unit for partitioning an image based on the at least one piece of information among the block shape information and the partition shape information.

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

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

[0279] According to an embodiment, the decoder 120 can determine whether the coding unit is divided according to the division shape information. The division shape information can include information about at least one coding unit included in the coding unit, and when the division shape information indicates that only one coding unit is included in the coding unit or is not divided, the decoder 120 can determine that the coding unit including the division shape information is not divided. When the division shape information indicates that the coding unit is divided into a plurality of coding units, the decoder 120 can divide the coding unit into the plurality of coding units included in the coding unit based on the division shape information.

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

[0281] Figure 13 The video decoding apparatus 100 according to an embodiment is illustrated to determine at least one coding unit by dividing a current coding unit.

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

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

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

[0285] According to an embodiment, the video decoding apparatus 100 can determine a shape of a coding unit by using the block shape information, and can determine a shape into which the coding unit is divided by using the information on the division shape mode. That is, the coding unit division method indicated by the information on the division shape mode can be determined according to the block shape indicated by the block shape information used by the video decoding apparatus 100.

[0286] The video decoding apparatus 100 can obtain the information on the division shape mode from a bitstream. However, the present disclosure is not limited thereto, and the video decoding apparatus 100 and the video encoding apparatus 200 can obtain the information on the division shape mode pre-agreed based on the block shape information. The video decoding apparatus 100 can obtain the information on the division shape mode pre-agreed for a maximum coding unit or a minimum coding unit. For example, the video decoding apparatus 100 can determine the size of the maximum coding unit as 256x256. The video decoding apparatus 100 can determine the information on the division shape mode pre-agreed by using a four division. The four division is a division shape mode in which the width and the height of a coding unit are halved. The video decoding apparatus 100 can obtain a coding unit having a size of 128x128 from the maximum coding unit having a size of 256x256 based on the information on the division shape mode. Further, the video decoding apparatus 100 can determine the size of the minimum coding unit as 4x4. The video decoding apparatus 100 can obtain the information on the division shape mode indicating "no division is performed" for the minimum coding unit.

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

[0288] Referring to Figure 13According to embodiments, the video decoding apparatus 100 can determine two coding units 310b obtained by performing vertical partitioning on the current coding unit 300 based on the information on the partitioning shape mode indicating that the partitioning is performed vertically. The video decoding apparatus 100 can determine two coding units 310c obtained by performing horizontal partitioning on the current coding unit 300 based on the information on the partitioning shape mode indicating that the partitioning is performed horizontally. The video decoding apparatus 100 can determine four coding units 310d obtained by performing vertical and horizontal partitioning on the current coding unit 300 based on the information on the partitioning shape mode indicating that the partitioning is performed vertically and horizontally. However, the partitioning method of the square coding unit is not limited to the above-described methods, and the information on the partitioning shape mode can indicate various methods. The predetermined partitioning methods of partitioning the square coding unit will be described in detail below in connection with various embodiments.

[0289] Figure 14 A process of determining at least one coding unit by partitioning a non-square coding unit performed by the video decoding apparatus 100 according to embodiments is shown.

[0290] According to embodiments, the video decoding apparatus 100 can use the block shape information indicating that the current coding unit has a non-square shape. The video decoding apparatus 100 can determine whether to not partition the non-square current coding unit or to partition the non-square current coding unit by using a predetermined partitioning method based on the information on the partitioning shape mode. Referring to Figure 14 When the block shape information of the current coding unit 400 or 450 indicates a non-square shape, the video decoding apparatus 100 can determine that the coding unit 410 or 460 having the same size as the current coding unit 400 or 450 is not partitioned based on the information on the partitioning shape mode indicating that the partitioning is not performed, or determine the coding units 420a and 420b, the coding units 430a to 430c, the coding units 470a and 470b, or the coding units 480a to 480c partitioned based on the information on the partitioning shape mode indicating the predetermined partitioning method. The predetermined partitioning methods of partitioning the non-square coding unit will be described in detail below in connection with various embodiments.

[0291] According to embodiments, the video decoding apparatus 100 can determine the partitioning method of the coding unit by using the information on the partitioning shape mode, and in this case, the partitioning shape information can indicate the number of one or more coding units generated by partitioning the coding unit. Referring to Figure 14When the information on the division shape mode indicates that the current coding unit 400 or 450 is divided into two coding units, the video decoding apparatus 100 can determine two coding units 420a and 420b included in the current coding unit 400 or 450, or coding units 470a and 470b, by dividing the current coding unit 400 or 450 based on the information on the division shape mode.

[0292] According to an embodiment, when the video decoding apparatus 100 divides the non-square current coding unit 400 or 450 based on the information on the division shape mode, the position of the long side of the non-square current coding unit 400 or 450 can be considered. For example, the video decoding apparatus 100 can determine a plurality of coding units by dividing the long side of the current coding unit 400 or 450 by considering the shape of the current coding unit 400 or 450.

[0293] According to an embodiment, when the information on the division shape mode indicates that the coding unit is divided into an odd number of blocks, the video decoding apparatus 100 can determine an odd number of coding units included in the current coding unit 400 or 450. For example, when the information on the division shape mode indicates that the current coding unit 400 or 450 is divided into three coding units, the video decoding apparatus 100 can divide the current coding unit 400 or 450 into three coding units 430a, 430b, and 430c, or coding units 480a, 480b, and 480c.

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

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

[0296] According to an embodiment, when the information on the partition shape mode indicates that the coding unit is partitioned into an odd number of blocks, the video decoding device 100 can determine the odd number of coding units included in the current coding unit 400 or 450, and can set a predetermined restriction on at least one coding unit among the odd number of coding units generated by partitioning the current coding unit 400 or 450. Referring to Figure 14 , the video decoding device 100 can make the decoding method of the coding unit 430b or 480b different from that of the other coding units 430a and 430c or the coding units 480a and 480c, wherein the coding unit 430b or 480b is located at a center position among the three coding units 430a, 430b, and 430c or the coding units 480a, 480b, and 480c generated by partitioning the current coding unit 400 or 450. For example, unlike the other coding units 430a and 430c or the coding units 480a and 480c, the video decoding device 100 can limit the coding unit 430b or 480b at the center position not to be partitioned any more or to be partitioned only a predetermined number of times.

[0297] Figure 15 A process of partitioning a coding unit based on at least one of block shape information and partition shape information, performed by the video decoding device 100 according to an embodiment, is illustrated.

[0298] According to an embodiment, the video decoding apparatus 100 can determine whether to divide the determined second coding unit 510 into a plurality of coding units based on at least one of the block shape information and the information on the division shape mode. Referring to FIG. 5, the video decoding apparatus 100 can determine whether to divide the determined second coding unit 510 into a plurality of coding units based on at least one of the block shape information and the information on the division shape mode. According to an embodiment, the video decoding apparatus 100 can determine the second coding unit 510 by dividing the first coding unit 500 along a horizontal direction when the information on the division shape mode indicates that the first coding unit 500 is divided along the horizontal direction. According to an embodiment, the first coding unit, the second coding unit, and the third coding unit used above are terms for understanding the relationship before and after the coding units are divided. For example, the second coding unit can be determined by dividing the first coding unit, and the third coding unit can be determined by dividing the second coding unit. It will be understood that the relationship between the first coding unit, the second coding unit, and the third coding unit follows the above description.

[0299] According to an embodiment, the video decoding apparatus 100 can determine whether to divide the determined second coding unit 510 into a plurality of coding units based on at least one of the block shape information and the information on the division shape mode. Referring to FIG. 5, the video decoding apparatus 100 can determine whether to divide the determined second coding unit 510 into a plurality of coding units based on at least one of the block shape information and the information on the division shape mode. According to an embodiment, the video decoding apparatus 100 can determine the second coding unit 510 by dividing the first coding unit 500 along a horizontal direction when the information on the division shape mode indicates that the first coding unit 500 is divided along the horizontal direction. According to an embodiment, the first coding unit, the second coding unit, and the third coding unit used above are terms for understanding the relationship before and after the coding units are divided. For example, the second coding unit can be determined by dividing the first coding unit, and the third coding unit can be determined by dividing the second coding unit. It will be understood that the relationship between the first coding unit, the second coding unit, and the third coding unit follows the above description. Figure 15 According to an embodiment, the video decoding apparatus 100 can determine whether to divide the determined second coding unit 510 into a plurality of coding units based on at least one of the block shape information and the information on the division shape mode. Referring to FIG. 5, the video decoding apparatus 100 can determine whether to divide the determined second coding unit 510 into a plurality of coding units based on at least one of the block shape information and the information on the division shape mode. According to an embodiment, the video decoding apparatus 100 can determine the second coding unit 510 by dividing the first coding unit 500 along a horizontal direction when the information on the division shape mode indicates that the first coding unit 500 is divided along the horizontal direction. According to an embodiment, the first coding unit, the second coding unit, and the third coding unit used above are terms for understanding the relationship before and after the coding units are divided. For example, the second coding unit can be determined by dividing the first coding unit, and the third coding unit can be determined by dividing the second coding unit. It will be understood that the relationship between the first coding unit, the second coding unit, and the third coding unit follows the above description.

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

[0301] According to an embodiment, the video decoding apparatus 100 can divide the third coding unit 520a or each of the third coding units 520b, 520c, and 520d into a plurality of coding units based on at least one of the block shape information and the information on the division shape mode. In addition, the video decoding apparatus 100 can determine not to divide the second coding unit 510 based on at least one of the block shape information and the information on the division shape mode. According to an embodiment, the video decoding apparatus 100 can divide the non-square second coding unit 510 into the odd number of third coding units 520b, 520c, and 520d. The video decoding apparatus 100 can set a predetermined restriction on a predetermined third coding unit among the odd number of third coding units 520b, 520c, and 520d. For example, the video decoding apparatus 100 can restrict the third coding unit 520c at a center position among the odd number of third coding units 520b, 520c, and 520d to not be divided again or to be divided a settable number of times.

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

[0303] According to an embodiment, the video decoding apparatus 100 can obtain at least one of block shape information and information on a split shape mode for partitioning the current coding unit from a predetermined position in the current coding unit.

[0304] Figure 16 A method of determining a predetermined coding unit from among an odd number of coding units, performed by the video decoding apparatus 100 according to an embodiment, is illustrated.

[0305] Referring to Figure 16 At least one of block shape information and information on a split shape mode for the current coding unit 600 or 650 can be obtained from a sample at a predetermined position (e.g., a sample 640 or 690 at a center position) among a plurality of samples included in the current coding unit 600 or 650. However, the predetermined position at which at least one of block shape information and information on a split shape mode can be obtained in the current coding unit 600 is not limited to the center position in Figure 16 and can include various positions (e.g., top, bottom, left, right, top-left, bottom-left, top-right, and bottom-right positions) included in the current coding unit 600. The video decoding apparatus 100 can obtain at least one of block shape information and information on a split shape mode from the predetermined position and determine whether to partition the current coding unit into coding units of various shapes and various sizes or not to partition the current coding unit.

[0306] According to an embodiment, when the current coding unit is partitioned into a predetermined number of coding units, the video decoding apparatus 100 can select one of the coding units. As will be described below in connection with various embodiments, various methods can be used to select one of a plurality of coding units.

[0307] According to an embodiment, the video decoding apparatus 100 can partition the current coding unit into a plurality of coding units and can determine a coding unit at a predetermined position.

[0308] According to an embodiment, the video decoding apparatus 100 can determine a coding unit at a center position among an odd number of coding units using information indicating a position of the odd number of coding units. Referring to Figure 16, the video decoding device 100 can 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 video decoding device 100 can determine the coding unit 620b at the center position or the coding unit 660b at the center position by using information about 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 video decoding device 100 can determine the coding unit 620b at the center position by determining positions of the coding units 620a, 620b and 620c based on information indicating positions of predetermined samples included in the coding units 620a, 620b and 620c. In detail, the video decoding device 100 can determine the coding unit 620b at the center position by determining positions of the coding units 620a, 620b and 620c based on information indicating positions of top-left samples 630a, 630b and 630c of the coding units 620a, 620b and 620c.

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

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

[0311] According to an embodiment, the video decoding apparatus 100 can partition the current coding unit 600 into a plurality of coding units 620a, 620b, and 620c, and can select one of the coding units 620a, 620b, and 620c based on a predetermined criterion. For example, the video decoding apparatus 100 can 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.

[0312] According to an embodiment, the video decoding apparatus 100 can determine the width or height of the coding units 620a, 620b, and 620c by using a coordinate (xa, ya) indicating the position of the top-left sample 630a of the top coding unit 620a, a coordinate (xb, yb) indicating the position of the top-left sample 630b of the middle coding unit 620b, and a coordinate (xc, yc) indicating the position of the top-left sample 630c of the bottom coding unit 620c. The video decoding apparatus 100 can 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 video decoding apparatus 100 can determine the width of the top coding unit 620a as the width of the current coding unit 600. The video decoding apparatus 100 can determine the height of the top coding unit 620a as yb-ya. According to an embodiment, the video decoding apparatus 100 can determine the width of the middle coding unit 620b as the width of the current coding unit 600. The video decoding apparatus 100 can determine the height of the middle coding unit 620b as yc-yb. According to an embodiment, the video decoding apparatus 100 can determine the width or height of the bottom coding unit 620c by using the width or height of the current coding unit 600 or the width or height of the top coding unit 620a and the middle coding unit 620b. The video decoding apparatus 100 can determine a coding unit having a size different from those of the other coding units based on the determined widths and heights of the coding units 620a to 620c. Referring to Figure 16 , the video decoding apparatus 100 can determine the middle coding unit 620b having a size different from those of the top coding unit 620a and the bottom coding unit 620c as the coding unit at the predetermined position. However, the above-described method of determining a coding unit having a size different from those of the other coding units performed by the video decoding apparatus 100 corresponds only to an example of determining a coding unit at a predetermined position by using the sizes of the coding units determined based on the coordinates of the samples, and thus various methods of determining a coding unit at a predetermined position by comparing the sizes of the coding units determined based on the coordinates of the predetermined samples can be used.

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

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

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

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

[0317] According to an embodiment, the video decoding device 100 can determine a coding unit at a predetermined position from among the even number of coding units using information indicating respective positions of the even number of coding units. The video decoding device 100 can determine the even number of coding units by partitioning the current coding unit and determine a coding unit at a predetermined position by using information about positions of the even number of coding units. Operations related thereto can correspond to the operations already described above in connection with determining a coding unit at a predetermined position (e.g., a center position) from among the odd number of coding units. Figure 16 Detailed descriptions of operations of determining a coding unit at a predetermined position (e.g., a center position) from among the odd number of coding units are thus not provided herein.

[0318] According to an embodiment, when a non-square current coding unit is partitioned into a plurality of coding units, predetermined information about a coding unit at a predetermined position can be used in a partitioning operation to determine a coding unit at a predetermined position from among the plurality of coding units. For example, the video decoding device 100 can use at least one of block shape information included in samples of a coding unit at a center position and information about a partition shape mode in a partitioning operation to determine a coding unit at the center position from among the plurality of coding units determined by partitioning the current coding unit.

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

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

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

[0322] According to an embodiment, when the current coding unit is divided into a plurality of coding units, the video decoding apparatus 100 can determine a coding unit at a predetermined position among the plurality of coding units using at least one of the block shape information and the information about the division shape mode. According to an embodiment, the video decoding apparatus 100 can obtain at least one of the block shape information and the information about the division shape mode from a sample at the predetermined position in the coding unit, and can divide the plurality of coding units by using at least one of the division shape information and the information about the block shape mode obtained from the sample at the predetermined position in each of the plurality of coding units generated by dividing the current coding unit. That is, the coding unit can be recursively divided based on at least one of the block shape information and the information about the division shape mode obtained from the sample at the predetermined position in each of the coding units. The operations of recursively dividing the coding unit have been described above, and thus a detailed description thereof will not be provided here. Figure 15 The operations of recursively dividing the coding unit are described above, and thus a detailed description thereof will not be provided here.

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

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

[0325] According to an embodiment, the video decoding device 100 can determine the second coding units 710a and 710b by partitioning the first coding unit 700 in a vertical direction, determine the second coding units 730a and 730b by partitioning the first coding unit 700 in a horizontal direction, or determine the second coding units 750a to 750d by partitioning the first coding unit 700 in the vertical direction and the horizontal direction, based on the block shape information and the information on the partition shape mode.

[0326] Referring to Figure 17 , the video decoding device 100 can determine to process the second coding units 710a and 710b determined by partitioning the first coding unit 700 in the vertical direction in a horizontal direction order 710c. The video decoding device 100 can determine to process the second coding units 730a and 730b determined by partitioning the first coding unit 700 in the horizontal direction in a vertical direction order 730c. The video decoding device 100 can determine to process the second coding units 750a to 750d determined by partitioning the first coding unit 700 in the vertical direction and the horizontal direction in a predetermined order for processing coding units in a row and then processing coding units in a next row, e.g., in a raster scan order or a zigzag scan order 750e.

[0327] According to an embodiment, the video decoding device 100 can recursively partition coding units. Referring to Figure 17 , the video decoding device 100 can determine a plurality of coding units 710a, 710b, 730a, 730b, 750a, 750b, 750c, and 750d by partitioning the first coding unit 700, and 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 can correspond to the partitioning method of the first coding unit 700. As such, each of the plurality of coding units 710a, 710b, 730a, 730b, 750a, 750b, 750c, and 750d can be independently partitioned into a plurality of coding units. Referring to Figure 17 , the video decoding device 100 can determine the second coding units 710a and 710b by partitioning the first coding unit 700 in the vertical direction, and can determine to independently partition or not to partition each of the second coding units 710a and 710b.

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

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

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

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

[0332] According to an embodiment, the video decoding device 100 can determine whether to divide any coding unit into an odd number of coding units by determining whether the third coding units 820a and 820b and the third coding units 820c to 820e can be processed in a predetermined order. Referring to FIG. 8B, the video decoding device 100 can determine whether to divide the right second coding unit 810b into an odd number of coding units by determining whether the third coding units 820c to 820e can be processed in a predetermined order. Figure 18 According to an embodiment, the video decoding device 100 can determine the third coding units 820a and 820b and the third coding units 820c to 820e by recursively dividing the first coding unit 800. The video decoding device 100 can determine whether any one of the first coding unit 800, the second coding units 810a and 810b, the third coding units 820a and 820b and 820c, 820d and 820e is divided into an odd number of coding units based on at least one of the block shape information and the information on the division shape mode. For example, the right second coding unit 810b can be divided into an odd number of third coding units 820c, 820d and 820e. The processing order of the plurality of coding units included in the first coding unit 800 can be a predetermined order (e.g., the zigzag scan order 830), and the video decoding device 100 can determine whether the third coding units 820c, 820d and 820e determined by dividing the right second coding unit 810b into an odd number of coding units satisfy the condition for processing in the predetermined order.

[0333] According to an embodiment, the video decoding apparatus 100 can determine whether the third coding units 820a and 820b included in the first coding unit 800 and the third coding units 820c, 820d, and 820e satisfy a condition for processing in a predetermined order, and the condition relates to whether at least one of the widths and the heights of the second coding units 810a and 810b is halved along the boundaries of the third coding units 820a and 820b and the third coding units 820c, 820d, and 820e. For example, the third coding units 820a and 820b determined by halving the height of the left second coding unit 810a which is non-square satisfy the condition. However, since the boundaries of the third coding units 820c, 820d, and 820e determined by dividing the right second coding unit 810b into three coding units do not halve the width or the height of the right second coding unit 810b, it can be determined that the third coding units 820c, 820d, and 820e do not satisfy the condition. When the condition is not satisfied as described above, the video decoding apparatus 100 can determine the discontinuity of the scan order, and determine that the right second coding unit 810b 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 video decoding apparatus 100 can set a predetermined restriction on a coding unit at a predetermined position among the divided coding units, and the restriction or the predetermined position has been described above in connection with various embodiments, and thus a detailed description thereof will not be provided here.

[0334] Figure 19 A process of determining at least one coding unit by dividing a first coding unit 900 performed by the video decoding apparatus 100 according to an embodiment is illustrated.

[0335] According to an embodiment, the video decoding apparatus 100 can divide the first coding unit 900 based on at least one of the block shape information and the information on the division shape mode obtained by the bitstream obtainer 110. The square first coding unit 900 can be divided into four square coding units, or can be divided into a plurality of non-square coding units. For example, referring to Figure 19When the block shape information indicates that the first coding unit 900 has a square shape and the information about the division shape mode indicates that the first coding unit 900 is divided into non-square coding units, the video decoding apparatus 100 can divide the first coding unit 900 into a plurality of non-square coding units. In detail, when the information about the division shape mode indicates that an odd number of coding units are determined by dividing the first coding unit 900 in a horizontal direction or a vertical direction, the video decoding apparatus 100 can divide the square first coding unit 900 into the odd number of coding units, e.g., the second coding units 910a, 910b, and 910c determined by dividing the square first coding unit 900 in a vertical direction or the second coding units 920a, 920b, and 920c determined by dividing the square first coding unit 900 in a horizontal direction.

[0336] According to an embodiment, the video decoding apparatus 100 can determine whether the second coding units 910a, 910b, 910c, 920a, 920b, and 920c included in the first coding unit 900 satisfy a condition for processing in a predetermined order, and the condition relates to whether at least one of the width and the 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 19 Since the boundaries of the second coding units 910a, 910b, and 910c determined by dividing the square first coding unit 900 in a vertical direction do not halve the width of the first coding unit 900, it can be determined that the first coding unit 900 does not satisfy the condition for processing in a predetermined order. Also, since the boundaries of the second coding units 920a, 920b, and 920c determined by dividing the square first coding unit 900 in a horizontal direction do not halve the height of the first coding unit 900, it can be determined that the first coding unit 900 does not satisfy the condition for processing in a predetermined order. When the condition is not satisfied as described above, the video decoding apparatus 100 can determine the discontinuity of the scan order, 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 video decoding apparatus 100 can set a predetermined restriction on a coding unit at a predetermined position among the divided coding units, and the restriction or the predetermined position has been described above in connection with various embodiments, and thus a detailed description thereof will not be provided here.

[0337] According to an embodiment, the video decoding apparatus 100 can determine coding units of various shapes by dividing a first coding unit.

[0338] Referring to Figure 19The video decoding apparatus 100 can divide the first coding unit 900 of a square shape or the first coding units 930 or 950 of a non-square shape into coding units of various shapes.

[0339] Figure 20 It is shown that, according to an embodiment, when a second coding unit having a non-square shape determined by dividing the first coding unit 1000 satisfies a predetermined condition, shapes into which the second coding unit can be divided by the video decoding apparatus 100 are limited.

[0340] According to an embodiment, the video decoding apparatus 100 can determine to divide the first coding unit 1000 of a square shape into the second coding units 1010a, 1010b, 1020a, and 1020b of a non-square shape based on at least one of the block shape information and the information on the division shape mode obtained by the bitstream obtainer 110. The second coding units 1010a, 1010b, 1020a, and 1020b can be independently divided. As such, the video decoding apparatus 100 can determine whether to divide each of the second coding units 1010a, 1010b, 1020a, and 1020b into a plurality of coding units based on at least one of the block shape information and the information on the division shape mode of each of the second coding units 1010a, 1010b, 1020a, and 1020b. According to an embodiment, the video decoding apparatus 100 can determine the third coding units 1012a and 1012b by dividing the left second coding unit 1010a of a non-square shape determined by dividing the first coding unit 1000 in a vertical direction in a horizontal direction. However, when the left second coding unit 1010a is divided in the horizontal direction, the video decoding apparatus 100 can limit the right second coding unit 1010b to not be divided in the horizontal direction in which the left second coding unit 1010a is divided. When the third coding units 1014a and 1014b are determined by dividing the right second coding unit 1010b in the same direction, because the left second coding unit 1010a and the right second coding unit 1010b are independently divided in the horizontal direction, the third coding units 1012a, 1012b, 1014a, and 1014b can be determined. However, this case is equivalent to a case in which the video decoding apparatus 100 divides the first coding unit 1000 into the four second coding units 1030a, 1030b, 1030c, and 1030d of a square shape based on at least one of the block shape information and the information on the division shape mode, but can be inefficient in terms of image decoding.

[0341] According to an embodiment, the video decoding apparatus 100 can determine the third coding units 1022a, 1022b, 1024a, and 1024b by dividing the non-square second coding units 1020a or 1020b determined by dividing the first coding unit 1000 in the horizontal direction in the vertical direction. However, when the second coding units (e.g., the upper second coding unit 1020a) are divided in the vertical direction, the video decoding apparatus 100 can restrict another second coding unit (e.g., the lower second coding unit 1020b) from being divided in the vertical direction as the upper second coding unit 1020a is not divided due to the above-described reason.

[0342] Figure 21 A process of dividing a square coding unit when information on a division shape mode indicates that the square coding unit is not to be divided into four square coding units, performed by the video decoding apparatus 100 according to an embodiment, is illustrated.

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

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

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

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

[0347] Figure 22 The order of processing between a plurality of coding units according to an embodiment is shown. The order of processing can change depending on the processing of dividing a coding unit.

[0348] According to an embodiment, the video decoding device 100 can divide the first coding unit 1200 based on the block shape information and the information on the division shape mode. When the block shape information indicates a square shape and the information on the division shape mode indicates that the first coding unit 1200 is divided in at least one of the horizontal direction and the vertical direction, the video decoding device 100 can determine the second coding units 1210a, 1210b, 1220a, and 1220b by dividing the first coding unit 1200. Referring to FIG. 12, the video decoding device 100 can determine the second coding units 1210a, 1210b, 1220a, and 1220b by dividing the first coding unit 1200 in the horizontal direction and the vertical direction. Figure 22, the second coding units 1210a, 1210b, 1220a, and 1220b, which are non-square determined by dividing the first coding unit 1200 in only a horizontal direction or a vertical direction, can be independently divided based on the block shape information of each coding unit and the information on the division shape mode. For example, the video decoding apparatus 100 can determine third coding units 1216a, 1216b, 1216c, and 1216d by dividing the second coding units 1210a and 1210b generated by dividing the first coding unit 1200 in a vertical direction in a horizontal direction, and 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 a horizontal direction in a vertical direction. The operations of dividing the second coding units 1210a, 1210b, 1220a, and 1220b have been described above, and thus a detailed description thereof will not be provided here. Figure 21 The operations of dividing the second coding units 1210a, 1210b, 1220a, and 1220b have been described above, and thus a detailed description thereof will not be provided here.

[0349] According to an embodiment, the video decoding apparatus 100 can process the coding units in a predetermined order. The operations of processing the coding units in the predetermined order have been described above, and thus a detailed description thereof will not be provided here. Referring to Figure 17 The operations of processing the coding units in the predetermined order have been described above, and thus a detailed description thereof will not be provided here. Referring to Figure 22 The video decoding apparatus 100 can determine four square third coding units 1216a, 1216b, 1216c, and 1216d and third coding units 1226a, 1226b, 1226c, and 1226d by dividing the square first coding unit 1200. According to an embodiment, the video decoding apparatus 100 can determine a processing order of the third coding units 1216a, 1216b, 1216c, and 1216d and the third coding units 1226a, 1226b, 1226c, and 1226d based on a division method of the first coding unit 1200.

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

[0351] According to an embodiment, the video decoding apparatus 100 can determine the third coding units 1226a, 1226b, 1226c, and 1226d by dividing the second coding units 1220a and 1220b generated by dividing the first coding unit 1200 in the horizontal direction in the vertical direction, and can process the third coding units 1226a, 1226b, 1226c, and 1226d in a processing order 1227 for processing the third coding units 1226a and 1226b included in the second coding unit 1220a above first in the horizontal direction and then processing the third coding units 1226c and 1226d included in the second coding unit 1220b below in the horizontal direction.

[0352] Referring to Figure 22 The square third coding units 1216a, 1216b, 1216c, and 1216d and the third coding units 1226a, 1226b, 1226c, and 1226d can be determined by dividing the second coding units 1210a, 1210b, 1220a, and 1220b, respectively. Although the second coding units 1210a and 1210b are determined by dividing the first coding unit 1200 in the vertical direction differently 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, and 1216d divided from the second coding units 1210a and 1210 and the third coding units 1226a, 1226b, 1226c, and 1226d divided from the second coding units 1220a and 1220 ultimately appear as coding units of the same shape divided from the first coding unit 1200. In this way, by dividing coding units recursively in different ways based on at least one of the block shape information and the information on the division shape mode, the video decoding apparatus 100 can process multiple coding units in different orders even when the multiple coding units are ultimately determined to be of the same shape.

[0353] Figure 23 A process of determining depths of coding units as shapes and sizes of the coding units change when the coding units are recursively divided to determine multiple coding units according to an embodiment is illustrated.

[0354] According to an embodiment, the video decoding apparatus 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 divided current coding unit, the video decoding apparatus 100 can determine that the depth of the current coding unit is increased by n from the depth of the coding unit before being divided. In the following description, a coding unit having an increased depth is denoted as a coding unit having a deeper depth.

[0355] Referring to Figure 23 According to an embodiment, the video decoding apparatus 100 can determine the second coding unit 1302 and the third coding unit 1304 of a deeper depth by dividing the square first coding unit 1300 based on block shape information indicating a square shape (for example, the block shape information can be denoted as "0: SQUARE"). Assuming that the size of the square first coding unit 1300 is 2N×2N, the second coding unit 1302 determined by dividing the width and height of the first coding unit 1300 by 1 / 2 can have a size of NxN. Also, the third coding unit 1304 determined by dividing the width and height of the second coding unit 1302 by 1 / 2 can have a size of N / 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 can be D+1, and the depth of the third coding unit 1304 can be D+2, where the width and height of the second coding unit 1302 are 1 / 2 of the width and height of the first coding unit 1300, and the width and height of the third coding unit 1304 are 1 / 4 of the width and height of the first coding unit 1300.

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

[0357] The video decoding apparatus 100 can determine the second coding units 1302, 1312, or 1322 by dividing at least one of the width and the height of the first coding unit 1310 of size N×2N. That is, the video decoding apparatus 100 can determine the second coding unit 1302 of size N×N or the second coding unit 1322 of size N×N / 2 by dividing the first coding unit 1310 in the horizontal direction, or can determine the second coding unit 1312 of size N / 2×N by dividing the first coding unit 1310 in the horizontal and vertical directions.

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

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

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

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

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

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

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

[0365] According to an embodiment, the video decoding apparatus 100 can determine second coding units having various shapes by dividing the square first coding unit 1400. Referring to FIG. 14, the video decoding apparatus 100 can determine the second coding unit 1412 having a size of 2N×2N by dividing the first coding unit 1400 in a horizontal direction or a vertical direction, or can determine the second coding unit 1414 having a size of N×2N by dividing the first coding unit 1400 in a vertical direction. Figure 24The video decoding apparatus 100 can determine the second coding units 1402a and 1402b, the second coding units 1404a and 1404b, and the second coding units 1406a, 1406b, 1406c, and 1406d by dividing the first coding unit 1400 in at least one of a vertical direction and a horizontal direction based on the information on the division shape mode. That is, the video decoding apparatus 100 can determine the second coding units 1402a and 1402b, the second coding units 1404a and 1404b, and the second coding units 1406a, 1406b, 1406c, and 1406d based on the information on the division shape mode of the first coding unit 1400.

[0366] According to an embodiment, 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 division shape mode of the first coding unit 1400 that is a square can be determined based on lengths of long sides thereof. For example, because the first coding unit 1400 that is a square has a side length equal to lengths of long sides of the second coding units 1402a and 1402b and the second coding units 1404a and 1404b that are not squares, the first coding unit 1400 and the second coding units 1402a and 1402b and the second coding units 1404a and 1404b that are not squares can have the same depth, e.g., D. However, when the video decoding apparatus 100 divides the first coding unit 1400 into the second coding units 1406a, 1406b, 1406c, and 1406d that are squares based on the information on the division shape mode, because the second coding units 1406a, 1406b, 1406c, and 1406d that are squares have a side length that is 1 / 2 of a side length of the first coding unit 1400, the second coding units 1406a, 1406b, 1406c, and 1406d can have a depth that is D+1, which is 1 deeper than the depth D of the first coding unit 1400.

[0367] According to an embodiment, the video decoding apparatus 100 can determine the second coding units 1412a and 1412b and the second coding units 1414a, 1414b, and 1414c by dividing the first coding unit 1410 that is taller than it is wide in a horizontal direction based on the information on the division shape mode. According to an embodiment, the video decoding apparatus 100 can determine the second coding units 1422a and 1422b and the second coding units 1424a, 1424b, and 1424c by dividing the first coding unit 1420 that is wider than it is tall in a vertical direction based on the information on the division shape mode.

[0368] According to an embodiment, 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 partition shape mode of the non-square first coding unit 1410 or 1420 can be determined based on lengths of long sides thereof. For example, because the side length of the square second coding units 1412a and 1412b is 1 / 2 of the length of the long side of the non-square first coding unit 1410 having a shape in which the height is longer than the width, the depth of the square second coding units 1412a and 1412b is D+1 which is 1 deeper than the depth D of the non-square first coding unit 1410.

[0369] In addition, the video decoding apparatus 100 can partition the non-square first coding unit 1410 into an odd number of second coding units 1414a, 1414b, and 1414c based on the information on the partition shape mode. The odd number of second coding units 1414a, 1414b, and 1414c can include the non-square second coding units 1414a and 1414c and the square second coding unit 1414b. In this case, because the length of the long side of the non-square second coding units 1414a and 1414c and the side length of the square second coding unit 1414b is 1 / 2 of the length of the long side of the first coding unit 1410, the depths of the second coding units 1414a, 1414b, and 1414c can be D+1 which is 1 deeper than the depth D of the non-square first coding unit 1410. The video decoding apparatus 100 can determine depths of coding units partitioned from the first coding unit 1420 having a non-square shape in which the width is longer than the height by using the above-described method of determining depths of coding units partitioned from the first coding unit 1410.

[0370] According to an embodiment, when the odd number of partitioned coding units do not have equal sizes, the video decoding apparatus 100 can determine PIDs for identifying the partitioned coding units based on size ratios between the coding units. Referring to FIG. 14, the video decoding apparatus 100 can determine the PIDs for identifying the partitioned coding units based on the size ratios between the coding units. For example, the video decoding apparatus 100 can determine the PID of the second coding unit 1412a to be 0, the PID of the second coding unit 1412b to be 1, the PID of the second coding unit 1414a to be 2, the PID of the second coding unit 1414b to be 3, and the PID of the second coding unit 1414c to be 4 based on the size ratios between the coding units. Figure 24The coding unit 1414b at the center position among the odd number of partitioned coding units 1414a, 1414b, and 1414c can have a width equal to that of the other coding units 1414a and 1414c and a height twice that of the other coding units 1414a and 1414c. That is, in this case, the coding unit 1414b at the center position can include two other coding units 1414a or 1414c. Accordingly, when the PID of the coding unit 1414b at the center position is 1 based on the scan order, the PID of the coding unit 1414c located next to the coding unit 1414b can increase by 2, and thus can be 3. That is, there can be a discontinuity in the PID values. According to an embodiment, the video decoding apparatus 100 can determine whether the odd number of partitioned coding units do not have equal sizes based on whether there is a discontinuity in the PIDs used to identify the partitioned coding units.

[0371] According to an embodiment, the video decoding apparatus 100 can determine whether to use a particular partitioning method based on PID values for a plurality of coding units determined by partitioning a current coding unit. Referring to FIG. 14, the video decoding apparatus 100 can determine whether to use a particular partitioning method based on whether there is a discontinuity in the PIDs used to identify the partitioned coding units. Figure 24 The video decoding apparatus 100 can determine even number of coding units 1412a and 1412b or odd number of coding units 1414a, 1414b, and 1414c by partitioning the first coding unit 1410 having a rectangular shape with a height longer than a width. The video decoding apparatus 100 can identify each coding unit using a PID. According to an embodiment, the PID can be obtained from a sample at a predetermined position (e.g., a top-left sample) of each coding unit.

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

[0373] According to an embodiment, the video decoding apparatus 100 can use a predetermined data unit from which the coding units are recursively divided.

[0374] Figure 25 It is shown that a plurality of coding units is determined based on a plurality of predetermined data units included in a picture according to an embodiment.

[0375] According to an embodiment, a predetermined data unit can be defined as a data unit from which a coding unit is recursively divided by using at least one of block shape information and information on a division shape pattern. That is, the predetermined data unit can correspond to a coding unit of a highest depth, which is used to determine a plurality of coding units divided from a current picture. In the following description, the predetermined data unit will be referred to as a reference data unit for convenience of explanation.

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

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

[0378] According to an embodiment, the video decoding apparatus 100 can determine a minimum size allowed for a reference data unit included in a current picture in advance. Accordingly, the video decoding apparatus 100 can determine various reference data units having a size equal to or greater than the minimum size and determine one or more coding units by using block shape information on the determined reference data unit and information on a division shape pattern.

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

[0380] According to an embodiment, the bitstream obtainer 110 of the video decoding apparatus 100 can obtain at least one of reference coding unit shape information and reference coding unit size information on each of various data units from a bitstream. The above has been described in connection with Figure 13The operation of partitioning the current coding unit 300 describes an operation of partitioning a square-shaped reference coding unit 1500 into one or more coding units, and a detailed description thereof has already been provided above in connection with Figure 14 The operation of partitioning the current coding unit 400 or 450 describes an operation of partitioning a non-square-shaped reference coding unit 1502 into one or more coding units, and thus a detailed description thereof will not be provided here.

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

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

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

[0384] According to an embodiment, the video decoding apparatus 100 can determine one or more processing blocks split from a picture. The processing block is a data unit including one or more reference coding units split from the picture, and one or more reference coding units included in the processing block can be determined according to a certain order. That is, the order of determination of one or more reference coding units determined in each processing block can correspond to one of various types of orders for determining the reference coding units, and can vary depending on the processing block. The order of determination of the reference coding units determined for each processing block can be one of various orders (e.g., a raster scan order, a zigzag scan, an N zigzag scan, a right-up diagonal scan, a horizontal scan, and a vertical scan), but is not limited to the above-described scan orders.

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

[0386] According to an embodiment, the bitstream obtainer 110 of the video decoding apparatus 100 can obtain the processing block size information from a bitstream according to each certain data unit. For example, the processing block size information can be obtained from a bitstream in data units such as an image, a sequence, a picture, a slice, or a slice segment. That is, the bitstream obtainer 110 can obtain the processing block size information from a bitstream according to each of various data units, and the video decoding apparatus 100 can determine sizes of one or more processing blocks split from a picture by using the obtained processing block size information, and the size of the processing block can be an integer multiple of the size of the reference coding unit.

[0387] According to an embodiment, the video decoding apparatus 100 can determine sizes of the processing blocks 1602 and 1612 included in the picture 1600. For example, the video decoding apparatus 100 can determine the sizes of the processing blocks based on the processing block size information obtained from a bitstream. Referring to Figure 26 , according to an embodiment, the video decoding apparatus 100 can determine the width of the processing blocks 1602 and 1612 to be four times the width of the reference coding unit, and can determine the height of the processing blocks 1602 and 1612 to be four times the height of the reference coding unit. The video decoding apparatus 100 can determine an order of determination of one or more reference coding units in one or more processing blocks.

[0388] According to an embodiment, the video decoding apparatus 100 can determine the processing blocks 1602 and 1612 included in the picture 1600 based on the size of the processing blocks, and can determine the determined order of the one or more reference coding units included in the processing blocks 1602 and 1612. According to an embodiment, determining the reference coding units can include determining the size of the reference coding units.

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

[0390] According to an embodiment, the video decoding apparatus 100 can obtain the determined order information of the reference coding units from the bitstream according to each specific data unit. For example, the bitstream obtainer 110 can obtain the determined order information of the reference coding units from the bitstream according to each data unit such as a picture, a sequence, a picture, a slice, a slice segment, or a processing block. Since the determined order information of the reference coding units indicates an order for determining the reference coding units in the processing blocks, the determined order information can be obtained for each specific data unit including an integer number of processing blocks.

[0391] According to an embodiment, the video decoding apparatus 100 can determine the one or more reference coding units based on the determined determined order.

[0392] According to an embodiment, the bitstream obtainer 110 can obtain the determined order information of the reference coding units from the bitstream as information related to the processing blocks 1602 and 1612, and the video decoding apparatus 100 can determine the determined order of the reference coding units of the one or more included in the processing blocks 1602 and 1612, and can determine the one or more reference coding units included in the picture 1600 based on the determined order. Referring to Figure 26, the video decoding apparatus 100 can determine the determination order 1604 and 1614 of one or more reference coding units in the processing blocks 1602 and 1612, respectively. 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 can 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 a raster scan order, the reference coding units included in the processing block 1602 can be determined according to the raster scan order. Conversely, when the determination order 1614 of the reference coding units in the other processing block 1612 is a reverse raster scan order, the reference coding units included in the processing block 1612 can be determined according to the reverse raster scan order.

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

[0394] According to an embodiment, the video decoding apparatus 100 can obtain block shape information indicating a shape of a current coding unit or information on a partition shape mode indicating a partitioning method of the current coding unit from a bitstream and can use the obtained information. The block shape information or the information on the partition shape mode can be included in the bitstream with respect to various data units. For example, the video decoding apparatus 100 can use the block shape information or the information on the partition 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 video decoding apparatus 100 can obtain syntax elements corresponding to the block shape information or the information on the partition shape mode from the bitstream according to each maximum coding unit, each reference coding unit, or each processing block and can use the obtained syntax elements.

[0395] Figure 27 A coding unit that can be determined for each picture when a combination of shapes in which a coding unit can be partitioned is different for each picture is shown according to an embodiment.

[0396] Referring to Figure 27, the video decoding apparatus 100 can determine a combination of shapes into which a coding unit can be divided differently for each picture. For example, the video decoding apparatus 100 can decode a picture by using a picture 1700 that can be divided into 4 coding units, a picture 1710 that can be divided into 2 or 4 coding units, and a picture 1720 that can be divided into 2, 3, or 4 coding units in at least one of a horizontal direction and a vertical direction of the picture. To divide the picture 1700 into coding units, the video decoding apparatus 100 can use only division shape information indicating that the picture 1700 is divided into 4 square coding units. To divide the picture 1710, the video decoding apparatus 100 can use only division shape information indicating that the picture 1710 is divided into 2 or 4 coding units. To divide the picture 1720, the video decoding apparatus 100 can use only division shape information indicating that the picture 1720 is divided into 2, 3, or 4 coding units. Because such a combination of division shapes is only an embodiment for describing the operation of the video decoding apparatus 100, the combination of division shapes should not be construed as being limited to the embodiment, but various combinations of division shapes can be used according to predetermined data units.

[0397] According to an embodiment, the bitstream obtainer 110 of the video decoding apparatus 100 can obtain a bitstream including an index indicating a combination of division shape information according to a predetermined data unit unit (e.g., a sequence, a picture, or a slice). For example, the bitstream obtainer 110 can obtain an index indicating a combination of division shape information from a sequence parameter set, a picture parameter set, or a slice header. The video decoding apparatus 100 can determine a combination of division shapes into which a coding unit can be divided according to a predetermined data unit by using the obtained index, and thus can use different combinations of division shapes according to predetermined data units.

[0398] Figure 28 Various shapes of a coding unit that can be determined based on division shape information that can be expressed as a binary code are shown according to an embodiment.

[0399] According to an embodiment, the video decoding apparatus 100 can divide a coding unit into various shapes by using block shape information and division shape information obtained by the bitstream obtainer 110. Shapes into which a coding unit can be divided can correspond to various shapes including the shapes described through the above embodiments.

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

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

[0402] According to an embodiment, when the video decoding apparatus 100 divides a coding unit having a non-square shape in a horizontal direction or a vertical direction, the type of the division shape that can be indicated by the division shape information can be determined according to the number of coding units into which the coding unit is divided. Referring to Table 1, Figure 28 , according to an embodiment, the video decoding apparatus 100 can divide a coding unit having a non-square shape into 3 coding units. The video decoding apparatus 100 can divide the coding unit into two coding units, and in this case, the division shape information can be expressed as (10)b. The video decoding apparatus 100 can divide the coding unit into 3 coding units, and in this case, the division shape information can be expressed as (11)b. The video decoding apparatus 100 can determine that the coding unit is not divided, and in this case, the division shape information can be expressed as (0)b. That is, in order to use the binary code indicating the division shape information, the video decoding apparatus 100 can use variable length coding (VLC) rather than fixed length coding (FLC).

[0403] According to an embodiment, referring to Table 1, Figure 28 , the binary code indicating the division shape information that the coding unit is not divided can be expressed as (0)b. When the binary code indicating the division shape information that the coding unit is not divided is set to (00)b, although there is no division shape information set to (01)b, it is necessary to use the entire 2-bit binary code of the division shape information. However, as Figure 28 indicated in Table 1, when 3 division shapes are used for a coding unit having a non-square shape, even though the video decoding apparatus 100 determines that the coding unit is not divided by using a 1-bit binary code (0)b as the division shape information, the division shape of the coding unit having a non-square shape indicated by the division shape information should not be interpreted as being limited to Figure 28The three shapes shown, and should be interpreted to include various shapes of the above embodiments.

[0404] Figure 29 Other shapes of the coding unit that can be determined based on the partition shape information that can be represented as a binary code are shown according to an embodiment.

[0405] Referring to Figure 29 , the video decoding apparatus 100 can partition the coding unit having a square shape in a horizontal direction or a vertical direction based on the partition shape information, and can partition the coding unit having a non-square shape in the horizontal direction or the vertical direction. That is, the partition shape information can indicate that the coding unit having a square shape is partitioned in one direction. In this case, the binary code of the partition shape information indicating that the 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 the coding unit is not partitioned is set to (00)b, although there is no partition shape information set to (01)b, it is necessary to use the entire 2-bit binary code of the partition shape information. However, as Figure 29 shown, when three partition shapes are used for the coding unit having a non-square shape, even by using a 1-bit binary code (0)b as the partition shape information, the video decoding apparatus 100 can determine that the coding unit is not partitioned, thereby efficiently using the bitstream. However, the partition shape of the coding unit having a square shape indicated by the partition shape information should not be interpreted to be limited to the three shapes shown, and should be interpreted to include various shapes of the above embodiments. Figure 29

[0406] According to an embodiment, the block shape information or the 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 the partition shape information represented as a binary code can not be immediately generated in a bitstream, and can be used as a binary code input during context adaptive binary arithmetic coding (CABAC).

[0407] ​According to an embodiment, a process of obtaining a syntax regarding block shape information or partition shape information through CABAC performed by the video decoding apparatus 100 will be described. The bitstream including the bin codes for the syntax can be obtained by the bitstream obtainer 110. The video decoding apparatus 100 can detect the syntax elements indicating the block shape information or the partition shape information by de-binarizing the bin string included in the obtained bitstream. According to an embodiment, the video decoding apparatus 100 can obtain a set of bin strings of bins corresponding to the syntax elements to be decoded, and can decode each bin by using the probability information, and the video decoding apparatus 100 can repeatedly perform the process until the bin string including the bins thus decoded is identical to one of the bin strings obtained in advance. The video decoding apparatus 100 can determine the syntax elements by de-binarizing the bin string.

[0408] According to an embodiment, the video decoding apparatus 100 can determine the syntax regarding the bin string by performing a decoding process of adaptive binary arithmetic coding, and can update the probability model for the bins obtained by the bitstream obtainer 110. Referring to Figure 28 , according to an embodiment, the bitstream obtainer 110 of the video decoding apparatus 100 can obtain a bitstream indicating a bin code indicating the partition shape information. The video decoding apparatus 100 can determine the syntax regarding the partition shape information by using the obtained bin code having a size of 1 bit or 2 bits. To determine the syntax regarding the partition shape information, the video decoding apparatus 100 can update the probability of each of the 2 bits of the bin code. That is, the video decoding apparatus 100 can update the probability that can have a value of 0 or 1 when decoding the next bin according to whether the value of the first bin of the 2 bits of the bin code is 0 or 1.

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

[0410] Referring to Figure 28When the syntax about the partition shape information of the coding unit having the non-square shape is determined by using the bin string indicating the partition shape information of the coding unit having the non-square shape, the video decoding apparatus 100 can determine the syntax about the partition shape information by using one bin having a value of 0 when the coding unit having the non-square shape is not partitioned. That is, when the block shape information indicates that the current coding unit has the non-square shape, the first bin of the bin string for the partition shape information can be 0 when the coding unit having the non-square shape is not partitioned and can be 1 when the coding unit having the non-square shape is partitioned into two or three coding units. Accordingly, the probability that the first bin of the bin string for the partition shape information of the coding unit having the non-square shape is 0 can be 1 / 3 and the probability that the first bin of the bin string for the partition shape information of the coding unit having the non-square shape is 1 can be 2 / 3. As described above, because the partition shape information indicating that the coding unit having the non-square shape is not partitioned can represent only a bin string of 1 bit having a value of 0, the video decoding apparatus 100 can determine the syntax about the partition shape information by determining whether the second bin is 0 or 1 only when the first bin of the partition shape information is 1. According to an embodiment, when the first bin for the partition shape information is 1, the video decoding apparatus 100 can decode the bin by determining that the probability that the second bin is 0 and 1 is the same.

[0411] According to an embodiment, the video decoding apparatus 100 can use various probabilities for each bin of the bin string for the partition shape information when determining the bin. According to an embodiment, the video decoding apparatus 100 can differently determine the probability for the bin of the partition shape information according to a direction of the non-square block. According to an embodiment, the video decoding apparatus 100 can differently determine the probability for the bin of the partition shape information according to an area of the current coding unit or a length of the long side. According to an embodiment, the video decoding apparatus 100 can differently determine the probability for the bin of the partition shape information according to at least one of a shape of the current coding unit and a length of the long side.

[0412] According to an embodiment, the video decoding apparatus 100 can determine that the probability for the bin of the partition shape information is the same for the coding unit having a predetermined size or more. For example, the video decoding apparatus 100 can determine that the probability for the bin of the partition shape information is the same for the coding unit having a size equal to or greater than 64 samples based on a length of the long side of each coding unit.

[0413] According to an embodiment, the video decoding apparatus 100 can determine an initial probability of the bin constituting the bin string of the partition shape information based on a slice type (e.g., I slice, P slice, B slice, etc.).

[0414] Figure 30 is a block diagram of an image encoding and decoding system 2000 for performing in-loop filtering.

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

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

[0417] Encoded image data in the bitstream received by the decoding end 2050 is reconstructed into residual data in a spatial domain through an entropy decoder 2055 and a dequantizer and inverse transformer 2060. When the residual data is combined with a reference image output from a prediction decoder 2075, image data in the spatial domain is formed, and a deblocking filter 2065 and an in-loop filter 2070 can filter the image data in the spatial domain and can output a reconstructed image for a current original image. The reconstructed image can be used by the prediction decoder 2075 as a reference image for a next original image.

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

[0419] Figure 31 An example of a filter unit included in a maximum coding unit and filter performance information of the filter unit according to an embodiment is shown.

[0420] When the filtering unit of the loop filter 2040 at the encoding end 2010 and the filtering unit of the loop filter 2070 at the decoding end 2050 include, according to reference Figures 13 to 15 When the encoding units of the described embodiments are similar data units, the filter information may include block shape information and partition shape information for indicating the data units of the filtering unit, as well as loop filtering performance information for indicating whether loop filtering is performed on the filtering unit.

[0421] According to an embodiment, the filtering units included in the maximum coding unit 2100 may have the same block shape and partition shape as the coding units included in the maximum coding unit 2100. Furthermore, the filtering units included in the maximum coding unit 2100 may be partitioned based on the dimensions of the coding units included in the maximum coding unit 2100 according to an embodiment. (Refer to...) Figure 31 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.

[0422] The block shape information, partition shape information (depth) and loop filtering performance information of the filtering units included in the maximum coding unit 2100 can be encoded as shown in Table 3.

[0423] [Table 3]

[0424]

[0425] According to the embodiment, the processing and reference of multiple coding units are determined by recursively dividing the coding units based on block shape information and block partitioning information. Figure 23 The processing described is the same. According to the embodiment, the loop filtering performance information of the filtering unit 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 3, all information of the data units used to determine which filtering units will be filtered by loop filters 2040 and 2070 can be encoded as filtering information and transmitted.

[0426] Since the coding unit configured according to the embodiment is a coding unit configured to minimize an error of an original image, it is expected to have a high spatial correlation in the coding unit. Thus, since the filtering unit is determined based on the coding unit according to the embodiment, an operation of determining the filtering unit separately from the determination of the coding unit can be omitted. Also, thus, since the filtering unit is determined based on the coding unit according to the embodiment, information for determining a division shape of the filtering unit can be omitted, and a transmission bit rate of filter information can be preserved.

[0427] Although the determination of the filtering unit based on the coding unit according to the embodiment is described in the above embodiment, the filtering unit can be divided based on the coding unit up to an arbitrary depth, so that a shape of the filtering unit can be determined up to at most the arbitrary depth.

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

[0429] According to the embodiment, the video decoding apparatus 100 can divide the current coding unit by using at least one of the block shape information and the division shape information, and can determine the block shape information to indicate that only a square shape is used in advance, and can determine the division shape information to indicate that the current coding unit is not divided or is divided into 4 square coding units. That is, the coding units of the current coding unit can always have a square shape according to the block shape information, and the current coding unit can not be divided or be divided into 4 square coding units based on the division shape information. The video decoding apparatus 100 can obtain a bitstream generated by using a predetermined coding method that is predetermined to use only such a block shape and division shape by using the bitstream obtainer 110, and the video decoding apparatus 100 can use only the predetermined block shape and division shape determined in advance. In this case, the video decoding apparatus 100 can solve a compatibility problem with the predetermined coding method by using a predetermined decoding method similar to the predetermined coding method. According to the embodiment, when the video decoding apparatus 100 uses the predetermined decoding method that uses only the predetermined block shape and division shape among various shapes that can be indicated by the block shape information and the division shape information, the block shape information indicates only a square shape, so the video decoding apparatus 100 can not perform a process of obtaining the block shape information from the bitstream. A syntax indicating whether the predetermined decoding method is used can be used, and such a syntax can be obtained from the bitstream according to data units having various shapes that can include a plurality of coding units such as a sequence, a picture, a slice unit, and a maximum coding unit. That is, the bitstream obtainer 110 can determine whether to obtain a syntax indicating the block shape information from the bitstream based on the syntax indicating whether the predetermined decoding method is used.

[0430] Figure 32An index according to a Z-scan order of a coding unit is shown according to an embodiment.

[0431] The video decoding apparatus 100 according to an embodiment can scan lower layer data units included in an upper layer data unit according to a Z-scan order. Further, the video decoding apparatus 100 according to an embodiment can sequentially access data according to a Z-scan index included in a coding unit of a processing block or a maximum coding unit.

[0432] As described with reference to Figure 13 and Figure 14 , the video decoding apparatus 100 according to an embodiment can 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 can coexist in the reference coding unit. The video decoding apparatus 100 according to an embodiment can access data according to a Z-scan index included in each coding unit in the reference coding unit. In this case, a method of applying the Z-scan index can change according to whether or not coding units having a non-square shape exist in the reference coding unit.

[0433] According to an embodiment, when coding units having a non-square shape do not exist in a reference coding unit, coding units of a lower depth in the reference coding unit can have consecutive Z-scan indexes. For example, according to an embodiment, a coding unit of a higher depth can include four coding units of a lower depth. Boundaries of the four coding units of the lower depth can be consecutive, and the coding units of the lower depth can be scanned in a Z-scan order according to indexes indicating the Z-scan order. The indexes indicating the Z-scan order according to an embodiment can be set to numbers that increase according to the Z-scan order for the coding unit. In this case, coding units of a deeper depth of the same depth can be scanned according to the Z-scan order.

[0434] According to an embodiment, when at least one coding unit having a non-square shape exists in a reference coding unit, the video decoding apparatus 100 can divide each coding unit in the reference coding unit into a sub-block, and can scan the divided sub-blocks according to a Z-scan order. For example, when coding units having a non-square shape in a vertical direction or a horizontal direction exist in the reference coding unit, Z-scan can be performed by using the divided sub-blocks. Further, for example, when the reference coding unit is divided into an odd number of coding units, Z-scan can be performed by using sub-blocks. The sub-blocks are coding units that are no longer divided or are obtained by dividing an arbitrary coding unit, and can have a square shape. For example, four sub-blocks having a square shape can be divided from a coding unit having a square shape. Further, for example, two sub-blocks having a square shape can be divided from a coding unit having a non-square shape.

[0435] Referring to Figure 32 For example, the video decoding apparatus 100 according to an embodiment can scan lower depth coding units 2302, 2304, 2306, 2308, and 2310 in a coding unit 2300 according to a zigzag scan order. The coding unit 2300 and the coding units 2302, 2304, 2306, 2308, and 2310 are upper and lower coding units, respectively. The coding unit 2300 includes the coding units 2306 and 2310 having a non-square shape in a horizontal direction. The coding units 2306 and 2310 having the non-square shape have discontinuous boundaries with the coding units 2302 and 2304 having a square shape and being adjacent to each other. Also, the coding unit 2308 has a square shape and is a coding unit at the center when the coding units having the non-square shape are divided into an odd number of coding units. Similar to the coding units 2306 and 2310 having the non-square shape, the coding unit 2308 has discontinuous boundaries with the coding units 2302 and 2304 having the square shape and being adjacent to each other. When the coding unit 2300 includes the coding units 2306 and 2310 having the non-square shape or the coding unit 2308 at the center, a continuous zigzag scan index can not be set when the coding units having the non-square shape are divided into an odd number of coding units because adjacent boundaries between the coding units are discontinuous. Accordingly, the video decoding apparatus 100 can continuously set the zigzag scan index by dividing the coding units into sub-blocks. Also, the video decoding apparatus 100 can perform continuous zigzag scanning on the coding units 2306 and 2310 having the non-square shape or the coding unit 2308 at the center of the coding units having the non-square shape of an odd number.

[0436] By dividing the coding units 2302, 2304, 2306, 2308, and 2310 in the coding unit 2300 into sub-blocks, the coding unit 2320 of Figure 32 is obtained. Because the zigzag scan index can be set for each sub-block and adjacent boundaries between the sub-blocks are continuous, the sub-blocks can be scanned according to the zigzag scan order. For example, in the decoding apparatus according to an embodiment, the coding unit 2308 can be divided into sub-blocks 2322, 2324, 2326, and 2328. In this case, the sub-blocks 2322 and 2324 can be scanned after data processing is performed on the sub-block 2330, and the sub-blocks 2326 and 2328 can be scanned after data processing is performed on the sub-block 2332. Also, the sub-blocks can be scanned according to the zigzag scan order.

[0437] In the above embodiment, data units are scanned according to the zigzag scan order to perform data storage, data loading, and data access.

[0438] Further, in the above embodiments, although the data units are scanned according to the zigzag scan order, the scan order of the data units can be one of various orders such as a raster scan order, an N-zigzag scan order, an up-right diagonal scan order, a horizontal scan order, and a vertical scan order, and should not be limited to the zigzag scan order.

[0439] Further, in the above embodiments, although the coding units in the reference coding units are scanned, the present disclosure is not limited thereto, and the target to be scanned can be an arbitrary block in the processing block or the largest coding unit.

[0440] Further, in the above embodiments, although the blocks are divided into sub-blocks and the scan is performed according to the zigzag scan order only when there is at least one block having a non-square shape, for a simplified embodiment, the blocks can be divided into sub-blocks and the scan can be performed according to the zigzag scan order even when there is no block having a non-square shape.

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

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

[0443] 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 can be respectively performed on each coding unit. Further, according to an embodiment, a skip mode can be applied to the coding unit having a 2N×N shape or an N×2N shape.

[0444] The video decoding apparatus 100 according to the embodiment can allow bi-prediction to be performed in the skip mode of a coding unit having an 8x4 shape or a 4x8 shape. Since only the skip mode information about the coding unit is received in the skip mode, the use of residual data for the coding unit is omitted. Thus, in this case, the overhead of inverse quantization and inverse transformation can be reduced. In contrast, the video decoding apparatus 100 according to the embodiment can allow bi-prediction to be performed on a coding unit to which the skip mode is applied, thereby improving decoding efficiency. Further, the video decoding apparatus 100 according to the embodiment can set the number of interpolation taps to a relatively small value during motion compensation while allowing bi-prediction to be performed on a coding unit having an 8x4 shape or a 4x8 shape, thereby efficiently using a storage bandwidth. For example, an interpolation filter having a number of taps less than 8 (e.g., a 2-tap interpolation filter) can be used instead of an 8-tap interpolation filter.

[0445] Further, the video decoding apparatus 100 according to the embodiment can signal intra-prediction information or inter-prediction information about each region included in a current coding unit by dividing each region included in the current coding unit into a preset shape (e.g., diagonal-based division).

[0446] The video decoding apparatus 100 according to the embodiment can obtain a predicted sample of a current coding unit using an intra mode by using neighboring samples of the current coding unit. In this case, intra-prediction is performed by using the neighboring samples that are reconstructed in advance, and these samples are referred to as reference samples.

[0447] Figure 33 is a diagram of reference samples for intra-prediction of a coding unit according to the embodiment. Referring to Figure 33 For a coding unit 2400 having a non-square shape of a length of w in a horizontal direction and a length of h in a vertical direction, w+h top reference samples 2402, w+h left reference samples 2404, and one top-left reference sample 2406 are required, i.e., a total of 2(w+h)+1 reference samples are required. In order to prepare the reference samples, padding can be performed on a portion in which a reference sample does not exist, and a reference sample filtering process can be performed for each prediction mode to reduce quantization error included in the reconstructed reference samples.

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

[0449] The above various embodiments describe operations related to an image decoding method performed by the video decoding apparatus 100. Operations of a video encoding apparatus 200 for performing an image encoding method corresponding to inverse processing of the image decoding method will be described through various embodiments.

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

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

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

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

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

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

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

[0457] The video encoding apparatus 200 determines information about a division shape mode based on a shape of a coding unit. The video encoding apparatus 200 determines a context model based on at least one of a ratio or a size, a direction, a width, and a height of the shape of the coding unit. The video encoding apparatus 200 encodes information about the division shape mode used to divide the coding unit based on the context model into a bitstream.

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

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

[0460] Also, to determine the context model, the video encoding apparatus 200 can compare a length of a width of an upper neighboring coding unit with a length of a width of the coding unit. Also, the video encoding apparatus 200 can compare a length of a height of a left neighboring coding unit and a right neighboring coding unit with a length of a height of the coding unit. Also, the video encoding apparatus 200 can determine the context model based on a result of the comparison.

[0461] The operation of the video encoding apparatus 200 is similar to the operation of the video decoding apparatus 100 described with reference to Figures 13 to 33 The detailed description thereof is not provided here.

[0462] Embodiments can be implemented as a computer executable program and the program can be stored in a medium.

[0463] The medium can store the computer-executable program persistently or can temporarily store the computer-executable program to perform or download the computer-executable program. In addition, the medium can be any one of various recording devices or storage devices including a single hardware or a combination of multiple hardware, and can be distributed in a network, without being limited to a medium directly connected to a computer system. The medium can be configured to store program instructions, and examples of the medium can include a magnetic medium such as a hard disk, a floppy disk, or a magnetic tape, an optical recording medium such as a compact disk read only memory (CD-ROM) or a digital versatile disk (DVD), a magneto-optical medium such as a floptical disk, a ROM, a random access memory (RAM), and a flash memory. In addition, other examples of the medium can include a recording medium and a storage medium managed by an application store distributing an application or a site or a server providing or distributing various other software.

[0464] While the disclosure has been particularly shown and described with reference to embodiments thereof, it will be understood by those of ordinary skill in the art that various changes in form and details can be made therein without departing from the spirit and scope of the disclosure as defined by the following claims.

Claims

1. A method for decoding motion vectors, the method comprising: Obtain information from the bitstream indicating the motion vector resolution of the current block among multiple motion vector resolutions; When information about a previously decoded block indicates first information, the positions of a plurality of candidate blocks corresponding to the plurality of motion vector resolutions are determined based on the first information, wherein the positions of the plurality of candidate blocks include a first position, and the positions of the plurality of candidate blocks are different from each other; When information about a previously decoded block indicates second information, the positions of multiple candidate blocks corresponding to the multiple motion vector resolutions are determined based on the second information, wherein the positions of the multiple candidate blocks include a second position, which is different from the first position; Determine whether the motion vector of one of the candidate blocks, which corresponds to the motion vector resolution of the current block, is available; When the motion vector of a candidate block is available, the motion vector prediction factor of the current block is obtained using the motion vector of the candidate block; Adjust the motion vector prediction factor of the current block using information indicating the motion vector resolution of the current block; The motion vector of the current block is obtained by using the adjusted motion vector prediction factor and the residual motion vector.

2. An apparatus for decoding motion vectors, the apparatus comprising: The acquirer is configured to obtain information from the bitstream indicating the motion vector resolution of the current block among multiple motion vector resolutions; The decoder is configured as follows: When information about a previously decoded block indicates first information, the positions of a plurality of candidate blocks corresponding to the plurality of motion vector resolutions are determined based on the first information, wherein the positions of the plurality of candidate blocks include a first position, and the positions of the plurality of candidate blocks are different from each other; When information about a previously decoded block indicates second information, the positions of multiple candidate blocks corresponding to the multiple motion vector resolutions are determined based on the second information, wherein the positions of the multiple candidate blocks include a second position, which is different from the first position; Determine whether the motion vector of one of the candidate blocks, which corresponds to the motion vector resolution of the current block, is available; When the motion vector of a candidate block is available, the motion vector prediction factor of the current block is obtained using the motion vector of the candidate block; Adjust the motion vector prediction factor of the current block using information indicating the motion vector resolution of the current block; The motion vector of the current block is obtained by using the adjusted motion vector prediction factor and the residual motion vector.

3. A method for encoding motion vectors, the method comprising: Determine the motion vector resolution of the current block among multiple motion vector resolutions; When information about previously encoded blocks is generated to indicate first information, the positions of multiple candidate blocks corresponding to the multiple motion vector resolutions are determined based on the first information, wherein the positions of the multiple candidate blocks include a first position, and the positions of the multiple candidate blocks are different from each other; When information about previously encoded blocks is generated to indicate second information, the positions of multiple candidate blocks corresponding to the multiple motion vector resolutions are determined based on the second information, wherein the positions of the multiple candidate blocks include a second position, which is different from the first position; Determine whether the motion vector of one of the candidate blocks, which corresponds to the motion vector resolution of the current block, is available; When the motion vector of a candidate block is available, the motion vector prediction factor of the current block is obtained using the motion vector of the candidate block; Adjust the motion vector prediction factor of the current block using information indicating the motion vector resolution of the current block; The residual motion vector of the current block is obtained by using the adjusted motion vector predictor and the motion vector of the current block; and Generate a bitstream that includes information indicating the motion vector resolution of the current block.

4. An apparatus for encoding motion vectors, the apparatus comprising: The encoder is configured as follows: Determine the motion vector resolution of the current block among multiple motion vector resolutions; When information about previously encoded blocks is generated to indicate first information, the positions of multiple candidate blocks corresponding to the multiple motion vector resolutions are determined based on the first information, wherein the positions of the multiple candidate blocks include a first position, and the positions of the multiple candidate blocks are different from each other; When information about previously encoded blocks is generated to indicate second information, the positions of multiple candidate blocks corresponding to the multiple motion vector resolutions are determined based on the second information, wherein the positions of the multiple candidate blocks include a second position, which is different from the first position; Determine whether the motion vector of one of the candidate blocks, which corresponds to the motion vector resolution of the current block, is available; When the motion vector of a candidate block is available, the motion vector prediction factor of the current block is obtained using the motion vector of the candidate block; Adjust the motion vector prediction factor of the current block using information indicating the motion vector resolution of the current block; The residual motion vector of the current block is obtained by using the adjusted motion vector predictor and the motion vector of the current block; and The generator is configured to generate a bitstream that includes information indicating the motion vector resolution of the current block.

5. A method for transmitting a bit stream, wherein, The bit stream is generated by the method described in claim 3.

Citation Information

Patent Citations

  • Apparatus for encoding moving picture

    CN106851304A

  • Motion vector detecting apparatus and method

    CN1109243A