Inter-frame prediction method and device in video coding system
By adopting an inter-frame prediction method based on affine motion model in the video compilation system, the control points and sample unit motion vectors of the current block are derived, and the problem of high-resolution image transmission and storage costs are solved, and efficient inter-frame prediction and compilation effects are achieved.
Patent Information
- Application Number
- CN202210527381.3
- 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-05-16
- Estimated Expiration
- 2036-07-15
AI Technical Summary
The prior art is difficult to effectively compress and transmit high-resolution, high-quality images, resulting in increased transmission and storage costs.
The inter prediction method based on the affine motion model is adopted to derive the sample unit motion vector by deriving the motion vector of the control point of the current block, thereby improving the efficiency of inter prediction.
The efficiency of inter-frame prediction is significantly improved, the amount of data of residual signals is reduced, and the overall compilation cost is reduced.
Smart Images

Figure CN114866770B_ABST
Abstract
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 device in a video coding system. Background Art
[0003] The demand for high-resolution, high-quality images, such as HD (high definition) images and UHD (ultra-high definition) images, is increasing in various fields. Because image data has high resolution and high quality, the amount of information or bits to be transmitted increases relative to conventional image data. Therefore, when image data is transmitted using a medium such as a conventional wired / wireless broadband line or stored using an existing storage medium, its transmission cost and storage cost 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 a device 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 sample unit motion vector 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 device 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] On the other hand, 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 vector of the sample in the current block can be efficiently derived based on the motion vector of the control point of the current block.
[0020] According to the present invention, without additionally 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 neighboring block previously decoded. Therefore, the data amount 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 in the case where 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 by a sample-unit motion vector. Therefore, the data amount 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] Fig. 9 is a view illustrating the CP of an asymmetric PU.
[0031] Fig.10 is a view illustrating motion information prediction candidates of a CP of a PU to which a partition type 2Nx2N is applied.
[0032] Fig.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] Fig.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] Fig.13is a view illustrating motion information prediction candidates of a CP of a PU to which a partition type Nx2N is applied.
[0035] Fig.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] Fig.15 is a view illustrating motion information prediction candidates of a CP of an asymmetric PU.
[0037] Fig.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] Fig.17 is a view illustrating a PU including a CP requiring motion information coding and a CP not requiring motion information coding.
[0039] Fig.18 is a view illustrating a PU including a CP that does not require motion information coding.
[0040] Fig.19 is a view schematically illustrating a video encoding method of an encoding apparatus according to the present invention.
[0041] Fig. 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 its specific embodiments 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. The representation of the singular includes the representation of the plural number, as long as it is 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 increase 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 the 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 element can be merged to form a single element, or an element can be divided into multiple elements. Without departing from the concept of the present invention, the embodiment in which the elements are merged and / or divided belongs to 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 encoding 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 CU as a quadtree structure. The CU can be segmented into a CU with a deeper depth as a quadtree structure. PU and TU can be obtained from the CU. For example, the PU can be segmented into a symmetrical or asymmetrical 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 may be a CU, a TU, or a PU. The prediction module 110 may determine whether the prediction performed on the corresponding processing unit is an inter-frame prediction or an intra-frame prediction, and may determine specific details, such as a prediction mode of a 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 the prediction mode may be determined in units of PUs, and the prediction process may 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 prediction methods, skip mode, merge mode, and advanced motion vector prediction (AMVP) can be used. In inter 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. may be entropy encoded and then sent to the decoding device. When the skip mode is applied, the prediction block may be used as a reconstructed block so that the residual may not be generated, transformed, quantized, or sent.
[0053] When intra prediction is performed, a prediction mode may be determined in PU units and a prediction process may be performed in PU units. Alternatively, a 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 may be configured after applying a filter to a reference sample. At this time, it may be determined whether the filter should be applied to the reference sample 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 transmitted 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 a 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 , that is, 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 symbol according to a probability distribution based on the quantized transform value rearranged by the rearrangement module 130 or the encoding parameter value calculated during the encoding process, and then output a bit stream. 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 regard, the symbol means a syntax element, a coding parameter, a residual signal value, etc. to be encoded / decoded. Coding parameters are necessary for encoding and decoding. Coding parameters may contain information that can be inferred during encoding or decoding, as well as information that is encoded in an encoding device and passed to a decoding device like a syntax element. Coding parameters are information required for encoding or decoding an image. Coding parameters may include statistics or values such as intra / inter prediction mode, movement / motion vector, reference picture index, coding block pattern, presence or absence of a residual signal, transform coefficient, quantized transform coefficient, quantization parameter, block size, block partition information, etc. In addition, a residual signal may mean the difference between an original signal and a predicted signal. In addition, the difference between the original signal and the predicted signal may be transformed to define a residual signal, or the difference between the original signal and the predicted signal may be transformed and quantized to define a residual signal. The residual signal may be referred to as a residual block in a block unit, and may be referred to as a residual sample in a sample unit.
[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 coding can be increased via 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 perform entropy coding using the stored VLC table. In addition, the entropy coding module 135 derives a binarization method of the corresponding symbol and a probability model of 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 a predetermined change 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 the example, the residual block and the prediction block are added by an adder to create a reconstructed block. At this time, the adder can be regarded as a specific unit for generating a reconstructed block, i.e., a reconstructed block creation unit.
[0073] The filtering module 155 applies a deblocking filter, an ALF adaptive loop filter, and a SAO sample adaptive offset to the reconstructed picture.
[0074] The deblocking filter removes block distortion generated at the boundary between blocks in the reconstructed picture. ALF performs the filtering process based on the comparison result value of the original image and the reconstructed image whose blocks are filtered by the deblocking filter. ALF can be used only when high efficiency is required. SAO reconstruction has the offset difference between the residual block with the deblocking filter applied thereto 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 2 is a block diagram schematically illustrating a video decoding device 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 220 , a dequantization module 230 , an inverse transform module 240 , a prediction module 250 , a filtering module 270 , and a memory 280 .
[0077] When a video bitstream is input from a video encoding device, the input bitstream may be decoded based on an order in which the video encoding device processes video information.
[0078] The entropy decoding module 210 may perform entropy decoding on the input bit stream according to the probability distribution to generate symbols in the form of quantized coefficients. The entropy decoding method is a method of receiving a sequence of binary numbers and using 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 of the syntax element to be decoded, decoding information of adjacent blocks and blocks to be decoded, or information of symbols / bins decoded in the previous step, and predicting the probability of bin occurrence according to the determined context model and thereby performing arithmetic decoding of the bins to generate symbols corresponding to the values of each syntax element. In this regard, after determining the context model, the CABAC entropy decoding method may further include the step of updating the context model using information of the decoded symbol / bin to determine the context model of 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 250 , 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 220 .
[0082] The rearrangement module 220 may rearrange the bitstream information entropy-decoded by the entropy decoding module 210 , that is, the quantized transform coefficients, based on a rearrangement method in the video encoding apparatus.
[0083] The rearrangement module 220 can 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 220 can scan the coefficients based on the prediction mode applied to the current block transform block and the size of the transform block, and can create an array of coefficient quantization transform coefficients in the form of a two-dimensional block.
[0084] The dequantization module 230 may perform dequantization based on the quantization parameter supplied from the video encoding apparatus and the coefficient value of the rearranged block.
[0085] The inverse transform module 240 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 a transmission unit or a partition unit of a picture determined by a video encoding device. The transform module of the video encoding device may selectively perform DCT and / or DST according to a plurality of information pieces such as a prediction method, a size of a current block, and a prediction direction, and the inverse transform module 240 of the video decoding device may perform the inverse transform based on the transform information about the transform performed by the transform module of the video encoding device.
[0087] The prediction module 250 generates a prediction block 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 250 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 an inter prediction mode, the prediction module 250 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 250 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 the inter prediction may include an advanced motion vector prediction (AMVP) mode, a merge mode, and the like.
[0092] For example, when the merge mode is applied, the encoding device and the decoding device may generate a merge candidate list using the motion vector of the reconstructed spatial neighboring block and / or the motion vector corresponding to the Col block as the temporal neighboring block. 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 may send a merge index indicating the candidate block having the optimal motion vector selected from the candidate blocks included in the merge candidate list to the decoding device. In such a case, the decoding device may 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 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 motion vector predictor candidate list. That is, the motion vector of the reconstructed spatial neighboring block and / or the motion vector corresponding to the Col block as the temporal neighboring block can be used as a motion vector candidate. 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 a motion vector for a current block and a 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 via addition between the decoded motion vector difference and the motion vector predictor.
[0095] In addition, the encoding device may transmit a reference picture index indicating the reference picture to the decoding device.
[0096] The prediction module 250 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 a reconstructed sample (or a reconstructed sample array) by adding the prediction sample (or a prediction sample array) obtained from the transform coefficient sent by the encoding device and the residual sample. Based on these reconstructed samples, a reconstructed block and a reconstructed picture can be generated.
[0098] In the above 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 the skip mode, which is one of the other modes for inter-picture prediction, the neighboring block information can be used as is for the current block. Therefore, in the case of the skip mode, the encoding device does not send syntax information such as 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 250 and the residual block provided by the inverse transform module 240 . Figure 2 The diagram shows that using an adder, the prediction block and the residual block are combined to generate a reconstructed block. In this regard, the adder can be regarded as a separate module (reconstruction block generation module) configured to generate a reconstructed block. In this regard, the reconstructed block includes a reconstructed sample or a reconstructed sample array as described above; the prediction block includes a prediction sample or a prediction sample array; the residual block can include a residual sample or a residual sample array. Therefore, it can be considered that the reconstructed sample or the reconstructed sample array is generated by combining the corresponding prediction sample or the prediction sample array with the corresponding residual sample or the residual sample array.
[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 270. The filtering module 270 may perform a deblocking filtering operation, an SAO operation, and / or an ALF operation on the reconstructed block and / or picture.
[0103] The memory 280 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 220, the dequantization module 230, the inverse transform module 240, the prediction module 250, the filtering module 270 and the memory 280 included in the decoding device 200, for example, the entropy decoding module 210, the rearrangement module 220, the dequantization module 230, the inverse transform module 240, the prediction module 250, the filtering module 270, 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, which parses information related to the encoded image included in the bitstream. The parsing module may include an 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 prediction may be performed on the current block in consideration of the motion of a target object or an image between pictures. However, the existing inter prediction method is performed based on a method of compensating for translational motion (translational motion model). Since inter prediction is performed by deriving a reference block that matches the current block based on a motion vector, the translational motion model may be referred to as a block matching method. That is, in the method applied to the existing inter prediction and translational motion model, all samples of a 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 prediction efficiency is reduced due to deformations such as enlargement, reduction, rotation, etc. 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 a 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 an affine motion model may be similar to 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') can 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. Figure 5 The figure in the figure shows the derivation 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. x ,v y ) is the 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 according to 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 derived as Figures 6 to 16 A specific embodiment thereof is described.
[0115] Figure 6 is a view illustrating a CP of a PU partitioned from a CU based on a partition type 2N×2N.
[0116] As illustrated 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 an equation for deriving a sample unit motion vector in a PU partitioned from a CU based on a partition type 2N×2N. For example, the motion vector of the upper left sample in the PU may be referred to as V0. In addition, using samples of neighboring blocks adjacent to the PU, the motion vectors of each CP may 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 may be set to (xp, yp), the coordinates of CP1 may be set to (xp+S, yp), and the coordinates of CP2 may be set to (xp, yp+S). The motion vector of CP0 may be set to V0, the motion vector of CP1 may be set to V1, and the motion vector of CP2 may be V2. The motion vector of the CP may be used to derive the sample unit motion vector. The sample unit motion vector may be derived based on the following equation.
[0118] [Equation 2]
[0119]
[0120] Here, V x and V y Vx0 and Vy0 represent the x component and y component of the motion vector of the sample of the (x, y) coordinate in the current block, respectively, Vx1 and Vy1 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, respectively. 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, a 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 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 component and y component of the motion vector of the sample of the (x, y) coordinate in the current block, respectively, Vx1 and Vy1 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, 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 a relative position in the PU for each sample of the PU partitioned from the CU based on the partition type N×2N.
[0125] Figure 8 The figure shows the CP of a PU partitioned from a CU based on a partition type of 2N×N. Figure 8 As shown in FIG. 1 , 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 to Figure 8 The shape of the PU illustrated in FIG. 1 adjusts the height 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 may be derived based on the following equation.
[0126] [Equation 4]
[0127]
[0128] Here, V x and V y denotes the x component and y component of the motion vector of the sample of the (x, y) coordinate in the current block, respectively, Vx0 and Vy0 denote the x component and y component of the motion vector V0 for CP0, Vx1 and Vy1 denote the x component and y component of the motion vector V1 for CP1, and Vx2 and Vy2 denote the x component and y component 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 may be derived based on a relative position in a PU for each sample that is used to partition a PU from a CU based on a partition type 2N×N.
[0129] Fig. 9 The CP of an asymmetric PU is illustrated. 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 Fig. 9 As shown in FIG. 1 , 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 may be used to derive the sample-unit motion vector: Fig. 9 The shape of the PU illustrated in the figure 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 may be set to (xp, yp), the coordinates of CP1 may be set to (xp+W, yp), and the coordinates of CP2 may be set to (xp, yp+H). In this case, the sample unit motion vector in the PU may be derived based on the following equation.
[0131] [Equation 5]
[0132]
[0133] Here, V x and V yVx0 and Vy0 represent the x component and y component of the motion vector of the sample of the (x, y) coordinate in the current block, respectively, 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, respectively. Equation 5 represents an equation for deriving a sample unit motion vector considering the width and height of the 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 a partition type of 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 may be selected based on the motion information of neighboring blocks or neighboring samples of the PU. The motion information prediction candidate may be referred to as a motion information candidate or a motion vector candidate.
[0135] Fig.10 The figure shows motion information prediction candidates of a CP to which a PU of a partition type 2N×2N is applied. Fig.10 , showing a method for configuring motion information prediction candidates for CPs. Motion information of neighboring blocks (or neighboring samples) adjacent to each CP can be used as prediction candidates for motion information of three CPs. In addition, 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 neighboring blocks (or neighboring samples) previously decoded 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 among multiple pieces of motion information of neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. In the case where 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 (xp+S-1, yp-1) coordinates, and B1 can represent the motion vector of the sample of (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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. In the case where 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 In detail, for example, in the case where 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 in the case where 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 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 is true for the remaining embodiments.
[0140] Fig.11 The figure shows motion information prediction candidates of a CP of a PU with a partition type of 2NxN. Fig.11 , showing a method for configuring motion information prediction candidates of CP. Fig.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 prediction candidates for the motion vector of the CP 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 a prediction candidate 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 a prediction candidate 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 neighboring blocks (or neighboring samples) previously decoded 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 among multiple pieces of motion information of neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. In the case where 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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. In the case where 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 neighboring blocks of the current CU may be further included 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, motion information of previously decoded neighboring blocks (i.e., 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. In the case where 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 motion vector v1 of CP1, the motion information of the previously decoded neighboring block (or neighboring sample) can be used as a prediction candidate. In detail, at least one of the three motion information of the neighboring sample can be further used as a prediction candidate, and the three motion information can be represented by B2, B3 and B4, respectively. In the case where 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 may 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 of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) may be used 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 S 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, at least one of the motion vectors A0, A1, and A2 may 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 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. In the case where 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 the multiple pieces of 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. In the case where 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) coordinates and C1 can represent the motion vector of the sample of the (xc-1, yc+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.
[0149] As a method of configuring prediction candidates of a motion vector for a CP of 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] Fig.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. Fig.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 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 among multiple pieces of motion information of neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. In the case where 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. In the case where 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] Fig.13 The figure shows motion information prediction candidates of a CP of a PU with a partition type of N×2N. Fig.13 , showing a method for configuring motion information prediction candidates of CP. Fig.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 the prediction candidates for the motion vector of the CP may be configured in consideration of the decoding process order of the PU.
[0154] like Fig.13As illustrated in , the coded motion information of the neighboring blocks (or neighboring samples) adjacent to each CP can be used as a prediction candidate for the motion information of the three CPs. In the case of applying the affine motion model to the neighboring blocks, the motion information of the neighboring samples adjacent to each CP can be used as a prediction candidate 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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1, and A2. In the case where 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 motion vector v1 of CP1, two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. In the case where 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 (xp+S / 2, yp-1) coordinates, and B1 can represent the motion vector of the sample of (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, in the case where the partition ID of the PU is 0, the motion vector B2 of the sample of (xp+S / 2+1, yp-1) coordinates and the motion vector B3 of the sample of (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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. In the case where 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 neighboring blocks of the current CU may be further included as prediction candidates for motion vector v0 of CP0 and motion vector v2 of CP2. For example, in the case of motion vector v0 of CP0, motion information of previously decoded neighboring blocks (i.e., 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. In the case where 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 motion vector v2 of CP2, the motion information of the previously decoded neighboring block (or neighboring sample) can be used as a prediction candidate. In detail, at least one of the three motion information of the neighboring sample can be further used as a prediction candidate, and the three motion information can be represented by C2, C3 and C4, respectively. In the case where 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 may 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 of the previously decoded neighboring blocks (i.e., the neighboring blocks or neighboring samples of the current CU) may be used 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 S 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, at least one of the motion vectors A0, A1, and A2 may be used as a prediction candidate for v0.
[0160] Moreover, in the case of the motion vector v1 of CP1 of each PU, 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. In the case where 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. In the case where 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) coordinates and C1 can represent the motion vector of the sample of the (xc-1, yc+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.
[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] Fig.14 The configuration in which prediction candidates of the CP of a PU to which a partition type N×2N is applied are limited to two prediction candidates is illustrated. Fig.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 motion vector v0 of CP0, 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 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 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. In the case where 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. In the case where 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] Fig.15 Motion information prediction candidates of the CP of an asymmetric PU are illustrated. An asymmetric PU may be a PU partitioned from a CU based on a partition type of nL×2N, nR×2N, 2N×nU, or 2N×nD.
[0167] refer to Fig.15 (a) shows a method for configuring motion information prediction candidates for a CP of a PU with a partition type of nL×2N. Fig.15 As illustrated in (a) of FIG. 1 , 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 Fig.15As shown in (a), the coded motion information of the neighboring blocks (or neighboring samples) adjacent to each CP can be used as a prediction candidate 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 a prediction candidate 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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1 and A2. In the case where 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 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. In the case where 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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. In the case where 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 neighboring blocks of the current CU may be further included as prediction candidates for motion vector v0 of CP0 and motion vector v2 of CP2. For example, in the case of motion vector v0 of CP0, motion information of previously decoded neighboring blocks (i.e., 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 motion vector v2 of CP2, motion information of a previously decoded neighboring block (or neighboring sample) may be further included as a prediction candidate. In detail, at least one of the two motion information of the neighboring sample 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 Fig.15 (b) shows a method for configuring prediction candidates for motion information of a CP of a PU applying a partition type of nR×2N. 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 processing order.
[0174] like Fig.15As shown in (b), the coded motion information of the neighboring blocks adjacent to each CP can be used as the motion information prediction candidate of the three CPs. In the case of applying the affine motion model to the neighboring blocks, the motion information of the neighboring samples adjacent to each CP can be used as the prediction candidate 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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1 and A2. In the case where 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 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. In the case where 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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. In the case where 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 neighboring blocks of the current CU may be further included as prediction candidates for motion vector v0 of CP0 and motion vector v2 of CP2. For example, in the case of motion vector v0 of CP0, motion information of previously decoded neighboring blocks (i.e., 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. 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), 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 block (or neighboring sample) can be used as a prediction candidate. In detail, at least one of the three motion information of the neighboring sample can be further used as a prediction candidate, and the three motion information can be represented by C2, C3 and C4, 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 can represent the motion vector of the sample of the (xc-1, yc+H) coordinate, C3 can represent the motion vector of the sample of the (xc, yc+H) coordinate, and C4 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 C2, C3 and C4 can be further used as a prediction candidate for v2.
[0179] refer to Fig.15 (c) shows a method for configuring prediction candidates for motion information of a CP of a PU to which a partition type 2N×nU is applied. Fig.15 As illustrated in (c) of FIG. 1 , 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 processing order of the PU.
[0180] like Fig.15As shown in (c), the coded motion information of the neighboring blocks adjacent to each CP can be used as the motion information prediction candidate of the three CPs. In the case of applying the affine motion model to the neighboring blocks, the motion information of the neighboring samples adjacent to each CP can be used as the prediction candidate 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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1 and A2. In the case where 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 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. In the case where 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 among multiple pieces of motion information of neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. In the case where 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 neighboring blocks of the current CU may be further included 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, motion information of previously decoded neighboring blocks (i.e., 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. In the case where 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 motion vector v1 of CP1, motion information of a previously decoded neighboring block (or neighboring sample) may be further included as a prediction candidate. In detail, at least one of the two motion information of the neighboring sample may be further used 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 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 Fig.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. Fig.15 As illustrated in (d) of FIG. 1 , 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 processing order of the PU.
[0186] like Fig.15As shown in (d), the coded motion information of the neighboring blocks (or neighboring samples) adjacent to each CP can be used as a prediction candidate for the motion information of the three CPs. In the case where 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 a prediction candidate 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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the three pieces of motion information can be represented by A0, A1 and A2. In the case where 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. In the case where 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 among multiple pieces of motion information of neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. In the case where 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 neighboring blocks of the current CU may be further included 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, motion information of previously decoded neighboring blocks (i.e., 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. In the case where 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 motion vector v1 of CP1, motion information of a previously decoded neighboring block (or neighboring sample) may be further included as a prediction candidate. In detail, at least one of the three pieces of motion information of the neighboring sample may be further used as a prediction candidate, and the three pieces of motion information may be represented by B2, B3, and B4, respectively. In the case where 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 Fig.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 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. In the case where 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. In the case where 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, 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] Fig.16A configuration in which prediction candidates of the CP of an asymmetric PU are limited to two prediction candidates is illustrated.The asymmetric PU may be a PU partitioned from a CU based on a partition type of nL×2N, nR×2N, 2N×nU, or 2N×nD.
[0196] refer to Fig.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 motion vector v0 of CP0, 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 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 among multiple pieces of motion information of neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by B0 and B1, respectively. In the case where 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 neighboring blocks (or neighboring samples) previously decoded can be used as prediction candidates, and the two pieces of motion information can be represented by C0 and C1, respectively. In the case where 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 a 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] Fig.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, transmission of additional syntax information may not be required. Fig.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 a raster scan order, it may be determined that the right block of the current PU has not yet been decoded. Therefore, it may 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 send the coded motion information through the bitstream.
[0202] Fig.18 The figure shows a PU including a CP that does not require motion information encoding. Fig.18 , the motion information of the sample in which 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, in the case of decoding the topmost block among the left neighboring blocks adjacent to the left boundary of the current block 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, in the case of decoding the leftmost block among the upper neighboring blocks adjacent to the upper boundary of the current block 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, in the case of decoding the upper left neighboring block of the current block 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, in the case where 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. In the case where 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, in the case where 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, in the case where 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] Fig.19 The video encoding method of the encoding device according to the present invention is schematically illustrated. Fig.19 The method disclosed in can be Figure 1 Specifically, for example, Fig.19 Steps S1900 to S1930 may be performed by a prediction unit of the encoding device, and step S1940 may be performed by an entropy encoding unit of the encoding device.
[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 the 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 a 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 the 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 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 coordinates (0,0) based on (0,0).
[0210] Moreover, in the 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 a motion vector for the CP based on neighboring samples adjacent to the CP. 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 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, the partition ID, and the shape of the current block.
[0213] For example, in the case where the current block is a PU to which a partition type 2N×2N is applied, in the case of a motion vector v0 of CP0, the encoding device may use three pieces of motion information among the motion information of the neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information may be represented by A0, A1, and A2, respectively. In the case where 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 may represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the encoding device may derive the motion vector v0 about CP0 based on the neighboring sample group 0 including the sample of the (xp-1, yp-1) coordinates, the sample of the (xp, yp-1) coordinates, and the sample of the (xp-1, yp) coordinates.
[0214] Moreover, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp+S, yp-1) coordinates, and B1 can represent the motion vector of the sample of (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 about CP1 based on the neighboring sample group 1 including the sample of (xp+S, yp-1) coordinates and the sample of (xp+S-1, yp-1) coordinates.
[0215] Moreover, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information 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. In the case where 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), C0 can represent the motion vector of the sample of (xp-1, yp+S) coordinates, and C1 can represent the motion vector of the sample of (xp-1, yp+S-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 about CP2 based on the neighboring sample group 2 including at least one of the sample of (xp-1, yp+S) coordinates and the sample of (xp-1, yp+S-1).
[0216] In another example, in the case where the current block is a PU to which a partition type 2N×N is applied, in the case of a motion vector v0 of CP0, the encoding device may 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 may be represented by A0, A1, and A2, respectively. In the case where 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 may represent the motion vector of the sample (xp-1, yp-1) coordinates of the sample, A1 may represent the motion vector of the sample (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample (xp-1, yp) 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. That is, the encoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including at least one of a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (xp-1, yp) coordinates.
[0217] Moreover, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp+S, yp-1) coordinates, and B1 can represent the motion vector of the sample of (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 about CP1 based on the neighboring sample group 1 including at least one of the sample of (xp+S, yp-1) coordinates and the sample of (xp+S-1, yp-1) coordinates.
[0218] Moreover, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp-1, yp+S / 2) coordinates, and C1 can represent the motion vector of the sample of (xp-1, yp+S / 2-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 about CP2 based on the neighboring sample group 2 including at least one of the sample of (xp-1, yp+S / 2) coordinates and the sample of (xp-1, yp+S / 2-1) coordinates.
[0219] In the case where 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 motion vector v0 of CP0 and 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. 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 A3, A4, and A5, 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), 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, 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 the (xc-1, yc-1) coordinate in the neighboring sample group 0, the sample of the (xc-1, yc) coordinate, and the sample of (xc, yc-1).
[0220] Moreover, in the case of motion vector v1 of CP1, the encoding device may further include motion information of 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 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 neighboring sample group 1.
[0221] In addition, the encoding device can configure the 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 among the multiple 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 A0 and A1. In the case where 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) coordinate and A1 can represent the motion vector of the sample of 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 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 can be sequentially determined according to the first predefined priority order.
[0222] In the case of motion vector v1 of CP1, the encoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by B0 and B1. In the case where 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 may represent the motion vector of the sample of (xp+S, yp-1) coordinates and B1 may represent the motion vector of the sample of (xp+S-1, yp-1) coordinates. In this case, the encoding device may use B0 and B1 as prediction candidates for v1. That is, the encoding device may include samples of (xp+S, yp-1) coordinates and samples of (xp+S-1, yp-1) coordinates in neighboring sample group 1, and the availability of samples of (xp+S, yp-1) coordinates and samples of (xp+S-1, yp-1) coordinates may be sequentially determined according to the second predetermined priority order.
[0223] In the case of motion vector v2 of CP2, the encoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by C0 and C1. In the case where 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 may represent the motion vector of the sample of (xp-1, yp+S / 2) coordinates and C1 may represent the motion vector of the sample of (xp-1, yp+S / 2-1) coordinates. In this case, the encoding device may use C0 and C1 as prediction candidates for v2. That is, the encoding device may include samples of (xp-1, yp+S / 2) coordinates and samples of (xp-1, yp+S / 2-1) coordinates in neighboring sample group 2, and the availability of samples of (xp-1, yp+S / 2) coordinates and samples of (xp-1, yp+S / 2-1) coordinates may be sequentially determined according to the third predefined priority order.
[0224] In another example, in the case where the current block is a PU to which a partition type N×2N is applied, in the case of a motion vector v0 of CP0, the encoding device may 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 may be represented by A0, A1, and A2, respectively. In the case where 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 may represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the encoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including a sample of (xp-1, yp-1) coordinates, a sample of (xp, yp-1) coordinates, and a 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 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. In the case where 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 of (xp+S / 2, yp-1) coordinates, and B1 can represent the motion vector of the sample of (xp+S / 2-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. In addition, in the case where the partition ID of the current block is 0, the encoding device can also include the motion vector B2 of the sample of (xp+S / 2+1, yp-1) coordinates and the motion vector B3 of the sample of (xp+S / 2+2, yp-1) coordinates as prediction candidates for v1. That is, the encoding device 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] In addition, in the case of motion vector v2 of CP2, the encoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by C0 and C1. In the case where 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), C0 may represent the motion vector of the sample of (xp-1, yp+S) coordinates and C1 may represent the motion vector of the sample of (xp-1, yp+S-1) coordinates. In this case, the encoding device may use at least one of the motion vectors C0 and C1 as a prediction candidate for v2. That is, the encoding device may derive the motion vector v2 about CP2 based on the neighboring sample group 2 including the sample of (xp-1, yp+S) coordinates and the sample of (xp-1, yp+S-1) coordinates. .
[0227] In the case where 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 motion vector v0 of CP0 and motion vector v2 of CP2. 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. In detail, the encoding device may further use at least one of the three pieces of motion information of neighboring samples as prediction candidates, and the three pieces of motion information may be represented by A3, A4, and A5, 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), A3 may represent the motion vector of the sample of (xc-1, yc-1) coordinates, A4 may represent the motion vector of the sample of (xc, yc-1) coordinates, and A5 may represent the motion vector of the sample of (xc-1, yc) coordinates. 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 motion vector v2 of CP2, the encoding device may further include motion information of 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 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 (xc-1, yc+S) coordinates, C3 may represent the motion vector of the sample of (xc, yc+S) coordinates, and C4 may represent the motion vector of the sample of (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] Moreover, the encoding device can configure the 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 among the multiple 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 A0 and A1. In the case where 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) coordinate and A1 can represent the motion vector of the sample of 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 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 can be sequentially determined according to the first predefined priority order.
[0230] In the case of motion vector v1 of CP1, the encoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by B0 and B1. In the case where 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 may represent the motion vector of the sample of (xp+S / 2, yp-1) coordinates and B1 may represent the motion vector of the sample of (xp+S / 2-1, yp-1) coordinates. In this case, the encoding device may use B0 and B1 as prediction candidates for v1. That is, the encoding device may include samples of (xp+S / 2, yp-1) coordinates and samples of (xp+S / 2-1, yp-1) coordinates in neighboring sample group 1, and the availability of samples of (xp+S / 2, yp-1) coordinates and samples of (xp+S / 2-1, yp-1) coordinates may 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 may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by C0 and C1. In the case where 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), C0 may represent the motion vector of the sample of (xp-1, yp+S) coordinates and C1 may represent the motion vector of the sample of (xp-1, yp+S-1) coordinates. In this case, the encoding device may use C0 and C1 as prediction candidates for v2. That is, the encoding device may include samples of (xp-1, yp+S) coordinates and samples of (xp-1, yp+S-1) coordinates in neighboring sample group 2, and the availability of samples of (xp-1, yp+S / 2) coordinates and samples of (xp-1, yp+S / 2-1) coordinates may be sequentially determined according to the third predefined priority order.
[0232] In another example, in the case where the current block is a PU to which a partition type nL×2N is applied, for example, in the case of a motion vector v0 of CP0, the encoding device may 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 may be represented by A0, A1, and A2, respectively. In the case where 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, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the encoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including at least one of a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (xp-1, yp) coordinates.
[0233] Moreover, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of (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 about CP1 based on the neighboring sample group 1 including the sample of (xp+W, yp-1) coordinates and the sample of (xp+W-1, yp-1) coordinates.
[0234] Moreover, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of (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 about CP2 based on the neighboring sample group 2 including the sample of (xp-1, yp+H) coordinates and the sample of (xp-1, yp+H-1).
[0235] Moreover, in the case where 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 motion vector v0 of CP0 and motion vector v2 of CP2. 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. In detail, the encoding device may further use at least one of the two motion information of 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 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 motion vector v2 of CP2, the encoding device may further include motion information of neighboring blocks (ie, neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the two motion information of neighboring samples as prediction candidates, 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 (xc-1, yc+H) coordinates, and C3 may represent the motion vector of the sample of (xc-1, yc+H-1) coordinates. 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 samples of (xc-1, yc+H) coordinates and the samples of (xc-1, yc+H-1) coordinates in the neighboring sample group 2.
[0237] In another example, in the case where 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 may use three pieces of motion information of a plurality of pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information may be represented by A0, A1, and A2, respectively. In the case where 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, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the encoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including at least one of a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (xp-1, yp) coordinates.
[0238] Moreover, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of (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 about CP1 based on the neighboring sample group 1 including the sample of (xp+W, yp-1) coordinates and the sample of (xp+W-1, yp-1) coordinates.
[0239] Moreover, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of (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 about CP2 based on the neighboring sample group 2 including the sample of (xp-1, yp+H) coordinates and the sample of (xp-1, yp+H-1).
[0240] Moreover, in the case where 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 motion vector v0 of CP0 and motion vector v2 of CP2. 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. In detail, the encoding device may further use at least one of the three pieces of motion information of neighboring samples as prediction candidates, and the three pieces of motion information may be represented by A3, A4, and A5, 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 (xc-1, yc-1) coordinates, A4 may represent the motion vector of the sample of (xc, yc-1) coordinates, and A5 may represent the motion vector of the sample of (xc-1, yc) coordinates. 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 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 neighboring samples as prediction candidates, 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 (xc-1, yc+H) coordinates, C3 may represent the motion vector of the sample of (xc, yc+H) coordinates, and C4 may represent the motion vector of the sample of (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, in the case where 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 may use three pieces of motion information of a plurality of pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information may be represented by A0, A1, and A2, respectively. In the case where 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, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the encoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including at least one of a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (xp-1, yp) coordinates.
[0243] Moreover, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of (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 about CP1 based on the neighboring sample group 1 including at least one of the sample of (xp+W, yp-1) coordinates and the sample of (xp+W-1, yp-1).
[0244] Moreover, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of (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 about CP2 based on the neighboring sample group 2 including at least one of the sample of (xp-1, yp+H) coordinates and the sample of (xp-1, yp+H-1).
[0245] Moreover, in the case where 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 motion vector v0 of CP0 and 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 (ie, neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of two motion information of 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 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 (xc-1, yc-1) coordinates, and A4 may represent the motion vector of the sample of (xc, yc-1) 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 and the sample of (xc, yc-1) coordinates in neighboring sample group 0.
[0246] Moreover, in the case of 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 two motion information of 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 (xc+W, yc-1) coordinates, and B3 may represent the motion vector of the sample of (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 samples of (xc+W, yc-1) coordinates and the samples of (xc+W-1, yc-1) coordinates in neighboring sample group 1.
[0247] In another example, in the case where 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 may 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 may be represented by A0, A1, and A2, respectively. In the case where 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, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the encoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including at least one of a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (xp-1, yp) coordinates.
[0248] Moreover, in the case of motion vector v1 of CP1, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of (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 about CP1 based on the neighboring sample group 1 including at least one of the sample of (xp+W, yp-1) coordinates and the sample of (xp+W-1, yp-1).
[0249] Moreover, in the case of motion vector v2 of CP2, the encoding device can use two pieces of motion information 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. In the case where 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 of (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of (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 about CP2 based on the neighboring sample group 2 including at least one of the sample of (xp-1, yp+H) coordinates and the sample of (xp-1, yp+H-1).
[0250] In addition, in the case where 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 motion vector v0 of CP0 and 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 (ie, neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the 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. 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), 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, 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 the (xc-1, yc-1) coordinate in the neighboring sample group 0, the sample of the (xc-1, yc) coordinate, and the sample of (xc, yc-1).
[0251] Moreover, in the case of motion vector v1 of CP1, the encoding device may further include motion information of neighboring blocks (ie, neighboring samples) as prediction candidates. In detail, the encoding device may further use at least one of the three pieces of motion information of neighboring samples as prediction candidates, and the three pieces of 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 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 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 the neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. In the case where 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 the two pieces of motion information can be represented by C0 and C1, respectively. In the case where 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 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 its number to two. For example, in the case of motion vector v0 of CP0, the encoding device may use two pieces of motion information of a plurality of pieces of motion information of a neighboring block (or neighboring sample) 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 samples of (xp-1, yp-1) coordinates and samples of (xp, yp-1) coordinates in neighboring sample group 0, and the availability of samples of (xp-1, yp-1) coordinates and samples of (xp, yp-1) coordinates may be sequentially determined according to a first predefined priority order.
[0257] In addition, in the case of motion vector v1 of CP1, the encoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by B0 and B1. In the case where 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 may represent the motion vector of the sample of (xp+W, yp-1) coordinates, and B1 may represent the motion vector of the sample of (xp+W-1, yp-1) coordinates. In this case, the encoding device may use B0 and B1 as prediction candidates for v1. That is, the encoding device may include samples of (xp+W, yp-1) coordinates and samples of (xp+W-1, yp-1) coordinates in neighboring sample group 1, and the availability of samples of (xp+w, yp-1) coordinates and samples of (xp+W-1, yp-1) coordinates may be sequentially determined according to the second predefined priority order.
[0258] Moreover, in the case of motion vector v2 of CP2, the encoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by C0 and C1. In the case where 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 may represent the motion vector of the sample of (xp-1, yp+H) coordinates, and C1 may represent the motion vector of the sample of (xp-1, yp+H-1) coordinates. In this case, the encoding device may use C0 and C1 as prediction candidates for v2. That is, the encoding device may include samples of (xp-1, yp+H) coordinates and samples of (xp-1, yp+H-1) coordinates in neighboring sample group 2, and the availability of samples of (xp-1, yp+H) coordinates and samples of (xp-1, yp+H-1) coordinates may 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 a prediction sample for the current block based on the sample-unit motion vector (S1930). The encoding device may derive a reference area in a reference picture based on the sample-unit motion vector, and generate a prediction sample of the current block based on a reconstructed sample in the reference area. If the prediction mode for the current block is not a skip mode, the encoding device may generate a residual sample (or a residual signal) based on the original sample of the original picture and the prediction sample.
[0261] The encoding device encodes the prediction mode information of the current block and outputs the encoding information (S1940). The encoding device may encode the prediction mode and the derived motion vector for the current block and output the encoding 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, in the case of decoding the topmost block among the left neighboring blocks adjacent to the left boundary of the current block 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, in the case of decoding the leftmost block among the upper non-adjacent blocks adjacent to the upper boundary of the current block 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, in the case of decoding the upper left neighboring block of the current block 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, in the case of decoding the upper right neighboring block of the current block 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, in the case of decoding the rightmost block of the upper neighboring block adjacent to the upper boundary of the current block 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, in the case of decoding the lower left neighboring block of the current block based on the affine motion model, the motion vector of CP1 of the corresponding 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. Moreover, in the case of decoding the bottom block of the left neighboring block adjacent to the left boundary of the current block 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 a 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] Fig. 20 A video decoding method of a decoding device according to the present invention is schematically illustrated. Fig. 20 The method disclosed in can be Figure 2 Specifically, for example, Fig. 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 where an affine motion model is applied 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 a 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 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 coordinates (0,0), CP1 is a sample of the coordinates (S / 2,0), and CP2 is a sample of the coordinates (0, S / 2).
[0271] Moreover, when 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 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 (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 the motion vector of the CP based on the motion vector for the current block and the motion vector of the neighboring block of the current block. The decoding device may receive the motion information of the CP through the bitstream. In the case where the motion vector for the CP with 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 the neighboring samples of each CP as 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 segmentation type, the segmentation ID, and the shape of the current block.
[0274] For example, in the case where the current block is a PU to which a partition type 2N×2N is applied, in the case of a motion vector v0 of CP0, the decoding device may use three pieces of motion information among multiple pieces of information of neighboring blocks (or neighboring samples) as prediction candidates, and the three pieces of motion information may be represented by A0, A1, and A2, respectively. In the case where 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 may represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the decoding device may derive the motion vector v0 about CP0 based on the neighboring sample group 0 including the sample of the (xp-1, yp-1) coordinates, the sample of the (xp, yp-1) coordinates, and the sample of 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 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. In the case where 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 of (xp+S, yp-1) coordinates, and B1 can represent the motion vector of the sample of (xp+S-1, yp-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. That is, the decoding device can derive the motion vector v1 about CP1 based on the neighboring sample group 1 including the sample of (xp+S, yp-1) coordinates and the sample of (xp+S-1, yp-1) coordinates.
[0276] Moreover, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information 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. In the case where 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), C0 can represent the motion vector of the sample of (xp-1, yp+S) coordinates, and C1 can represent the motion vector of the sample of (xp-1, yp+S-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. That is, the decoding device can derive the motion vector v2 about CP2 based on the neighboring sample group 2 including at least one of the sample of (xp-1, yp+S) coordinates and the sample of (xp-1, yp+S-1) coordinates.
[0277] In another example, in the case where the current block is a PU to which a partition type 2N×N is applied, in the case of a motion vector v0 of CP0, the decoding device may 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 may be represented by A0, A1, and A2, respectively. In the case where 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 may represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the decoding device may derive a motion vector v0 about 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] Moreover, in the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information 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. In the case where 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 of (xp+S, yp-1) coordinates, and B1 can represent the motion vector of the sample of (xp+S-1, yp-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. That is, the decoding device can derive the motion vector v1 about CP1 based on the neighboring sample group 1 including at least one of the sample of (xp+S, yp-1) coordinates and the sample of (xp+S-1, yp-1) coordinates.
[0279] Moreover, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information 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. In the case where 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 of (xp-1, yp+S / 2) coordinates, and C1 can represent the motion vector of the sample of (xp-1, yp+S / 2-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. That is, the decoding device can derive the motion vector v2 about CP2 based on the neighboring sample group 2 including at least one of the sample of (xp-1, yp+S / 2) coordinates and the sample of (xp-1, yp+S / 2-1) coordinates.
[0280] In the case where 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 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 (ie, neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the 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. 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), 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, 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 (xc, yc-1).
[0281] Moreover, in the case of motion vector v1 of CP1, the decoding device may further include motion information of 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 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 (xc+S, yc) coordinates, B3 may represent the motion vector of the sample of (xc+S, yc-1) coordinates, and B4 may represent the motion vector of the sample of (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 samples of the (xc+S, yc) coordinates, the samples of the (xc+S, yc-1) coordinates, and the samples of the (xc+S-1, yc-1) coordinates in the neighboring sample group 1.
[0282] Moreover, the decoding device can configure the 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 decoding device can use two pieces of motion information among the multiple 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 A0 and A1. In the case where 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) coordinate and A1 can represent the motion vector of the sample of 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 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 (xp, yp-1) coordinate can be sequentially determined according to the first predefined priority order.
[0283] In the case of motion vector v1 of CP1, the decoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by B0 and B1. In the case where 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 may represent the motion vector of the sample of (xp+S, yp-1) coordinates and B1 may represent the motion vector of the sample of (xp+S-1, yp-1) coordinates. In this case, the decoding device may use B0 and B1 as prediction candidates for v1. That is, the decoding device may include samples of (xp+S, yp-1) coordinates and samples of (xp+S-1, yp-1) coordinates in neighboring sample group 1, and the availability of samples of (xp+S, yp-1) coordinates and samples of (xp+S-1, yp-1) coordinates may be sequentially determined according to the second predetermined priority order.
[0284] In the case of motion vector v2 of CP2, the decoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by C0 and C1. In the case where 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 may represent the motion vector of the sample of the motion vector (xp-1, yp+S / 2) coordinates of the current block and C1 may represent the motion vector of the sample of the coordinate (xp-1, yp+S / 2-1). In this case, the decoding device may use C0 and C1 as prediction candidates for v2. That is, the decoding device may include samples of the coordinates (xp-1, yp+S / 2) and samples of the coordinates (xp-1, yp+S / 2-1) in the neighboring sample group 2, and the availability of the samples of the coordinates (xp-1, yp+S / 2) and the samples of the coordinates (xp-1, yp+S / 2-1) may be sequentially determined according to the third predefined priority order.
[0285] In another example, in the case where the current block is a PU to which a partition type N×2N is applied, in the case of a motion vector v0 of CP0, the decoding device may 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 may be represented by A0, A1, and A2, respectively. In the case where 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 may represent the motion vector of the sample of the (xp-1, yp-1) coordinates, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the decoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (xp-1, yp) coordinates.
[0286] Moreover, in the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information 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. In the case where 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 of (xp+S / 2, yp-1) coordinates, and B1 can represent the motion vector of the sample of (xp+S / 2-1, yp-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. In addition, in the case where the partition ID of the current block is 0, the decoding device can further include the motion vector B2 of the sample of (xp+S / 2+1, yp-1) coordinates and the motion vector B3 of the sample of (xp+S / 2+2, yp-1) coordinates as prediction candidates for v1. That is, the decoding device can derive the motion vector v1 about CP1 based on the neighboring sample group 1 including the sample of the (xp+S / 2, yp-1) coordinate and the sample of the (xp+S / 2-1, yp-1) coordinate.
[0287] In addition, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information 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. In the case where 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), C0 can represent the motion vector of the sample of (xp-1, yp+S) coordinates and C1 can represent the motion vector of the sample of (xp-1, yp+S-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. That is, the decoding device can derive the motion vector v2 about CP2 based on the neighboring sample group 2 of the samples including the (xp-1, yp+S) coordinates and the (xp-1, yp+S-1) coordinates.
[0288] In the case where 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 motion vector v0 of CP0 and motion vector v2 of CP2. For example, in the case of motion vector v0 of CP0, the decoding device may further include motion information of neighboring blocks (ie, neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the 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. 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), 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, 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 motion vector v2 of CP2, the decoding device may further include motion information of 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 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 (xc-1, yc+S) coordinates, C3 may represent the motion vector of the sample of (xc, yc+S) coordinates, and C4 may represent the motion vector of the sample of (xc-1, yc+S-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+S) coordinates, the samples of (xc, yc+S) coordinates, and the samples of (xc-1, yc+S-1) coordinates in the neighboring sample group 2.
[0290] Moreover, the decoding device can configure the 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 decoding device can use two pieces of motion information among the multiple 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 A0 and A1. In the case where 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) coordinate and A1 can represent the motion vector of the sample of 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 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 (xp, yp-1) coordinate can be sequentially determined according to the first predefined priority order.
[0291] In the case of motion vector v1 of CP1, the decoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by B0 and B1. In the case where 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 may represent the motion vector of the sample of (xp+S / 2, yp-1) coordinates and B1 may represent the motion vector of the sample of (xp+S / 2-1, yp-1) coordinates. In this case, the decoding device may use B0 and B1 as prediction candidates for v1. That is, the decoding device may include samples of (xp+S / 2, yp-1) coordinates and samples of (xp+S / 2-1, yp-1) coordinates in neighboring sample group 1, and the availability of samples of (xp+S / 2, yp-1) coordinates and samples of (xp+S / 2-1, yp-1) coordinates may 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 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. In the case where 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), C0 can represent the motion vector of the sample of (xp-1, yp+S) coordinates and C1 can represent the motion vector of the sample of (xp-1, yp+S-1) coordinates. In this case, the decoding device can use C0 and C1 as prediction candidates for v2. That is, the decoding device can include samples of (xp-1, yp+S) coordinates and samples of (xp-1, yp+S-1) coordinates in neighboring sample group 2, and the availability of samples of (xp-1, yp+S) coordinates and samples of (xp-1, yp+S-1) coordinates can be sequentially determined according to the third predefined priority order.
[0293] In another example, in the case where the current block is a PU to which a partition type nL×2N is applied, for example, in the case of a motion vector v0 of CP0, the decoding device may 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 may be represented by A0, A1, and A2, respectively. In the case where 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, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the decoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including at least one of a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (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 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. In the case where 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 of (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of (xp+W-1, yp-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. That is, the decoding device can derive the motion vector v1 about CP1 based on the neighboring sample group 1 including the sample of (xp+W, yp-1) coordinates and the sample of (xp+W-1, yp-1) coordinates.
[0295] In addition, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information 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. In the case where 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 of (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of (xp-1, yp+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. That is, the decoding device can derive the motion vector v2 about CP2 based on the neighboring sample group 2 including the sample of (xp-1, yp+H) coordinates and the sample of (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 neighboring blocks of the current CU as prediction candidates for motion vector v0 of CP0 and motion vector v2 of CP2. 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 the two motion information of 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 two pieces of motion information of neighboring samples as prediction candidates, and the 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 (xc-1, yc+H) coordinates, and C3 may represent the motion vector of the sample of (xc-1, yc+H-1) coordinates. 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 samples of (xc-1, yc+H) coordinates and the samples of (xc-1, yc+H-1) coordinates in neighboring sample group 2.
[0298] In another example, in the case where 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 decoding device may 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 may be represented by A0, A1, and A2, respectively. In the case where 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, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the decoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including at least one of a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (xp-1, yp) coordinates.
[0299] Moreover, in the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information 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. In the case where 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 of (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of (xp+W-1, yp-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. That is, the decoding device can derive the motion vector v1 about CP1 based on the neighboring sample group 1 including the sample of (xp+W, yp-1) coordinates and the sample of (xp+W-1, yp-1) coordinates.
[0300] In addition, in the case of motion vector v2 of CP2, the decoding device can use two pieces of motion information 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. In the case where 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 of (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of (xp-1, yp+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. That is, the decoding device can derive the motion vector v2 about CP2 based on the neighboring sample group 2 including the sample of (xp-1, yp+H) coordinates and the sample of (xp-1, yp+H-1).
[0301] In addition, in the case where 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 motion vector v0 of CP0 and motion vector v2 of CP2. For example, in the case of motion vector v0 of CP0, the decoding device may further include motion information of neighboring blocks (ie, neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the 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. 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, 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, 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 (xc, yc-1).
[0302] Moreover, in the case of motion vector v2 of CP2, the decoding device may further include motion information of neighboring blocks (ie, neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the three pieces of motion information of neighboring samples as prediction candidates, 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 (xc-1, yc+H) coordinates, C3 may represent the motion vector of the sample of (xc, yc+H) coordinates, and C4 may represent the motion vector of the sample of (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 may use three pieces of motion information of a plurality of pieces of motion information of a neighboring block (or neighboring samples) 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 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, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the decoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including at least one of a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (xp-1, yp) coordinates.
[0304] Moreover, in the case of motion vector v1 of CP1, the decoding device can use two pieces of motion information 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. In the case where 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 of (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of (xp+W-1, yp-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. That is, the decoding device can derive the motion vector v1 about CP1 based on the neighboring sample group 1 including at least one of the sample of (xp+W, yp-1) coordinates and the sample of (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 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. In the case where 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 of (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of (xp-1, yp+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. That is, the decoding device can derive the motion vector v2 about CP2 based on the neighboring sample group 2 including at least one of the sample of (xp-1, yp+H) coordinates and the sample of (xp-1, yp+H-1) coordinates.
[0306] Moreover, in the case where 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 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 (ie, neighboring samples) as prediction candidates. Specifically, the decoding device may further use at least one of the two motion information of 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 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, 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) coordinates and the sample of the (xc, yc-1) coordinates in the neighboring sample group 0.
[0307] Moreover, in the case of motion vector v1 of CP1, 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 motion information of 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 (xc+W, yc-1) coordinates, and B3 may represent the motion vector of the sample of (xc+W-1, yc-1) coordinates. 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 samples of (xc+W, yc-1) coordinates and the samples of (xc+W-1, yc-1) coordinates in neighboring sample group 1.
[0308] In another example, in the case where 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 decoding device may 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 may be represented by A0, A1, and A2, respectively. In the case where 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, A1 may represent the motion vector of the sample of the (xp, yp-1) coordinates, and A2 may represent the motion vector of the sample of the (xp-1, yp) 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. That is, the decoding device can derive a motion vector v0 about CP0 based on a neighboring sample group 0 including at least one of a sample with (xp-1, yp-1) coordinates, a sample with (xp, yp-1) coordinates, and a sample with (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 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. In the case where 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 of (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of (xp+W-1, yp-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. That is, the decoding device can derive the motion vector v1 about CP1 based on the neighboring sample group 1 including at least one of the sample of (xp+W, yp-1) coordinates and the sample of (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 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. In the case where 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 of (xp-1, yp+H) coordinates, and C1 can represent the motion vector of the sample of (xp-1, yp+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. That is, the decoding device can derive the motion vector v2 about CP2 based on the neighboring sample group 2 including at least one of the sample of (xp-1, yp+H) coordinates and the sample of (xp-1, yp+H-1) coordinates.
[0311] In addition, in the case where 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 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 (ie, neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the 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. 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), 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, 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 motion vector v1 of CP1, the decoding device may further include motion information of neighboring blocks (ie, neighboring samples) as prediction candidates. In detail, the decoding device may further use at least one of the three pieces of motion information of neighboring samples as prediction candidates, and the three pieces of 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 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 the (xc+W, yc) coordinates, the samples of the (xc+W, yc-1) coordinates, and the samples of the (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 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 the neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information can be represented by B0 and B1. In the case where 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 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. In the case where 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 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 its number to two. For example, in the case of motion vector v0 of CP0, the decoding device may use two pieces of motion information of a plurality of pieces of motion information of a neighboring block (or neighboring sample) 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 samples of (xp-1, yp-1) coordinates and samples of (xp, yp-1) coordinates in neighboring sample group 0, and the availability of samples of (xp-1, yp-1) coordinates and samples of (xp, yp-1) coordinates may be sequentially determined according to a 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 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. In the case where 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 of (xp+W, yp-1) coordinates, and B1 can represent the motion vector of the sample of (xp+W-1, yp-1) coordinates. In this case, the decoding device can use B0 and B1 as prediction candidates for v1. That is, the decoding device can include samples of (xp+W, yp-1) coordinates and samples of (xp+W-1, yp-1) coordinates in neighboring sample group 1, and the availability of samples of (xp+W, yp-1) coordinates and samples of (xp+W-1, yp-1) coordinates can be sequentially determined according to the second predefined priority order.
[0319] Moreover, in the case of motion vector v2 of CP2, the decoding device may use two pieces of motion information among multiple pieces of motion information of neighboring blocks (or neighboring samples) as prediction candidates, and the two pieces of motion information may be represented by C0 and C1. In the case where 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 may represent the motion vector of the sample of (xp-1, yp+H) coordinates, and C1 may represent the motion vector of the sample of (xp-1, yp+H-1) coordinates. In this case, the decoding device may use C0 and C1 as prediction candidates for v2. That is, the decoding device may include samples of (xp-1, yp+H) coordinates and samples of (xp-1, yp+H-1) coordinates in neighboring sample group 2, and the availability of samples of (xp-1, yp+H) coordinates and samples of (xp-1, yp+H-1) coordinates may 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, in the case of decoding the topmost block among the left neighboring blocks adjacent to the left boundary of the current block 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. Moreover, in the case of decoding the leftmost block among the upper neighboring blocks adjacent to the upper boundary of the current block 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. Moreover, in the case of decoding the upper left neighboring block of the current block 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, in the case where 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. In the case where 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, in the case where 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. Moreover, in the case where 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 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 a prediction sample 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 a prediction sample for the current block based on a reconstructed sample in the reference region.
[0326] The decoding device may generate a reconstructed sample based on the prediction sample. If the prediction mode for the current block is not the skip mode, the decoding device may obtain a residual signal from the bit stream received from the encoding device and generate a residual sample for the current block. In this case, the decoding device may generate a reconstructed sample based on the prediction sample and the residual sample. The decoding device may generate a reconstructed picture based on the reconstructed sample.
[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] Moreover, according to the present invention, without additionally transmitting information about the motion vector of the control point for the current block, the motion vector of the control point for 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 for the motion vector of the control point 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 effectively performed by 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 the 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 from the above-mentioned steps. In addition, it should be understood by those skilled in the art that the steps shown in the sequence diagram are not exclusive, 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 embodiment of the present invention is implemented by software, the above method can be implemented by a module (process, function, etc.) that performs 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 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 method performed by a decoding device, the video decoding method comprising: Derives a motion vector for a control point (CP) 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 from the first block group, wherein the second motion vector is derived from the second block group, wherein the third motion vector is derived from the third block group, wherein the first motion vector is determined based on a first checked available block in the first block group according to a first predefined priority order, 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 motion vector is determined based on the available block that is first checked in the second block group according to a second predefined priority order, 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, wherein the third motion vector is determined based on the available block first checked in the third block group according to a third predefined priority order; 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 method 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, and W and H are the width and height of the current block, respectively.
3. The video decoding method 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 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 method 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 method according to claim 1, in, H is equal to 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.
6. The video decoding method 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 method 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 method performed by an encoding device, the video encoding method comprising: Derives a motion vector for a control point (CP) 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; as well as 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 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 of 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 from the first block group, wherein the second motion vector is derived from the second block group, wherein the third motion vector is derived from the third block group, wherein the first motion vector is determined based on a first checked available block in the first block group according to a first predefined priority order, 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 motion vector is determined based on the available block that is first checked in the second block group according to a second predefined priority order, 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, wherein the third motion vector is determined based on the available block first checked in the third block group according to a third predefined priority order; 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 method 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 the Vx represents the x component of the motion vector associated with the sample position at the coordinates of (x, y), the Vy represents the y component of the motion vector associated with the sample position at the coordinates of (x, y), the Vx0 represents the x component of the first motion vector for the first CP, the Vy0 represents the y component of the first motion vector for the first CP, the Vx1 represents the x component of the second motion vector for the second CP, the Vy1 represents the y component of the second motion vector for the second CP, the Vx2 represents the x component of the third motion vector for the third CP, and the Vy2 represents the y component of the third motion vector for the third CP, and W and H are the width and height of the current block, respectively.
10. The video encoding method 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 method 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 method 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 method 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 method 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 computer-readable digital storage medium storing a bit stream generated by an encoding device executing the following steps, wherein the steps are: Derives a motion vector for a control point (CP) 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 encoding video information about a prediction for the current block to output the bitstream, in, 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 from the first block group, wherein the second motion vector is derived from the second block group, wherein the third motion vector is derived from the third block group, wherein the first motion vector is determined based on a first checked available block in the first block group according to a first predefined priority order, 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 motion vector is determined based on the available block that is first checked in the second block group according to a second predefined priority order, 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, wherein the third motion vector is determined based on the available block first checked in the third block group according to a third predefined priority order; 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.
16. A method for transmitting video data, the method comprising: obtaining a bitstream for the video, wherein the bitstream is generated based on: deriving a motion vector for a control point (CP) for a 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 encoding video information regarding the prediction for the current block; as well as sending said data comprising said bit stream, 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 from the first block group, wherein the second motion vector is derived from the second block group, wherein the third motion vector is derived from the third block group, wherein the first motion vector is determined based on a first checked available block in the first block group according to a first predefined priority order, 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 motion vector is determined based on the available block that is first checked in the second block group according to a second predefined priority order, 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, wherein the third motion vector is determined based on the available block first checked in the third block group according to a third predefined priority order; 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
Video coding device
EP0765087A2
Video decoding device, video decoding method, and video decoding program
JP2015111910A