Inter-frame prediction method and device in video coding system

Through the inter-prediction method based on the affine motion model, image prediction is performed using the control point motion vector of the current block and the sample unit motion vector, which solves the problem of high-resolution image transmission and storage costs, improves compilation efficiency and reduces data volume.

CN114866771BActive Publication Date: 2025-08-22NOKIA TECHNOLOGIES OY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210527386.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2015-08-07
Filing Date
2016-07-15
Publication Date
2025-08-22
Estimated Expiration
2036-07-15

AI Technical Summary

Technical Problem

The transmission and storage cost of high resolution and high-quality images is high, and it is difficult for the prior art to effectively compress image data.

Method used

Using an inter prediction method based on an affine motion model, by deriving the control point motion vector of the current block, using the sample unit motion vector for prediction, reducing the amount of data of the control point motion vector, and performing effective inter prediction under the situation of image rotation, enlarging, decreasing or deformation.

Benefits of technology

It improves inter prediction efficiency, reduces the amount of data of residual signals, and improves the overall compilation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114866771B_ABST
    Figure CN114866771B_ABST
Patent Text Reader

Abstract

The present invention relates to an inter-frame prediction method and apparatus in a video coding system. The video decoding method performed by the decoding apparatus according to the present invention includes the following steps: deriving a control point (CP) for a current block; obtaining a motion vector for the CP; deriving a sample-by-sample motion vector in the current block based on the obtained motion vector; and deriving prediction samples for the current block based on the sample-by-sample motion vector. According to the present invention, inter-frame prediction can be efficiently performed using sample-by-sample motion vectors, not only when the image in the current block is planarly displaced, but also when various image distortions are present.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the patent application with application number 201680055123.2 (PCT / KR2016 / 007734) filed on March 22, 2018, with an international application date of July 15, 2016, and the invention name is “Inter-frame prediction method and device in video coding system”. Technical Field

[0002] The present invention relates to a video coding technology, and more particularly, to an inter-frame prediction method and apparatus in a video coding system. Background Art

[0003] Demand for high-resolution, high-quality images, such as HD (High Definition) and UHD (Ultra High Definition), is increasing across various fields. Because image data has high resolution and high quality, the amount of information, or bits, required to be transmitted increases compared to conventional image data. Consequently, when image data is transmitted using media such as conventional wired / wireless broadband lines or stored using existing storage media, transmission and storage costs increase.

[0004] Therefore, there is a need for efficient image compression technology for effectively transmitting, storing, and reproducing information of high-resolution and high-quality images. Summary of the Invention

[0005] Technical Purpose

[0006] The present invention provides a method and apparatus for enhancing image coding efficiency.

[0007] Another technical purpose of the present invention is to provide an inter-frame prediction method and device based on an affine motion model.

[0008] Another technical objective of the present invention is to provide a method and apparatus for performing inter-frame prediction based on sample-unit motion vectors.

[0009] Another technical objective of the present invention is to provide a method and device for deriving a motion vector of a sample unit based on a motion vector of a control point of a current block.

[0010] Another technical objective of the present invention is to provide a method and apparatus for deriving a motion vector of a control point of a current block that is a non-square block based on samples of neighboring blocks.

[0011] Another technical object of the present invention is to provide a method and apparatus for deriving a motion vector of a control point of a current block based on a motion vector of a control point of a previously decoded neighboring block.

[0012] Technical Solution

[0013] In one aspect, a video decoding method performed by a decoding device is provided. The decoding method includes: deriving a control point (CP) for a current block; obtaining a motion vector for the CP; deriving a sample-unit motion vector in the current block based on the obtained motion vector; and deriving a prediction sample for the current block based on the sample-unit motion vector.

[0014] In another aspect, a decoding device for performing video decoding is provided. The decoding device includes: a decoding unit that obtains prediction mode information about a current block from a bitstream; a prediction unit that derives a control point (CP) about the current block; obtains a motion vector about the CP; derives a sample-unit motion vector in the current block based on the obtained motion vector; and derives a prediction sample about the current block based on the sample-unit motion vector; and an adder that generates a reconstructed sample based on the prediction sample.

[0015] On the other hand, a video encoding method performed by an encoding device is provided. The video encoding method includes: deriving a driving control point (CP) for a current block; obtaining a motion vector for the CP; deriving a sample-unit motion vector in the current block based on the obtained motion vector; generating a prediction sample for the current block based on the sample-unit motion vector; and encoding prediction mode information for the current block and outputting the encoded prediction mode information.

[0016] On the other hand, an encoding device for performing video encoding is provided. The encoding device includes: a prediction unit that determines a prediction mode for a current block, derives a control point (CP) for the current block, obtains a motion vector for the CP, derives a sample-unit motion vector in the current block based on the obtained motion vector, and generates a prediction sample for the current block based on the sample-unit motion vector; and an encoding unit that encodes prediction mode information for the current block and outputs the encoded prediction mode information.

[0017] Beneficial effects

[0018] According to the present invention, a more accurate sample-based motion vector of the current block can be derived, and thus inter prediction efficiency can be significantly improved.

[0019] According to the present invention, the motion vectors of samples in the current block can be efficiently derived based on the motion vectors of the control points of the current block.

[0020] According to the present invention, without separately transmitting information about the motion vector of the control point of the current block, the motion vector of the control point of the current block can be derived based on the motion vector of the control point of the previously decoded neighboring block. Therefore, the amount of data of the motion vector of the control point can be eliminated or reduced, and the overall coding efficiency can be improved.

[0021] According to the present invention, even when the image in the current block is rotated, enlarged, reduced, or deformed into a parallelogram, and the image of the current block is plane-shifted, inter-frame prediction is effectively performed using a sample-unit motion vector. Therefore, the amount of data of the residual signal of the current block can be eliminated or reduced, and the overall coding efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 is a block diagram schematically illustrating a video encoding apparatus according to an embodiment of the present invention.

[0023] Figure 2 is a block diagram schematically illustrating a video decoding apparatus according to an embodiment of the present invention.

[0024] Figure 3 is a view illustrating a configuration in which a prediction block is generated in inter prediction to which a translational motion model is applied.

[0025] Figure 4 is a view illustrating a configuration in which a prediction block is generated in inter prediction to which an affine motion model is applied.

[0026] Figure 5 is a view illustrating a state in which a prediction block and a motion vector of inter prediction to which an affine motion model is applied are generated.

[0027] Figure 6 is a view illustrating a CP of a PU partitioned from a CU based on a partition type 2Nx2N.

[0028] Figure 7 is a view illustrating a CP of a PU partitioned from a CU based on a partition type Nx2N.

[0029] Figure 8 is a view illustrating a CP of a PU partitioned from a CU based on a partition type 2NxN.

[0030] Figure 9 is a diagram illustrating a CP of an asymmetric PU.

[0031] Figure 10 is a view illustrating motion information prediction candidates of a CP of a PU to which a partition type 2Nx2N is applied.

[0032] Figure 11 An example of motion information prediction candidates of a CP of a PU to which a partition type 2NxN is applied is illustrated.

[0033] Figure 12 is a view illustrating a configuration in which prediction candidates of a CP of a PU to which a partition type 2NxN is applied are limited to two prediction candidates.

[0034] Figure 13is a view illustrating motion information prediction candidates of a CP of a PU to which a partition type Nx2N is applied.

[0035] Figure 14 is a view illustrating a configuration in which prediction candidates of a CP of a PU to which a partition type Nx2N is applied are limited to two prediction candidates.

[0036] Figure 15 is a view illustrating motion information prediction candidates of a CP of an asymmetric PU.

[0037] Figure 16 is a view illustrating a configuration in which prediction candidates for the CP of an asymmetric PU are limited to two prediction candidates.

[0038] Figure 17 is a view illustrating a PU including a CP requiring motion information coding and a CP not requiring motion information coding.

[0039] Figure 18 is a view illustrating a PU including a CP that does not require motion information coding.

[0040] Figure 19 is a view schematically illustrating a video encoding method of an encoding apparatus according to the present invention.

[0041] Figure 20 is a view schematically illustrating a video decoding method of a decoding apparatus according to the present invention. DETAILED DESCRIPTION

[0042] The present invention can be modified in various forms, and specific embodiments thereof will be described and illustrated in the accompanying drawings. However, the embodiments are not intended to limit the present invention. The terms used in the following description are only used to describe specific embodiments, but are not intended to limit the present invention. Singular expressions include plural expressions as long as they are clearly understood differently. Terms such as "including" and "having" are intended to indicate the presence of features, numbers, steps, operations, elements, components or combinations thereof used in the following description, and therefore, it should be understood that the possibility of the presence or addition of one or more different features, numbers, steps, operations, elements, components or combinations thereof is not excluded.

[0043] On the other hand, in order to facilitate explanation of different specific functions in the image encoding / decoding device, the elements in the drawings described in the present invention are drawn independently, but this does not mean that the elements are implemented by independent hardware or independent software. For example, two or more elements in the elements can be combined to form a single element, or an element can be divided into multiple elements. Without departing from the concept of the present invention, embodiments in which elements are combined and / or divided fall within the scope of the present invention.

[0044] Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings.

[0045] Figure 1 is a block diagram illustrating a video encoding apparatus according to an embodiment of the present invention.

[0046] refer to Figure 1 The video encoding device 100 includes a picture segmentation module 105, a prediction module 110, a transformation module 120, a quantization module 125, a rearrangement module 130, an entropy coding module 135, a dequantization module 140, an inverse transformation module 145, a filtering module 155 and a memory 160.

[0047] The picture segmentation module 105 can be configured to segment the input picture into at least one processing unit block. In this regard, the block as a processing unit can be a prediction unit PU, a transform unit TU or a coding unit CU. The picture can be composed of multiple coding tree units CTU. Each CTU can be segmented into CUs as a quadtree structure. The CU can be segmented into CUs with a deeper depth as a quadtree structure. The PU and TU can be obtained from the CU. For example, the PU can be segmented into a symmetric or asymmetric square structure from the CU. In addition, the TU can be segmented into a quadtree structure from the CU. The CTU can correspond to a coding tree block CTB, the CU can correspond to a coding block CB, the PU can correspond to a prediction block PB and the TU can correspond to a transform block TB.

[0048] The prediction module 110 includes an inter-frame prediction unit that performs an inter-frame prediction process and an intra-frame prediction unit that performs an intra-frame prediction process, which will be described later. The prediction module 110 performs a prediction process on the processing unit of the picture segmented by the picture segmentation module 105 to create a prediction block including a prediction sample or a prediction sample array. In the prediction module 110, the processing unit of the picture can be a CU, TU, or PU. The prediction module 110 can determine whether the prediction performed on the corresponding processing unit is inter-frame prediction or intra-frame prediction, and can determine specific details, such as the prediction mode of the prediction method. The processing unit undergoing the prediction process may be different from the processing unit that determines the prediction method and specific details. For example, the prediction method and prediction mode can be determined in units of PUs, and the prediction process can be performed in units of TUs.

[0049] In inter prediction, a prediction process is performed based on information about at least one of a previous picture and / or a subsequent picture of a current picture to create a prediction block. In intra prediction, a prediction process may be performed based on pixel information of a current picture to create a prediction block.

[0050] As inter-frame prediction methods, skip mode, merge mode, and advanced motion vector prediction (AMVP) can be used. In inter-frame prediction, a reference picture can be selected for the PU, and a reference block corresponding to the PU can be selected. The reference block can be selected based on integer pixels (or samples) or fractional pixels (or samples). Then, a prediction block is generated in which the residual signal related to the PU is minimized and the motion vector amplitude is also minimized. Pixels, pels, and samples can be used interchangeably here.

[0051] The prediction block may be generated as an integer pixel unit, or may be generated as a fractional pixel unit such as a 1 / 2 pixel unit or a 1 / 4 pixel unit. In this regard, a motion vector may also be expressed as a fractional pixel unit.

[0052] Information such as the index of the reference picture selected via inter-frame prediction, the motion vector difference MDV, the motion vector predictor MVP, the residual signal, etc. can be entropy encoded and then transmitted to the decoding device. When skip mode is applied, the prediction block can be used as a reconstructed block so that the residual may not be generated, transformed, quantized, or transmitted.

[0053] When performing intra prediction, the prediction mode may be determined in PU units and the prediction process may be performed in PU units. Alternatively, the prediction mode may be determined in PU units and inter prediction may be performed in TU units.

[0054] As an example, the prediction modes in intra prediction may include 33 directional prediction modes and at least two non-directional modes. The non-directional modes may include a DC prediction mode and a planar mode.

[0055] In intra prediction, a prediction block can be configured after applying a filter to a reference sample. At this time, whether the filter should be applied to the reference sample can be determined according to the intra prediction mode and / or the size of the current block.

[0056] The residual value (residual block or residual signal) between the constructed prediction block and the original block is input to the transform module 120. Prediction mode information, motion vector information, etc. used for prediction are encoded together with the residual value through the entropy encoding module 135 and sent to the decoding device.

[0057] The transform module 120 performs a transform process on the residual block in units of TUs and generates transform coefficients.

[0058] A transform block is a rectangular block of samples and is a block to which the same transform is applied. A transform block may be a TU and may have a quadtree structure.

[0059] The transform module 120 may perform a transform process according to a prediction mode applied to the residual block and the size of the block.

[0060] For example, when intra prediction is applied to the residual block and the residual block has a 4×4 array, the residual block is transformed using discrete sine transform (DST). Otherwise, the residual block may be transformed using discrete cosine transform (DCT).

[0061] The transform module 120 may construct a transform block of transform coefficients through transformation.

[0062] The quantization module 125 may quantize the residual value transformed by the transform module 120 , ie, the transform coefficient, and may create a quantized coefficient. The value calculated by the quantization module 125 may be supplied to the dequantization module 140 and the rearrangement module 130.

[0063] The rearrangement module 130 may rearrange the transform coefficients supplied from the quantization module 125. By rearranging the quantization coefficients, encoding efficiency in the entropy encoding module 135 can be enhanced.

[0064] The rearrangement module 130 may rearrange the quantized transform coefficients in the form of a two-dimensional block into the form of a one-dimensional vector by using a coefficient scanning method.

[0065] The entropy encoding module 135 may be configured to entropy encode the symbols according to a probability distribution based on the quantized transform values ​​rearranged by the rearrangement module 130 or the encoding parameter values ​​calculated during the encoding process, and then output a bitstream. The entropy encoding method is a method of receiving symbols having various values ​​and expressing the symbols as a binary string that can be decoded while removing its statistical redundancy.

[0066] In this context, the symbols refer to syntax elements, coding parameters, residual signal values, etc. to be encoded / decoded. Coding parameters are necessary for encoding and decoding. Coding parameters can include information that can be inferred during encoding or decoding, as well as information that is encoded in the encoding device and passed to the decoding device, just like syntax elements. Coding parameters are information required to encode or decode an image. Coding parameters can include statistics or values ​​such as intra / inter prediction mode, motion / motion vectors, reference picture indexes, coding block patterns, the presence or absence of residual signals, transform coefficients, quantized transform coefficients, quantization parameters, block size, block partitioning information, etc. In addition, the residual signal can refer to the difference between the original signal and the predicted signal. Furthermore, the difference between the original signal and the predicted signal can be transformed to define the residual signal, or the difference between the original signal and the predicted signal can be transformed and quantized to define the residual signal. The residual signal can be referred to as a residual block in block units and as a residual sample in sample units.

[0067] When entropy coding is applied, symbols can be expressed so that a small number of bits are allocated to symbols with a high probability of occurrence, and a large number of bits are allocated to symbols with a low probability of occurrence. This can reduce the size of the bit string of the symbol to be encoded. Therefore, the compression performance of image encoding can be improved through entropy coding.

[0068] Coding schemes such as exponential Golomb codes, context-adaptive variable length coding (CAVLC), and context-adaptive binary arithmetic coding (CABAC) may be used for entropy coding. For example, the entropy coding module 135 may store therein a table for performing entropy coding, such as a variable length coding / code (VLC) table. The entropy coding module 135 may use the stored VLC table to perform entropy coding. In addition, the entropy coding module 135 derives a binarization method for the corresponding symbol and a probability model for the corresponding symbol / bin, and then performs entropy coding using the derived binarization method or probability model.

[0069] If necessary, the entropy encoding module 135 may give predetermined changes to a parameter set or syntax to be transmitted.

[0070] The dequantization module 140 dequantizes the value transform coefficients quantized by the quantization module 125. The inverse transform module 145 inversely transforms the values ​​dequantized by the dequantization module 140.

[0071] The residual values ​​or residual samples or residual sample arrays generated by the dequantization module 140 and the inverse transform module 145 and the prediction block predicted by the prediction module 110 may be combined to form a reconstructed block including reconstructed samples or a reconstructed sample array.

[0072] exist Figure 1 In

[15] , the residual block and the prediction block are added by an adder to create a reconstructed block. In this case, the adder can be considered as a specific unit for generating a reconstructed block, namely a reconstructed block creation unit.

[0073] The filtering module 155 applies a deblocking filter, an ALF adaptive loop filter, and an SAO sample adaptive offset to the reconstructed picture.

[0074] The deblocking filter removes block distortion generated at the boundaries between blocks in the reconstructed picture. The ALF performs the filtering process based on the comparison results between the original image and the reconstructed image after the blocks have been filtered by the deblocking filter. The ALF should only be used when high efficiency is required. SAO reconstruction uses the offset difference between the residual block with the deblocking filter applied and the original picture, and SAO is applied in the form of band offset, edge offset, etc.

[0075] The memory 160 may store the reconstructed block or picture calculated by the filtering module 155. The reconstructed block or picture stored in the memory 160 may be supplied to the prediction module 110 that performs inter prediction.

[0076] Figure 2 is a block diagram schematically illustrating a video decoding apparatus according to an embodiment of the present invention. Figure 2 , the video decoding apparatus 200 may include an entropy decoding module 210 , a rearrangement module 215 , a dequantization module 220 , an inverse transform module 225 , a prediction module 230 , a filtering module 235 and a memory 240 .

[0077] When a video bitstream is input from a video encoding apparatus, the input bitstream may be decoded based on an order in which the video encoding apparatus processes video information.

[0078] The entropy decoding module 210 performs entropy decoding on the input bitstream according to a probability distribution to generate symbols in the form of quantized coefficients. The entropy decoding method is a method that receives a series of binary numbers and uses the sequence to generate each symbol. The entropy decoding method is similar to the entropy encoding method described above.

[0079] For example, when variable length coding VLC (hereinafter referred to as "VLC") such as CAVLC is used to perform entropy coding in the video encoding device, the entropy decoding module 210 can perform decoding using the same VLC table as the VLC table used in the encoding device. In addition, when CABAC is used to perform entropy coding in the video encoding device, the entropy decoding module 210 can perform entropy decoding using CABAC.

[0080] More specifically, the CABAC entropy decoding method may include: receiving a bin corresponding to each syntax element in a bitstream, determining a context model using information about the syntax element to be decoded, decoding information about adjacent blocks and the block to be decoded, or information about the symbol / bin decoded in the previous step, and predicting the probability of occurrence of the bin based on the determined context model and thereby performing arithmetic decoding of the bin to generate a symbol corresponding to the value of each syntax element. In this regard, after determining the context model, the CABAC entropy decoding method may further include a step of updating the context model using information about the decoded symbol / bin to determine a context model for the next symbol / bin.

[0081] Information for constructing a prediction block from information decoded by the entropy decoding module 210 may be supplied to the prediction module 230 , and a residual value entropy-decoded by the entropy decoding module 210 , that is, a quantized transform coefficient may be input to the rearrangement module 215 .

[0082] The rearrangement module 215 may rearrange the bitstream information, ie, the quantized transform coefficients, entropy-decoded by the entropy decoding module 210 based on a rearrangement method in the video encoding apparatus.

[0083] The rearrangement module 215 may reconstruct and rearrange the coefficients expressed in the form of a one-dimensional vector into coefficients in the form of a two-dimensional block. The rearrangement module 215 may scan the coefficients based on the prediction mode applied to the current block transform block and the size of the transform block, and may create an array of coefficient quantized transform coefficients in the form of a two-dimensional block.

[0084] The dequantization module 220 may perform dequantization based on a quantization parameter supplied from the video encoding apparatus and coefficient values ​​of the rearranged block.

[0085] The inverse transform module 225 may perform inverse DCT and / or inverse DST of DCT and / or DST that have been performed by the transform module of the video encoding device on the quantization result from the video encoding device.

[0086] The inverse transform may be performed based on the transmission unit or the partition unit of the picture determined by the video encoding device. The transform module of the video encoding device may selectively perform DCT and / or DST based on multiple pieces of information such as the prediction method, the size of the current block, and the prediction direction, and the inverse transform module 225 of the video decoding device may perform inverse transform based on the transform information about the transform performed by the transform module of the video encoding device.

[0087] The prediction module 230 generates a prediction block 240 including a prediction sample or a prediction sample array based on the prediction block generation related information provided by the entropy decoding module 210 and a previously decoded block and / or picture information provided from a memory.

[0088] If the prediction mode for the current PU is an intra prediction mode, the prediction module 230 may perform intra prediction to generate a prediction block based on pixel information in the current picture.

[0089] If the prediction mode for the current PU is the inter prediction mode, the prediction module 230 may be configured to perform inter prediction on the current PU based on information included in at least one picture from a previous picture or a subsequent picture to the current picture. In this regard, information about motion information necessary for inter prediction of the current PU provided in the video encoding device, such as a motion vector and a reference picture index, may be inferred by checking a skip flag and a merge flag received from the encoding device.

[0090] When inter prediction is performed on the current picture, the prediction module 230 may generate a prediction block such that a residual signal with respect to the current block is minimized and the size of a motion vector is minimized.

[0091] On the other hand, the motion information derivation method may be changed according to the prediction mode of the current block. The prediction modes applied to inter prediction may include Advanced Motion Vector Prediction (AMVP) mode, Merge mode, and the like.

[0092] For example, when the merge mode is applied, the encoding device and the decoding device can use the motion vector of the reconstructed spatial neighboring block and / or the motion vector corresponding to the Col block as the temporal neighboring block to generate a merge candidate list. In the merge mode, the motion vector of the candidate block selected in the merge candidate list is used as the motion vector of the current block. The encoding device can send a merge index indicating the candidate block with the best motion vector selected from the candidate blocks included in the merge candidate list to the decoding device. In this case, the decoding device can use the merge index to derive the motion vector of the current block.

[0093] In another example, when the AMVP (Advanced Motion Vector Prediction) mode is applied, the encoding device and the decoding device use the motion vectors of the reconstructed spatially neighboring blocks and / or the motion vectors corresponding to the Col blocks as the temporally neighboring blocks to generate a motion vector predictor candidate list. That is, the motion vectors of the reconstructed spatially neighboring blocks and / or the motion vectors corresponding to the Col blocks as the temporally neighboring blocks can be used as motion vector candidates. The encoding device can send a predicted motion vector index indicating the optimal motion vector selected from the motion vector candidates included in the motion vector predictor candidate list to the decoding device. In this regard, the decoding device can use the motion vector index to select a predicted motion vector for the current block from the motion vector candidates included in the motion vector candidate list.

[0094] The encoding device may obtain a motion vector difference MVD between the motion vector of the current block and the motion vector predictor (MVP), encode the MVD, and transmit the encoded MVD to the decoding device. That is, the MVD may be a value obtained by subtracting the motion vector predictor (MVP) from the motion vector (MV) of the current block. In this regard, the decoding device may decode the received motion vector difference and derive the motion vector of the current block by adding the decoded motion vector difference to the motion vector predictor.

[0095] In addition, the encoding device may transmit a reference picture index indicating a reference picture to the decoding device.

[0096] The prediction module 230 of the decoding device can use the motion information of the neighboring blocks to predict the motion vector of the current block, and use the residual received from the encoding device to derive the motion vector of the current block. The decoding device can generate a prediction sample (or a predicted sample array) of the current block based on the derived motion vector and reference picture index information received from the encoding device.

[0097] The decoding device can generate reconstructed samples (or reconstructed sample arrays) by adding the predicted samples (or predicted sample arrays) obtained from the transform coefficients sent by the encoding device and the residual samples. Based on these reconstructed samples, reconstructed blocks and reconstructed pictures can be generated.

[0098] In the above-mentioned AMVP and merge modes, the motion information of the current block may be derived using the reconstructed motion information of the neighboring blocks and / or the motion information of the Col block.

[0099] In skip mode, which is one of the other modes for inter-picture prediction, neighboring block information can be used as is for the current block. Therefore, in skip mode, the encoding device does not transmit syntax information such as a residual to the decoding device except for information indicating which block's motion information is used as the motion information of the current block.

[0100] A reconstructed block may be generated using the prediction block generated by the prediction module 230 and the residual block provided by the inverse transform module 225 . Figure 2 The diagram illustrates the use of an adder to combine the prediction block and the residual block to generate a reconstructed block. In this regard, the adder can be considered a separate module (reconstruction block generation module) configured to generate a reconstructed block. In this regard, the reconstructed block includes the reconstructed samples or reconstructed sample arrays described above; the prediction block includes the prediction samples or the prediction sample arrays; and the residual block includes the residual samples or the residual sample arrays. Therefore, it can be considered that the reconstructed samples or the reconstructed sample arrays are generated by combining the corresponding prediction samples or the prediction sample arrays with the corresponding residual samples or the residual sample arrays.

[0101] When skip mode is used for a block, a residual signal may not be transmitted and the predicted block may be used as a reconstructed block.

[0102] The reconstructed block and / or picture may be supplied to the filtering module 235. The filtering module 235 may perform a deblocking filtering operation, an SAO operation, and / or an ALF operation on the reconstructed block and / or picture.

[0103] The memory 240 may store the reconstructed picture or block to be used as a reference picture or a reference block, and may supply the reconstructed picture to the output unit.

[0104] Elements directly related to the decoded image among the entropy decoding module 210, the rearrangement module 215, the dequantization module 220, the inverse transform module 225, the prediction module 230, the filtering module 235 and the memory 240 included in the decoding device 200, for example, the entropy decoding module 210, the rearrangement module 215, the dequantization module 220, the inverse transform module 225, the prediction module 230, the filtering module 235, etc. can be expressed as a decoder or a decoding module distinguished from other elements.

[0105] In addition, the decoding device 200 may further include a parsing module (not shown in the drawings) that parses information related to the encoded image included in the bitstream. The parsing module may include the entropy decoding module 210 and may be included in the entropy decoding module 210. Such a parsing module may also be implemented as an element of the decoding module.

[0106] Inter-frame prediction can be performed on the current block taking into account the motion of the target object or image between pictures. However, existing inter-frame prediction methods are performed based on a method of compensating for translational motion (translational motion model). Because inter-frame prediction is performed by deriving a reference block that matches the current block based on a motion vector, the translational motion model can be called a block matching method. That is, in the method applied to existing inter-frame prediction and the translational motion model, all samples of the prediction unit (PU) have the same motion information.

[0107] Figure 3 is a view illustrating a manner in which a prediction block is generated from inter prediction to which a translational motion model is applied.

[0108] refer to Figure 3 , since all samples of a PU have the same motion information, prediction and compensation are performed in a limited form. Specifically, according to the translational motion model, the motion vector MV in the x-axis direction is used. x and the motion vector MV in the y-axis direction y An area having the same shape and size as those of a prediction block within a reference picture is designated as a prediction reference block, motion parameters for one motion vector are in units of PUs, and samples within the reference block are used as prediction samples of the prediction block. However, the application of the translational motion model has a limitation in that the prediction efficiency is reduced due to deformations such as enlargement, reduction, and rotation of the image. According to the present invention, it is possible to modify a process in which the same motion information is transmitted and derived in units of existing PUs so that samples in the PU can have different motion information. The prediction model according to the present invention may be referred to as a two-dimensional affine transformation method or an affine motion model. Inter-frame prediction using the affine motion model can be compared with Figure 4 Same as shown in the figure.

[0109] Figure 4 An example in which a prediction block is generated in inter prediction using an affine motion model is illustrated. Hereinafter, a current block may correspond to a PU.

[0110] refer to Figure 4, x and y represent the x-coordinate and y-coordinate of each sample in the current block, respectively. x' and y' represent the x-coordinate and y-coordinate of the corresponding sample in the reference picture corresponding to x and y, respectively. In this case, the area including the sample at the pointed sample position (x', y') may be referred to as a reference block or a reference area. In this case, the reference block may correspond to an area including an image transformed according to a rotational deformation, a shape deformation, a size deformation such as enlargement or reduction, etc. with respect to the image within the current block. Therefore, the size and shape of the reference block may be different from the size and shape of the current block. In Figure 5 The derivation in the figure is for Figure 4 The specific method of obtaining a different or unique motion vector for each sample in the current block is illustrated in FIG.

[0111] Figure 5 1 is a diagram illustrating a state in which a prediction block and a motion vector in inter-frame prediction using an affine motion model are generated. Figure 5 , shows the formula for deriving the motion vector when the affine motion model is applied. The motion vector can be derived based on the following equation.

[0112] [Equation 1]

[0113]

[0114] Here, v x represents the x component of the sample-unit motion vector for the (x, y) coordinate sample in the current block, and v y represents the y component of the sample-unit motion vector of the (x, y) coordinate sample in the current block. That is, (v x ,v y ) is a sample-unit motion vector for (x, y) coordinate samples. Here, a, b, c, d, e, and f represent parameters of an equation for deriving a sample-unit motion vector (motion information) for (x, y) coordinates from a control point (CP) of the current block. The CP may be expressed as a steered pixel. The parameters may be derived from the motion information of the CP of each PU sent in units of PUs. The equation for deriving the sample-unit motion vector derived from the motion information of the CP may be applied to each sample of each PU, or may be derived to the position of a predicted sample in a reference image based on the relative position of the x and y axes of each PU sample. Depending on the partitioning applied to the coding unit (CU), the asymmetric or symmetric type, the partition ID, etc., the sample-unit motion vector may be derived differently depending on the size of the PU. The reference image may be used as the basis for the derivation of the sample-unit motion vector derived from the motion information of the CP. Figures 6 to 16 Specific embodiments thereof are described.

[0115] Figure 6 is a view illustrating a CP of a PU partitioned from a CU based on a partition type of 2N×2N.

[0116] As shown in the above equation (1), the parameters of the equation for deriving the sample unit motion vector can be derived as different values ​​based on the motion vector of the CP of the current block. The CP can be three CPs. The CP can use the motion information of the CP at different positions according to the shape of the PU.

[0117] refer to Figure 6 , a method is shown for deriving the equation for the sample unit motion vector in a PU partitioned from a CU based on a partition type of 2N×2N. For example, the motion vector of the upper left sample in the PU can be referred to as V0. In addition, using the samples of the neighboring blocks adjacent to the PU, the motion vectors of each CP can be V1 and V2. That is, when the width and height of the PU are S and the coordinates of the upper left sample position of the PU are (xp, yp), the coordinates of CP0 among the CPs can be set to (xp, yp), the coordinates of CP1 can be set to (xp+S, yp), and the coordinates of CP2 can be set to (xp, yp+S). The motion vector of CP0 can be set to V0, the motion vector of CP1 can be set to V1, and the motion vector of CP2 can be V2. The motion vector of the CP can be used to derive the sample unit motion vector. The sample unit motion vector can be derived based on the following equation.

[0118] [Equation 2]

[0119]

[0120] Here, V x and V y Respectively represent the x component and y component of the motion vector of the sample of the (x, y) coordinate in the current block, Vx0 and Vy0 represent the x component and y component of the motion vector V0 for CP0, Vx1 and Vy1 represent the x component and y component of the motion vector V1 for CP1, and Vx2 and Vy2 represent the x component and y component of the motion vector V2 for CP2. According to the equation for deriving the sample-unit motion vector as in Equation 2, the motion vector can be derived based on the relative position of each sample in the PU partitioned from the CU based on the partition type 2N×2N.

[0121] Figure 7 The figure shows the CP of a PU partitioned from a CU based on the partition type N×2N. Figure 7, shows the process of deriving the motion vector of the PU partitioned from the CU based on the partition type Nx2N. The equation for deriving the sample unit motion vector in the PU can be derived by the same method as the method for the case of the aforementioned partition type 2N×2N. In the process of deriving the formula, the width value corresponding to the shape of the PU can be used. In order to derive the sample unit motion vector, three CPs can be derived, and the positions of the CPs can be adjusted, such as Figure 7 As shown in . That is, when the width and height of the PU are S / 2 and S, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), the coordinates of CP0 among the CPs are (xp, yp), the coordinates of CP1 may be (xp+S / 2, yp), and the coordinates of CP2 may be (xp, yp+S). The sample-unit motion vector may be derived based on the following equation.

[0122] [Equation 3]

[0123]

[0124] Here, V x and V y Vx0 and Vy0 represent the x and y components of the motion vector of the sample at the (x, y) coordinate in the current block, respectively. Vx0 and Vy0 represent the x and y components of the motion vector V0 for CP0, Vx1 and Vy1 represent the x and y components of the motion vector V1 for CP1, respectively. Vx2 and Vy2 represent the x and y components of the motion vector V2 for CP2, respectively. Equation 3 represents an equation for deriving a sample-unit motion vector considering that the width of the PU is S / 2. According to the equation for deriving a sample-unit motion vector as in Equation 3, a motion vector can be derived based on the relative position of each sample in the PU partitioned from the CU based on the partition type N×2N.

[0125] Figure 8 The figure shows the CP of the PU partitioned from the CU based on the partition type 2N×N. Figure 8 As shown in FIG, in order to derive the sample unit motion vector, three CPs can be derived, and can be as follows Figure 8 Adjust the position of CP as shown to Figure 8 The shape of the PU illustrated in FIG has its height adjusted to S / 2. That is, when the width and height of the PU are S and S / 2, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), the coordinates of CP0 among the CPs may be (xp, yp), the coordinates of CP1 may be (xp+S, yp), and the coordinates of CP2 may be (xp, yp+S / 2). The sample-unit motion vector can be derived based on the following equation.

[0126] [Equation 4]

[0127]

[0128] Here, V x and V y Vx0 and Vy0 represent the x and y components of the motion vector for the sample at the (x, y) coordinate in the current block, respectively. Vx0 and Vy0 represent the x and y components of the motion vector V0 for CP0, Vx1 and Vy1 represent the x and y components of the motion vector V1 for CP1, and Vx2 and Vy2 represent the x and y components of the motion vector V2 for CP2, respectively. Equation 4 represents an equation for deriving a sample-unit motion vector considering that the height of the PU is S / 2. According to the equation for deriving a sample-unit motion vector as in Equation 4, a motion vector can be derived based on the relative position of each sample in the PU used to partition the PU from the CU based on the partition type 2N×N.

[0129] Figure 9 The CP of an asymmetric PU is shown. An asymmetric PU may be a PU partitioned from a CU based on partition types nL×2N, nR×2N, 2N×nU, or 2N×nD.

[0130] like Figure 9 As shown in FIG, the width and height of the asymmetric PU may be W and H, respectively. In this case, the equation for deriving the sample-unit motion vector in the PU may be derived as follows. To derive the sample-unit motion vector, three CPs may be derived for each PU, and the following equations may be used: Figure 9 The shape of the PU illustrated in FIG adjusts the coordinates of the CP based on the width and height. That is, when the width and height of the PU are W and H and the coordinates of the upper left sample position of each PU are (xp, yp), the coordinates of CP0 among the CPs can be set to (xp, yp), the coordinates of CP1 can be set to (xp+W, yp), and the coordinates of CP2 can be set to (xp, yp+H). In this case, the sample-unit motion vector in the PU can be derived based on the following equation.

[0131] [Equation 5]

[0132]

[0133] Here, V x and V yVx0 and Vy0 represent the x and y components of the motion vector of the sample of the (x, y) coordinate in the current block, respectively, Vx1 and Vy1 represent the x and y components of the motion vector V0 for CP0, Vx1 and Vy1 represent the x and y components of the motion vector V1 for CP1, and Vx2 and Vy2 represent the x and y components of the motion vector V2 for CP2, respectively. Equation 5 represents an equation for deriving a sample-unit motion vector taking into account the width and height of an asymmetric Pus. According to the equation for deriving a sample-unit motion vector as in Equation 5, a motion vector can be derived based on the relative position of each sample in the PU for a PU partitioned from a CU based on partition types nL×2N, nR×2N, 2N×nU, or 2N×nD.

[0134] At the same time, according to the present invention, in order to reduce the motion information of CPs sent in units of PUs, for example, three CPs, a motion information prediction candidate for at least one CP can be selected based on the motion information of neighboring blocks or neighboring samples of the PU. The motion information prediction candidate can be referred to as a motion information candidate or a motion vector candidate.

[0135] Figure 10 The figure shows motion information prediction candidates for a CP of a PU with a partition type of 2N×2N. Figure 10 , showing a method for configuring motion information prediction candidates for CPs. The motion information of neighboring blocks (or neighboring samples) adjacent to each CP can be used as prediction candidates for the motion information of the three CPs. In addition, the motion information of neighboring samples adjacent to each CP can be used as motion information prediction candidates for each CP. For example, in the case of motion vector v0 of CP0, three pieces of motion information among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2. When the width and height of the PU are S and the coordinates of the upper left sample position of the PU are (xp, yp), A0 is the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, at least one of the motion vectors A0, A1, and A2 can be used as a prediction candidate for v0.

[0136] In addition, in the case of motion vector v1 of CP1, two pieces of motion information from among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are S and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the (xp+S-1, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+S-1, yp-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1.

[0137] Moreover, in the case of motion vector v2 of CP2, two pieces of motion information among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are S and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the motion vector of the sample of the (xp-1, yp+S) coordinates and C1 can represent the motion vector of the sample of the (xp-1, yp+S-1) coordinates. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0138] In this case, if the affine motion model is applied to the neighboring blocks including the sample at the corresponding position, the motion information of the prediction candidate position can be derived based on the motion vector of the sample at the corresponding position, and if the affine motion model is not applied to the neighboring blocks including the sample at the corresponding position, the motion information of the prediction candidate position can be derived based on the motion vector of the neighboring blocks including the sample at the corresponding position. This is in the following Figures 10 to 16 The same applies to the other remaining embodiments. Specifically, for example, when the affine motion model is applied to the neighboring block of the sample including the (xp-1, yp-1) coordinates, A0 can be derived based on the motion vector of the sample including the (xp-1, yp-1) coordinates, and when the affine motion model is not applied to the neighboring block of the sample including the (xp-1, yp-1) coordinates, A0 can be derived based on the motion vector block of the neighboring block of the sample including the (xp-1, yp-1) coordinates.

[0139] In this case, the number of prediction candidates for each CP in the figure can be used to distinguish between the prediction candidates or can indicate the priority order of the prediction candidates. For example, in the case of prediction candidates for CP0, A0 can have a higher priority than A1, and A1 can have a higher priority than A2. This is for the following Figures 11 to 16 The same applies to the remaining embodiments.

[0140] Figure 11 The figure shows motion information prediction candidates for a CP of a PU with a partition type of 2NxN. Figure 11 , shows a method for configuring motion information prediction candidates of CP. Figure 11 As illustrated in , prediction candidates for the motion vector of the CP may be configured in consideration of the fact that the PU does not have a square shape, and may be configured in consideration of the decoding process order of the PU.

[0141] The motion information of the neighboring blocks (or neighboring samples) adjacent to each CP can be used as prediction candidates for the motion information of the three CPs. When the affine motion model is applied to the neighboring blocks, the motion information of the neighboring samples adjacent to each CP can be used as the motion information prediction candidate for each CP. For example, in the case of the motion vector v0 of CP0, three pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1 and A2. When the width and height of the PU are S and S / 2 respectively and the coordinates of the upper left sample position of the PU are (xp, yp), A0 is the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, at least one of the motion vectors A0, A1 and A2 can be used as a prediction candidate for v0.

[0142] In addition, in the case of motion vector v1 of CP1, two pieces of motion information from among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are S and S / 2, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the motion vector of the sample of the (xp+S-1, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+S-1, yp-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1.

[0143] Moreover, in the case of motion vector v2 of CP2, two pieces of motion information among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are S and S / 2, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the (xp-1, yp+S / 2) coordinates, and C1 can represent the motion vector of the sample of the (xp-1, yp+S / 2-1) coordinates. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0144] In another embodiment, when the partition ID of the PU is 1, samples of the neighboring blocks of the current CU may be further included as prediction candidates for the motion vector v0 of CP0 and the motion vector v1 of CP1. For example, in the case of the motion vector v0 of CP0, the motion information of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) may be further included as prediction candidates. In detail, at least one of the three pieces of motion information of the neighboring samples may be further used as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the PU are S and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample of the (xc-1, yc) coordinates, A4 may represent the motion vector of the sample of the (xc-1, yc-1) coordinates, and A5 may represent the motion vector of the sample of the (xc, yc-1) coordinates. In this case, at least one of the motion vectors A3, A4, and A5 may be further used as a prediction candidate for v0.

[0145] Moreover, in the case of the motion vector v1 of CP1, the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as a prediction candidate. In detail, at least one of the three motion information of the neighboring samples can be further used as a prediction candidate, and the three motion information can be represented by B2, B3 and B4 respectively. When the width and height of the CU including the PU are S and the coordinates of the upper left sample position of the CU are (xc, yc), B2 can represent the motion vector of the sample of the (xc+S, yc) coordinates, B3 can represent the motion vector of the sample of the (xc+S-1, yc-1) coordinates, and B4 can represent the motion vector of the sample of the (xc+S-1, yc-1) coordinates. In this case, at least one of the motion vectors B2, B3 and B4 can be further used as a prediction candidate for v1.

[0146] In another embodiment, each PU included in the CU can use the same prediction candidate of the PU in the CU as a prediction candidate for the motion vector of the CP, regardless of the partition ID. For example, in the case of the motion vector v0 of the CP0 of each PU, three pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the CU are S and the coordinates of the upper left sample position of the CU are (xc, yc), A0 can represent the motion vector of the sample of the (xc-1, yc-1) coordinates, A1 can represent the motion vector of the sample of the (xc, yc-1) coordinates, and A2 can represent the motion vector of the sample of the (xc-1, yc) coordinates. In this case, at least one of the motion vectors A0, A1, and A2 can be used as a prediction candidate for v0.

[0147] In addition, in the case of the motion vector v1 of CP1 of each PU, two pieces of motion information from among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the CU are S and the coordinates of the upper left sample position of the CU are (xc, yc), B0 can represent the motion vector of the sample of the (xc+S, yc-1) coordinates, and B1 can represent the motion vector of the sample of the (xc+S-1, yc-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1.

[0148] Moreover, in the case of the motion vector v2 of CP2 of each PU, two pieces of motion information among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and these two pieces of motion information can be represented by C0 and C1 respectively. When the width and height of the CU are S and the coordinates of the upper left sample position of the CU are (xc, yc), C0 can represent the motion vector of the sample of the (xc-1, yc+S) coordinate and C1 can represent the motion vector of the sample of the (xc-1, yc+S-1) coordinate. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0149] As a method of configuring prediction candidates of a motion vector of a CP for a PU to which a 2N×N partition type is applied, the prediction candidates may be limited to a predetermined number so as to be configured.

[0150] Figure 12 The diagram illustrates a configuration in which prediction candidates for a CP of a PU to which a partition type 2N×N is applied are limited to two prediction candidates. Figure 12, the figure shows that a list of two samples including prediction candidates for each CP of the PU is configured. For example, in the case of the motion vector v0 of CP0, two pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by A0 and A1. When the width and height of the PU are S and S / 2 respectively and the coordinates of the upper left sample position of the PU are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates. In this case, A0 and A1 can be used as prediction candidates for v0.

[0151] Moreover, in the case of motion vector v1 of CP1, two pieces of motion information from among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are S and S / 2, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the motion vector of the sample of the (xp+S-1, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+S-1, yp-1) coordinates. In this case, motion vectors B0 and B1 can be used as prediction candidates for v1.

[0152] Moreover, in the case of motion vector v2 of CP2, two pieces of motion information among the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are S and S / 2, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the motion vector of the sample of the (xp-1, yp+S / 2) coordinates, and C1 can represent the motion vector of the sample of the (xp-1, yp+S / 2-1) coordinates. In this case, motion vectors C0 and C1 can be used as prediction candidates for v2.

[0153] Figure 13 The figure shows motion information prediction candidates for a CP of a PU with N×2N partition type applied. Figure 13 , shows a method for configuring motion information prediction candidates of CP. Figure 13 As illustrated in , prediction candidates for the motion vector of the CP may be configured in consideration of the fact that the PU does not have a square shape, and may be configured in consideration of the decoding process order of the PU.

[0154] like Figure 13As illustrated in , the coded motion information of the neighboring blocks (or neighboring samples) adjacent to each CP can be used as prediction candidates for the motion information of the three CPs. When the affine motion model is applied to the neighboring blocks, the motion information of the neighboring samples adjacent to each CP can be used as the motion information prediction candidate for each CP. For example, in the case of the motion vector v0 of CP0, three pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2. When the width and height of the PU are S / 2 and S respectively and the coordinates of the upper left sample position of the PU are (xp, yp), A0 is the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, at least one of the motion vectors A0, A1, and A2 can be used as a prediction candidate for v0.

[0155] Moreover, in the case of the motion vector v1 of CP1, two pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are S / 2 and S respectively and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the motion vector of the sample of the (xp+S / 2, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+S / 2-1, yp-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1. Moreover, when the partition ID of the PU is 0, the motion vector B2 of the sample of the (xp+S / 2+1, yp-1) coordinates and the motion vector B3 of the sample of the (xp+S / 2+2, yp-1) coordinates are further included as prediction candidates for v1.

[0156] In addition, in the case of motion vector v2 of CP2, two pieces of motion information among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are S / 2 and S, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the motion vector of the sample of the (xp-1, yp+S) coordinates, and C1 can represent the motion vector of the sample of the (xp-1, yp+S-1) coordinates. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0157] In another embodiment, when the partition ID of the PU is 1, samples of the neighboring blocks of the current CU may be further included as prediction candidates for the motion vector v0 of CP0 and the motion vector v2 of CP2. For example, in the case of the motion vector v0 of CP0, the motion information of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) may be further included as prediction candidates. In detail, at least one of the three pieces of motion information of the neighboring samples may be further used as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the PU are S and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample of the (xc-1, yc-1) coordinates, A4 may represent the motion vector of the sample of the (xc, yc-1) coordinates, and A5 may represent the motion vector of the sample of the (xc-1, yc) coordinates. In this case, at least one of the motion vectors A3, A4, and A5 may be further used as a prediction candidate for v0.

[0158] Moreover, in the case of the motion vector v2 of CP2, the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as a prediction candidate. In detail, at least one of the three motion information of the neighboring samples can be further used as a prediction candidate, and the three motion information can be represented by C2, C3 and C4 respectively. When the width and height of the CU including the PU are S and the coordinates of the upper left sample position of the CU are (xc, yc), C2 can represent the motion vector of the sample of the (xc-1, yc+S) coordinate, C3 can represent the motion vector of the sample of the (xc, yc+S) coordinate, and C4 can represent the motion vector of the sample of the (xc-1, yc+S-1) coordinate. In this case, at least one of the motion vectors C2, C3 and C4 can be further used as a prediction candidate for v2.

[0159] In another embodiment, each PU included in the CU can use the same prediction candidate of the PU in the CU as a prediction candidate for the motion vector of the CP, regardless of the partition ID. For example, in the case of the motion vector v0 of the CP0 of each PU, three pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the CU are S and the coordinates of the upper left sample position of the CU are (xc, yc), A0 can represent the motion vector of the sample of the (xc-1, yc-1) coordinates, A1 can represent the motion vector of the sample of the (xc, yc-1) coordinates, and A2 can represent the motion vector of the sample of the (xc-1, yc) coordinates. In this case, at least one of the motion vectors A0, A1, and A2 can be used as a prediction candidate for v0.

[0160] Furthermore, in the case of the motion vector v1 of CP1 of each PU, two pieces of motion information from among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the CU are S and the coordinates of the upper left sample position of the CU are (xc, yc), B0 can represent the motion vector of the sample of the (xc+S, yc-1) coordinates, and B1 can represent the motion vector of the sample of the (xc+S-1, yc-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1.

[0161] Moreover, in the case of the motion vector v2 of CP2 of each PU, two pieces of motion information among the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and these two pieces of motion information can be represented by C0 and C1 respectively. When the width and height of the CU are S and the coordinates of the upper left sample position of the CU are (xc, yc), C0 can represent the motion vector of the sample of the (xc-1, yc+S) coordinate and C1 can represent the motion vector of the sample of the (xc-1, yc+S-1) coordinate. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0162] As a method of configuring prediction candidates of a motion vector of a CP of a PU to which an N×2N partition type is applied, the prediction candidates may be limited to a predetermined number so as to be configured.

[0163] Figure 14 The diagram illustrates a configuration in which prediction candidates for a CP of a PU to which a partition type N×2N is applied are limited to two prediction candidates. Figure 14 , the illustrated configuration includes a list of two samples that are prediction candidates for each CP of the PU. For example, in the case of the motion vector v0 of CP0, two pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by A0 and A1. When the width and height of the PU are S / 2 and S respectively and the coordinates of the upper left sample position of the PU are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates. In this case, A0 and A1 can be used as prediction candidates for v0.

[0164] Moreover, in the case of motion vector v1 of CP1, two pieces of motion information from among the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are S / 2 and S, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the motion vector of the sample of the (xp+S / 2, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+S / 2-1, yp-1) coordinates. In this case, motion vectors B0 and B1 can be used as prediction candidates for v1.

[0165] Moreover, in the case of motion vector v2 of CP2, two pieces of motion information among the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are S / 2 and S, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the motion vector of the sample of the (xp-1, yp+S) coordinates, and C1 can represent the motion vector of the sample of the (xp-1, yp+S-1) coordinates. In this case, motion vectors C0 and C1 can be used as prediction candidates for v2.

[0166] Figure 15 The motion information prediction candidates of the CP of an asymmetric PU are shown. An asymmetric PU may be a PU partitioned from a CU based on partition types nL×2N, nR×2N, 2N×nU, or 2N×nD.

[0167] refer to Figure 15 (a) shows a method for configuring motion information prediction candidates for CPs of PUs with nL×2N partitioning types. Figure 15 As illustrated in (a) of FIG. 5 , prediction candidates for a motion vector of a CP may be configured in consideration of the fact that a PU does not have a square shape, and may be configured in consideration of a decoding process order of the PU.

[0168] like Figure 15As illustrated in (a), the coded motion information of the neighboring blocks (or neighboring samples) adjacent to each CP can be used as prediction candidates for the motion information of the three CPs. When the affine motion model is applied to the neighboring blocks, the motion information of the neighboring samples adjacent to each CP can be used as the motion information prediction candidate for each CP. For example, in the case of the motion vector v0 of CP0, three pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2. When the width and height of the PU are W and H respectively and the coordinates of the upper left sample position of the PU are (xp, yp), A0 is the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, at least one of the motion vectors A0, A1, and A2 can be used as a prediction candidate for v0.

[0169] Moreover, in the case of motion vector v1 of CP1, two pieces of motion information of the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the motion vector of the sample of the (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+W-1, yp-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1.

[0170] Moreover, in the case of motion vector v2 of CP2, two pieces of motion information among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the motion vector of the sample of the (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of the (xp-1, yp+H-1) coordinates. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0171] In another embodiment, when the partition ID of the PU is 1, samples of the neighboring blocks of the current CU may be further included as prediction candidates for the motion vector v0 of CP0 and the motion vector v2 of CP2. For example, in the case of the motion vector v0 of CP0, the motion information of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) may be further included as prediction candidates. In detail, at least one of the two motion information of the neighboring samples may be further used as a prediction candidate, and the two motion information may be represented by A3 and A4, respectively. When the width and height of the CU including the PU are H and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample of the (xc-1, yc-1) coordinates, and A4 may represent the motion vector of the sample of the (xc-1, yc) coordinates. In this case, at least one of the motion vectors A3 and A4 may be further used as a prediction candidate for v0.

[0172] Moreover, in the case of the motion vector v2 of CP2, the motion information of the previously decoded neighboring blocks (or neighboring samples) may be further included as prediction candidates. In detail, at least one of the two motion information of the neighboring samples may be further used as a prediction candidate, and the two motion information may be represented by C2 and C3, respectively. In the case where the width and height of the CU including the PU are H and the coordinates of the upper left sample position of the CU are (xc, yc), C2 may represent the motion vector of the sample of the (xc-1, yc+H) coordinates, and C3 may represent the motion vector of the sample of the (xc-1, yc+H-1) coordinates. In this case, at least one of the motion vectors C2 and C3 may be further used as a prediction candidate for v2.

[0173] refer to Figure 15 (b) shows a method for configuring prediction candidates for motion information of a CP of a PU to which a partition type nR×2N is applied. Considering the fact that the PU does not have a square shape, prediction candidates for the motion vector of the CP can be configured, and prediction candidate PUs for the motion vector of the CP can be configured in consideration of the PU decoding process order.

[0174] like Figure 15As illustrated in (b), the coded motion information of the neighboring blocks adjacent to each CP can be used as motion information prediction candidates for the three CPs. When the affine motion model is applied to the neighboring blocks, the motion information of the neighboring samples adjacent to each CP can be used as prediction candidates for the motion information of each CP. For example, in the case of the motion vector v0 of CP0, three pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1 and A2. When the width and height of the PU are W and H respectively and the coordinates of the upper left sample position of the PU are (xp, yp), A0 is the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, at least one of the motion vectors A0, A1 and A2 can be used as a prediction candidate for v0.

[0175] Moreover, in the case of motion vector v1 of CP1, two pieces of motion information of the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the motion vector of the sample of the (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+W-1, yp-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1.

[0176] Moreover, in the case of motion vector v2 of CP2, two pieces of motion information among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the motion vector of the sample of the (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of the (xp-1, yp+H-1) coordinates. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0177] In another embodiment, when the partition ID of the PU is 1, samples of the neighboring blocks of the current CU may be further included as prediction candidates for the motion vector v0 of CP0 and the motion vector v2 of CP2. For example, in the case of the motion vector v0 of CP0, the motion information of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) may be further included as prediction candidates. In detail, at least one of the three pieces of motion information of the neighboring samples may be further used as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the PU are H and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample of the (xc-1, yc-1) coordinates, A4 may represent the motion vector of the sample of the (xc, yc-1) coordinates, and A5 may represent the motion vector of the sample of the (xc-1, yc) coordinates. In this case, at least one of the motion vectors A3, A4, and A5 may be further used as a prediction candidate for v0.

[0178] In addition, in the case of motion vector v2 of CP2, the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as a prediction candidate. In detail, at least one of the three motion information of the neighboring samples can be further used as a prediction candidate, and the three motion information can be represented by C2, C3 and C4 respectively. When the width and height of the CU including the PU are H and the coordinates of the upper left sample position of the CU are (xc, yc), C2 can represent the motion vector of the sample of (xc-1, yc+H) coordinates, C3 can represent the motion vector of the sample of (xc, yc+H) coordinates, and C4 can represent the motion vector of the sample of (xc-1, yc+H-1) coordinates. In this case, at least one of the motion vectors C2, C3 and C4 can be further used as a prediction candidate for v2.

[0179] refer to Figure 15 (c) shows a method for configuring prediction candidates for motion information of a CP of a PU applying a partition type of 2N×nU. Figure 15 As illustrated in (c) , prediction candidates for the motion vector of the CP may be configured in consideration of the fact that the PU does not have a square shape, and may be configured in consideration of a decoding process order of the PU.

[0180] like Figure 15As illustrated in (c), the coded motion information of the neighboring blocks adjacent to each CP can be used as motion information prediction candidates for the three CPs. When the affine motion model is applied to the neighboring blocks, the motion information of the neighboring samples adjacent to each CP can be used as prediction candidates for the motion information of each CP. For example, in the case of the motion vector v0 of CP0, three pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1 and A2. When the width and height of the PU are W and H respectively and the coordinates of the upper left sample position of the PU are (xp, yp), A0 is the motion vector of the sample of (xp-1, yp-1), and A1 can represent the motion vector of the sample of (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of (xp-1, yp) coordinates. In this case, at least one of the motion vectors A0, A1 and A2 can be used as a prediction candidate for v0.

[0181] In addition, in the case of motion vector v1 of CP1, two pieces of motion information from among the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the motion vector of the sample of the (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+W-1, yp-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1.

[0182] In addition, in the case of motion vector v2 of CP2, two pieces of motion information from among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the motion vector of the sample of the (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of the (xp-1, yp+H-1) coordinates. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0183] In another embodiment, when the partition ID of the PU is 1, samples of the neighboring blocks of the current CU may be further included as prediction candidates for the motion vector v0 of CP0 and the motion vector v1 of CP1. For example, in the case of the motion vector v0 of CP0, the motion information of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) may be further included as prediction candidates. In detail, at least one of the two motion information of the neighboring samples may be further used as a prediction candidate, and the two motion information may be represented by A3 and A4, respectively. When the width and height of the CU including the PU are W and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample of the (xc-1, yc-1) coordinates, and A4 may represent the motion vector of the sample of the (xc, yc-1) coordinates. In this case, at least one of the motion vectors A3 and A4 may be further used as a prediction candidate for v0.

[0184] In addition, in the case of the motion vector v1 of CP1, the motion information of the previously decoded neighboring blocks (or neighboring samples) may be further included as prediction candidates. In detail, at least one of the two motion information of the neighboring samples may be further used as a prediction candidate, and the two motion information may be represented by B2 and B3, respectively. When the width and height of the CU including the PU are W and the coordinates of the upper left sample position of the CU are (xc, yc), B2 may represent the motion vector of the sample of the (xc+S, yc-1) coordinates, and B3 may represent the motion vector of the sample of the (xc+S-1, yc-1) coordinates. In this case, at least one of the motion vectors B2 and B3 may be further used as a prediction candidate for v1.

[0185] refer to Figure 15 (d) shows a method of configuring prediction candidates for motion information of a CP of a PU to which a partition type 2N×nD is applied. Figure 15 As illustrated in (d) , prediction candidates for the motion vector of the CP may be configured in consideration of the fact that the PU does not have a square shape, and may be configured in consideration of a decoding process order of the PU.

[0186] like Figure 15As illustrated in (d), the coded motion information of the neighboring blocks (or neighboring samples) adjacent to each CP can be used as prediction candidates for the motion information of the three CPs. When the affine motion model is applied to the neighboring blocks, the motion information of the neighboring samples adjacent to each CP can be used as the motion information prediction candidate for each CP. For example, in the case of the motion vector v0 of CP0, three pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1 and A2. When the width and height of the PU are W and H respectively and the coordinates of the upper left sample position of the PU are (xp, yp), A0 can be the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, at least one of the motion vectors A0, A1 and A2 can be used as a prediction candidate for v0.

[0187] In addition, in the case of motion vector v1 of CP1, two pieces of motion information of the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the motion vector of the sample of the (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+W-1, yp-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1.

[0188] In addition, in the case of motion vector v2 of CP2, two pieces of motion information from among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the motion vector of the sample of the (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of the (xp-1, yp+H-1) coordinates. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0189] In another embodiment, when the partition ID of the PU is 1, samples of the neighboring blocks of the current CU may be further included as prediction candidates for the motion vector v0 of CP0 and the motion vector v1 of CP1. For example, in the case of the motion vector v0 of CP0, the motion information of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) may be further included as prediction candidates. In detail, at least one of the three pieces of motion information of the neighboring samples may be further used as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the PU are W and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample of the (xc-1, yc) coordinates, A4 may represent the motion vector of the sample of the (xc-1, yc-1) coordinates, and A5 may represent the motion vector of the sample of the (xc, yc-1) coordinates. In this case, at least one of the motion vectors A3, A4, and A5 may be further used as a prediction candidate for v0.

[0190] Moreover, in the case of the motion vector v1 of CP1, the motion information of the previously decoded neighboring blocks (or neighboring samples) may be further included as prediction candidates. In detail, at least one of the three pieces of motion information of the neighboring samples may be further used as a prediction candidate, and the three pieces of motion information may be represented by B2, B3, and B4, respectively. When the width and height of the CU including the PU are W and the coordinates of the upper left sample position of the CU are (xc, yc), B2 may represent the motion vector of the sample of the (xc+W, yc) coordinates, B3 may represent the motion vector of the sample of the (xc+W, yc-1) coordinates, and B4 may represent the motion vector of the sample of the (xc+W-1, yc-1) coordinates. In this case, at least one of the motion vectors B2, B3, and B4 may be further used as a prediction candidate for v1.

[0191] Included in Figure 15Each PU in the CU illustrated in the figure can use the same prediction candidate of the PU in the CU as a prediction candidate for the motion vector of the CP, regardless of the shape and partition ID. For example, in the case of the motion vector v0 of CP0 of each PU, three pieces of motion information among the motion information of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the CU are W and H, respectively, and the coordinates of the upper left sample position of the CU are (xc, yc), A0 can represent the motion vector of the sample of the (xc-1, yc-1) coordinates, A1 can represent the motion vector of the sample of the (xc, yc-1) coordinates, and A2 can represent the motion vector of the sample of the (xc-1, yc) coordinates. In this case, at least one of the motion vectors A0, A1, and A2 can be used as a prediction candidate for v0.

[0192] Moreover, in the case of the motion vector v1 of CP1 of each PU, two pieces of motion information from among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the CU are W and the coordinates of the upper left sample position of the CU are (xc, yc), B0 can represent the motion vector of the sample of the (xc+W, yc-1) coordinates, and B1 can represent the motion vector of the sample of the (xc+W-1, yc-1) coordinates. In this case, at least one of the motion vectors B0 and B1 can be used as a prediction candidate for v1.

[0193] Moreover, in the case of the motion vector v2 of CP2 of each PU, two pieces of motion information among the motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and these two pieces of motion information can be represented by C0 and C1 respectively. When the width and height of the CU are W and the coordinates of the upper left sample position of the CU are (xc, yc), C0 can represent the motion vector of the sample of the (xc-1, yc+H) coordinate and C1 can represent the motion vector of the sample of the (xc-1, yc+H-1) coordinate. In this case, at least one of the motion vectors C0 and C1 can be used as a prediction candidate for v2.

[0194] As a method of configuring prediction candidates of a motion vector of a CP of a PU to which an nL×2N, nR×2N, 2N×nU, or 2N×nD partition type is applied, the prediction candidates may be limited to a predetermined number so as to be configured.

[0195] Figure 16The diagram illustrates a configuration in which prediction candidates for the CP of an asymmetric PU are limited to two prediction candidates. An asymmetric PU may be a PU partitioned from a CU based on partition types nL×2N, nR×2N, 2N×nU, or 2N×nD.

[0196] refer to Figure 16 , illustrating a configuration in which the prediction candidates for each CP of each PU are limited to two prediction candidates. For example, in the case of the motion vector v0 of CP0, two pieces of motion information among the multiple pieces of motion information of the previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by A0 and A1. When the width and height of the PU are W and H respectively and the coordinates of the upper left sample position of the PU are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates. In this case, A0 and A1 can be used as prediction candidates for v0.

[0197] Moreover, in the case of motion vector v1 of CP1, two pieces of motion information from among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), B0 can represent the motion vector of the sample of the (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of the (xp+W-1, yp-1) coordinates. In this case, motion vectors B0 and B1 can be used as prediction candidates for v1.

[0198] Moreover, in the case of motion vector v2 of CP2, two pieces of motion information among multiple pieces of motion information of previously decoded neighboring blocks (or neighboring samples) can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. When the width and height of the PU are W and H, respectively, and the coordinates of the upper left sample position of the PU are (xp, yp), C0 can represent the motion vector of the sample of (xp-1, yp+H), and C1 can represent the motion vector of the sample of (xp-1, yp+H-1) coordinates. In this case, motion vectors C0 and C1 can be used as prediction candidates for v2.

[0199] Meanwhile, when the motion vector of each CP is derived as described in the above embodiment, the amount of data for motion information may slightly increase. A method of reducing the amount of data by applying the feature that each CP is located at the boundary of the current PU may be used.

[0200] If the CP of the PU to be decoded (the next PU) next to the current PU has the same position as the CP of the current PU, the encoding device may not separately encode the motion information about the CP of the next PU, and may use the above-mentioned encoding method of the prediction candidate only for the CP when there is no motion information in the previous decoding process.

[0201] Figure 17 The figure shows a PU including a CP that requires motion information coding and a CP that does not require motion information coding. Whether a PU is a PU that requires motion information can be determined by checking the decoding process of the motion information of the neighboring blocks of the current PU in the encoding device / decoding device. Therefore, when determining whether a PU is a PU that requires motion information, the transmission of additional syntax information may not be required. Figure 17 , illustrating the CP of the current PU. The upper left sample of the current PU may be referred to as CP0, the upper right neighboring sample of the current PU may be referred to as CP1, and the lower left neighboring sample of the current PU may be referred to as CP2. In the case where blocks are coded according to the raster scan order, it can be determined that the right block of the current PU has not yet been decoded. Therefore, it can be determined that the motion information for the CP located in the right block needs to be coded. For example, because the motion vectors of CPs other than CP1 have been derived in the process of decoding the previous PU, the encoding device may encode only the motion information for CP1 and transmit the coded motion information through the bitstream.

[0202] Figure 18 The figure shows a PU including a CP that does not require motion information coding. Figure 18 , the motion information of the sample where the CP of the current PU is located has been derived from the upper block of the current PU. Therefore, the encoding device can encode the corresponding motion information without decoding the additional motion information. That is, without receiving the additional motion information, the decoding device can derive the motion vector of the CP of the current PU based on the motion vector derived in the previous decoding process.

[0203] For example, in the case of CP0, when the top block among the left neighboring blocks adjacent to the left boundary of the current block is decoded based on the affine motion model, the motion vector of CP1 of the corresponding block can be used as the motion vector of CP0 of the current block. Moreover, when the leftmost block among the upper neighboring blocks adjacent to the upper boundary of the current block is decoded based on the affine motion model, the motion vector of CP2 of the corresponding block can be used as the motion vector of CP0 of the current block. Moreover, when the upper left neighboring block of the current block is decoded based on the affine motion model, the motion vector of the lower right neighboring sample of the corresponding block derived based on the CP of the corresponding block can be used as the motion vector of CP0 of the current block. In this case, the motion vector of the lower right neighboring sample of the corresponding block can be derived based on the CP of the corresponding block based on the above equations 2 to 5.

[0204] For example, in the case of CP1, when the upper right neighboring block of the current block is decoded based on the affine motion model, the motion vector of CP2 of the corresponding block can be used as the motion vector of CP1 of the current block. When the rightmost block of the upper neighboring block adjacent to the upper boundary of the current block is decoded based on the affine motion model, the motion vector of the lower right neighboring sample of the corresponding block derived based on the CP of the block can be used as the motion vector of CP1 of the current block. In this case, the motion vector of the lower right neighboring sample of the corresponding block can be derived based on the CP of the corresponding block based on the above equations 2 to 5.

[0205] For example, in the case of CP2, when the lower left neighboring block of the current block is decoded based on the affine motion model, the motion vector of CP1 of the corresponding block can be used as the motion vector of CP2 of the current block. Moreover, when the bottom block of the left neighboring block adjacent to the left boundary of the current block is decoded based on the affine motion model, the motion vector of the lower right neighboring block of the corresponding block derived based on the CP of the current block can be used as the motion vector of CP2 of the current block. In this case, the motion vector of the lower right neighboring sample of the corresponding block can be derived based on the CP of the corresponding block based on the above equations 2 to 5.

[0206] Figure 19 The video encoding method of the encoding device according to the present invention is schematically illustrated. Figure 19 The method disclosed in Figure 1 Specifically, for example, Figure 19 Steps S1900 to S1930 may be performed by a prediction unit of the encoding apparatus, and step S1940 may be performed by an entropy encoding unit of the encoding apparatus.

[0207] The encoding device derives a control point (CP) for the current block (S1900). The encoding device may determine whether to apply an affine motion model of the current block based on the RD cost. In the case where an affine motion model is applied to the current block, the encoding device may derive a CP to apply the affine motion model. The CP may be three CPs.

[0208] For example, in a case where the current block is a PU partitioned from the CU based on a partition type of 2N×2N and the width and height of the current block are S, the encoding device may derive three CPs where CP0 is a sample of (0,0) coordinates, CP1 is a sample of (S,0) coordinates, and CP2 is a sample of (0,S) coordinates based on the coordinates (0,0) of the upper left sample position of the current block.

[0209] Moreover, in a case where the current block is a PU partitioned from the CU based on a partition type N×2N and the width and height of the current block are S / 2 and S, respectively, the encoding device can derive three CPs where CP0 is a sample of a (0,0) coordinate, CP1 is a sample of a (S / 2,0) coordinate, and CP2 is the upper left sample position of the current block of a coordinate (0,0) based on (0,0).

[0210] Moreover, in a case where the current block is a PU partitioned from the CU based on a partition type of 2N×N and the width and height of the current block are S and S / 2, respectively, the encoding device can derive three CPs, where CP0 is a sample of (0,0) coordinates, CP1 is a sample of (S / 2,0) coordinates, and CP2 is a sample of (0, S / 2) coordinates based on the coordinates (0,0) of the upper left sample position of the current block.

[0211] Moreover, in a case where the current block is based on a partition type of nL×2N, nR×2N, 2N×nU, or 2N×nD and the width and height of the current block are W and H, respectively, the encoding device may derive three CPs, where CP0 is a sample of (0,0) coordinates, CP1 is a sample of (W,0) coordinates, and CP2 is a sample of (0,H) coordinates based on the coordinates (0,0) of the upper left sample position of the current block.

[0212] The encoding device obtains a motion vector for the CP (S1910). The encoding device may derive the motion vector for the CP based on neighboring samples adjacent to the CP. The samples adjacent to the CP may be configured as prediction candidates. The encoding device may configure prediction candidates for the motion vector of the CP based on the coded motion information of the neighboring blocks (or samples) adjacent to each CP, and derive the motion vector of each CP based on the best candidate among the configured prediction candidates. The prediction candidate may be determined based on the partition type, partition ID, and shape of the current block.

[0213] For example, when the current block is a PU to which a partition type 2N×2N is applied, in the case of motion vector v0 of CP0, the encoding device can use three pieces of motion information from among the motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are S and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample at the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample at the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample at the (xp-1, yp) coordinates. In this case, the encoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the encoding device can derive the motion vector v0 for CP0 based on neighboring sample group 0, which includes the sample at the (xp-1, yp-1) coordinates, the sample at the (xp, yp-1) coordinates, and the sample at the (xp-1, yp) coordinates.

[0214] Furthermore, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are S and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the (xp+S, yp-1) coordinates, and B1 can represent the motion vector of the sample at the (xp+S-1, yp-1) coordinates. In this case, the encoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the encoding device can derive the motion vector v1 for CP1 based on the neighboring sample group 1 including the sample at the (xp+S, yp-1) coordinates and the sample at the (xp+S-1, yp-1) coordinates.

[0215] Furthermore, in the case of motion vector v2 for CP2, the encoding device can use two pieces of motion information from among multiple pieces of motion information for neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are S and the coordinates of the top-left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+S), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+S-1). In this case, the encoding device can use at least one of the motion vectors C0 and C1 as a prediction candidate for v2. That is, the encoding device can derive motion vector v2 for CP2 based on neighboring sample group 2, which includes at least one of the sample at the coordinates (xp-1, yp+S) and the sample at the coordinates (xp-1, yp+S-1).

[0216] In another example, when the current block is a PU to which a partition type 2N×N is applied, in the case of motion vector v0 of CP0, the encoding device can use three pieces of motion information of a plurality of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are S and S / 2, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample (xp-1, yp-1), the motion vector of the sample (xp, yp-1), A1 can represent the motion vector of the sample (xp, yp-1), and A2 can represent the motion vector of the sample (xp-1, yp). In this case, the encoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the encoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including at least one of the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0217] Furthermore, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are S and S / 2, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates of (xp+S, yp-1), and B1 can represent the motion vector of the sample at the coordinates of (xp+S-1, yp-1). In this case, the encoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the encoding device can derive the motion vector v1 for CP1 based on neighboring sample group 1 including at least one of the sample at the coordinates of (xp+S, yp-1) and the sample at the coordinates of (xp+S-1, yp-1).

[0218] Furthermore, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are S and S / 2, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+S / 2), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+S / 2-1). In this case, the encoding device can use at least one of the motion vectors C0 and C1 as the prediction candidate for v2. That is, the encoding device can derive the motion vector v2 for CP2 based on the neighboring sample group 2 including at least one of the sample at the coordinates (xp-1, yp+S / 2) and the sample at the coordinates (xp-1, yp+S / 2-1).

[0219] When the partition ID of the current block is 1, the encoding device may further include samples of neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v1 of CP1. For example, in the case of the motion vector v0 of CP0, the encoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the three pieces of motion information of the neighboring samples as prediction candidates, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the current block are S and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample at the (xc-1, yc) coordinate, A4 may represent the motion vector of the sample at the (xc-1, yc-1) coordinate, and A5 may represent the motion vector of the sample at the (xc, yc-1) coordinate. In this case, the encoding device may further use at least one of the motion vectors A3, A4, and A5 as a prediction candidate for v0. That is, the encoding device may further include at least one of a sample of (xc-1, yc-1) coordinates, a sample of (xc-1, yc) coordinates, and a sample of (xc, yc-1) in the neighboring sample group 0.

[0220] Moreover, in the case of the motion vector v1 of CP1, the encoding device may further include the motion information of the neighboring blocks of the current CU as a prediction candidate. In detail, the encoding device may further use at least one of the three motion information of the neighboring samples as a prediction candidate, and the three motion information may be represented by B2, B3, and B4, respectively. In the case where the width and height of the CU including the current block are S and the coordinates of the upper left sample position of the CU are (xc, yc), B2 may represent the motion vector of the sample of the (xc+S, yc) coordinates, B3 may represent the motion vector of the sample of the (xc+S, yc-1) coordinates, and B4 may represent the motion vector of the sample of the (xc+S-1, yc-1) coordinates. In this case, the encoding device may further use at least one of the motion vectors B2, B3, and B4 as a prediction candidate for v1. That is, the encoding device may further include at least one of samples of (xc+S, yc) coordinates, samples of (xc+S, yc-1) coordinates, and (xc+S-1, yc-1) coordinates in the neighboring sample group 1.

[0221] In addition, the encoding device can configure prediction candidates for the motion vector of the CP of the current block by limiting the number of prediction candidates to a certain number. In the case of the motion vector v0 of CP0, the encoding device can use two pieces of motion information from multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and these two pieces of motion information can be represented by A0 and A1. When the width and height of the current block are S and S / 2 respectively and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample at the (xp-1, yp-1) coordinate and A1 can represent the motion vector of the sample at the (xp, yp-1) coordinate. In this case, the encoding device can use A0 and A1 as prediction candidates for v0. That is, the encoding device can include the sample at the (xp-1, yp-1) coordinate and the sample at the (xp, yp-1) coordinate in the neighboring sample group 0, and the availability of the sample at the (xp-1, yp-1) coordinate and the sample at the (xp, yp-1) coordinate can be determined sequentially according to the first predefined priority order.

[0222] In the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are S and S / 2, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the (xp+S, yp-1) coordinates, and B1 can represent the motion vector of the sample at the (xp+S-1, yp-1) coordinates. In this case, the encoding device can use B0 and B1 as prediction candidates for v1. That is, the encoding device can include the sample at the (xp+S, yp-1) coordinates and the sample at the (xp+S-1, yp-1) coordinates in neighboring sample group 1, and the availability of the sample at the (xp+S, yp-1) coordinates and the sample at the (xp+S-1, yp-1) coordinates can be sequentially determined according to the second predetermined priority order.

[0223] In the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information from multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are S and S / 2, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+S / 2) and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+S / 2-1). In this case, the encoding device can use C0 and C1 as prediction candidates for v2. That is, the encoding device can include the sample at the coordinates (xp-1, yp+S / 2) and the sample at the coordinates (xp-1, yp+S / 2-1) in neighboring sample group 2, and the availability of the sample at the coordinates (xp-1, yp+S / 2) and the sample at the coordinates (xp-1, yp+S / 2-1) can be sequentially determined according to the third predefined priority order.

[0224] In another example, when the current block is a PU to which a partition type N×2N is applied, in the case of motion vector v0 of CP0, the encoding device can use three pieces of motion information of a plurality of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are S / 2 and S, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the encoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the encoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates and the sample of (xp-1, yp) coordinates.

[0225] In addition, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are S / 2 and S respectively and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates of (xp+S / 2, yp-1), and B1 can represent the motion vector of the sample at the coordinates of (xp+S / 2-1, yp-1). In this case, the encoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. In addition, when the partition ID of the current block is 0, the encoding device can also include motion vector B2 of the sample at the coordinates of (xp+S / 2+1, yp-1) and motion vector B3 of the sample at the coordinates of (xp+S / 2+2, yp-1) as prediction candidates for v1. That is, the encoding apparatus may derive a motion vector v1 with respect to CP1 based on a neighboring sample group 1 including a sample of (xp+S / 2, yp-1) coordinates and a sample of (xp+S / 2-1, yp-1) coordinates.

[0226] Furthermore, for motion vector v2 of CP2, the encoding device may use two pieces of motion information from neighboring blocks (or neighboring samples) as prediction candidates. These two pieces of motion information may be represented by C0 and C1. If the width and height of the current block are S / 2 and S, respectively, and the coordinates of the top-left sample position of the current block are (xp, yp), C0 may represent the motion vector of the sample at (xp-1, yp+S) coordinates, and C1 may represent the motion vector of the sample at (xp-1, yp+S-1) coordinates. In this case, the encoding device may use at least one of motion vectors C0 and C1 as a prediction candidate for v2. That is, the encoding device may derive motion vector v2 for CP2 based on neighboring sample group 2, which includes a sample at (xp-1, yp+S) coordinates and a sample at (xp-1, yp+S-1) coordinates.

[0227] When the partition ID of the current block is 1, the encoding device may further include samples of the neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v2 of CP2. For example, in the case of the motion vector v0 of CP0, the encoding device may further include motion information of the neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the three pieces of motion information of the neighboring samples as prediction candidates, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the current block are S and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample of the (xc-1, yc-1) coordinate, A4 may represent the motion vector of the sample of the (xc, yc-1) coordinate, and A5 may represent the motion vector of the sample of the (xc-1, yc) coordinate. In this case, the encoding device may further use at least one of the motion vectors A3, A4, and A5 as a prediction candidate for v0. That is, the encoding device may further include at least one of the sample of (xc-1, yc-1) coordinates, the sample of (xc-1, yc) coordinates, and the sample of (xc, yc-1) coordinates in the adjacent sample group 0.

[0228] Moreover, in the case of the motion vector v2 of CP2, the encoding device may further include the motion information of the neighboring blocks (or neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the three motion information of the neighboring samples as a prediction candidate, and the three motion information may be represented by C2, C3, and C4, respectively. In the case where the width and height of the CU including the current block are S and the coordinates of the upper left sample position of the CU are (xc, yc), C2 may represent the motion vector of the sample of the (xc-1, yc+S) coordinates, C3 may represent the motion vector of the sample of the (xc, yc+S) coordinates, and C4 may represent the motion vector of the sample of the (xc-1, yc+S-1) coordinates. In this case, the encoding device may further use at least one of the motion vectors C2, C3, and C4 as a prediction candidate for v2. That is, the encoding device may further include at least one of samples of (xc-1, yc+S) coordinates, samples of (xc, yc+S) coordinates, and samples of (xc-1, yc+S-1) coordinates in the neighboring sample group 2.

[0229] Furthermore, the encoding device can configure prediction candidates for the motion vector of the CP of the current block by limiting the number of prediction candidates to a certain number. In the case of motion vector v0 of CP0, the encoding device can use two pieces of motion information from multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and these two pieces of motion information can be represented by A0 and A1. When the width and height of the current block are S / 2 and S respectively and the coordinates of the top left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample at the (xp-1, yp-1) coordinate and A1 can represent the motion vector of the sample at the (xp, yp-1) coordinate. In this case, the encoding device can use A0 and A1 as prediction candidates for v0. That is, the encoding device can include the sample at the (xp-1, yp-1) coordinate and the sample at the (xp, yp-1) coordinate in neighboring sample group 0, and the availability of the sample at the (xp-1, yp-1) coordinate and the sample at the (xp, yp-1) coordinate can be determined sequentially according to the first predefined priority order.

[0230] In the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are S / 2 and S, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates (xp+S / 2, yp-1), and B1 can represent the motion vector of the sample at the coordinates (xp+S / 2-1, yp-1). In this case, the encoding device can use B0 and B1 as prediction candidates for v1. That is, the encoding device can include the sample at the coordinates (xp+S / 2, yp-1) and the sample at the coordinates (xp+S / 2-1, yp-1) in neighboring sample group 1, and the availability of the sample at the coordinates (xp+S / 2, yp-1) and the sample at the coordinates (xp+S / 2-1, yp-1) can be sequentially determined according to the second predefined priority order.

[0231] In addition, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information from a plurality of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are S / 2 and S, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the (xp-1, yp+S) coordinate, and C1 can represent the motion vector of the sample at the (xp-1, yp+S-1) coordinate. In this case, the encoding device can use C0 and C1 as prediction candidates for v2. That is, the encoding device can include the sample at the (xp-1, yp+S) coordinate and the sample at the (xp-1, yp+S-1) coordinate in neighboring sample group 2, and the availability of the sample at the (xp-1, yp+S / 2) coordinate and the sample at the (xp-1, yp+S / 2-1) coordinate can be sequentially determined according to the third predefined priority order.

[0232] In another example, when the current block is a PU to which a partition type nL×2N is applied, for example, in the case of motion vector v0 of CP0, the encoding device can use three pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the encoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the encoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including at least one of the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0233] Furthermore, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample at the (xp+W-1, yp-1) coordinates. In this case, the encoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the encoding device can derive the motion vector v1 for CP1 based on neighboring sample group 1, which includes the sample at the (xp+W, yp-1) coordinates and the sample at the (xp+W-1, yp-1) coordinates.

[0234] Furthermore, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample at the (xp-1, yp+H-1) coordinates. In this case, the encoding device can use at least one of the motion vectors C0 and C1 as a prediction candidate for v2. That is, the encoding device can derive the motion vector v2 for CP2 based on the neighboring sample group 2 including the sample at the (xp-1, yp+H) coordinates and the (xp-1, yp+H-1) sample.

[0235] Moreover, when the partition ID of the current block is 1, the encoding device may further include samples of the neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v2 of CP2. For example, in the case of the motion vector v0 of CP0, the encoding device may further include motion information of the neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the two motion information of the neighboring samples as a prediction candidate, and the two motion information may be represented by A3 and A4, respectively. When the width and height of the CU including the current block are H and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample of the (xc-1, yc-1) coordinates, and A4 may represent the motion vector of the sample of the (xc-1, yc) coordinates. In this case, the encoding device may further use at least one of the motion vectors A3 and A4 as a prediction candidate for v0. That is, the encoding device may further include at least one of the sample of (xc-1, yc-1) coordinates, the sample of (xc-1, yc) coordinates, and the sample of (xc, yc-1) coordinates in the adjacent sample group 0.

[0236] Moreover, in the case of the motion vector v2 of CP2, the encoding device may further include the motion information of the neighboring block (i.e., the neighboring sample) as a prediction candidate. In detail, the encoding device may further use at least one of the two motion information of the neighboring sample as a prediction candidate, and the two motion information may be represented by C2 and C3, respectively. In the case where the width and height of the CU including the current block are H and the coordinates of the upper left sample position of the CU are (xc, yc), C2 may represent the motion vector of the sample of the (xc-1, yc+H) coordinate, and C3 may represent the motion vector of the sample of the (xc-1, yc+H-1) coordinate. In this case, the encoding device may further use at least one of the motion vectors C2 and C3 as a prediction candidate for v2. That is, the encoding device may further include at least one of the sample of the (xc-1, yc+H) coordinate and the sample of the (xc-1, yc+H-1) coordinate in the neighboring sample group 2.

[0237] In another example, when the current block is a PU to which a partition type nR×2N is applied, for example, in the case of a motion vector v0 of CP0, the encoding device can use three pieces of motion information of a plurality of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the encoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the encoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including at least one of the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0238] Furthermore, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample at the (xp+W-1, yp-1) coordinates. In this case, the encoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the encoding device can derive the motion vector v1 for CP1 based on neighboring sample group 1, which includes the sample at the (xp+W, yp-1) coordinates and the sample at the (xp+W-1, yp-1) coordinates.

[0239] Furthermore, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample at the (xp-1, yp+H-1) coordinates. In this case, the encoding device can use at least one of the motion vectors C0 and C1 as a prediction candidate for v2. That is, the encoding device can derive the motion vector v2 for CP2 based on the neighboring sample group 2 including the sample at the (xp-1, yp+H) coordinates and the (xp-1, yp+H-1) sample.

[0240] Furthermore, when the partition ID of the current block is 1, the encoding device may further include samples of neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v2 of CP2. For example, in the case of the motion vector v0 of CP0, the encoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. Specifically, the encoding device may further use at least one of three pieces of motion information of neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the current block are H and the coordinates of the top left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample at the (xc-1, yc-1) coordinate, A4 may represent the motion vector of the sample at the (xc, yc-1) coordinate, and A5 may represent the motion vector of the sample at the (xc-1, yc) coordinate. In this case, the encoding device may further use at least one of the motion vectors A3, A4, and A5 as a prediction candidate for v0. That is, the encoding device may further include at least one of a sample of (xc-1, yc-1) coordinates, a sample of (xc-1, yc) coordinates, and a sample of (xc, yc-1) in the adjacent sample group 0.

[0241] Moreover, in the case of the motion vector v2 of CP2, the encoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the three pieces of motion information of the neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by C2, C3, and C4, respectively. In the case where the width and height of the CU including the current block are H and the coordinates of the upper left sample position of the CU are (xc, yc), C2 may represent the motion vector of the sample of the (xc-1, yc+H) coordinates, C3 may represent the motion vector of the sample of the (xc, yc+H) coordinates, and C4 may represent the motion vector of the sample of the (xc-1, yc+H-1) coordinates. In this case, the encoding device may further use at least one of the motion vectors C2, C3, and C4 as a prediction candidate for v2. That is, the encoding device may further include at least one of samples of (xc-1, yc+H) coordinates, samples of (xc, yc+H) coordinates, and samples of (xc-1, yc+H-1) coordinates in the neighboring sample group 2.

[0242] In another example, when the current block is a PU to which a partition type 2N×nU is applied, for example, in the case of a motion vector v0 of CP0, the encoding device can use three pieces of motion information of a plurality of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the encoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the encoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including at least one of the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0243] Furthermore, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates of (xp+W, yp-1), and B1 can represent the motion vector of the sample at the coordinates of (xp+W-1, yp-1). In this case, the encoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the encoding device can derive the motion vector v1 for CP1 based on neighboring sample group 1 including at least one of the sample at the coordinates of (xp+W, yp-1) and the sample at the coordinates of (xp+W-1, yp-1).

[0244] Furthermore, in the case of motion vector v2 for CP2, the encoding device can use two pieces of motion information from among multiple pieces of motion information for neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the top-left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+H), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+H-1). In this case, the encoding device can use at least one of the motion vectors C0 and C1 as a prediction candidate for v2. That is, the encoding device can derive motion vector v2 for CP2 based on neighboring sample group 2, which includes at least one of the sample at the coordinates (xp-1, yp+H) and the sample at the coordinates (xp-1, yp+H-1).

[0245] Furthermore, when the partition ID of the current block is 1, the encoding device may further include samples from neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v1 of CP1. For example, in the case of motion vector v0 of CP0, the encoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. Specifically, the encoding device may further use at least one of two pieces of motion information of neighboring samples as prediction candidates, and these two pieces of motion information may be represented by A3 and A4, respectively. When the width and height of the CU including the current block are W and the coordinates of the top-left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample at the (xc-1, yc-1) coordinate, and A4 may represent the motion vector of the sample at the (xc, yc-1) coordinate. In this case, the encoding device may further use at least one of motion vectors A3 and A4 as a prediction candidate for v0. That is, the encoding device may further include at least one of the sample at the (xc-1, yc-1) coordinate and the sample at the (xc, yc-1) coordinate in neighboring sample group 0.

[0246] Moreover, in the case of the motion vector v1 of CP1, the encoding device may further include the motion information of the neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the two motion information of the neighboring samples as a prediction candidate, and the two motion information may be represented by B2 and B3, respectively. In the case where the width and height of the CU including the current block are W and the coordinates of the upper left sample position of the CU are (xc, yc), B2 may represent the motion vector of the sample of the (xc+W, yc-1) coordinates, and B3 may represent the motion vector of the sample of the (xc+W-1, yc-1) coordinates. In this case, the encoding device may further use at least one of the motion vectors B2 and B3 as a prediction candidate for v1. That is, the encoding device may further include at least one of the sample of the (xc+W, yc-1) coordinates and the sample of the (xc+W-1, yc-1) coordinates in the neighboring sample group 1.

[0247] In another example, when the current block is a PU to which a partition type 2N×nD is applied, for example, in the case of a motion vector v0 of CP0, the encoding device can use three pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the encoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the encoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including at least one of the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0248] Furthermore, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates of (xp+W, yp-1), and B1 can represent the motion vector of the sample at the coordinates of (xp+W-1, yp-1). In this case, the encoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the encoding device can derive the motion vector v1 for CP1 based on neighboring sample group 1 including at least one of the sample at the coordinates of (xp+W, yp-1) and the sample at the coordinates of (xp+W-1, yp-1).

[0249] Furthermore, in the case of motion vector v2 for CP2, the encoding device can use two pieces of motion information from among multiple pieces of motion information for neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the top-left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+H), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+H-1). In this case, the encoding device can use at least one of the motion vectors C0 and C1 as a prediction candidate for v2. That is, the encoding device can derive motion vector v2 for CP2 based on neighboring sample group 2, which includes at least one of the sample at the coordinates (xp-1, yp+H) and the sample at the coordinates (xp-1, yp+H-1).

[0250] In addition, when the partition ID of the current block is 1, the encoding device may further include samples of neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v1 of CP1. For example, in the case of the motion vector v0 of CP0, the encoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of three pieces of motion information of neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the current block are W and the coordinates of the top left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample at the (xc-1, yc) coordinate, A4 may represent the motion vector of the sample at the (xc-1, yc-1) coordinate, and A5 may represent the motion vector of the sample at the (xc, yc-1) coordinate. In this case, the encoding device may further use at least one of the motion vectors A3, A4, and A5 as a prediction candidate for v0. That is, the encoding device may further include at least one of a sample of (xc-1, yc-1) coordinates, a sample of (xc-1, yc) coordinates, and a sample of (xc, yc-1) in the neighboring sample group 0.

[0251] Moreover, in the case of the motion vector v1 of CP1, the encoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the three pieces of motion information of the neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by B2, B3, and B4, respectively. When the width and height of the CU including the current block are W and the coordinates of the upper left sample position of the CU are (xc, yc), B2 may represent the motion vector of the sample of the (xc+W, yc) coordinates, B3 may represent the motion vector of the sample of the (xc+W, yc-1) coordinates, and B4 may represent the motion vector of the sample of the (xc+W-1, yc-1) coordinates. In this case, the encoding device may further use at least one of the motion vectors B2, B3, and B4 as a prediction candidate for v1. That is, the encoding device may further include at least one of samples of (xc+W, yc) coordinates, samples of (xc+W, yc-1) coordinates, and samples of (xc+W-1, yc-1) coordinates in neighboring sample group 1.

[0252] In another example, the encoding device may use the same prediction candidate of the PU included in the CU as a prediction candidate for the motion vector of the CP, regardless of the partition ID. For example, in the case of the motion vector v0 of the CP0 of the current block, the encoding device may use three pieces of motion information among the multiple pieces of motion information of the neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) as prediction candidates, and the three pieces of motion information may be represented by A0, A1, and A2, respectively. When the width and height of the CU are W and H, respectively, and the coordinates of the upper left sample position of the CU are (xc, yc), A0 may represent the motion vector of the sample of the (xc-1, yc-1) coordinates, A1 may represent the motion vector of the sample of the (xc, yc-1) coordinates, and A2 may represent the motion vector of the sample of the (xc-1, yc) coordinates. In this case, the encoding device may use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0.

[0253] In addition, in the case of motion vector v1 of CP1 of the current block, the encoding device can use two pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the CU are W and the coordinates of the upper left sample position of the CU are (xc, yc), B0 can represent the motion vector of the sample of the (xc+W, yc-1) coordinates, and B1 can represent the motion vector of the sample of the (xc+W-1, yc-1) coordinates. In this case, the encoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1.

[0254] In addition, in the case of motion vector v2 of CP2 of the current block, the encoding device can use two pieces of motion information of the neighboring blocks (or neighboring samples) as prediction candidates, and these two pieces of motion information can be represented by C0 and C1 respectively. When the width and height of the CU are W and the coordinates of the upper left sample position of the CU are (xc, yc), C0 can represent the motion vector of the sample of the (xc-1, yc+H) coordinates and C1 can represent the motion vector of the sample of the (xc-1, yc+H-1) coordinates. In this case, the encoding device can use at least one of the motion vectors C0 and C1 as a prediction candidate for v2.

[0255] In another example, as a method of configuring prediction candidates of a motion vector of a CP of a PU to which an nL×2N, nR×2N, 2N×nU, or 2N×nD partition type is applied, the prediction candidates may be limited to a predetermined number to be configured.

[0256] In another example, when the current block is a PU to which a partition type nL×2N, nR×2N, 2N×nU, or 2N×nD is applied, the encoding device may configure prediction candidates for each CP by limiting their number to two. For example, in the case of a motion vector v0 of CP0, the encoding device may use two pieces of motion information of a plurality of pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by A0 and A1. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 may represent the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates. In this case, the encoding device may use A0 and A1 as prediction candidates for v0. That is, the encoding device may include the sample of the (xp-1, yp-1) coordinate and the sample of the (xp, yp-1) coordinate in the neighboring sample group 0, and the availability of the sample of the (xp-1, yp-1) coordinate and the sample of the (xp, yp-1) coordinate may be sequentially determined according to the first predefined priority order.

[0257] In addition, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the (xp+W, yp-1) coordinate, and B1 can represent the motion vector of the sample at the (xp+W-1, yp-1) coordinate. In this case, the encoding device can use B0 and B1 as prediction candidates for v1. That is, the encoding device can include the sample at the (xp+W, yp-1) coordinate and the sample at the (xp+W-1, yp-1) coordinate in neighboring sample group 1, and the availability of the sample at the (xp+W, yp-1) coordinate and the sample at the (xp+W-1, yp-1) coordinate can be sequentially determined according to the second predefined priority order.

[0258] Furthermore, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the (xp-1, yp+H) coordinate, and C1 can represent the motion vector of the sample at the (xp-1, yp+H-1) coordinate. In this case, the encoding device can use C0 and C1 as prediction candidates for v2. That is, the encoding device can include the sample at the (xp-1, yp+H) coordinate and the sample at the (xp-1, yp+H-1) coordinate in neighboring sample group 2, and the availability of the sample at the (xp-1, yp+H) coordinate and the sample at the (xp-1, yp+H-1) coordinate can be sequentially determined according to the third predefined priority order.

[0259] The encoding device derives a sample-unit motion vector in the current block based on the motion vector for the CP (S1920). According to the affine motion model, the motion vector may be different according to each sample coordinate in the current block. If the motion vector of CP0, the motion vector of CP1, and the motion vector of CP2 are known, the motion vector according to the sample position in the current block may be derived. That is, according to the affine motion model, the motion vector in the CP—the motion vector of CP0 (v) may be used based on the distance ratio between the coordinates (x, y) and the three control points. x0 ,v y0 ), CP1's motion vector (v x1 ,v y1 ) and the motion vector of CP2 (v x2 , v y2 ) to derive the sample-unit motion vector of the sample position. In this case, the encoding device may derive the sample-unit motion vector of the sample position in the current block based on the above equations 2 to 5.

[0260] The encoding device generates prediction samples for the current block based on the sample-unit motion vector (S1930). The encoding device may derive a reference region in a reference picture based on the sample-unit motion vector, and generate prediction samples for the current block based on reconstructed samples in the reference region. If the prediction mode for the current block is not skip mode, the encoding device may generate residual samples (or residual signals) based on the original samples of the original picture and the prediction samples.

[0261] The encoding device encodes the prediction mode information of the current block and outputs the encoded information (S1940). The encoding device may encode the prediction mode and the derived motion vector for the current block and output the encoded information in the form of a bitstream. In addition, when the CP of the previous block to be decoded has the same position as the CP of the current block, the encoding device may not separately encode the motion information about the CP of the current block.

[0262] For example, in the case of motion information for CP0 of the current block, when the top block among the left neighboring blocks adjacent to the left boundary of the current block is decoded based on the affine motion model, the motion vector of CP1 of the corresponding block can be used as the motion vector of CP0 of the current block, and therefore, the motion information for CP0 may not be separately coded. Moreover, when the leftmost block among the upper non-neighboring blocks adjacent to the upper boundary of the current block is decoded based on the affine motion model, the motion vector of CP2 of the corresponding block can be used as the motion vector of CP0, and therefore, the motion information for CP0 may not be separately coded. Moreover, when the upper left neighboring block of the current block is decoded based on the affine motion model, the motion vector of the lower right neighboring sample of the corresponding block derived based on the CP of the corresponding block can be used as the motion vector of CP0 of the current block, and therefore, the motion information for CP0 may not be separately coded. In this case, the motion vector of the lower right neighboring sample of the corresponding block can be derived based on the CP of the corresponding block based on the above equations 2 to 5.

[0263] For example, in the case of CP1 of the current block, when the upper right neighboring block of the current block is decoded based on the affine motion model, the motion vector of CP2 of the corresponding block can be used as the motion vector of CP1 of the current block, and therefore, the motion information for CP0 may not be separately encoded. In addition, when the rightmost block of the upper neighboring block adjacent to the upper boundary of the current block is decoded based on the affine motion model, the motion vector of the lower right neighboring sample of the corresponding block derived based on the CP of the block can be used as the motion vector of CP1 of the current block, and therefore, the motion information for CP0 may not be separately encoded. In this case, the motion vector of the lower right neighboring sample of the corresponding block can be derived based on the CP of the corresponding block based on the above equations 2 to 5.

[0264] For example, in the case of CP2 of the current block, when the lower left neighboring block of the current block is decoded based on the affine motion model, the motion vector of CP1 of the corresponding block can be used as the motion vector of CP2 of the current block, and therefore, the motion information for CP0 may not be separately encoded. Moreover, when the lowermost block of the left neighboring block adjacent to the left boundary of the current block is decoded based on the affine motion model, the motion vector of the lower right neighboring sample of the corresponding block derived based on the CP of the current block may be used as the motion vector of CP2 of the current block, and therefore, the motion information for CP0 may not be separately encoded.

[0265] The bitstream can be sent to a decoding device via a network or storage medium.

[0266] Although not shown, the encoding apparatus may encode information about the residual sample of the current block and output the information. The information about the residual sample may include a transform coefficient related to the residual sample.

[0267] Figure 20 A video decoding method of a decoding device according to the present invention is schematically illustrated. Figure 20 The method disclosed in Figure 2 Specifically, for example, Figure 20 Steps S2000 to S2030 may be performed by a prediction unit of a decoding device.

[0268] The decoding device derives a control point (CP) for the current block (S2000). The decoding device may receive information about inter-frame prediction of the current block through a bitstream. In the case of applying an affine motion model to the current block, the decoding device may derive a CP to apply the affine motion model. The CP may be three CPs. For example, in the case where the current block is a PU partitioned from the CU based on a partition type of 2N×2N and the width and height of the current block are S, the decoding device may derive three CPs based on the coordinates (0,0) of the upper left sample position of the current block, where CP0 is a sample of the (0,0) coordinate, CP1 is a sample of the (S,0) coordinate, and CP2 is a sample of the (0,S) coordinate.

[0269] Moreover, in a case where the current block is a PU partitioned from the CU based on a partition type of N×2N and the width and height of the current block are S / 2 and S, respectively, the decoding device can derive three CPs based on the coordinates (0,0) of the upper left sample position of the previous block, where CP0 is a sample of the (0,0) coordinate, CP1 is a sample of the (S / 2,0) coordinate, and CP2 is a sample of the (0,S) coordinate.

[0270] In addition, when the current block is a PU partitioned from the CU based on a partition type of 2N×N and the width and height of the current block are S and S / 2, respectively, the decoding device can derive three CPs based on the coordinates (0,0) of the upper left sample position of the current block, where CP0 is a sample of the (0,0) coordinate, CP1 is a sample of the (S / 2,0) coordinate, and CP2 is a sample of the (0, S / 2) coordinate.

[0271] Moreover, in a case where the current block is a PU partitioned from the CU based on a partition type of nL×2N, nR×2N, 2N×nU, or 2N×nD and the width and height of the current block are W and H, respectively, the decoding device may derive three CPs based on the coordinates (0, 0) of the upper left sample position of the current block, where CP0 is a sample of the (0, 0) coordinate, CP1 is a sample of the (W, 0) coordinate, and CP2 is a sample of the (0, H) coordinate.

[0272] The decoding apparatus obtains a motion vector for a CP ( S2010 ).

[0273] The decoding device may derive a motion vector for the CP based on the motion vector for the current block and the motion vectors of neighboring blocks of the current block. The decoding device may receive motion information of the CP via a bitstream. In the case where a motion vector for a CP located at the same position as the CP of the current block is derived before decoding the current block, the decoding device may not receive information about the CP of the current block. The decoding device may configure neighboring samples of each CP into a neighboring sample group and derive the motion vector of the CP based on the neighboring sample group. The neighboring sample group may be determined based on the partition type, partition ID, and shape of the current block.

[0274] For example, if the current block is a PU to which a partition type of 2N×2N is applied, in the case of motion vector v0 of CP0, the decoding device can use three pieces of motion information from among multiple pieces of information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. If the width and height of the current block are S and the coordinates of the top-left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample at the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample at the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample at the (xp-1, yp) coordinates. In this case, the decoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the decoding device can derive the motion vector v0 for CP0 based on neighboring sample group 0, which includes the sample at the (xp-1, yp-1) coordinates, the sample at the (xp, yp-1) coordinates, and the sample at the (xp-1, yp) coordinates.

[0275] In addition, in the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are S and the coordinates of the upper left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates of (xp+S, yp-1), and B1 can represent the motion vector of the sample at the coordinates of (xp+S-1, yp-1). In this case, the decoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the decoding device can derive the motion vector v1 for CP1 based on neighboring sample group 1, which includes the sample at the coordinates of (xp+S, yp-1) and the sample at the coordinates of (xp+S-1, yp-1).

[0276] Furthermore, in the case of motion vector v2 for CP2, the decoding device can use two pieces of motion information from among multiple pieces of motion information for neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are S and the coordinates of the top-left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+S), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+S-1). In this case, the decoding device can use at least one of motion vectors C0 and C1 as a prediction candidate for v2. That is, the decoding device can derive motion vector v2 for CP2 based on neighboring sample group 2, which includes at least one of the sample at the coordinates (xp-1, yp+S) and the sample at the coordinates (xp-1, yp+S-1).

[0277] In another example, when the current block is a PU to which a partition type 2N×N is applied, in the case of motion vector v0 of CP0, the decoding device can use three pieces of motion information of a plurality of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are S and S / 2, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the decoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the decoding device may derive a motion vector v0 with respect to CP0 based on a neighboring sample group 0 including at least one of a sample of (xp-1, yp-1) coordinates, a sample of (xp, yp-1) coordinates, and a sample of (xp-1, yp) coordinates.

[0278] Furthermore, in the case of motion vector v1 for CP1, the decoding device can use two pieces of motion information from among multiple pieces of motion information for neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. If the width and height of the current block are S and S / 2, respectively, and the coordinates of the top-left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates (xp+S, yp-1), and B1 can represent the motion vector of the sample at the coordinates (xp+S-1, yp-1). In this case, the decoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the decoding device can derive motion vector v1 for CP1 based on neighboring sample group 1, which includes at least one of the sample at the coordinates (xp+S, yp-1) and the sample at the coordinates (xp+S-1, yp-1).

[0279] Furthermore, in the case of motion vector v2 for CP2, the decoding device can use two pieces of motion information from neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. If the width and height of the current block are S and S / 2, respectively, and the coordinates of the top-left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+S / 2), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+S / 2-1). In this case, the decoding device can use at least one of motion vectors C0 and C1 as a prediction candidate for v2. That is, the decoding device can derive motion vector v2 for CP2 based on neighboring sample group 2, which includes at least one of the sample at the coordinates (xp-1, yp+S / 2) and the sample at the coordinates (xp-1, yp+S / 2-1).

[0280] When the partition ID of the current block is 1, the decoding device may further include samples of neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v1 of CP1. For example, in the case of the motion vector v0 of CP0, the decoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the three pieces of motion information of the neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the current block are S and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample at the (xc-1, yc) coordinate, A4 may represent the motion vector of the sample at the (xc-1, yc-1) coordinate, and A5 may represent the motion vector of the sample at the (xc, yc-1) coordinate. In this case, the decoding device may further use at least one of the motion vectors A3, A4, and A5 as a prediction candidate for v0. That is, the decoding device may further include at least one of a sample of (xc-1, yc-1) coordinates, a sample of (xc-1, yc) coordinates, and a sample of (xc, yc-1) in the neighboring sample group 0.

[0281] Moreover, in the case of the motion vector v1 of CP1, the decoding device may further include the motion information of the neighboring blocks (or neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the three motion information of the neighboring samples as a prediction candidate, and the three motion information may be represented by B2, B3, and B4, respectively. In the case where the width and height of the CU including the current block are S and the coordinates of the upper left sample position of the CU are (xc, yc), B2 may represent the motion vector of the sample of the (xc+S, yc) coordinates, B3 may represent the motion vector of the sample of the (xc+S, yc-1) coordinates, and B4 may represent the motion vector of the sample of the (xc+S-1, yc-1) coordinates. In this case, the decoding device may further use at least one of the motion vectors B2, B3, and B4 as a prediction candidate for v1. That is, the decoding device may further include at least one of the sample of (xc+S, yc) coordinate, the sample of (xc+S, yc-1) coordinate, and the sample of (xc+S-1, yc-1) coordinate in the neighboring sample group 1.

[0282] Furthermore, the decoding device can configure prediction candidates for the motion vector of the CP of the current block by limiting the number of prediction candidates to a certain number. In the case of motion vector v0 of CP0, the decoding device can use two pieces of motion information from multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and these two pieces of motion information can be represented by A0 and A1. When the width and height of the current block are S and S / 2 respectively and the coordinates of the top left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample at the (xp-1, yp-1) coordinate and A1 can represent the motion vector of the sample at the (xp, yp-1) coordinate. In this case, the decoding device can use A0 and A1 as prediction candidates for v0. That is, the decoding device can include the sample at the (xp-1, yp-1) coordinate and the sample at the (xp, yp-1) coordinate in neighboring sample group 0, and the availability of the samples at the (xp-1, yp-1) coordinate and the (xp, yp-1) coordinate can be determined sequentially according to a first predefined priority order.

[0283] In the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are S and S / 2, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates (xp+S, yp-1), and B1 can represent the motion vector of the sample at the coordinates (xp+S-1, yp-1). In this case, the decoding device can use B0 and B1 as prediction candidates for v1. That is, the decoding device can include the sample at the coordinates (xp+S, yp-1) and the sample at the coordinates (xp+S-1, yp-1) in neighboring sample group 1, and the availability of the sample at the coordinates (xp+S, yp-1) and the sample at the coordinates (xp+S-1, yp-1) can be sequentially determined according to the second predetermined priority order.

[0284] In the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information from multiple neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are S and S / 2, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates of (xp-1, yp+S / 2) of the motion vector of the current block, and C1 can represent the motion vector of the sample at the coordinates of (xp-1, yp+S / 2-1). In this case, the decoding device can use C0 and C1 as prediction candidates for v2. That is, the decoding device can include the sample at the coordinates of (xp-1, yp+S / 2) and the sample at the coordinates of (xp-1, yp+S / 2-1) in neighboring sample group 2, and the availability of the sample at the coordinates of (xp-1, yp+S / 2) and (xp-1, yp+S / 2-1) can be sequentially determined according to the third predefined priority order.

[0285] In another example, when the current block is a PU to which a partition type N×2N is applied, in the case of motion vector v0 of CP0, the decoding device can use three pieces of motion information of a plurality of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are S / 2 and S, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the decoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the decoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0286] Furthermore, in the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. If the width and height of the current block are S / 2 and S, respectively, and the coordinates of the top-left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates (xp+S / 2, yp-1), and B1 can represent the motion vector of the sample at the coordinates (xp+S / 2-1, yp-1). In this case, the decoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. Furthermore, if the partition ID of the current block is 0, the decoding device can further include motion vector B2 of the sample at the coordinates (xp+S / 2+1, yp-1) and motion vector B3 of the sample at the coordinates (xp+S / 2+2, yp-1) as prediction candidates for v1. That is, the decoding apparatus may derive a motion vector v1 with respect to CP1 based on a neighboring sample group 1 including a sample of (xp+S / 2, yp-1) coordinates and a sample of (xp+S / 2-1, yp-1) coordinates.

[0287] In addition, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are S / 2 and S, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample with the coordinates (xp-1, yp+S) and C1 can represent the motion vector of the sample with the coordinates (xp-1, yp+S-1). In this case, the decoding device can use at least one of the motion vectors C0 and C1 as the prediction candidate for v2. That is, the decoding device can derive the motion vector v2 for CP2 based on the neighboring sample group 2 including the samples with the coordinates (xp-1, yp+S) and (xp-1, yp+S-1).

[0288] When the partition ID of the current block is 1, the decoding device may further include samples of neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v2 of CP2. For example, in the case of the motion vector v0 of CP0, the decoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the three pieces of motion information of the neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the current block are S and the coordinates of the top left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample at the (xc-1, yc-1) coordinate, A4 may represent the motion vector of the sample at the (xc, yc-1) coordinate, and A5 may represent the motion vector of the sample at the (xc-1, yc) coordinate. In this case, the decoding device may further use at least one of the motion vectors A3, A4, and A5 as a prediction candidate for v0. That is, the decoding device may further include at least one of the sample of the (xc-1, yc-1) coordinate in the neighboring sample group 0, the sample of the (xc-1, yc) coordinate, and the sample of the (xc, yc-1) coordinate.

[0289] Moreover, in the case of the motion vector v2 of CP2, the decoding device may further include the motion information of the neighboring blocks (or neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the three motion information of the neighboring samples as a prediction candidate, and the three motion information may be represented by C2, C3, and C4, respectively. In the case where the width and height of the CU including the current block are S and the coordinates of the upper left sample position of the CU are (xc, yc), C2 may represent the motion vector of the sample of the (xc-1, yc+S) coordinate, C3 may represent the motion vector of the sample of the (xc, yc+S) coordinate, and C4 may represent the motion vector of the sample of the (xc-1, yc+S-1) coordinate. In this case, the decoding device may further use at least one of the motion vectors C2, C3, and C4 as a prediction candidate for v2. That is, the decoding device may further include at least one of samples of (xc-1, yc+S) coordinates, samples of (xc, yc+S) coordinates, and samples of (xc-1, yc+S-1) coordinates in the neighboring sample group 2.

[0290] Furthermore, the decoding device can configure prediction candidates for the motion vector of the CP of the current block by limiting the number of prediction candidates to a certain number. In the case of motion vector v0 of CP0, the decoding device can use two pieces of motion information from multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and these two pieces of motion information can be represented by A0 and A1. When the width and height of the current block are S / 2 and S respectively and the coordinates of the top left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample at the (xp-1, yp-1) coordinate and A1 can represent the motion vector of the sample at the (xp, yp-1) coordinate. In this case, the decoding device can use A0 and A1 as prediction candidates for v0. That is, the decoding device can include the sample at the (xp-1, yp-1) coordinate and the sample at the (xp, yp-1) coordinate in neighboring sample group 0, and the availability of the samples at the (xp-1, yp-1) coordinate and the (xp, yp-1) coordinate can be determined sequentially according to a first predefined priority order.

[0291] In the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information from multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are S / 2 and S, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates (xp+S / 2, yp-1), and B1 can represent the motion vector of the sample at the coordinates (xp+S / 2-1, yp-1). In this case, the decoding device can use B0 and B1 as prediction candidates for v1. That is, the decoding device can include the sample at the coordinates (xp+S / 2, yp-1) and the sample at the coordinates (xp+S / 2-1, yp-1) in neighboring sample group 1, and the availability of the sample at the coordinates (xp+S / 2, yp-1) and the sample at the coordinates (xp+S / 2-1, yp-1) can be sequentially determined according to the second predefined priority order.

[0292] In addition, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are S / 2 and S, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+S), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+S-1). In this case, the decoding device can use C0 and C1 as prediction candidates for v2. That is, the decoding device can include the sample at the coordinates (xp-1, yp+S) and the sample at the coordinates (xp-1, yp+S-1) in neighboring sample group 2, and the availability of the sample at the coordinates (xp-1, yp+S) and the sample at the coordinates (xp-1, yp+S-1) can be sequentially determined according to the third predefined priority order.

[0293] In another example, when the current block is a PU to which a partition type nL×2N is applied, for example, in the case of motion vector v0 of CP0, the decoding device can use three pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the decoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the decoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including at least one of the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0294] In addition, in the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information from neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are W and H, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates (xp+W, yp-1), and B1 can represent the motion vector of the sample at the coordinates (xp+W-1, yp-1). In this case, the decoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the decoding device can derive motion vector v1 for CP1 based on neighboring sample group 1, which includes the sample at the coordinates (xp+W, yp-1) and the sample at the coordinates (xp+W-1, yp-1).

[0295] In addition, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information from neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+H), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+H-1). In this case, the decoding device can use at least one of the motion vectors C0 and C1 as a prediction candidate for v2. That is, the decoding device can derive the motion vector v2 for CP2 based on the neighboring sample group 2, which includes the sample at the coordinates (xp-1, yp+H) and the sample at (xp-1, yp+H-1).

[0296] Moreover, in the case where the partition ID of the current block is 1, the decoding device may further include samples of the neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v2 of CP2. For example, in the case of the motion vector v0 of CP0, the decoding device may further include motion information of the neighboring blocks (i.e., neighboring samples) as prediction candidates. Specifically, the decoding device may further use at least one of the two motion information of the neighboring samples as a prediction candidate, and the two motion information may be represented by A3 and A4, respectively. In the case where the width and height of the CU including the current block are H and the coordinates of the upper left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample of the (xc-1, yc-1) coordinates, and A4 may represent the motion vector of the sample of the (xc-1, yc) coordinates. In this case, the decoding device may further use at least one of the motion vectors A3 and A4 as a prediction candidate for v0. That is, the decoding device may further include at least one of the sample of the (xc-1, yc-1) coordinate in the neighboring sample group 0, the sample of the (xc-1, yc) coordinate, and the sample of the (xc, yc-1) coordinate.

[0297] Moreover, in the case of motion vector v2 of CP2, the decoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the two pieces of motion information of neighboring samples as prediction candidates, and these two pieces of motion information may be represented by C2 and C3, respectively. In the case where the width and height of the CU including the current block are H and the coordinates of the upper left sample position of the CU are (xc, yc), C2 may represent the motion vector of the sample of the (xc-1, yc+H) coordinate, and C3 may represent the motion vector of the sample of the (xc-1, yc+H-1) coordinate. In this case, the decoding device may further use at least one of the motion vectors C2 and C3 as a prediction candidate for v2. That is, the decoding device may further include at least one of the sample of the (xc-1, yc+H) coordinate and the sample of the (xc-1, yc+H-1) coordinate in neighboring sample group 2.

[0298] In another example, when the current block is a PU to which a partition type nR×2N is applied, for example, in the case of motion vector v0 of CP0, the decoding device can use three pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the decoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the decoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including at least one of the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0299] Furthermore, in the case of motion vector v1 for CP1, the decoding device can use two pieces of motion information from among multiple pieces of motion information for neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. If the width and height of the current block are W and H, respectively, and the coordinates of the top-left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates (xp+W, yp-1), and B1 can represent the motion vector of the sample at the coordinates (xp+W-1, yp-1). In this case, the decoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the decoding device can derive motion vector v1 for CP1 based on neighboring sample group 1, which includes the sample at the coordinates (xp+W, yp-1) and the sample at the coordinates (xp+W-1, yp-1).

[0300] In addition, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information from neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+H), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+H-1). In this case, the decoding device can use at least one of the motion vectors C0 and C1 as a prediction candidate for v2. That is, the decoding device can derive the motion vector v2 for CP2 based on the neighboring sample group 2, which includes the sample at the coordinates (xp-1, yp+H) and the sample at (xp-1, yp+H-1).

[0301] In addition, when the partition ID of the current block is 1, the decoding device may further include samples of neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v2 of CP2. For example, in the case of the motion vector v0 of CP0, the decoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. Specifically, the decoding device may further use at least one of three pieces of motion information of neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the current block are H and the coordinates of the top left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample at the (xc-1, yc-1) coordinate, A4 may represent the motion vector of the sample at the (xc, yc-1) coordinate, and A5 may represent the motion vector of the sample at the (xc-1, yc) coordinate. In this case, the decoding device may further use at least one of the motion vectors A3, A4, and A5 as a prediction candidate for v0. That is, the decoding device may further include at least one of a sample of (xc-1, yc-1) coordinates, a sample of (xc-1, yc) coordinates, and a sample of (xc, yc-1) in the neighboring sample group 0.

[0302] Moreover, in the case of the motion vector v2 of CP2, the decoding device may further include the motion information of the neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the three pieces of motion information of the neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by C2, C3, and C4, respectively. In the case where the width and height of the CU including the current block are H and the coordinates of the upper left sample position of the CU are (xc, yc), C2 may represent the motion vector of the sample of the (xc-1, yc+H) coordinates, C3 may represent the motion vector of the sample of the (xc, yc+H) coordinates, and C4 may represent the motion vector of the sample of the (xc-1, yc+H-1) coordinates. In this case, the decoding device may further use at least one of the motion vectors C2, C3, and C4 as a prediction candidate for v2. That is, the decoding device may further include at least one of the samples of (xc-1, yc+H) coordinates, the samples of (xc, yc+H) coordinates, and the samples of (xc-1, yc+H-1) coordinates in the neighboring sample group 2.

[0303] In another example, when the current block is a PU to which a partition type 2N×nU is applied, for example, in the case of a motion vector v0 of CP0, the decoding device can use three pieces of motion information of a plurality of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the decoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the decoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including at least one of the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0304] Furthermore, in the case of motion vector v1 for CP1, the decoding device can use two pieces of motion information from among multiple pieces of motion information for neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are W and H, respectively, and the coordinates of the top-left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample at the (xp+W-1, yp-1) coordinates. In this case, the decoding device can use at least one of motion vectors B0 and B1 as a prediction candidate for v1. That is, the decoding device can derive motion vector v1 for CP1 based on neighboring sample group 1, which includes at least one of the sample at the (xp+W, yp-1) coordinates and the sample at the (xp+W-1, yp-1) coordinates.

[0305] In addition, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information from neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+H), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+H-1). In this case, the decoding device can use at least one of the motion vectors C0 and C1 as the prediction candidate for v2. That is, the decoding device can derive the motion vector v2 for CP2 based on the neighboring sample group 2 that includes at least one of the sample at the coordinates (xp-1, yp+H) and the sample at the coordinates (xp-1, yp+H-1).

[0306] Furthermore, when the partition ID of the current block is 1, the decoding device may further include samples from neighboring blocks of the current CU as prediction candidates for motion vector v0 of CP0 and motion vector v1 of CP1. For example, in the case of motion vector v0 of CP0, the decoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. Specifically, the decoding device may further use at least one of two pieces of motion information of neighboring samples as prediction candidates, and these two pieces of motion information may be represented by A3 and A4, respectively. When the width and height of the CU including the current block are W and the coordinates of the top-left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample at the (xc-1, yc-1) coordinate, and A4 may represent the motion vector of the sample at the (xc, yc-1) coordinate. In this case, the decoding device may further use at least one of motion vectors A3 and A4 as a prediction candidate for v0. That is, the decoding device may further include at least one of the sample at the (xc-1, yc-1) coordinate and the sample at the (xc, yc-1) coordinate in neighboring sample group 0.

[0307] Moreover, in the case of the motion vector v1 of CP1, the decoding device may further include the motion information of the neighboring block (i.e., the neighboring sample) as a prediction candidate. In detail, the decoding device may further use at least one of the two motion information of the neighboring sample as a prediction candidate, and the two motion information may be represented by B2 and B3, respectively. In the case where the width and height of the CU including the current block are W and the coordinates of the upper left sample position of the CU are (xc, yc), B2 may represent the motion vector of the sample of the (xc+W, yc-1) coordinate, and B3 may represent the motion vector of the sample of the (xc+W-1, yc-1) coordinate. In this case, the decoding device may further use at least one of the motion vectors B2 and B3 as a prediction candidate for v1. That is, the decoding device may further include at least one of the sample of the (xc+W, yc-1) coordinate and the sample of the (xc+W-1, yc-1) coordinate in the neighboring sample group 1.

[0308] In another example, when the current block is a PU to which a partition type 2N×nD is applied, for example, in the case of motion vector v0 of CP0, the decoding device can use three pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2, respectively. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 can represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 can represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 can represent the motion vector of the sample of the (xp-1, yp) coordinates. In this case, the decoding device can use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0. That is, the decoding device can derive the motion vector v0 about CP0 based on the neighboring sample group 0 including at least one of the sample of (xp-1, yp-1) coordinates, the sample of (xp, yp-1) coordinates, and the sample of (xp-1, yp) coordinates.

[0309] In addition, in the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are W and H, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates (xp+W, yp-1), and B1 can represent the motion vector of the sample at the coordinates (xp+W-1, yp-1). In this case, the decoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1. That is, the decoding device can derive motion vector v1 for CP1 based on neighboring sample group 1, which includes at least one of the sample at the coordinates (xp+W, yp-1) and the sample at the coordinates (xp+W-1, yp-1).

[0310] In addition, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information from neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+H), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+H-1). In this case, the decoding device can use at least one of the motion vectors C0 and C1 as the prediction candidate for v2. That is, the decoding device can derive the motion vector v2 for CP2 based on the neighboring sample group 2 that includes at least one of the sample at the coordinates (xp-1, yp+H) and the sample at the coordinates (xp-1, yp+H-1).

[0311] In addition, when the partition ID of the current block is 1, the decoding device may further include samples of neighboring blocks of the current CU as prediction candidates for the motion vector v0 of CP0 and the motion vector v1 of CP1. For example, in the case of the motion vector v0 of CP0, the decoding device may further include motion information of neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of three pieces of motion information of neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by A3, A4, and A5, respectively. When the width and height of the CU including the current block are W and the coordinates of the top left sample position of the CU are (xc, yc), A3 may represent the motion vector of the sample at the (xc-1, yc) coordinate, A4 may represent the motion vector of the sample at the (xc-1, yc-1) coordinate, and A5 may represent the motion vector of the sample at the (xc, yc-1) coordinate. In this case, the decoding device may further use at least one of the motion vectors A3, A4, and A5 as a prediction candidate for v0. That is, the decoding device may further include at least one of the sample of (xc-1, yc-1) coordinates, the sample of (xc-1, yc) coordinates, and the sample of (xc, yc-1) coordinates in the neighboring sample group 0.

[0312] Moreover, in the case of the motion vector v1 of CP1, the decoding device may further include the motion information of the neighboring blocks (i.e., neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the three pieces of motion information of the neighboring samples as a prediction candidate, and the three pieces of motion information may be represented by B2, B3, and B4, respectively. When the width and height of the CU including the current block are W and the coordinates of the upper left sample position of the CU are (xc, yc), B2 may represent the motion vector of the sample of the (xc+W, yc) coordinates, B3 may represent the motion vector of the sample of the (xc+W, yc-1) coordinates, and B4 may represent the motion vector of the sample of the (xc+W-1, yc-1) coordinates. In this case, the decoding device may further use at least one of the motion vectors B2, B3, and B4 as a prediction candidate for v1. That is, the decoding device may further include at least one of the samples of (xc+W, yc) coordinates, the samples of (xc+W, yc-1) coordinates, and the samples of (xc+W-1, yc-1) coordinates in the neighboring sample group 1.

[0313] In another example, the decoding device may use the same prediction candidate of the PU included in the CU as a prediction candidate for the motion vector of the CP, regardless of the partition ID. For example, in the case of the motion vector v0 of the CP0 of the current block, the decoding device may use three pieces of motion information among the multiple pieces of motion information of the neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) as prediction candidates, and the three pieces of motion information may be represented by A0, A1, and A2, respectively. When the width and height of the CU are W and H, respectively, and the coordinates of the upper left sample position of the CU are (xc, yc), A0 may represent the motion vector of the sample of (xc-1, yc-1), A1 may represent the motion vector of the sample of (xc, yc-1) coordinates, and A2 may represent the motion vector of the sample of (xc-1, yc) coordinates. In this case, the decoding device may use at least one of the motion vectors A0, A1, and A2 as a prediction candidate for v0.

[0314] In addition, in the case of motion vector v1 of CP1 of the current block, the decoding device can use two pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the CU are W and the coordinates of the upper left sample position of the CU are (xc, yc), B0 can represent the motion vector of the sample at the (xc+W, yc-1) coordinates, and B1 can represent the motion vector of the sample at the (xc+W-1, yc-1) coordinates. In this case, the decoding device can use at least one of the motion vectors B0 and B1 as a prediction candidate for v1.

[0315] In addition, in the case of motion vector v2 of CP2 of the current block, the decoding device can use two pieces of motion information among the motion information of the neighboring blocks (or neighboring samples) as prediction candidates, and these two pieces of motion information can be represented by C0 and C1 respectively. When the width and height of the CU are W and the coordinates of the upper left sample position of the CU are (xc, yc), C0 can represent the motion vector of the sample of the (xc-1, yc+H) coordinates and C1 can represent the motion vector of the sample of the (xc-1, yc+H-1) coordinates. In this case, the decoding device can use at least one of the motion vectors C0 and C1 as a prediction candidate for v2.

[0316] In another example, as a method of configuring prediction candidates for a motion vector of a CP of a PU to which an nL×2N, nR×2N, 2N×nU, or 2N×nD partition type is applied, the prediction candidates may be limited to a predetermined number to be configured.

[0317] In another example, when the current block is a PU to which a partition type nL×2N, nR×2N, 2N×nU, or 2N×nD is applied, the decoding device may configure prediction candidates for each CP by limiting their number to two. For example, in the case of a motion vector v0 of CP0, the decoding device may use two pieces of motion information of a plurality of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by A0 and A1. When the width and height of the current block are W and H, respectively, and the coordinates of the upper left sample position of the current block are (xp, yp), A0 may represent the motion vector of the sample of the (xp-1, yp-1) coordinates, and A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates. In this case, the decoding device may use A0 and A1 as prediction candidates for v0. That is, the decoding device may include the sample of the (xp-1, yp-1) coordinate and the sample of the (xp, yp-1) coordinate in the neighboring sample group 0, and the availability of the sample of the (xp-1, yp-1) coordinate and the sample of the (xp, yp-1) coordinate may be sequentially determined according to the first predefined priority order.

[0318] In addition, in the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. When the width and height of the current block are W and H, respectively, and the coordinates of the top left sample position of the current block are (xp, yp), B0 can represent the motion vector of the sample at the coordinates (xp+W, yp-1), and B1 can represent the motion vector of the sample at the coordinates (xp+W-1, yp-1). In this case, the decoding device can use B0 and B1 as prediction candidates for v1. That is, the decoding device can include the sample at the coordinates (xp+W, yp-1) and the sample at the coordinates (xp+W-1, yp-1) in neighboring sample group 1, and the availability of the sample at the coordinates (xp+W, yp-1) and the sample at the coordinates (xp+W-1, yp-1) can be sequentially determined according to the second predefined priority order.

[0319] Furthermore, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information from among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by C0 and C1. When the width and height of the current block are W and H, respectively, and the coordinates of the top-left sample position of the current block are (xp, yp), C0 can represent the motion vector of the sample at the coordinates (xp-1, yp+H), and C1 can represent the motion vector of the sample at the coordinates (xp-1, yp+H-1). In this case, the decoding device can use C0 and C1 as prediction candidates for v2. That is, the decoding device can include the sample at the coordinates (xp-1, yp+H) and the sample at the coordinates (xp-1, yp+H-1) in neighboring sample group 2, and the availability of the sample at the coordinates (xp-1, yp+H) and the sample at the coordinates (xp-1, yp+H-1) can be sequentially determined according to the third predefined priority order.

[0320] In addition, the decoding device can derive the motion vector of the CP of the current PU based on the motion vector derived in the previous decoding process without receiving additional motion information.

[0321] For example, in the case of CP0, when the top block among the left neighboring blocks adjacent to the left boundary of the current block is decoded based on the affine motion model, the motion vector of CP0 of the current block can be derived based on the motion vector of CP1 of the corresponding block. Furthermore, when the leftmost block among the upper neighboring blocks adjacent to the upper boundary of the current block is decoded based on the affine motion model, the motion vector of CP0 of the current block can be derived based on the motion vector of CP2 of the corresponding block. Furthermore, when the upper left neighboring block of the current block is decoded based on the affine motion model, the motion vector of CP0 of the current block can be derived based on the motion vector of the lower right neighboring sample of the corresponding block derived based on the CP of the corresponding block. In this case, the motion vector of the lower right neighboring sample of the corresponding block can be derived based on the CP of the corresponding block based on the above equations 2 to 5.

[0322] For example, in the case of CP1, when the upper right neighboring block of the current block is decoded based on the affine motion model, the motion vector of CP1 of the current block can be derived based on the motion vector of CP2 of the corresponding block. When the rightmost block of the upper neighboring block adjacent to the upper boundary of the current block is decoded based on the affine motion model, the motion vector of CP1 of the current block can be derived based on the motion vector of the lower right neighboring sample of the corresponding block derived based on the CP of the block. In this case, the motion vector of the lower right neighboring sample of the corresponding block can be derived based on the CP of the corresponding block based on the above equations 2 to 5.

[0323] For example, in the case of CP2, when the lower left neighboring block of the current block is decoded based on the affine motion model, the motion vector of CP2 of the current block can be derived based on the motion vector of CP1 of the corresponding block. Furthermore, when the bottommost block of the left neighboring block adjacent to the left boundary of the current block is decoded based on the affine motion model, the motion vector of CP2 of the current block can be derived based on the motion vector of the lower right neighboring sample of the corresponding block derived based on the CP of the current block. In this case, the motion vector of the lower right neighboring sample of the corresponding block can be derived based on the CP of the corresponding block based on the above equations 2 to 5.

[0324] The decoding device derives a sample-unit motion vector in the current block based on the obtained motion vector (S2020). Based on the motion vector of CP0, the motion vector of CP1, and the motion vector of CP2, the decoding device may derive the sample-unit motion vector according to the sample position in the current block. In this case, the decoding device may derive the sample-unit motion vector at the sample position in the current block based on Equations 2 to 5.

[0325] The decoding device derives prediction samples for the current block based on the sample-unit motion vector (S2030). The decoding device may derive a reference region in a reference picture based on the sample-unit motion vector and generate prediction samples for the current block based on reconstructed samples in the reference region.

[0326] The decoding device may generate reconstructed samples based on the predicted samples. If the prediction mode for the current block is not skip mode, the decoding device may obtain a residual signal from the bitstream received from the encoding device and generate residual samples for the current block. In this case, the decoding device may generate reconstructed samples based on the predicted samples and the residual samples. The decoding device may generate a reconstructed picture based on the reconstructed samples.

[0327] According to the present invention described above, a more accurate sample-unit motion vector for a current block can be derived, and inter-prediction efficiency can be significantly increased.

[0328] Also, according to the present invention, a motion vector for a sample of a current block can be efficiently derived based on a motion vector for a control point of the current block.

[0329] Furthermore, according to the present invention, without separately transmitting information about the motion vectors of the control points of the current block, the motion vectors of the control points of the current block can be derived based on the motion vectors of the control points of the previously decoded neighboring blocks. Therefore, the amount of data for the motion vectors of the control points can be eliminated or reduced, and the overall coding efficiency can be improved.

[0330] In addition, according to the present invention, even in the case where the image of the current block is rotated, enlarged, reduced, or deformed in a parallelogram, and in the case where the image of the current block is plane-shifted, inter-frame prediction can be efficiently performed using a sample-unit motion vector. Therefore, the amount of data of the residual signal for the current block can be eliminated or reduced, and the overall coding efficiency can be improved.

[0331] In the above-mentioned embodiment, the method is described based on a flowchart using a series of steps or blocks, but the present invention is not limited to the order of the steps. Some steps may occur simultaneously or in a different order than the steps described above. In addition, it should be understood by those skilled in the art that the steps shown in the sequence diagram are not exclusive and other steps may be included, or one or more steps in the flowchart may be deleted without affecting the scope of the present invention.

[0332] The above method according to the present invention can be implemented by software.The encoding device and / or decoding device according to the present invention can be included in a device that performs image processing, for example, for a TV, computer, smart phone, set-top box or display device.

[0333] When the embodiments of the present invention are implemented in software, the above methods can be implemented by modules (processes, functions, etc.) that perform the above functions. Such modules can be stored in a memory and executed by a processor. The memory can be inside or outside the processor, and the memory can be coupled to the processor using various well-known means. The processor may include an application-specific integrated circuit (ASIC), other chipsets, logic circuits, and / or data processing equipment. The memory may include a ROM (read-only memory), a RAM (random access memory), a flash memory, a memory card, a storage medium, and / or other storage devices.

Claims

1. A video decoding device, the video decoding device being configured to: A motion vector of a control point (CP) for the current block is derived based on the size of the current block, wherein: determining a size of the current block based on a width of the current block and a height of the current block; deriving a motion vector associated with a sample position in the current block based on the obtained motion vector for the CP; deriving a prediction sample for the current block based on the motion vector associated with the sample position; as well as generating a reconstructed block for the current block based on the derived prediction samples for the current block, The CP includes a first CP, a second CP, and a third CP, wherein the first CP is used for the upper left corner of the current block, the second CP is used for the upper right corner of the current block, and the third CP is used for the lower left corner of the current block. wherein the motion vectors for the CPs include a first motion vector for the first CP, a second motion vector for the second CP, and a third motion vector for the third CP, wherein the first motion vector is derived based on a first checked available block in the first block group according to a first predefined priority order, the first predefined priority order being a priority among blocks included in the first block group, wherein the second motion vector is derived based on the first checked available block in the second block group according to a second predefined priority order, the second predefined priority order being a priority among blocks included in the second block group, wherein the third motion vector is derived based on the first checked available block in the third block group according to a third predefined priority order, the third predefined priority order being a priority among blocks included in the third block group, The first block group includes an upper left corner neighboring block of the current block, a first upper neighboring block which is a leftmost block among blocks adjacent to the upper side of the current block, and a first left neighboring block which is an uppermost block among blocks adjacent to the left side of the current block. wherein the second block group includes an upper right corner neighboring block of the current block and a second upper neighboring block which is the rightmost block among blocks adjacent to the upper side of the current block, and The third block group includes a lower left corner neighboring block of the current block and a second left neighboring block which is a lowermost block among blocks adjacent to the left side of the current block.

2. The video decoding device according to claim 1, wherein The motion vector associated with the sample position is derived based on the following equation, Vx=(Vx1-Vx0)*x / W+(Vx2-Vx0)*y / H+Vx0, Vy=(Vy1-Vy0)*x / W+(Vy2-Vy0)*y / H+Vy0, and Wherein, Vx represents the x component of the motion vector associated with the sample position at the coordinates of (x, y), Vy represents the y component of the motion vector associated with the sample position at the coordinates of (x, y), Vx0 represents the x component of the first motion vector for the first CP, Vy0 represents the y component of the first motion vector for the first CP, Vx1 represents the x component of the second motion vector for the second CP, Vy1 represents the y component of the second motion vector for the second CP, Vx2 represents the x component of the third motion vector for the third CP, and Vy2 represents the y component of the third motion vector for the third CP.

3. The video decoding device according to claim 1, wherein The upper left neighboring block is located at the coordinates of (xp-1, yp-1), the first upper neighboring block is located at the coordinates of (xp, yp-1), and the first left neighboring block is located at the coordinates of (xp-1, yp), The upper right corner neighboring block is located at the coordinates of (xp+W, yp-1), and the second upper neighboring block is located at the coordinates of (xp+W-1, yp-1), and The lower left neighboring block is located at the coordinates of (xp-1, yp+H), and the second left neighboring block is located at the coordinates of (xp-1, yp+H-1), and where (xp, yp) is the top left sample position of the current block, and W and H are the width and height of the current block, respectively.

4. The video decoding device according to claim 1, wherein The first predefined priority order is from the upper left neighboring block to the first upper neighboring block to the first left neighboring block, wherein the second predefined priority order is from the upper right corner neighboring block to the second upper neighboring block, and The third predefined priority order is from the lower left neighboring block to the second left neighboring block.

5. The video decoding device according to claim 1, in, H equals W / 2, and wherein the second CP is located at the coordinate of (xp+W,yp), and the third CP is located at the coordinate of (xp,yp+W / 2), and Wherein, (xp, yp) is the top left sample position of the current block, and W and H are the width and height of the current block respectively. The video decoding device according to claim 5 , wherein: The motion vector associated with the sample position is derived based on the following equation, Vx=(Vx1-Vx0)*x / W+(Vx2-Vx0)*y / (W / 2)+Vx0, Vy=(Vy1-Vy0)*x / W+(Vy2-Vy0)*y / (W / 2)+Vy0, and Wherein, Vx represents the x component of the motion vector associated with the sample position at the coordinates of (x, y), Vy represents the y component of the motion vector associated with the sample position at the coordinates of (x, y), Vx0 represents the x component of the first motion vector for the first CP, Vy0 represents the y component of the first motion vector for the first CP, Vx1 represents the x component of the second motion vector for the second CP, Vy1 represents the y component of the second motion vector for the second CP, Vx2 represents the x component of the third motion vector for the third CP, and Vy2 represents the y component of the third motion vector for the third CP.

7. The video decoding device according to claim 5, wherein: The upper left neighboring block is located at the coordinates of (xp-1, yp-1), the first upper neighboring block is located at the coordinates of (xp, yp-1), and the first left neighboring block is located at the coordinates of (xp-1, yp), The upper right corner neighboring block is located at the coordinates of (xp+W, yp-1), and the second upper neighboring block is located at the coordinates of (xp+W-1, yp-1), and The lower left neighboring block is located at the coordinates of (xp-1, yp+W / 2), and the second left neighboring block is located at the coordinates of (xp-1, yp+W / 2-1).

8. A video encoding device, the video encoding device being configured to: The motion vector of the control point (CP) for the current block is derived based on the size of the current block, where determining a size of the current block based on a width of the current block and a height of the current block; deriving a motion vector associated with a sample position in the current block based on the obtained motion vector for the CP; performing prediction for the current block based on the motion vector associated with the sample position; as well as encoding video information about a prediction for said current block, The CP includes a first CP, a second CP, and a third CP, wherein the first CP is used for the upper left corner of the current block, the second CP is used for the upper right corner of the current block, and the third CP is used for the lower left corner of the current block. The motion vectors for the CPs include a first motion vector for the first CP, a second motion vector for the second CP, and a third motion vector for the third CP. wherein the first motion vector is derived based on a first checked available block in the first block group according to a first predefined priority order, the first predefined priority order being a priority among blocks included in the first block group, wherein the second motion vector is derived based on the first checked available block in the second block group according to a second predefined priority order, the second predefined priority order being a priority among blocks included in the second block group, wherein the third motion vector is derived based on the first checked available block in the third block group according to a third predefined priority order, the third predefined priority order being a priority among blocks included in the third block group, The first block group includes an upper left corner neighboring block of the current block, a first upper neighboring block which is a leftmost block among blocks adjacent to the upper side of the current block, and a first left neighboring block which is an uppermost block among blocks adjacent to the left side of the current block. wherein the second block group includes an upper right corner neighboring block of the current block and a second upper neighboring block which is the rightmost block among blocks adjacent to the upper side of the current block, and The third block group includes a lower left corner neighboring block of the current block and a second left neighboring block which is a lowermost block among blocks adjacent to the left side of the current block.

9. The video encoding device according to claim 8, wherein The motion vector associated with the sample position is derived based on the following equation, Vx=(Vx1-Vx0)*x / W+(Vx2-Vx0)*y / H+Vx0, Vy=(Vy1-Vy0)*x / W+(Vy2-Vy0)*y / H+Vy0, and Wherein, Vx represents the x component of the motion vector associated with the sample position at the coordinates of (x, y), Vy represents the y component of the motion vector associated with the sample position at the coordinates of (x, y), Vx0 represents the x component of the first motion vector for the first CP, Vy0 represents the y component of the first motion vector for the first CP, Vx1 represents the x component of the second motion vector for the second CP, Vy1 represents the y component of the second motion vector for the second CP, Vx2 represents the x component of the third motion vector for the third CP, and Vy2 represents the y component of the third motion vector for the third CP.

10. The video encoding device according to claim 8, wherein The upper left neighboring block is located at the coordinates of (xp-1, yp-1), the first upper neighboring block is located at the coordinates of (xp, yp-1), and the first left neighboring block is located at the coordinates of (xp-1, yp), The upper right corner neighboring block is located at the coordinates of (xp+W, yp-1), and the second upper neighboring block is located at the coordinates of (xp+W-1, yp-1), and The lower left neighboring block is located at the coordinates of (xp-1, yp+H), and the second left neighboring block is located at the coordinates of (xp-1, yp+H-1).

11. The video encoding device according to claim 8, in, The first predefined priority order is from the upper left neighboring block to the first upper neighboring block to the first left neighboring block, wherein the second predefined priority order is from the upper right corner neighboring block to the second upper neighboring block, and The third predefined priority order is from the lower left neighboring block to the second left neighboring block.

12. The video encoding device according to claim 8, in, H is equal to W / 2, Wherein, the second CP is located at the coordinate of (xp+W,yp), and the third CP is located at the coordinate of (xp,yp+W / 2), Wherein, (xp, yp) is the top left sample position of the current block, and W and H are the width and height of the current block respectively.

13. The video encoding device according to claim 12, wherein: The motion vector associated with the sample position is derived based on the following equation, Vx=(Vx1-Vx0)*x / W+(Vx2-Vx0)*y / (W / 2)+Vx0, Vy=(Vy1-Vy0)*x / W+(Vy2-Vy0)*y / (W / 2)+Vy0, and Wherein, Vx represents the x component of the motion vector associated with the sample position at the coordinates of (x, y), Vy represents the y component of the motion vector associated with the sample position at the coordinates of (x, y), Vx0 represents the x component of the first motion vector for the first CP, Vy0 represents the y component of the first motion vector for the first CP, Vx1 represents the x component of the second motion vector for the second CP, Vy1 represents the y component of the second motion vector for the second CP, Vx2 represents the x component of the third motion vector for the third CP, and Vy2 represents the y component of the third motion vector for the third CP.

14. The video encoding device according to claim 12, wherein: The upper left neighboring block is located at the coordinates of (xp-1, yp-1), the first upper neighboring block is located at the coordinates of (xp, yp-1), and the first left neighboring block is located at the coordinates of (xp-1, yp), The upper right corner neighboring block is located at the coordinates of (xp+W, yp-1), and the second upper neighboring block is located at the coordinates of (xp+W-1, yp-1), and The lower left neighboring block is located at the coordinates of (xp-1, yp+W / 2), and the second left neighboring block is located at the coordinates of (xp-1, yp+W / 2-1).

15. A transmission device for video data, the transmission device being configured to: Obtaining a bitstream for the video, wherein generating the bitstream based on: deriving a motion vector for a control point (CP) of the current block based on a size of the current block, deriving a motion vector associated with a sample position in the current block based on the obtained motion vector for the CP, performing prediction for the current block based on the motion vector associated with the sample position, and generating video information regarding the prediction for the current block; as well as sending said data comprising said bitstream, The size of the current block is determined based on the width and height of the current block. The CP includes a first CP, a second CP, and a third CP, wherein the first CP is used for the upper left corner of the current block, the second CP is used for the upper right corner of the current block, and the third CP is used for the lower left corner of the current block. The motion vectors for the CPs include a first motion vector for the first CP, a second motion vector for the second CP, and a third motion vector for the third CP. wherein the first motion vector is derived based on a first checked available block in the first block group according to a first predefined priority order, the first predefined priority order being a priority among blocks included in the first block group, wherein the second motion vector is derived based on the first checked available block in the second block group according to a second predefined priority order, the second predefined priority order being a priority among blocks included in the second block group, wherein the third motion vector is derived based on the first checked available block in the third block group according to a third predefined priority order, the third predefined priority order being a priority among blocks included in the third block group, The first block group includes an upper left corner neighboring block of the current block, a first upper neighboring block which is a leftmost block among blocks adjacent to the upper side of the current block, and a first left neighboring block which is an uppermost block among blocks adjacent to the left side of the current block. wherein the second block group includes an upper right corner neighboring block of the current block and a second upper neighboring block which is the rightmost block among blocks adjacent to the upper side of the current block, and The third block group includes a lower left corner neighboring block of the current block and a second left neighboring block which is a lowermost block among blocks adjacent to the left side of the current block.

Citation Information

Patent Citations

  • Method and device for encoding / decoding image using feature vectors of surrounding blocks

    CN103299639A

  • A method for decoding video signals having a current block which is to be decoded

    CN104378638A