VIDEO ENCODING / DECODING METHOD, VIDEO ENCODER, VIDEO DECODER, VIDEO ENCODING APPARATUS, VIDEO DECODING APPARATUS, AND COMPUTER-READABLE STORAGE MEDIUM
By using the merge offset vector encoding method in video encoding, a merge candidate list is generated and the addition operation of motion vectors is guided, the problem of increasing data volume in high-resolution video services is solved, and the efficiency of video encoding and decoding is improved.
Patent Information
- Application Number
- JP2024042882
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2018-12-21
- Filing Date
- 2024-03-18
- Publication Date
- 2025-04-14
- Estimated Expiration
- 2039-11-08
AI Technical Summary
With the increase in display size, the amount of data of high-resolution video services has increased dramatically, and the performance of existing video encoding standards has reached its limit, making it difficult to meet the needs of higher quality video services.
The merge offset vector encoding method is adopted to generate a merge candidate list, identify the merge candidate block and guide the motion vector of the current block based on this. Under the merge offset vector encoding method, this method obtains a new motion vector by adding the motion vector of the current block and the motion vector of the merge candidate block, and decides whether to decode the index information based on whether the maximum number of merge candidates is a single.
The efficiency of video encoding and decoding is improved, especially in motion vector prediction, and the performance of video encoding is enhanced, and high-resolution video data can be processed more effectively.
Smart Images

Figure 0007661564000023 
Figure 0007661564000024 
Figure 0007661564000025
Abstract
Description
[Technical field]
[0001] The present invention relates to a video encoding / decoding method, a video encoder, a video decoder, a video encoding device, a video decoding device, and a computer-readable storage medium. [Background technology]
[0002] As display panels become larger and larger, higher quality video services are increasingly required. The biggest problem with high definition video services is the large increase in data volume, and in order to solve this problem, active research is being conducted to improve video compression rates. As a representative example, in 2009, MPEG (Motion Picture Experts Group) and VCEG (Video Coding Experts Group) under ITU-T (International Telecommunication Union-Telecommunication) formed JCT-VC (Joint Collaborative Team on Video Coding). Compared to H.264 / AVC, JCT-VC proposed HEVC (High Efficiency Video Coding), a video compression standard with approximately twice the compression performance, and the standard was approved on January 25, 2013. With the rapid development of high definition video services, HEVC's performance is increasingly showing its limits. Summary of the Invention
[0003] The invention is defined by the independent claims. Further embodiments are defined by the dependent claims.
[0004] A video decoding method according to the present invention includes the steps of: determining whether a merge offset vector encoding method is applied to a current block, generating a merge candidate list for the current block, identifying a merge candidate for the current block based on the merge candidate list, and deriving a motion vector for the current block based on the merge candidate. In this case, if the merge offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to a motion vector of the merge candidate, and if the maximum number of merge candidates that the merge candidate list can include is multiple, the merge candidate for the current block is selected based on index information decoded from a bitstream indicating any one of the merge candidates, and if the maximum number is 1, the merge candidate may be determined without decoding the index information.
[0005] A video encoding method according to the present invention includes the steps of: determining whether a merge offset vector encoding method is applied to a current block; generating a merge candidate list for the current block; identifying a merge candidate for the current block based on the merge candidate list; and deriving a motion vector for the current block based on the merge candidate. If the merge offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to a motion vector of the merge candidate. If the maximum number of merge candidates that the merge candidate list can include is multiple, index information indicating the merge candidate for the current block among the merge candidates is encoded, and if the maximum number is 1, encoding of the index information is omitted.
[0006] According to the present invention, a video decoder includes a processor and a memory, the memory being adapted to store a computer program, and the processor executes the computer program stored in the memory to determine whether a merge offset vector encoding method is applied to a current block, generate a merge candidate list for the current block, identify a merge candidate for the current block based on the merge candidate list, and derive a motion vector for the current block based on the merge candidate. If the merge offset vector encoding method is applied to the current block, a motion vector for the current block is derived by adding an offset vector to a motion vector of the merge candidate, and if the maximum number of merge candidates that the merge candidate list can include is multiple, the merge candidate for the current block is selected based on index information decoded from a bitstream indicating any one of the merge candidates, and if the maximum number is one, the merge candidate is determined without decoding the index information.
[0007] According to the present invention, there is provided a video encoder including a processor and a memory, the memory being adapted to store a computer program, the processor executing the computer program stored in the memory to determine whether a merge offset vector encoding method is applied to a current block, generate a merge candidate list for the current block, identify merge candidates for the current block based on the merge candidate list, and derive a motion vector for the current block based on the merge candidates. If the merge offset vector encoding method is applied to the current block, a motion vector for the current block is derived by adding an offset vector to a motion vector of the merge candidate, and if the maximum number of merge candidates that the merge candidate list can include is multiple, index information indicating the merge candidate for the current block among the merge candidates is encoded, and if the maximum number is one, encoding of the index information is omitted.
[0008] a motion vector for the current block based on the merge candidate list; and a motion vector for the current block based on the merge candidate. If the merge offset vector encoding method is applied to the current block, a motion vector for the current block is derived by adding an offset vector to a motion vector of the merge candidate. If the merge candidate list has a maximum number of merge candidates, the merge candidate for the current block is selected based on index information decoded from a bitstream indicating any one of the merge candidates. If the maximum number is 1, the merge candidate for the current block is determined without decoding the index information.
[0009] According to an embodiment of the present invention, there is provided a video encoding apparatus comprising: an inter prediction unit that determines whether a merge offset vector encoding method is applied to a current block; generates a merge candidate list for the current block; identifies merge candidates for the current block based on the merge candidate list; and derives a motion vector for the current block based on the merge candidates. If the merge offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to a motion vector of the merge candidate. If the maximum number of merge candidates that the merge candidate list can include is multiple, index information indicating the merge candidate for the current block among the merge candidates is encoded, and if the maximum number is 1, encoding of the index information is omitted.
[0010] A computer-readable storage medium according to the present invention is used for storing a computer program which, when executed by a processor, performs a video decoding method or a video encoding method. [Brief description of the drawings]
[0011] [Figure 1] FIG. 1 is a block diagram showing a video encoder (encoder) according to an embodiment of the present invention. [Diagram 2] FIG. 2 is a block diagram showing a video decoder (decoder) according to one embodiment of the present invention. [Diagram 3] FIG. 3 illustrates a basic coding tree unit according to one embodiment of the present invention. [Figure 4] FIG. 4 is a diagram showing various division forms of a coding block. [Diagram 5] FIG. 5 is a diagram showing a division pattern of a coding tree unit. [Figure 6] FIG. 6 is a diagram showing the format of a data basic unit. [Figure 7]FIG. 7 is a diagram showing an example in which a coding block is divided into a plurality of sub-blocks. [Figure 8] FIG. 8 is a diagram showing an example in which a coding block is divided into a plurality of sub-blocks. [Figure 9] FIG. 9 is a flowchart of an inter prediction method according to an embodiment of the present invention. [Figure 10] FIG. 10 is a diagram illustrating the nonlinear motion of an object. [Figure 11] FIG. 11 is a flowchart of an affine motion based inter prediction method according to an embodiment of the present invention. [Figure 12] FIG. 12 is a diagram illustrating affine seed vectors of each affine motion model. [Figure 13] FIG. 13 is a diagram illustrating affine vectors of sub-blocks in a four-parameter motion model. [Figure 14] FIG. 14 is a flowchart of a process for deriving motion information of a current block in merge mode. [Figure 15] FIG. 15 is a diagram illustrating candidate blocks used to derive merge candidates. [Figure 16] FIG. 16 is a diagram showing the position of the reference sample. [Figure 17] FIG. 17 is a diagram illustrating candidate blocks used to derive merge candidates. [Figure 18] FIG. 18 is a diagram showing an example in which the position of the reference sample is changed. [Figure 19] FIG. 19 is a diagram showing an example in which the position of the reference sample is changed. [Figure 20] FIG. 20 is a diagram showing a mode of updating the inter-region motion information table. [Figure 21] FIG. 21 is a diagram showing a mode of updating the inter region merge candidate table. [Figure 22] FIG. 22 is a diagram showing an example in which the indexes of already stored inter region merge candidates are updated. [Figure 23] FIG. 23 is a diagram showing the position of the representative sub-block. [Figure 24] FIG. 24 is a diagram showing an example in which an inter region motion information table is generated for each inter prediction mode. [Diagram 25] FIG. 25 is a diagram showing an example in which inter-region merging candidates included in the long-term motion information table are added to the merging candidate list. [Figure 26] FIG. 26 illustrates an example in which redundancy checking is performed on only a portion of the merging candidates. [Figure 27] FIG. 27 is a diagram showing an example in which a redundancy check with a specific merging candidate is omitted. [Figure 28] FIG. 28 is a diagram showing offset vectors based on the values of distance_idx indicating the magnitude of the offset vector and direction_idx indicating the direction of the offset vector. [Figure 29] FIG. 29 is a diagram showing offset vectors based on values of distance_idx indicating the magnitude of the offset vector and direction_idx indicating the direction of the offset vector. [Diagram 30] FIG. 30 is a diagram illustrating a manner in which a coding block is divided when a triangular division technique is applied. [Diagram 31] FIG. 31 is a diagram showing an example in which the offset vectors of the subunits are set to be different from each other. [Diagram 32] FIG. 32 is a diagram showing motion vector candidates that can be taken by refine merge candidates. [Diagram 33] FIG. 33 is a diagram showing the structure of a merge refinement offset list. [Diagram 34] FIG. 34 is a diagram showing offset vectors specified by merge offset candidates. [Diagram 35] FIG. 35 is a diagram showing offset vectors specified by merge offset candidates. [Diagram 36]FIG. 36 is a diagram illustrating candidate blocks used to derive motion vector prediction candidates. [Figure 37] FIG. 37 is a diagram showing motion vector candidates that can be set as refinement motion vector prediction candidates. [Figure 38] FIG. 38 is a diagram showing the structure of a predicted vector refinement offset list. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0012] Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0013] A video decoding method according to the present invention includes the steps of: determining whether a merge offset vector encoding method is applied to a current block, generating a merge candidate list for the current block, identifying a merge candidate for the current block based on the merge candidate list, and deriving a motion vector for the current block based on the merge candidate. In this case, if the merge offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to a motion vector of the merge candidate, and if the maximum number of merge candidates that the merge candidate list can include is multiple, the merge candidate for the current block is selected based on index information decoded from a bitstream indicating any one of the merge candidates, and if the maximum number is 1, the merge candidate may be determined without decoding the index information.
[0014] In one embodiment, the offset vector magnitude is determined based on first index information that identifies one of the candidate vector magnitudes.
[0015] In one embodiment, at least one of the maximum or minimum values of the vector magnitude candidates is set differently based on a value of a flag indicating the value of the vector magnitude candidate.
[0016] In one embodiment, the flag is signaled at the picture level.
[0017] In one embodiment, at least one of the maximum or minimum values of the vector magnitude candidates is set differently depending on the accuracy of the motion vector for the current block.
[0018] In one embodiment, the offset vector magnitude is obtained by applying a bit shift operation to a value indicated by a vector magnitude candidate identified by the first index information.
[0019] In one embodiment, the direction of the offset vector is determined based on second index information that identifies one of candidate vector directions.
[0020] A video encoding method according to the present invention includes the steps of: determining whether a merge offset vector encoding method is applied to a current block; generating a merge candidate list for the current block; identifying a merge candidate for the current block based on the merge candidate list; and deriving a motion vector for the current block based on the merge candidate. If the merge offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to a motion vector of the merge candidate. If the maximum number of merge candidates that the merge candidate list can include is multiple, index information indicating the merge candidate for the current block among the merge candidates is encoded, and if the maximum number is 1, encoding of the index information is omitted.
[0021] In one embodiment, the video encoding method further comprises encoding first index information for identifying a vector magnitude candidate indicative of a magnitude of the offset vector among a plurality of vector magnitude candidates.
[0022] In one embodiment, the video encoding method further includes a step of encoding a flag indicating a numerical value of the vector magnitude candidate, and at least one of a maximum value or a minimum value of the vector magnitude candidate is set to be different depending on the value of the flag.
[0023] In one embodiment, the flag is encoded at the picture level.
[0024] In one embodiment, at least one of the maximum or minimum values of the vector magnitude candidates is set differently depending on the accuracy of the motion vector for the current block.
[0025] In one embodiment, the vector magnitude candidate has a value derived by applying a bit shift operation to the magnitude of the offset vector.
[0026] In one embodiment, the video encoding method further comprises encoding second index information for identifying a vector direction candidate indicating a direction of the offset vector among a number of vector direction candidates.
[0027] According to the present invention, there is provided a video decoder including a processor and a memory, the memory being adapted to store a computer program, the processor executing the computer program stored in the memory to determine whether a merge offset vector encoding method is applied to a current block, generate a merge candidate list for the current block, identify a merge candidate for the current block based on the merge candidate list, and derive a motion vector for the current block based on the merge candidate. If the merge offset vector encoding method is applied to the current block, a motion vector for the current block is derived by adding an offset vector to a motion vector of the merge candidate, if the maximum number of merge candidates that the merge candidate list can include is multiple, the merge candidate for the current block is selected based on index information decoded from a bitstream indicating any one of the merge candidates, and if the maximum number is one, the merge candidate is determined without decoding the index information.
[0028] According to the present invention, there is provided a video encoder including a processor and a memory, the memory being adapted to store a computer program, the processor executing the computer program stored in the memory to determine whether a merge offset vector encoding method is applied to a current block, generate a merge candidate list for the current block, identify merge candidates for the current block based on the merge candidate list, and derive a motion vector for the current block based on the merge candidates. If the merge offset vector encoding method is applied to the current block, a motion vector for the current block is derived by adding an offset vector to a motion vector of the merge candidate, and if the maximum number of merge candidates that the merge candidate list can include is multiple, index information indicating the merge candidate for the current block among the merge candidates is encoded, and if the maximum number is one, encoding of the index information is omitted.
[0029] a motion vector for the current block based on the merge candidate list; and a motion vector for the current block based on the merge candidate. If the merge offset vector encoding method is applied to the current block, a motion vector for the current block is derived by adding an offset vector to a motion vector of the merge candidate. If the merge candidate list has a maximum number of merge candidates, the merge candidate for the current block is selected based on index information decoded from a bitstream indicating any one of the merge candidates. If the maximum number is 1, the merge candidate for the current block is determined without decoding the index information.
[0030] According to an embodiment of the present invention, there is provided a video encoding apparatus comprising: an inter prediction unit that determines whether a merge offset vector encoding method is applied to a current block; generates a merge candidate list for the current block; identifies merge candidates for the current block based on the merge candidate list; and derives a motion vector for the current block based on the merge candidates. If the merge offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to a motion vector of the merge candidate. If the maximum number of merge candidates that the merge candidate list can include is multiple, index information indicating the merge candidate for the current block among the merge candidates is encoded, and if the maximum number is 1, encoding of the index information is omitted.
[0031] A computer-readable storage medium according to the present invention is used for storing a computer program which, when executed by a processor, performs a video decoding method or a video encoding method.
[0032] The present invention further provides a method for refining a motion vector derived from a merging candidate based on an offset vector when encoding / decoding a video signal, and an apparatus for performing the method.
[0033] The present invention further provides a method for signaling an offset vector when encoding / decoding a video signal and an apparatus for implementing the method.
[0034] According to the present invention, the efficiency of inter prediction can be improved by refining the motion vectors of the merging candidates based on the offset vectors.
[0035] According to the present invention, the efficiency of inter prediction can be improved by adaptively determining the magnitude and direction of the offset vector.
[0036] Video encoding and decoding is performed in block units. For example, encoding / decoding processes such as transform, quantization, prediction, in-loop filtering, or restoration may be performed on a coding block, a transform block, or a prediction block.
[0037] Hereinafter, the block to be encoded / decoded is referred to as a “current block.” As an example, based on the current encoding / decoding process step, the current block may indicate a coding block, a transformation block, or a prediction block.
[0038] Furthermore, it can be understood that the term "unit" as used herein represents a basic unit for performing a particular encoding / decoding process, and the term "block" indicates a sample array of a given size. Unless otherwise stated, "block" and "unit" can be used interchangeably. As an example, in the embodiments described below, it can be understood that a coding block and a coding unit have the same meaning.
[0039] FIG. 1 is a block diagram showing a video encoder (encoder) according to an embodiment of the present invention.
[0040] Referring to FIG. 1, the video encoding device 100 may include a picture division unit 110, a prediction unit 120, 125, a transformation unit 130, a quantization unit 135, a realignment unit 160, an entropy coding unit 165, an inverse quantization unit 140, an inverse transformation unit 145, a filter unit 150 and a memory 155.
[0041] In order to show different characteristic functions of the video encoding device, each component shown in Fig. 1 is illustrated independently, but this does not mean that each component is composed of separate hardware or one software component unit. In other words, for the sake of convenience, each component is listed, and at least two of the components are combined to form one component, or one component can be divided into multiple components to perform functions, and embodiments in which these components are integrated and separated are also included in the scope of the present invention as long as they do not deviate from the essence of the present invention.
[0042] In addition, some components may not be essential components for performing the essential functions of the present invention, but may be optional components for merely improving performance. The present invention may include only components essential for achieving the essence of the present invention, excluding components used only to improve performance, and a structure including only necessary components, excluding optional components used only to improve performance, is also included in the scope of the present invention.
[0043] The picture division unit 110 may divide an input picture into at least one processing unit. At this time, the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The picture division unit 110 may divide one picture into a combination of a plurality of coding units, prediction units, and transform units, and may select one combination of a coding unit, a prediction unit, and a transform unit based on a predetermined criterion (e.g., a cost function) to encode the picture.
[0044] For example, one picture can be divided into multiple coding units. A recursive tree structure such as a quad tree structure can be used to divide a picture into coding units, and a coding unit that is divided into other coding units with one video or largest coding unit as a root can be divided with child nodes equal to the number of divided coding units. A coding unit that is not further divided according to a certain limit becomes a leaf node. In other words, assuming that only square division is possible for one coding unit, one coding unit can be divided into a maximum of four other coding units.
[0045] Hereinafter, in the embodiments of the present invention, a coding unit may be used to mean a unit that performs encoding, or may be used to mean a unit that performs decoding.
[0046] The prediction units may be divided within a coding unit into at least one shape, such as a square or rectangle, of the same size, or may be divided such that any one of the prediction units divided within a coding unit has a different shape and / or size from the other prediction units.
[0047] When generating a prediction unit for performing intra prediction based on a coding unit, if there is no minimum coding unit, intra prediction can be performed without dividing into a plurality of N×N prediction units.
[0048] The prediction units 120 and 125 may include an inter prediction unit 120 for performing inter prediction and an intra prediction unit 125 for performing intra prediction. It is determined whether to perform inter prediction or intra prediction for a prediction unit, and specific information (e.g., intra prediction mode, motion vector, reference picture, etc.) may be determined according to each prediction method. At this time, a processing unit in which prediction is performed and a processing unit in which a prediction method and specific contents are determined may be different. For example, a prediction method and a prediction mode may be determined in a prediction unit, and prediction may be performed in a transformation unit. A residual value (residual block) between the generated prediction block and an original block may be input to the transformation unit 130. In addition, prediction mode information, motion vector information, etc. used for prediction may be encoded together with the residual value by the entropy coding unit 165 and transmitted to a decoder. When a specific encoding mode is used, the prediction units 120 and 125 may not generate a prediction block, but may directly encode the original block and transmit it to a decoder.
[0049] The inter prediction unit 120 may predict a prediction unit based on information of at least one picture preceding or following the current picture, and may also predict a prediction unit based on information of an encoded sub-region in the current picture. The inter prediction unit 120 may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.
[0050] The reference picture interpolator receives reference picture information from the memory 155 and can generate pixel information of less than integer pixels in the reference picture. In the case of luminance pixels, a DCT-based 8-tab interpolation filter with a variable filter coefficient can be used to generate pixel information of less than integer pixels in 1 / 4 pixel units. In the case of chrominance signals, a DCT-based 4-tab interpolation filter with a variable filter coefficient can be used to generate pixel information of less than integer pixels in 1 / 8 pixel units.
[0051] The motion prediction unit may perform motion prediction based on the reference picture interpolated by the reference picture interpolation unit. As a method of calculating a motion vector, various methods such as a full search-based block matching algorithm (FBMA), a three step search (TSS), a new three-step search algorithm (NTS), etc. may be used. The motion vector may have a motion vector value in units of 1 / 2 or 1 / 4 pixels based on the interpolated pixel. The motion prediction unit may predict a current prediction unit by changing a motion prediction method. As a motion prediction method, various methods such as a skip method, a merge method, an advanced motion vector prediction method (AMVP), an intra block copy method, etc. may be used.
[0052] The intra prediction unit 125 may generate a prediction unit based on reference pixel information around a current block, which is pixel information of a current picture. When a peripheral block of a current prediction unit is a block that has undergone inter prediction and a reference pixel is a pixel that has undergone inter prediction, the reference pixel included in the block that has undergone inter prediction may be replaced with reference pixel information of a peripheral block that has undergone intra prediction. In other words, when a reference pixel is not available, the unavailable reference pixel information may be replaced with at least one of the available reference pixels.
[0053] In intra prediction, prediction modes include a directional prediction mode that uses reference pixel information according to a prediction direction, and a non-directional mode that does not use directional information when performing prediction. The mode for predicting luma information and the mode for predicting chroma information may be different, and intra prediction mode information used to predict luma information or predicted luma signal information may be utilized to predict chroma information.
[0054] When performing intra prediction, if the size of the prediction unit and the size of the transform unit are the same, intra prediction can be performed on the prediction unit based on the pixel on the left side, the pixel on the top left, and the pixel on the top edge. However, when performing intra prediction, if the size of the prediction unit and the size of the transform unit are different, intra prediction can be performed using reference pixels based on the transform unit. Also, intra prediction using N×N partitioning can be used only for the smallest coding unit.
[0055] The intra prediction method may generate a prediction block after applying an AIS (Adaptive Intra Smoothing) filter to reference pixels according to a prediction mode. The type of AIS filter applied to the reference pixels may vary. To perform the intra prediction method, the intra prediction mode of the current prediction unit may be predicted from the intra prediction mode of a prediction unit present in the vicinity of the current prediction unit. When predicting the prediction mode of the current prediction unit using mode information predicted from the surrounding prediction unit, if the intra prediction modes of the current prediction unit and the surrounding prediction unit are the same, information that the prediction modes of the current prediction unit and the surrounding prediction unit are the same may be transmitted using predetermined flag information, and if the prediction modes of the current prediction unit and the surrounding prediction unit are different, entropy coding may be performed to encode prediction mode information of the current block.
[0056] In addition, a residual block including residual value information, which is a difference value between a prediction unit obtained by performing prediction based on the prediction unit generated by the prediction units 120 and 125 and an original block of the prediction unit, may be generated. The generated residual block may be input to the conversion unit 130.
[0057] The transform unit 130 may use a transform method such as DCT (Discrete Cosine Transform) or DST (Discrete Sine Transform) to transform the residual block including residual value information between the original block and the prediction unit generated by the prediction unit 120, 125. Here, the DCT transform core includes at least one of DCT2 or DCT8, and the DST transform core includes DST7. Whether to apply DCT or DST to transform the residual block may be determined based on intra-prediction mode information of the prediction unit used to generate the residual block. The transform of the residual block may also be skipped. A flag indicating whether to skip the transform of the residual block may be encoded. The transform skip may be allowed for the residual block, the luma component, or the chroma component under the 4:4:4 format whose magnitude is equal to or less than a threshold.
[0058] The quantization unit 135 may quantize the values transformed into the frequency domain by the transformation unit 130. The quantization coefficient may vary depending on the importance of the block or video. The values calculated by the quantization unit 135 may be provided to the inverse quantization unit 140 and the reordering unit 160.
[0059] The reordering unit 160 may perform reordering of coefficient values for the quantized residual values.
[0060] The reordering unit 160 may convert two-dimensional block configuration coefficients into one-dimensional vector form by a coefficient scanning method. For example, the reordering unit 160 may convert into one-dimensional vector form by scanning from DC coefficients to coefficients in a high frequency region using a zig-zag scan method. Depending on the size of the transform unit and the intra prediction mode, a vertical scan that scans two-dimensional block configuration coefficients in a column direction and a horizontal scan that scans two-dimensional block configuration coefficients in a row direction may be used instead of the zig-zag scan. That is, depending on the size of the transform unit and the intra prediction mode, it may be determined which scan method to use among the zig-zag scan, the vertical scan, and the horizontal scan.
[0061] The entropy coding unit 165 may perform entropy coding based on the value calculated by the reordering unit 160. The entropy coding may use various encoding methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC).
[0062] The entropy coding unit 165 can encode various information such as residual value coefficient information of the coding unit, block type information, prediction mode information, division unit information, prediction unit information, transmission unit information, motion vector information, reference frame information, block interpolation information, filtering information, etc. from the realignment unit 160 and the prediction units 120, 125.
[0063] The entropy coding unit 165 may entropy encode the coefficient values of the coding units input from the reordering unit 160 .
[0064] The inverse quantization unit 140 inversely quantizes the values quantized by the quantization unit 135, and the inverse transformation unit 145 inversely transforms the values transformed by the transformation unit 130. Residual values generated by the inverse quantization unit 140 and the inverse transformation unit 145 can be combined with prediction units predicted by a motion estimation unit, a motion compensation unit, and an intra prediction unit included in the prediction units 120 and 125 to generate a reconstructed block.
[0065] The filter unit 150 may include at least one of a deblocking filter, an offset correction unit, and an ALF (Adaptive Loop Filter).
[0066] The deblocking filter can remove block distortion generated by boundaries between blocks in a restored picture. To determine whether to perform deblocking, it can be determined whether to apply the deblocking filter to the current block based on the pixels contained in a number of columns or rows contained in the block. When applying the deblocking filter to the block, a strong filter or a weak filter can be applied according to the required deblocking filtering strength. In addition, when applying the deblocking filter, horizontal filtering and vertical filtering can be processed in parallel when performing vertical filtering and horizontal filtering.
[0067] The offset correction unit can correct the offset between the deblocked video and the original video in pixel units. In order to perform offset correction for a specific picture, a method of dividing pixels included in the video into a certain number of regions, determining a region to perform offset, and applying an offset to the corresponding region, or a method of applying an offset by considering edge information of each pixel, can be used.
[0068] ALF (Adaptive Loop Filtering) can be performed based on a value obtained by comparing the filtered restored video with the original video. After dividing the pixels included in the video into predetermined groups, a filter to be applied to the corresponding group is determined, and filtering can be performed differentially for each group. A luminance signal, which is information related to whether or not to apply ALF, can be transmitted for each coding unit (CU), and the shape and filter coefficient of the ALF filter applied according to each block can be different. In addition, the same type (fixed type) of ALF filter can be applied regardless of the characteristics of the block to which it is applied.
[0069] The memory 155 may store the reconstructed block or picture calculated through the filter unit 150, and the stored reconstructed block or picture may be provided to the prediction units 120 and 125 when performing inter prediction.
[0070] FIG. 2 is a block diagram showing a video decoder (decoder) according to one embodiment of the present invention.
[0071] Referring to FIG. 2, the video decoder 200 may include an entropy decoding unit 210, a reordering unit 215, an inverse quantization unit 220, an inverse transform unit 225, prediction units 230 and 235, a filter unit 240, and a memory 245.
[0072] When a video bitstream is input from a video decoder, the input bitstream can be decoded in the reverse order to that of the video encoder.
[0073] The entropy decoding unit 210 may perform entropy decoding in a procedure that is the reverse of the procedure of performing entropy coding in the entropy coding unit of the video encoder. For example, various methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC) may be applied in accordance with the method performed in the video encoder.
[0074] The entropy decoding unit 210 can decode information regarding intra-prediction and inter-prediction performed in the encoder.
[0075] The reordering unit 215 may perform reordering on the bitstream entropy decoded from the entropy decoding unit 210 based on a reordering method performed in the encoding unit. The reordering unit 215 may restore and reorder coefficients expressed in the form of one-dimensional vectors into coefficients in the form of two-dimensional blocks. The reordering unit 215 may receive information related to coefficient scanning performed in the encoding unit and perform reordering using a reverse scanning method based on the scanning order performed in the corresponding encoding unit.
[0076] The inverse quantization unit 220 may perform inverse quantization based on the quantization parameter provided by the encoder and the coefficient values of the reordered blocks.
[0077] The inverse transform unit 225 may perform an inverse transform of the transform performed by the transform unit, i.e., DCT or DST, on the quantization result performed by the video encoder, i.e., perform an inverse DCT or inverse DST. Here, the DCT transform core may include at least one of DCT2 or DCT8, and the DST transform core may include DST7. Or, if the transform is skipped in the video encoder, the inverse transform unit 225 may not perform the inverse transform. The inverse transform may be performed based on a transmission unit determined in the video encoder. The inverse transform unit 225 of the video decoder may selectively perform a transform technique (e.g., DCT or DST) based on a plurality of pieces of information such as a prediction method, a size of a current block, and a prediction direction.
[0078] The prediction units 230 and 235 may generate a prediction block based on information related to the generation of the prediction block provided from the entropy decoding unit 210 and previously decoded block or picture information provided from the memory 245.
[0079] As described above, in the same manner as the operation of a video encoder, when performing intra prediction, if the size of the prediction unit and the size of the transform unit are the same, intra prediction can be performed on the prediction unit based on the pixel on the left side, the pixel on the top left, and the pixel on the top edge. However, when performing intra prediction, if the size of the prediction unit and the size of the transform unit are different, intra prediction can be performed using reference pixels based on the transform unit. Also, intra prediction using N×N partitioning can be used only for the minimum coding unit.
[0080] The prediction unit 230, 235 may include a prediction unit discrimination unit, an inter prediction unit, and an intra prediction unit. The prediction unit discrimination unit receives various information such as prediction unit information input from the entropy decoding unit 210, prediction mode information of the intra prediction method, and information on motion prediction of the inter prediction method, and may classify prediction units in a current coding unit and determine whether the prediction unit performs inter prediction or intra prediction. The inter prediction unit 230 may perform inter prediction on the current prediction unit based on information included in at least one picture of a previous picture or a subsequent picture of the current picture including the current prediction unit, using information necessary for inter prediction of the current prediction unit provided by the video encoder. Alternatively, the inter prediction may be performed based on information of some areas previously restored in the current picture including the current prediction unit.
[0081] To perform inter prediction, it is possible to determine, based on a coding unit, whether the motion prediction method of the prediction unit included in the corresponding coding unit is skip mode, merge mode, motion vector prediction mode (AMVP mode), or intra block copy mode.
[0082] The intra prediction unit 235 may generate a prediction block based on pixel information in the current picture. If the prediction unit is a prediction unit that has performed intra prediction, the intra prediction may be performed based on intra prediction mode information of the prediction unit provided from the video encoder. The intra prediction unit 235 may include an adaptive intra smoothing (AIS) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter is a part that performs filtering on reference pixels of a current block, and may determine whether to apply a filter based on a prediction mode of a current prediction unit and apply the AIS filter. AIS filtering may be performed on reference pixels of a current block using the prediction mode and AIS filter information of a prediction unit provided by a video encoder. If the prediction mode of a current block is a mode that does not perform AIS filtering, the AIS filter may not be applied.
[0083] If the prediction mode of the prediction unit is a prediction unit that performs intra prediction based on pixel values obtained by interpolating reference pixels, the reference pixel interpolation unit may generate reference pixels of a pixel unit with a value less than an integer by interpolating the reference pixels. If the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating reference pixels, the reference pixels may not be interpolated. If the prediction mode of the current block is a DC mode, the DC filter may generate a prediction block by filtering.
[0084] The reconstructed block or picture may be provided to the filter unit 240. The filter unit 240 may include a deblocking filter, an offset correction unit, and an ALF.
[0085] The video encoder may receive information regarding whether a deblocking filter has been applied to a corresponding block or picture, and, if a deblocking filter has been applied, information regarding whether a strong or weak filter has been applied. The deblocking filter of the video decoder may receive information related to the deblocking filter provided by the video encoder, and the video encoder may perform deblocking filtering on the corresponding block.
[0086] The offset compensation unit may perform offset compensation on the restored video based on the type of offset compensation applied to the video during encoding, offset value information, and the like.
[0087] The ALF may be applied to a coding unit based on information provided by an encoder as to whether to apply the ALF, ALF coefficient information, etc. Such ALF information may be provided by being included in a specific parameter set.
[0088] The memory 245 may store the reconstructed pictures or blocks for use as reference pictures or blocks, and may provide the reconstructed pictures to an output.
[0089] FIG. 3 illustrates a basic coding tree unit according to one embodiment of the present invention.
[0090] A coding block of a maximum size can be defined as a coding tree block. One picture is divided into a number of coding tree units (CTUs). A coding tree unit is a coding unit of a maximum size and can also be called an LCU (Largest Coding Unit). Figure 3 shows an example in which one picture is divided into a number of coding tree units.
[0091] The size of the coding tree unit may be defined at the picture level or at the sequence level. For this purpose, information indicating the size of the coding tree unit may be signaled by a picture parameter set or a sequence parameter set.
[0092] For example, the size of the coding tree unit of all pictures in the sequence may be set to 128×128. Alternatively, the size of the coding tree unit may be determined to be either 128×128 or 256×256 at the picture level. For example, the size of the coding tree unit of the first picture may be set to 128×128, and the size of the coding tree unit of the second picture may be set to 256×256.
[0093] A coding tree unit may be divided to generate coding blocks. The coding block indicates a basic unit for performing encoding / decoding. For example, prediction or transformation may be performed for each coding block, or a predictive encoding mode may be determined for each coding block. Here, the predictive encoding mode indicates a method of generating a predictive video. For example, the predictive encoding mode may include intra prediction, inter prediction, current picture referencing (CPR, or intra block copy, IBC), or combined prediction. For a coding block, a predictive block of the coding block may be generated using at least one predictive encoding mode of intra prediction, inter prediction, current picture referencing, or combined prediction.
[0094] Information indicating the predictive encoding mode of the current block may be signaled via the bitstream. As an example, the information may be a 1-bit flag indicating whether the predictive encoding mode is an intra mode or an inter mode. Only if the predictive encoding mode of the current block is determined as an inter mode, the current picture reference or hybrid prediction may be used.
[0095] The current picture reference is for setting the current picture as a reference picture and obtaining a prediction block of the current block from an area in the current picture where encoding / decoding has already been completed. Here, the current picture means a picture including the current block. Information indicating whether the current picture reference is applied to the current block may be signaled via a bitstream. As an example, the information may be a 1-bit flag. If the flag is true, the predictive encoding of the current block may be determined as the current picture reference, and if the flag is false, the prediction mode of the current block may be determined as inter prediction.
[0096] Alternatively, the prediction encoding mode of the current block may be determined based on a reference picture index. For example, if the reference picture index points to the current picture, the prediction encoding mode of the current block may be determined as a current picture reference. If the reference picture index points to a picture other than the current picture, the prediction encoding mode of the current block may be determined as inter prediction. That is, the current picture reference is a prediction method using information on an area in the current picture where encoding / decoding has been completed, and the inter prediction is a prediction method using information on another picture where encoding / decoding has been completed.
[0097] Composite prediction refers to an encoding mode that combines both or more of intra prediction, inter prediction, and current picture reference. As an example, when composite prediction is applied, a first prediction block may be generated based on any one of intra prediction, inter prediction, and current picture reference, and a second prediction block may be generated based on the other one. When the first prediction block and the second prediction block are generated, a final prediction block may be generated through an average operation or a weighted sum operation of the first prediction block and the second prediction block. Information indicating whether composite prediction is applied may be signaled via a bitstream. The information may be a 1-bit flag.
[0098] FIG. 4 is a diagram showing various division forms of a coding block.
[0099] A coding block may be divided into multiple coding blocks based on a quad tree partition, a binary tree partition, or a triple tree partition. The divided coding block may also be divided into multiple coding blocks again based on a quad tree partition, a binary tree partition, or a triple tree partition.
[0100] Quadtree partitioning refers to a partitioning technique that divides the current block into four blocks. As a result of the quadtree partitioning, the current block can be partitioned into four square partitions (see “SPLIT_QT” in (a) of Figure 4).
[0101] Binary tree split refers to a splitting technique for splitting the current block into two blocks. Splitting the current block into two blocks along the vertical direction (i.e., using a vertical line across the current block) can be referred to as a vertical binary tree split, and splitting the current block into two blocks along the horizontal direction (i.e., using a horizontal line across the current block) can be referred to as a horizontal binary tree split. As a result of the binary tree split, the current block can be split into two non-square partitions. (b) "SPLIT_BT_VER" in FIG. 4 shows the result of the vertical binary tree split, and (c) "SPLIT_BT_HOR" in FIG. 4 shows the result of the horizontal binary tree split.
[0102] Triple tree partitioning refers to a partitioning technique for partitioning a current block into three blocks. Partitioning the current block into three blocks along the vertical direction (i.e., using two vertical lines crossing the current block) can be referred to as vertical triple tree partitioning, and partitioning the current block into three blocks along the horizontal direction (i.e., using two horizontal lines crossing the current block) can be referred to as horizontal triple tree partitioning. As a result of triple tree partitioning, the current block can be partitioned into three non-square partitions. In this case, the width / height of the partition located in the center of the current block can be twice the width / height of the other partitions. (d) "SPLIT_TT_VER" in FIG. 4 illustrates a triple tree partitioning result in the vertical direction, and (e) "SPLIT_TT_HOR" in FIG. 4 illustrates a triple tree partitioning result in the horizontal direction.
[0103] The number of times a coding tree unit is divided can be defined as a partitioning depth. The maximum partitioning depth of a coding tree unit can be determined at a sequence or picture level. Thus, the maximum partitioning depth of a coding tree unit may differ for each sequence or picture.
[0104] Alternatively, the maximum partitioning depth for each partitioning technique can be determined individually. As an example, the maximum partitioning depth at which a quad-tree partition is permitted may be different from the maximum partitioning depth at which a binary tree partition and / or a triple-tree partition is permitted.
[0105] The encoder may signal information indicating at least one of a partition type or a partition depth of the current block via the bitstream, and the decoder may determine the partition type and partition depth of the coding tree unit based on said information parsed from the bitstream.
[0106] FIG. 5 is a diagram showing a division pattern of a coding tree unit.
[0107] Partitioning a coding block using a partitioning technique such as quad tree partitioning, binary tree partitioning, and / or triple tree partitioning may be referred to as multi-tree partitioning.
[0108] A coding block generated by applying multi-tree partitioning to a coding block may be referred to as a sub-coding block. If the partition depth of a coding block is k, the partition depth of the sub-coding block is set to k+1.
[0109] Conversely, for a coding block with a division depth of k+1, a code block with a division depth of k can be called a superior coding block.
[0110] The partition type of the current coding block may be determined based on at least one of a partition type of an upper coding block or a partition type of a neighboring coding block. Here, the neighboring coding block may be adjacent to the current coding block and may include at least one of a top neighboring block, a left neighboring block, or a neighboring block adjacent to the upper left corner of the current coding block. Here, the partition type may include at least one of whether to perform quad tree partitioning, whether to perform binary tree partitioning, a binary tree partitioning direction, whether to perform triple tree partitioning, or a triple tree partitioning direction.
[0111] In order to determine the partitioning form of a coding block, information indicating whether the coding block is partitioned can be signaled via a bitstream. The information is a 1-bit flag "split_cu_flag", which indicates that the coding block is partitioned by a multi-tree partitioning technique if the flag is true.
[0112] If split_cu_flag is true, information indicating whether the coding block is quad-tree split may be signaled via the bitstream. The information is a 1-bit flag split_qt_flag, and if the flag is true, the coding block may be split into four blocks.
[0113] As an example, in the example shown in FIG 5, it is shown that four coding blocks having a division depth of 1 are generated as a result of quad-tree division of a coding tree unit. Also, it is shown that quad-tree division is again applied to a first coding block and a fourth coding block among the four coding blocks generated as a result of the quad-tree division. As a result, four coding blocks having a division depth of 2 can be generated.
[0114] In addition, by applying quad tree partitioning again to the coding block with a partition depth of 2, a coding block with a partition depth of 3 can be generated.
[0115] If quad tree partitioning is not applied to a coding block, it may be determined whether to perform binary tree partitioning or triple tree partitioning on the coding block, taking into account at least one of the following: the size of the coding block, whether the coding block is located on a picture boundary, the maximum partition depth, or the partition form of an adjacent block. If it is determined that binary tree partitioning or triple tree partitioning is performed on the coding block, information indicating a partitioning direction may be signaled via a bitstream. The information may be a 1-bit flag mtt_split_cu_vertical_flag. It may be determined whether the partitioning direction is vertical or horizontal based on the flag. In addition, information indicating whether binary tree partitioning or triple tree partitioning is applied to the coding block may be signaled via a bitstream. The information may be a 1-bit flag mtt_split_cu_binary_flag. It may be determined whether binary tree partitioning or triple tree partitioning is applied to the coding block based on the flag.
[0116] As an example, in the example shown in Figure 5, vertical binary tree partitioning is applied to a coding block with a partitioning depth of 1, and in the coding block generated as a result of the partitioning, vertical triple tree partitioning is applied to the left coding block and vertical binary tree partitioning is applied to the right coding block.
[0117] In a device for encoding or decoding video, a problem occurs where an area larger than a threshold of hardware performance is difficult to process. For example, when a maximum of 4096 samples can be processed simultaneously due to the performance of the hardware, a problem occurs where a data unit of 64x64 size needs to be accessed and processed in duplicate in an area having more than 4096 samples, and a problem occurs where data cannot be processed simultaneously. Thus, a basic unit of data processing can be defined as a pipeline-based data basic unit (VPDU, hereinafter referred to as data basic unit).
[0118] The elementary units of data can be classified into square, non-square or rectangular types.
[0119] FIG. 6 is a diagram showing the format of a basic unit of data.
[0120] The data elementary unit may include a number of samples equal to or smaller than the maximum number of samples that can be processed simultaneously. As an example, a square block of 64x64 size may be set in the data elementary unit as shown in FIG. 6(a). Or, a non-square block may be set in the data elementary unit. As an example, a block of 32x128 size or a block of 64x32 size may be set in the data elementary unit as shown in FIG. 6(b) or FIG. 6(c).
[0121] Although not shown, triangular, L-shaped or polygonal data elementary units may also be defined.
[0122] Information for determining the data elementary unit may be signaled via the bit stream. The information may be for determining at least one of a size or a shape of the data elementary unit. Based on the information, it may be determined whether to allow a non-square data elementary unit or whether to allow a non-rectangular data elementary unit.
[0123] Alternatively, the encoder and decoder may predefine at least one of the size or shape of the elementary unit of data.
[0124] Whether or not to permit a division form of a coding block may be determined in consideration of the size of a data elementary unit. For example, if a coding block generated as a result of dividing a coding block is larger than a data elementary unit, the division may not be permitted. Or, if a non-square coding block generated as a result of dividing a coding block is larger than a data elementary unit, the division may not be permitted. For example, if a width or height of a coding block is larger than a threshold, or if the number of samples included in a coding block is larger than a threshold, binary tree division or triple tree division may not be permitted. Thus, encoding of information related to binary tree division or triple tree division may be omitted.
[0125] Alternatively, it may be set to always split a coding block larger than a data basic unit. Alternatively, it may be set to always perform binary tree splitting or triple tree splitting for a coding block larger than a data basic unit. Thus, for a coding block larger than a data basic unit, even if the flag split_flag indicating whether or not to split the coding block is not encoded, the flag value may be induced to 1.
[0126] As another example, a coding block larger than a data basic unit may be divided into a plurality of sub-blocks. Here, the sub-block may be set to a prediction unit, which is a basic unit for prediction, or a transform unit, which is a basic unit for transformation and / or quantization. In this case, dividing a coding block into a plurality of prediction units may be defined as VPDU prediction unit partitioning, and dividing a coding block into a plurality of transform units may be defined as VPDU transform unit partitioning.
[0127] At least one of VPDU prediction unit partitioning or VPDU transformation unit partitioning may be applied to the coding block. The partition type of the coding block by applying the VPDU prediction unit partitioning may be set to be the same as the partition type of the coding block by applying the VPDU transformation unit partitioning.
[0128] When only VPDU prediction unit partitioning is applied to a coding block, prediction is performed for each subblock, but transformation and / or quantization may be performed for the coding block. In this case, a prediction mode such as a predictive encoding mode, an intra prediction mode, or an inter prediction mode may be determined for the coding block.
[0129] When only VPDU transform unit partitioning is applied to a coding block, prediction is performed for sub-blocks, but transformation and / or quantization may be performed on a sub-block basis.
[0130] 7 and 8 are diagrams illustrating an example in which a coding block is divided into a plurality of sub-blocks.
[0131] FIG. 7 is a diagram showing a division state when only square data basic units are permitted, and FIG. 8 is a diagram showing a division state when square data basic units and non-square data basic units are permitted.
[0132] Assuming that only square data elementary units are allowed, in (a) and (b) of Figure 7, CU0 and CU3 are defined by two different VPDUs, and CU1 is defined by four different VPDUs, which allows us to split CU0 and CU3 into two sub-blocks, and CU1 into four sub-blocks.
[0133] Assuming that square and non-square data basic units are allowed, in (a) and (b) of Figure 8, CU0 and CU3 can be defined by one VPDU, while CU1 can be defined using two different VPDUs. This means that CU0 and CU3 are not divided into sub-blocks, but CU1 can be divided into two sub-blocks.
[0134] In this case, CU1 can be divided into square sub-blocks or non-square sub-blocks. For example, CU1 can be divided into two square sub-blocks based on a horizontal line dividing CU1 into upper and lower parts, or CU1 can be divided into two non-square sub-blocks based on a vertical line dividing CU1 into left and right parts.
[0135] If there are multiple partition type candidates applicable to a coding block, information indicating any one of the multiple partition type candidates may be signaled via the bitstream. As an example, the information may indicate whether the coding block is partitioned into square sub-blocks or whether the coding block is partitioned into non-square sub-blocks.
[0136] Alternatively, partitioning a coding block into square sub-blocks can be set to have a higher priority than partitioning a coding block into non-square sub-blocks, e.g., partitioning a coding block into non-square sub-blocks can be allowed when the coding block cannot be partitioned into square sub-blocks.
[0137] Alternatively, the division form of the coding block may be determined based on the division form of the coding block that is the parent node. For example, if the coding block that is the parent node is divided based on a triple tree, the coding block may be set to be divided into square sub-blocks. On the other hand, if the coding block that is the parent node is divided based on a binary tree or a triple tree, the coding block may be set to be divided into non-square sub-blocks.
[0138] Inter prediction is a predictive encoding mode that predicts a current block using information of a previous picture. As an example, a block at the same position as the current block in the previous picture (hereinafter, collocated block) can be set as a prediction block of the current block. Hereinafter, a prediction block generated based on a block at the same position as the current block is referred to as a collocated prediction block.
[0139] Meanwhile, if an object in a previous picture moves to another position in a current picture, the current block can be effectively predicted using the motion of the object. For example, if the moving direction and size of an object can be known by comparing a previous picture with a current picture, a predicted block (or predicted video) of the current block can be generated taking into account the motion information of the object. Hereinafter, the predicted block generated using the motion information can be referred to as a motion predicted block.
[0140] A residual block can be generated by subtracting the prediction block from the current block, where in the presence of object motion, the energy of the residual block can be reduced by using a motion prediction block instead of a collocated prediction block, thus improving the compression performance of the residual block.
[0141] As described above, generating a prediction block using motion information may be called motion compensated prediction. In most inter predictions, a prediction block may be generated based on motion compensated prediction.
[0142] The motion information may include at least one of a motion vector, a reference picture index, a prediction direction, or a bidirectional weight index. The motion vector indicates the moving direction and size of an object. The reference picture index identifies a reference picture of the current block among reference pictures included in a reference picture list. The prediction direction refers to one of unidirectional L0 prediction, unidirectional L1 prediction, or bidirectional prediction (L0 prediction and L1 prediction). Depending on the prediction direction of the current block, at least one of the motion information in the L0 direction or the motion information in the L1 direction can be used. The bidirectional weight index identifies the weight applied to the L0 prediction block and the weight applied to the L1 prediction block.
[0143] FIG. 9 is a flowchart of an inter prediction method according to an embodiment of the present invention.
[0144] Referring to FIG. 9, the inter prediction method includes a step of determining an inter prediction mode of a current block (S901), a step of acquiring motion information of the current block according to the determined inter prediction mode (S902), and a step of performing motion compensation prediction of the current block based on the acquired motion information (S903).
[0145] Here, the inter prediction mode indicates various methods for determining motion information of the current block, and may include an inter prediction mode using translation motion information and an inter prediction mode using affine motion information. As an example, the inter prediction mode using translation motion information may include a merge mode and a motion vector prediction mode, and the inter prediction mode using affine motion information may include an affine merge mode and an affine motion vector prediction mode. The motion information of the current block may be determined based on information analyzed from a neighboring block or a bitstream adjacent to the current block according to the inter prediction mode.
[0146] The inter prediction method using affine motion information will now be described in detail.
[0147] FIG. 10 is a diagram illustrating the nonlinear motion of an object.
[0148] Nonlinear object motion may occur in a video. For example, as shown in FIG. 10, nonlinear object motion may occur due to camera zoom-in, zoom-out, rotation, or affine transformation. When nonlinear object motion occurs, the object motion cannot be effectively represented by a translational motion vector. Therefore, in a portion where nonlinear object motion occurs, affine motion may be used instead of translational motion to improve encoding efficiency.
[0149] FIG. 11 is a flowchart of an affine motion based inter prediction method according to an embodiment of the present invention.
[0150] Whether the affine motion-based inter prediction technique is applied to the current block may be determined based on information analyzed from the bitstream. Specifically, whether the affine motion-based inter prediction technique is applied to the current block may be determined based on at least one of a flag indicating whether the affine merge mode is applied to the current block or a flag indicating whether the affine motion vector prediction mode is applied to the current block.
[0151] When an affine motion-based inter prediction technique is applied to a current block, an affine motion model of the current block may be determined (S1101). The affine motion model may be determined as at least one of a six-parameter affine motion model or a four-parameter affine motion model. The six-parameter affine motion model represents affine motion using six parameters, and the four-parameter affine motion model represents affine motion using four parameters.
[0152] Equation (1) uses six parameters to express affine motion, which indicates the translational movement of a given region determined by an affine seed vector.
[0153] [Formula 1]
[0154]
number
[0155] When affine motion is expressed using six parameters, complex motion can be expressed, but the number of bits required for encoding each parameter increases, which reduces encoding efficiency. Therefore, affine motion can also be expressed using four parameters. Equation 2 expresses affine motion using four parameters.
[0156] [Formula 2]
[0157]
number
[0158] Information for determining an affine motion model of a current block may be encoded and signaled via a bitstream. As an example, the information may be a 1-bit flag "affine_type_flag". A value of 0 of the flag indicates that a 4-parameter affine motion model is applied, and a value of 1 of the flag indicates that a 6-parameter affine motion model is applied. The flag may be encoded in units of a slice, a tile, or a block (e.g., a coding block or a coding tree unit). If a flag is signaled at a slice level, the affine motion model determined at the slice level may be applied to all blocks belonging to the slice.
[0159] Alternatively, an affine motion model of the current block may be determined based on an affine inter prediction mode of the current block. For example, when an affine merge mode is applied, an affine motion model of the current block may be determined as a four-parameter motion model. On the other hand, when an affine motion vector prediction mode is applied, information for determining an affine motion model of the current block may be encoded and signaled via a bitstream. For example, when an affine motion vector prediction mode of the current block is applied, an affine motion model of the current block may be determined based on a 1-bit flag "affine_type_flag".
[0160] Next, an affine seed vector for the current block may be derived (S1102). If a four-parameter affine motion model is selected, motion vectors at two control points of the current block may be derived. Meanwhile, if a six-parameter affine motion model is selected, motion vectors at three control points of the current block may be derived. The motion vectors at the control points may be referred to as affine seed vectors. The control points may include at least one of the top left corner, the top right corner, or the bottom left corner of the current block.
[0161] FIG. 12 is a diagram illustrating affine seed vectors of each affine motion model.
[0162] In the parameter affine motion model, two affine seed vectors can be derived from the top left corner, the top right corner, or the bottom left corner. As an example, as shown in FIG. 12(a), when a four-parameter affine motion model is selected, an affine vector can be derived using an affine seed vector sv0 from the top left corner of the current block (e.g., the top left sample (x1, y1)) and an affine seed vector sv1 from the top right corner of the current block (e.g., the top right sample (x1, y1)). The affine seed vector from the bottom left corner can also be used instead of the affine seed vector from the top left corner, or the affine seed vector from the bottom left corner can also be used instead of the affine seed vector from the top right corner.
[0163] In the parameter affine motion model, affine seed vectors for the upper left corner, the upper right corner, and the lower left corner can be derived. As an example, as shown in (b) of FIG. 12, when a 6-parameter affine motion model is selected, affine vectors can be derived using an affine seed vector sv0 for the upper left corner of the current block (e.g., the upper left sample (x1, y1)), an affine seed vector sv1 for the upper right corner of the current block (e.g., the upper right sample (x1, y1)), and an affine seed vector sv2 for the upper left corner of the current block (e.g., the upper left sample (x2, y2)).
[0164] In the examples described below, in the four-parameter affine motion model, the affine seed vectors of the top-left control point and the top-right control point are referred to as the first affine seed vector and the second affine seed vector, respectively. In the embodiments described below that utilize the first affine seed vector and the second affine seed vector, at least one of the first affine seed vector and the second affine seed vector can be replaced with the affine seed vector of the bottom-left control point (third affine seed vector) or the affine seed vector of the bottom-right control point (fourth affine seed vector).
[0165] In addition, in the six-parameter affine motion model, the affine seed vectors of the top left control point, the top right control point, and the bottom left control point are referred to as the first affine seed vector, the second affine seed vector, and the third affine seed vector, respectively. In an embodiment using the first affine seed vector, the second affine seed vector, and the third affine seed vector described below, at least one of the first affine seed vector, the second affine seed vector, and the third affine seed vector can be replaced with the affine seed vector of the bottom right control point (fourth affine seed vector).
[0166] Using the affine seed vector, an affine vector for each sub-block can be derived (S1103). Here, the affine vector refers to a translational motion vector derived based on the affine seed vector. The affine vector of a sub-block can be called an affine sub-block motion vector or a sub-block motion vector.
[0167] FIG. 13 is a diagram illustrating affine vectors of sub-blocks in a four-parameter motion model.
[0168] The affine vector of the sub-block can be derived based on the position of the control point, the position of the sub-block, and the affine seed vector. As an example, Equation 3 shows an example of deriving an affine sub-block vector.
[0169] [Formula 3]
[0170]
number
[0171] In the above formula 3, (x, y) indicates the position of the sub-block. Here, the position of the sub-block indicates the position of a reference sample included in the sub-block. The reference sample may be a sample located at the upper left corner of the sub-block, or a sample whose x-axis coordinate or y-axis coordinate is at the center position. (x0, y0) indicates the position of the first control point, and (sv0x, sv0y) indicates the first affine seed vector. Note that (x1, y1) indicates the position of the second control point, and (sv1x, sv1y) indicates the second affine seed vector.
[0172] If the first and second control points correspond to the upper-left and upper-right corners of the current block, respectively, then x1-x0 may be set to a value equal to the width of the current block.
[0173] Then, motion compensation prediction can be performed for each sub-block using the affine vector of each sub-block (S1104). As a result of the motion compensation prediction, a prediction block for each sub-block can be generated. The prediction block of the sub-block can be set as the prediction block of the current block.
[0174] Next, the inter prediction method using translational motion information will be described in detail.
[0175] The motion information of the current block may be derived from the motion information of another block other than the current block. Here, the other block may be a block that has been encoded / decoded by inter prediction before the current block. Setting the motion information of the current block to be the same as the motion information of another block may be defined as a merge mode. Also, setting the motion vector of another block to a predicted value of the motion vector of the current block may be defined as a motion vector prediction mode.
[0176] FIG. 14 is a flowchart of a process for deriving motion information of a current block in merge mode.
[0177] Merge candidates for a current block may be derived (S1401). The merging candidates for the current block may be derived from blocks that have been encoded / decoded by inter prediction before the current block.
[0178] FIG. 15 is a diagram illustrating candidate blocks used to derive merge candidates.
[0179] The candidate block may include at least one of a neighboring block including a sample neighboring the current block or a non-neighboring block including a sample not neighboring the current block. Hereinafter, a sample determining a candidate block is defined as a reference sample. Note that a reference sample neighboring the current block is referred to as a neighboring reference sample, and a reference sample not neighboring the current block is referred to as a non-neighboring reference sample.
[0180] The adjacent reference sample may be included in an adjacent column of the leftmost column of the current block or an adjacent row of the topmost row of the current block. As an example, when the coordinates of the top left sample of the current block are (0, 0), at least one of a block including a reference sample at a position (-1, H-1), a block including a reference sample at a position (W-1, -1), a block including a reference sample at a position (W, -1), a block including a reference sample at a position (-1, H), or a block including a reference sample at a position (-1, -1) may be used as a candidate block. Referring to the drawing, adjacent blocks with indexes 0 to 4 may be used as candidate blocks.
[0181] The non-adjacent reference sample indicates a sample having at least one of a distance on the x-axis or a distance on the y-axis from a reference sample adjacent to the current block that has a predefined value. As an example, at least one of a block including a reference sample having a predefined value on the x-axis from the left reference sample, a block including a non-adjacent sample having a predefined value on the y-axis from the top reference sample, or a block including a non-adjacent sample having predefined values on the x-axis and y-axis from the top left reference sample may be used as a candidate block. The predefined value may be a natural number such as 4, 8, 12, 16, etc. Referring to the drawing, at least one of blocks with indexes 5 to 26 may be used as a candidate block.
[0182] A sample that is not located on the same vertical, horizontal or diagonal line as an adjacent reference sample may also be set as a non-adjacent reference sample.
[0183] FIG. 16 is a diagram showing the position of the reference sample.
[0184] As shown in the example of Fig. 16, the x coordinate of the top non-adjacent reference sample may be set to be different from the x coordinate of the top adjacent reference sample. As an example, when the position of the top adjacent reference sample is (W-1, -1), the position of the top non-adjacent reference sample that is N away from the top adjacent reference sample along the y axis may be set to ((W / 2)-1, -1-N), and the position of the top non-adjacent reference sample that is 2N away from the top adjacent reference sample along the y axis may be set to (0, -1-2N). That is, the positions of the non-adjacent reference samples may be determined based on the positions of the adjacent reference samples and the distances from the adjacent reference samples.
[0185] Hereinafter, among the candidate blocks, a candidate block that includes adjacent reference samples will be referred to as an adjacent block, and a block that includes non-adjacent reference samples will be referred to as a non-adjacent block.
[0186] If the distance between the current block and the candidate block is equal to or greater than a threshold, the candidate block may be set as unavailable as a merging candidate. The threshold may be determined based on the size of the coding tree unit. As an example, the threshold may be set to the height of the coding tree unit (ctu_height) or a value obtained by adding or subtracting an offset from the height of the coding tree unit (e.g., ctu_height±N). The offset N is a value that is already defined in the encoder and decoder, and may be set to 4, 8, 16, 32, or ctu_height.
[0187] If the difference between the y-axis coordinate of the current block and the y-axis coordinate of a sample included in the candidate block is greater than a threshold, the candidate block may be determined to be unavailable as a merging candidate.
[0188] Alternatively, a candidate block that does not belong to the same coding tree unit as the current block may be set as unavailable as a merging candidate. For example, if a reference sample exceeds the upper boundary of the coding tree unit to which the current block belongs, a candidate block including the reference sample may be set as unavailable as a merging candidate.
[0189] If the top boundary of the current block is adjacent to the top boundary of the coding tree unit, many candidate blocks are determined to be unavailable as merge candidates, and the encoding / decoding efficiency of the current block may decrease. To solve this problem, the candidate blocks may be set so that the number of candidate blocks located to the left of the current block is greater than the number of candidate blocks located at the top of the current block.
[0190] FIG. 17 is a diagram illustrating candidate blocks used to derive merge candidates.
[0191] As shown in the example of Fig. 17, the top block belonging to the top N block row of the current block and the left block belonging to the left M block row of the current block can be set as candidate blocks. In this case, M can be set to be larger than N, so that the number of left candidate blocks can be set to be larger than the number of top candidate blocks.
[0192] For example, the difference between the y-axis coordinate of a reference sample in the current block and the y-axis coordinate of a top block that can be used as a candidate block can be set to not exceed N times the height of the current block, and the difference between the x-axis coordinate of a reference sample in the current block and the x-axis coordinate of a left block that can be used as a candidate block can be set to not exceed M times the width of the current block.
[0193] As an example, in the example shown in Figure 17, it is shown that the blocks belonging to the top two block columns of the current block and the blocks belonging to the five block columns to the left of the current block are set as candidate blocks.
[0194] As another example, if the candidate block and the current block do not belong to the same coding tree unit, a merge candidate can be derived using a block that belongs to the same coding tree unit as the current block or a block that includes a reference sample adjacent to the boundary of the coding tree unit instead of the candidate block.
[0195] FIG. 18 is a diagram showing an example in which the position of the reference sample is changed.
[0196] If a reference sample is included in a different coding tree unit from the current block and the reference sample is not adjacent to the boundary of the coding tree unit, a candidate block can be determined using a reference sample adjacent to the boundary of the coding tree unit instead of the reference sample.
[0197] 18(a) and 18(b), if the top boundary of the current block and the top boundary of the coding tree unit are adjacent, the reference sample at the top of the current block belongs to a coding tree unit different from the current block. For the reference samples that belong to a coding tree unit different from the current block, the reference samples that are not adjacent to the top boundary of the coding tree unit can be replaced with samples that are adjacent to the top boundary of the coding tree unit.
[0198] As an example, as shown in (a) of Figure 18, the reference sample at position 6 can be replaced with the sample at position 6' located at the upper boundary of the coding tree unit, and as shown in (b) of Figure 18, the reference sample at position 15 can be replaced with the sample at position 15' located at the upper boundary of the coding tree unit. In this case, the y coordinate of the replacement sample can be changed to an adjacent position of the coding tree unit, and the x coordinate of the replacement sample can be set to the same as the reference sample. As an example, the sample at position 6' can have the same x coordinate as the sample at position 6, and the sample at position 15' can have the same x coordinate as the sample at position 15.
[0199] Alternatively, the x-coordinate of the replacement sample may be set by adding or subtracting an offset from the x-coordinate of the reference sample. For example, if the x-coordinates of an adjacent reference sample and a non-adjacent reference sample located at the top of the current block are the same, the x-coordinate of the replacement sample may be set by adding or subtracting an offset from the x-coordinate of the reference sample. This is to prevent a replacement sample replacing a non-adjacent reference sample from being at the same position as another non-adjacent reference sample or an adjacent reference sample.
[0200] FIG. 19 is a diagram showing an example in which the position of the reference sample is changed.
[0201] When replacing a reference sample that is included in a coding tree unit different from the current block and is not adjacent to the boundary of the coding tree unit with a sample located at the boundary of the coding tree unit, a value obtained by adding or subtracting an offset from the x coordinate of the reference sample can be set as the x coordinate of the replacement sample.
[0202] 19, the reference sample at position 6 and the reference sample at position 15 may be replaced with the sample at position 6' and the sample at position 15', whose y coordinates are the same as those of the row adjacent to the upper boundary of the coding tree unit, respectively. In this case, the x coordinate of the sample at position 6' may be set to a value obtained by subtracting W / 2 from the x coordinate of the reference sample at position 6, and the x coordinate of the sample at position 15' may be set to a value obtained by subtracting W-1 from the x coordinate of the reference sample at position 15.
[0203] Unlike the examples shown in Figures 18 and 19, the y coordinate of the row located at the top of the topmost row of the current block or the y coordinate of the top boundary of the coding tree unit can also be set as the y coordinate of the replacement sample.
[0204] Although not shown, a sample to replace the reference sample may be determined based on the left boundary of the coding tree unit. For example, if the reference sample is not included in the same coding tree unit as the current block and is not adjacent to the left boundary of the coding tree unit, the reference sample may be replaced with a sample adjacent to the left boundary of the coding tree unit. In this case, the replacement sample may have the same y coordinate as the reference sample, or may have a y coordinate obtained by adding or subtracting an offset from the y coordinate of the reference sample.
[0205] Thereafter, the block containing the replacement sample can be set as a candidate block, and a merging candidate for the current block can be derived based on the candidate block.
[0206] Merging candidates may also be derived from temporally adjacent blocks included in a different picture than the current block, for example, from co-located blocks included in a co-located picture.
[0207] The motion information of the merging candidate may be set to be the same as the motion information of the candidate block. For example, at least one of the motion vector, the reference picture index, the prediction direction, or the bidirectional weight index of the candidate block may be set as the motion information of the merging candidate.
[0208] A merge candidate list including merge candidates may be generated (S1402). The merge candidates may be classified into adjacent merge candidates derived from adjacent blocks adjacent to the current block and non-adjacent merge candidates derived from non-adjacent blocks.
[0209] The indices of the merge candidates in the merge candidate list may be assigned in a predetermined order. For example, indices assigned to adjacent merge candidates may have lower values than indices assigned to non-adjacent merge candidates. Alternatively, an index may be assigned to each merge candidate based on the index of each block shown in FIG. 15 or FIG. 17.
[0210] When the merging candidate set includes a plurality of merging candidates, at least one of the plurality of merging candidates may be selected (S1403). In this case, information indicating whether motion information of the current block is derived from a neighboring merging candidate may be signaled through the bitstream. The information may be a 1-bit flag. As an example, a syntax element isAdjancentMergeFlag indicating whether motion information of the current block is derived from a neighboring merging candidate may be signaled through the bitstream. When the syntax element isAdjancentMergeFlag has a value of 1, the motion information of the current block may be derived based on a neighboring merging candidate. On the other hand, when the syntax element isAdjancentMergeFlag has a value of 0, the motion information of the current block may be derived based on a non-neighboring merging candidate.
[0211] Table 1 shows a syntax table including the syntax element isAdjancentMergeFlag.
[0212] [Table 1]
[0213] Information for identifying any one of a plurality of merging candidates may be signaled via a bitstream. For example, information indicating an index of any one of the merging candidates included in the merging candidate list may be signaled via a bitstream.
[0214] A syntax element merge_idx that specifies one of the adjacent merge candidates may be signaled if isAdjacentMergeflag is 1. The maximum value of the syntax element merge_idx may be set to a value obtained by subtracting 1 from the number of adjacent merge candidates.
[0215] When isAdjacentMergeflag is 0, a syntax element NA_merge_idx that specifies one of the non-adjacent merge candidates may be signaled. The syntax element NA_merge_idx indicates a value obtained by subtracting the number of adjacent merge candidates from the index of the non-adjacent merge candidate. The decoder may select a non-adjacent merge candidate by adding the number of adjacent merge candidates to the index specified by NA_merge_idx.
[0216] If the number of merge candidates included in the merge candidate list is less than a threshold, the merge candidates included in the inter region motion information table may be added to the merge candidate list. Here, the threshold may be the maximum number of merge candidates that the merge candidate list can include or the maximum number of merge candidates minus an offset. The offset may be a natural number such as 1 or 2. The inter region motion information table may include merge candidates derived based on blocks encoded / decoded before the current block.
[0217] The inter region motion information table includes merge candidates derived from blocks encoded / decoded based on inter prediction in the current picture. As an example, the motion information of the merge candidates included in the inter region motion information table may be set to be the same as the motion information of the blocks encoded / decoded based on inter prediction. Here, the motion information may include at least one of a motion vector, a reference picture index, a prediction direction, or a bidirectional weight index.
[0218] For ease of explanation, the merge candidates included in the inter region motion information table are referred to as inter region merge candidates.
[0219] The maximum number of merge candidates included in the inter region motion information table may be predefined in the encoder and decoder. For example, the maximum number of merge candidates included in the inter region motion information table may be 1, 2, 3, 4, 5, 6, 7, 8, or more (e.g., 16).
[0220] Alternatively, information indicating the maximum number of merge candidates in the inter-region motion information table may be signaled via the bitstream, and the information may be signaled at the sequence, picture, or slice level.
[0221] Alternatively, the number of maximum merge candidates in the inter-region motion information table may be determined based on the size of a picture, the size of a slice, or the size of a coding tree unit.
[0222] The inter region motion information table may be initialized in units of pictures, slices, tiles, bricks, coding tree units, or coding tree unit lines (rows or columns). As an example, when a slice is initialized, the inter region motion information table is also initialized, and the inter region motion information table may not include any merge candidates.
[0223] Alternatively, information indicating whether to initialize the inter-region motion information table may be signaled via a bitstream. The information may be signaled at a slice, tile, brick, or block level. Before the information indicates that the inter-region motion information table should be initialized, a previously configured inter-region motion information table may be used.
[0224] Alternatively, information about the initial inter region merging candidate may be signaled via a picture parameter set or a slice header. When a slice is initialized, the inter region motion information table may include the initial inter region merging candidate. Thus, the inter region merging candidate may be used for the first block to be encoded / decoded in the slice.
[0225] Blocks may be encoded / decoded in encoding / decoding order, and the blocks encoded / decoded based on inter prediction may be set as inter region merging candidates sequentially in the encoding / decoding order.
[0226] FIG. 20 is a diagram showing a mode of updating the inter-region motion information table.
[0227] When inter prediction is performed on a current block (S2001), an inter region merging candidate can be derived based on the current block (S2002). The motion information of the inter region merging candidate can be set to be the same as the motion information of the current block.
[0228] If the inter region motion information table is empty (S2003), an inter region merge candidate derived based on the current block can be added to the inter region motion information table (S2004).
[0229] If the inter region motion information table already includes an inter region merge candidate (S2003), a redundancy check may be performed on the motion information of the current block (or an inter region merge candidate derived based on the motion information) (S2005). The redundancy check is for determining whether the motion information of the inter region merge candidate already stored in the inter region motion information table is the same as the motion information of the current block. The redundancy check may be performed on all inter region merge candidates already stored in the inter region motion information table. Alternatively, the redundancy check may be performed on inter region merge candidates whose indexes in the inter region merge candidates already stored in the inter region motion information table are greater than or equal to a threshold value or less than a threshold value.
[0230] If the inter-prediction merge candidate having the same motion information as the motion information of the current block is not included, an inter region merge candidate derived based on the current block may be added to the inter region motion information table (S2008). Whether the inter-prediction merge candidates are the same may be determined based on whether the motion information (e.g., motion vectors and / or reference picture indexes, etc.) of the inter-prediction merge candidates are the same.
[0231] At this time, if the maximum number of inter region merge candidates are already stored in the inter region motion information table (S2006), the oldest inter region merge candidate is deleted (S2007), and the inter region merge candidate derived based on the current block can be added to the inter region motion information table (S2008).
[0232] The inter region merge candidates may be identified by their respective indexes. When an inter region merge candidate derived from the current block is added to the inter region motion information table, the lowest index (e.g., 0) may be assigned to the inter region merge candidate, and the indexes of the already stored inter region merge candidates may be incremented by 1. In this case, if the maximum number of inter prediction merge candidates is already stored in the inter region motion information table, the inter region merge candidate with the highest index is removed.
[0233] Alternatively, when an inter region merge candidate derived from the current block is added to the inter region motion information table, the inter region merge candidate may be assigned the largest index. For example, if the number of inter prediction merge candidates already stored in the inter region motion information table is less than the maximum value, the inter region merge candidate may be assigned an index with a value equal to the number of inter prediction merge candidates already stored. Alternatively, if the number of inter prediction merge candidates already stored in the inter region motion information table is equal to the maximum value, the inter region merge candidate may be assigned an index obtained by subtracting 1 from the maximum value. In addition, the inter region merge candidate with the smallest index is removed, and the indexes of the remaining inter region merge candidates already stored are decremented by one.
[0234] FIG. 21 is a diagram showing a mode of updating the inter region merge candidate table.
[0235] It is assumed that an inter region merge candidate derived from the current block is added to an inter region merge candidate table and assigned the highest index, and that the inter region merge candidate table already contains the maximum number of inter region merge candidates.
[0236] When the inter region merge candidate HmvpCand[n+1] derived from the current block is added to the inter region merge candidate table HmvpCandList, the inter region merge candidate HmvpCand[0] with the smallest index among the already stored inter region merge candidates may be deleted, and the indexes of the remaining inter region merge candidates may be decremented by 1. In addition, the index of the inter region merge candidate HmvpCand[n+1] derived from the current block may be set to the maximum value (n in the example illustrated in FIG. 21).
[0237] If an inter region merge candidate that is the same as the inter region merge candidate derived based on the current block has already been stored (S2005), the inter region merge candidate derived based on the current block does not need to be added to the inter region motion information table (S2009).
[0238] Alternatively, an inter region merging candidate derived based on the current block may be added to the inter region motion information table, while an already stored inter region merging candidate that is the same as the inter region merging candidate may be deleted, in which case the same effect as updating the index of the already stored inter region merging candidate may be obtained.
[0239] FIG. 22 is a diagram showing an example in which the indexes of already stored inter region merge candidates are updated.
[0240] If an index of an already stored inter prediction merge candidate that is the same as the inter region merge candidate mvCand derived based on the current block is hIdx, the already stored inter prediction merge candidate may be deleted, and the index of the inter prediction merge candidate whose index is greater than hIdx may be decremented by 1. As an example, the example shown in FIG 22 illustrates that HmvpCand[2] that is the same as mvCand is deleted from the inter region motion information table HvmpCandList, and the indexes from HmvpCand[3] to HmvpCand[n] are decremented by 1.
[0241] Then, the inter region merge candidate mvCand derived based on the current block can be added to the end of the inter region motion information table.
[0242] Alternatively, the index assigned to an already stored inter region merge candidate that is the same as the inter region merge candidate derived based on the current block may be updated, for example, the index of the already stored inter region merge candidate may be changed to a minimum or maximum value.
[0243] The motion information of blocks included in a predetermined region may be set not to be added to the inter region motion information table. As an example, an inter region merge candidate derived based on the motion information of blocks included in the merge processing region may not be added to the inter region motion information table. Since the encoding / decoding order is not defined for blocks included in the merge processing region, it is inappropriate to use any one of these motion information when inter predicting other blocks. Therefore, an inter region merge candidate derived based on blocks included in the merge processing region may not be added to the inter region motion information table.
[0244] When motion compensation prediction is performed on a subblock unit, an inter region merging candidate may be derived based on motion information of a representative subblock among a plurality of subblocks included in a current block. For example, when a subblock merging candidate is used for a current block, an inter region merging candidate may be derived based on motion information of a representative subblock among the subblocks.
[0245] The motion vector of a sub-block may be derived in the following order. First, one of the merging candidates included in the merging candidate list of the current block may be selected, and an initial shift vector (shVector) may be derived based on the motion vector of the selected merging candidate. Then, a shifted sub-block whose reference sample position is (xColSb, yColSb) may be derived by adding the initial shift vector to the position (xSb, ySb) of a reference sample (e.g., the upper left sample or the sample at the middle position) of each sub-block in the coding block. The following Equation 4 shows a formula for deriving the shifted sub-block.
[0246] [Formula 4]
[0247]
number
[0248] Then, the motion vector of the collocated block corresponding to the center position of the sub-block containing (xColSb, yColSb) can be set as the motion vector of the sub-block containing (xSb, ySb).
[0249] The representative sub-block may refer to the sub-block that includes the top-left sample or the center sample of the current block.
[0250] FIG. 23 is a diagram showing the position of the representative sub-block.
[0251] 23(a) shows an example in which a sub-block located at the upper left of a current block is set as a representative sub-block, and FIG. 23(b) shows an example in which a sub-block located at the center of a current block is set as a representative sub-block. When motion compensation prediction is performed in a sub-block unit, an inter region merging candidate for a current block can be derived based on a motion vector of a sub-block including a sample at the upper left of the current block or a sub-block including a sample at the center of the current block.
[0252] It may also be determined whether to use the current block as an inter region merging candidate based on the inter prediction mode of the current block. For example, a block encoded / decoded based on an affine motion model may be set not to be used as an inter region merging candidate. Thus, even if the current block is encoded / decoded by inter prediction, if the inter prediction mode of the current block is an affine prediction mode, the inter prediction motion information table may not be updated based on the current block.
[0253] Alternatively, the inter region merging candidate may be derived based on at least one subblock vector among the subblocks included in the block encoded / decoded based on the affine motion model. As an example, the inter region merging candidate may be derived using a subblock located at the upper left, the subblock located at the center, or the subblock located at the upper right of the current block. Alternatively, the average value of the subblock vectors of a plurality of subblocks may be set as the motion vector of the inter region merging candidate.
[0254] Alternatively, the inter region merging candidate may be derived based on the average value of the affine seed vectors of the blocks encoded / decoded based on the affine motion model. As an example, the average of at least one of the first affine seed vector, the second affine seed vector, or the third affine seed vector of the current block may be set as the motion vector of the inter region merging candidate.
[0255] Alternatively, an inter region motion information table may be configured for each inter prediction mode. For example, at least one of an inter region motion information table for a block encoded / decoded by intra block copy, an inter region motion information table for a block encoded / decoded based on a translational motion model, or an inter region motion information table for a block encoded / decoded based on an affine motion model may be defined. Depending on the inter prediction mode of the current block, any one of the inter region motion information tables may be selected.
[0256] FIG. 24 is a diagram showing an example in which an inter region motion information table is generated for each inter prediction mode.
[0257] If a block is encoded / decoded based on a non-fine motion model, the inter region merge candidate mvCand derived based on the block may be added to the inter region non-fine motion information table HmvpCandList, whereas if a block is encoded / decoded based on an affine motion model, the inter region merge candidate mvAfCand derived based on the block may be added to the inter region affine motion information table HmvpAfCandList.
[0258] An inter region merge candidate derived from a block encoded / decoded based on an affine motion model may store the affine seed vector of the block, and thus the inter region merge candidate may be used as a merge candidate for deriving an affine seed vector of a current block.
[0259] In addition to the inter-region motion information table described above, an additional inter-region motion information table can also be defined. In addition to the above-mentioned inter-region motion information table (hereinafter referred to as the first inter-region motion information table), a long-term motion information table (hereinafter referred to as the second inter-region motion information table) can be defined. Here, the long-term motion information table includes long-term merge candidates.
[0260] When the first inter region motion information table and the second inter region motion information table are both empty, the inter region merge candidates can be added to the second inter region motion information table first, and the inter region merge candidates can be added to the first inter region motion information table only after the number of inter region merge candidates available in the second inter region motion information table reaches the maximum number.
[0261] Alternatively, one inter prediction merge candidate can be added to both the second inter region motion information table and the first inter region motion information table.
[0262] At this time, the second inter region motion information table whose construction has been completed may not be updated any more, or the second inter region motion information table may be updated if the decoded region is equal to or larger than a predetermined ratio of the slice, or the second inter region motion information table may be updated every N coding tree unit lines.
[0263] Meanwhile, the first inter region motion information table may be updated every time a block encoded / decoded by inter prediction occurs, but the inter region merge candidates added to the second inter region motion information table may be set not to be used to update the first inter region motion information table.
[0264] Information for selecting one of the first inter region motion information table or the second inter region motion information table may be signaled via the bitstream, and if the number of merge candidates included in the merge candidate list is less than a threshold, the merge candidates included in the inter region motion information table indicated by the information may be added to the merge candidate list.
[0265] Alternatively, the inter region motion information table may be selected based on the size, shape, inter prediction mode, whether to perform bi-directional prediction, whether to refine motion vectors, or whether to perform triangular partitioning of the current block.
[0266] Alternatively, if the number of merge candidates included in the merge candidate list is less than the maximum number of merges even after adding the inter region merge candidates included in the first inter region motion information table, the inter region merge candidates included in the second inter region motion information table can be added to the merge candidate list.
[0267] FIG. 25 is a diagram showing an example in which inter-region merging candidates included in the long-term motion information table are added to the merging candidate list.
[0268] If the number of merge candidates included in the merge candidate list is less than the maximum number, the inter region merge candidates included in the first inter region motion information table HmvpCandList can be added to the merge candidate list. If the number of merge candidates included in the merge candidate list is still less than the maximum number even after the inter region merge candidates included in the first inter region motion information table are added to the merge candidate list, the inter region merge candidates included in the long term motion information table HmvpLTCandList can be added to the merge candidate list.
[0269] Table 2 shows the process of adding the inter-region merge candidates contained in the long-term motion information table to the merge candidate list.
[0270] [Table 2]
[0271] Inter region merge candidates may be set to include additional information in addition to motion information. For example, the inter region merge candidates may additionally store block size, shape, or block partition information. When constructing a merge candidate list for the current block, only inter prediction merge candidates having the same or similar size, shape, or partition information as the current block may be used among the inter prediction merge candidates, or inter prediction merge candidates having the same or similar size, shape, or partition information as the current block may be added to the merge candidate list first.
[0272] Alternatively, an inter-region motion information table may be generated for each size, shape, or partition information of a block. Among the multiple inter-region motion information tables, an inter-region motion information table that matches the shape, size, or partition information of the current block may be used to generate a merge candidate list for the current block.
[0273] If the number of merge candidates included in the merge candidate list of the current block is less than a threshold, the inter region merge candidates included in the inter region motion information table may be added to the merge candidate list. The addition process may be performed in ascending or descending order based on the index. For example, the inter region merge candidate with the largest index may be added to the merge candidate list first.
[0274] When an inter region merge candidate included in the inter region motion information table is to be added to the merge candidate list, a redundancy check may be performed between the inter region merge candidate and the merge candidates already stored in the merge candidate list.
[0275] As an example, Table 3 shows the process by which inter-region merge candidates are added to the merge candidate list.
[0276] [Table 3]
[0277] The redundancy check may be performed only on a portion of the inter region merge candidates included in the inter region motion information table. For example, the redundancy check may be performed only on the inter region merge candidates whose indexes are greater than or less than a threshold value. Alternatively, the redundancy check may be performed only on the N merge candidates whose indexes are the largest or the N merge candidates whose indexes are the smallest.
[0278] Alternatively, the redundancy check may be performed on only a portion of the merge candidates already stored in the merge candidate list. As an example, the redundancy check may be performed on only merge candidates whose index is greater than or equal to a threshold or less than or equal to a threshold, or on merge candidates derived from a block at a specific location, where the specific location may include at least one of a left neighboring block, an upper neighboring block, an upper right neighboring block, or a lower left neighboring block of the current block.
[0279] FIG. 26 illustrates an example in which redundancy checking is performed on only a portion of the merging candidates.
[0280] When an inter-region merge candidate HmvpCand[j] is to be added to the merge candidate list, a redundancy check can be performed on the inter-region merge candidate with the two merge candidates with the highest indices mergeCandList[NumMerge-2] and mergeCandList[NumMerge-1], where NumMerge can indicate the number of available spatial and temporal merge candidates.
[0281] Unlike the illustrated example, when adding an inter-region merge candidate HmvpCand[j] to the merge candidate list, a redundancy check may be performed on the inter-region merge candidate with up to two merge candidates with the smallest index. For example, it may be confirmed whether mergeCandList[0] and mergeCandList[1] are the same as HmvpCand[j]. Alternatively, a redundancy check may be performed only on merge candidates derived from a specific position. As an example, a redundancy check may be performed on at least one of merge candidates derived from a neighboring block located to the left of the current block or merge candidates derived from a neighboring block located at the top end of the current block. If there is no merge candidate derived from a specific position in the merge candidate list, the inter-region merge candidate may be added to the merge candidate list without a redundancy check.
[0282] When a merge candidate identical to the first inter region merge candidate is found, the redundancy check with the same merge candidate as the first inter region merge candidate can be omitted when performing a redundancy check on a second inter region merge candidate.
[0283] FIG. 27 is a diagram showing an example in which a redundancy check with a specific merging candidate is omitted.
[0284] When an inter-region merge candidate HmvpCand[i] with index i is to be added to a merge candidate list, a redundancy check is performed between the inter-region merge candidate and merge candidates already stored in the merge candidate list. In this case, if a merge candidate mergeCandList[j] identical to the inter-region merge candidate HmvpCand[i] is found, a redundancy check may be performed between the inter-region merge candidate HmvpCand[i-1] with index i-1 and the merge candidate without adding the inter-region merge candidate HmvpCand[i] to the merge candidate list. In this case, the redundancy check between the inter-region merge candidate HmvpCand[i-1] and the merge candidate mergeCandList[j] may be omitted.
[0285] 27, it is determined that HmvpCand[i] and mergeCandList[2] are the same. Therefore, HmvpCand[i] is not added to the merge candidate list, and a redundancy check of HmvpCand[i-1] can be performed. In this case, the redundancy check between HmvpCand[i-1] and mergeCandList[2] can be omitted.
[0286] If the number of merge candidates included in the merge candidate list of the current block is less than a threshold, in addition to the inter-region merge candidates, the list may further include at least one of pairwise merge candidates or zero merge candidates. A fairwise merge candidate is a merge candidate whose motion vector is the average value of the motion vectors of two or more merge candidates, and a zero merge candidate is a merge candidate whose motion vector is 0.
[0287] The current block's merge candidate list can be populated with merge candidates by the following steps:
[0288] Spatial merge candidates - Temporal merge candidates - Inter-region merge candidates - (Inter-region affine merge candidates) - Pairwise merge candidates - Zero merge candidates
[0289] The spatial merge candidate refers to a merge candidate derived from at least one of adjacent or non-adjacent blocks, and the temporal merge candidate refers to a merge candidate derived from a previous reference picture. The inter-region affine merge candidate refers to an inter-region merge candidate derived from a block encoded / decoded with an affine motion model.
[0290] The inter region motion information table may also be used in a motion vector prediction mode. For example, if the number of motion vector prediction candidates included in the motion vector prediction candidate list of the current block is less than a threshold, the inter region merge candidates included in the inter region motion information table may be set as motion vector prediction candidates of the current block. Specifically, the motion vectors of the inter region merge candidates may be set as motion vector prediction candidates.
[0291] When one of the motion vector prediction candidates included in the motion vector prediction candidate list of the current block is selected, the selected candidate can be set as a motion vector predictor of the current block. Thereafter, the motion vector residual value of the current block is decoded, and the motion vector predictor and the motion vector residual value are added to obtain the motion vector of the current block.
[0292] The motion vector prediction candidate list for the current block may be constructed in the following order:
[0293] Spatial motion vector prediction candidate -Temporal motion vector prediction candidate -Inter region merge candidate -(Inter region affine merge candidate) -Zero motion vector prediction candidate
[0294] The spatial motion vector prediction candidate refers to a motion vector prediction candidate derived from at least one of adjacent blocks or non-adjacent blocks, and the temporal motion vector prediction candidate refers to a motion vector prediction candidate derived from a previous reference picture. The inter-region affine merge candidate refers to an inter-region motion vector prediction candidate derived from a block encoded / decoded with an affine motion model. The zero motion vector prediction candidate refers to a candidate whose motion vector value is 0.
[0295] When a merge candidate for the current block is selected, the motion vector of the selected merge candidate may be set as an initial motion vector, and a motion compensation prediction for the current block may be performed using a motion vector derived by adding or subtracting an offset vector to or from the initial motion vector. The process of adding or subtracting an offset vector to or from the motion vector of the merge candidate to derive a new motion vector may be defined as a merge offset vector encoding method.
[0296] Information indicating whether the merge offset encoding method is used may be signaled via a bitstream. The information may be a 1-bit flag, merge_offset_vector_flag. As an example, a value of merge_offset_vector_flag of 1 indicates that the merge offset vector encoding method is applied to the current block. If the merge offset vector encoding method is applied to the current block, the offset vector may be added or subtracted from the motion vector of the merge candidate to derive the motion vector of the current block. A value of merge_offset_vector_flag of 0 indicates that the merge offset vector encoding method is not applied to the current block. If the merge offset vector encoding method is not applied, the motion vector of the merge candidate may be set as the motion vector of the current block.
[0297] The flag may be signaled only when the value of the skip flag indicating whether the skip mode is applied is true or the value of the merge flag indicating whether the merge mode is applied is true. For example, when the value of the skip_flag indicating that the skip mode is applied to the current block is 1 or the value of the merge_flag indicating that the merge mode is applied to the current block is 1, the merge_offset_vector_flag may be encoded and signaled.
[0298] If it is determined that the merge offset encoding method is applied to the current block, at least one of information identifying any one of the merge candidates included in the merge candidate list, information indicating the magnitude of the offset vector, or information indicating the direction of the offset vector may be additionally signaled.
[0299] Information for determining the maximum number of merge candidates that a merge candidate list can include may be signaled via the bitstream. As an example, the maximum number of merge candidates that a merge candidate list can include may be set as a natural number less than or equal to 6.
[0300] When it is determined that the merge offset encoding method is applied to the current block, only the maximum number of merge candidates already set may be set as the initial motion vector of the current block. That is, the number of merge candidates available to the current block may be adaptively determined depending on whether the merge offset encoding method is applied or not. As an example, when the value of merge_offset_vector_flag is set to 0, the maximum number of merge candidates available to the current block may be set to M, whereas when the value of merge_offset_vector_flag is set to 1, the maximum number of merge candidates available to the current block may be set to N. Here, M indicates the maximum number of merge candidates that the merge candidate list can include, and N indicates a natural number equal to or smaller than M.
[0301] As an example, if M is 6 and N is 2, among the merge candidates included in the merge candidate list, the two merge candidates with the smallest indexes may be set as usable for the current block. Thus, the motion vector of the merge candidate with an index value of 0 or the motion vector of the merge candidate with an index value of 1 may be set as the initial motion vector of the current block. If M and N are the same (e.g., M and N are 2), all merge candidates included in the merge candidate list may be set as usable for the current block.
[0302] Alternatively, whether a neighboring block can be used as a merge candidate may be determined based on whether a merge offset vector encoding method is applied to the current block. As an example, if the value of merge_offset_vector_flag is 1, at least one of the neighboring blocks adjacent to the upper right corner or the lower left corner of the current block may be set not to be used as a merge candidate. Therefore, if the merge offset vector encoding method is applied to the current block, at least one motion vector of the neighboring block adjacent to the upper right corner or the lower left corner of the current block cannot be set as an initial motion vector. Alternatively, if the value of merge_offset_vector_flag is 1, the temporal neighboring blocks of the current block may be set not to be used as a merge candidate.
[0303] When the merge offset vector encoding method is applied to the current block, at least one of the pairwise merge candidates or the zero merge candidates may be set not to be used. Thus, when the value of merge_offset_vector_flag is 1, at least one of the pairwise merge candidates or the zero merge candidates may not be added to the merge candidate list even if the number of merge candidates included in the merge candidate list is less than the maximum number.
[0304] The motion vector of the merge candidate may be set as an initial motion vector of the current block. In this case, if the number of merge candidates available to the current block is multiple, information identifying one of the multiple merge candidates may be signaled through the bitstream. As an example, if the maximum number of merge candidates that the merge candidate list can include is greater than 1, information merge_idx indicating one of the multiple merge candidates may be signaled through the bitstream. That is, the merge candidate may be identified through information merge_idx for identifying one of the multiple merge candidates according to a merge offset encoding method. The initial motion vector of the current block may be set as the motion vector of the merge candidate indicated by merge_idx.
[0305] Meanwhile, when the number of merge candidates available for the current block is 1, signaling of information for identifying a merge candidate may be omitted. As an example, when the maximum number of merge candidates that a merge candidate list can include is not greater than 1, signaling of information merge_idx for identifying a merge candidate may be omitted. That is, under the merge offset encoding method, when one merge candidate is included in a merge candidate list, encoding of information merge_idx for identifying a merge candidate may be omitted, and an initial motion vector may be determined based on a merge candidate included in the merge candidate list. The motion vector of the merge candidate may be set as the initial motion vector of the current block.
[0306] As another example, it may be possible to determine merge candidates for the current block and then determine whether to apply the merge offset vector encoding method to the current block. As an example, if the maximum number of merge candidates that a merge candidate can include is greater than 1, information merge_idx for identifying any one of the merge candidates may be signaled. After selecting a merge candidate based on merge_idx, it may be possible to decode merge_offset_vector_flag, which indicates whether the merge offset vector encoding method is applied to the current block. Table 4 illustrates a syntax table according to the above embodiment.
[0307] [Table 4]
[0308] As another example, after determining a merge candidate for the current block, it may be determined whether or not to apply the merge offset vector encoding method to the current block only if the index of the determined merge candidate is smaller than the maximum number of merge candidates available when applying the merge offset vector encoding method. As an example, only if the value of index information merge_idx is smaller than N, merge_offset_vector_flag indicating whether or not to apply the merge offset vector encoding method to the current block may be encoded and signaled. If the value of index information merge_idx is equal to or greater than N, encoding of merge_offset_vector_flag may be omitted. If encoding of merge_offset_vector_flag is omitted, it may be determined that the merge offset vector encoding method is not applied to the current block.
[0309] Alternatively, after determining a merge candidate for the current block, it may be determined whether or not to apply the merge offset vector encoding method to the current block, taking into consideration whether or not the determined merge candidate has bidirectional motion information or unidirectional motion information. As an example, only if the value of index information merge_idx is smaller than N and the merge candidate selected by the index information has bidirectional motion information, merge_offset_vector_flag indicating whether or not to apply the merge offset vector encoding method to the current block may be encoded and signaled. Alternatively, only if the value of index information merge_idx is smaller than N and the merge candidate selected by the index information has unidirectional motion information, merge_offset_vector_flag indicating whether or not to apply the merge offset vector encoding method to the current block may be encoded and signaled.
[0310] Alternatively, it may be determined whether to apply the merge offset vector encoding method based on at least one of the size, shape, or whether the current block borders a coding tree unit boundary. If at least one of the size, shape, or whether the current block borders a coding tree unit boundary is already set and does not satisfy the condition, encoding of merge_offset_vector_flag, which indicates whether to apply the merge offset vector encoding method to the current block, may be omitted.
[0311] When a merging candidate is selected, the motion vector of the merging candidate may be set as an initial motion vector of the current block. Then, the offset vector may be determined by decoding information indicating the magnitude of the offset vector and information indicating the direction of the offset vector. The offset vector may have a horizontal component or a vertical component.
[0312] The information indicating the magnitude of the offset vector may be index information indicating one of vector magnitude candidates. As an example, index information distance_idx indicating one of the vector magnitude candidates may be signaled through a bitstream. Table 5 shows the binarization of index information distance_idx and the value of variable DistFromMergeMV for determining the magnitude of the offset vector according to distance_idx.
[0313] [Table 5]
[0314] The magnitude of the offset vector can be derived by dividing the variable DistFromMergeMV by a previously set value. Equation 5 shows an example of determining the magnitude of the offset vector.
[0315] [Formula 5]
[0316]
number
[0317] According to Equation 5, the value obtained by dividing the variable DistFromMegeMV by 4 or the value obtained by shifting the variable DistFromMergeMV by 2 bits to the left can be set as the size of the offset vector.
[0318] It is also possible to use a greater or lesser number of vector magnitude candidates than the example shown in Table 5, or to set the range of motion vector offset size candidates differently from the example shown in Table 5. As an example, it is possible to set the magnitude of the horizontal component or vertical component of the offset vector to be not greater than the distance of two samples. Table 6 shows the value of the variable DistFromMergeMV for determining the binarization of index information distance_idx and the magnitude of the offset vector according to distance_idx.
[0319] [Table 6]
[0320] Alternatively, the range of motion vector offset size candidates may be set differently depending on the motion vector precision. For example, if the precision of the motion vector of the current block is fractional-pel, the value of the variable DistFromMergeMV corresponding to the value of the index information distance_idx may be set to 1, 2, 4, 8, 16, etc. Here, the fractional pel includes at least one of 1 / 16 pel, octo-pel, quarter-pel, or half-pel. Meanwhile, if the precision of the motion vector of the current block is integer-pel, the value of the variable DistFromMergeMV corresponding to the value of the index information distance_idx may be set to 4, 8, 16, 32, 64, etc. That is, a table to be referenced to determine the variable DistFromMergeMV may be set differently depending on the precision of the motion vector of the current block.
[0321] As an example, if the accuracy of the motion vector of the current block or the merging candidate is quarter-pel, the variable DistFromMergeMV pointed to by distance_idx can be derived using Table 5. On the other hand, if the accuracy of the motion vector of the current block or the merging candidate is integer-pel, a value N times (e.g., 4 times) the value of the variable DistFromMergeMV pointed to by distance_idx in Table 5 can be derived as the value of the variable DistFromMergeMV.
[0322] Information for determining the accuracy of the motion vector may be signaled via a bitstream. As an example, the information may be signaled at a sequence, picture, slice, or block level. Thus, the range of vector magnitude candidates may be set to be different depending on the information on the accuracy of the motion vector signaled via the bitstream. Alternatively, the accuracy of the motion vector may be determined based on a merging candidate of the current block. As an example, the accuracy of the motion vector of the current block may be set to be the same as the accuracy of the motion vector of the merging candidate.
[0323] Alternatively, information for determining a search range of an offset vector may be signaled via a bitstream. Based on the search range, at least one of the number of vector magnitude candidates, the minimum value or the maximum value of the vector magnitude candidates may be determined. As an example, a flag merge_offset_vector_flag for determining the search range of an offset vector may be signaled via a bitstream. The information may be signaled via a sequence header, a picture header, or a slice header.
[0324] As an example, when the value of merge_offset_extend_range_flag is 0, the magnitude of the offset vector can be set not to exceed 2. Thus, the maximum value of DistFromMergeMV can be set to 8. On the other hand, when the value of merge_offset_extend_range_flag is 1, the magnitude of the offset vector can be set not to exceed a distance of 32 samples. Thus, the maximum value of DistFromMergeMV can be set to 128.
[0325] The magnitude of the offset vector may be determined using a flag indicating whether the magnitude of the offset vector is greater than a threshold. As an example, a flag distance_flag indicating whether the magnitude of the offset vector is greater than a threshold may be signaled via a bitstream. The threshold may be 1, 2, 4, 8, or 16. As an example, distance_flag being 1 indicates that the magnitude of the offset vector is greater than 4. Meanwhile, distance_flag being 0 indicates that the magnitude of the offset vector is equal to or less than 4.
[0326] If the magnitude of the offset vector is greater than the threshold, the index information distance_idx can be used to derive a difference value between the magnitude of the offset vector and the threshold. Alternatively, if the magnitude of the offset vector is equal to or less than the threshold, the index information distance_idx can be used to determine the magnitude of the offset vector. Table 7 is a syntax table showing the encoding aspects of distance_flag and distance_idx.
[0327] [Table 7]
[0328] Equation 6 shows an example of deriving a variable DistFromMergeMV for determining the magnitude of an offset vector using distance_flag and distance_idx.
[0329] [Formula 6]
[0330]
number
[0331] In Equation 6, the value of distance_flag may be set to 1 or 0. The value of distance_idx may be set to 1, 2, 4, 8, 16, 32, 64, 128, etc. N indicates a factor determined by the threshold. As an example, if the threshold is 4, N may be set to 16.
[0332] The information indicating the direction of the offset vector may be index information indicating one of vector direction candidates. As an example, index information direction_idx indicating one of the vector direction candidates may be signaled through a bitstream. Table 8 shows binarization of index information direction_idx and the direction of the offset vector according to direction_idx.
[0333] [Table 8]
[0334] In Table 8, sign[0] indicates the horizontal direction and sign[1] indicates the vertical direction. +1 indicates that the value of the x or y component of the offset vector is +, and -1 indicates that the value of the x or y component of the offset vector is -. Equation 7 shows an example of determining an offset vector based on the magnitude and direction of the offset vector.
[0335] [Formula 7]
[0336]
number
[0337] In Equation 7, offsetMV[0] indicates the vertical component of the offset vector, and offsetMV[1] indicates the horizontal component of the offset vector.
[0338] FIG. 28 is a diagram showing offset vectors based on values of distance_idx indicating the magnitude of the offset vector and direction_idx indicating the direction of the offset vector.
[0339] As shown in the example of FIG. 28, the magnitude and direction of the offset vector may be determined based on the values of distance_idx and direction_idx. The maximum magnitude of the offset vector may be set so as not to exceed a threshold. Here, the threshold may have a value already defined in the encoder and the decoder. As an example, the threshold may be a distance of 32 samples. Alternatively, the threshold may be determined according to the magnitude of the initial motion vector. As an example, the horizontal threshold may be set based on the magnitude of the horizontal component of the initial motion vector, and the vertical threshold may be set based on the magnitude of the vertical component of the initial motion vector.
[0340] If the merge candidate has bidirectional motion information, the L0 motion vector of the merge candidate can be set as the L0 initial motion vector of the current block, and the L1 motion vector of the merge candidate can be set as the L1 initial motion vector of the current block. At this time, the L0 offset vector and the L1 offset vector can be determined by considering an output order difference value (hereinafter referred to as L0 difference value) between the L0 reference picture of the merge candidate and the current picture, and an output order difference value (hereinafter referred to as L1 difference value) between the L1 reference picture of the merge candidate and the current picture.
[0341] First, when the signs of the L0 difference value and the L1 difference value are the same, the L0 offset vector and the L1 offset vector can be set to be the same, whereas when the signs of the L0 difference value and the L1 difference value are different, the L1 offset vector can be set to be in the opposite direction to the L0 offset vector.
[0342] The magnitude of the L0 offset vector and the magnitude of the L1 offset vector can be set to be equal, or the magnitude of the L1 offset vector can be determined by scaling the L0 offset vector based on the L0 difference value and the L1 difference value.
[0343] As an example, Equation 8 shows the L0 offset vector and the L1 offset vector when the signs of the L0 and L1 difference values are the same.
[0344] [Formula 8]
[0345]
number
[0346] In Equation 8, offsetMVL0[0] indicates the horizontal component of the L0 offset vector, offsetMVL0[1] indicates the vertical component of the L0 offset vector, offsetMVL1[0] indicates the horizontal component of the L1 offset vector, and offsetMVL1[1] indicates the vertical component of the L1 offset vector.
[0347] Equation 9 shows the L0 offset vector and the L1 offset vector when the L0 and L1 difference values have different signs.
[0348] [Formula 9]
[0349]
number
[0350] It is also possible to define more than four vector direction candidates. Tables 9 and 10 show an example in which eight vector direction candidates are defined.
[0351] [Table 9]
[0352] [Table 10]
[0353] In Tables 9 and 10, when the absolute values of sign[0] and sign[1] are greater than 0, it indicates that the offset vector is diagonal. When Table 8 is used, the magnitudes of the x-axis and y-axis components of the diagonal offset vector are set to abs(offsetMV), but when Table 9 is used, the magnitudes of the x-axis and y-axis components of the diagonal offset vector can be set to abs(offsetMV / 2).
[0354] FIG. 29 is a diagram showing offset vectors based on values of distance_idx indicating the magnitude of the offset vector and direction_idx indicating the direction of the offset vector.
[0355] FIG. 29(a) is an example of the case where Table 8 is applied, and FIG. 29(b) is an example of the case where Table 9 is applied.
[0356] Information for determining at least one of the number or magnitude of vector direction candidates may be signaled via a bitstream. As an example, a flag merge_offset_direction_range_flag for determining vector direction candidates may be signaled via a bitstream. The flag may be signaled at a sequence, picture, or slice level. As an example, if the value of the flag is 0, four vector direction candidates exemplified in Table 8 may be used. On the other hand, if the value of the flag is 1, eight vector direction candidates exemplified in Table 9 or Table 10 may be used.
[0357] Alternatively, at least one of the number or magnitude of the vector direction candidates may be determined based on the magnitude of the offset vector. As an example, when the value of the variable DistFromMergeMV for determining the magnitude of the offset vector is equal to or smaller than the threshold, the eight vector direction candidates exemplified in Table 9 or Table 10 may be used. On the other hand, when the value of the variable DistFromMergeMV is greater than the threshold, the four vector direction candidates exemplified in Table 8 may be used.
[0358] Alternatively, at least one of the number or magnitude of the vector direction candidates may be determined based on the value MVx of the x component and the value MVy of the y component of the initial motion vector. As an example, when the MVx and MVy difference or the absolute value of the difference is equal to or less than a threshold, the eight vector direction candidates exemplified in Table 9 or Table 10 may be used. On the other hand, when the MVx and MVy difference or the absolute value of the difference is greater than the threshold, the four vector direction candidates exemplified in Table 8 may be used.
[0359] The motion vector of the current block may be derived by adding the offset vector to the initial motion vector. Equation 10 shows an example of determining the motion vector of the current block.
[0360] [Formula 10]
[0361]
number
[0362] In Equation 10, mvL0 indicates the L0 motion vector of the current block, mvL1 indicates the L1 motion vector of the current block, mergeMVL0 indicates the L0 initial motion vector of the current block (i.e., the L0 motion vector of the merge candidate), and mergeMVL1 indicates the L1 initial motion vector of the current block. [0] indicates the horizontal component of the motion vector, and [1] indicates the vertical component of the motion vector.
[0363] The merge offset vector encoding method may also be applied when a coding block is divided into a plurality of subunits and then inter prediction is performed for each subunit. Here, performing inter prediction on a subunit basis may include at least one of Advanced Temporal Motion Vector Prediction (ATMVP), Spatial Temporal Motion Vector Prediction (STMVP), or triangular division techniques.
[0364] As an example, in the ATMVP method, the initial motion vector can be derived as follows.
[0365] First, an initial shift vector can be derived using a motion vector of a merging candidate derived from a neighboring block adjacent to a coding block. Then, a shift block of a sub-block included in the coding block can be derived using the initial shift vector. Equation 11 shows the position of the shift block.
[0366] [Formula 11]
[0367]
number
[0368] In Equation 11, (xColSb, yColSb) indicates the position of the upper left sample of the shift block, (xSb, ySb) indicates the position of the upper left sample of the sub-block, and shVector indicates a shift vector.
[0369] Once the shift block is determined, the motion vector of the collocated block that is at the same position as the shift block in the collocated picture can be set as the motion vector of the sub-block, i.e., the motion vector of the collocated block that includes a sample at the (xColSb, yColSb) position in the collocated block can be set as the motion vector of the sub-block that includes a sample at the (xSb, ySb) position.
[0370] When a triangular partitioning method is applied, the coding block may be divided into triangular subunits. As an example, the coding block may be divided into two subunits by a diagonal line connecting the upper left corner and the lower right corner of the coding block or a diagonal line connecting the upper right corner and the lower left corner of the coding block.
[0371] FIG. 30 is a diagram illustrating a manner in which a coding block is divided when a triangular division technique is applied.
[0372] The motion information of each subunit of the triangle may be identified by a merge candidate. For each subunit, index information indicating one of the merge candidates may be signaled. As an example, index information merge_1st_idx of a first subunit may identify a merge candidate of the first subunit, and index information merge_2nd_idx of a second subunit may identify a merge candidate of the second subunit.
[0373] The initial motion vector of each sub-unit may be determined individually. For example, when an affine motion model is applied to a coding block, an affine vector of a sub-block derived from an affine seed vector of the coding block may be set as an initial motion vector of the sub-block. The motion vector of each sub-block may be derived by adding or subtracting an offset vector to the initial motion vector.
[0374] When the merge offset vector encoding method is applied to a coding block divided into multiple sub-units, the multiple sub-units can be configured to use the same offset vector, i.e., the initial motion vectors of each of the multiple sub-units can be modified using the same offset vector.
[0375] Alternatively, the coding block may be divided into multiple subunits, and the offset vector of each subunit may be determined individually, so that the offset vector of at least one of the subunits may be set to be different from the offset vectors of the other subunits.
[0376] FIG. 31 is a diagram showing an example in which the offset vectors of the subunits are set to be different from each other.
[0377] As shown in the example of FIG. 31, information distance_idx indicating the magnitude of the offset vector and information direction_idx indicating the direction of the offset vector can be encoded and signaled for each subunit.
[0378] Alternatively, the magnitude of the offset vectors of all subunits may be set to be the same, but the direction of the offset vectors of the subunits may be set individually. For example, the subunits may be set to share the value of distance_idx signaled at the coding level, and the direction_idx may be encoded and signaled for each subunit.
[0379] Alternatively, the directions of the offset vectors of all subunits may be set to be the same, but the magnitudes of the offset vectors of the subunits may be set individually. For example, the subunits may be set to share a value of direction_idx signaled at the coding level, and distance_idx may be encoded and signaled for each subunit.
[0380] The merge offset vector encoding method may be applied to only some of the subunits generated by dividing a coding block. For example, when a current block is divided into a first subunit and a second subunit, a motion vector of the first subunit may be set to be equal to a motion vector of a merge candidate, and a motion vector of the second subunit may be derived by adding an offset vector to the motion vector of the merge candidate.
[0381] Instead of signaling information for determining the offset vector, the decoder may derive the offset vector. Specifically, the offset vector may be derived using an average value of horizontal gradients and an average value of vertical gradients of prediction samples included in the sub-block.
[0382] Here, the gradient may be derived based on a difference between a reconstructed sample corresponding to a predicted sample in a reference picture and adjacent samples adjacent to the reconstructed sample. For example, a horizontal gradient may indicate a difference between a reconstructed sample and its adjacent left and / or right side reconstructed samples, and a vertical gradient may indicate a difference between a reconstructed sample and its adjacent top and / or bottom side reconstructed samples.
[0383] Among the merge candidates included in the merge candidate list, a merge candidate having a motion vector derived by adding or subtracting an offset vector to the motion vector of a reference merge candidate may be added to the merge candidate list. A merge candidate having a motion vector derived by adding or subtracting an offset vector to the motion vector of a reference merge candidate may be referred to as a refine merge candidate.
[0384] The remaining motion information of the refine merge candidate, except for the motion vector, may be set to be the same as that of the reference merge candidate.
[0385] FIG. 32 is a diagram showing motion vector candidates that can be taken by refine merge candidates.
[0386] If the motion vector of the base merge candidate is (MvLX[0], MvLX[1]), the motion vector of the refine merge candidate may be derived by adding or subtracting an offset to at least one of the x-component or y-component of the motion vector of the base merge candidate. As an example, the motion vector of the refine merge candidate may be set to (MvLX[0]+M, MvLX[1]), (MvLX[0]-M, MvLX[1]), (MvLX[0], MvLX[1]+M), or (MvLX[0], MvLX[1]-M), where M indicates the magnitude of the offset vector.
[0387] The reference merge candidate may be a merge candidate having a predefined index value in the merge candidate list. As an example, among the merge candidates included in the merge candidate list, a merge candidate having the smallest index value (i.e., a merge candidate having an index value of 0) or a merge candidate having the largest index value may be set as the reference merge candidate. Alternatively, an inter region merge candidate having the smallest index value or an inter region merge candidate having the largest index value in the inter region motion information table may be set as the reference merge candidate.
[0388] Alternatively, among the merge candidates having bidirectional motion information, the merge candidate with the smallest index value may be set as the reference merge candidate, i.e., when candidate blocks are searched in order, the first bidirectional merge candidate found may be set as the reference merge candidate.
[0389] A base merge candidate may also be selected based on the size, shape, or whether the current block borders a coding tree unit boundary. For example, if the current block is square or non-square with its height greater than its width, a merge candidate with index 0 or a merge candidate derived from an adjacent block located at the top of the current block may be set as a base merge candidate. If the current block is non-square with its width greater than its height, a merge candidate with index 1 or a merge candidate derived from an adjacent block located to the left of the current block may be set as a base merge candidate.
[0390] Alternatively, information identifying the reference merging candidate may be signaled via the bitstream, which may be index information identifying any one of the merging candidates included in the merging candidate list.
[0391] Information indicating whether to use a refine merge candidate may be signaled via a bitstream. The information may be a 1-bit flag. If the value of the flag is 1, the refine merge candidate generated based on the reference merge candidate may be added to a merge candidate list. On the other hand, if the value of the flag is 0, the merge candidate list does not include the refine merge candidate.
[0392] Alternatively, if the number of merge candidates already added to the merge candidate list is less than the maximum number of merge candidates that the merge candidate list can include, the refine merge candidate may be added to the merge candidate list. Here, the already added merge candidates may include at least one of a spatial merge candidate, a temporal merge candidate, an inter-region merge candidate, or a pair-wise merge candidate. As an example, if the number of at least one of a spatial merge candidate, a temporal merge candidate, or an inter-region merge candidate included in the merge candidate list is less than or equal to a threshold, the refine merge candidate may be added to the merge candidate list.
[0393] Alternatively, refine merge candidates may be used if the number of merge candidates already added to the merge candidate list is equal to or exceeds a threshold.
[0394] The maximum number of merge candidates that the merge candidate list can include can be set differently depending on whether or not refine merge candidates are used. For example, when it is set not to use refine merge candidates, the maximum number of merge candidates that the merge candidate list can include can be set to N, whereas when it is set to use refine merge candidates, the maximum number of merge candidates that the merge candidate list can include can be set to N+n.
[0395] A refine merge candidate can have a higher index than a merge candidate already added to the merge candidate list. As an example, Table 11 shows an example of the composition of a merge candidate list.
[0396] [Table 11]
[0397] In Table 11, mergeCand[X] indicates a merge candidate whose index is X. mvLx[0] indicates the x-component motion vector of the base merge candidate, and mvLx[1] indicates the y-component motion vector of the base merge candidate. As an example, if the base merge candidate is mergeCand[0], mvLx[0] and mvLx[1] may indicate the motion vector of mergeCand[0].
[0398] The magnitude M of the offset vector may be predefined in the encoder and the decoder. For example, the magnitude M of the offset vector may be set to an integer equal to or less than 4, such as 1 or 4.
[0399] Alternatively, information for determining the offset vector may be signaled via a bitstream. The information may be signaled at a sequence, picture, slice, or block level. As an example, the offset vector may be determined using at least one of the above-mentioned information distance_idx for determining the magnitude of the offset vector or information direction_idx for determining the direction of the offset vector.
[0400] As shown in the example of Table 11, at least one refine merge candidate derived based on the reference merge candidate may be added to the merge candidate list. If there is a merge candidate whose motion information is the same as that of the refine merge candidate among the already added merge candidates, the refine merge candidate may not be added to the merge candidate list. As an example, if a refine merge candidate derived based on the reference merge candidate mergeCand[0] is the same as any one of mergeCand[1] to mergeCand[5], the refine merge candidate may not be added to the merge candidate list.
[0401] Alternatively, if there is a merge candidate whose motion information is the same as that of the refine merge candidate, the refine merge candidate may be re-derived by changing the offset vector or resetting the merge candidate whose motion information is the same as that of the refine merge candidate to the refine merge candidate. As an example, if the motion information of the refine merge candidate mergeCand[6] derived based on the reference merge candidate mergeCand[0] is the same as that of the merge candidate mergeCand[2], the motion vector of the refine merge candidate mergeCand[6] may be changed to a value obtained by adding or subtracting the offset vector to the motion vector of the merge candidate mergeCand[2]. As an example, the motion vector of mergeCand[6] may be changed from (mergeCand[0]_mxLx[0]+M, mergeCand[0]_mvLx[1]) to (mergeCand[2]_mxLx[0]+M, mergeCand[2]_mvLx[1]). Here, mergeCand[X]_mvLx indicates the motion vector of the merge candidate whose index is X.
[0402] As another example, an offset vector may be determined using a merge refinement offset list including at least one merge offset candidate. If a merge candidate identified by index information of a current block is a reference merge candidate, an offset vector may be determined using a merge refinement offset list. Then, a motion vector of the current block may be derived by adding or subtracting the offset vector to or from the motion vector of the merge candidate. The reference merge candidate may be a merge candidate having a predefined index value in the merge candidate list. As an example, among the merge candidates included in the merge candidate list, a merge candidate having the smallest index value (i.e., a merge candidate having an index value of 0) or a merge candidate having the largest index value may be set as the reference merge candidate. Alternatively, an inter region merge candidate having the smallest index value or an inter region merge candidate having the largest index value in an inter region motion information table may be set as the reference merge candidate.
[0403] FIG. 33 is a diagram showing the structure of a merge refinement offset list.
[0404] In FIG. 33, assume that the reference merge candidate is the merge candidate with index 6.
[0405] If the index of the merge candidate identified by the index information merge_idx indicating any one of the merge candidates is not 6, the motion vector of the merge candidate may be set as the motion vector of the current block.
[0406] On the other hand, if the index of the merge candidate identified by the index information merge_idx is 6, an offset vector can be derived using the merge refinement offset list. Index information MrgOffset_idx that identifies one of the merge offset candidates included in the merge refinement offset list can be signaled via the bitstream.
[0407] Once the offset vector is identified, the offset vector can be added or subtracted from the motion vector of the reference merge candidate to derive the motion vector of the current block.
[0408] The merge refinement offset list may include at least one or more merge offset candidates. For example, the number of merge offset candidates included in the merge refinement offset list may be 4, 8, or 16.
[0409] 34 and 35 are diagrams showing offset vectors specified by merge offset candidates.
[0410] FIG. 34 shows an example in which the number of merge offset candidates is eight, and FIG. 35 shows an example in which the number of merge offset candidates is sixteen.
[0411] As shown in the example of (a) of Figure 34, the offset vectors indicated by the merge offset candidates may be set so that the absolute value of the horizontal motion vector and / or the absolute value of the vertical motion vector have a fixed value. Alternatively, as shown in the example of Figure 35, the offset vectors indicated by the merge offset candidates having an index smaller than a threshold among the merge offset candidates may be set so that the absolute value of the horizontal motion vector and / or the absolute value of the vertical motion vector have a first value, and the offset vectors indicated by the other merge offset candidates may be set so that the absolute value of the horizontal motion vector and / or the absolute value of the vertical motion vector have a second value.
[0412] Alternatively, as in the example shown in (b) of Figure 34, the offset vector indicated by the merge offset candidate can be set so that the sum of the absolute value of the horizontal motion vector and the absolute value of the vertical motion vector has a fixed value.
[0413] A plurality of reference merge candidates may be set. As an example, two merge candidates having the smallest indexes among the merge candidates included in the merge candidate list may be set as the reference merge candidates. Thus, when the index of the merge candidate identified by the index information merge_idx is 0 or 1, an offset vector may be derived using the merge refinement offset list. Alternatively, the merge candidate having the smallest index among the merge candidates included in the merge candidate list and the merge candidate having the largest index among the merge candidates included in the inter-region merge candidate list may be set as the reference merge candidates.
[0414] In the motion vector prediction mode, the motion vector of the current block may be derived by adding a motion difference vector to the motion predictor vector. The motion predictor vector of the current block may be determined based on a motion vector prediction candidate list including at least one motion predictor vector candidate. As an example, any one of the motion predictor vector candidates may be set as the motion predictor vector of the current block.
[0415] The motion vector prediction candidates may be derived based on at least one of the spatial neighboring blocks of the current block or the temporal neighboring blocks of the current block.
[0416] FIG. 36 is a diagram illustrating candidate blocks used to derive motion vector prediction candidates.
[0417] The spatially neighboring blocks may include a top neighboring block located at the top of the current block and a left neighboring block located to the left of the current block. The top neighboring block may include at least one of a block B0 including a sample at a position (xCb+CbW, yCb-1), a block B1 including a sample at a position (xCb+CbW-1, yCb-1), a block B2 including a sample at a position (xCb-1, yCb-1), or a block B3 including a sample at a position (xCb, yCb-1). Here, (xCb, yCb) indicates the position of the top-left sample of the current block, and CbW indicates the width of the current block. The left neighboring block may include at least one of a block A0 including a sample at a position (xCb-1, yCb+CbH), a block A1 including a sample at a position (xCb-1, yCb+CbH-1), or a block A2 including a sample at a position (xCb-1, yCb). Here, CbH denotes the height of the current block.
[0418] The temporal neighboring blocks may include at least one of block C0 containing a central sample of a block having the same position and size as the current block in the collocated block or block C1 containing a sample adjacent to the upper right corner of said block.
[0419] The maximum number of motion vector prediction candidates that the motion vector prediction candidate list can include is 2. The order of induction of the motion vector prediction candidates is as follows.
[0420] 1. If at least one of the left adjacent block A0 or the left adjacent block A1 is available, set the motion vector of the available block as a motion vector prediction candidate.
[0421] 2. If at least one of the top-end adjacent block B0, the top-end adjacent block B1, or the top-end adjacent block B2 is available, set the motion vector of the available block as a motion vector prediction candidate.
[0422] 3. If the temporal neighboring blocks are available, set the temporal motion vector as the motion vector prediction candidate.
[0423] 4. Set the zero motion vector as the motion vector prediction candidate.
[0424] Alternatively, if the number of motion vector prediction candidates induced according to the order of 1 to 3 is less than two, a motion vector included in an inter region motion information table may be set as a motion vector prediction candidate. If an inter region motion information table is available, the motion vector prediction candidates may be induced according to the following order.
[0425] 1. If at least one of the left adjacent block A0 or the left adjacent block A1 is available, set the motion vector of the available block as a motion vector prediction candidate.
[0426] 2. If at least one of the top-end adjacent block B0, the top-end adjacent block B1, or the top-end adjacent block B2 is available, set the motion vector of the available block as a motion vector prediction candidate.
[0427] 3. If the temporal neighboring blocks are available, set the temporal motion vector as the motion vector prediction candidate.
[0428] 4. The motion vectors included in the inter-region motion information table are set as motion vector prediction candidates.
[0429] 5. Set the zero motion vector as the motion vector prediction candidate.
[0430] A motion vector prediction candidate having a motion vector derived by adding or subtracting an offset vector to the motion vector of the reference motion vector prediction candidate may be added to the motion vector prediction candidate list. A motion vector prediction candidate having a motion vector derived by adding or subtracting an offset vector to the motion vector of the reference motion vector prediction candidate may be referred to as a refined motion vector prediction candidate.
[0431] FIG. 37 is a diagram showing motion vector candidates that can be set as refinement motion vector prediction candidates.
[0432] When the motion vector of the reference motion vector prediction candidate is (MvpLX[0], MvpLX[1]), the motion vector of the refine motion vector prediction candidate may be derived by adding or subtracting an offset to at least one of the x-component or y-component of the motion vector of the reference motion vector prediction candidate. As an example, the motion vector of the refine motion vector prediction candidate may be set to (MvpLX[0]+M, MvpLX[1]), (MvpLX[0]-M, MvpLX[1]), (MvpLX[0], MvpLX[1]+M), or (MvpLX[0], MvpLX[1]-M). M indicates the magnitude of the offset vector.
[0433] The magnitude M of the offset vector may be predefined in the encoder and the decoder. For example, the magnitude M of the offset vector may be set to an integer equal to or less than 4, such as 1 or 4.
[0434] Alternatively, information for determining the offset vector may be signaled via a bitstream. The information may be signaled at a sequence, picture, slice, or block level. As an example, the offset vector may be determined using at least one of the above-mentioned information distance_idx for determining the magnitude of the offset vector or information direction_idx for determining the direction of the offset vector.
[0435] The reference motion vector prediction candidate may be a motion vector prediction candidate having a predefined index value in the motion vector prediction candidate list. For example, among the motion vector prediction candidates included in the motion vector prediction candidate list, a motion vector prediction candidate having an index value of 0 or a motion vector prediction candidate having an index value of 1 may be set as the reference motion vector prediction candidate.
[0436] As another example, an offset vector may be determined using a merge refinement offset list including at least one or more predictor offset candidates. If a motion vector prediction candidate identified by index information of a current block is a reference motion vector prediction candidate, an offset vector may be determined using a predictor refinement offset list. Then, a motion predictor vector of a current block may be derived by adding or subtracting the offset vector to a motion vector of the motion vector prediction candidate. The reference motion vector prediction candidate may be a motion vector prediction candidate having a predefined index value in the motion vector prediction candidate list. As an example, a motion vector prediction candidate having the smallest index value or the largest index value among the motion vector prediction candidates included in the motion vector prediction candidate list may be set as a reference motion vector prediction candidate.
[0437] When calculating an offset vector using a predictor vector offset refinement list, the maximum number of predictor vector candidates that the predictor vector candidate list can include can be set to a value greater than two.
[0438] FIG. 38 is a diagram showing the structure of a predicted vector refinement offset list.
[0439] In FIG. 38, it is assumed that the reference predictor vector candidate is the predictor vector candidate with index 2.
[0440] When the index of the predictor vector candidate identified by the index information AMVPcand_idx indicating any one of the predictor vector candidates is not 2, the motion vector of the predictor vector candidate may be set as the motion predictor vector of the current block.
[0441] Meanwhile, when the index of the predictor vector candidate identified by the index information AMVPcand_idx is 2, an offset vector may be derived using a predictor vector refinement offset list. Index information AMVPOffset_idx that identifies one of the predictor vector offset candidates included in the predictor vector refinement offset list may be signaled via a bitstream.
[0442] Once the offset vector is identified, the offset vector may be added or subtracted from the motion vector of the reference candidate predictor vector to derive the motion predictor vector for the current block.
[0443] A motion vector refinement technique may also be used when a coding block is encoded based on an affine motion model. For example, when an affine motion vector prediction mode is applied, an affine seed vector of a coding block may be derived by adding an affine seed differential vector to an affine seed prediction vector. Here, the affine seed prediction vector may be derived based on an affine seed vector of a spatially adjacent block or a temporally adjacent block of the coding block. The affine seed differential vector may be determined based on information signaled from a bitstream. In this case, the same affine seed differential vector may be applied to all control points. Alternatively, information for determining an affine seed vector may be signaled to each control point.
[0444] When the affine vectors of the sub-blocks are derived based on the affine seed vector of the coding block, the affine vectors can be set as initial motion vectors, and then offset vectors can be derived. The motion vectors of each sub-block can be derived by adding or subtracting the offset vector from the initial motion vector.
[0445] Instead of signaling information for determining the offset vector, the decoding may derive the offset vector. Specifically, the offset vector may be derived using an average value of horizontal gradients and an average value of vertical gradients of prediction samples included in the sub-block.
[0446] Intra prediction predicts a current block using reconstructed samples encoded / decoded around the current block. In this case, reconstructed samples before an in-loop filter is applied can be used for intra prediction of the current block.
[0447] The intra prediction technique includes intra prediction based on a matrix and general intra prediction considering the direction with respect to the surrounding reconstruction samples. Information indicating the intra prediction technique of the current block may be signaled through a bitstream. The information may be a 1-bit flag. Alternatively, the intra prediction technique of the current block may be determined based on at least one of the position, size, shape, or intra prediction technique of a neighboring block of the current block. As an example, if the current block is located beyond the picture boundary, the matrix-based intra prediction may be set not to be applied to the current block.
[0448] Matrix-based intra prediction is a method of obtaining a prediction block of a current block based on a matrix multiplication between a matrix already stored in an encoder / decoder and reconstructed samples around the current block. Information for identifying any one of a plurality of already stored matrices may be signaled via a bitstream. The decoder may determine a matrix for intra prediction of the current block based on the information and the size of the current block.
[0449] General intra prediction is a method of obtaining a prediction block of a current block based on a non-directional intra prediction mode or a directional intra prediction mode.
[0450] A predicted video can be subtracted from an original video to generate an induced residual video. In this case, when the residual video is converted to a frequency domain, even if high-frequency components among the frequency components are removed, the subjective image quality of the video does not decrease significantly. Therefore, by converting the values of the high-frequency components to smaller values or setting the values of the high-frequency components to 0, visual distortion is not significantly generated, and compression efficiency is improved. Reflecting the above characteristics, the current block can be transformed to decompose the residual video into two-dimensional frequency components. The transformation can be performed using a transformation technique such as DCT (Discrete Cosine Transform) or DST (Discrete Sine Transform).
[0451] The current block may be transformed using a DCT or DST, and then the transformed current block may be transformed again, where the transformation based on the DCT or DST may be defined as a first transformation, and the transformation of the block to which the first transformation has been applied may be defined as a second transformation.
[0452] The first transform may be performed using any one of a number of transform core candidates. As an example, the first transform may be performed using any one of DCT2, DCT8, or DCT7.
[0453] Different transform cores may be used for the horizontal and vertical directions, and information indicating the combination of horizontal and vertical transform cores may be signaled via the bitstream.
[0454] The execution units of the first transform and the second transform may be different. For example, an 8×8 block may perform the first transform, and a 4×4 size sub-block of the transformed 8×8 block may perform the second transform. In this case, the transform coefficients of the remaining area where the second transform is not performed may be set to 0.
[0455] Alternatively, the 4x4 block may undergo a first transformation and an 8x8 sized region containing the transformed 4x4 block may undergo a second transformation.
[0456] Information indicating whether or not to perform the second transformation can be signaled via the bitstream.
[0457] The decoder may perform an inverse transform (second inverse transform) of the second transform, and perform an inverse transform (first inverse transform) of the first transform on the result of the second inverse transform. As a result of performing the second inverse transform and the first inverse transform, a residual signal of the current block may be obtained.
[0458] Quantization is intended to reduce the energy of a block, and the quantization process involves dividing the transform coefficients by a certain constant value, which may be derived from a quantization parameter, which may be defined as a value between 1 and 63.
[0459] After the encoder performs the transform and quantization, the decoder can obtain a residual block through inverse quantization and inverse transform. The decoder can obtain a reconstructed block of the current block by adding the predicted block and the residual block.
[0460] When a reconstruction block of the current block is obtained, information loss occurring during quantization and encoding can be reduced through in-loop filtering. The in-loop filter may include at least one of a deblocking filter, a sample adaptive offset filter (SAO), or an adaptive loop filter (ALF).
[0461] It is within the scope of the present invention to apply the embodiments described with respect to a decoding process or an encoding process to an encoding process or a decoding process. It is also within the scope of the present invention to modify the embodiments described in a certain order to an order different from that described.
[0462] Although the above-described embodiments are described based on a series of steps or flow charts, this does not limit the chronological order of the present invention, and the steps may be performed simultaneously or in another order as necessary. In addition, in the above-described embodiments, each of the components (e.g., units, modules, etc.) constituting the block diagrams may be embodied in a hardware device or software, and multiple components may be combined and embodied in one hardware device or software. The above-described embodiments may be embodied in the form of program commands executed by various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program commands, data files, data structures, etc., alone or in combination. Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes, optical recording media such as CD-ROMs and DVDs, magneto-optical media such as floptical disks, and hardware devices specially configured to store and execute program commands, such as ROMs, RAMs, flash memories, etc. The hardware devices may be configured to operate using one or more software modules to perform the processes according to the present invention, and vice versa.
[0463] The present invention can be applied to electronic devices that encode / decode video.
Claims
1. 1. A video decoding method, comprising: determining whether a merge offset vector encoding method is applied to the current block; generating a merge candidate list for the current block; identifying merging candidates for the current block based on the merging candidate list; deriving a motion vector for the current block based on the merging candidates; Including, When the merging offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to the motion vector of the merging candidate; at least one of the maximum or minimum values of the vector magnitude candidates is set differently depending on the accuracy of the motion vector for the current block; 13. A video decoding method comprising:
2. the magnitude of the offset vector is determined based on first index information identifying one of vector magnitude candidates; 2. The video decoding method of claim 1.
3. At least one of the maximum or minimum values of the vector magnitude candidates is set to be different based on a value of a flag indicating the numerical value of the vector magnitude candidates, the flag being signaled at a picture level.
3. The video decoding method of claim 2.
4. The direction of the offset vector is determined based on second index information that identifies one of vector direction candidates. Video decoding method according to any one of claims 2 to 3.
5. 1. A video encoding method, comprising: determining whether a merge offset vector encoding method is applied to the current block; generating a merge candidate list for the current block; identifying merging candidates for the current block based on the merging candidate list; deriving a motion vector for the current block based on the merging candidates; Including, When the merging offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to the motion vector of the merging candidate; at least one of the maximum or minimum values of the vector magnitude candidates is set differently depending on the accuracy of the motion vector for the current block; 13. A video encoding method comprising:
6. encoding first index information for identifying a vector magnitude candidate indicating a magnitude of the offset vector among a plurality of vector magnitude candidates; 6. The video encoding method of claim 5.
7. The method further includes a step of encoding a flag indicating a value of the vector magnitude candidate, wherein at least one of a maximum value or a minimum value of the vector magnitude candidate is set to be different depending on a value of the flag, and the flag is encoded at a picture level.
7. The video encoding method of claim 6.
8. encoding second index information for identifying a vector direction candidate indicating a direction of the offset vector among a plurality of vector direction candidates; Video encoding method according to any one of claims 6 to 7.
9. 1. A video decoder comprising: A processor and a memory, The memory is adapted to store a computer program, and the processor is adapted to execute the method according to any one of claims 1 to 4 by executing the computer program stored in the memory.
1. A video decoder comprising:
10. 1. A video encoder comprising: A memory and a processor are included. The memory is adapted to store a computer program, and the processor is adapted to execute the method according to any one of claims 5 to 8 by executing the computer program stored in the memory.
1. A video encoder comprising:
11. A video decoding device, comprising: an inter prediction unit configured to determine whether a merge offset vector encoding method is applied to a current block, generate a merge candidate list for the current block, identify merge candidates for the current block based on the merge candidate list, and derive a motion vector for the current block based on the merge candidates; When the merging offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to the motion vector of the merging candidate, and at least one of a maximum value or a minimum value of a vector magnitude candidate is set to be different depending on a precision of the motion vector for the current block. A video decoding device comprising:
12. 1. A video encoding device, comprising: an inter prediction unit configured to determine whether a merge offset vector encoding method is applied to a current block, generate a merge candidate list for the current block, identify merge candidates for the current block based on the merge candidate list, and derive a motion vector for the current block based on the merge candidates; When the merging offset vector encoding method is applied to the current block, a motion vector of the current block is derived by adding an offset vector to the motion vector of the merging candidate, and at least one of a maximum value or a minimum value of a vector magnitude candidate is set to be different depending on a precision of the motion vector for the current block. A video encoding device comprising:
13. 1. A computer-readable storage medium, comprising: A method for performing the method according to any one of claims 1 to 4 or any one of claims 5 to 8, A computer-readable storage medium comprising: