Video signal processing method and apparatus using motion compensation
By comparing the motion vector differences of different reference picture lists in video signal processing, the motion vectors are corrected to improve the reconstruction accuracy of video signal blocks, solving the problems of low video signal coding efficiency and signaling efficiency in the existing technology, and achieving a better Efficient video signal processing.
Patent Information
- Application Number
- CN202410769312.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2018-04-20
- Filing Date
- 2019-03-27
- Publication Date
- 2024-10-01
AI Technical Summary
Existing video signal processing technology is difficult to improve the coding efficiency of video signals, especially the problem of low signaling efficiency in inter-frame prediction.
By obtaining the merge index, motion information is obtained based on the index, and picture sequence count differences of motion vectors in different reference picture lists are compared to correct and reconstruct video signal blocks and improve motion vector accuracy and signaling efficiency.
It improves the coding efficiency of video signals and the prediction performance of inter-frame prediction, reduces signaling overhead, and enhances the overall performance of video signal processing.
Smart Images

Figure CN118741094A_ABST
Abstract
Description
[0001] This application is a divisional application of the patent application with application number 201980022660.0 (PCT / KR2019 / 003608) filed on September 27, 2020, with an international application date of March 27, 2019, and the invention name is "Video signal processing method and device using motion compensation". Technical Field
[0002] The present invention relates to a video signal processing method and apparatus, and more particularly, to a video signal processing method and apparatus for encoding or decoding a video signal. Background Art
[0003] Compression coding refers to a series of signal processing techniques for sending digitized information through communication lines or storing information in a form suitable for storage media. Objects of compression coding include objects such as voice, video, and text, and in particular, the technology for performing compression coding on images is called video compression. Compression coding of video signals is performed by removing excess information in consideration of spatial correlation, temporal correlation, and random correlation. However, with the recent development of various media and data transmission media, more efficient video signal processing methods and devices are needed. Summary of the invention
[0004] Technical issues
[0005] The object of the present invention is to improve the coding efficiency of a video signal.In addition, the object of the present invention is to improve the signaling efficiency related to the prediction of the current block using the reference samples of the current block.
[0006] Technical Solution
[0007] In order to solve the above problems, the present invention provides the following video signal processing device and video signal processing method.
[0008] According to an embodiment of the present invention, a video signal processing method includes the following steps: obtaining a merge index indicating a candidate for predicting a current block among multiple candidates included in a merge candidate list for predicting the current block; obtaining motion information about the current block based on motion information corresponding to the candidate indicated by the merge index; when the motion information about the current block includes multiple motion vectors corresponding to different reference picture lists, comparing a picture order count (POC) difference between each reference picture corresponding to the multiple motion vectors and a current picture including the current block; correcting the multiple motion vectors based on a result of the comparison; and reconstructing the current block based on the multiple corrected motion vectors.
[0009] In addition, according to an embodiment of the present invention, a video signal processing device includes a processor, wherein the processor obtains a merge index indicating a candidate for predicting the current block among multiple candidates included in a merge candidate list for predicting the current block; obtains motion information about the current block based on motion information corresponding to the candidate indicated by the merge index; when the motion information about the current block includes multiple motion vectors corresponding to different reference picture lists, compares a picture order count (POC) difference between each reference picture corresponding to the multiple motion vectors and a current picture including the current block; corrects the multiple motion vectors based on a result of the comparison; and reconstructs the current block based on the multiple corrected motion vectors.
[0010] The plurality of motion vectors may include a first motion vector and a second motion vector. The processor may obtain a first POC difference and a second POC difference, may compare the first POC difference with the second POC difference to obtain a specific offset as a correction value of one of the first motion vector and the second motion vector, and may correct the first motion vector and the second motion vector based on the specific offset. The first POC difference may indicate a POC difference between a first reference picture corresponding to the first motion vector and a current picture, and the second POC difference may indicate a POC difference between a second reference picture corresponding to the second motion vector and the current picture.
[0011] The processor may obtain the specific offset earlier than the correction value of the other of the first motion vector and the second motion vector based on a result of comparing the first POC difference with the second POC difference.
[0012] When the first POC difference is greater than the second POC difference, the specific offset may be a correction value of the first motion vector, and when the first POC difference is less than the second POC difference, the specific offset may be a correction value of the second motion vector.
[0013] When the first POC difference is greater than the second POC difference, the specific offset may be a first offset as a correction value of the first motion vector. Here, the processor may correct the first motion vector by adding the first offset, may obtain a second offset as a correction value of the second motion vector based on the specific offset, and may correct the second motion vector by adding the second offset.
[0014] The processor may generate a first corrected motion vector by adding the first offset to the first motion vector, may generate a second corrected motion vector by adding the second offset to the second motion vector, and may reconstruct the current block based on the first corrected motion vector and the second corrected motion vector.
[0015] When the first POC difference and the second POC difference are equal, the processor may obtain a specific offset as a correction value for one of the first motion vector and the second motion vector based on a value indicating a reference picture list corresponding to the first motion vector and the second motion vector, respectively.
[0016] When a value indicating a first reference picture list corresponding to a first motion vector is 0, and a value indicating a second reference picture list corresponding to a second motion vector is 1, the processor may obtain a specific offset as a correction value of the first motion vector.
[0017] The first reference picture list may be used in a first higher layer region in which up to one motion vector is used for a specific sample and in a second higher layer region in which up to two motion vectors are used for the specific sample, and the second reference picture list may not be used in the first higher layer region.
[0018] Beneficial Effects
[0019] According to the embodiments of the present invention, the coding efficiency of the video signal can be improved. In addition, according to the embodiments of the present invention, the prediction performance of the inter-frame prediction of the current block can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a schematic block diagram of a video signal encoding apparatus according to an embodiment of the present invention.
[0021] Figure 2 is a schematic block diagram of a video signal decoding apparatus according to an embodiment of the present invention.
[0022] Figure 3 An embodiment in which a coding tree unit is divided into coding units in a picture is shown.
[0023] Figure 4 An embodiment of a method for signaling partitioning of quadtrees and multi-type trees is shown.
[0024] Figure 5 and Figure 6 An intra prediction method according to an embodiment of the present invention is illustrated.
[0025] Figure 7 An inter-frame prediction method according to an embodiment of the present invention is illustrated.
[0026] Figure 8 A bidirectional prediction method according to an embodiment of the present invention is illustrated.
[0027] Fig. 9 is a diagram illustrating a method of configuring a merge candidate list according to an embodiment of the present invention.
[0028] Fig.10is a diagram illustrating a method of correcting a motion vector according to an embodiment of the present invention.
[0029] Fig.11 is a diagram illustrating a method of correcting a motion vector according to another embodiment of the present invention.
[0030] Fig.12 is a diagram illustrating motion vector scaling of candidates included in an MVP candidate list of a current block according to an embodiment of the present invention.
[0031] Fig.13 is a diagram illustrating a method of correcting a motion vector according to an embodiment of the present invention.
[0032] Fig.14 is a diagram illustrating a search position for correcting a motion vector based on an initial motion vector according to an embodiment of the present invention.
[0033] Fig.15 is a diagram illustrating a method of configuring a template for correcting a motion vector according to an embodiment of the present invention.
[0034] Fig.16 is a flowchart illustrating a method of correcting a motion vector according to an embodiment of the present invention.
[0035] Fig.17 is a flowchart illustrating a method of correcting a motion vector according to another embodiment of the present invention.
[0036] Fig.18 is a diagram illustrating a weighted prediction method using one motion information set according to an embodiment of the present invention.
[0037] Fig.19 is a diagram illustrating a weighted prediction method of a bidirectional prediction block according to an embodiment of the present invention.
[0038] Fig. 20 is a flowchart illustrating a method in which a decoder predicts a current block using weighted prediction according to an embodiment of the present invention.
[0039] Fig.21 is a diagram illustrating a method of updating a weight parameter set to be applied to a reference block when a current block is unidirectionally predicted according to an embodiment of the present invention.
[0040] Fig. 22 is a diagram illustrating a method of predicting a current block based on an additionally searched reference block according to an embodiment of the present invention.
[0041] Fig.23 is a diagram illustrating a method of updating a weight parameter set to be applied to a reference block when a current block is a bidirectionally predicted block according to an embodiment of the present invention.
[0042] Fig.24 is a diagram illustrating a method of predicting a current block based on an additionally searched reference block when the current block is a bidirectionally predicted block according to an embodiment of the present invention.
[0043] Fig.25 is a diagram illustrating a method of predicting a current block based on an additionally searched reference block when the current block is a bidirectionally predicted block according to another embodiment of the present invention.
[0044] Fig.26 is a diagram illustrating a template matching method according to an embodiment of the present invention.
[0045] Fig. 27 is a diagram illustrating whether a symbol matches and symbol determination according to an embodiment of the present invention.
[0046] Fig.28 and Fig.29 is a diagram illustrating a method of encoding symbol information in consideration of a context according to an embodiment of the present invention.
[0047] Fig.30 is a diagram illustrating a method of performing prediction on each region split from a current block based on different motion information sets according to an embodiment of the present invention.
[0048] Fig.31 is a diagram illustrating a method of performing intra prediction or inter prediction on each region split from a current block according to an embodiment of the present invention. DETAILED DESCRIPTION
[0049] Considering the functions in the present invention, the terms used in this specification may be common terms that are currently widely used, but may be changed according to the intention of those skilled in the art, customs, or the emergence of new technologies. In addition, in some cases, there may be terms arbitrarily selected by the applicant, and in this case, their meanings are described in the corresponding description section of the present invention. Therefore, the terms used in this specification should be interpreted based on the substantial meaning of the terms and contents throughout the specification.
[0050] In this specification, some terms may be explained as follows. In some cases, coding may be explained as encoding or decoding. In this specification, a device that generates a video signal bit stream by performing coding (coding) of a video signal is referred to as a coding device or encoder, and a device that performs decoding (decoding) of a video signal bit stream to reconstruct a video signal is referred to as a decoding device or decoder. In addition, in this specification, a video signal processing device is used as a term that includes the concepts of both encoders and decoders. Information is a term that includes all values, parameters, coefficients, elements, etc. In some cases, the meaning is interpreted differently, so the present invention is not limited thereto. "Unit" is used as a meaning that refers to a basic unit of image processing or a specific position of a picture, and refers to an image area that includes both luminance components and chrominance components. In addition, "block" refers to an image area that includes a specific component among luminance components and chrominance components (ie, Cb and Cr). However, depending on the embodiment, terms such as "unit", "block", "partition" and "area" may be used interchangeably. In addition, in this specification, a unit may be used as a concept that includes all of a coding unit, a prediction unit and a transform unit. A picture indicates a field or a frame, and these terms may be used interchangeably according to an embodiment.
[0051] Figure 1 is a schematic block diagram of a video signal encoding apparatus according to an embodiment of the present invention. Figure 1 The encoding device 100 of the present invention includes a transform unit 110, a quantization unit 115, an inverse quantization unit 120, an inverse transform unit 125, a filtering unit 130, a prediction unit 150 and an entropy coding unit 160.
[0052] The transform unit 110 obtains the value of the transform coefficient by transforming the residual signal, which is the difference between the input video signal and the prediction signal generated by the prediction unit 150. For example, discrete cosine transform (DCT), discrete sine transform (DST) or wavelet transform can be used. DCT and DST perform transformation by dividing the input image signal into a plurality of blocks. In the transformation, the coding efficiency can vary according to the distribution and characteristics of the values in the transformation area. The quantization unit 115 quantizes the value of the transform coefficient value output from the transform unit 110.
[0053] In order to improve the coding efficiency, instead of the method of coding the image signal as it is, a method is used to predict the picture using the area that has been coded by the prediction unit 150, and obtain the reconstructed image by adding the residual value between the original picture and the predicted picture to the predicted picture. In order to prevent the mismatch between the encoder and the decoder, when the prediction is performed in the encoder, information that can be used in the decoder should be used. To this end, the encoder performs the process of reconstructing the encoded current block again. The inverse quantization unit 120 inversely quantizes the value of the transform coefficient, and the inverse transform unit 125 reconstructs the residual value using the inversely quantized transform coefficient value. At the same time, the filtering unit 130 performs a filtering operation to improve the quality of the reconstructed picture and improve the coding efficiency. For example, a deblocking filter, a sample adaptive offset (SAO) and an adaptive loop filter may be included. The filtered picture is output or stored in a decoded picture buffer (DPB) 156 to be used as a reference picture.
[0054] The prediction unit 150 includes an intra prediction unit 152 and an inter prediction unit 154. The intra prediction unit 152 performs intra prediction in the current picture, and the inter prediction unit 154 performs inter prediction to predict the current picture by using the reference picture stored in the DPB 156. The intra prediction unit 152 performs intra prediction according to the reconstructed sample in the current picture, and sends intra coding information to the entropy coding unit 160. The intra coding information may include at least one of an intra prediction mode, a most probable mode (MPM) flag, and an MPM index. The inter prediction unit 154 may include a motion estimation unit 154a and a motion compensation unit 154b. The motion estimation unit 154a refers to a specific area of the reconstructed reference picture to obtain a motion vector value of the current area. The motion estimation unit 154a sends a motion information set (reference picture index, motion vector information, etc.) about the reference area to the entropy coding unit 160. The motion compensation unit 154b performs motion compensation using the motion vector value sent from the motion estimation unit 154a. The inter prediction unit 154 transmits the inter encoding information including the motion information set about the reference region to the entropy coding unit 160 .
[0055] When performing the above-mentioned picture prediction, the transform unit 110 transforms the residual value between the original picture and the predicted picture to obtain a transform coefficient value. In this case, the transform can be performed in units of a specific block within the picture, and the size of the specific block can be changed within a preset range. The quantization unit 115 quantizes the transform coefficient value generated in the transform unit 110 and sends it to the entropy coding unit 160.
[0056] The entropy coding unit 160 performs entropy coding on the quantized transform coefficients, intra-frame coding information, and inter-frame coding information to generate a video signal bit stream. In the entropy coding unit 160, a variable length coding (VLC) method, an arithmetic coding method, etc. can be used. The VLC method transforms the input symbols into continuous codewords, and the length of the codeword can be variable. For example, frequently occurring symbols are expressed as short codewords, while less frequently occurring symbols are expressed as long codewords. As a VLC method, a context-based adaptive variable length coding (CAVLC) method can be used. Arithmetic coding transforms continuous data symbols into a single decimal, and arithmetic coding can obtain the optimal number of decimal bits required to represent each symbol. As arithmetic coding, context-based adaptive arithmetic coding (CABAC) can be used.
[0057] The generated bitstream is encapsulated using a network abstraction layer (NAL) unit as a basic unit. A NAL unit includes an integer number of coded coding tree units. In order to decode the bitstream in a video decoder, first, the bitstream must be separated into NAL units, and then each separated NAL unit must be decoded. At the same time, the information required to decode the video signal bitstream can be sent through a raw byte sequence payload (RBSP) of a high-level set such as a picture parameter set (PPS), a sequence parameter set (SPS), a video parameter set (VPS), etc.
[0058] at the same time, Figure 1 The block diagram of the encoding device 100 according to an embodiment of the present invention is shown, and the blocks shown separately logically distinguish and show the elements of the encoding device 100. Therefore, the elements of the encoding device 100 described above may be installed as one chip or multiple chips depending on the design of the device. According to an embodiment, the operation of each element of the encoding device 100 described above may be performed by a processor (not shown).
[0059] Figure 2 2 is a schematic block diagram of a video signal decoding apparatus 200 according to an embodiment of the present invention. Figure 2 The decoding device 200 of the present invention includes an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 225, a filtering unit 230 and a prediction unit 250.
[0060] The entropy decoding unit 210 entropy decodes the video signal bit stream and extracts the transform coefficient, intra-frame coding information and inter-frame coding information of each region. The inverse quantization unit 220 inversely quantizes the entropy-decoded transform coefficient, and the inverse transform unit 225 reconstructs the residual value using the inversely quantized transform coefficient. The video signal processing device 200 reconstructs the original pixel value by adding the residual value obtained in the inverse transform unit 225 to the predictor obtained in the prediction unit 250.
[0061] At the same time, the filtering unit 230 performs filtering on the picture to improve the image quality. This may include a deblocking filter for reducing block distortion and / or an adaptive loop filter for removing distortion of the entire picture. The filtered picture is output or stored in the DPB 256 to be used as a reference picture for the next picture.
[0062] The prediction unit 250 includes an intra prediction unit 252 and an inter prediction unit 254. The prediction unit 250 generates a predicted picture by using the encoding type, the transform coefficient of each region, and the intra / inter coding information decoded by the above-mentioned entropy decoding unit 210. In order to reconstruct the current block in which decoding is performed, the decoded region of the current picture or other pictures including the current block may be used. In reconstruction, only the current picture, that is, the picture (or tile / slice) in which only intra prediction is performed is called an intra picture or an I picture (or tile / slice), and the picture (or tile / slice) capable of performing intra prediction and inter prediction is called an inter picture (or tile / slice). In order to predict the sample value of each block in the inter picture (or tile / slice), the picture (or tile / slice) using at most one motion vector and a reference picture index is called a predicted picture or a P picture (or tile / slice), and the picture (or tile / slice) using at most two motion vectors and reference picture indexes is called a bidirectionally predicted picture or a B picture (or tile / slice). In other words, a P picture (or tile / slice) uses at most one motion information set to predict each block, and a B picture (or tile / slice) uses at most two motion information sets to predict each block. Here, a motion information set includes one or more motion vectors and a reference picture index.
[0063] The intra prediction unit 252 generates a prediction block using the intra coding information and the restored samples in the current picture. As described above, the intra coding information may include at least one of an intra prediction mode, a most probable mode (MPM) flag, and an MPM index. The intra prediction unit 252 predicts the sample value of the current block by using the restored samples located on the left and / or upper side of the current block as reference samples. In the present disclosure, the restored samples, the reference samples, and the samples of the current block may represent pixels. Moreover, the sample value may represent a pixel value.
[0064] According to an embodiment, the reference sample may be a sample included in a neighboring block of the current block. For example, the reference sample may be a sample adjacent to the left boundary of the current block and / or a sample adjacent to the upper boundary. Moreover, the reference sample may be a sample located on a line within a predetermined distance from the left boundary of the current block and / or a sample located on a line within a predetermined distance from the upper boundary of the current block among the samples of the neighboring blocks of the current block. In this case, the neighboring blocks of the current block may include a left (L) block, an upper (A) block, a lower left (BL) block, an upper right (AR) block, or an upper left (AL) block.
[0065] The inter prediction unit 254 generates a prediction block using the reference picture and the inter coding information stored in the DPB 256. The inter coding information may include a motion information set (reference picture index, motion vector information, etc.) for the current block of the reference block. Inter prediction may include L0 prediction, L1 prediction, and bidirectional prediction. L0 prediction means prediction using one reference picture included in the L0 picture list, and L1 prediction means prediction using one reference picture included in the L1 picture list. To this end, a set of motion information (e.g., motion vector and reference picture index) may be required. In the bidirectional prediction method, up to two reference areas may be used, and the two reference areas may exist in the same reference picture or may exist in different pictures. That is, in the bidirectional prediction method, up to two sets of motion information (e.g., motion vector and reference picture index) may be used, and the two motion vectors may correspond to the same reference picture index or different reference picture indexes. In this case, the reference picture may be displayed (or output) before and after the current picture in terms of time.
[0066] The inter-frame prediction unit 254 can use the motion vector and the reference picture index to obtain the reference block of the current block. The reference block is in the reference picture corresponding to the reference picture index. Moreover, the sample value of the block specified by the motion vector or its interpolated value can be used as a predictor of the current block. For motion prediction with sub-pel unit pixel accuracy, for example, an 8-tap interpolation filter for luminance signal and a 4-tap interpolation filter for chrominance signal can be used. However, the interpolation filter for motion prediction in sub-pixel units is not limited to this. In this way, the inter-frame prediction unit 254 performs motion compensation to predict the texture of the current unit based on the motion picture previously reconstructed using motion information. Here, the inter-frame prediction unit can use a motion information set.
[0067] The reconstructed video picture is generated by adding the predictor output from the intra prediction unit 252 or the inter prediction unit 254 to the residual value output from the inverse transform unit 225. That is, the video signal decoding apparatus 200 reconstructs the current block using the predicted block generated by the prediction unit 250 and the residual obtained from the inverse transform unit 225.
[0068] at the same time, Figure 2 The block diagram of the decoding device 200 according to an embodiment of the present invention is shown, and the blocks shown separately logically distinguish and show the elements of the decoding device 200. Therefore, the elements of the above-mentioned decoding device 200 may be installed as one chip or multiple chips depending on the design of the device. According to the embodiment, the operation of each element of the above-mentioned decoding device 200 may be performed by a processor (not shown).
[0069] Figure 3 An embodiment in which a coding tree unit (CTU) is partitioned into coding units (CU) in a picture is illustrated. In the coding process of a video signal, a picture may be partitioned into a series of coding tree units (CTUs). A coding tree unit consists of an NxN block of luminance samples and two blocks of chrominance samples corresponding thereto. A coding tree unit may be partitioned into a plurality of coding units. A coding tree unit may not be partitioned and may be a leaf node. In this case, the coding tree unit itself may be a coding unit. A coding unit refers to a basic unit for processing a picture in the processing of the above-mentioned video signal, i.e., intra / inter prediction, transform, quantization and / or entropy coding. The size and shape of a coding unit in a picture may not be constant. A coding unit may have a square or rectangular shape. A rectangular coding unit (or rectangular block) includes a vertical coding unit (or vertical block) and a horizontal coding unit (or horizontal block). In this specification, a vertical block is a block whose height is greater than its width, and a horizontal block is a block whose width is greater than its height. In addition, in this specification, a non-square block may refer to a rectangular block, but the present invention is not limited thereto.
[0070] refer to Figure 3 , firstly, the compilation tree unit is split into a quadtree (QT) structure. That is, a node having a size of 2NX2N in the quadtree structure can be split into four nodes having a size of NXN. In this specification, a quadtree may also be referred to as a quadtree. Quadtree splitting may be performed recursively, and not all nodes need to be split at the same depth.
[0071] At the same time, the leaf nodes of the above-mentioned quadtree can be further divided into a multi-type tree (MTT) structure. According to an embodiment of the present invention, in a multi-type tree structure, a node can be divided into a binary or ternary tree structure divided horizontally or vertically. That is, in a multi-type tree structure, there are four segmentation structures, such as vertical binary segmentation, horizontal binary segmentation, vertical ternary segmentation and horizontal ternary segmentation. According to an embodiment of the present invention, in each tree structure, the width and height of the node can have a power of 2. For example, in a binary tree (BT) structure, a node of 2NX2N size can be divided into two NX2N nodes by vertical binary segmentation, and divided into two 2NXN nodes by horizontal binary segmentation. In addition, in a ternary tree (TT) structure, a node of 2NX2N size is divided into (N / 2)X2N, NX2N and (N / 2)X2N nodes by vertical ternary segmentation, and is divided into 2NX(N / 2), 2NXN and 2NX(N / 2) nodes by horizontal ternary segmentation. This multi-type tree splitting can be performed recursively.
[0072] The leaf nodes of the multi-type tree can be coding units. When the division of the coding unit is not indicated or the coding unit is not larger than the maximum conversion length, the coding unit is used as a unit of prediction and conversion without further division. On the other hand, at least one of the following parameters in the above-mentioned quadtree and multi-type tree can be predefined or sent through the RBSP of the high-level set such as PPS, SPS, VPS, etc. 1) CTU size: the root node size of the quadtree, 2) Minimum QT size MinQtSize: the minimum allowed QT leaf node size, 3) Maximum BT size MaxBtSize: the maximum allowed BT root node size, 4) Maximum TT size MaxTtSize: the maximum allowed TT root node size, 5) Maximum MTT depth MaxMttDepth: the maximum allowed depth of the MTT split from the leaf node of the QT, 6) Minimum BT size MinBtSize: the minimum allowed BT leaf node size, 7) Minimum TT size MinTtSize: the minimum allowed TT leaf node size.
[0073] Figure 4 An embodiment of a method for signaling a partition of a quadtree and a multi-type tree is shown. Preset flags may be used to signal the partition of the quadtree and the multi-type tree. Figure 4 , at least one of the flag “qt_split_flag” indicating whether to split a quadtree node, the flag “mtt_split_flag” indicating whether to split a multi-type tree node, the flag “mtt_split_vertical_flag” indicating the split direction of the multi-type tree node, or the flag “mtt_split_binary_flag” indicating the split type of the multi-type tree node may be used.
[0074] According to an embodiment of the present invention, the coding tree unit is the root node of the quadtree and can be first split into a quadtree structure. In the quadtree structure, a "qt_split_flag" is signaled for each node "QT_node". If the value of "qt_split_flag" is 1, the node is split into 4 square nodes, and if the value of "qt_split_flag" is 0, the corresponding node becomes a leaf node "QT_leaf_node" of the quadtree.
[0075] Each quad tree leaf node "QT_leaf_node" can be further split into a multi-type tree structure. In the multi-type tree structure, "mtt_split_flag" is sent with a signal for each node "MTT_node". When the value of "mtt_split_flag" is 1, the corresponding node is split into multiple rectangular nodes, and when the value of "mtt_split_flag" is 0, the corresponding node is a leaf node "MTT_leaf_node" of the multi-type tree. When the multi-type tree node "MTT_node" is split into multiple rectangular nodes (that is, when the value of "mtt_split_flag" is 1), the "mtt_split_vertical_flag" and "mtt_split_binary_flag" of the node "MTT_node" can be additionally sent with a signal. When the value of "mtt_split_vertical_flag" is 1, it indicates the vertical division of the node "MTT_node", and when the value of "mtt_split_vertical_flag" is 0, it indicates the horizontal division of the node "MTT_node". In addition, when the value of "mtt_split_binary_flag" is 1, the node "MTT_node" is divided into 2 rectangular nodes, and when the value of "mtt_split_binary_flag" is 0, the node "MTT_node" is divided into 3 rectangular nodes.
[0076] Figure 5 and Figure 6 The intra prediction method according to an embodiment of the present invention is illustrated. As described above, the intra prediction unit predicts sample values of the current block by using restored samples located on the left and / or upper side of the current block as reference samples.
[0077] first, Figure 5 An embodiment of a reference sample used for prediction of a current block in an intra prediction mode is shown. According to an embodiment, the reference sample may be a sample adjacent to the left boundary of the current block and / or a sample adjacent to the upper boundary. Figure 5 As shown in , when the size of the current block is WXH and samples of a single reference line adjacent to the current block are used for intra prediction, a maximum of 2W+2H+1 neighboring samples located on the left and top of the current block can be used to configure the reference samples.
[0078] According to another embodiment of the present invention, samples on multiple reference lines may be used for intra prediction of the current block. Multiple reference lines may be composed of n lines located within a predetermined distance from the boundary of the current block. In this case, separate reference line information indicating at least one reference line used for intra prediction of the current block may be sent by signal. Specifically, the reference line information may include an index indicating any one of the multiple reference lines. In addition, if at least some of the samples to be used as reference samples have not been recovered, the intra prediction unit may obtain reference samples by performing a reference sample filling process. In addition, the intra prediction unit may perform a reference sample filtering process to reduce errors in intra prediction. That is, the filtered reference samples may be obtained by filtering the reference samples obtained by the neighboring samples and / or the reference sample filling process. The intra prediction unit uses the unfiltered reference samples or the filtered reference samples to predict the samples of the current block. In the present disclosure, the neighboring samples may include samples on at least one reference line. For example, the neighboring samples may include neighboring samples on a line adjacent to the boundary of the current block.
[0079] Next, Figure 6 An embodiment of a prediction mode for intra prediction is shown. For intra prediction, intra prediction mode information indicating an intra prediction direction may be signaled. The intra prediction mode information indicates one of a plurality of intra prediction modes included in an intra prediction mode set. When a current block is an intra prediction block, a decoder receives the intra prediction mode information of the current block from a bitstream. An intra prediction unit of the decoder performs intra prediction on the current block based on the extracted intra prediction mode information.
[0080] According to an embodiment of the present invention, the intra-frame prediction mode set may include all intra-frame prediction modes used in intra-frame prediction (e.g., a total of 67 intra-frame prediction modes). More specifically, the intra-frame prediction mode set may include a plane mode, a DC mode, and a plurality of (e.g., 65) angle modes (i.e., directional modes). In some embodiments, the intra-frame prediction mode set may be composed of some of all intra-frame prediction modes. Each intra-frame prediction mode may be indicated by a preset index (i.e., an intra-frame prediction mode index). For example, Figure 6 As shown in , intra-prediction mode index 0 indicates a plane mode, and intra-prediction mode index 1 indicates a DC mode. In addition, intra-prediction mode indexes 2 to 66 may indicate different angle modes, respectively. In this case, intra-prediction mode index 2 indicates a horizontal diagonal (HDIA) mode, intra-prediction mode index 18 indicates a horizontal (horizontal, HOR) mode, intra-prediction mode index 34 indicates a diagonal (DIA) mode, intra-prediction mode index 50 indicates a vertical (VER) mode, and intra-prediction mode index 66 indicates a vertical diagonal (VDIA) mode.
[0081] Figure 7 The inter-frame prediction method according to an embodiment of the present invention is illustrated. As described above, the decoder can predict the current block by referring to the reconstructed sample of another decoded picture. Figure 7 , the decoder obtains a reference block 702 in a reference picture 720 based on a motion information set of the current block 701. Here, the motion information set may include a reference picture index ref_idx_lx and a motion vector MV. The reference picture index ref_idx_lx indicates a reference picture 720 including a reference block for inter prediction of the current block in a reference picture list lx. The motion vector MV indicates an offset between a coordinate value of the current block 701 in the current picture 710 and a coordinate value of the reference block 702 in the reference picture 720. The decoder obtains a predictor of the current block 701 based on a sample value of the reference block 702, and reconstructs the current block 701 using the predictor.
[0082] In detail, the encoder can obtain the above-mentioned reference block by searching for a block similar to the current block from the previous picture in the reconstruction order. For example, the encoder can search for a reference block with the smallest sum of sample value differences from the current block within a preset search area. Here, in order to measure the similarity between the samples of the current block and the reference block, at least one of the sum of absolute differences (SAD) or the sum of Hadamard transform differences (SATD) can be used. Here, SAD can be a value obtained by adding all absolute values of the difference between the sample values included in the two blocks. In addition, SATD can be a value obtained by adding all absolute values of Hadamard transform coefficients obtained by performing Hadamard transform on the difference between the values of the samples included in the two blocks.
[0083] Meanwhile, the current block may also be predicted using at least one reference region.As described above, the current block may be inter-predicted using a bi-directional prediction scheme in which up to two reference regions are used. Figure 8 The bidirectional prediction method according to an embodiment of the present invention is illustrated. Figure 8 , the decoder can obtain two reference blocks 802 and 803 based on the two motion information sets of the current block 801. In addition, the decoder can obtain the first predictor and the second predictor of the current block based on each sample value of the two reference blocks obtained. In addition, the decoder can reconstruct the current block 801 using the first predictor and the second predictor.
[0084] According to one embodiment, the decoder may reconstruct the current block 801 based on the average value of each sample of the first predictor and the second predictor. According to another embodiment, the decoder may reconstruct the current block 801 by applying different weight values to the first predictor and the second predictor. In this case, information indicating the use or non-use of the weight value may be signaled through the PPS or SPS. The weight value and the offset value used to predict the current block 801 may be transmitted in units of slices / tiles through the slice / tile header. In addition, the weight value and the offset value used to predict the current block 801 may be transmitted for each coding unit. This will be referred to later. Figures 18 to 25 Describes the method of using weight values to predict the current block.
[0085] As described above, one or more motion information sets may be signaled for motion compensation of the current block. In the method of signaling the motion information set of the current block, redundancy between the motion information sets used for motion compensation of each of the plurality of blocks may be used. This is because the motion information set used to predict the current block may be derived from the motion information set used to predict any one of the other samples in the pre-reconstruction.
[0086] For example, there may be multiple candidate blocks, which may have been predicted based on a motion information set that is the same as or similar to the motion information set of the current block. The decoder can generate a merge candidate list based on the multiple candidate blocks. Here, the merge candidate list may include candidates corresponding to samples among samples reconstructed earlier than the current block, which may have been predicted based on a motion information set related to the motion information set of the current block. The encoder and the decoder can configure the merge candidate list of the current block according to predetermined rules. Here, the merge candidate lists configured by the encoder and the decoder, respectively, may be the same. For example, the encoder and the decoder can configure the merge candidate list of the current block based on the position of the current block in the current picture. This will be referred to later. Fig. 9 A method for an encoder and a decoder to configure a merge candidate list of a current block is described. In the present disclosure, a position of a specific block indicates a relative position of an upper left sample of the specific block in a picture including the specific block.
[0087] According to an embodiment, when a current block is predicted using a merge candidate list, the current block may be reconstructed based on a motion information set corresponding to any one of the candidates included in the merge candidate list. For example, a motion vector of the current block may be obtained based on a motion vector of any one of the candidates included in the merge candidate list. In addition, a reference picture to be referenced to predict the current block may be obtained based on a reference picture list and a reference picture index corresponding to any one of the candidates.
[0088] In detail, a merge index indicating any one of the multiple candidates included in the merge candidate list may be signaled. The decoder may receive the merge index signaled from the encoder. The decoder may perform motion compensation of the current block based on the motion information set corresponding to the candidate indicated by the merge index. The candidate indicated by the merge index may be referred to as a merge target. The decoder may obtain the motion information set of the current block based on the motion information set corresponding to the merge target. That is, motion compensation of the current block may be performed based on the reference picture index of the merge target and the motion vector of the merge target. In this way, the encoder and the decoder may reduce motion information signaling overhead.
[0089] According to an embodiment, the prediction method using the merge candidate list can be divided into a skip mode and a merge mode. For example, when the prediction method of the current block is a skip mode, the residual signal of the current block may not be sent by a signal. In this case, the decoder can reconstruct the current block based on the predictor of the current block generated based on the merge index. When the prediction method of the current block is a merge mode, the merge index and the residual signal can be sent from the encoder by a signal. In this case, the decoder can reconstruct the current block based on the merge index and the residual signal of the current block. The decoder can generate a predictor for the current block based on the motion information set of the merge target indicated by the merge index of the current block. Next, the decoder can reconstruct the current block based on the generated predictor of the current block and the received residual signal.
[0090] In the following, reference will be made to Fig. 9 A method for configuring a merge candidate list according to an embodiment of the present invention is described in detail. Fig. 9 is a diagram illustrating a method of configuring a merge candidate list according to an embodiment of the present invention. According to an embodiment, the merge candidate list may include at least one of a spatial candidate or a temporal candidate. Here, a spatial candidate may refer to a candidate configured based on a neighboring block of a current block. This is because the motion information set for the current block may be the same as or similar to the motion information set of any one of the neighboring blocks used to predict the current block. In the present disclosure, a spatial candidate or a temporal candidate may be referred to as a block corresponding to each candidate.
[0091] refer to Fig. 9 , the spatial candidates of the merge candidate list can be configured based on the available neighboring blocks A0, A1, B0, B1 and B2 corresponding to the preset positions among the neighboring blocks adjacent to the current block. In detail, the spatial candidates of the merge candidate list may include at least one of the lower left block A0, the left block A1, the upper right block B0, the upper block B1 or the upper left block B2. Here, the decoder can search A1, B1, B0, A0 and B2 sequentially to configure up to four spatial candidates. In addition, when intra-frame prediction has been performed on a specific block among the neighboring blocks, there is no specific block, or the prediction mode of the specific block is unavailable, the corresponding block can be configured as unavailable.
[0092] For example, when A1 is not available, the decoder may not include A1 in the merge candidate list. Next, the decoder may determine whether B1 is available. Here, when B1 is available, the decoder may configure a merge candidate list including B1. The decoder may search the remaining neighboring blocks B0, A0, and B2 so that the merge candidate list includes up to four spatial candidates. In addition, the motion information set of a specific neighboring block may be searched earlier than a specific neighboring block, and may be the same as the motion information set of another neighboring block included in the merge candidate list. In this case, the decoder may not include the corresponding neighboring block in the merge candidate list.
[0093] As described above, the merge candidate list may include a temporal candidate. The temporal candidate may represent a candidate configured based on a block corresponding to the position of the current block in another picture other than the current picture. This is because the motion information set for the current block may be the same or similar to the motion information set for predicting the block included in another picture. For example, other pictures other than the current picture may be a pre-configured reference picture R0. The pre-configured reference picture R0 may be signaled by a header of a higher layer including the current block. Here, the higher layer may represent a slice / tile, a picture or a CTU or a coding tree block (CTB) including the current block. In detail, the encoder may insert a reference picture index indicating the pre-configured reference picture R0 in a specific reference picture list into the header of the higher layer.
[0094] refer to Fig. 9 , the temporal candidate may include a co-located block C3 corresponding to the same position as the current block in the current picture in a pre-configured reference picture R0, or a lower right block H of the co-located block C3. Here, the decoder may search for H in preference to C3. For example, when H is not available, the decoder may not include H in the merge candidate list. Next, the decoder may determine whether C3 is available. In addition, when C3 is available, the decoder may configure a merge candidate list including C3. Conversely, when H is available, the decoder may not perform an operation to determine whether C3 is available. That is, the merge candidate list may include up to one temporal candidate.
[0095] In addition, the decoder can scale the motion vector of the temporal candidate to use the scaled motion vector as the motion vector of the current block. The decoder can scale the motion vector of the temporal candidate according to the temporal distance between the reference pictures. This is because the candidate block corresponding to the temporal candidate belongs to a picture different from the picture to which the current block belongs. In detail, the decoder can obtain a first value td by subtracting the POC of the picture referenced for predicting the temporal candidate from the picture order count (POC) of the picture including the temporal candidate. The decoder can obtain a second value tb by subtracting the POC of the reference picture to be referenced to predict the current picture from the POC of the current picture. In addition, the decoder can scale the motion vector of the temporal candidate based on the first value td and the second value tb. Here, the decoder can perform calculations using a fixed-point method in which an offset value and a shift operation are used. In this way, the decoder can use no division operation.
[0096] According to an embodiment, when the sum of the number of spatial candidates and the number of temporal candidates is less than the maximum number of candidates that can be included in the merge candidate list, the decoder may include candidates corresponding to additional prediction methods in the merge candidate. The maximum number of merge candidates included in the merge candidate list may be signaled by including a header of a higher layer of the current block. According to an embodiment, an additional motion information list may be managed, which includes motion information sets for blocks reconstructed earlier than the current block. In detail, the motion information list may include motion information sets for a plurality of blocks reconstructed earlier than the current block in the current picture, respectively. In this case, the decoder may use at least some of the motion information sets included in the motion information list as candidates for the merge candidate list.
[0097] According to another embodiment, the decoder may select two candidates from the candidates included in the merge candidate list according to a preset order. In addition, the decoder may generate an average motion vector based on an average of motion vectors used to predict each of the two selected candidates. The decoder may generate an average motion information set based on the average motion vector. In addition, the decoder may use the generated average motion information set as a candidate for the merge candidate list.
[0098] According to another embodiment, the decoder can generate bidirectional prediction information by combining unidirectional prediction information. In detail, when multiple candidates have been predicted based on unidirectional prediction information, the decoder can combine the unidirectional prediction information about the candidates to generate bidirectional prediction information for prediction. In addition, the decoder can add the generated bidirectional prediction information to the merge candidate list. In addition, the decoder can include the candidate corresponding to the zero motion vector in the merge candidate list.
[0099] As described above, the encoder and decoder according to the embodiment can reduce the overhead associated with motion information signaling by using a merge candidate list and a merge index. However, it may be difficult to accurately express the motion of the current block using the motion vector of the merge candidate included in the merge candidate list. According to an embodiment of the present invention, the motion vector corrected from the motion vector of the merge candidate indicated by the merge index can be used as the motion vector of the current block. In this way, the encoder and decoder can use the merge candidate list to improve the prediction performance of the prediction method. Hereinafter, the method for correcting the motion vector of the current block according to an embodiment of the present invention will be described in detail.
[0100] According to an embodiment of the present invention, the decoder may correct the motion vector of the current block. For example, when predicting the current block using a merge candidate list, the decoder may correct the motion vector of the current block. Here, the motion vector of the current block may be a merged motion vector obtained from the motion vector of the merge target. In the present disclosure, the merged motion vector may represent the motion vector of the current block obtained from the motion information set corresponding to the merge target. The decoder may generate a corrected motion vector by correcting the merged motion vector. In addition, the decoder may predict the current block based on the corrected motion vector.
[0101] According to an embodiment, the merged motion vector may be corrected based on a motion vector offset. Here, the motion vector offset may indicate the difference between the motion vector before correction and the corrected motion vector. For example, the decoder may generate a corrected motion vector by adding the motion vector offset to the merged motion vector. Here, the motion vector offset may be sent with a signal or may be derived according to a preset rule.
[0102] According to an embodiment, information indicating a motion vector offset may be signaled separately. Here, the information indicating a motion vector offset may include at least one of an absolute value of a motion vector offset or a sign of a motion vector offset. The absolute value of a motion vector offset may indicate a distance between a motion vector before correction and a corrected motion vector. In detail, the absolute value of a motion vector offset may be obtained by a distance index. For example, an encoder may signal a distance index corresponding to a specific distance based on a table predefined between an encoder and a decoder. In addition, a decoder may determine the absolute value of a motion vector offset based on a received distance index and a table predefined between an encoder and a decoder.
[0103] In addition, the sign of the motion vector offset can be obtained by a symbol index. The symbol index can indicate a symbol set, which includes symbols corresponding to the x-axis component and the y-axis component of the coordinates (x, y) indicating the motion vector, respectively. For example, a symbol information table including a specific symbol set mapped to a specific symbol index can be managed. The symbol information table can be the same between the encoder and the decoder.
[0104] Next, the decoder may reconstruct the current block based on the corrected motion vector. The decoder may generate a predictor for the current block based on the corrected motion vector. In addition, when the prediction mode of the current block is the above-mentioned merge mode, the decoder may reconstruct the current block based on the predictor for the current block and the residual signal for the current block. When the prediction mode of the current block is the above-mentioned skip mode, the decoder may reconstruct the current block based on the predictor for the current block without the residual signal.
[0105] At the same time, as described above, inter-frame prediction can be performed based on multiple motion information sets. For example, the decoder can obtain the motion information set of the current block based on the motion information set of the merge target block indicated by the merge index of the current block. Here, when the merge target has been predicted based on multiple motion information sets, multiple motion information sets can also be used to predict the current block. Hereinafter, a method for correcting multiple motion vectors of the current block will be described. Specifically, although the present disclosure exemplarily describes a case in which the current block is predicted based on two motion information sets obtained by merging candidate lists, the present disclosure is not limited thereto.
[0106] According to an embodiment of the present invention, when a merge target includes multiple motion information sets, multiple motion vector offsets corresponding to multiple motion vectors may be required. In this case, the decoder may first obtain a specific motion vector offset as one of the multiple motion vector offsets, and may obtain other motion vector offsets based on the specific motion vector offset. In this way, the signaling overhead or complexity of the decoder related to the acquisition of the motion vector offset may be reduced. In the following, according to an embodiment of the present invention, reference will be made to Fig.10 A method of determining a motion vector from among a plurality of motion vectors for first obtaining a motion vector offset is described.
[0107] Fig.10 is a diagram illustrating a method for correcting a motion vector according to an embodiment of the present invention. According to an embodiment of the present invention, multiple merged motion vectors may be corrected based on the POC of at least one reference picture of a merged target. The decoder may correct multiple merged motion vectors based on the POC difference between the current picture and each reference picture corresponding to the multiple merged motion vectors. For example, the decoder may compare the POC difference between the current picture and each reference picture corresponding to the multiple merged motion vectors. In addition, the decoder may correct multiple motion vectors based on the result of the comparison. The POC difference may represent the absolute value of a value obtained by subtracting the POC of a reference picture from the POC of a current picture, and vice versa.
[0108] According to an embodiment, the plurality of motion vectors may include a first motion vector and a second motion vector. In this case, the decoder may obtain a first POC difference between a current picture and a first reference picture corresponding to the first motion vector. In addition, the decoder may obtain a second POC difference between a current picture and a second reference picture corresponding to the second motion vector. The decoder may compare the first POC difference and the second POC difference to obtain a specific motion vector offset, which is a correction value of the first motion vector or the second motion vector. The decoder may obtain a motion vector offset of one of the first motion vector and the second motion vector earlier than a motion vector offset of the other of the first motion vector and the second motion vector.
[0109] For example, the motion vector offset of the motion vector corresponding to the reference picture having a larger POC difference among the first POC difference and the second POC difference can be obtained earlier than the motion vector offset of the motion vector corresponding to the reference picture having a smaller POC difference. This is because as the difference between the POC of the current picture and the POC of the reference picture including the reference block increases, the temporal distance between the reference block and the current block may increase, and the correlation therebetween may decrease. Therefore, the motion vector corresponding to the reference picture having a larger POC difference from the current picture may have a larger absolute value of the motion vector offset. The decoder may obtain a specific motion vector offset of a specific motion vector earlier than another motion vector offset, and the specific motion vector is expected to have a relatively large absolute value of the motion vector offset. In detail, only the specific motion vector offset may be sent to the decoder with a signal, or may be determined by the decoder in priority. The motion vector corresponding to the reference picture having a relatively small POC difference from the current picture may be corrected based on the motion vector offset scaled from the specific motion vector offset.
[0110] For example, when the first POC difference is greater than or equal to the second POC difference, the specific motion vector offset may be a correction value for the first motion vector. Conversely, when the first POC difference is less than the second POC difference, the specific motion vector offset may be a correction value for the second motion vector. Here, the first motion vector may be a motion vector corresponding to the reference picture list L0, and the second motion vector may be a motion vector corresponding to the reference picture list L1.
[0111] exist Fig.10In an embodiment, the motion information set of the current block may include: a first motion information set including a first motion vector MV0 and a second motion information set including a second motion vector MV1. In addition, the first motion information set may include a first reference picture index, and the second motion information set may include a second reference picture index. According to an embodiment, the decoder may obtain the motion information set of the current block based on the motion information set of the merge target. The decoder may obtain the motion vector of the current block by correcting MV0 and MV1.
[0112] refer to Fig.10 (a), when a first POC difference between a current picture and a first reference picture corresponding to MV0 is greater than or equal to a second POC difference between a current picture and a second reference picture corresponding to MV1, the decoder may obtain a first motion vector offset applied to MV0 earlier than a second motion vector offset applied to MV1. In addition, the decoder may correct MV0 based on the first motion vector offset. Next, a second motion vector offset may be obtained based on the first motion vector offset. In addition, the decoder may correct MV1 based on the second motion vector offset.
[0113] On the contrary, when the first POC difference is less than the second POC difference, the decoder may obtain the second motion vector offset in preference to the first motion vector offset. In addition, the decoder may correct MV1 based on the second motion vector offset. Next, the first motion vector offset may be obtained based on the second motion vector offset. In addition, the decoder may correct MV0 based on the first motion vector offset.
[0114] In detail, in step S1001, the decoder may obtain the POC poc_curr of the current block, the POC poc_RefPic0 of the first reference picture, and the POC poc_RefPic1 of the second reference picture. Here, the first reference picture and the second reference picture may correspond to reference picture lists L0 and L1, respectively. For example, the decoder may obtain the first reference picture indicated by the first reference picture index from the reference picture list L0. The decoder may obtain the POC poc_RefPic0 of the first reference picture. In addition, the decoder may obtain the second reference picture indicated by the second reference picture index from the reference picture list L1. The decoder may obtain the POC poc_RefPic1 of the second reference picture.
[0115] In step S1002, the decoder may obtain a first POC difference pocDiff0 based on the POC of the first reference picture and the POC of the current picture. pocDiff0 may be an absolute value of a value obtained by subtracting poc_curr from poc_RefPic0. In addition, the decoder may obtain a second POC difference pocDiff1 based on the POC of the second reference picture and the POC of the current picture. pocDiff1 may be an absolute value of a value obtained by subtracting poc_curr from poc_RefPic1.
[0116] In step S1003, the decoder may compare the first POC difference and the second POC difference. The decoder may determine whether the first POC difference is greater than the second POC difference. In step S1003, when the first POC difference is greater than the second POC difference, the decoder may preferentially obtain a first motion vector offset corresponding to MV0. The decoder may correct MV0 based on the first motion vector offset. Next, the decoder may obtain a second motion vector offset scaled from the first motion vector offset. In addition, the decoder may correct MV1 based on the second motion vector offset.
[0117] When the first POC difference is not greater than the second POC difference in step S1003, the decoder may determine whether the first POC difference and the second POC difference are equal, as in step S1004. In step S1004, when the first POC difference and the second POC difference are not equal, the decoder may preferentially obtain a second motion vector offset corresponding to MV1. The decoder may correct MV1 based on the second motion vector offset. Next, the decoder may obtain a first motion vector offset scaled from the second motion vector offset. In addition, the decoder may correct MV0 based on the first motion vector offset.
[0118] When the first POC difference and the second POC difference are equal in step S1004, the decoder may obtain the motion vector offset of MV0 corresponding to the reference picture list L0 earlier than the motion vector offset of MV1 corresponding to the reference picture list L1. For example, when the first POC difference and the second POC difference are equal, the decoder may determine the motion vector for which the motion vector offset is to be obtained preferentially based on the value indicating the reference picture list corresponding to the motion vector. Here, the value indicating the reference picture list may be an index for identifying each of a plurality of reference picture lists. For example, the reference picture list L(i) may be identified by the value i indicating the reference picture list. The value indicating the reference picture list L0 may be "0", and the value indicating the reference picture list L1 may be "1". In detail, the decoder may preferentially obtain the motion vector offset of the motion vector corresponding to the reference picture list having a smaller value indicating the reference picture list. Therefore, when the first POC difference and the second POC difference are equal, the decoder may obtain the first motion vector offset earlier than the second motion vector offset. Here, the reference picture list L0 may be a list used in a first higher layer region in which up to one motion vector is used for a specific sample and in a second higher layer region in which up to two motion vectors are used for a specific sample. In addition, the reference picture list L1 may be a list used only in a second higher layer region in which up to two motion vectors are used for a specific sample. That is, the reference picture list L1 may be a list not used in a first higher layer region in which up to one motion vector is used for a specific sample. Here, the region of the higher layer may represent a slice / tile or a picture including the current block.
[0119] [Equation 1] indicates an embodiment of a method for determining a motion vector MV1 for which a motion vector offset is first obtained. The decoder can obtain the lth motion vector MV1 having the largest POC difference among MV0, MV1, ..., MVk-1 according to [Equation 1]. In [Equation 1], POCi represents the POC of the reference picture corresponding to the i-th motion vector among the k motion vectors, and POCcur represents the POC of the current block.
[0120] [Equation 1]
[0121]
[0122] That is, through step S1003 and step S1004, the decoder can determine whether the first POC difference is greater than or equal to the second POC difference. When the first POC difference is greater than or equal to the second POC difference, the decoder can preferentially obtain the first motion vector offset corresponding to MV0. In addition, the decoder can correct MV0 based on the first motion vector offset. Next, the decoder can obtain the second motion vector offset corresponding to MV1. In addition, the decoder can correct MV1 based on the second motion vector offset.
[0123] On the contrary, when the first POC difference is less than the second POC difference, the decoder can preferentially obtain the second motion vector offset corresponding to MV1. In addition, the decoder can correct MV1 based on the second motion vector offset. Next, the decoder can obtain the first motion vector offset corresponding to MV0. In addition, the decoder can correct MV0 based on the first motion vector offset.
[0124] According to another embodiment, multiple merged motion vectors may be corrected based on the size of each of the multiple merged motion vectors. For example, the decoder may correct the multiple merged motion vectors according to a priority order based on a result of comparing the sizes of the multiple merged motion vectors. This is because as the size of the motion vector increases, the spatial distance between the reference block and the current block may increase, and thus the correlation may decrease. Fig.10 (b), the decoder can obtain the absolute value of each of MV0 and MV1. Next, the decoder can compare the absolute values of MV0 and MV1. When the absolute value of MV0 is greater than or equal to the absolute value of MV1, the decoder can obtain the first motion vector offset corresponding to MV0 earlier than the second motion vector offset corresponding to MV1. When the absolute value of MV0 is less than the absolute value of MV1, the decoder can obtain the second motion vector offset earlier than the first motion vector offset. [Equation 2] indicates an embodiment of a method for determining a motion vector MV1 for which a motion vector offset is to be obtained preferentially. In [Equation 2], MVi represents the i-th motion vector among k motion vectors.
[0125] [Equation 2]
[0126]
[0127] refer to Fig.10(c), the merged motion vector may be corrected based on the size of each merged motion vector and the POC of the reference picture. First, the decoder may determine the motion vector for which the motion vector offset is to be obtained first based on the result of comparing the first POC difference and the second POC difference. For example, the decoder may perform the above operations of steps S1001 to S1003. Next, when the first POC difference and the second POC difference are equal, the decoder may determine the motion vector for which the motion vector offset is to be obtained first based on the result of comparing the absolute value of MV0 and the absolute value of MV1.
[0128] Fig.11 is a diagram illustrating a method of correcting a motion vector according to another embodiment of the present invention. According to an embodiment, the decoder may determine a motion vector for which a motion vector offset is to be obtained preferentially among a plurality of motion vectors using a template matching method. Fig.11 , when the width of the current block is W and its height is H, the decoder may configure an L-shaped template including a W0xH area on the left side of the target block and a WxH0 area on the upper side of the target block. At least one of W0 or H0 may be determined based on the size of the current block. The decoder may configure an L-shaped template for each of the current block 1101, the first reference block 1102, and the second reference block 1103. Here, the first reference block 1102 may be a reference block specified by a motion vector MV0 of a reference picture list L0. In addition, the second reference block 1103 may be a reference block specified by a motion vector MV1 of a reference picture list L1.
[0129] Next, the decoder can determine the motion vector for which the motion vector offset is to be obtained first among MV0 and MV1 based on the value difference between the templates of the multiple configurations. In detail, the decoder can calculate the first template value difference between the template corresponding to MV0 and the template of the current block and the second template value difference between the template corresponding to MV1 and the template of the current block. The difference between the values of the template can be calculated by the above-mentioned SAD, average normalized SAD or square error sum (SSE). When the first template value difference is greater than or equal to the second template value difference, the decoder can obtain the first motion vector offset corresponding to MV0 earlier than the second motion vector offset corresponding to MV1. When the first template value difference is less than the second template value difference, the decoder can obtain the second motion vector offset earlier than the first motion vector offset. [Equation 3] indicates an embodiment of a method for determining a motion vector MV1 for which a motion vector offset is to be obtained first. In [Equation 3], cost_i represents the value difference between the template of the reference block i and the template of the current block. In detail, the reference block i represents the reference block specified by the i-th motion vector among the k motion vectors.
[0130] [Equation 3]
[0131]
[0132] According to an additional embodiment, the decoder may determine a motion vector for which a motion vector offset is to be obtained preferentially among multiple motion vectors based on the characteristics of the merge candidate. For example, when there is a motion vector scaled from a temporal candidate among multiple motion vectors corresponding to the merge target, the decoder may first obtain a motion vector offset of the motion vector scaled from the temporal candidate. In addition, when there is a zero motion vector among multiple motion vectors corresponding to the merge target, the decoder may first obtain a motion vector offset of the zero motion vector. Reference Fig.11 The motion vector determination method described in the reference Fig.10 The motion vector determination method described is combined.
[0133] At the same time, a method different from the above-mentioned method of using a merge candidate list may be used to obtain a motion information set of the current block. In this case, the motion vector of the current block may be obtained by a motion vector predictor (MVP) and a motion vector difference (MVD). The MVP candidate list may be used to signal the MVP of the current block. In addition, the reference picture index and the MVD of the current block may be signaled separately. The MVP candidate list may be obtained in a manner similar to the merge candidate list. This inter-frame prediction method may be referred to as an MVP mode.
[0134] According to an embodiment, the MVP candidate list may include at least one of a spatial candidate or a temporal candidate. Fig. 9 The merge candidate list described in the embodiment of the present invention can configure spatial candidates based on available neighboring blocks among neighboring blocks of the current block. In detail, the decoder can sequentially search Fig. 9 A0, A1, scaled A0 and scaled A1 to generate up to one first spatial candidate. Next, the decoder can sequentially search Fig. 9 B0, B1, B2, scaled B0 and scaled B1 can be used to generate up to one second spatial candidate. Here, scaled A0, scaled A1, scaled B0 and scaled B1 represent motion vectors obtained by scaling the motion vectors corresponding thereto respectively according to the temporal relationship. For example, when A0 is available, A1 is not available, and the reference picture used to predict A1 is different from the reference picture of the current picture, scaled A0 can be determined as the first spatial candidate. Here, the reference picture of the current picture can be a picture determined based on a reference picture index sent by a signal. In addition, the MVP candidate list can include up to one temporal candidate. The MVP candidate list can include a zero motion vector.
[0135] According to an embodiment, the encoder may signal a reference picture index, mvd, and MVP index indicating any one of the candidates in the MVP candidate list. The decoder may use the motion vector of the candidate indicated by the MVP index as the MVP of the current block. The decoder may obtain the motion vector of the current block based on the obtained MVP and the received mvd. For example, the motion vector of the current block may have a value obtained by adding the mvd to the MVP. Next, the decoder may reconstruct the current block based on the motion vector and the reference picture of the current block.
[0136] Fig.12 2 is a diagram illustrating motion vector scaling of a candidate included in an MVP candidate list of a current block according to an embodiment of the present invention. Hereinafter, an MVP candidate block refers to a candidate block corresponding to any one of the candidates included in the MVP candidate list. Fig.10 , a first temporal distance tb between the current picture and the picture referenced by the current block can be obtained. In addition, a second temporal distance td between the picture including the MVP candidate block and the picture referenced by the MVP candidate block can be obtained. The decoder can scale the motion vector corresponding to the MVP candidate block based on a value obtained by dividing the first temporal distance tb by the second temporal distance td. Here, the temporal distances tb and td can be expressed as POC differences. In addition, in order not to use a division operation, the decoder can use a fixed-point method to calculate tb and td. The fixed-point method can be a method using an offset value and a shift operation.
[0137] At the same time, the above-mentioned motion vector offset can be obtained by the decoder according to a predetermined rule. According to an embodiment of the present invention, the decoder can obtain the motion vector offset based on a template matching method. For example, the decoder can obtain the motion vector offset by searching for adjacent sample values based on a block specified by a merged motion vector obtained by a merged index. In addition, the decoder can correct the merged motion vector based on the obtained motion vector offset. In this way, the signaling overhead can be reduced.
[0138] Fig.13 is a diagram illustrating a method for correcting a motion vector according to an embodiment of the present invention. According to an embodiment, when the current block is a bidirectional prediction block, the decoder may correct multiple motion vectors for the bidirectional prediction block. For example, when the current block is a bidirectional prediction block, a first initial motion vector MV0 corresponding to a first reference picture list L0 and a second initial motion vector MV1 corresponding to a second reference picture list L1 may be used to predict the current block. Here, the initial motion vector may represent a merged motion vector derived based on the above-mentioned merge index. The decoder may correct each of the first initial motion vector MV0 and the second initial motion vector MV1 to generate a first corrected motion vector MV0' and a second corrected motion vector MV1'.
[0139] According to an embodiment of the present invention, the first initial motion vector MV0 and the second initial motion vector MV1 can be corrected based on a template matching method. The decoder can obtain a first template based on a first reference block indicated by the first initial motion vector and a second reference block indicated by the second initial motion vector. For example, the first template can be the average of each sample between the first reference block P0 and the second reference block P1. That is, a specific sample of the first template can be expressed in the form of (p0+p1) / 2. Here, p0 and p1 can be samples of corresponding positions in the first reference block P0 and the second reference block P1, respectively. In addition, the decoder can configure the first template using a bit shift operation such as (p0+p1)>>1. In this way, the decoder can configure the first template without a division operation.
[0140] According to another embodiment, when the weighted prediction method is used for the current block, the first template may be the sum of each sample of the first reference block and the second reference block to which the weight value is applied. In this case, the first template may be expressed as [Equation 4]. In [Equation 4], W0 and O0 may represent the weight value and the offset value applied to the reference block P0, respectively. In addition, W1 and O1 may represent the weight value and the offset value applied to the reference block P1, respectively. w_shift represents a parameter for a bit shift operation. Reference will be made later. Figures 18 to 25 Describes how weight and bias values are determined.
[0141] [Equation 4]
[0142] T=(w0×P0+w1×P1+((01+02+1)<w_shift))> (w_shift+1)
[0143] Next, the decoder may correct the first initial motion vector and the second initial motion vector based on the first template. According to an embodiment, the decoder may configure the first comparison target area based on the first reference block indicated by the first initial motion vector. In addition, the decoder may compare the first template with a plurality of comparison target templates configurable within the first comparison target area. Here, the comparison target template may be configured to have the same size and shape as the first template. In addition, the comparison target template may be configured with pixels in units of integer pixels or subpels (1 / 2, 1 / 4, 1 / 16-pel).
[0144] According to an embodiment, the decoder may determine a second template having a minimum value difference with the first template among the comparison target templates configurable in the first comparison target area. In addition, the decoder may generate a first corrected motion vector MV0' based on the second template. In detail, the motion vector offset between the first initial motion vector MV0 and the first corrected motion vector MV0' may be the difference between the coordinate value indicating the position of the first reference block and the coordinate value indicating the position of the second template.
[0145] The difference between the template values can be calculated by the sum of absolute differences (SAD) or the average normalized SAD. The SAD can be expressed as [Equation 5]. In addition, the average normalized SAD can be expressed as [Equation 6]. In [Equation 5] and [Equation 6], M represents the width of the template or block, and N represents the height of the template or block. In addition, T (x, y) represents a sample of the template, and P (x, y) represents a sample of the comparison target block. Mean (X) can be a function for outputting the average value of "X".
[0146] [Equation 5]
[0147]
[0148] [Equation 6]
[0149]
[0150] T′(x,y)=T(x,y)-mean(T(x,y)),
[0151] P'(x,y)=P(x,y)-meam(P(x,y))
[0152] According to a specific embodiment, the decoder may generate a first corrected motion vector MV0' based on a second template that minimizes the SAD or SAD' of the equation. In addition, the current block may be reconstructed based on a reference block indicated by the first corrected motion vector MV0'.
[0153] The above-described method of generating the first corrected motion vector MV0 ′ by correcting the first initial motion vector MV0 may be equally or equivalently applied to a method of generating the second corrected motion vector MV1 ′ by correcting the second initial motion vector MV1 .
[0154] Fig.14 is a diagram illustrating a search position for correcting a motion vector based on an initial motion vector according to an embodiment of the present invention. Fig.14(a), P0 indicates the sample position indicated by the initial motion vector. According to an embodiment of the present invention, the decoder may configure eight templates corresponding to eight sample positions P1, P2, P3, P4, P5, P6, P7 and P8 adjacent to P0, respectively. In addition, the decoder may determine a template having a minimum value difference with the template of the current block generated based on the initial motion vector among the eight templates. In addition, the decoder may generate a motion vector corrected based on the sample position corresponding to one template.
[0155] For example, the initial motion vector indicating P0 may be expressed as a coordinate value (x, y). Here, when the value difference between the template of the current block and the template corresponding to P5 (a position moved by +1 from P0 in the x-axis direction) is the smallest, the decoder may correct the initial motion vector (x, y) to (x+1, y). According to another embodiment, when the value difference between the template of the current block and the template corresponding to P6 (a position moved by -1 from P0 in the x-axis direction and +1 in the y-direction) is the smallest, the decoder may correct the initial motion vector (x, y) to (x-1, y+1). According to another embodiment, when the value difference between the template of the current block and the template corresponding to P0 is the smallest, the initial motion vector may not be updated.
[0156] Fig.14 (b) shows that only the search Fig.14 (a) is an embodiment of some of the sample positions illustrated in FIG. According to an embodiment of the present invention, the decoder may perform template matching only on some sample positions adjacent to P0. This is because when template matching cost calculation is performed on all samples adjacent to P0, the decoding calculation amount may become excessive and the decoding complexity may increase. In detail, motion vector correction may be performed based on four templates corresponding to four sample positions P2, P4, P5 and P7 adjacent to P0 in the vertical direction and the horizontal direction, respectively. That is, templates corresponding to sample positions P1, P3, P6 and P8 adjacent to P0 in the diagonal direction, respectively, may be excluded from the search object.
[0157] According to another embodiment, the decoder may additionally perform template matching on any one of the sample positions P1, P3, P6, and P8 that are adjacent in the diagonal direction. According to a preset rule, the decoder may determine the sample position on which the template matching is to be performed. For example, when the value difference between the template of the current block and the template corresponding to P2 is less than the value difference between the template of the current block and the template corresponding to P7, and the value difference between the template of the current block and the template corresponding to P5 is less than the value difference between the template of the current block and the template corresponding to P4, the decoder may perform template matching on P2, P4, P5, P7, and P3.
[0158] Fig.13The illustration shows a template for predicting the current block, the template having the same size as the width and height of the current block. According to another embodiment of the present invention, the template of the current block can be configured to be different from the current block in size and / or shape. For example, the size of the template of the current block can be expanded compared to the size of the current block. In this way, the accuracy of template matching can be improved.
[0159] Fig.15 is a diagram illustrating a method of configuring a template for correcting a motion vector according to an embodiment of the present invention. According to an embodiment, the current block may have a width W and a height H. In this case, a reference block 1501 having the same shape as the current block having a width W and a height H may be configured based on a sample position indicated by an initial motion vector. In addition, the reference block may be configured so that the sample position indicated by the initial motion vector becomes the upper left sample within the reference block. Here, a template 1502 may be configured having a shape in which a left boundary of the reference block 1501 and an upper boundary of the reference block extend. In detail, a width W0 extending from the left boundary of the reference block 1501 toward the outside of the block and a height H0 extending from the upper boundary of the reference block 1501 toward the outside of the block may be determined based on the size of the reference block 1501. Even when the decoder uses an extended template, the decoder may use the same template as the reference block. Fig.13 and Fig.14 The initial motion vector is corrected by the same or equivalent method as described.
[0160] Fig.16 is a flowchart illustrating a method of correcting a motion vector according to an embodiment of the present invention. As described above, the current block can be predicted based on a plurality of motion information sets. Fig.16 In an embodiment of the present invention, the current block can be predicted based on k motion vectors. The decoder can correct the k motion vectors using a template matching method. In addition, the decoder can generate a final prediction block of the current block based on the k corrected motion vectors. Hereinafter, a method for correcting k initial motion vectors will be described in detail.
[0161] According to an embodiment, the template of the current block may be configured based on a plurality of reference blocks corresponding to initial motion vectors MV0, MV1, ..., MVk-1, respectively. Next, MV0, MV1, ..., MVk-1 may be corrected based on the template of the current block. For example, among the comparison target templates within the comparison target area configured based on MV0, the decoder may generate MV0' based on a template having a minimum difference with the template of the current block. Here, the decoder may generate a corrected motion vector while increasing the number of iterations for each initial motion vector. The reference motion vector used to configure the comparison target area may be changed according to the number of iterations.
[0162] For details, refer to Fig.14The described multiple comparison target templates corresponding to multiple sample positions respectively can be configured based on the sample position indicated by the reference motion vector in each iteration. Here, the reference motion vector of the current iteration can be a motion vector corrected by the previous iteration. When the number of iterations is "0", the reference motion vector can be an initial motion vector. In each iteration, the decoder can calculate the value difference between the template of the current block and each of the multiple comparison target templates. In addition, the decoder can generate a corrected motion vector for the current iteration based on the comparison target template having the minimum value difference with the template of the current block. Next, when the current number of iterations is less than the preset maximum number of iterations max_iteration, the decoder can perform template matching for the next iteration based on the corrected motion vector of the current iteration. Through the above method, the initial motion vector can be repeatedly corrected until the number of iterations reaches the preset maximum number of iterations max_iteration.
[0163] According to another embodiment, motion vector correction can be performed in units of integer pixels or sub-pixels (1 / 2, 1 / 4, 1 / 16-pel). First, the decoder can generate a motion vector MVi' corrected in units of integer pixels based on the i-th initial motion vector MVi. Next, the decoder can use the motion vector MVi' corrected in units of integer pixels as a reference motion vector to update the motion vector of the sub-pixel unit. Here, the decoder can configure templates corresponding to multiple sample positions of sub-pixel units adjacent to P0 in the same manner as that used to correct motion vectors in units of integer pixels. In addition, the decoder can perform motion vector correction in sub-pixel units based on the configured template.
[0164] According to the above-mentioned motion vector correction method based on template matching, the decoder repeatedly accesses the memory, and thus the complexity of the decoder may increase. Therefore, in order to suppress the increase in the complexity of the decoder, a method of correcting multiple motion vectors based on one offset may be used. In this case, when the motion vector offset of the first initial motion vector for which the motion vector offset is first obtained among multiple initial motion vectors is "0", the other initial motion vectors may not be corrected. Here, the above reference may be used. Fig.10 and Fig.11 The described method determines a target for which a motion vector offset is to be first obtained among a plurality of initial motion vectors.
[0165] Fig.17 is a flowchart illustrating a method for correcting a motion vector according to another embodiment of the present invention. As described above, the current block can be predicted based on a plurality of motion information sets. Fig.17 In the embodiment of the present invention, the current block may be predicted based on k motion vectors.
[0166] First, the decoder can determine the motion vector for which to prioritize the motion vector offset. Fig.10 and Fig.11 The method described herein determines a target for which a motion vector offset is to be first obtained among a plurality of initial motion vectors. Fig.17 , the decoder can determine MV1 for which to first obtain the motion vector offset.
[0167] Next, the decoder can be based on the above reference Fig.16 The method described herein corrects MV1. For example, the template of the current block may be configured based on a plurality of reference blocks corresponding to the initial motion vectors MV0, MV1, ..., MVk-1, respectively. In addition, among the comparison target templates in the comparison target area configured based on MV1, the decoder may obtain the motion vector offset corresponding to MV1 based on the template having the minimum value difference with the template of the current block. The decoder may generate MV1' based on the motion vector offset corresponding to MV1.
[0168] Next, the decoder can determine whether MV1 has been corrected. When MV1 has not been corrected, the decoder can use the initial motion vectors MV0, MV1, ..., MVk-1 as the final motion vector to predict the current block. This is because the motion vector offset corresponding to MV1 is "0". On the contrary, when MV1 has been corrected, the decoder can sequentially correct the initial motion vectors other than MV1, such as Fig.16 For example, when l is 2 and MV2 has been corrected, correction may be sequentially performed on MV0, MV1, MV3, ..., MVk-1 except MV2.
[0169] In addition, in the process of sequentially correcting the initial motion vectors other than MV1, when the i-th motion vector has not been corrected, the decoder can end the motion vector correction early. For example, the decoder can use the corrected motion vectors for the motion vectors before MV1 and the (i+1)-th motion vector and the initial motion vectors for the motion vectors from the (i+1)-th motion vector to the k-th motion vector to predict the current block.
[0170] According to an additional embodiment, when all of the k initial motion vectors have been corrected and the number of iterations is less than the maximum number of iterations max_iteration, the decoder may update the template of the current block. In this case, the decoder may update the template of the current block based on multiple reference blocks corresponding to the corrected motion vectors, respectively. That is, using the motion vectors corrected by the previous iteration, the template of the current block used in the current iteration may be repeatedly updated as many times as the maximum number of iterations max_iteration. According to another embodiment, the method of terminating the correction algorithm early may be configured to be not used in the initial correction round depending on whether the MVI or other motion vectors are corrected. Whether to use early termination may be adaptively determined based on the size of the current block.
[0171] Hereinafter, a weighted prediction method for applying a weight value and an offset value to a reference block according to an embodiment of the present invention will be described.
[0172] Fig.18 is a diagram illustrating a weighted prediction method using one motion information set according to an embodiment of the present invention. As described above, a method of searching for a block having a high similarity to a current block in a picture having a POC different from that of the current picture can be used to determine a reference block for inter-frame prediction of the current block. Here, the picture having a POC different from that of the current picture can be a picture in the past direction whose POC is before the POC of the current picture, or a picture in the future direction whose POC is after the POC of the current picture. Here, a block having a high similarity to the current block can be searched in units of integer pixels or sub-pixels (1 / 2, 1 / 4, 1 / 16-pel).
[0173] According to an embodiment of the present invention, a motion information set of a specific block may include bidirectional prediction information. Here, the bidirectional prediction information may be information indicating whether the corresponding block is a block predicted using both reference picture lists. For example, the encoder may send the bidirectional prediction information with a signal. In addition, the motion information set may include a reference picture list, a reference picture index, and a motion vector. Figures 18 to 26 In the described embodiment, the motion vector and the initial motion vector may represent a merge motion vector derived based on a merge index from the merge candidate list described above.
[0174] According to another embodiment, the motion information set may include unidirectional / bidirectional information. The unidirectional / bidirectional information may be information indicating whether the corresponding block has been predicted based on a past directional picture or a future directional picture with reference to the POC of the current picture, or has been predicted based on a bidirectional picture.
[0175] According to an embodiment of the present invention, a decoder may predict a current block using a weighted prediction method for applying a weight value and an offset value to a reference block. Here, the weighted prediction method may be divided into a first weighted prediction method and a second weighted prediction method. First, in the first weighted prediction method, information indicating the use / non-use of weighted prediction and a weight parameter set may be signaled in units of PPS. Hereinafter, the weight parameter set may be used as an item including at least one of a weight value or an offset value applied to a reference block. Next, in the second weighted prediction method, information indicating the use / non-use of weighted prediction may be signaled in units of SPS. In addition, in the second weighted prediction method, a weight parameter set may be signaled for each coding unit. The first weighted prediction method and the second weighted prediction method may not be repeatedly applied to one coding unit. For example, the second weighted prediction method may be applied to a coding unit included in a picture to which the first weighted prediction method is not applied.
[0176] According to an embodiment, the second weighted prediction method may be applied only when the size of the coding unit is greater than a preset size or the number of samples of the coding unit is greater than a preset number. In the second weighted prediction method, the weight value can be indicated by the index gbi_idx[x0][y0] of the preconfigured table. Weighted_pred_flag can be used to indicate information indicating the use / non-use of weighted prediction for unidirectional prediction. Weighted_bipred_flag can be used to indicate information indicating the use / non-use of weighted prediction for bidirectional prediction. Although the embodiments of the present invention are described below based on the first weighted prediction method, the present disclosure is not limited thereto. The above-mentioned second weighted prediction method can be equally or equivalently applied to the embodiments described below.
[0177] exist Fig.18 , P0 represents a sample value of a reference block, W0 represents a weight value, and O0 represents an offset value. In addition, Wshift represents a parameter for a shift operation. The decoder may obtain information indicating use / non-use of weighted prediction based on a received bit stream. In addition, the decoder may predict a current block based on the information indicating use / non-use of weighted prediction.
[0178] Fig.19 is a diagram illustrating a weighted prediction method of a bidirectional prediction block according to an embodiment of the present invention. According to an embodiment of the present invention, a current block may be predicted based on a reference block P0 included in a picture based on a first reference picture list L0 and a reference block P1 included in a picture based on a second reference picture list L1. Fig.19In the example, W0 and O0 may represent a weight value and an offset value applied to the reference block P0, respectively. In addition, W1 and O1 may represent a weight value and an offset value applied to the reference block P1, respectively. Wshift represents a parameter used for a shift operation. The decoder may obtain corresponding information based on the bitstream and may predict the current block.
[0179] Fig. 20 1 is a flowchart illustrating a method for a decoder to predict a current block using weighted prediction according to an embodiment of the present invention. Fig. 20 In step S2001 of (a), the decoder may obtain an initial motion vector and weighted prediction related information. Here, the decoder may obtain the initial motion vector and weighted prediction related information from the received bit stream. In step S2003, the decoder may obtain a first reference block based on the initial motion vector and weighted prediction related information obtained in step S2001. In step S2005, the decoder may configure a template of the current block and a template of the first reference block.
[0180] In step S2007, the decoder may determine a weight parameter set to be applied to the first reference block using a template matching method. For example, the decoder may determine a weight parameter set to be applied to the first reference block based on a value difference between a template of the current block and a template of the first reference block. In addition, the decoder may generate a prediction block for inter-frame prediction by applying the determined weight parameter set to the first reference block. At the same time, depending on whether the inter-frame prediction method of the current block is bidirectional prediction, a similarity determined based on at least one of the additional information about the value difference between the templates or the value difference between the multiple reference blocks may be used to predict the current block.
[0181] Fig. 20 Steps S2002 and S2004 of (b) can be combined with Fig. 20 Step S2001 and step S2003 of (a) are the same. The decoder can obtain the initial motion vector and the weighted prediction related information, and can obtain the first reference block based on the initial motion vector and the weighted prediction related information. In step S2006, the decoder can perform a search based on the template of the current block to determine the second reference block. For example, the decoder can determine the second reference block based on the template of the current block and the additional information. In detail, the additional information can be a template of the comparison target block. The decoder can configure the comparison target area based on the first reference block. In this case, the decoder can configure the template of the specific comparison target block in the comparison target area. In addition, when the value difference between the template of the specific comparison target block and the template of the current block is equal to or less than a preset value, the decoder can use the specific comparison target block as the second reference block.
[0182] In step S2008, the decoder may use a template matching method to determine a set of weight parameters to be applied to each of the first reference block and the second reference block. For example, the decoder may use a template of the current block, a template of the first reference block, and a template of the second reference block to determine a set of weight parameters to be applied to each of the first reference block and the second reference block. In detail, the decoder may determine a set of weight parameters to be applied to each of the first reference block and the second reference block based on a value difference between the template of the current block and the template of the first reference block or a value difference between the template of the current block and the template of the second reference block. In addition, the decoder may determine a set of weight parameters to be applied to each of the first reference block and the second reference block based on samples of each of the current block, the first reference block, and the second reference block.
[0183] Fig.21 1 is a diagram illustrating a method of updating a weight parameter set to be applied to a reference block when a current block is unidirectionally predicted according to an embodiment of the present invention. According to an embodiment of the present invention, a decoder may configure a template of a current block based on neighboring samples of the current block. Hereinafter, the template of the current block may be referred to as a first template. Although Fig.21 The illustration shows that the template of the current block is configured using the upper and left neighboring samples of the current block, but the present disclosure is not limited thereto.
[0184] In addition, the decoder can determine the first reference block based on the motion vector MV0 of the current block. The decoder can configure a second template based on neighboring samples of the first reference block, which is a template of the first reference block. The second template can be configured using a method that is the same or equivalent to the method for configuring the template of the current block.
[0185] Next, the decoder may calculate the value difference between the first template and the second template. Here, the value difference between the templates may be a value determined using SAD or SATD. According to another embodiment, the value difference between the templates may be a value determined based on the ratio between the sum of the sample values of all samples included in the first template and the sum of the sample values of all samples included in the second template.
[0186] The decoder can update the weight parameter set based on the value difference between the templates determined using the above method. For example, when the weight value sent with the signal is the first weight value W0, the decoder can change the first weight value W0 to the second weight value W0' based on the value difference between the templates. In detail, the decoder can compare the value difference between the first template and the second template with a preset value. In addition, the decoder can change the first weight value W0 to the second weight value W0' based on the comparison result. The decoder can change the first weight value W0 to the second weight value W0' based on a predefined table, and the second weight value W0' is a weight value corresponding to the value difference between the templates. Here, the predefined table can be a common table shared between the encoder and the decoder. Next, the decoder can generate a prediction block of the current block by applying the second weight value W0' to the sample value of the first reference block. In addition, the decoder can reconstruct the current block based on the prediction block.
[0187] According to an additional embodiment, the decoder may use a linear model between the first template and the second template to determine a set of weight parameters to be applied to the first reference block. In detail, the decoder may generate a linear model that minimizes the difference between the sample values of each position of the samples in the first template and the second template. For example, when the linear model is y=ax+b, the decoder may apply the weight value "a" and the offset value "b" to the first reference block. In addition, in the linear model, x and y may correspond to the sample values of the second template and the sample values of the first template, respectively. In addition, the decoder may use a linear / nonlinear regression model instead of a linear model.
[0188] According to another embodiment, the decoder may determine a weight parameter set corresponding to a value difference between templates obtained based on a predefined table. According to another embodiment, the offset value applied to the first reference block may be updated with an offset value within a preset range according to changes in the weight value and the motion vector.
[0189] According to an additional embodiment, it can be determined whether to use a weighted prediction method based on the value difference between the first template and the second template. For example, when the value difference between the templates is equal to or less than a preset value, the weighted prediction method may not be used. On the contrary, when the value difference between the templates is at least a preset value, the weighted prediction method may be used.
[0190] although Fig.21 The method of updating the weight parameter set applied to the first reference block is illustrated, but the motion vector of the current block may be corrected using a method that is the same as or equivalent to the method of updating the weight parameter set. According to an embodiment of the present invention, the reference block may be corrected together with the above-mentioned update of the weight parameter set. Figures 9 to 17 Describes the motion vector correction.
[0191] For example, the decoder may update at least one of the motion vector of the current block, the weight value applied to the reference block, and the offset value applied to the reference block. The decoder may update at least one of the motion vector of the current block, the weight value applied to the reference block, and the offset value applied to the reference block based on the template of the current block and the template of the reference.
[0192] Fig. 22 2 is a diagram illustrating a method for predicting a current block based on an additional searched reference block according to an embodiment of the present invention. According to an embodiment of the present invention, an encoder may signal an additional reference marker indicating the presence of an additional reference block having a higher similarity to the current block than a first reference block indicated by a motion vector MV0 of the current block. Here, the additional reference marker may be 1 bit. The decoder may determine whether to correct the motion vector of the current block based on the additional reference marker. For example, when the additional reference marker is deactivated, the decoder may generate a prediction block of the current block based on the first reference block.
[0193] In contrast, when the additional reference flag is activated, the decoder can correct the motion vector of the current block by searching for an additional reference block that is more similar to the current block than the first reference block. That is, the decoder can obtain a corrected motion vector "MV0" indicating an additional reference block other than the first reference block in the reference picture. Here, the additional reference block can be searched based on the position of the first reference block. For example, the decoder can configure a comparison target area based on the position of the first reference block. In this case, the decoder can configure a template of a specific comparison target block in the comparison target area. In addition, the decoder can compare the template of the specific comparison target block with the template of the current block, and when the difference therebetween is equal to or less than a preset value, the decoder can use the specific comparison target block as an additional reference block.
[0194] refer to Fig. 22 , the decoder may compare the template of each comparison target block in the comparison target area with the first template to obtain a second reference block having the minimum value difference between the templates. Here, the decoder may obtain the second reference block having the minimum value difference between the templates in units of integer pixels, 1 / 2-pel, 1 / 4-ple, or 1 / 16-pel. In addition, when a weighted prediction method is used for the current block, the decoder may obtain a set of weight parameters to be applied to the second reference block based on the value difference between the first reference block and the second reference block. For example, the decoder may determine a weight value W0" to be applied to the second reference block based on the value difference between the first reference block and the second reference block. Here, the reference Fig.21The described method for determining the value difference between templates and the weighted prediction method based on the value difference between templates can be applied equally or equivalently. For example, the decoder can determine the weight value W0" to be applied to the second reference block based on the value difference between at least two of the first template of the current block, the second template of the first reference block, and the third template of the second reference block.
[0195] In addition, the decoder may predict the current block based on at least one of the first reference block or the second reference block. For example, the decoder may generate a first prediction block of the current block by applying a first weight value W0 to sample values of the first reference block. In addition, the decoder may generate a second prediction block of the current block by applying a second weight value W0" to sample values of the second reference block. In addition, the decoder may reconstruct the current block based on at least one of the first prediction block or the second prediction block.
[0196] According to another embodiment, the decoder can determine whether to use the weighted prediction method by comparing a preset value and a change in the corrected motion vector MV0" indicating the second reference block relative to the initial motion vector MV0. In addition, it can be determined whether to update the weight parameter set based on the change in the corrected motion vector MV0" indicating the second reference block relative to the initial motion vector MV0.
[0197] Fig.23 is a diagram illustrating a method of updating a weight parameter set to be applied to a reference block when the current block is a bidirectionally predicted block according to an embodiment of the present invention. According to an embodiment of the present invention, when the current block is a bidirectionally predicted block, the decoder may predict the current block based on two motion information sets. Here, the first motion information set corresponding to the reference picture list L0 may include a first motion vector MV0. In addition, the second motion information set corresponding to the reference picture list L1 may include a second motion vector MV1.
[0198] According to an embodiment of the present invention, the decoder can predict the current block based on the first reference block indicated by the first motion vector MV0 and the second reference block indicated by the second motion vector MV1. Figures 18 to 22 The method described above configures a first template of a current block, a second template of a first reference block, and a third template of a second reference block. Next, the decoder can determine a first template value difference by comparing the first template and the second template. In addition, the decoder can determine a second template value difference by comparing the first template and the third template. Next, the decoder can determine a first parameter set to be applied to the first reference block based on the first template value difference. In addition, the decoder can determine a second parameter set to be applied to the second reference block based on the second template value difference. Next, the decoder can reconstruct the current block based on the first parameter set and the second parameter set.
[0199] Fig.24 1 is a diagram illustrating a method for predicting a current block based on an additionally searched reference block when the current block is a bidirectionally predicted block according to an embodiment of the present invention. According to an embodiment of the present invention, the current block can be predicted based on a reference block generated by a plurality of reference blocks. First, the decoder can obtain a first reference block and a second reference block based on initial motion vectors MV0 and MV1 of the current block. Next, the decoder can generate a fifth reference block based on the first reference block and the second reference block. For example, the decoder can generate the fifth reference block or an average of each sample of the first reference block and the second reference block.
[0200] Next, the decoder may correct the initial motion vector based on the sample value of the fifth reference block. For example, the decoder may search for a block having a sample value similar to the sample value of the fifth block from each of the first reference picture and the second reference picture. Here, the first reference picture and the second reference picture may correspond to the initial motion vector (MV0, MV1), respectively. By performing the search, the decoder may obtain a third reference block that is most similar to the fifth reference block from the first reference picture, and a fourth reference block that is most similar to the fifth reference block from the second reference picture. According to one embodiment, the decoder may correct the initial motion vector MV0 to MV0' based on the position of the third reference block. In addition, the decoder may correct the initial motion vector MV1 to MV1' based on the position of the fourth reference block.
[0201] Next, the decoder may determine whether to perform weighted prediction or determine a parameter set to be applied to the third reference sample and a parameter set to be applied to the fourth reference sample based on at least one of the value difference between the fifth reference block and the third reference block or the value difference between the fifth reference block and the fourth reference block. Next, the decoder may reconstruct the current block based on the parameter set to be applied to the third reference sample and the parameter set to be applied to the fourth reference sample.
[0202] Fig.25 1 is a diagram illustrating a method for predicting a current block based on an additionally searched reference block when the current block is a bidirectionally predicted block according to another embodiment of the present invention. First, the decoder may obtain a first reference block and a second reference block based on initial motion vectors MV0 and MV1 of the current block. Next, the decoder may generate a fifth reference block based on the first reference block and the second reference block. For example, the decoder may generate the fifth reference block using an average of each sample of the first reference block and the second reference block or the sum of each sample of the first reference block and the second reference block to which a weight value is applied.
[0203] Next, the decoder can correct the initial motion vector based on the sample value of the fifth reference block. Here, the first reference picture and the second reference picture can correspond to the initial motion vectors MV0 and MV1, respectively. By performing the search, the decoder can obtain the third reference block that is most similar to the fifth reference picture from the first reference picture, and obtain the fourth reference block that is most similar to the fifth reference picture from the second reference picture.
[0204] Next, the decoder may configure a first template configured with neighboring samples of the current block. In addition, the decoder may configure a second template configured with neighboring samples of a third reference block and a third template configured with neighboring samples of a fourth reference block. Next, the decoder may determine a parameter set to be applied to the third reference sample and a parameter set to be applied to the fourth reference sample based on a value difference between two of the first template, the second template, and the third template. Next, in addition, the decoder may reconstruct the current block based on the parameter set to be applied to the third reference sample and the parameter set to be applied to the fourth reference sample.
[0205] According to an embodiment of the present invention, an efficient method for signaling a motion information set for inter-frame prediction can be provided. According to an embodiment, the motion information set of the current block can be derived based on the motion information set of the neighboring blocks used to predict the current block (such as the above-mentioned merge mode, skip mode and MVP mode).
[0206] As described above, the motion vector of the current block can be determined based on the motion vector predictor and the motion vector difference. For example, the decoder can obtain the motion vector of the current block by adding the motion vector difference to the motion vector predictor. According to an embodiment, the encoder and the decoder can determine the motion vector predictor according to a rule predefined between the encoder and the decoder. In addition, the encoder can obtain the motion vector difference based on the determined motion vector predictor. In addition, the encoder can send the obtained motion vector difference with a signal. The decoder can obtain the motion vector based on the determined motion vector predictor and the motion vector difference. In the case where the motion vector difference is sent with a signal instead of the motion vector as in the above method, the bits used to obtain the motion vector can be reduced.
[0207] The above-mentioned motion vector predictor can be obtained based on the motion vector predictor candidate list. Here, the motion vector predictor candidate list can be configured with spatial predictor candidates and temporal predictor candidates. In addition, the encoder and the decoder can configure the motion vector predictor candidate list based on a rule predefined between the encoder and the decoder.
[0208] According to an embodiment of the present invention, the candidates in the above-mentioned merge candidate list and / or motion vector predictor candidate list (hereinafter referred to as the candidate list) can be reordered. That is, the index indicating the candidate in the candidate list can be redefined. In the present disclosure, reordering the candidates in the candidate list can be referred to as motion candidate reordering (MCR). Motion candidate reordering can be performed according to each predefined reordering rule in the encoder and decoder. In this way, the encoder and decoder according to an embodiment of the present invention can improve the coding efficiency of the video signal.
[0209] According to an embodiment, the reordering rule may be based on a preset cost. For example, the reordering rule may determine an ascending (or descending) order of a specific cost. For example, the preset cost may represent a template matching cost. Fig.26 A template matching method according to an embodiment of the present invention is described.
[0210] Fig.26 is a diagram illustrating a template matching method according to an embodiment of the present invention. According to an embodiment, template matching may be an operation of comparing a template of a first block with a template of a second block. That is, the encoder and the decoder may determine the value difference between the first block and the second block by comparing the template of the first block with the template of the second block. This is because it may be assumed that a specific block and the template of the block have at least a preset level of similarity. For example, the encoder and the decoder may perform template matching based on the sample value difference between the templates of a plurality of blocks.
[0211] According to an embodiment of the present invention, the template of a specific block may be an area based on a preconfigured range and position of the block, or may be a sample in the area. For example, the template of a specific block may be configured with neighboring samples adjacent to the boundary of the block. In detail, the template of the current block may be configured with neighboring samples adjacent to the boundary of the current block. In addition, the template of the comparison target block to be compared with the current block may be configured to have neighboring samples adjacent to the boundary of the comparison target block. In addition, the template may be determined in an area where there are samples reconstructed earlier than the current block.
[0212] The above template matching cost may be the sum of the differences between the values of the samples corresponding to the same position in each of the multiple templates. In this case, as the sum decreases, the template is determined to be more similar. That is, the decoder may determine that the template matches better as the sum decreases. In addition, the template matching cost may decrease as the sum decreases. In addition, template matching may be performed based on the square or absolute value of the difference between the values of the samples corresponding to the same position in each of the multiple templates. Template matching may be an operation of searching for a candidate block corresponding to a template having a minimum value difference with the template of the current block among the candidate blocks in order to detect a block similar to the current block. For example, when there are multiple candidate blocks, as the template matching cost between the template of the current block and the candidate block decreases, the probability that the corresponding candidate block is selected as a merge or MVP target block increases. In addition, as the template matching cost decreases, the index of the candidate list may be set to a smaller value. For example, the candidate list may be reordered so that the candidate with a lower template matching cost among the multiple candidate blocks included in the candidate list has a smaller index.
[0213] refer to Fig.26 , the template of the current block may be configured with the upper neighboring samples and the left neighboring samples of the current block. However, the present disclosure is not limited thereto, and the template of the current block may be configured in different ways according to at least one of the block scanning order, the decoding order, or whether the neighboring samples of the current block are available. According to an embodiment, the template of the current block may be compared with the template of the comparison target block. Fig.26 In the example, the comparison target block of the current block may be a block indicated by a motion vector of a co-located block in a reference picture of the current block. In this case, the template 2701 of the current block and the template 2702 of the comparison target block may be compared. In addition, the decoder may determine the value difference between the current block and the comparison target block based on the result of the comparison. The decoder may reorder the candidate list, or may determine the target block based on the value difference between the current block and the comparison target block.
[0214] According to an embodiment of the present invention, MCR can be applied to all inter-frame prediction methods or motion vector acquisition methods described in the present disclosure. For example, MCR can be applied to at least one of merge mode, pattern matching motion vector refinement (PMVR) or MVP mode. The encoder and decoder according to an embodiment of the present invention can obtain a motion information set by selecting a candidate indicated by a specific index from a candidate list reordered by the above-mentioned MCR. Here, candidates with smaller indexes in the candidate list can be signaled by a smaller number of bits. Therefore, candidates with a higher probability of being selected can be arranged to correspond to smaller indexes in the candidate list.
[0215] Fig. 27is a diagram illustrating whether symbols match and symbol determination according to an embodiment of the present invention. According to an embodiment of the present invention, the encoder may not explicitly signal a symbol bit indicating symbol information of a specific value. In this case, the decoder may estimate the symbol information based on other information sent by the signal. In this way, when the symbol information is not signaled by an additional bit, the signaling overhead can be reduced. For example, the encoder may signal the symbol information of a motion vector or a motion vector difference without display. In addition, the decoder may estimate the symbol information of a motion vector or a motion vector difference based on the information sent by the signal.
[0216] According to a specific embodiment, when the decoder estimates the symbol information including n symbol bits, the number of the multiple possible symbol information is 2^n. According to an embodiment of the present invention, the encoder and the decoder may configure a symbol information list including multiple possible symbol information according to a rule predefined between the encoder and the decoder. The symbol information list may include multiple candidate symbol information. For example, Fig. 27 As illustrated in , when two symbols are estimated, the symbol information list may include four pieces of candidate symbol information.
[0217] According to an embodiment, the encoder may signal any one of a plurality of candidate symbol information included in the symbol information list. According to another embodiment, the encoder may signal modification information indicating a method for modifying each candidate symbol information based on the reference symbol information. In detail, the modification information may indicate "Hit" when the reference symbol information is not modified, "Vertical Flip" for a vertical modification in which the sign of the y-axis component is modified, "Horizontal Flip" for a horizontal modification in which the sign of the x-axis component is modified, and "Diagonal Flip" for a diagonal modification in which the signs of the x-axis component and the y-axis component are modified, but the present disclosure is not limited thereto. For example, when the number of symbol bits to be estimated is at least three, another modification method may be added.
[0218] refer to Fig. 27 The reference symbol information may be candidate symbol information having the lowest preset cost among the multiple candidate symbol information included in the symbol information list. The encoder and the decoder may determine the candidate symbol information having the lowest preset cost based on a predetermined rule. The preset cost may be the above reference Fig.26 Describes the template matching cost.
[0219] In detail, the decoder can obtain modification information "10" indicating the modification method from the encoder. In this case, the decoder can determine the reference symbol information as a reference among multiple candidate symbol information. That is, the decoder can determine the reference symbol information corresponding to the hit (Hit) among multiple candidate symbol information. For example, the decoder can use the candidate symbol information with the lowest template matching cost among multiple candidate symbol information as the reference symbol information. Next, the decoder can select the candidate symbol information that is vertically flipped (10) from the reference symbol information. According to an embodiment, when the above-mentioned symbol information indicates the sign of the motion vector difference of the current block, the symbol information may include the signs of the x-axis component and the y-axis component of the coordinates (x, y) defining the motion vector. In this case, the decoder can reconstruct the current block by using the selected candidate symbol information as the symbol information of the motion vector difference.
[0220] although Fig. 27 It is illustrated that the symbol information list is configured in the order of vertical modification, horizontal modification, and diagonal modification, but the present disclosure is not limited thereto. For example, the symbol information list may be configured such that the horizontal modification is signaled by fewer bits than the vertical modification.
[0221] In addition, information indicating each of the plurality of modification methods may be signaled by at least one bit. Here, the number of bits signaled to indicate the modification method may be variable. Symbol information having a higher probability of being selected from the symbol information list may be signaled by a smaller number of bits. For example, the modification method may be encoded using at least one of truncated unary binarization, unary binarization, or exp-Golomb binarization.
[0222] According to additional embodiments, information indicating the modification method may be encoded based on the context. In this way, signaling overhead may be reduced. Fig. 27 In the example, information corresponding to a specific modification may be signaled by 2 bits, and information indicating a modification method other than the specific modification method may be signaled by 3 bits. Here, the information to be signaled by 2 bits may be determined based on the context. Fig.28 and Fig.29 A method of encoding information indicating a modification method based on context is described.
[0223] Fig.28 and Fig.29 is a diagram illustrating a method for encoding symbol information in consideration of context according to an embodiment of the present invention. Fig.28 and Fig.29In an embodiment of the present invention, information indicating a method of modifying from reference symbol information may be signaled by a variable length bit. According to an embodiment of the present invention, modification information indicating a method of modifying from reference symbol information may be determined based on an absolute value of an x-axis component and an absolute value of a y-axis component. For example, when the estimated symbol information is symbol information of a motion vector difference value of a current block, the modification information may be determined based on an absolute value of an x-axis component and an absolute value of a y-axis component of the motion vector difference value.
[0224] refer to Fig.28 , modification information for modifying the sign of the smaller value among the absolute value of the x-axis component and the absolute value of the y-axis component can be signaled by a smaller number of bits. This is because flipping the sign of the smaller value among the absolute value of the x-axis component and the absolute value of the y-axis component may provide a short distance from the value before the sign modification. As the distance decreases, the cost value difference can be reduced. In detail, the distance between the position (x, y) and the position (-x, y) can be a first distance, and the distance between the position (x, y) and the position (x, -y) can be a second distance. Here, when the absolute value of y is less than the absolute value of x, the second distance can be less than the first distance. In this case, compared with the modification information for modifying the sign of the x-axis component, the modification information for modifying the sign of the y-axis component from the reference sign information can be signaled by a smaller number of bits.
[0225] Although in order to provide a description Fig.28 The case of |x|<|y| and the case of |x|>=|y| are illustrated, but the method of signaling the modification information may vary according to the cases of |x|<=|y| and |x|>|y|. Alternatively, when |x| and |y| are not equal, a method of considering the absolute value may be performed. Fig.10 The flip of |x| and |y| can be sent with a signal according to a preset method when |x| and |y| are equal. Here, the preset method can be a reference Fig. 27 According to an additional embodiment, a re-ranking process considering absolute values may be added to the above-mentioned candidate list MCR process.
[0226] In addition, reference Fig.28 , modification information for flipping the signs of both the x-axis component and the y-axis component (diagonal flip) can be signaled by "110". In addition, modification information for not flipping the signs of components with smaller absolute values (large absolute value flip) can be signaled by "111". That is, "diagonal flip" can be signaled by a smaller value than "large absolute value flip". At the same time, referring to Fig.29 , a “diagonal flip” may be signaled by “111”, and a “large absolute value flip” may be signaled by “110”.
[0227] like Fig. 27 As in, the above-mentioned symbol information may be information indicating the symbol of the motion vector or motion vector difference of the current block. When the above-mentioned symbol information indicates the symbol of the motion vector difference of the current block, the symbol information may include the symbols of the x-axis component and the y-axis component for defining the coordinates (x, y) of the motion vector. According to an embodiment, the decoder may determine the reference symbol information corresponding to the hit based on the template matching cost. For example, the decoder may use the candidate symbol information with the lowest template matching cost among multiple candidate symbol information as the reference symbol information. Next, the decoder may compare the absolute value of the x-axis component and the absolute value of the y-axis component of the motion vector difference of the current block. The decoder may obtain a modification method based on the comparison result and the modification information sent with a signal. Next, the decoder may obtain the final symbol information of the absolute value of the motion vector difference to be applied to the current block based on the obtained modification method and the reference symbol information. In addition, the decoder may generate the final motion vector difference by applying the obtained final symbol information to the absolute value of the motion vector difference. The decoder may reconstruct the current block based on the final motion vector difference.
[0228] In the above embodiment, the method of estimating 2-bit symbol information is described exemplarily, but the present disclosure is not limited thereto. The above symbol information estimation and signaling method can be equally or equivalently applied to the case of estimating symbol information including more than two symbol bits. For example, when estimating n symbols, modification information can be signaled based on the absolute values corresponding to the n symbols respectively. For example, as the absolute value of the component decreases, modification information of the sign of the flipped component can be signaled by a smaller number of bits.
[0229] Meanwhile, according to an embodiment of the present invention, the current block may be divided into a plurality of regions to which different motion information sets are applied so as to be predicted. Here, the current block may be divided based on boundary information. For example, the decoder may detect an edge in the current block. The decoder may detect an edge in the current block using a gradient-based sobel operator. Next, the decoder may obtain boundary information based on the detected edge. Here, based on the detected edge, the current block may be divided into at least two regions. The decoder may divide the current block into at least two regions in which different motion information sets are used based on boundary information. Hereinafter, a method for performing inter-frame prediction on each region divided from the current block based on different motion information sets according to an embodiment of the present invention will be described.
[0230] Fig.30 2 is a diagram illustrating a method of performing prediction on each region partitioned from a current block based on different motion information sets according to an embodiment of the present invention. Fig.30, the current block 310 may be divided into a first region 311 and a second region 312 based on the boundary information of the current block 310. The motion information set corresponding to the first region 311 may include a motion vector and a reference picture index indicating a first reference block 320 including a region similar to the first region 311 of the current block 310. That is, the first motion information set may be obtained based on the original sample values of the first region 311 of the current block 310 and the sample values of the first partial region 321 corresponding to the first region in the first reference block 320. SAD or SATD may be calculated based on the original sample values of the first region 311 of the current block 310 and the sample values corresponding to the first partial region 321. In addition, the first motion information set of the first region 311 of the current block 310 may be expressed as {MV_R1, ref_idx_R1}.
[0231] Likewise, the above embodiment may be applied to the second region 312 of the current block 310. For example, a second motion information set may be obtained based on the original sample values of the second region 312 of the current block 310 and the sample values of the second partial region 332 corresponding to the second region in the second reference block 330. The second motion information set corresponding to the second region 312 may be expressed as {MV_R2, ref_idx_R2}. The reference picture index for the first region 311 and the reference picture index for the second region 312 may be the same.
[0232] The decoder according to an embodiment of the present invention can obtain the final prediction block of the current block based on the first motion information set and the second motion information set obtained by the above method. For example, the decoder can generate a first prediction block for the first region 311 based on the first motion information set. In addition, the decoder can generate a second prediction block for the second region 312 based on the second motion information set.
[0233] Next, the decoder can generate a final prediction block for the current block by combining the first prediction block and the second prediction block. For example, the decoder can generate a first prediction block having a sample value of "0" corresponding to an area other than the first partial area 321. In addition, the decoder can generate a second prediction block having a sample value of "0" corresponding to an area other than the second partial area 321. In this case, the final prediction block can be expressed as the sum of the first prediction block and the second prediction block. In addition, the decoder can generate the first prediction block and the second prediction block using boundary information. The encoder and the decoder can generate boundary information according to predefined rules. Here, the multiple boundary information generated by the encoder and the decoder, respectively, can be the same. In addition, the decoder can generate a prediction block that is the same as the prediction block predicted by the encoder based on the boundary information.
[0234] According to additional embodiments, the decoder can perform vertical / horizontal filtering on samples around the boundary between the first area 311 and the second area 312. Here, the samples around the boundary can be adjacent to the boundary. In addition, the decoder can perform filtering using a low-pass filter that passes a frequency band lower than the reference frequency. In addition, the decoder can perform filtering using a low-band 3-tap filter. The filter factor of the low-band 3-tap filter can be {1 / 4, 2 / 4, 1 / 4}.
[0235] At the same time, when the current block is divided into Fig.30 When multiple regions are shown in , some of the multiple regions may be intra-predicted while other regions may be inter-predicted. Fig.31 is a diagram illustrating a method of performing intra prediction or inter prediction on each region divided from a current block according to an embodiment of the present invention. Fig.30 In the embodiment of the present invention, the current block may be divided based on the boundary information. For example, the current block may be divided into the first area 3201 and the second area 3202 based on the boundary information.
[0236] In a specific embodiment, the first region 3201 may be encoded according to an intra prediction method, and the second region 3202 may be encoded using an inter prediction method. In this case, the decoder may obtain a motion information set corresponding to the second region 3203, and may generate a second prediction block corresponding to the second region 3202 based on the corresponding motion information set {MV_R2, ref_idx_R2}.
[0237] In addition, the decoder can generate a first prediction block corresponding to the first region 3201 based on the left reference sample or the upper reference sample of the current block. The decoder can generate the first prediction block based on the intra prediction mode of the current block. Here, the intra prediction mode used to predict the first region 3201 in the encoder can be determined by the following equation.
[0238] [Equation 7]
[0239] cost(i)=SATD+λ·bit(i)
[0240]
[0241] In [Equation 7], SATD may be a value obtained by performing a Hadamard transform on a residual signal between a current block and a first prediction block. That is, SATD represents the difference between a prediction signal corresponding to the first region and an original signal. bit(i) represents the number of bits required to encode the i-th intra prediction mode, and λ may be a parameter for adjusting the unit between the residual signal and the coding rate. The encoder may signal an intra prediction mode that minimizes cost(i) of [Equation 7]. In addition, the decoder may generate a first prediction block for the first region 3201 using the parsed intra prediction mode.
[0242] Next, the decoder may generate a final prediction block for the current block by combining the first prediction block and the second prediction block. The decoder may combine the first prediction block and the second prediction block based on the boundary information. Here, in the first prediction block, the sample values of the area other than the first area 3201 may be set to "0". In addition, in the second prediction block, the sample values of the area other than the second area 3202 may be set to "0". In this case, the final prediction block may be expressed as the sum of the first prediction block and the second prediction block.
[0243] Fig.31 (a) illustrates a method for performing intra prediction on a first region when a boundary between the first region and the second region forms a closed curve according to an embodiment of the present invention. When the width of the current block is W and the height is H, the decoder can use up to 2*W+2*H+1 reconstructed samples existing around the current block to perform intra prediction.
[0244] Fig.31 (b) illustrates a method for performing intra-frame prediction on the first region when the boundary between the first region and the second region crosses the current block in any form according to an embodiment of the present invention. Fig.31 As in (a), the decoder can use up to 2*W+2*H+1 reconstructed samples present around the current block to perform intra prediction.
[0245] Fig.31 (c) to Fig.31 (e) illustrates a method for performing intra prediction on the first region based on padded reference samples when a boundary between the first region and the second region crosses the current block in any form according to an embodiment of the present invention. For example, when the first region and the second region are images showing different objects in the current block, it may be effective to use only a portion continuous with the first region among neighboring samples of the current block.
[0246] exist Fig.31In (c), the point where the boundary in the current block merges with the upper boundary of the current block and the point where the boundary in the current block merges with the left boundary of the current block can be (x', 0) and (0, y'), respectively. Here, the decoder can perform reference sample padding in the correct direction based on the reconstructed sample at position (x', -1). The decoder can configure the upper reference sample using the padding sample to the right of (x', -1) and (x'+1) reconstructed samples. In addition, the decoder can perform reference sample padding in the downward direction based on the reconstructed sample at position (-1, y'). The decoder can configure the left reference sample using the padding sample below (-1, y') and (y'+1) reconstructed samples.
[0247] Fig.31 (d) illustrates that a boundary in the current block merges with the upper boundary of the current block, but does not merge with its left boundary. Here, the point where the boundary between the first region and the second region merges with the upper boundary of the current block may be (x",0). The decoder may perform reference sample padding in the right direction based on the reconstructed sample at position (x",-1). The decoder may configure an upper reference sample using padding samples from the right side of (x",-1) and (x"+1) reconstructed samples. In addition, an existing reconstructed sample may be used as a left reference sample.
[0248] Fig.31 (e) The boundary in the illustrated current block merges with the left boundary of the current block but does not merge with its upper boundary. Here, the point where the boundary between the first region and the second region merges with the left boundary of the current block may be (0, y”). The decoder may perform reference sample padding in a downward direction based on the reconstructed sample at position (-1, y”). The decoder may configure a left reference sample using the lower padding sample from (-1, y') and (y”+1) reconstructed samples. Furthermore, an existing reconstructed sample may be used as an upper reference sample.
[0249] The above-mentioned embodiments of the present invention may be implemented by various means. For example, the embodiments of the present invention may be implemented by hardware, firmware, software or a combination thereof.
[0250] For the case of implementation through hardware, the method according to the embodiment of the present invention can be implemented by one or more of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a processor, a controller, a microcontroller, a microprocessor, etc.
[0251] In the case of implementation by firmware or software, the method according to the embodiment of the present invention can be implemented in the form of a module, process or function that performs the above functions or operations. The software code can be stored in a memory and driven by a processor. The memory can be located inside or outside the processor and can exchange data with the processor in various known ways.
[0252] The above description of the present invention is for illustrative purposes only, and it will be understood that those skilled in the art to which the present invention belongs can change the present invention without changing the technical ideas or basic features of the present invention, and the present invention can be easily modified in other specific forms. Therefore, the above embodiments are illustrative and are not limited in all aspects. For example, each component described as a single entity can be distributed and implemented, and similarly, the components described as distributed can also be implemented in an associated manner.
[0253] The scope of the present invention is defined by the appended claims rather than the detailed description above, and all changes or modifications derived from the meaning and scope of the appended claims and their equivalents should be construed as being included in the scope of the present invention.
Claims
1. A video signal decoding device, comprising: processor, Wherein, the processor is configured to: obtaining a first motion vector of a current block corresponding to a first reference picture and a second motion vector of the current block corresponding to a second reference picture, obtaining a first picture order count (POC) difference representing a POC difference between the first reference picture and a current picture, obtaining a second POC difference representing a POC difference between the second reference picture and the current picture, obtaining at least one of a first correction value of the first motion vector and a second correction value of the second motion vector as a first value based on a result of comparing the first POC difference and the second POC difference, obtaining a first corrected motion vector by correcting the first motion vector based on the first correction value, obtaining a second corrected motion vector by correcting the second motion vector based on the second correction value, and reconstructing the current block based on the first corrected motion vector and the second corrected motion vector, The first reference picture and the second reference picture are included in a first reference picture list and the second reference picture list, respectively. wherein the first reference picture list is used in a first higher layer region in which at most one motion vector is used for a particular sample and in a second higher layer region in which at most two motion vectors are used for the particular sample, and Wherein, the second reference picture list is not used in the first higher layer region.
2. The video signal decoding device according to claim 1, in, When one of the first correction value and the second correction value is obtained as the first value, The correction value obtained as the first value is obtained earlier than the correction value not obtained as the first value.
3. The video signal decoding device according to claim 2, in, when the absolute value of the first POC difference is greater than or equal to the absolute value of the second POC difference, obtaining the first correction value as the first value and obtaining the second correction value based on the first value, When the absolute value of the first POC difference is smaller than the absolute value of the second POC difference, the second correction value is obtained as the first value and the first correction value is obtained based on the first value.
4. The video signal decoding device according to claim 3, in, obtaining the first corrected motion vector by adding the first correction value to the first motion vector, Therein, the second corrected motion vector is obtained by adding the second correction value to the second motion vector.
5. The video signal decoding device according to claim 1, in, The value indicating the first reference picture list is 0 and the value indicating the second reference picture list is 1.
6. A video signal encoding device, comprising: processor, Wherein, the processor is configured to Obtaining a bit stream to be decoded by a decoder using a decoding method, the decoding method comprising: Obtaining a first motion vector of a current block corresponding to a first reference picture and a second motion vector of the current block corresponding to a second reference picture; obtaining a first picture order count (POC) difference representing a POC difference between the first reference picture and a current picture; Obtaining a second POC difference representing a POC difference between the second reference picture and the current picture; obtaining, based on a result of comparing the first POC difference and the second POC difference, at least one of a first correction value of the first motion vector and a second correction value of the second motion vector as a first value; obtaining a first corrected motion vector by correcting the first motion vector based on the first correction value; obtaining a second corrected motion vector by correcting the second motion vector based on the second correction value; and reconstructing the current block based on the first corrected motion vector and the second corrected motion vector, The first reference picture and the second reference picture are included in a first reference picture list and the second reference picture list, respectively. wherein the first reference picture list is used in a first higher layer region in which at most one motion vector is used for a particular sample and in a second higher layer region in which at most two motion vectors are used for the particular sample, and Wherein, the second reference picture list is not used in the first higher layer region.
7. The video signal encoding device according to claim 6, in, When one of the first correction value and the second correction value is obtained as the first value, The correction value obtained as the first value is obtained earlier than the correction value not obtained as the first value.
8. The video signal encoding device according to claim 7, in, when the absolute value of the first POC difference is greater than or equal to the absolute value of the second POC difference, obtaining the first correction value as the first value and obtaining the second correction value based on the first value, When the absolute value of the first POC difference is smaller than the absolute value of the second POC difference, the second correction value is obtained as the first value and the first correction value is obtained based on the first value.
9. The video signal encoding device according to claim 8, in, obtaining the first corrected motion vector by adding the first correction value to the first motion vector, wherein the second corrected motion vector is obtained by adding the second correction value to the second motion vector, and The second value is obtained based on the first value.
10. The video signal encoding device according to claim 6, in, The value indicating the first reference picture list is 0 and the value indicating the second reference picture list is 1.
11. A non-transitory computer-readable medium storing a program for obtaining a bit stream to be decoded by a decoder using a decoding method, the decoding method comprising: Obtaining a first motion vector of a current block corresponding to a first reference picture and a second motion vector of the current block corresponding to a second reference picture; Obtaining a first picture order count (POC) difference representing a POC difference between the first reference picture and the current picture; Obtaining a second POC difference representing a POC difference between the second reference picture and the current picture; obtaining, based on a result of comparing the first POC difference and the second POC difference, at least one of a first correction value of the first motion vector and a second correction value of the second motion vector as a first value; obtaining a first corrected motion vector by correcting the first motion vector based on the first correction value; obtaining a second corrected motion vector by correcting the second motion vector based on the second correction value; and reconstructing the current block based on the first corrected motion vector and the second corrected motion vector, The first reference picture and the second reference picture are included in a first reference picture list and the second reference picture list, respectively. wherein the first reference picture list is used in a first higher layer region in which at most one motion vector is used for a particular sample and in a second higher layer region in which at most two motion vectors are used for the particular sample, and Wherein, the second reference picture list is not used in the first higher layer region.
12. The non-transitory computer-readable medium storing the program according to claim 11, in, When one of the first correction value and the second correction value is obtained as the first value, The correction value obtained as the first value is obtained earlier than the correction value not obtained as the first value.
13. The non-transitory computer-readable medium storing the program according to claim 12, in, when the absolute value of the first POC difference is greater than or equal to the absolute value of the second POC difference, obtaining the first correction value as the first value and obtaining the second correction value based on the first value, When the absolute value of the first POC difference is smaller than the absolute value of the second POC difference, the second correction value is obtained as the first value and the first correction value is obtained based on the first value.
14. The non-transitory computer-readable medium storing the program according to claim 13, in, obtaining the first corrected motion vector by adding the first correction value to the first motion vector, Therein, the second corrected motion vector is obtained by adding the second correction value to the second motion vector.
15. The non-transitory computer readable medium storing the program according to claim 11, in, The value indicating the first reference picture list is 0 and the value indicating the second reference picture list is 1.
16. A video signal processing method, the method comprising: Obtaining a first motion vector of a current block corresponding to a first reference picture and a second motion vector of the current block corresponding to a second reference picture; obtaining a first picture order count (POC) difference representing a POC difference between the first reference picture and a current picture; Obtaining a second POC difference representing a POC difference between the second reference picture and the current picture; Based on a result of comparing the first POC difference and the second POC difference, obtaining at least one of a first correction value of the first motion vector and a second correction value of the second motion vector as a first value, wherein the specific value is a specific offset; obtaining a first corrected motion vector by correcting the first motion vector based on the first correction value; obtaining a second corrected motion vector by correcting the second motion vector based on the second correction value; and reconstructing the current block based on the first corrected motion vector and the second corrected motion vector, The first reference picture and the second reference picture are included in a first reference picture list and the second reference picture list, respectively. wherein the first reference picture list is used in a first higher layer region in which at most one motion vector is used for a particular sample and in a second higher layer region in which at most two motion vectors are used for the particular sample, and Wherein, the second reference picture list is not used in the first higher layer region.
