Video encoding / decoding method, video encoder, video decoder, video encoding device, video decoding device, and computer-readable storage medium
The merge offset vector encoding method enhances video compression efficiency by refining motion vectors with offset vectors, addressing the data volume challenges in high-definition video services.
Patent Information
- Application Number
- JP2025060630
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2018-12-21
- Filing Date
- 2025-04-01
- Publication Date
- 2026-01-22
- Estimated Expiration
- 2039-11-08
AI Technical Summary
The increasing demand for high-definition video services has led to a significant increase in data volume, and existing video compression standards like HEVC are reaching their performance limits, necessitating improved video compression techniques.
A method for video encoding and decoding that utilizes a merge offset vector encoding technique to derive motion vectors by adding an offset vector to a merge candidate, with adaptive determination of offset vector magnitude and direction, and optional encoding of index information based on the number of merge candidates.
This approach enhances the efficiency of inter prediction by refining motion vectors using offset vectors, improving compression performance and reducing data volume in high-definition video services.
Smart Images

Figure 0007804811000023 
Figure 0007804811000024 
Figure 0007804811000025
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 continue to grow larger, higher quality video services are increasingly required. The biggest problem with high-definition video services is the significant increase in data volume. To address this issue, active research is being conducted to improve video compression rates. As a representative example, in 2009, the Motion Picture Experts Group (MPEG) and the Video Coding Experts Group (VCEG) under the International Telecommunication Union-Telecommunication (ITU-T) formed the Joint Collaborative Team on Video Coding (JCT-VC). JCT-VC proposed High Efficiency Video Coding (HEVC), a video compression standard with approximately twice the compression performance of H.264 / AVC, and the standard was approved on January 25, 2013. With the rapid development of high-definition video services, HEVC's performance is increasingly reaching 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 determining whether a merge offset vector encoding method is applicable to a current block, generating a merge candidate list for the current block, identifying merge candidates for the current block based on the merge candidate list, and deriving a motion vector for the current block based on the merge candidates. If the merge offset vector encoding method is applicable 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 one, 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 applicable to a current block; generating a merge candidate list for the current block; identifying merge candidates for the current block based on the merge candidate list; and deriving a motion vector for the current block based on the merge candidates. If the merge offset vector encoding method is applicable to the current block, the motion vector of the current block is derived by adding an offset vector to the 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. If the maximum number is 1, encoding of the index information is omitted.
[0006] A video decoder according to the present invention includes a processor and a memory, the memory being configured to store a computer program, and the processor executing the computer program stored in the memory determines whether a merge offset vector encoding method is applicable 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 applicable to the current block, the motion vector for the current block is derived by adding an offset vector to the 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 one, the merge candidate is determined without decoding the index information.
[0007] A video encoder according to the present invention includes a processor and a memory, the memory being configured to store a computer program, and the processor executing the computer program to determine whether a merge offset vector encoding method is applicable 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 applicable to the current block, the motion vector for the current block is derived by adding an offset vector to the motion vector of the merge candidate. If the maximum number of merge candidates that the merge candidate list can include is plural, index information indicating the merge candidate for the current block among the merge candidates is encoded. 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; 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, the motion vector for the current block is derived by adding an offset vector to the 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 one, the merge candidate is determined without decoding the index information.
[0009] A video encoding apparatus according to the present invention includes 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 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 plural, index information indicating the merge candidate for the current block among the merge candidates is encoded. If the maximum number is one, encoding of the index information is omitted.
[0010] A computer-readable storage medium according to the present invention is used to store a computer program, which, when executed by a processor, performs a video decoding method or a video encoding method. [Brief explanation 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. [Figure 2] FIG. 2 is a block diagram showing a video decoder (decoder) according to one embodiment of the present invention. [Figure 3] FIG. 3 is a diagram illustrating 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. [Figure 5] FIG. 5 is a diagram showing division patterns of coding tree units. [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 how the inter-region motion information table is updated. [Figure 21] FIG. 21 is a diagram showing how the inter region merge candidate table is updated. [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. [Figure 25] FIG. 25 is a diagram showing an example in which inter-region merge candidates included in the long-term motion information table are added to the merge candidate list. [Figure 26] FIG. 26 shows an example in which redundancy checking is performed on only some of the merge candidates. [Figure 27] FIG. 27 shows an example in which a redundancy check with a specific merge candidate is omitted. [Figure 28] FIG. 28 is a diagram showing offset vectors based on the values of distance_idx, which indicates the magnitude of the offset vector, and direction_idx, which indicates the direction of the offset vector. [Figure 29] FIG. 29 is a diagram showing offset vectors based on the values of distance_idx, which indicates the magnitude of the offset vector, and direction_idx, which indicates the direction of the offset vector. [Figure 30] FIG. 30 is a diagram illustrating how a coding block is divided when a triangular division technique is applied. [Figure 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. [Figure 32] FIG. 32 is a diagram showing motion vector candidates that can be used as refine merge candidates. [Figure 33] FIG. 33 is a diagram showing the structure of a merge refinement offset list. [Figure 34] FIG. 34 is a diagram showing offset vectors identified by merge offset candidates. [Figure 35] FIG. 35 is a diagram showing offset vectors identified by merge offset candidates. [Figure 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 refined 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 INVENTION
[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 determining whether a merge offset vector encoding method is applicable to a current block, generating a merge candidate list for the current block, identifying merge candidates for the current block based on the merge candidate list, and deriving a motion vector for the current block based on the merge candidates. If the merge offset vector encoding method is applicable 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 one, the merge candidate may be determined without decoding the index information.
[0014] In one embodiment, the magnitude of the offset vector 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 to be different based on the 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 magnitude of the offset vector 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 any one of vector direction candidates.
[0020] A video encoding method according to the present invention includes the steps of: determining whether a merge offset vector encoding method is applicable to a current block; generating a merge candidate list for the current block; identifying merge candidates for the current block based on the merge candidate list; and deriving a motion vector for the current block based on the merge candidates. If the merge offset vector encoding method is applicable to the current block, the motion vector of the current block is derived by adding an offset vector to the 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. 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 indicating 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 the maximum or minimum values 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] A video decoder according to the present invention includes a processor and a memory, the memory being configured to store a computer program. The processor executes the computer program stored in the memory to determine whether a merge offset vector encoding method is applicable 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 applicable to the current block, the motion vector for the current block is derived by adding an offset vector to the 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 one, the merge candidate is determined without decoding the index information.
[0028] A video encoder according to the present invention includes a processor and a memory, the memory being configured to store a computer program, and the processor executing the computer program to determine whether a merge offset vector encoding method is applicable 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 applicable to the current block, the motion vector for the current block is derived by adding an offset vector to the motion vector of the merge candidate. If the maximum number of merge candidates that the merge candidate list can include is plural, index information indicating the merge candidate for the current block among the merge candidates is encoded. 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; 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, the motion vector for the current block is derived by adding an offset vector to the 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 one, the merge candidate is determined without decoding the index information.
[0030] A video encoding apparatus according to the present invention includes 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 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 plural, index information indicating the merge candidate for the current block among the merge candidates is encoded. If the maximum number is one, encoding of the index information is omitted.
[0031] A computer-readable storage medium according to the present invention is used to store 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 merge 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 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 reconstruction may be performed on coding blocks, transform blocks, or prediction blocks.
[0037] Hereinafter, the block to be encoded / decoded is referred to as a “current block.” For example, depending on the current encoding / decoding process step, the current block may refer to a coding block, a transform block, or a prediction block.
[0038] Furthermore, as used herein, the term "unit" refers to a basic unit for performing a specific encoding / decoding process, and the term "block" refers to a sample array of a predetermined size. Unless otherwise specified, the terms "block" and "unit" may be used interchangeably. As an example, in the embodiments described below, the terms "coding block" and "coding unit" may be understood to 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 transform unit 130, a quantization unit 135, a realignment unit 160, an entropy coding unit 165, an inverse quantization unit 140, an inverse transform unit 145, a filter unit 150, and a memory 155.
[0041] 1 are illustrated independently to illustrate different characteristic functions of the video encoding device, but this does not mean that each component is composed of separate hardware or a single software unit. In other words, for the sake of convenience, each component is listed, and at least two of the components may be combined to form a single component, or a single component may be divided into multiple components to perform its functions. Both integrated and separated embodiments of these components are within the scope of the present invention, provided they do not deviate from the essence of the present invention.
[0042] Furthermore, some components may not be essential for performing the essential functions of the present invention, but may be optional components merely for improving performance. The present invention may include only components essential for realizing the essence of the present invention, excluding components merely used for improving performance, and a structure including only necessary components, excluding optional components merely used for improving 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. In this case, 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 plurality of combinations of coding units, prediction units, and transform units, and may select one combination of coding units, prediction units, and transform units based on a predetermined criterion (e.g., a cost function) to encode the picture.
[0044] For example, a 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. A coding unit that is divided into other coding units, with one video or largest coding unit as the root, can have as many child nodes as 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 a 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 into at least one shape, such as a square or rectangle, of the same size within a coding unit, or may be divided such that any one of the prediction units 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 that performs inter prediction and an intra prediction unit 125 that performs intra prediction. The prediction unit 120 and 125 may determine whether to perform inter prediction or intra prediction for a prediction unit, and may determine specific information (e.g., intra prediction mode, motion vector, reference picture, etc.) according to each prediction method. The processing unit in which the prediction is performed may differ from the processing unit in which the prediction method and specific information are determined. For example, the prediction method and prediction mode may be determined in the prediction unit, and the prediction may be performed in the transform unit. Residual values (residual blocks) between the generated prediction block and the original block may be input to the transform unit 130. Information about the prediction mode and motion vectors used for prediction, along with the residual values, may be encoded by the entropy coding unit 165 and transmitted to the decoder. When a specific encoding mode is used, the prediction unit 120 and 125 may not generate a prediction block, but the original block may be encoded and transmitted to the 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 subregion within 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 generates sub-integer pixel information in the reference picture. In the case of luminance pixels, a DCT-based 8-tab interpolation filter whose filter coefficients change to generate sub-integer pixel information in 1 / 4 pixel units may be used. In the case of chrominance signals, a DCT-based 4-tab interpolation filter whose filter coefficients change to generate sub-integer pixel information in 1 / 8 pixel units may be used.
[0051] The motion prediction unit may perform motion prediction based on the reference picture interpolated by the reference picture interpolator. Various methods, such as a full search-based block matching algorithm (FBMA), a three-step search algorithm (TSS), or a new three-step search algorithm (NTS), may be used to calculate a motion vector. The motion vector may have a motion vector value in half or quarter pixel units based on the interpolated pixel. The motion prediction unit may predict the current prediction unit by changing the motion prediction method. Various methods, such as a skip method, a merge method, an advanced motion vector prediction method (AMVP), or an intra block copy method, may be used as the motion prediction method.
[0052] The intra prediction unit 125 may generate a prediction unit based on reference pixel information surrounding a current block, which is pixel information of the current picture. If a neighboring block of the current prediction unit is an inter-predicted block and the reference pixel is an inter-predicted pixel, the reference pixel included in the inter-predicted block may be replaced with reference pixel information of a neighboring intra-predicted block. In other words, if a reference pixel is unavailable, 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 the 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 used 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 located to the left, the pixel located to the top left, and the pixel located at the top. 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 NxN partitioning can be used only for the smallest coding unit.
[0055] The intra prediction method may generate a predicted block after applying an adaptive intra smoothing (AIS) 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 a current prediction unit may be predicted from the intra prediction mode of prediction units surrounding the current prediction unit. When predicting the prediction mode of the current prediction unit using mode information predicted from surrounding prediction units, if the intra prediction modes of the current prediction unit and the surrounding prediction units are the same, information indicating that the prediction modes of the current prediction unit and the surrounding prediction units are the same may be transmitted using predetermined flag information. If the prediction modes of the current prediction unit and the surrounding prediction units are different, entropy coding may be performed to encode the prediction mode information of the current block.
[0056] In addition, a residual block including residual information, which is a difference value between a prediction unit predicted based on the prediction unit generated by the prediction units 120 and 125 and the original block of the prediction unit, may be generated. The generated residual block may be input to the transform unit 130.
[0057] The transform unit 130 may transform a residual block containing residual value information between an original block and a prediction unit generated by the predictor 120 or 125 using a transform method such as a Discrete Cosine Transform (DCT) or a Discrete Sine Transform (DST). Here, the DCT transform core includes at least one of a DCT2 or a DCT8, and the DST transform core includes a DST7. Whether to apply a DCT or a 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. Transform skipping may be permitted for residual blocks, luma components, or chroma components 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 reorder coefficient values for the quantized residual values.
[0060] The reordering unit 160 may convert two-dimensional block configuration coefficients into one-dimensional vector form using a coefficient scanning method. For example, the reordering unit 160 may convert two-dimensional block configuration coefficients into one-dimensional vector form by scanning from DC coefficients to high-frequency region coefficients using a zig-zag scan method. Depending on the size of the transform unit and the intra prediction mode, vertical scanning, which scans two-dimensional block configuration coefficients in a column direction, or horizontal scanning, which scans two-dimensional block configuration coefficients in a row direction, may be used instead of zig-zag scanning. That is, depending on the size of the transform unit and the intra prediction mode, it may be determined which scanning method to use among zig-zag scanning, vertical scanning, and horizontal scanning.
[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 and 125.
[0063] The entropy coding unit 165 can entropy encode the coefficient values of the coding unit 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 transform unit 145 inversely transforms the values transformed by the transform unit 130. Residual values generated by the inverse quantization unit 140 and the inverse transform unit 145 can be combined with prediction units predicted by the motion estimation unit, motion compensation unit, and intra prediction unit included in the prediction units 120 and 125 to generate reconstructed blocks.
[0065] The filter unit 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).
[0066] A deblocking filter can remove block artifacts generated by boundaries between blocks in a reconstructed picture. To determine whether to perform deblocking, it can be determined whether to apply a deblocking filter to a current block based on the number of columns or rows of pixels contained in the block. When applying a deblocking filter to a block, a strong filter or a weak filter can be applied depending on the required deblocking filtering strength. In addition, when applying a deblocking filter, horizontal filtering and vertical filtering can be performed in parallel.
[0067] The offset correction unit can correct the offset between the deblocked video and the original video in pixel units. To perform offset correction for a specific picture, pixels included in the video can be divided into a certain number of regions, and then a region for which offset is to be performed can be determined and an offset can be applied to the corresponding region, or an offset can be applied taking into account edge information of each pixel.
[0068] Adaptive Loop Filtering (ALF) can be performed based on a comparison between the filtered restored video and the original video. After dividing the pixels in the video into predetermined groups, a filter to be applied to the corresponding group is determined, and differential filtering can be performed 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 coefficients of the ALF filter applied to each block can vary. Alternatively, the same (fixed) type of ALF filter can be applied regardless of the characteristics of the block to which it is applied.
[0069] The memory 155 can store the reconstructed blocks or pictures calculated through the filter unit 150, and the stored reconstructed blocks or pictures can 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 of the procedure of the video encoder.
[0073] The entropy decoding unit 210 may perform entropy decoding in a reverse procedure to that performed by 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 by the video encoder.
[0074] The entropy decoding unit 210 can decode information related to intra-prediction and inter-prediction performed in the encoder.
[0075] The reordering unit 215 may perform reordering on the bitstream entropy decoded by the entropy decoding unit 210 based on the reordering method performed in the encoding unit. Coefficients expressed in the form of one-dimensional vectors may be restored to coefficients in the form of two-dimensional blocks and reordered. 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 parameters 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., may 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. Alternatively, if a transform is skipped in the video encoder, the inverse transform unit 225 may not perform an inverse transform. The inverse transform may be performed based on a transmission unit determined by 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 multiple pieces of information such as a prediction method, a size of the current block, and a prediction direction.
[0078] The prediction units 230 and 235 can 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, similar to the operation of a video encoder, when intra prediction is performed, 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 located to the left, the pixel located to the top left, and the pixel located at the top. However, when intra prediction is performed, 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 NxN partitioning can be used only for the smallest coding unit.
[0080] The prediction units 230 and 235 may include a prediction unit determination unit, an inter prediction unit, and an intra prediction unit. The prediction unit determination unit receives various information, such as prediction unit information input from the entropy decoding unit 210, prediction mode information for the intra prediction method, and information related to motion prediction for the inter prediction method, to classify prediction units in the 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, including a picture preceding or following the current picture, using information necessary for inter prediction of the current prediction unit provided by the video encoder. Alternatively, the inter prediction unit may perform inter prediction based on information of several previously reconstructed regions within the current picture including the current prediction unit.
[0081] To perform inter prediction, it is possible to determine, based on the 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 within the current picture. If the prediction unit is a prediction unit that has undergone 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 interpolator, and a DC filter. The AIS filter is a unit that performs filtering on reference pixels of the current block, and may determine whether to apply a filter based on the prediction mode of the current prediction unit and apply the AIS filter. AIS filtering may be performed on reference pixels of the current block using the prediction mode of the prediction unit and AIS filter information provided by the video encoder. If the prediction mode of the 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 interpolator may interpolate the reference pixels to generate reference pixels of a pixel unit having an integer value or less. 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 decoder may receive information from the video encoder 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 correction unit may perform offset correction on the restored video based on the type of offset correction applied to the video during encoding, offset value information, and the like.
[0087] The ALF can be applied to a coding unit based on information provided by the encoder on whether to apply the ALF, ALF coefficient information, etc. Such ALF information can be provided by being included in a specific parameter set.
[0088] The memory 245 can store the reconstructed pictures or blocks for use as reference pictures or blocks, and can provide the reconstructed pictures to an output.
[0089] FIG. 3 is a diagram illustrating a basic coding tree unit according to one embodiment of the present invention.
[0090] A coding block of the largest size can be defined as a coding tree block. One picture is divided into multiple coding tree units (CTUs). A coding tree unit is a coding unit of the largest size and can also be called an LCU (Largest Coding Unit). Figure 3 shows an example in which one picture is divided into multiple coding tree units.
[0091] The size of the coding tree unit can be defined at the picture level or at the sequence level, and for this purpose, information indicating the size of the coding tree unit can be signaled by a picture parameter set or a sequence parameter set.
[0092] For example, the size of the coding tree unit for all pictures in a sequence may be set to 128 x 128. Alternatively, the size of the coding tree unit may be determined to be either 128 x 128 or 256 x 256 at the picture level. For example, the size of the coding tree unit for a first picture may be set to 128 x 128, and the size of the coding tree unit for a second picture may be set to 256 x 256.
[0093] Coding blocks may be generated by dividing a coding tree unit. A coding block indicates a basic unit for 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 for generating a predictive video. For example, the predictive encoding mode may include intra prediction (intra prediction), inter 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 a bitstream. For example, the information may be a 1-bit flag indicating whether the predictive encoding mode is an intra mode or an inter mode. Only when the predictive encoding mode of the current block is determined as an inter mode, can the current picture reference or hybrid prediction be used.
[0095] The current picture reference is used to set the current picture as a reference picture and obtain a prediction block for the current block from an area in the current picture that has already been encoded / decoded. Here, the current picture refers to 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. For 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 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, current picture reference is a prediction method using information on an area in the current picture for which encoding / decoding has been completed, and inter prediction is a prediction method using information on another picture for which encoding / decoding has been completed.
[0097] Hybrid prediction refers to an encoding mode that combines two or more of intra prediction, inter prediction, and current picture reference. For example, when hybrid prediction is applied, a first predicted block may be generated based on any one of intra prediction, inter prediction, and current picture reference, and a second predicted block may be generated based on the other one. Once the first predicted block and the second predicted block are generated, a final predicted block may be generated through an average operation or a weighted sum operation of the first predicted block and the second predicted block. Information indicating whether hybrid 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 quad-tree, binary-tree, or triple-tree partitioning, and the divided coding block may be further divided into multiple coding blocks based on quad-tree, binary-tree, or triple-tree partitioning.
[0100] Quadtree partitioning refers to a partitioning technique that divides the current block into four blocks. As a result of quadtree partitioning, the current block can be divided into four square partitions (see "SPLIT_QT" in (a) of Figure 4).
[0101] Binary tree splitting refers to a splitting technique that splits the current block into two blocks. Splitting the current block into two blocks along the vertical direction (i.e., using a vertical line that crosses the current block) can be called vertical binary tree splitting, and splitting the current block into two blocks along the horizontal direction (i.e., using a horizontal line that crosses the current block) can be called horizontal binary tree splitting. As a result of the binary tree splitting, the current block can be split into two non-square partitions. Figure 4(b) "SPLIT_BT_VER" shows the result of the vertical binary tree splitting, and Figure 4(c) "SPLIT_BT_HOR" shows the result of the horizontal binary tree splitting.
[0102] Triple tree partitioning refers to a partitioning technique for dividing a current block into three blocks. Dividing 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 dividing 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 divided 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. Figure 4(d) "SPLIT_TT_VER" shows the result of vertical triple tree partitioning, and Figure 4(e) "SPLIT_TT_HOR" shows the result of horizontal triple tree partitioning.
[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 the sequence or picture level. Thus, the maximum partitioning depth of a coding tree unit can be different for each sequence or picture.
[0104] Alternatively, the maximum splitting depth for each splitting technique can be determined individually. As an example, the maximum splitting depth allowed for quad-tree splitting may be different from the maximum splitting depth allowed for binary tree and / or triple-tree splitting.
[0105] The encoder may signal information indicating at least one of the partition type or 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 the information parsed from the bitstream.
[0106] FIG. 5 is a diagram showing division patterns of coding tree units.
[0107] Partitioning a coding block using a partitioning technique such as quad tree partitioning, binary tree partitioning, and / or triple tree partitioning can be called 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 partitioning depth of a coding block is k, the partitioning 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 higher coding block.
[0110] The partition type of the current coding block may be determined based on at least one of the partition type of an upper coding block or the 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 the top neighboring block, the left neighboring block, or the 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, the binary-tree partitioning direction, whether to perform triple-tree partitioning, or the triple-tree partitioning direction.
[0111] To determine the partitioning form of a coding block, information indicating whether the coding block is to be split can be signaled via a bitstream. The information is a 1-bit flag "split_cu_flag," which indicates that the coding block is to be split using a multi-tree partitioning technique if the flag is true.
[0112] If split_cu_flag is true, information indicating whether a coding block is quadtree split can be signaled via the bitstream. The information is a 1-bit flag split_qt_flag, and if the flag is true, the coding block can be split into four blocks.
[0113] For example, in the example shown in FIG. 5, four coding blocks with a division depth of 1 are generated as a result of quadtree division of a coding tree unit. Also, as a result of the quadtree division, it is shown that quadtree division is again applied to the first coding block and the fourth coding block among the four generated coding blocks. As a result, four coding blocks with a division depth of 2 can be generated.
[0114] Furthermore, by applying quadtree partitioning again to a 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 size of the coding block, whether the coding block is located on a picture boundary, the maximum partition depth, or the partition type of an adjacent block. If it is determined that binary tree partitioning or triple tree partitioning is to be performed on the coding block, information indicating the partitioning direction may be signaled via the bitstream. The information may be a one-bit flag mtt_split_cu_vertical_flag. Based on the flag, it may be determined whether the partitioning direction is vertical or horizontal. In addition, information indicating whether binary tree partitioning or triple tree partitioning is to be applied to the coding block may be signaled via the bitstream. The information may be a one-bit flag mtt_split_cu_binary_flag. Based on the flag, it may be determined whether binary tree partitioning or triple tree partitioning is to be applied to the coding block.
[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 blocks 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 video encoding or decoding device, a problem occurs in that an area larger than a threshold of hardware performance is difficult to process. For example, if the hardware performance allows simultaneous processing of up to 4096 samples, a problem occurs in that an area having more than 4096 samples requires overlapping access and processing of 64x64 size data units, and the problem occurs in that 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 contain a number of samples equal to or smaller than the maximum number of samples that can be simultaneously processed. For example, a 64x64 square block may be set as the data elementary unit, as shown in (a) of FIG. 6. Alternatively, a non-square block may be set as the data elementary unit. For example, a 32x128 block or a 64x32 block may be set as the data elementary unit, as shown in (b) or (c) of FIG. 6.
[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 a bitstream. The information may be for determining at least one of the size or 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 and shape of the elementary unit of data.
[0124] Whether or not to allow a coding block division form may be determined taking into account 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 allowed. Alternatively, 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 allowed. For example, if the 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 allowed. As a result, 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 elementary unit. Alternatively, it may be set to always perform binary tree splitting or triple tree splitting for a coding block larger than a data elementary unit. Thus, for a coding block larger than a data elementary unit, even if the flag split_flag indicating whether to split the coding block is not encoded, the flag value can be induced to 1.
[0126] As another example, a coding block larger than a data basic unit may be divided into multiple sub-blocks. Here, the sub-blocks may be set to prediction units, which are basic units for prediction, or transform units, which are basic units for transformation and / or quantization. In this case, dividing a coding block into multiple prediction units may be defined as VPDU prediction unit partitioning, and dividing a coding block into multiple 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 a coding block. The partition type of a coding block resulting from application of VPDU prediction unit partitioning may be set to be the same as the partition type of a coding block resulting from application of VPDU transformation unit partitioning.
[0128] When only VPDU prediction unit partitioning is applied to a coding block, prediction is performed for each sub-block, 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 on sub-blocks, but transform and / or quantization can be performed on a sub-block basis.
[0130] 7 and 8 are diagrams showing examples in which a coding block is divided into a plurality of sub-blocks.
[0131] FIG. 7 is a diagram showing a division mode when only square data elementary units are permitted, and FIG. 8 is a diagram showing a division mode when square data elementary units and non-square data elementary 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. This allows CU0 and CU3 to be divided into two sub-blocks, and CU1 to be divided into four sub-blocks.
[0133] Assuming that square and non-square data elementary units are allowed, in (a) and (b) of Figure 8, CU0 and CU3 can be defined using one VPDU, while CU1 can be defined using two different VPDUs. As a result, 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 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 halves, or into two non-square sub-blocks based on a vertical line dividing CU1 into left and right halves.
[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. For 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, dividing a coding block into square sub-blocks can be set to have a higher priority than dividing a coding block into non-square sub-blocks, e.g., dividing a coding block into non-square sub-blocks can be allowed when the coding block cannot be divided into square sub-blocks.
[0137] Alternatively, the division form of a coding block may be determined based on the division form of the coding block that is a parent node. For example, if the coding block that is a 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 a 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 from a previous picture. For example, a block at the same position as the current block in the previous picture (hereinafter referred to as a collocated block) can be set as a prediction block for the current block. Hereinafter, a prediction block generated based on a block at the same position as the current block will be referred to as a collocated prediction block.
[0139] On the other hand, if an object in a previous picture moves to another position in the current picture, the current block can be effectively predicted using the object's motion. For example, if the object's movement direction and size can be known by comparing the previous picture with the current picture, a predicted block (or predicted video) of the current block can be generated taking into account the object's motion information. Hereinafter, the predicted block generated using the motion information may be referred to as a motion predicted block.
[0140] A residual block can be generated by subtracting the predicted block from the current block. In this case, if object motion is present, the energy of the residual block can be reduced by using a motion prediction block instead of a collocated prediction block, thereby 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-prediction cases, 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 movement direction and size of an object. The reference picture index identifies the reference picture of the current block among the reference pictures included in the reference picture list. The prediction direction indicates 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 L0 direction motion information or L1 direction motion information can be used. The bidirectional weight index identifies the weight to be applied to the L0 prediction block and the weight to be 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 techniques 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. For 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 adjacent to the current block or a bitstream, depending on 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 or not an affine motion-based inter prediction technique is applied to the current block may be determined based on information analyzed from the bitstream. Specifically, whether or not an 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 an affine merge mode is applied to the current block or a flag indicating whether an 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 for the current block can be determined (S1101). The affine motion model can 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 to encode each parameter increases, reducing 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 for a current block may be encoded and signaled via a bitstream. For 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, tile, or block (e.g., a coding block or a coding tree unit). When a flag is signaled at the slice level, the affine motion model determined at the slice level may be applied to all blocks belonging to the slice.
[0159] Alternatively, the affine motion model of the current block may be determined based on the affine inter prediction mode of the current block. For example, when an affine merge mode is applied, the 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 the affine motion model of the current block may be encoded and signaled via the bitstream. For example, when an affine motion vector prediction mode is applied to the current block, the 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 can be derived (S1102). If a four-parameter affine motion model is selected, motion vectors at two control points of the current block can be derived. On the other hand, if a six-parameter affine motion model is selected, motion vectors at three control points of the current block can be derived. The motion vectors at the control points can be referred to as affine seed vectors. The control points can include at least one of the top left corner, top right corner, or bottom left corner of the current block.
[0161] FIG. 12 is a diagram illustrating affine seed vectors of each affine motion model.
[0162] In a parameter affine motion model, two affine seed vectors can be derived from the upper left corner, the upper right corner, or the lower left corner. As an example, as shown in (a) of FIG. 12, when a four-parameter affine motion model is selected, an affine vector can be derived using an affine seed vector sv0 from the upper left corner of the current block (e.g., the upper left sample (x1, y1)) and an affine seed vector sv1 from the upper right corner of the current block (e.g., the upper right sample (x1, y1)). It is also possible to use the affine seed vector from the lower left corner instead of the affine seed vector from the upper left corner, or to use the affine seed vector from the lower left corner instead of the affine seed vector from the upper right corner.
[0163] In a parameter affine motion model, affine seed vectors for the upper left corner, the upper right corner, and the lower left corner can be derived. For example, as shown in (b) of FIG. 12, when a six-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] Furthermore, 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 will be referred to as the first affine seed vector, the second affine seed vector, and the third affine seed vector, respectively. In embodiments using the first affine seed vector, the second affine seed vector, and the third affine seed vector, which will be described later, 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] An affine vector for each sub-block can be derived using the affine seed vector (S1103). Here, the affine vector refers to a translational motion vector derived based on the affine seed vector. The affine vector for a sub-block can be referred to as 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 vectors of the sub-blocks can be derived based on the positions of the control points, the positions of the sub-blocks, and the affine seed vectors. As an example, Equation 3 shows an example of deriving affine sub-block vectors.
[0169] [Formula 3]
[0170]
number
[0171] In Equation 3, (x, y) indicates the position of the sub-block. Here, the position of the sub-block indicates the position of the reference sample included in the sub-block. The reference sample may be a sample located in the upper left corner of the sub-block, or a sample whose x-axis coordinate or y-axis coordinate is 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, x1-x0 can be set to the same value as the width of the current block.
[0173] Then, motion compensation prediction for each sub-block can be performed 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, an 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 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 merge candidates for the current block may be derived from blocks that are 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 samples neighboring the current block or a non-neighboring block including samples not neighboring the current block. Hereinafter, a sample used to determine 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 neighboring reference sample may be included in the column adjacent to the leftmost column of the current block or the row adjacent to the topmost row of the current block. For 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, neighboring blocks with indexes 0 to 4 may be used as candidate blocks.
[0181] A non-adjacent reference sample refers to a sample whose x-axis distance or y-axis distance from a reference sample adjacent to the current block has a predefined value. For example, at least one of a block including a reference sample whose x-axis distance from the left reference sample is a predefined value, a block including a non-adjacent sample whose y-axis distance from the top reference sample is a predefined value, or a block including a non-adjacent sample whose x-axis distance and y-axis distance from the top-left reference sample are predefined values may be used as a candidate block. The predefined value may be a natural number such as 4, 8, 12, or 16. 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 can also be set as a non-adjacent reference sample.
[0183] FIG. 16 is a diagram showing the position of the reference sample.
[0184] 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. For example, if 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 a candidate block is equal to or greater than a threshold, the candidate block may be set as ineligible for use as a merge candidate. The threshold may be determined based on the size of the coding tree unit. For 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 predefined 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 the sample included in the candidate block is greater than a threshold, the candidate block can 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, which may reduce the encoding / decoding efficiency of the current block. To solve this problem, 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 Figure 17, the top block in the top N block column of the current block and the left block in the left M block column 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 the 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 the 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 coding tree unit different 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 a 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] For 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 top 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 top boundary of the coding tree unit. In this case, the y coordinate of the replacement sample can be changed to an adjacent position in the coding tree unit, and the x coordinate of the replacement sample can be set to the same as the reference sample. For 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 the replacement sample replacing the non-adjacent reference sample from being located at the same position as other non-adjacent reference samples or adjacent reference samples.
[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, the x coordinate of the replacement sample can be set to a value obtained by adding or subtracting an offset from the x coordinate of the reference 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', respectively, whose y-coordinates are the same as those of the row adjacent to the top boundary of the coding tree unit. 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 top 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 a 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 merge candidate for the current block can be derived based on the candidate block.
[0206] Merging candidates may also be derived from temporally adjacent blocks contained in a different picture than the current block. For example, merging candidates may be derived from colocated blocks contained in a colocated picture.
[0207] The motion information of the merge candidate may be set to the same as the motion information of the candidate block. For example, at least one of the motion vector, reference picture index, prediction direction, or bidirectional weight index of the candidate block may be set as the motion information of the merge 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, an index assigned to an adjacent merge candidate may have a lower value than an index assigned to a non-adjacent merge candidate. 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] If the merge candidate set includes multiple merge candidates, at least one of the multiple merge candidates may be selected (S1403). In this case, information indicating whether motion information of the current block is derived from a neighboring merge candidate may be signaled via the bitstream. The information may be a 1-bit flag. For example, a syntax element "isAdjancentMergeFlag" indicating whether motion information of the current block is derived from a neighboring merge candidate may be signaled via the bitstream. If the syntax element "isAdjancentMergeFlag" has a value of 1, the motion information of the current block may be derived based on a neighboring merge candidate. On the other hand, if the syntax element "isAdjancentMergeFlag" has a value of 0, the motion information of the current block may be derived based on a non-neighboring merge 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 merge candidates may be signaled via the bitstream. For example, information indicating an index of any one of the merge candidates included in the merge candidate list may be signaled via the bitstream.
[0214] If isAdjacentMergeflag is 1, a syntax element merge_idx that identifies one of the adjacent merge candidates may be signaled. 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] If isAdjacentMergeflag is 0, the syntax element NA_merge_idx, which specifies one of the non-adjacent merge candidates, can be signaled. The syntax element NA_merge_idx indicates the index of the non-adjacent merge candidate minus the number of adjacent merge candidates. The decoder can 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, 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. For example, the motion information of the merge candidates included in the inter-region motion information table may be set to 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 convenience of description, 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 can be signaled via the bitstream, and the information can be signaled at the sequence, picture, or slice level.
[0221] Alternatively, the maximum number of merge candidates in the inter-region motion information table may be determined based on the size of the picture, the size of the slice, or the size of the 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). For example, when a slice is initialized, the inter-region motion information table may also be 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 the 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 initial inter region merge candidates may be signaled via a picture parameter set or a slice header. Even when a slice is initialized, the inter region motion information table may include the initial inter region merge candidates. Therefore, the inter region merge candidates 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 encoding / decoding order.
[0226] FIG. 20 is a diagram showing how the inter-region motion information table is updated.
[0227] When inter prediction is performed on the current block (S2001), an inter region merge candidate can be derived based on the current block (S2002). The motion information of the inter region merge candidate can be set to 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 inter region merge candidates (S2003), a redundancy check can be performed on the motion information of the current block (or on inter region merge candidates derived based on the motion information) (S2005). The redundancy check is performed to determine whether the motion information of the inter region merge candidates already stored in the inter region motion information table is the same as the motion information of the current block. The redundancy check can be performed on all inter region merge candidates already stored in the inter region motion information table. Alternatively, the redundancy check can be performed on inter region merge candidates whose indexes among the inter region merge candidates already stored in the inter region motion information table are greater than or less than a threshold.
[0230] If no inter-prediction merge candidate having the same motion information as the current block is 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) of the inter-prediction merge candidates are the same.
[0231] At this time, if the maximum number of inter region merge candidates is already stored in the inter region motion information table (S2006), the oldest inter region merge candidate is deleted (S2007), and an inter region merge candidate derived based on the current block can be added to the inter region motion information table (S2008).
[0232] 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 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 the same as the maximum value, the inter region merge candidate may be assigned an index equal to the maximum value minus 1. 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 1.
[0234] FIG. 21 is a diagram showing how the inter region merge candidate table is updated.
[0235] It is assumed that an inter region merge candidate derived from the current block is added to the inter region merge candidate table and assigned the highest index, and that the maximum number of inter region merge candidates is already stored in the inter region merge candidate table.
[0236] When adding the inter region merge candidate HmvpCand[n+1] derived from the current block 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 shown in FIG. 21).
[0237] If an inter region merge candidate identical to the inter region merge candidate derived based on the current block is already 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, while adding an inter region merge candidate derived based on the current block to the inter region motion information table, it is also possible to delete an already stored inter region merge candidate that is the same as the inter region merge candidate, which has the same effect as updating the index of the already stored inter region merge candidate.
[0239] FIG. 22 is a diagram showing an example in which the indexes of already stored inter region merge candidates are updated.
[0240] If the 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. For example, in the example shown in FIG. 22, HmvpCand[2] that is the same as mvCand is deleted from the inter-region motion information table HvmpCandList, and the indices 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 can be updated, for example, the index of the already stored inter region merge candidate can be changed to the 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. For example, inter region merge candidates 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. Because 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, inter region merge candidates 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 sub-block unit, inter region merging candidates may be derived based on motion information of a representative sub-block among a plurality of sub-blocks included in the current block. For example, when sub-block merging candidates are used for the current block, inter region merging candidates may be derived based on motion information of a representative sub-block among the sub-blocks.
[0245] The motion vector of a sub-block can be derived in the following order. First, one of the merge candidates included in the merge candidate list of the current block is selected, and an initial shift vector (shVector) can be derived based on the motion vector of the selected merge candidate. Then, the initial shift vector can be added to the position (xSb, ySb) of the reference sample (e.g., the upper left sample or the middle sample) of each sub-block in the coding block to derive a shifted sub-block whose reference sample position is (xColSb, yColSb). Equation 4 below 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 including 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 top 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 the current block is set as a representative sub-block. When motion compensation prediction is performed in sub-block units, an inter region merge candidate for the current block can be derived based on the motion vector of the sub-block including the top left sample of the current block or the sub-block including the center sample of the current block.
[0252] Whether to use the current block as an inter region merging candidate may also be determined 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 to be ineligible for use as an inter region merging candidate. Therefore, even if the current block is encoded / decoded using 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, an inter region merging candidate may be derived based on at least one sub-block vector among sub-blocks included in a block encoded / decoded based on an affine motion model. For example, an inter region merging candidate may be derived using a sub-block located at the upper left, center, or upper right of a current block. Alternatively, an average value of sub-block vectors of a plurality of sub-blocks may be set as the motion vector of the inter region merging candidate.
[0254] Alternatively, the inter region merge 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. For example, the average of at least one of the first affine seed vector, the second affine seed vector, and the third affine seed vector of the current block may be set as the motion vector of the inter region merge 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 copying, 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. Any one of the inter region motion information tables may be selected depending on the inter prediction mode of the current block.
[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 can 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 can 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 can be used as a merge candidate for deriving the affine seed vector of the current block.
[0259] In addition to the inter-region motion information table described above, an additional inter-region motion information table can be defined. In addition to the above-described 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] If the first inter-region motion information table and the second inter-region motion information table are both empty, inter-region merge candidates can be added to the second inter-region motion information table first, and only after the number of inter-region merge candidates available in the second inter-region motion information table reaches the maximum number can inter-region merge candidates be added to the first inter-region motion information table.
[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] In this case, the second inter-region motion information table that has been configured may not be updated any more, or may be updated if the decoded region is equal to or greater than a predetermined ratio of the slice, or 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 either the first inter-region motion information table or the second inter-region motion information table may be signaled via a bitstream, and if the number of merge candidates included in the merge candidate list is less than a threshold, 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 bi-directional prediction is performed, whether motion vector refinement is performed, or whether triangular partitioning is performed, 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 merge candidates included in the long-term motion information table are added to the merge 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 adding the inter-region merge candidates included in the first inter-region motion information table 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 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 configured to include additional information in addition to motion information. For example, inter region merge candidates may additionally store block size, shape, or block partition information. When constructing a merge candidate list for a current block, only inter prediction merge candidates having the same or similar size, shape, or partition information as the current block may be used, 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 for 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 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 can 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 equal to a threshold value, or only on the N merge candidates with the largest indexes or the N merge candidates with the smallest indexes.
[0278] Alternatively, the redundancy check may be performed only on some of the merge candidates already stored in the merge candidate list. For example, the redundancy check may be performed only on merge candidates whose indexes are 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. Here, the specific location may include at least one of the left neighboring block, the top neighboring block, the top right neighboring block, or the bottom left neighboring block of the current block.
[0279] FIG. 26 shows an example in which redundancy checking is performed on only some of the merge 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 can be performed on the inter-region merge candidate with up to two merge candidates with the smallest indexes. For example, it can be checked whether mergeCandList[0] and mergeCandList[1] are the same as HmvpCand[j]. Alternatively, a redundancy check can be performed only on merge candidates derived from a specific position. For example, a redundancy check can be performed on at least one of merge candidates derived from neighboring blocks located to the left of the current block or merge candidates derived from neighboring blocks located above the current block. If there is no merge candidate derived from a specific position in the merge candidate list, the inter-region merge candidate can be added to the merge candidate list without a redundancy check.
[0282] If a merge candidate identical to the first inter-region merge candidate is found, when a redundancy check is performed on a second inter-region merge candidate, the redundancy check with the merge candidate identical to the first inter-region merge candidate can be omitted.
[0283] FIG. 27 shows an example in which a redundancy check with a specific merge candidate is omitted.
[0284] When an inter-region merge candidate HmvpCand[i] with index i is to be added to the merge candidate list, a redundancy check is performed between the inter-region merge candidate and merge candidates already stored in the merge candidate list. If a merge candidate mergeCandList[j] identical to the inter-region merge candidate HmvpCand[i] is found, the inter-region merge candidate HmvpCand[i] may not be added to the merge candidate list, and a redundancy check may be performed between the inter-region merge candidate HmvpCand[i-1] with index i-1 and the merge candidate. 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 for 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 for the current block is less than a threshold, the list may further include at least one of pairwise merge candidates or zero merge candidates in addition to inter-region merge candidates. A fairwise merge candidate is a merge candidate whose motion vector is the average 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 expanded with merge candidates by following the steps below.
[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 can 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, an inter-region merge candidate included in the inter-region motion information table can be set as a motion vector prediction candidate for the current block. Specifically, the motion vector of the inter-region merge candidate can be set as a motion vector prediction candidate.
[0291] When one of the motion vector prediction candidates included in the motion vector prediction candidate list for the current block is selected, the selected candidate can be set as the motion vector predictor for 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 can 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 is set as an initial motion vector, and motion compensation prediction for the current block can be performed using a motion vector derived by adding or subtracting an offset vector to or from the initial motion vector. Deriving a new motion vector by adding or subtracting an offset vector to or from the motion vector of the merge candidate can be defined as a merge offset vector encoding method.
[0296] Information indicating whether to use the merge offset encoding method may be signaled via a bitstream. The information may be a 1-bit flag, merge_offset_vector_flag. For example, a value of 1 in merge_offset_vector_flag 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 motion vector of the current block may be derived by adding or subtracting an offset vector to or from the motion vector of the merge candidate. A value of 0 in merge_offset_vector_flag 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 when 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 when 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. For 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 that have already been 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. For 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 less than M.
[0301] For example, if M is 6 and N is 2, the two merge candidates with the smallest indexes among those included in the merge candidate list may be set as usable for the current block. Therefore, 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 for 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. For 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 as ineligible for use as a merge candidate. Therefore, if the merge offset vector encoding method is applied to the current block, the motion vector of at least one of the neighboring blocks adjacent to the upper right corner or the lower left corner of the current block may not 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 as ineligible for use 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 candidate may be set not to be used. Thus, if the value of merge_offset_vector_flag is 1, at least one of the pairwise merge candidates or the zero merge candidate 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 a merge candidate may be set as the initial motion vector of the current block. In this case, if there are multiple merge candidates available for the current block, information identifying one of the multiple merge candidates may be signaled via the bitstream. For example, if the maximum number of merge candidates that the merge candidate list can include is greater than one, information merge_idx indicating one of the multiple merge candidates may be signaled via the bitstream. That is, a merge candidate may be identified via information merge_idx for identifying one of the multiple merge candidates using 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] On the other hand, if the number of merge candidates available for the current block is one, signaling of information for identifying a merge candidate may be omitted. As an example, if the maximum number of merge candidates that can be included in the merge candidate list is not greater than one, signaling of information merge_idx for identifying a merge candidate may be omitted. That is, under the merge offset encoding method, if the merge candidate list includes one merge candidate, encoding of information merge_idx for identifying a merge candidate may be omitted, and an initial motion vector may be determined based on the 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 determine merge candidates for the current block and then determine whether to apply the merge offset vector encoding method to the current block. For example, if the maximum number of merge candidates that a merge candidate can include is greater than 1, information "merge_idx" for identifying one of the merge candidates may be signaled. After selecting a merge candidate based on the merge_idx, it may decode "merge_offset_vector_flag" indicating whether to apply the merge offset vector encoding method to the current block. Table 4 illustrates a syntax table according to the above embodiment.
[0307] [Table 4]
[0308] As another example, after determining merge candidates for the current block, it may be determined whether 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 that can be used when applying the merge offset vector encoding method. As an example, merge_offset_vector_flag, which indicates whether to apply the merge offset vector encoding method to the current block, may be encoded and signaled only if the value of index information merge_idx is smaller than N. 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 determine whether to apply the merge offset vector encoding method to the current block, taking into account whether 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, it may encode and signal merge_offset_vector_flag, which indicates whether to apply the merge offset vector encoding method to the current block. 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, it may encode and signal merge_offset_vector_flag, which indicates whether to apply the merge offset vector encoding method to the current block.
[0310] Alternatively, whether to apply the merge offset vector encoding method may be determined 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 has already been 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 merge candidate is selected, the motion vector of the merge candidate can be set as the initial motion vector of the current block. Then, the offset vector can be determined by decoding information indicating the magnitude and direction of the offset vector. The offset vector can 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 via a bitstream. Table 5 shows the binarization of the index information distance_idx and the value of the 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 DistFromMergeMV 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 or vertical component of the offset vector to be no 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 motion vector precision 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, fractional-pel includes at least one of 1 / 16 pel, octopel, quarter-pel, or half-pel. On the other hand, if the motion vector precision 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 for determining the variable DistFromMergeMV may be set differently depending on the motion vector precision of the current block.
[0321] For example, if the motion vector precision of the current block or 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 motion vector precision of the current block or merging candidate is integer-pel, the value of the variable DistFromMergeMV pointed to by distance_idx in Table 5 can be N times (e.g., 4 times) the value of the variable DistFromMergeMV.
[0322] Information for determining the accuracy of a motion vector may be signaled via a bitstream. For example, the information may be signaled at the sequence, picture, slice, or block level. Therefore, the range of vector magnitude candidates may be set differently depending on the information regarding 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 for the current block. For 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 for 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 for 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] For example, if the value of merge_offset_extend_range_flag is 0, the magnitude of the offset vector can be set not to exceed 2. Therefore, the maximum value of DistFromMergeMV can be set to 8. On the other hand, if 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. Therefore, the maximum value of DistFromMergeMV can be set to 128.
[0325] The magnitude of the offset vector can be determined using a flag indicating whether the magnitude of the offset vector is greater than a threshold. For 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. For example, distance_flag being 1 indicates that the magnitude of the offset vector is greater than 4. On the other hand, distance_flag being 0 indicates that the magnitude of the offset vector is 4 or less.
[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 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 can be set to 1 or 0. The value of distance_idx can be set to 1, 2, 4, 8, 16, 32, 64, 128, etc. N represents a coefficient determined by the threshold. For example, if the threshold is 4, N can 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 via a bitstream. Table 8 shows the binarization of the 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 the values of distance_idx, which indicates the magnitude of the offset vector, and direction_idx, which indicates 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 predefined in the encoder and decoder. For 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. For 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 a 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. In this case, the L0 offset vector and the L1 offset vector can be determined taking into account the output order difference value (hereinafter referred to as the L0 difference value) between the L0 reference picture of the merge candidate and the current picture, and the output order difference value (hereinafter referred to as the L1 difference value) between the L1 reference picture of the merge candidate and the current picture.
[0341] First, if the signs of the L0 differential value and the L1 differential value are the same, the L0 offset vector and the L1 offset vector can be set to be the same, whereas if the signs of the L0 differential value and the L1 differential 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 the same, 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 difference value and the L1 difference value 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 signs of the L0 difference value and the L1 difference value are different.
[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 the values of distance_idx, which indicates the magnitude of the offset vector, and direction_idx, which indicates 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 size of vector direction candidates may be signaled via the bitstream. For example, a flag merge_offset_direction_range_flag for determining vector direction candidates may be signaled via the bitstream. The flag may be signaled at the sequence, picture, or slice level. For 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 a 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 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, if 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 illustrated in Table 9 or Table 10 may be used. On the other hand, if the MVx and MVy difference or the absolute value of the difference is greater than the threshold, the four vector direction candidates illustrated in Table 8 may be used.
[0359] The motion vector of the current block can be derived by adding an 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 multiple 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 partitioning 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 the motion vector of a merging candidate derived from a neighboring block adjacent to the 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 the 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 containing the sample at the (xColSb, yColSb) position in the collocated block can be set as the motion vector of the sub-block containing the sample at the (xSb, ySb) position.
[0370] When a triangular partitioning method is applied, a coding block may be divided into triangular subunits. For 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 how 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. For example, index information merge_1st_idx of a first subunit may identify a merge candidate for the first subunit, and index information merge_2nd_idx of a second subunit may identify a merge candidate for the second subunit.
[0373] The initial motion vector of each sub-unit can 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 can be set as the initial motion vector of the sub-block. The motion vector of each sub-block can be derived by adding or subtracting an offset vector to the initial motion vector.
[0374] When a 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 the multiple sub-units can be modified using the same offset vector.
[0375] Alternatively, a coding block may be divided into multiple sub-units, and the offset vector of each sub-unit may be determined individually, so that the offset vector of at least one of the sub-units may be set to be different from the offset vectors of the other sub-units.
[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 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 distance_idx value 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 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 sub-units generated by dividing a coding block. For example, if a current block is divided into a first sub-unit and a second sub-unit, the motion vector of the first sub-unit may be set to be the same as the motion vector of a merge candidate, and the motion vector of the second sub-unit 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, by using the average value of the horizontal gradient and the average value of the vertical gradient of the 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 a neighboring sample adjacent to the reconstructed sample. For example, a horizontal gradient may indicate a difference between a reconstructed sample and its neighboring reconstructed sample on the left and / or right side, and a vertical gradient may indicate a difference between a reconstructed sample and its neighboring reconstructed sample on the top and / or bottom side.
[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 the reference merge candidate can 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 the reference merge candidate can be referred to as a refined merge candidate.
[0384] The remaining motion information of the refine merge candidate, excluding the motion vector, can be set to be the same as that of the base merge candidate.
[0385] FIG. 32 is a diagram showing motion vector candidates that can be used as 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. For example, among the merge candidates included in the merge candidate list, the merge candidate with the smallest index value (i.e., the merge candidate with an index value of 0) or the merge candidate with the largest index value may be set as the reference merge candidate. Alternatively, the inter region merge candidate with the smallest index value or the inter region merge candidate with 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 can be set as the reference merge candidate. That is, when candidate blocks are searched in order, the first bidirectional merge candidate found can 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 in shape, where the height is greater than the width, a merge candidate with an index of 0 or a merge candidate derived from an adjacent block located on the top of the current block may be set as the base merge candidate. If the current block is non-square in shape, where the width is greater than the height, a merge candidate with an index of 1 or a merge candidate derived from an adjacent block located to the left of the current block may be set as the base merge candidate.
[0390] Alternatively, information identifying the reference merge candidate may be signaled via the bitstream, which may be index information identifying one of the merge candidates included in the merge 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 flag value is 1, a refine merge candidate generated based on the reference merge candidate may be added to the merge candidate list. On the other hand, if the flag value 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 contain, a refine merge candidate can be added to the merge candidate list. Here, the already added merge candidates can include at least one of spatial merge candidates, temporal merge candidates, inter-region merge candidates, or pairwise merge candidates. For example, if the number of at least one of spatial merge candidates, temporal merge candidates, or inter-region merge candidates included in the merge candidate list is equal to or less than a threshold, a refine merge candidate can be added to the merge candidate list.
[0393] Alternatively, refine merge candidates may be utilized 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 a merge candidate list can include can be set differently depending on whether refine merge candidates are used. For example, if refine merge candidates are not used, the maximum number of merge candidates that a merge candidate list can include can be set to N. However, if refine merge candidates are used, the maximum number of merge candidates that a 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 the merge candidate whose index is X. mvLx[0] indicates the x-component motion vector of the reference merge candidate, and mvLx[1] indicates the y-component motion vector of the reference merge candidate. As an example, if the reference merge candidate is mergeCand[0], mvLx[0] and mvLx[1] may indicate the motion vector of mergeCand[0].
[0398] The size M of the offset vector may be predefined in the encoder and decoder. For example, the size 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. For 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 a merge candidate with the same motion information as the refine merge candidate exists among the already added merge candidates, the refine merge candidate may not be added to the merge candidate list. For 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 with the same motion information as the refine merge candidate, the refine merge candidate can be re-derived by changing the offset vector or resetting the merge candidate with the same motion information as the refine merge candidate to the refine merge candidate. For example, if the motion information of refine merge candidate mergeCand[6] derived based on the reference merge candidate mergeCand[0] is the same as that of merge candidate mergeCand[2], the motion vector of refine merge candidate mergeCand[6] can be changed to a value obtained by adding or subtracting an offset vector from the motion vector of merge candidate mergeCand[2]. For example, the motion vector of mergeCand[6] can 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 with index 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 the merge refinement offset list. Then, the offset vector may be added to or subtracted from the motion vector of the merge candidate to derive the motion vector of the current block. 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, the merge candidate with the smallest index value (i.e., the merge candidate with an index value of 0) or the merge candidate with the largest index value may be set as the reference merge candidate. Alternatively, the inter region merge candidate with the smallest index value or the inter region merge candidate with the largest index value in the 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 can 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 motion vector of the current block can be derived by adding or subtracting the offset vector from the motion vector of the reference merge candidate.
[0408] The merge refinement offset list may include at least one merge offset candidate, for example, 4, 8, or 16 merge offset candidates.
[0409] 34 and 35 are diagrams showing offset vectors identified by merge offset candidates.
[0410] FIG. 34 shows an example where the number of merge offset candidates is eight, and FIG. 35 shows an example where the number of merge offset candidates is sixteen.
[0411] As shown in the example of Figure 34(a), the offset vectors indicated by the merge offset candidates may be set so that the absolute values of the horizontal motion vectors and / or the vertical motion vectors have fixed values. Alternatively, as shown in the example of Figure 35, the offset vectors indicated by merge offset candidates having an index smaller than a threshold may be set so that the absolute values of the horizontal motion vectors and / or the vertical motion vectors have first values, and the offset vectors indicated by the other merge offset candidates may be set so that the absolute values of the horizontal motion vectors and / or the vertical motion vectors have second values.
[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] Multiple base merge candidates can also be set. As an example, two merge candidates with the smallest indexes among the merge candidates included in the merge candidate list can be set as base merge candidates. Therefore, if the index of the merge candidate identified by the index information merge_idx is 0 or 1, an offset vector can be derived using the merge refinement offset list. Alternatively, the merge candidate with the smallest index among the merge candidates included in the merge candidate list and the merge candidate with the largest index among the merge candidates included in the inter-region merge candidate list can be set as base merge candidates.
[0414] In the motion vector prediction mode, the motion vector of the current block may be derived by adding a motion differential vector to a motion predictor. The motion predictor of the current block may be determined based on a motion vector prediction candidate list including at least one motion predictor candidate. For example, any one of the motion predictor candidate candidates may be set as the motion predictor 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 block B0 including a sample at (xCb+CbW, yCb-1), block B1 including a sample at (xCb+CbW-1, yCb-1), block B2 including a sample at (xCb-1, yCb-1), or block B3 including a sample at (xCb, yCb-1). Here, (xCb, yCb) indicates the location 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 block A0 including a sample at (xCb-1, yCb+CbH), block A1 including a sample at (xCb-1, yCb+CbH-1), or block A2 including a sample at (xCb-1, yCb). Here, CbH indicates 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 the 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 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 upper-end adjacent block B0, the upper-end adjacent block B1, or the upper-end adjacent block B2 is available, the motion vector of the available block is set as a motion vector prediction candidate.
[0422] 3. If the temporal neighboring blocks are available, set the temporal motion vectors as motion vector prediction candidates.
[0423] 4. Set the zero motion vector as a motion vector prediction candidate.
[0424] Alternatively, if the number of motion vector prediction candidates derived in the order of 1 to 3 is less than two, a motion vector included in an inter-region motion information table can be set as a motion vector prediction candidate. If an inter-region motion information table is available, motion vector prediction candidates can be derived in 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 upper-end adjacent block B0, the upper-end adjacent block B1, or the upper-end adjacent block B2 is available, the motion vector of the available block is set as a motion vector prediction candidate.
[0427] 3. If the temporal neighboring blocks are available, set the temporal motion vectors as motion vector prediction candidates.
[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 a 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 refined 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), where M indicates the magnitude of the offset vector.
[0433] The size M of the offset vector may be predefined in the encoder and decoder. For example, the size 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. For 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 predictor vector offset candidate. 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 the predictor vector refinement offset list. Then, a motion predictor vector for the current block may be derived by adding or subtracting the offset vector to or from the 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, among the motion vector prediction candidates included in the motion vector prediction candidate list, the motion vector prediction candidate with the smallest index value or the motion vector prediction candidate with the largest index value may be set as the 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 can be included in the predictor vector candidate list 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] If 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, if 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 identifying 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 motion predictor vector for the current block can be derived by adding or subtracting the offset vector from the motion vector of the reference candidate predictor vector.
[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 the affine seed vector of a spatially or temporally neighboring block of the coding block. The affine seed differential vector may be determined based on information signaled from the bitstream. In this case, the same affine seed differential vector may be applied to all control points. Alternatively, information for determining the 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 the average value of the horizontal gradient and the average value of the vertical gradient of the 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] Intra prediction techniques include matrix-based intra prediction and general intra prediction that takes into account the directionality of neighboring reconstructed samples. Information indicating the intra prediction technique for the current block may be signaled via a bitstream. The information may be a 1-bit flag. Alternatively, the intra prediction technique for the current block may be determined based on at least one of the position, size, and shape of the current block, or the intra prediction techniques of neighboring blocks. For example, if the current block crosses a picture boundary, 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 one of a plurality of already stored matrices can be signaled via a bitstream. The decoder can 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 residual video can be derived by subtracting a predicted video from an original video. When the residual video is converted to the frequency domain, even if high-frequency components are removed, the subjective image quality of the video does not significantly decrease. Therefore, reducing the values of high-frequency components or setting them to zero can prevent significant visual distortion and improve compression efficiency. 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 transform technique such as a discrete cosine transform (DCT) or a discrete sine transform (DST).
[0451] The current block may be transformed using a DCT or DST, and then the transformed current block may be transformed again. In this case, 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 plurality of candidate transform cores, for example, a DCT2, a DCT8, or a 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 first and second transforms may be performed in different units. For example, an 8x8 block may be subjected to the first transform, and a 4x4 sub-block of the transformed 8x8 block may be subjected to the second transform. In this case, the transform coefficients of the remaining area where the second transform has not been performed may be set to 0.
[0455] Alternatively, the 4x4 block can undergo a first transformation and an 8x8 sized region containing the transformed 4x4 block can undergo a second transformation.
[0456] Information indicating whether or not to perform the second transformation can be signaled via the bitstream.
[0457] The decoder can perform an inverse transform of the second transform (second inverse transform) and then perform an inverse transform of the first transform (first inverse 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 can be obtained.
[0458] Quantization is used to reduce the energy of a block, and the quantization process involves dividing the transform coefficients by a specific constant value, which can be derived from a quantization parameter, which can 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, and can obtain a reconstructed block of the current block by adding the predicted block and the residual block.
[0460] Once a reconstruction block of the current block is obtained, information loss occurring during the quantization and encoding process can be reduced through in-loop filtering, which 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 reference 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 given order to perform the steps in an order different from that described.
[0462] Although the above-described embodiments are described based on a series of steps or flowcharts, this does not limit the chronological order of the present invention, and steps may be executed simultaneously or in another order as needed. Furthermore, in the above-described embodiments, each of the components (e.g., units, modules, etc.) constituting the block diagrams may be embodied in hardware devices or software, or multiple components may be combined and embodied in a single 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 media such as CD-ROMs and DVDs; magneto-optical media such as floptical disks; and hardware devices specifically configured to store and execute program commands, such as ROMs, RAMs, and flash memories. The hardware devices may be configured to operate using one or more software modules to perform the processes of the present invention, or 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 a merge candidate for the current block based on the merge candidate list; deriving a motion vector for the current block based on the merging candidates; Including, When 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 the motion vector of the merge candidate; when the maximum number of merge candidates that the merge candidate list can include is plural, the merge candidate of the current block is selected based on index information decoded from a bitstream indicating any one of the merge candidates; when the maximum number is 1, the merge candidate is determined without decoding the index information; At least one of the maximum value and the minimum value of the vector magnitude candidates is set to be different based on the value of a flag indicating the numerical value of the vector magnitude candidate.
1. A video decoding method comprising:
2. the magnitude of the offset vector is determined based on first index information that identifies one of the vector magnitude candidates.
2. The video decoding method of claim 1.
3. The flag is signaled at the picture level.
2. The video decoding method of claim 1.
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 1 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 a merge candidate for the current block based on the merge candidate list; deriving a motion vector for the current block based on the merging candidates; Including, When 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 the motion vector of the merge candidate; when the maximum number of merge candidates that the merge candidate list can include is plural, index information indicating the merge candidate of the current block among the merge candidates is encoded; when the maximum number is 1, encoding of the index information is omitted; At least one of the maximum value and the minimum value of the vector magnitude candidates is set to be different based on the value of a flag indicating the numerical value of the vector magnitude candidate. 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. further comprising encoding a flag indicating a value of the vector magnitude candidate, the flag being encoded at a picture level.
6. The video encoding method of claim 5.
8. further comprising encoding second index information for identifying a vector direction candidate indicating the direction of the offset vector among a plurality of vector direction candidates; Video encoding method according to any one of claims 5 to 7.
9. 1. A video decoder comprising: a processor and a memory, The memory is used to store a computer program, and the processor is used to perform 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, The memory is used to store a computer program, and the processor is used 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 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; When the merge offset vector encoding method is applied to the current block, the motion vector of the current block is derived by adding an offset vector to the 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 of 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 is determined without decoding the index information; and at least one of the maximum or minimum values of the vector magnitude candidates is set to be different based on the value of a flag indicating the numerical value of the vector magnitude candidate. A video decoding device comprising:
12. 1. A video encoding device, 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; When the merge offset vector encoding method is applied to the current block, the motion vector of the current block is derived by adding an offset vector to the motion vector of the merge candidate; if the maximum number of merge candidates that the merge candidate list can include is plural, index information indicating the merge candidate of the current block among the merge candidates is encoded; if the maximum number is 1, encoding of the index information is omitted; and at least one of maximum or minimum values of vector magnitude candidates is set to be different based on the value of a flag indicating the numerical value of the vector magnitude candidate. A video encoding device comprising:
13. A computer-readable storage medium for storing computer programs / instructions and bitstreams, comprising: When the computer program is executed by a processor, it performs the video encoding method according to any one of claims 5 to 8 to generate the bitstream. A computer-readable storage medium comprising: