Image signal encoding / decoding method and apparatus therefor

By dividing the video signal encoding block into multiple prediction blocks and deriveing ​​motion information, combined with the use of inter-frame motion information list, the problem of low efficiency in high-definition video signal encoding/decoding is solved, and more efficient inter-frame prediction is achieved.

CN119815001AActive Publication Date: 2025-04-11GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411821767.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2018-11-08
Filing Date
2019-11-08
Publication Date
2025-04-11
Estimated Expiration
2039-11-08

AI Technical Summary

Technical Problem

When existing video signal encoding/decoding technologies process high-definition video, the data volume is large and the compression rate is low, resulting in low efficiency.

Method used

By dividing the coded block into multiple prediction blocks and derive the motion information of each prediction block, the merge candidates are exported using the inter-motion information list to improve the inter-frame prediction efficiency.

Benefits of technology

It improves inter-frame prediction efficiency, enhances the performance of video signal encoding/decoding, and solves the problems of large amount of data and low compression rate in high-definition videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119815001A_ABST
    Figure CN119815001A_ABST
Patent Text Reader

Abstract

An image decoding method according to the present invention comprises the steps of: dividing an encoding block into a first prediction unit and a second prediction unit; deriving a merge candidate list of the coding block; deriving first motion information of the first prediction unit and second motion information of the second prediction unit using the merge candidate list; and obtaining a prediction sample in the coding block based on the first motion information and the second motion information.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with the application date of November 8, 2019, application number 201980063338.2, and invention name “Image signal encoding / decoding method and device thereof”. Technical Field

[0002] The invention relates to a video signal encoding / decoding method and a device thereof. Background Art

[0003] With the trend of display panels becoming larger and larger, video services with higher picture quality are gradually needed. The biggest problem with high-definition video services is the substantial increase in the amount of data. In order to solve this problem, research is being actively conducted to improve the video compression rate. 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) established the Joint Collaborative Team on Video Coding (JCT-VC). JCT-VC proposed the video compression standard HEVC (High Efficiency Video Coding) and was approved on January 25, 2013. Its compression performance is about twice that of H.264 / AVC. With the rapid development of high-definition video services, the performance of HEVC has gradually exposed its limitations. Summary of the invention

[0004] Technical issues to be solved

[0005] An object of the present invention is to provide a method for dividing a coding block into a plurality of prediction blocks when encoding / decoding a video signal and a device for performing the method.

[0006] An object of the present invention is to provide a method of deriving motion information of each prediction block among a plurality of prediction blocks when encoding / decoding a video signal and an apparatus for performing the method.

[0007] An object of the present invention is to provide a method for deriving a merge candidate using an inter-frame motion information list when encoding / decoding a video signal and a device for executing the method.

[0008] The technical problems to be achieved by the present invention are not limited to the technical problems mentioned above, and ordinary technicians in the technical field to which the present invention belongs will clearly understand other technical problems not mentioned through the following description.

[0009] Technical Solution

[0010] The video signal decoding / encoding method according to the present invention may include the following steps: dividing a coding block into a first prediction unit and a second prediction unit; deriving a merge candidate list of the coding block; deriving first motion information of the first prediction unit and second motion information of the second prediction unit using the merge candidate list; and obtaining a prediction sample in the coding block based on the first motion information and the second motion information. In this case, whether to divide the coding block is determined according to the size of the coding block, and the first motion information of the first prediction unit is derived from the first merge candidate in the merge candidate list, and the second motion information of the second prediction unit is derived from a second merge candidate different from the first merge candidate.

[0011] In the video signal decoding / encoding method according to the present invention, when at least one of a width and a height of the coding block is greater than a threshold value, the coding block may not be divided.

[0012] In the video signal decoding / encoding method according to the present invention, the method may further include the following steps: decoding first index information for specifying the first merge candidate and second index information for specifying the second merge candidate from a bit stream, and when the value of the second index information is equal to or greater than the value of the first index information, the second merge candidate has a value obtained by adding 1 to the value of the second index information as an index.

[0013] In the video signal encoding / decoding method of the present invention, when the prediction sample is included in the boundary area of ​​the first prediction unit and the second prediction unit, the prediction sample can be derived according to the weighted sum operation of the first prediction sample derived based on the first motion information and the second prediction sample derived based on the second motion information.

[0014] In the video signal encoding / decoding method of the present invention, the first weighting value applied to the first prediction sample may be determined based on the x-axis coordinate and the y-axis coordinate of the prediction sample.

[0015] In the video signal encoding / decoding method of the present invention, the second weighting value applied to the second prediction sample may be derived by subtracting the first weighting value from a constant.

[0016] In the video signal decoding / encoding method according to the present invention, the maximum number of merging candidates included in the merging candidate list may be determined based on whether the coding block is split into the first prediction unit and the second prediction unit.

[0017] The features briefly summarized above for the present invention are merely exemplary embodiments of the detailed description of the present invention to be described later and do not limit the scope of the present invention.

[0018] Beneficial Effects

[0019] According to the present invention, inter-frame prediction efficiency can be improved by providing a method of dividing a coding block into a plurality of prediction blocks and deriving motion information of each of the plurality of prediction blocks.

[0020] According to the present invention, inter prediction efficiency can be improved by providing a method for deriving merge candidates using an inter motion information list.

[0021] Effects obtainable in the present invention are not limited to the above-mentioned effects, and other effects not mentioned will be clearly understood by a person of ordinary skill in the technical field to which the present invention pertains through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 is a block diagram of a video encoder according to an embodiment of the present invention.

[0023] Figure 2 is a block diagram of a video decoder according to an embodiment of the present invention.

[0024] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present invention.

[0025] Figure 4 is a diagram showing various types of partitioning of a coding block.

[0026] Figure 5 is a diagram showing a division pattern of a coding tree unit.

[0027] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present invention.

[0028] Figure 7 is a diagram showing the nonlinear motion of an object.

[0029] Figure 8 is a flowchart showing an inter-frame prediction method based on affine motion according to an embodiment of the present invention.

[0030] Fig. 9 is a diagram showing an example of an affine seed vector for each affine motion model.

[0031] Fig.10 is a diagram showing an example of affine vectors of sub-blocks under a 4-parameter motion model.

[0032] Fig.11 is a flow chart of the process of deriving motion information of the current block in merge mode.

[0033] Fig.12 is a diagram showing an example of candidate blocks for deriving merge candidates.

[0034] Fig.13 is a diagram showing the positions of reference samples.

[0035] Fig.14 is a diagram showing an example of candidate blocks for deriving merge candidates.

[0036] Fig.15 is a flowchart showing the update status of the inter-frame motion information list.

[0037] Fig.16 is a diagram showing an embodiment of updating an inter-frame merging candidate list.

[0038] Fig.17 2 is a diagram showing an example in which the index of the stored inter-frame merging candidate is updated.

[0039] Fig.18 is a diagram showing the positions of representative sub-blocks.

[0040] Fig.19 An example of generating an inter-frame motion information list for different inter-frame prediction modes is shown.

[0041] Fig. 20 is a diagram showing an example of adding an inter merge candidate included in a long-term motion information list to a merge candidate list.

[0042] Fig.21 is a diagram showing an example in which redundancy checking is performed only on some merge candidates.

[0043] Fig. 22 is a diagram showing an example of skipping redundant checking of a specific merge candidate.

[0044] Fig.23 is a diagram showing an example of dividing a coding block into a plurality of prediction units using diagonal lines.

[0045] Fig.24 is a diagram showing an example of dividing a coding block into two prediction units.

[0046] Fig.25 A diagram showing an example of dividing a coding block into a plurality of prediction blocks having different sizes.

[0047] Fig.26 is a diagram showing neighboring blocks used to derive triangle merging candidates.

[0048] Fig. 27 is a diagram for describing an example of determining availability of neighboring blocks of each triangle prediction unit.

[0049] Fig.28 and Fig.29 is a diagram showing an example of deriving a prediction sample based on a weighted sum operation of a first prediction sample and a second prediction sample. DETAILED DESCRIPTION

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

[0051] The encoding and decoding of the video is performed in units of blocks. For example, encoding / decoding processes such as transformation, quantization, prediction, in-loop filtering, or reconstruction may be performed on a coding block, a transform block, or a prediction block.

[0052] Hereinafter, a block to be encoded / decoded is referred to as a “current block.” For example, according to a current encoding / decoding process step, the current block may refer to a coding block, a transform block, or a prediction block.

[0053] In addition, the term "unit" used in this specification means a basic unit for performing a specific encoding / decoding process, and "block" can be understood to mean a sample array of a predetermined size. Unless otherwise specified, "block" and "unit" can be used interchangeably. For example, in the embodiments described later, a coding block and a coding unit can be understood to have the same meaning.

[0054] Figure 1 is a block diagram of a video encoder according to an embodiment of the present invention.

[0055] Reference Figure 1 The video encoding apparatus 100 may include an image division unit 110 , prediction units 120 , 125 , a transformation unit 130 , a quantization unit 135 , a rearrangement unit 160 , an entropy encoding unit 165 , an inverse quantization unit 140 , an inverse transformation unit 145 , a filter unit 150 and a memory 155 .

[0056] Figure 1 The components shown are shown separately to represent the characteristic functions that are different from each other in the video encoding device, and do not mean that the components are composed of separate hardware or a single software component. That is, for the convenience of explanation, the components are arranged in a manner such that at least two of the components are combined into one component or one component is divided into multiple components, and thus the functions are performed. As long as they do not deviate from the essence of the present invention, such embodiments that integrate the components and embodiments that separate the components also belong to the scope of the present invention.

[0057] Moreover, some structural elements are not necessary structural elements for performing the essential functions in the present invention, but are optional structural elements only for improving performance. The present invention can be implemented by only including components required for realizing the essence of the present invention except for the structural elements only for improving performance, and a structure including only necessary structural elements except for the optional structural elements only for improving performance also belongs to the scope of rights of the present invention.

[0058] The image division unit 110 may divide the input image 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 image division unit 110 divides an image into a combination of a plurality of coding units, prediction units, and transform units, and may select a combination of a coding unit, a prediction unit, and a transform unit based on a predetermined criterion (e.g., a cost function) to encode the image.

[0059] For example, an image may be divided into a plurality of coding units. In order to divide an image into coding units, a recursive tree structure such as a quad tree structure may be used, and a video or a largest coding unit may be used as a root and the coding unit may be divided into other coding units having child nodes equivalent to the number of divided coding units. Coding units that are no longer divided according to certain restrictions will become leaf nodes. That is, when it is assumed that a coding unit can only achieve square division, a coding unit may be divided into up to 4 other coding units.

[0060] Hereinafter, in the embodiments of the present invention, a coding unit may mean a unit that performs coding, and may also mean a unit that performs decoding.

[0061] The prediction units within a coding unit may be divided into at least one of squares or rectangles of the same size, or one prediction unit within a coding unit may be divided into a shape and / or size different from that of another prediction unit.

[0062] When a prediction unit on which intra prediction is performed based on a coding unit is not a minimum coding unit, intra prediction may be performed without being divided into a plurality of prediction units N×N.

[0063] The prediction units 120 and 125 may include an inter-frame prediction unit 120 that performs inter-frame prediction and an intra-frame prediction unit 125 that performs intra-frame prediction. It may be determined whether to use inter-frame prediction or perform intra-frame prediction for the prediction unit, and specific information (e.g., intra-frame prediction mode, motion vector, reference image, etc.) may be determined based on each prediction method. In this case, the processing unit that performs the prediction may be different from the processing unit that determines the prediction method and specific content. For example, the prediction method and prediction mode, etc. may be determined by the prediction unit, and the prediction may be performed by the transform unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transform unit 130. In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded together with the residual value in the entropy coding unit 165 and transmitted to the decoder. When a specific coding mode is used, the prediction block may also be generated by directly encoding the original block and transmitting it to the decoder without going through the prediction units 120 and 125.

[0064] The inter-frame prediction unit 120 may predict a prediction unit based on information of at least one of the previous image or the next image of the current image, and in some cases, may also predict a prediction unit based on information of a part of the region that has been encoded in the current image. The inter-frame prediction unit 120 may include a reference image interpolation unit, a motion prediction unit, and a motion compensation unit.

[0065] The reference image interpolation unit receives reference image information from the memory 155, and can generate pixel information of integer pixels or fractional pixels from the reference image. For luminance pixels, in order to generate pixel information of fractional pixels in units of 1 / 4 pixels, an 8th-order DCT-based interpolation filter with different filter coefficients can be used. For chrominance signals, in order to generate pixel information of fractional pixels in units of 1 / 8 pixels, a 4th-order DCT-based interpolation filter with different filter coefficients can be used.

[0066] The motion prediction unit can perform motion prediction based on the reference image interpolated by the reference image interpolation unit. The method for calculating the motion vector can use a full search-based block matching algorithm (FBMA), a three-step search method (TSS), a new three-step search algorithm (NTS), and a variety of other methods. The motion vector can have a motion vector value in units of 1 / 2 pixel or 1 / 4 pixel based on the interpolated pixel. The current prediction unit can be predicted in the motion prediction unit by adopting different motion prediction methods. The motion prediction method can use a skip method, a merge method, an advanced motion vector prediction (AMVP) method, an intra block copy method, and a variety of other methods.

[0067] The intra prediction unit 125 may generate a prediction unit based on reference pixel information around the current block, which is pixel information within the current image. When the neighboring block of the current prediction unit is a block on which inter prediction has been performed and the reference pixel is a pixel on which inter prediction has been performed, the reference pixel included in the block on which inter prediction has been performed may be used as reference pixel information of the surrounding block on which intra prediction has been performed. That is, when a reference pixel is unavailable, at least one reference pixel among available reference pixels may be used to replace the unavailable reference pixel information.

[0068] In intra prediction, the prediction mode may have an angular prediction mode using reference pixel information in a prediction direction and a non-angular mode that does not use direction information when performing prediction. The mode for predicting luminance information and the mode for predicting chrominance information may be different, and in order to predict chrominance information, the intra prediction mode information used for predicting luminance information or the predicted luminance signal information may be applied.

[0069] When performing intra prediction, if the size of the prediction unit is the same as the size of the transform unit, intra prediction can be performed on the prediction unit based on the pixel existing on the left side of the prediction unit, the pixel existing on the upper left, and the pixel existing on the upper side. However, when performing intra prediction, if the size of the prediction unit is different from the size of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. In addition, intra prediction using only N×N partitioning for the minimum coding unit can be applied.

[0070] The intra prediction method may generate a prediction block after applying an adaptive intra smoothing (AIS) filter to reference pixels according to a prediction mode. The types of adaptive intra smoothing filters used for reference pixels may be different. In order to perform the intra prediction method, the intra prediction mode of the current prediction unit may be predicted from the intra prediction modes of prediction units existing around the current prediction unit. In the case of predicting the prediction mode of the current prediction unit using the mode information predicted from the surrounding prediction units, if the intra prediction modes of the current prediction unit and the surrounding prediction units are the same, predetermined flag information may be used to transmit information indicating that the prediction modes of the current prediction unit and the surrounding prediction units are the same. If the prediction modes of the current prediction unit and the surrounding prediction units are different, the prediction mode information of the current block may be encoded by performing entropy coding.

[0071] And, a residual block including residual information which is a difference value between a prediction unit predicted based on the prediction unit generated in the prediction parts 120 and 125 and an original block of the prediction unit may be generated. The generated residual block may be input to the transform part 130.

[0072] In the transform unit 130, a transform method such as discrete cosine transform (DCT) or discrete sine transform (DST) can be used to transform the residual block, which includes residual information between the original block and the prediction unit generated by the prediction unit 120, 125. Among them, the DCT transform kernel includes at least one of DCT2 or DCT8, and the DST transform kernel includes DST7. It can be determined whether to apply DCT or DST to transform the residual block based on the intra-frame prediction mode information of the prediction unit used to generate the residual block. The transformation of the residual block can also be skipped. A flag indicating whether the transformation of the residual block is skipped can be encoded. For residual blocks, luminance components, or chrominance components (below 4:4:4 format) whose size is below a threshold, transformation skipping can be allowed.

[0073] The quantization part 135 may quantize the value transformed into the frequency domain in the transformation part 130. The quantization coefficient may be changed according to the importance of the block or video. The value calculated in the quantization part 135 may be provided to the inverse quantization part 140 and the rearrangement part 160.

[0074] The rearrangement part 160 may perform rearrangement of coefficient values ​​on the quantized residual value.

[0075] The rearrangement unit 160 may change the 2D block shape coefficients into a 1D vector form by a coefficient scanning method. For example, the rearrangement unit 160 may use a zigzag scanning method to scan the DC coefficients and even the coefficients in the high frequency domain and change them into a 1D vector form. Depending on the size of the transform unit and the intra-frame prediction mode, instead of the zigzag scanning, vertical scanning for scanning the 2D block shape coefficients along the column direction and horizontal scanning for scanning the 2D block shape coefficients along the row direction may be used. That is, which scanning method to use among the zigzag scanning, the vertical scanning and the horizontal scanning may be determined according to the size of the transform unit and the intra-frame prediction mode.

[0076] The entropy coding unit 165 may perform entropy coding based on the value calculated by the rearrangement unit 160. For example, the entropy coding may use a variety of coding methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC).

[0077] The entropy coding unit 165 can encode various information such as residual value coefficient information and block type information, prediction mode information, partition unit information, prediction unit information and transmission unit information, motion vector information, reference frame information, block interpolation information, filtering information, etc. of the coding units originating from the rearrangement unit 160 and the prediction units 120 and 125.

[0078] The coefficient values ​​of the coding unit input from the rearrangement part 160 may be entropy encoded at the entropy encoding part 165 .

[0079] The inverse quantization unit 140 and the inverse transformation unit 145 inversely quantize the multiple values ​​quantized by the quantization unit 135, and inversely transform the values ​​transformed by the transformation unit 130. The residual values ​​generated in the inverse quantization unit 140 and the inverse transformation unit 145 can be merged with the prediction units predicted by the motion prediction unit, the motion compensation unit, and the intra prediction unit included in the prediction units 120 and 125 to generate a reconstructed block.

[0080] The filter unit 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).

[0081] The deblocking filter can remove block distortion generated in the reconstructed image due to the boundary between blocks. In order to determine whether to perform deblocking, it is possible to determine whether to apply the deblocking filter to the current block based on the pixels included in several columns or rows included in the block. In the case of applying the deblocking filter to the block, a strong filter (Strong Filter) or a weak filter (Weak Filter) can be applied according to the required deblocking filter strength. In addition, in the process of using the deblocking filter, when performing vertical filtering and horizontal filtering, horizontal filtering and vertical filtering can be processed simultaneously.

[0082] The offset correction unit can correct the offset between the video to be deblocked and the original video in pixel units. In order to perform offset correction on a specified image, the following method can be used, that is, after dividing the pixels included in the video into a predetermined number of regions, determining the region to be offset, and applying the offset to the corresponding region, or applying the offset by taking edge information of each pixel into consideration.

[0083] Adaptive loop filtering (ALF) can be performed based on the value of comparing the filtered reconstructed image with the original video. After the pixels included in the video are divided into predetermined groups, filtering can be performed differently for each group by determining a filter to be used for the corresponding group. Information related to whether to apply adaptive loop filtering and luminance signals can be transmitted by coding unit (Coding Unit, CU), and the shape and filter coefficients of the adaptive loop filter to be applied can be different for each block. In addition, it is also possible to apply the same type (fixed type) of adaptive loop filter regardless of the characteristics of the block to which it is applied.

[0084] The memory 155 may store the reconstructed block or image calculated by the filter unit 150 , and may provide the stored reconstructed block or image to the prediction units 120 , 125 when performing inter-frame prediction.

[0085] Figure 2 is a block diagram of a video decoder according to an embodiment of the present invention.

[0086] Reference Figure 2 The video decoder 200 may include an entropy decoding unit 210 , a rearrangement unit 215 , an inverse quantization unit 220 , an inverse transformation unit 225 , a prediction unit 230 , a prediction unit 235 , a filter unit 240 , and a memory 245 .

[0087] When a video bit stream is input from a video encoder, the input bit stream may be decoded in the reverse steps of the video encoder.

[0088] The entropy decoding unit 210 may perform entropy decoding in a step opposite to the step of performing entropy encoding in the entropy encoding unit of the video encoder. For example, corresponding to the method performed in the video encoder, various methods such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC) may be applied.

[0089] The entropy decoding unit 210 may decode information related to intra prediction and inter prediction performed by the encoder.

[0090] The rearrangement unit 215 can perform rearrangement based on a method of rearranging the bit stream entropy-decoded by the entropy decoding unit 210 in the encoding unit. The rearrangement can be performed by reconstructing a plurality of coefficients represented by a 1-dimensional vector form into coefficients in a 2-dimensional block shape. The rearrangement unit 215 receives information related to coefficient scanning performed in the encoding unit, and can perform rearrangement by performing reverse scanning based on the scanning order performed in the corresponding encoding unit.

[0091] The inverse quantization part 220 may perform inverse quantization based on the quantization parameter provided by the encoder and the coefficient value of the rearranged block.

[0092] The inverse transform unit 225 may perform an inverse discrete cosine transform and an inverse discrete sine transform on the quantization result performed by the video encoder, and the inverse discrete cosine transform and the inverse discrete sine transform belong to the inverse transform of the transform performed in the transform unit, that is, the inverse transform of the discrete cosine transform and the discrete sine transform. Among them, the DCT transform core may include at least one of DCT2 or DCT8, and the DST transform core may include DST7. Alternatively, if the transform is skipped in the video encoder, the inverse transform may not be performed in the inverse transform unit 225. The inverse transform may be performed based on the transmission unit determined in the video encoder. In the inverse transform unit 225 of the video decoder, the transform method (e.g., DCT or DST) may be selectively performed based on multiple information such as the prediction method, the size of the current block, and the prediction direction.

[0093] The prediction units 230 , 235 can generate a prediction block based on information related to prediction block generation provided by the entropy decoding unit 210 and previously decoded block or image information provided by the memory 245 .

[0094] As described above, when intra prediction is performed in the same manner as the operation in the video encoder, if the size of the prediction unit is the same as the size of the transform unit, intra prediction is performed on the prediction unit based on the pixel existing on the left side of the prediction unit, the pixel existing on the upper left, and the pixel existing on the upper side. If the size of the prediction unit when performing intra prediction is different from the size of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. In addition, intra prediction using only N×N partitioning for the minimum coding unit can also be applied.

[0095] The prediction units 230 and 235 may include a prediction unit determination unit, an inter-frame prediction unit, and an intra-frame 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 of the intra-frame prediction method, motion prediction related information of the inter-frame prediction method, and the like, and classifies the prediction unit according to the current coding unit to determine whether the prediction unit is performing inter-frame prediction or intra-frame prediction. The inter-frame prediction unit 230 may use the information required for the inter-frame prediction of the current prediction unit provided by the video encoder, and perform inter-frame prediction on the current prediction unit based on the information included in at least one of the previous image or the next image of the current image to which the current prediction unit belongs. Alternatively, inter-frame prediction may also be performed based on information of a portion of the reconstructed area within the current image to which the current prediction unit belongs.

[0096] In order to perform inter-frame 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, advanced motion vector prediction mode (AMVP Mode), or intra-frame block copy mode.

[0097] The intra prediction unit 235 can generate a prediction block based on pixel information within the current image. When the prediction unit is a prediction unit that has performed intra prediction, it is possible to perform intra prediction based on the intra prediction mode information of the prediction unit provided by the video encoder. The intra prediction unit 235 may include an adaptive intra smoothing (AIS, Adaptive IntraSmoothing) filter, a reference pixel interpolation unit, and a DC filter. The adaptive intra smoothing filter is a part that performs filtering on the reference pixels of the current block, and it can determine whether to apply the filter according to the prediction mode of the current prediction unit. The prediction mode of the prediction unit provided by the video encoder and the adaptive intra smoothing filter information can be used to perform adaptive intra smoothing filtering on the reference pixels of the current block. If the prediction mode of the current block is a mode in which adaptive intra smoothing filtering is not performed, the adaptive intra smoothing filter may not be applied.

[0098] For the reference pixel interpolation unit, if the prediction mode of the prediction unit is a prediction unit that performs intra-frame prediction based on the pixel value interpolated from the reference pixel, the reference pixel can be interpolated to generate the reference pixel in the pixel unit of integer value or fractional value. If the prediction mode of the current prediction unit is a prediction mode that generates the prediction block in a manner that does not interpolate the reference pixel, the reference pixel may not be interpolated. If the prediction mode of the current block is the DC mode, the DC filter can generate the prediction block by filtering.

[0099] The reconstructed block or image may be provided to the filter part 240. The filter part 240 may include a deblocking filter, an offset correction part, and an ALF.

[0100] Information related to whether to apply a deblocking filter to a corresponding block or image and information related to whether to apply a strong filter or a weak filter when applying the deblocking filter can be received from a video encoder. Information related to the deblocking filter provided by the video encoder is received from a deblocking filter of a video decoder, and deblocking filtering can be performed on the corresponding block at the video decoder.

[0101] The offset correction unit can perform offset correction on the reconstructed video based on the type of offset correction and offset amount information used for the video during encoding.

[0102] ALF may be applied to a coding unit based on information related to whether ALF is applied, ALF coefficient information, etc. provided by an encoder. Such ALF information may be provided by being included in a specific parameter set.

[0103] The memory 245 stores the reconstructed image or block so that the image or block can be used as a reference image or a reference block, and can provide the reconstructed image to an output section.

[0104] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present invention.

[0105] The largest coding block can be defined as a coding tree block. A picture can be divided into multiple coding tree units (CTUs). A coding tree unit is the largest coding unit and can also be called a largest coding unit (LCU). Figure 3 An example of dividing an image into a plurality of coding tree units is shown.

[0106] The size of the coding tree unit may be defined at a picture level or a sequence level. To this end, information indicating the size of the coding tree unit may be signaled through a picture parameter set or a sequence parameter set.

[0107] For example, the size of the coding tree unit of the entire image in the sequence may be set to 128×128. Alternatively, any one of 128×128 or 256×256 at the image level may be determined as the size of the coding tree unit. For example, the size of the coding tree unit in the first image may be set to 128×128, and the size of the coding tree unit in the second image may be set to 256×256.

[0108] The coding block can be generated by dividing the coding tree unit. The coding block represents the basic unit for performing the encoding / decoding process. For example, prediction or transformation can be performed according to different coding blocks, or the prediction coding mode can be determined according to different coding blocks. Among them, the prediction coding mode represents a method for generating a predicted image. For example, the prediction coding mode may include intra-frame prediction (Intra Prediction), inter-frame prediction (Inter Prediction), current picture referencing (Current Picture Referencing, CPR, or Intra Block Copy (Intra Block Copy, IBC)) or combined prediction (Combined Prediction). For the coding block, at least one prediction coding mode of intra-frame prediction, inter-frame prediction, current image reference or combined prediction can be used to generate a prediction block related to the coding block.

[0109] Information indicating the prediction coding mode of the current block may be signaled via a bitstream. For example, the information may be a 1-bit flag indicating whether the prediction coding mode is an intra mode or an inter mode. The current picture reference or combined prediction may be used only if the prediction coding mode of the current block is determined to be an inter mode.

[0110] The current picture reference is used to set the current picture as the reference picture and obtain the prediction block of the current block from the encoded / decoded area within the current picture. The current picture means the picture including the current block. Information indicating whether the current picture reference is applied to the current block can be sent by a bitstream signal. For example, the information can be a 1-bit flag. When the flag is true, the prediction coding mode of the current block can be determined as the current picture reference, and when the flag is false, the prediction mode of the current block can be determined as inter-frame prediction.

[0111] Alternatively, the prediction coding mode of the current block may be determined based on a reference image index. For example, when the reference image index points to the current image, the prediction coding mode of the current block may be determined as the current image reference. When the reference image index points to other images instead of the current image, the prediction coding mode of the current block may be determined as the inter-frame prediction. That is, the current image reference is a prediction method using information of an already encoded / decoded area within the current image, and the inter-frame prediction is a prediction method using information of other images that have been encoded / decoded.

[0112] Combined prediction refers to a coding mode composed of two or more combinations of intra-frame prediction, inter-frame prediction and current image reference. For example, when combined prediction is applied, a first prediction block can be generated based on one of intra-frame prediction, inter-frame prediction or current image reference, and a second prediction block can be generated based on the other. If a first prediction block and a second prediction block are generated, a final prediction block can be generated by an average operation or a weighted sum operation of the first prediction block and the second prediction block. Information indicating whether combined prediction is applied can be sent by a signal through a bitstream. The information can be a 1-bit flag.

[0113] Figure 4 is a diagram showing various types of partitioning of a coding block.

[0114] The coding block may be divided into a plurality of coding blocks based on quadtree partitioning, binary tree partitioning, or ternary tree partitioning. The divided coding block may also be further divided into a plurality of coding blocks based on quadtree partitioning, binary tree partitioning, or ternary tree partitioning.

[0115] Quadtree partitioning refers to a partitioning technique that divides the current block into 4 blocks. As a result of quadtree partitioning, the current block can be divided into 4 square partitions (refer to Figure 4 “SPLIT_QT” in part (a).

[0116] Binary tree partitioning refers to a partitioning technique for partitioning a current block into two blocks. The process of partitioning a current block into two blocks along a vertical direction (i.e., using a vertical line that crosses the current block) may be referred to as vertical binary tree partitioning, and the process of partitioning a current block into two blocks along a horizontal direction (i.e., using a horizontal line that crosses the current block) may be referred to as horizontal binary tree partitioning. The current block may be partitioned into two non-square partitions after binary tree partitioning. Figure 4 "SPLIT_BT_VER" in part (b) indicates the vertical binary tree partition result, and Figure 4 “SPLIT_BT_HOR” in part (c) indicates the result of horizontal binary tree partitioning.

[0117] Ternary tree partitioning refers to a partitioning technique for partitioning a current block into three blocks. The process of partitioning a current block into three blocks along the vertical direction (i.e., using two vertical lines that cross the current block) may be referred to as vertical ternary tree partitioning, and the process of partitioning a current block into three blocks along the horizontal direction (i.e., using two horizontal lines that cross the current block) may be referred to as horizontal ternary tree partitioning. The current block may be partitioned into three non-square partitions after ternary tree partitioning. In this case, the width / height of the partition located at the center of the current block may be twice the width / height of the other partitions. Figure 4 "SPLIT_TT_VER" in part (d) indicates the vertical ternary tree split result, and Figure 4 “SPLIT_TT_HOR” in part (e) indicates the horizontal ternary tree partitioning result.

[0118] The number of partitions of the coding tree unit may be defined as a partitioning depth. The maximum partitioning depth of the coding tree unit may be determined at a sequence or picture level. Thus, the maximum partitioning depth of the coding tree unit may be different according to different sequences or pictures.

[0119] Alternatively, the maximum partition depth for each of the plurality of partitioning techniques may be determined separately. For example, the maximum partition depth allowed for quadtree partitioning may be different from the maximum partition depth allowed for binary tree partitioning and / or ternary tree partitioning.

[0120] The encoder may signal information indicating at least one of a partition shape or a partition depth of the current block through a bitstream. The decoder may determine a partition shape and a partition depth of the coding tree unit based on the information parsed from the bitstream.

[0121] Figure 5 is a diagram showing a division pattern of a coding tree unit.

[0122] The process of partitioning a coding block using partitioning techniques such as quadtree partitioning, binary tree partitioning and / or ternary tree partitioning may be referred to as multi-tree partitioning.

[0123] The coding blocks generated by applying the multi-tree partitioning to the coding blocks may be referred to as a plurality of downstream coding blocks. When the partition depth of the coding block is k, the partition depth of the plurality of downstream coding blocks is set to k+1.

[0124] On the other hand, for a plurality of coding blocks whose partition depth is k+1, the coding block whose partition depth is k may be referred to as an upstream coding block.

[0125] The partition type of the current coding block can be determined based on at least one of the partition shape of the upstream coding block or the partition type of the adjacent coding block. The adjacent coding block is adjacent to the current coding block, which may include at least one of the upper adjacent block, the left adjacent block, or the adjacent block adjacent to the upper left corner of the current coding block. The partition type may include whether to partition a quadtree, whether to partition a binary tree, the binary tree partition direction, whether to partition a ternary tree, or the ternary tree partition direction.

[0126] In order to determine the division shape of the coding block, information indicating whether the coding block is divided can be sent by signaling through the bitstream. The information is a 1-bit flag "split_cu_flag", which, when true, indicates that the coding block is divided by a multi-tree division technique.

[0127] When "split_cu_flag" is true, information indicating whether the coding block is divided by quadtree can be signaled through the bitstream. The information is a 1-bit flag "split_qt_flag". When the flag is true, the coding block can be divided into 4 blocks.

[0128] For example, in Figure 5 In the example shown, as the coding tree unit is divided by quadtree, 4 coding blocks with a division depth of 1 are generated. In addition, quadtree division is applied again to the first coding block and the fourth coding block of the 4 coding blocks generated as a result of quadtree division. Finally, 4 coding blocks with a division depth of 2 can be generated.

[0129] And, a coding block having a split depth of 3 may be generated by applying quadtree splitting again to the coding block having a split depth of 2.

[0130] When quadtree partitioning is not applied to the coding block, it can be determined whether binary tree partitioning or ternary tree partitioning is performed on the coding block by considering at least one of the size of the coding block, whether the coding block is located at the image boundary, the maximum partition depth, or the partition shape of the adjacent blocks. When it is determined that binary tree partitioning or ternary tree partitioning is performed on the coding block, information indicating the partitioning direction can be sent by signaling through the bitstream. The information can be a 1-bit flag "mtt_split_cu_vertical_flag". It can be determined based on the flag whether the partitioning direction is vertical or horizontal. In addition, information indicating which of binary tree partitioning or ternary tree partitioning is applied to the coding block can be sent by signaling through the bitstream. The information can be a 1-bit flag "mtt_split_cu_binary_flag". It can be determined based on the flag whether binary tree partitioning or ternary tree partitioning is applied to the coding block.

[0131] For example, in Figure 5The example shown illustrates that vertical binary tree division is applied to a coding block with a division depth of 1, vertical ternary tree division is applied to a left coding block in the coding block generated as a result of the division, and vertical binary tree division is applied to a right coding block.

[0132] Inter-frame prediction refers to the prediction coding mode that uses the information of the previous image to predict the current block. For example, the block in the previous image at the same position as the current block (hereinafter referred to as the collocated block) can be set as the prediction block of the current block. Hereinafter, the prediction block generated based on the block at the same position as the current block is referred to as the collocated prediction block.

[0133] On the other hand, if an object existing in the previous image has moved to another location in the current image, the motion of the object can be used to effectively predict the current block. For example, if the moving direction and size of the object can be known by comparing the previous image and the current image, the motion information of the object can be considered to generate a prediction block (or prediction image) of the current block. Hereinafter, the prediction block generated using the motion information may be referred to as a motion prediction block.

[0134] A residual block can be generated by subtracting a prediction block from a current block. In this case, when there is motion of an object, the energy of the residual block can be reduced by using a motion prediction block instead of a co-located prediction block, thereby improving the compression performance of the residual block.

[0135] As described above, the process of generating a prediction block using motion information may be referred to as motion compensated prediction. In most inter-frame predictions, a prediction block may be generated based on motion compensated prediction.

[0136] The motion information may include at least one of a motion vector, a reference image index, a prediction direction, or a bidirectional weighted value index. The motion vector indicates the moving direction and size of an object. The reference image index specifies a reference image of a current block among a plurality of reference images included in a reference image list. The prediction direction refers to any one of unidirectional L0 prediction, unidirectional L1 prediction, or bidirectional prediction (L0 prediction and L1 prediction). At least one of the motion information in the L0 direction or the motion information in the L1 direction may be used according to the prediction direction of the current block. The bidirectional weighted value index specifies a weighted value for the L0 prediction block and a weighted value applied to the L1 prediction block.

[0137] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present invention.

[0138] Reference Fig. 9The inter-frame prediction method includes: determining an inter-frame prediction mode of a current block (S601); obtaining motion information of the current block according to the determined inter-frame prediction mode (S602); and performing motion compensation prediction of the current block based on the obtained motion information (S603).

[0139] Among them, the inter-frame prediction mode represents a variety of technologies for determining the motion information of the current block, which may include an inter-frame prediction mode using translation motion information and an inter-frame prediction mode using affine motion information. For example, the inter-frame prediction mode using translation motion information may include a merge mode and an advanced motion vector prediction mode, and the inter-frame prediction mode using affine motion information may include an affine merge mode and an affine motion vector prediction mode. According to the inter-frame prediction mode, the motion information of the current block may be determined based on neighboring blocks adjacent to the current block or information parsed from the bitstream.

[0140] The following describes in detail the inter-frame prediction method using affine motion information.

[0141] Figure 7 is a diagram showing the nonlinear motion of an object.

[0142] The motion of objects in a video may be nonlinear. Figure 7 In the example shown, nonlinear motion of the object may occur, such as zoom-in, zoom-out, rotation, or affine transformation of the camera. When nonlinear motion of the object occurs, the motion of the object cannot be effectively represented by the translation motion vector. Therefore, in the part where the nonlinear motion of the object occurs, the affine motion can be used instead of the translation motion, thereby improving the coding efficiency.

[0143] Figure 8 is a flowchart showing an inter-frame prediction method based on affine motion according to an embodiment of the present invention.

[0144] Whether to apply the inter-frame prediction technology based on affine motion to the current block can be determined based on information parsed from the bitstream. Specifically, whether to apply the inter-frame prediction technology based on affine motion to the current block can be determined based on at least one of a flag indicating whether the affine merge mode is applied to the current block or a flag indicating whether the affine motion vector prediction mode is applied to the current block.

[0145] When the inter-frame prediction technology based on affine motion is applied to the current block, an affine motion model of the current block may be determined (S1101). The affine motion model may be determined by at least one of a 6-parameter affine motion model or a 4-parameter affine motion model. The 6-parameter affine motion model uses 6 parameters to represent the affine motion, and the 4-parameter affine motion model uses 4 parameters to represent the affine motion.

[0146] Formula 1 shows the case where affine motion is represented by 6 parameters. Affine motion represents a translation motion with respect to a predetermined area determined by an affine seed vector.

[0147] [Formula 1]

[0148] v x =ax-by+e

[0149] v y =cx+dy+f

[0150] When 6 parameters are used to represent affine motion, complex motion can be represented, but the number of bits required to encode each parameter increases, which reduces encoding efficiency. Therefore, 4 parameters can also be used to represent affine motion. Formula 2 shows the case of using 4 parameters to represent affine motion.

[0151] [Formula 2]

[0152] v x =ax-by+e

[0153] v y =bx+ay+f

[0154] Information for determining an affine motion model for a current block may be encoded and may be signaled via a bitstream. For example, the information may be a 1-bit flag "affine_type_flag". A value of 0 for the flag indicates that a 4-parameter affine motion model is applied, and a value of 1 for the flag indicates that a 6-parameter affine motion model is applied. The flag may be encoded in units of slices, tiles, or blocks (e.g., coding blocks or coding tree units). When a flag is signaled at a slice level, an affine motion model determined at the slice level may be applied to all blocks in the slice.

[0155] 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 the affine merge mode is applied, the affine motion model of the current block may be determined as a 4-parameter motion model. On the other hand, when the affine motion vector prediction mode is applied, information for determining the affine motion model of the current block may be encoded and may be signaled via a bitstream. For example, when the 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".

[0156] Next, an affine seed vector of the current block may be derived (S1102). When a 4-parameter affine motion model is selected, a motion vector on two control points of the current block may be derived. On the other hand, when a 6-parameter affine motion model is selected, a motion vector on three control points of the current block may be derived. The motion vector on the control point may be referred to as an affine seed vector. The control point may include at least one of the upper left corner, the upper right corner, or the lower left corner of the current block.

[0157] Fig. 9 is a diagram showing an example of an affine seed vector for each affine motion model.

[0158] In the 4-parameter affine motion model, an affine seed vector associated with two of the upper left corner, upper right corner, or lower left corner can be derived. Fig. 9 In the example shown in part (a), when the 4-parameter affine motion model is selected, the affine vector can be derived by using the affine seed vector sv0 associated with the upper left corner of the current block (e.g., the upper left sample (x0, y0)) and the affine seed vector sv1 associated with the upper right corner of the current block (e.g., the upper right sample (x1, y1)). The affine seed vector associated with the lower left corner can also be used instead of the affine seed vector associated with the upper left corner, or the affine seed vector associated with the lower left corner can also be used instead of the affine seed vector associated with the upper right corner.

[0159] In the 6-parameter affine motion model, affine seed vectors associated with the upper left corner, upper right corner, and lower left corner can be derived. Fig. 9 In the example shown in part (b), when the 6-parameter affine motion model is selected, the affine vector can be derived by using the affine seed vector sv0 associated with the upper left corner of the current block (e.g., the upper left sample (x0, y0)), the affine seed vector sv1 associated with the upper right corner of the current block (e.g., the upper right sample (x1, y1)), and the affine seed vector sv2 associated with the upper left corner of the current block (e.g., the upper left sample (x2, y2)).

[0160] In the embodiments described later, under the 4-parameter affine motion model, the affine seed vectors of the upper left control point and the upper right control point are respectively referred to as the first affine seed vector and the second affine seed vector. In the embodiments described later using 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 may be replaced by the affine seed vector of the lower left control point (the third affine seed vector) or the affine seed vector of the lower right control point (the fourth affine seed vector).

[0161] Furthermore, under the 6-parameter affine motion model, the affine seed vectors of the upper left control point, the upper right control point, and the lower left control point are respectively referred to as the first affine seed vector, the second affine seed vector, and the third affine seed vector. In the embodiment using the first affine seed vector, the second affine seed vector, and the third affine seed vector described later, at least one of the first affine seed vector, the second affine seed vector, and the third affine seed vector may be replaced by the affine seed vector of the lower right control point (the fourth affine seed vector).

[0162] The affine vector of each sub-block can be derived by using the affine seed vector (S1103). The affine vector represents a translation motion vector derived based on the affine seed vector. The affine vector of the sub-block can be called an affine sub-block motion vector or a sub-block motion vector.

[0163] Fig.10 is a diagram showing an example of affine vectors of sub-blocks under a 4-parameter motion model.

[0164] The affine vector of the sub-block can be derived based on the position of the control point, the position of the sub-block and the affine seed vector. For example, Formula 3 represents an example of deriving an affine sub-block vector.

[0165] [Formula 3]

[0166]

[0167] In Formula 3, (x, y) represents the position of the sub-block. The position of the sub-block represents the position of the reference sample included in the sub-block. The reference sample may be a sample located at the upper left corner of the sub-block, or a sample located at the center of at least one of the x-axis or y-axis coordinates. (x0, y0) represents the position of the first control point, and (sv 0x , sv 0y ) represents the first affine seed vector. In addition, (x1, y1) represents the position of the second control point, and (sv 1x , sv 1y ) represents the second affine seed vector.

[0168] When the first control point and the second control point correspond to the upper left corner and the upper right corner of the current block, respectively, x1-x0 may be set to the same value as the width of the current block.

[0169] Thereafter, motion compensation prediction of each sub-block may be performed using the affine vector of each sub-block (S1104). After performing motion compensation prediction, a prediction block associated with each sub-block may be generated. The prediction block of the sub-block may be set as the prediction block of the current block.

[0170] Next, an inter-frame prediction method using translational motion information is described in detail.

[0171] The motion information of the current block may be derived from the motion information of other blocks of the current block. The other blocks may be blocks that are encoded / decoded with inter-frame prediction with higher priority than the current block. The case where the motion information of the current block is set to be the same as the motion information of other blocks may be defined as a merge mode. Also, the case where the motion vectors of other blocks are set to the predicted value of the motion vector of the current block may be defined as a motion vector prediction mode.

[0172] Fig.11 is a flow chart of the process of deriving motion information of the current block in merge mode.

[0173] A merge candidate of a current block may be derived (S1101). The merge candidate of the current block may be derived from a block encoded / decoded with inter prediction before the current block.

[0174] Fig.12 is a diagram showing an example of candidate blocks for deriving merge candidates.

[0175] The candidate block may include at least one of a neighboring block including samples adjacent to the current block or a non-neighboring block including samples not adjacent to the current block. Hereinafter, samples used to determine the candidate block are designated as reference samples. In addition, reference samples adjacent to the current block are referred to as neighboring reference samples, and reference samples not adjacent to the current block are referred to as non-neighboring reference samples.

[0176] The adjacent reference sample may be included in an adjacent column of the leftmost column of the current block, or in an adjacent row of the topmost row of the current block. For example, if 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 of (-1, H-1), a block including a reference sample at a position of (W-1, -1), a block including a reference sample at a position of (W, -1), a block including a reference sample at a position of (-1, H), or a block including a reference sample at a position of (-1, -1) may be used as a candidate block. Referring to the accompanying drawings, adjacent blocks indexed from 0 to 4 may be used as candidate blocks.

[0177] The non-adjacent reference sample means a sample whose at least one of the x-axis distance or the y-axis distance between the reference samples 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 to the left reference sample is a predefined value, a block including a non-adjacent sample whose y-axis distance to the upper reference sample is a predefined value, or a block including a non-adjacent sample whose x-axis distance and y-axis distance to the upper left reference sample are predefined values ​​can be used as a candidate block. The predefined value can be an integer such as 4, 8, 12, 16, etc. Referring to the accompanying drawings, at least one of the blocks indexed from 5 to 26 can be used as a candidate block.

[0178] Samples that are not on the same vertical line, horizontal line, or diagonal line as the adjacent reference samples may be set as non-adjacent reference samples.

[0179] Fig.13 is a diagram showing the positions of reference samples.

[0180] like Fig.13 In the example shown, the x-coordinate of the upper non-adjacent reference sample can be set to be different from the x-coordinate of the upper adjacent reference sample. For example, when the position of the upper adjacent reference sample is (W-1, -1), the position of the upper non-adjacent reference sample that is N away from the upper adjacent reference sample along the y-axis can be set to ((W / 2)-1, -1-N), and the position of the upper non-adjacent reference sample that is 2N away from the upper adjacent reference sample along the y-axis can be set to (0, -1-2N). That is, the position of the non-adjacent reference sample can be determined based on the position of the adjacent reference sample and the distance between the adjacent reference sample and the adjacent reference sample.

[0181] Hereinafter, a candidate block including adjacent reference samples among the candidate blocks is referred to as an adjacent block, and a block including non-adjacent reference samples is referred to as a non-adjacent block.

[0182] When the distance between the current block and the candidate block is greater than or equal to a threshold, the candidate block may be set to be unavailable 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 to the value obtained by adding or subtracting an offset value from the height of the coding tree unit (e.g., ctu_height±N). The offset value N is a predefined value in the encoder and decoder, and may be set to 4, 8, 16, 32, or ctu_height.

[0183] When a difference between the y-axis coordinate of the current block and the y-axis coordinate of a sample included in the candidate block is greater than a threshold, the candidate block may be determined to be unusable as a merge candidate.

[0184] Alternatively, a candidate block that does not belong to the same coding tree unit as the current block may be set to be unavailable as a merge candidate. For example, when the reference sample exceeds the upper boundary of the coding tree unit to which the current block belongs, the candidate block including the reference sample may be set to be unavailable as a merge candidate.

[0185] If, when the upper boundary of the current block is adjacent to the upper boundary of the coding tree unit, multiple candidate blocks are determined to be unavailable as merge candidates, the encoding / decoding efficiency of the current block is reduced. In order to solve the above problem, the candidate blocks may be set so that the number of candidate blocks located above the current block is greater than the number of candidate blocks located to the left of the current block.

[0186] Fig.14 is a diagram showing an example of candidate blocks for deriving merge candidates.

[0187] like Fig.14 In the example shown, the upper blocks of the N block columns above the current block and the left blocks of the M block columns on the left side of the current block can be set as candidate blocks. At this time, by setting M to be greater than N, the number of left candidate blocks can be set to be greater than the number of upper candidate blocks.

[0188] For example, the difference between the y-axis coordinate of the reference sample in the current block and the y-axis coordinate of the upper block that can be used as the candidate block can be set to not exceed N times the height of the current block. In addition, the difference between the x-axis coordinate of the reference sample in the current block and the x-axis coordinate of the left block that can be used as the candidate block can be set to not exceed M times the width of the current block.

[0189] For example, Fig.14 In the illustrated example, it is shown that blocks belonging to two block columns above the current block and blocks belonging to five block columns to the left of the current block are set as candidate blocks.

[0190] The merge candidate may also be derived from a temporally neighboring block included in a different image from the current block. For example, the merge candidate may be derived from a co-located block included in a co-located image.

[0191] The motion information of the merge candidate may be set to be the same as the motion information of the candidate block. For example, at least one of the motion vector, reference image index, prediction direction, or bidirectional weighted value index of the candidate block may be set as the motion information of the merge candidate.

[0192] A merge candidate list including merge candidates may be generated (S1102). The merge candidates may be classified into adjacent merge candidates derived from neighboring blocks adjacent to the current block and non-adjacent merge candidates derived from non-adjacent blocks.

[0193] The indexes of the plurality of merge candidates in the merge candidate list may be assigned in a predetermined order. For example, the index assigned to the adjacent merge candidate may have a smaller value than the index assigned to the non-adjacent merge candidate. Fig.12 or Fig.14 The index of each block shown may be assigned to each merge candidate.

[0194] When a plurality of merge candidates are included in the merge candidate list, at least one of the plurality of merge candidates may be selected (S1103). At this time, information indicating whether the motion information of the current block is derived from an adjacent merge candidate may be sent by a bitstream signal. The information may be a 1-bit flag. For example, a syntax element isAdjancentMergeFlag indicating whether the motion information of the current block is derived from an adjacent merge candidate may be sent by a bitstream signal. When the value of the syntax element isAdjancentMergeFlag is 1, the motion information of the current block may be derived based on the adjacent merge candidate. On the other hand, when the value of the syntax element isAdjancentMergeFlag is 0, the motion information of the current block may be derived based on a non-adjacent merge candidate.

[0195] Information for specifying any one of the plurality of merge candidates may be signaled through a bitstream. For example, information indicating any one index of the merge candidates included in the merge candidate list may be signaled through a bitstream.

[0196] When isAdjacentMergeflag is 1, a syntax element merge_idx for determining any one of the adjacent merge candidates may be signaled. A maximum value of the syntax element merge_idx may be set to a value that differs from the number of adjacent merge candidates by 1.

[0197] When isAdjacentMergeflag is 0, a syntax element NA_merge_idx for determining any one of the non-adjacent merge candidates may be signaled. The syntax element NA_merge_idx indicates a value obtained by subtracting the index of the non-adjacent merge candidate from the number of adjacent merge candidates. The decoder may select a non-adjacent merge candidate by adding the index determined according to NA_merge_idx to the number of adjacent merge candidates.

[0198] When the number of merge candidates included in the merge candidate list is less than a threshold, the merge candidates included in the inter-frame motion information list may be added to the merge candidate list. The threshold may be the maximum number of merge candidates that may be included in the merge candidate list or the value of the maximum number of merge candidates minus an offset. The offset may be an integer such as 1 or 2. The inter-frame motion information list may include merge candidates derived based on a block encoded / decoded before the current block.

[0199] The inter-frame motion information list includes merge candidates derived from blocks encoded / decoded based on inter-frame prediction within the current image. For example, the motion information of the merge candidates included in the inter-frame motion information list can be set to be the same as the motion information of the blocks encoded / decoded based on inter-frame prediction. The motion information may include at least one of a motion vector, a reference image index, a prediction direction, or a bidirectional weighted value index.

[0200] For convenience of explanation, the merge candidates included in the inter-frame motion information list are referred to as inter-frame merge candidates.

[0201] The maximum number of merge candidates that can be included in the inter-frame motion information list can be predefined in the encoder and the decoder. For example, the maximum number of merge candidates that can be included in the inter-frame motion information list can be 1, 2, 3, 4, 5, 6, 7, 8 or more (e.g., 16).

[0202] Alternatively, information indicating the maximum number of merging candidates of the inter-frame motion information list may be signaled through a bitstream, and the information may be signaled at a sequence level, a picture level, or a slice level.

[0203] Alternatively, the maximum merging candidate number of the inter-motion information list may be determined according to the size of an image, the size of a slice, or the size of a coding tree unit.

[0204] The inter-frame motion information list can 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-frame motion information list is also initialized, and the inter-frame motion information list may not include any merge candidates.

[0205] Alternatively, information indicating whether to initialize the inter-frame motion information list may also be signaled via the bitstream. The information may be signaled at a slice level, a tile level, a brick level, or a block level. Before the information indicates that the inter-frame motion information list is initialized, the configured inter-frame motion information list may be used.

[0206] Alternatively, information related to inter-frame merge candidates can be signaled through a picture parameter set or a slice header. Even if a slice is initialized, the inter-frame motion information list can also include initial inter-frame merge candidates. Thus, the inter-frame merge candidates can be used for blocks that are encoded / decoded for the first time within a slice.

[0207] The blocks are encoded / decoded according to the encoding / decoding order, and a plurality of blocks encoded / decoded based on the inter prediction may be sequentially set as inter merging candidates according to the encoding / decoding order.

[0208] Fig.15 is a flowchart showing the update status of the inter-frame motion information list.

[0209] When inter prediction is performed on a current block (S1501), an inter merge candidate may be derived based on the current block (S1502). The motion information of the inter merge candidate may be set to be the same as the motion information of the current block.

[0210] When the inter-motion information list is empty ( S1503 ), the inter-merging candidate derived based on the current block may be added to the inter-motion information list ( S1504 ).

[0211] When the inter-frame motion information list already includes the inter-frame merge candidate (S1503), a redundancy check may be performed on the motion information of the current block (or the inter-frame merge candidate derived based on the current block) (S1505). The redundancy check is used to determine whether the motion information of the inter-frame merge candidate stored in the inter-frame motion information list is the same as the motion information of the current block. The redundancy check may be performed on all inter-frame merge candidates stored in the inter-frame motion information list as objects. Alternatively, the redundancy check may be performed on inter-frame merge candidates whose index is above or below the threshold among the inter-frame merge candidates stored in the inter-frame motion information list.

[0212] When an inter-frame merge candidate having the same motion information as the motion information of the current block is not included, the inter-frame merge candidate derived based on the current block can be added to the inter-frame motion information list (S1508). Whether the inter-frame merge candidates are the same can be determined based on whether the motion information (e.g., motion vector and / or reference image index, etc.) of the inter-frame merge candidates is the same.

[0213] In this case, when the maximum number of inter-frame merge candidates has been stored in the inter-frame motion information list (S1506), the earliest inter-frame merge candidate is deleted (S1507), and the inter-frame merge candidate derived based on the current block can be added to the inter-frame motion information list (S1508).

[0214] A plurality of inter-frame merge candidates may be identified according to respective indexes. When an inter-frame merge candidate derived from the current block is added to the inter-frame motion information list, the lowest index (e.g., 0) is assigned to the inter-frame merge candidate, and the indexes of the stored inter-frame merge candidates may be increased by 1, respectively. In this case, when the maximum number of inter-frame merge candidates is stored in the inter-frame motion information list, the inter-frame merge candidate with the largest index is removed.

[0215] Alternatively, when an inter-frame merge candidate derived from the current block is added to the inter-frame motion information list, the maximum index may be assigned to the inter-frame merge candidate. For example, when the number of inter-frame merge candidates stored in the inter-frame motion information list is less than the maximum value, the inter-frame merge candidate may be assigned an index having the same value as the number of stored inter-frame merge candidates. Alternatively, when the number of inter-frame merge candidates stored in the inter-frame motion information list is equal to the maximum value, the inter-frame merge candidate may be assigned an index obtained by subtracting 1 from the maximum value. Furthermore, the inter-frame merge candidate with the smallest index is removed, and the indices of the remaining multiple stored inter-frame merge candidates are respectively reduced by 1.

[0216] Fig.16 is a diagram showing an embodiment of updating an inter-frame merging candidate list.

[0217] It is assumed that an inter-frame merge candidate derived from the current block is added to the inter-frame merge candidate list and a maximum index is assigned to the inter-frame merge candidate. Also, it is assumed that a maximum number of inter-frame merge candidates have been stored in the inter-frame merge candidate list.

[0218] When the inter-frame merge candidate HmvpCand[n+1] derived from the current block is added to the inter-frame merge candidate list HmvpCandList, the inter-frame merge candidate HmvpCand[0] with the smallest index is deleted from the stored inter-frame merge candidates, and the indexes of the remaining inter-frame merge candidates are respectively reduced by 1. In addition, the index of the inter-frame merge candidate HmvpCand[n+1] derived from the current block can be set to the maximum value (in Fig.16 In the example shown, n).

[0219] When the same inter merge candidate as the inter merge candidate derived based on the current block has been stored ( S1505 ), the inter merge candidate derived based on the current block may not be added to the inter motion information list ( S1509 ).

[0220] Alternatively, as the inter-frame merge candidate derived based on the current block is added to the inter-frame motion information list, the stored inter-frame merge candidate identical to the inter-frame merge candidate may also be removed. In this case, the index of the stored inter-frame merge candidate is updated.

[0221] Fig.17 2 is a diagram showing an example in which the index of the stored inter-frame merging candidate is updated.

[0222] When the index of the stored inter-frame merge candidate that is the same as the inter-frame merge candidate mvCand derived based on the current block is hIdx, the stored inter-frame merge candidate is deleted, and the indexes of the inter-frame merge candidates with indexes greater than hIdx can be reduced by 1. Fig.17 In the illustrated example, HmvpCand[2] which is the same as mvCand is deleted from the inter-frame motion information list HvmpCandList, and the indexes of HmvpCand[3] to HmvpCand[n] are each decreased by 1.

[0223] And, the inter-frame merge candidate mvCand derived based on the current block may be added to the end of the inter-frame motion information list.

[0224] Alternatively, the index assigned to the same stored inter-frame merge candidate as the inter-frame merge candidate derived based on the current block may be updated. For example, the index of the stored inter-frame merge candidate may be changed to a minimum value or a maximum value.

[0225] The motion information of the blocks included in the predetermined area may be set to not be added to the inter-frame motion information list. For example, the inter-frame merge candidate derived based on the motion information of the blocks included in the merge processing area cannot be added to the inter-frame motion information list. Since the encoding / decoding order of the blocks included in the merge processing area is not defined, it is inappropriate to use the motion information of any of these blocks for inter-frame prediction of other blocks. Thus, the inter-frame merge candidate derived based on the blocks included in the merge processing area may not be added to the inter-frame motion information list.

[0226] When performing motion compensation prediction with the help of sub-block units, inter-frame merge candidates can be derived based on motion information of representative sub-blocks among multiple sub-blocks included in the current block. For example, when sub-block merge candidates are used for the current block, inter-frame merge candidates can be derived based on motion information of representative sub-blocks among the sub-blocks.

[0227] The motion vector of the sub-block can be derived in the following order. First, any one of the merge candidates included in the merge candidate list of the current block can be selected, and the initial shift vector (shVector) can be derived based on the motion vector of the selected merge candidate. And, by adding the position (xSb, ySb) of the reference sample (e.g., the upper left sample or the middle position sample) of each sub-block in the coding block to the initial shift vector, the shifted sub-block with the reference sample position (xColSb, yColSb) can be derived. The following formula 4 shows the formula for deriving the shifted sub-block.

[0228] [Formula 4]

[0229] (xColSb, yColSb) = (xSb+shVector[0]>>4, ySb+shVector[1]>>4)

[0230] Next, the motion vector of the co-located block corresponding to the center position of the sub-block including (xColSb, yColSb) is set as the motion vector of the sub-block including (xSb, ySb).

[0231] The representative sub-block may mean a sub-block including an upper left sample or a center sample of the current block.

[0232] Fig.18 is a diagram showing the positions of representative sub-blocks.

[0233] Fig.18 (a) shows an example of setting the sub-block located at the upper left of the current block as the representative sub-block, Fig.18 (b) shows an example of setting a subblock located at the center of the current block as a representative subblock. When motion compensation prediction is performed in units of subblocks, an inter-frame merge candidate of the current block can be derived based on a motion vector of a subblock including an upper left sample of the current block or a subblock including a central sample of the current block.

[0234] Based on the inter prediction mode of the current block, it can also be determined whether the current block is used as an inter merge candidate. For example, a block encoded / decoded based on an affine motion model can be set to be unusable as an inter merge candidate. Thus, even if the current block is encoded / decoded by inter prediction, when the inter prediction mode of the current block is an affine prediction mode, the inter prediction motion information list will not be updated based on the current block.

[0235] Alternatively, the inter-frame merge candidate can also be derived based on at least one sub-block vector of the sub-block included in the block encoded / decoded based on the affine motion model. For example, the inter-frame merge candidate can be derived using the sub-block located at the upper left of the current block, the sub-block located at the center, or the sub-block located at the upper right. Alternatively, the average value of the sub-block vectors of multiple sub-blocks can also be set as the motion vector of the inter-frame merge candidate.

[0236] Alternatively, the inter-frame merge candidate can also be derived based on the average value of the affine seed vector of the block encoded / decoded based on the affine motion model. For example, the average value of at least one of the first affine seed vector, the second affine seed vector, or the third affine seed vector of the current block is set as the motion vector of the inter-frame merge candidate.

[0237] Alternatively, the inter-frame motion information list may be configured for different inter-frame prediction modes. For example, at least one of an inter-frame motion information list for a block encoded / decoded by intra-frame block copy, an inter-frame motion information list for a block encoded / decoded based on a translational motion model, or an inter-frame motion information list for a block encoded / decoded based on an affine motion model may be defined. Depending on the inter-frame prediction mode of the current block, any one of the multiple inter-frame motion information lists may be selected.

[0238] Fig.19 An example of generating an inter-frame motion information list for different inter-frame prediction modes is shown.

[0239] When a block is encoded / decoded based on a non-affine motion model, the inter-frame merge candidate mvCand derived based on the block can be added to the inter-frame non-affine motion information list HmvpCandList. On the other hand, when a block is encoded / decoded based on an affine motion model, the inter-frame merge candidate mvAfCand derived based on the block can be added to the inter-frame affine motion information list HmvpAfCandList.

[0240] The affine seed vector of the block may be stored in an inter-frame merge candidate derived from the block encoded / decoded based on the affine motion model. Thus, the inter-frame merge candidate may be used as a merge candidate for deriving the affine seed vector of the current block.

[0241] In addition to the inter-frame motion information list described, another inter-frame motion information list may be defined. In addition to the inter-frame motion information list described (hereinafter referred to as the first inter-frame motion information list), a long-term motion information list (hereinafter referred to as the second inter-frame motion information list) may be defined. The long-term motion information list includes long-term merge candidates.

[0242] When both the first inter-frame motion information list and the second inter-frame motion information list are empty, the inter-frame merge candidate can be added to the second inter-frame motion information list first. The inter-frame merge candidate can be added to the first inter-frame motion information list only after the number of inter-frame merge candidates available in the second inter-frame motion information list reaches the maximum number.

[0243] Alternatively, one inter-frame merge candidate may also be added to both the second inter-frame motion information list and the first inter-frame motion information list.

[0244] In this case, the second inter-frame motion information list that has been configured may not be updated. Alternatively, when the decoding area is above a predetermined ratio of the slice, the second inter-frame motion information list may be updated. Alternatively, the second inter-frame motion information list may be updated every N coding tree unit rows.

[0245] On the other hand, the first inter motion information list may be updated whenever a block encoded / decoded with inter prediction is generated. However, the inter merge candidate added to the second inter motion information list may also be set not to be used for updating the first inter motion information list.

[0246] Information for selecting any one of the first inter-frame motion information list or the second inter-frame motion information list may be sent by signaling through a bitstream. When the number of merge candidates included in the merge candidate list is less than a threshold, the merge candidates included in the inter-frame motion information list indicated by the information may be added to the merge candidate list.

[0247] Alternatively, the inter-frame motion information list may be selected based on the size, shape, inter-frame prediction mode, bidirectional prediction, motion vector refinement, or triangle partitioning of the current block.

[0248] Alternatively, even when the inter-frame merge candidates included in the first inter-frame motion information list are added, the number of merge candidates included in the merge candidate list is still less than the maximum merge number, the inter-frame merge candidates included in the second inter-frame motion information list can be added to the merge candidate list.

[0249] Fig. 20 is a diagram showing an example of adding an inter merge candidate included in a long-term motion information list to a merge candidate list.

[0250] When the number of merge candidates included in the merge candidate list is less than the maximum number, the inter-frame merge candidates included in the first inter-frame motion information list HmvpCandList may 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 when the inter-frame merge candidates included in the first inter-frame motion information list are added to the merge candidate list, the inter-frame merge candidates included in the long-term motion information list HmvpLTCandList may be added to the merge candidate list.

[0251] The inter-frame merge candidate may be set to include additional information in addition to the motion information. For example, the size, shape, or partition information of the storage block may be added to the inter-frame merge candidate. When constructing the merge candidate list of the current block, only the inter-frame merge candidates whose size, shape, or partition information is the same or similar to that of the current block are used in the inter-frame merge candidate, or the inter-frame merge candidates whose size, shape, or partition information is the same or similar to that of the current block may be preferentially added to the merge candidate list.

[0252] Alternatively, inter-frame motion information lists may be generated for different block sizes, shapes, or partition information. The inter-frame motion information list corresponding to the shape, size, or partition information of the current block among the plurality of inter-frame motion information lists may be used to generate a merge candidate list for the current block.

[0253] When the number of merge candidates included in the merge candidate list of the current block is less than a threshold, the inter-frame merge candidates included in the inter-frame motion information list may be added to the merge candidate list. The adding process is performed in ascending or descending order of the index. For example, the inter-frame merge candidate with the largest index may be added to the merge candidate list.

[0254] When an inter merge candidate included in the inter motion information list is to be added to the merge candidate list, a redundancy check between the inter merge candidate and a plurality of merge candidates already stored in the merge candidate list may be performed.

[0255] It is also possible to perform redundancy checks only on some of the inter-frame merge candidates included in the inter-frame motion information list. For example, redundancy checks may be performed only on inter-frame merge candidates with indices above or below a threshold. Alternatively, redundancy checks may be performed only on the N merge candidates with the largest indices or the N merge candidates with the smallest indices.

[0256] Alternatively, a redundancy check may be performed only on some of the merge candidates stored in the merge candidate list. For example, a redundancy check may be performed only on merge candidates with an index above a threshold or below a threshold or on merge candidates derived from a block at a specific position. The specific position may include at least one of a left neighboring block, an upper neighboring block, an upper right neighboring block, or a lower left neighboring block of the current block.

[0257] Fig.21 is a diagram showing an example in which redundancy checking is performed only on some merge candidates.

[0258] When adding the inter-frame merge candidate HmvpCand[j] to the merge candidate list, a redundancy check may be performed between the inter-frame merge candidate and the two merge candidates with the largest indexes, mergeCandList[NumMerge-2] and mergeCandList[NumMerge-1]. NumMerge may represent the number of available spatial merge candidates and temporal merge candidates.

[0259] Different from the example shown in the figure, when the inter-frame merge candidate HmvpCand[j] is to be added to the merge candidate list, a redundancy check between the inter-frame merge candidate and the two merge candidates with the smallest index can also be performed. For example, it can be confirmed 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 only on at least one of the merge candidates derived from the adjacent block located to the left of the current block or the merge candidates derived from the adjacent block located above the current block. When there is no merge candidate derived from a specific position in the merge candidate list, the inter-frame merge candidate can be added to the merge candidate list without performing a redundancy check.

[0260] In the event that a merge candidate identical to a first inter merge candidate is found, when performing a redundancy check on a second inter merge candidate, a redundant check of the merge candidate identical to the first inter merge candidate may be skipped.

[0261] Fig. 22 is a diagram showing an example of skipping redundant checking of a specific merge candidate.

[0262] When an inter-frame merge candidate HmvpCand[i] with index i is to be added to the merge candidate list, a redundancy check between the inter-frame merge candidate and the merge candidates already stored in the merge candidate list may be performed. In this case, when a merge candidate mergeCandList[j] identical to the inter-frame merge candidate HmvpCand[i] is found, the inter-frame merge candidate HmvpCand[i] will not be added to the merge candidate list, and a redundancy check between the inter-frame merge candidate HmvpCand[i-1] with index i-1 and the merge candidate may be performed. In this case, the redundancy check between the inter-frame merge candidate HmvpCand[i-1] and the merge candidate mergeCandList[j] may be skipped.

[0263] For example, in Fig. 22 In the example shown, it is determined that HmvpCand[i] is the same as mergeCandList[2]. Therefore, HmvpCand[i] is not added to the merge candidate list, and a redundancy check can be performed on HmvpCand[i-1]. In this case, the redundancy check between HvmpCand[i-1] and mergeCandList[2] can be skipped.

[0264] When the number of merge candidates included in the merge candidate list of the current block is less than a threshold value, in addition to the inter-frame merge candidate, at least one of a paired merge candidate or a zero merge candidate may also be included. A paired merge candidate refers to a merge candidate that uses the average of the motion vectors of two or more merge candidates as a motion vector, and a zero merge candidate refers to a merge candidate whose motion vector is 0.

[0265] The merge candidate list of the current block can add merge candidates in the following order.

[0266] Spatial merge candidate - Temporal merge candidate - Inter-frame merge candidate - (Inter-frame affine merge candidate) - Paired merge candidate - Zero merge candidate

[0267] A spatial merge candidate is a merge candidate derived from at least one of an adjacent block or a non-adjacent block, and a temporal merge candidate is a merge candidate derived from a previous reference image. The inter-frame affine merge candidate column represents an inter-frame merge candidate derived from a block encoded / decoded with an affine motion model.

[0268] The inter-frame motion information list can also be used in the advanced motion vector prediction mode. For example, when the number of motion vector prediction candidates included in the motion vector prediction candidate list of the current block is less than a threshold, the inter-frame merge candidate included in the inter-frame motion information list is set as the motion vector prediction candidate associated with the current block. Specifically, the motion vector of the inter-frame merge candidate is set as the motion vector prediction candidate.

[0269] If any one of the motion vector prediction candidates included in the motion vector prediction candidate list of the current block is selected, the selected candidate is set as the motion vector prediction value of the current block. After that, after decoding the motion vector residual value of the current block, the motion vector of the current block can be obtained by adding the motion vector prediction value and the motion vector residual value.

[0270] The motion vector prediction candidate list of the current block may be constructed in the following order.

[0271] Spatial motion vector prediction candidate - Temporal motion vector prediction candidate - Inter-frame decoding area merging candidate - (Inter-frame decoding area affine merging candidate) - Zero motion vector prediction candidate

[0272] The spatial motion vector prediction candidate refers to a motion vector prediction candidate derived from at least one of the adjacent blocks or non-adjacent blocks, and the temporal motion vector prediction candidate refers to a motion vector prediction candidate derived from the previous reference image. The inter-frame affine merge candidate column represents the inter-frame motion vector prediction candidate derived from the block encoded / decoded with the affine motion model. The zero motion vector prediction candidate represents a candidate whose motion vector value is 0.

[0273] The coding block may be divided into a plurality of prediction units, and prediction may be performed on the divided prediction units, respectively, wherein the prediction unit refers to a basic unit for prediction.

[0274] The coding block may be divided using at least one of a vertical line, a horizontal line, a slant line, or a diagonal line. Information for determining at least one of the number, angle, or position of lines that divide the coding block may be sent by a bitstream signal. For example, information representing any one of the division type candidates for the coding block may be sent by a bitstream signal, or information specifying any one of a plurality of line candidates for dividing the coding block may be sent by a bitstream signal. Alternatively, information for determining the number or type of line candidates for dividing the coding block may be sent by a bitstream signal. For example, using a 1-bit flag, it may be determined whether a slant line having an angle greater than a diagonal line and / or a slant line having an angle less than a diagonal line can be used as a line candidate.

[0275] Alternatively, at least one of the number, angle or position of lines partitioning the coding block may be adaptively determined based on at least one of an intra prediction mode of the coding block, an inter prediction mode, a position of a merging candidate that can be used, or a partition type of a neighboring block.

[0276] If the coding block is divided into a plurality of prediction units, intra prediction or inter prediction may be performed on each of the divided prediction units.

[0277] Fig.23 is a diagram showing an example of dividing a coding block into a plurality of prediction units using diagonal lines.

[0278] As in Fig.23 (a) and Fig.23 In the example shown in (b), the coding block can be divided into two triangular prediction units using a diagonal line.

[0279] exist Fig.23 (a) and Fig.23 In (b), a coding block is divided into two prediction units using a diagonal line connecting two vertices of the coding block. However, a slanted line in which at least one end of the line does not pass through a vertex of the coding block may be used to divide the coding block into two prediction units.

[0280] Fig.24 is a diagram showing an example of dividing a coding block into two prediction units.

[0281] As in Fig.24 (a) and Fig.24 In the example shown in (b), the coding block may be divided into two prediction units using an oblique line whose two ends touch the upper boundary and the lower boundary of the coding block respectively.

[0282] Alternatively, as in Fig.24 (c) and Fig.24 In the example shown in (d), the coding block may be divided into two prediction units using an oblique line whose two ends touch the left and right boundaries of the coding block, respectively.

[0283] Alternatively, the coding block may be divided into two prediction blocks of different sizes. For example, the oblique line dividing the coding block is set to contact two boundary surfaces forming a vertex, thereby dividing the coding block into two prediction units of different sizes.

[0284] Fig.25 A diagram showing an example of dividing a coding block into a plurality of prediction blocks having different sizes.

[0285] As in Fig.25 (a) and Fig.25 In the example shown in (b), the coding block can be divided into two prediction units with different sizes by setting the diagonal line connected at the upper left corner or the lower right corner of the coding block to pass through the left boundary, right boundary, upper boundary or lower boundary of the coding block instead of passing through the upper left corner or the lower right corner of the coding block.

[0286] Alternatively, as in Fig.25 (c) and Fig.25 In the example shown in (d), the coding block can be divided into two prediction units with different sizes by setting the diagonal line connected at the upper right corner or the lower left corner of the coding block to pass through the left boundary, right boundary, upper boundary or lower boundary of the coding block instead of passing through the upper left corner or the lower right corner of the coding block.

[0287] Each prediction unit generated by dividing the coding block is called an "Nth prediction unit". Figure 23 to Figure 25 In the example shown, PU1 may be defined as a first prediction unit, and PU2 may be defined as a second prediction unit. The first prediction unit may refer to a prediction unit including a sample located at the lower left or a sample located at the upper left within the coding block, and the second prediction unit may refer to a prediction unit including a sample located at the upper right or a sample located at the lower right within the coding block.

[0288] Contrary to the above, a prediction unit including a sample located at the upper right or a sample located at the lower right within the coding block may be defined as a first prediction unit, and a prediction unit including a sample located at the lower left or a sample located at the upper left within the coding block may be defined as a second prediction unit.

[0289] The embodiments described later mainly illustrate examples of division using diagonal lines. In particular, the process of dividing a coding block into two prediction units using diagonal lines is called diagonal division or triangular division, and the prediction unit generated based on the diagonal division is called a triangular prediction unit. However, of course, examples of division using oblique lines at angles different from vertical lines, horizontal lines, or diagonal lines may also be used in the embodiments described later.

[0290] Whether to apply diagonal splitting to a coding block can be determined based on at least one of a slice type, a maximum number of merge candidates that a merge candidate list can include, a size of a coding block, a shape of a coding block, a prediction coding mode of a coding block, or a split type of a parent node.

[0291] For example, whether to apply diagonal splitting to the coding block may be determined based on whether the current slice is of type B. Diagonal splitting may be allowed only when the current slice is of type B.

[0292] Alternatively, whether to apply diagonal partitioning to the coding block may be determined based on whether the maximum number of merge candidates included in the merge candidate list is greater than 2. Diagonal partitioning is allowed only when the maximum number of merge candidates included in the merge candidate list is greater than 2.

[0293] Alternatively, when at least one of the width or height of the hardware is greater than 64, the disadvantage of redundantly accessing the data processing unit of 64×64 size occurs. Thus, when at least one of the width or height of the coding block is greater than the threshold, it is possible not to divide the coding block into multiple prediction blocks. For example, when at least one of the height and width of the coding block is greater than 64 (for example, when at least one of the width and height is 128), diagonal division may not be used.

[0294] Alternatively, considering the maximum number of samples that can be processed simultaneously in a hardware implementation, diagonal partitioning may not be performed for coding blocks with a sample number greater than a threshold. For example, diagonal partitioning may not be allowed for coding tree blocks with a sample number greater than 4096.

[0295] Alternatively, for a coding block including a number of samples less than a threshold, diagonal splitting may not be allowed. For example, when the number of samples included in the coding block is less than 64, it may be set not to apply diagonal splitting to the coding block.

[0296] Alternatively, based on whether the width and height ratio of the coding block is less than the first threshold or whether the width and height ratio of the coding block is greater than the second threshold, it can be determined whether to apply diagonal splitting to the coding block. Here, the ratio of the width to the height of the coding block whRatio can be determined as the ratio of the width CbW to the height CbH of the coding block, as shown in the following formula 5.

[0297] [Formula 5]

[0298] whRatio=Cbw / CbH

[0299] The second threshold may be the inverse of the first threshold. For example, when the first threshold is k, the second threshold may be 1 / k.

[0300] Only when the width and height ratio of the coding block exists between the first threshold and the second threshold, the diagonal partitioning may be applied to the coding block.

[0301] Alternatively, triangular partitioning can be used only when the width and height ratio of the coding block is less than the first threshold or greater than the second threshold. For example, when the first threshold is 16, diagonal partitioning is not allowed for coding blocks of size 64×4 or 4×64.

[0302] Alternatively, based on the partition type of the parent node, it can be determined whether diagonal partitioning is allowed. For example, when the coding block as the parent node is partitioned based on a quadtree, diagonal partitioning can be applied to the coding block as a leaf node. On the other hand, when the coding block as the parent node is partitioned based on a binary tree or ternary tree partitioning, the coding block as a leaf node is set to not allow diagonal partitioning.

[0303] Alternatively, based on the prediction coding mode of the coding block, it can be determined whether diagonal splitting is allowed. For example, when the coding block is encoded with intra-frame prediction, diagonal splitting is allowed only when the coding block is encoded with inter-frame prediction or the coding block is encoded with a predefined inter-frame prediction mode. The predefined inter-frame prediction mode can represent at least one of a merge mode, an advanced motion vector prediction mode, an affine merge mode, or an affine motion vector prediction mode.

[0304] Alternatively, whether to allow diagonal splitting may be determined based on the size of the parallel processing region. For example, when the size of the coding block is larger than the size of the parallel processing region, diagonal splitting may not be used.

[0305] It is also possible to consider two or more of the listed conditions to determine whether to apply diagonal partitioning to the coding block.

[0306] As another example, information indicating whether diagonal partitioning is applied to a coding block may be signaled via the bitstream. The information may be signaled at a sequence level, a picture level, a slice level, or a block level. For example, a flag triangle_partition_flag indicating whether triangle partitioning is applied to a coding block may be signaled at a coding block level.

[0307] When it is determined that diagonal partitioning is to be applied to the coding block, information indicating the number of lines or positions of the lines that partition the coding block may be signaled through a bitstream.

[0308] For example, when the coding block is divided by a diagonal line, information indicating the direction of the diagonal line dividing the coding block can be sent by a bitstream signal. For example, a flag triangle_partition_type_flag indicating the direction of the diagonal line can be sent by a bitstream signal. The flag indicates whether the coding block is divided by a diagonal line connecting the upper left and lower right or whether it is divided by a diagonal line connecting the upper right and lower left. When the coding block is divided by a diagonal line connecting the upper left and lower right, it can be called a left triangle partition type, and when the coding block is divided by a diagonal line connecting the upper right and lower left, it can be called a right triangle partition type. For example, a value of the flag is 0, indicating that the division type of the coding block is a left triangle partition type, and a value of the flag is 1, indicating that the division type of the coding block is a right triangle partition type.

[0309] In addition, information indicating whether the prediction units have the same size or information indicating the position of the diagonal used to divide the coding block may be sent by signaling through the bitstream. For example, if the information indicating the size of the prediction unit indicates that the size of the prediction unit is the same, the encoding of the information indicating the position of the diagonal is skipped, and the coding block may be divided into two prediction units using a diagonal passing through two vertices of the coding block. On the other hand, when the information indicating the size of the prediction unit indicates that the size of the prediction unit is not the same, the position of the diagonal used to divide the coding block may be determined based on the information indicating the position of the diagonal. For example, when the left triangle partition type is applied to the coding block, the position information may indicate whether the diagonal is in contact with the left and lower boundaries or the upper and right boundaries of the coding block. Alternatively, when the right triangle partition type is applied to the coding block, the position information may indicate whether the diagonal is in contact with the right and lower boundaries or the upper and left boundaries of the coding block.

[0310] The information indicating the partition type of the coding block may be signaled at the coding block level. Thus, the partition type may be determined for different coding blocks to which diagonal partitioning is applied.

[0311] As another example, for a sequence, image, slice, tile, or coding tree unit, information indicating the partition type may be signaled. In this case, the partition type of the coding block to which diagonal partitioning is applied may be set to be the same within the sequence, image, slice, tile, or coding tree unit.

[0312] Alternatively, for the first coding unit to which diagonal partitioning is applied within the coding tree unit, information for determining the partitioning type is encoded and signaled, and the second and subsequent coding units to which diagonal partitioning is applied are set to use the same partitioning type as the first coding unit.

[0313] As another example, the partition type of the coding block can be determined based on the partition type of the adjacent block. Among them, the adjacent block may include an adjacent block adjacent to the upper left corner of the coding block, an adjacent block adjacent to the upper right corner, an adjacent block adjacent to the lower left corner, an adjacent block located above, or at least one of an adjacent block located on the left. For example, the partition type of the current block may be set the same as the partition type of the adjacent block. Alternatively, the partition type of the current block can be determined based on whether the upper left adjacent block applies the left triangle partition type, the upper right adjacent block, or the lower left adjacent block applies the right triangle partition type.

[0314] In order to perform motion prediction compensation on the first triangle prediction unit and the second triangle prediction unit, the motion information of each of the first triangle prediction unit and the second triangle prediction unit may be derived. In this case, the motion information of the first triangle prediction unit and the second triangle prediction unit may be derived from the merge candidates included in the merge candidate list. In order to distinguish a general merge candidate list from a merge candidate list used when deriving the motion information of a triangle prediction unit, the merge candidate list used to derive the motion information of the triangle prediction unit is referred to as a triangle merge candidate list, and the merge candidates included in the triangle merge candidate list are referred to as triangle merge candidates. However, the use of the aforementioned merge candidate derivation method and merge candidate list construction method for triangle merge candidates and triangle merge candidate list construction method is also included in the spirit of the present invention.

[0315] Information for determining the maximum number of triangle merge candidates that the triangle merge candidate list can include may be signaled through a bitstream, and may represent a difference between the maximum number of merge candidates that the merge candidate list can include and the maximum number of triangle merge candidates that the triangle merge candidate list can include.

[0316] The triangle merging candidates may be derived from the spatial and temporal neighboring blocks of the coding block.

[0317] Fig.26 is a diagram showing neighboring blocks used to derive triangle merging candidates.

[0318] A triangle merging candidate may be derived using at least one of a neighboring block located above the coding block, a neighboring block located on the left side of the coding block, or a co-located block included in an image different from the coding block. The upper neighboring block may include a block including a sample (xCb+CbW-1, yCb-1) located above the coding block, a block including a sample (xCb+CbW, yCb-1) located above the coding block, or a block including a sample (xCb-1, yCb-1) located above the coding block. The left neighboring block may include a block including a sample (xCb-1, yCb+CbH-1) located on the left side of the coding block or a block including a sample (xCb-1, yCb+CbH) located on the left side of the coding block. The co-located block may be determined as either a block including samples (xCb+CbW, yCb+CbH) adjacent to the upper right corner of the coded block within the co-located image or a block including samples (xCb / 2, yCb / 2) located at the center of the coded block.

[0319] The neighboring blocks may be searched in a predefined order, and the triangle merging candidates may be constructed into a triangle merging candidate list in a predefined order. For example, the triangle merging candidates may be searched in the order of B1, A1, B0, A0, C0, B2, and C1 to construct the triangle merging candidate list.

[0320] The motion information of the triangle prediction units may be derived based on the triangle merging candidate list. That is, the triangle prediction units may share one triangle merging candidate list.

[0321] In order to derive motion information of a triangle merging unit, information for specifying at least one of the triangle merging candidates included in the triangle merging candidate list may be signaled through a bitstream. For example, index information merge_triangle_idx for specifying at least one of the triangle merging candidates may be signaled through a bitstream.

[0322] The index information may specify a combination of a merge candidate of the first triangle prediction unit and a merge candidate of the second triangle prediction unit. For example, the following Table 1 shows an example of a combination of merge candidates according to the index information merge_triangle_idx.

[0323] Table 1

[0324] merge_triangle_idx 0 1 2 3 4 5 6 7 8 First prediction unit 1 0 0 0 2 0 0 1 3 Second prediction unit 0 1 2 1 0 3 4 0 0 merge_triangle_idx 9 10 11 12 13 14 15 16 17 First prediction unit 4 0 1 1 0 0 1 1 1 Second prediction unit 0 2 2 2 4 3 3 4 4 merge_triangle_idx 18 19 20 21 22 23 24 25 26 First triangle prediction unit 1 2 2 2 4 3 3 3 4 Second triangle prediction unit 3 1 0 1 3 0 2 4 0 merge_triangle_idx 27 28 29 30 31 32 33 34 35 First triangle prediction unit 3 2 4 4 2 4 3 4 3 Second triangle prediction unit 1 3 1 1 3 2 2 3 1 merge_triangle_idx 36 37 38 39 First triangle prediction unit 2 2 4 3 Second triangle prediction unit 4 4 2 4

[0325] The value of the index information merge_triangle_idx is 1, indicating that the motion information of the first triangle prediction unit is derived from the merge candidate of index 1, and the motion information of the second triangle prediction unit is derived from the merge candidate of index 0. The triangle merge candidate for deriving the motion information of the first triangle prediction unit and the triangle merge candidate for deriving the motion information of the second triangle prediction unit may be determined by the index information merge_triangle_idx.

[0326] The partition type of the coding block to which diagonal partitioning is applied may also be determined based on the index information. That is, the index information may specify a combination of a merge candidate of a first triangle prediction unit, a merge candidate of a second triangle prediction unit, and a partition direction of the coding block. When the partition type of the coding block is determined based on the index information, the information triangle_partition_type_flag indicating the direction of the diagonal dividing the coding block may not be encoded. Table 2 shows the partition type of the coding block with respect to the index information merge_triangle_idx.

[0327] Table 2

[0328] merge_triangle_idx 0 1 2 3 4 5 6 7 8 TriangleDir 0 1 1 0 0 1 1 1 0 merge_triangle_idx 9 10 11 12 13 14 15 16 17 TriangleDir 0 0 0 1 0 0 0 0 1 merge_triangle_idx 18 19 20 21 22 23 24 25 26 TriangleDir 1 1 1 0 0 1 1 1 1 merge_triangle_idx 27 28 29 30 31 32 33 34 35 TriangleDir 1 1 1 0 0 1 0 1 0 merge_triangle_idx 36 37 38 39 TriangleDir 0 1 0 0

[0329] When the variable TriangleDir is 0, it indicates that the coding block applies the left triangle partition type, and when the variable TriangleDir is 1, it indicates that the coding block applies the right triangle partition type. By combining Table 1 and Table 2, it can be set to specify the combination of the merge candidate of the first triangle prediction unit, the merge candidate of the second triangle prediction unit, and the partition direction of the coding block according to the index information merge_triangle_idx.

[0330] As another example, index information for only one of the first triangle prediction unit and the second triangle prediction unit may be sent by a signal, and the index of the triangle merge candidate for the other of the first triangle prediction unit and the second triangle prediction unit may be determined based on the index information. For example, the triangle merge candidate of the first triangle prediction unit may be determined based on the index information merge_triangle_idx indicating the index of any one of the triangle merge candidates. And, the triangle merge candidate of the second triangle prediction unit may be specified based on the merge_triangle_idx. For example, the triangle merge candidate of the second triangle prediction unit may be derived by adding or subtracting an offset from the index information merge_triangle_idx. The offset may be an integer such as 1 or 2. For example, the triangle merge candidate of the second triangle prediction unit may be determined as a triangle merge candidate having a value of merge_triangle_idx plus 1 as an index. When merge_triangle_idx indicates a triangle merge candidate with the largest index value among the triangle merge candidates, the motion information of the second triangle prediction unit may be derived from the triangle merge candidate with an index of 0 or the triangle merge candidate with a value obtained by subtracting 1 from merge_triangle_idx as an index.

[0331] Alternatively, the motion information of the second triangle prediction unit may be derived from a triangle merge candidate having the same reference image as the triangle merge candidate of the first triangle prediction unit specified according to the index information. The triangle merge candidate having the same reference image as the triangle merge candidate of the first triangle prediction unit may represent at least one of an L0 reference image or an L1 reference image having the same triangle merge candidate as the triangle merge candidate of the first triangle prediction unit. When there are multiple triangle merge candidates having the same reference image as the triangle merge candidate of the first triangle prediction unit, any one may be selected based on at least one of whether the merge candidate includes bidirectional motion information or a difference between an index of the merge candidate and the index information.

[0332] As another example, for the first triangle prediction unit and the second triangle prediction unit, index information may be respectively signaled. For example, first index information 1st_merge_idx for determining a triangle merge candidate of the first triangle prediction unit and second index information 2nd_merge_idx for determining a triangle merge candidate of the second triangle prediction unit may be signaled through a bitstream. Motion information of the first triangle prediction unit may be derived from the triangle merge candidate determined based on the first index information 1st_merge_idx, and motion information of the second triangle prediction unit may be derived from the triangle merge candidate determined based on the second index information 2nd_merge_idx.

[0333] The first index information 1st_merge_idx may indicate any index of the triangle merging candidates included in the triangle merging candidate list. The triangle merging candidate of the first triangle prediction unit may be determined as the triangle merging candidate indicated by the first index information 1st_merge_idx.

[0334] The triangle merge candidate indicated by the first index information 1st_merge_idx is set to be unusable as a triangle merge candidate for the second triangle prediction unit. Thus, the second index information 2nd_merge_idx of the second triangle prediction unit may indicate an index of any one of the remaining triangle merge candidates other than the triangle merge candidate indicated by the first index information. When the value of the second index information 2nd_merge_idx is less than the value of the first index information 1st_merge_idx, the triangle merge candidate of the second triangle prediction unit may be determined as a triangle merge candidate having the index information represented by the second index information 2nd_merge_idx. On the other hand, when the value of the second index information 2nd_merge_idx is the same as or greater than the value of the first index information 1st_merge_idx, the triangle merge candidate of the second triangle prediction unit may be determined as a triangle merge candidate having a value in the second index information 2nd_merge_idx plus 1 as an index.

[0335] Alternatively, it may be determined whether to signal the second index information based on the number of triangle merge candidates included in the triangle merge candidate list. For example, when the maximum number of triangle merge candidates that the triangle merge candidate list may include does not exceed 2, the second index information may be skipped. When the second index information is skipped, the first index information may be added or subtracted by an offset to derive the second triangle merge candidate. For example, when the maximum number of triangle merge candidates that the triangle merge candidate list may include is 2 and the first index information is index 0, the second triangle merge candidate may be derived by adding 1 to the first index information. Alternatively, when the maximum number of triangle merge candidates that the triangle merge candidate list may include is 2 and the first index information is 1, the second triangle merge candidate may be derived by subtracting 1 from the first index information.

[0336] Alternatively, when skipping signaling the second index information, the second index information may be set to a default value. The default value may be 0. By comparing the first index information and the second index information, a second triangle merge candidate may be derived. For example, when the second index information is less than the first index information, the merge candidate of index 0 is set to the second triangle merge candidate, and when the second index information is the same as or greater than the first index information, the merge candidate of index 1 is set to the second triangle merge candidate.

[0337] When the triangle merge candidate has unidirectional motion information, the unidirectional motion information of the triangle merge candidate is set as the motion information of the triangle prediction unit. On the other hand, when the triangle merge candidate has bidirectional motion information, only either the L0 motion information or the L1 motion information is set as the motion information of the triangle prediction unit. Which of the L0 motion information or the L1 motion information is to be obtained may be determined based on the index of the triangle merge candidate or the motion information of another triangle prediction unit.

[0338] For example, when the index of the triangle merge candidate is an even number, the L0 motion information of the triangle prediction unit is set to 0, and the L1 motion information of the triangle merge candidate is set to the L1 motion information of the triangle prediction unit. On the other hand, when the index of the triangle merge candidate is an odd number, the L1 motion information of the triangle prediction unit is set to 0, and the L0 motion information of the triangle merge candidate is set to 0. Contrary to the above, when the index of the triangle merge candidate is an even number, the L0 motion information of the triangle merge candidate is set to the L0 motion information of the triangle prediction unit, and when the index of the triangle merge candidate is an odd number, the L1 motion information of the triangle merge candidate may also be set to the L1 motion information of the triangle prediction unit. Alternatively, for the first triangle prediction unit, when the triangle merge candidate is an even number, the L0 motion information of the triangle merge candidate is set to the L0 motion information of the first triangle prediction unit, and on the other hand, for the second triangle prediction unit, when the triangle merge candidate is an odd number, the L1 motion information of the triangle merge candidate is set to the L1 motion information of the second triangle prediction unit.

[0339] Alternatively, when the first triangle prediction unit has L0 motion information, the L0 motion information of the second triangle prediction unit is set to 0, and the L1 motion information of the triangle merging candidate is set to the L1 information of the second triangle prediction unit. On the other hand, when the first triangle prediction unit has L1 motion information, the L1 motion information of the second triangle prediction unit is set to 0, and the L0 motion information of the triangle merging candidate is set to the L0 motion signal of the second triangle prediction unit.

[0340] The triangle merging candidate list used to derive the motion information of the first triangle prediction unit and the triangle merging candidate list used to derive the motion information of the second triangle prediction unit may also be set to be different.

[0341] For example, when a triangle merging candidate for deriving motion information of a first triangle prediction unit in a triangle merging candidate list is specified based on index information related to the first triangle prediction unit, the motion information of the second triangle prediction unit may be derived using a triangle merging list including remaining triangle merging candidates other than the triangle merging candidate indicated by the index information. Specifically, the motion information of the second triangle prediction unit may be derived from any one of the remaining triangle merging candidates.

[0342] Thus, the maximum number of triangle merge candidates included in the triangle merge candidate list of the first triangle prediction unit and the maximum number of triangle merge candidates included in the triangle merge candidate list of the second triangle prediction unit may be different. For example, when the triangle merge candidate list of the first triangle prediction unit includes M merge candidates, the triangle merge candidate list of the second triangle prediction unit may include M-1 merge candidates in addition to the triangle merge candidate indicated by the index information of the first triangle prediction unit.

[0343] As another example, merging candidates of each triangle prediction unit may be derived based on neighboring blocks adjacent to the coding block, and availability of the neighboring blocks may be determined by considering the shape or position of the triangle prediction unit.

[0344] Fig. 27 is a diagram for describing an example of determining availability of neighboring blocks of each triangle prediction unit.

[0345] Neighboring blocks not adjacent to the first triangle prediction unit may be set as neighboring blocks unavailable to the first triangle prediction unit, and neighboring blocks not adjacent to the second triangle prediction unit may be set as neighboring blocks unavailable to the second triangle prediction unit.

[0346] For example, as in Fig. 27 In the example shown in (a), when the left triangle partition type is applied to the coding block, it can be determined that blocks A1, A0, and A2 adjacent to the first triangle prediction unit among the adjacent blocks adjacent to the coding block can be used for the first triangle prediction unit, while blocks B0 and B1 cannot be used for the first triangle prediction unit. Therefore, the triangle merging candidate list related to the first triangle prediction unit includes triangle merging candidates derived from blocks A1, A0, and A2, but does not include triangle merging candidates derived from blocks B0 and B1.

[0347] As in Fig. 27 In the example shown in (b), when the left triangle partition type is applied to the coding block, it can be determined that blocks B0 and B1 adjacent to the second triangle prediction unit are available for the second triangle prediction unit, while blocks A1, A0 and A2 are not available for the second triangle prediction unit. As a result, the triangle merging candidate list associated with the second triangle prediction unit includes triangle merging candidates derived from blocks B0 and B1, but does not include triangle merging candidates derived from blocks A1, A0 and A2.

[0348] Thus, the number of triangle merging candidates or the range of triangle merging candidates that can be used by the triangle prediction unit may be determined based on at least one of the position of the triangle prediction unit or the partition type of the coding block.

[0349] As another example, the merge mode may be applied to only one of the first triangle prediction unit and the second triangle prediction unit, and the motion information of the other of the first triangle prediction unit and the second triangle prediction unit may be set to be the same as the motion information of the triangle prediction unit to which the merge mode is applied, or the motion information of the triangle prediction unit to which the merge mode is applied may be refined to be derived.

[0350] For example, the motion vector and reference image index of the first triangle prediction unit may be derived based on the triangle merge candidate, and the motion vector of the first triangle prediction unit may be refined to derive the motion vector of the second triangle prediction unit. For example, the motion vector {mvD1LXx, mvD1LXy} of the first triangle prediction unit may be added or subtracted by the fine motion vector {Rx, Ry} to derive the motion vector of the second triangle prediction unit. The reference image index of the second triangle prediction unit may be set to be the same as the reference image index of the first triangle prediction unit.

[0351] Information for determining a fine motion vector representing a difference between a motion vector of a first triangle prediction unit and a motion vector of a second triangle prediction unit may be signaled through a bitstream, and the information may include at least one of information representing a size of the fine motion vector or information representing a sign of the fine motion vector.

[0352] Alternatively, the sign of the fine motion vector may be derived based on at least one of the position, index, or partition type applied to the coding block of the triangle prediction unit.

[0353] As another example, a motion vector and a reference picture index of any one of the first triangle prediction unit and the second triangle prediction unit may be signaled. The other motion vector of the first triangle prediction unit and the second triangle prediction unit may be derived by refining the signaled motion vector.

[0354] For example, based on information signaled from a bitstream, a motion vector and a reference image index of a first triangle prediction unit may be determined. Furthermore, a motion vector of a second triangle prediction unit may be derived by refining the motion vector of the first triangle prediction unit. For example, a refined motion vector {Rx, Ry} may be added to or subtracted from the motion vector {mvD1LXx, mvD1LXy} of the first triangle prediction unit to derive the motion vector of the second triangle prediction unit. The reference image index of the second triangle prediction unit may be set to be the same as the reference image index of the first triangle prediction unit.

[0355] Motion prediction compensation prediction can be performed on the coding block based on the motion information of the first triangle prediction unit and the motion information of the second triangle prediction unit. In this case, the boundary part of the first triangle prediction unit and the second triangle prediction unit may have image quality degradation. For example, the edge (Edge) existing on the boundary of the first triangle prediction unit and the second triangle prediction unit may cause the continuity of the image quality to deteriorate. In order to reduce the image quality degradation of the boundary part, the prediction sample can be derived by smoothing filtering or weighted prediction.

[0356] The prediction samples for applying diagonal partitioning within the coding block can be derived based on a weighted sum operation of a first prediction sample obtained based on motion information of the first triangular prediction unit and a second prediction sample obtained based on motion information of the second triangular prediction unit. Alternatively, the prediction samples of the first triangular prediction unit are derived from a first prediction block determined based on motion information of the first triangular prediction unit, and the prediction samples of the second triangular prediction unit are derived from a second prediction block determined based on motion information of the second triangular prediction unit, and the prediction samples located in the boundary area of ​​the first triangular prediction unit and the second triangular prediction unit can be derived based on a weighted sum operation of the first prediction sample included in the first prediction block and the second prediction sample included in the second prediction block. For example, the following formula 6 shows an example of deriving the prediction samples of the first triangular prediction unit and the second triangular prediction unit.

[0357] [Formula 6]

[0358] P(x, y)=w1*P1(x, y)+(1-w1)*P2(x, y)

[0359] In Formula 6, P1 represents a first prediction sample, and P2 represents a second prediction sample. w1 represents a weighted value applied to the first prediction sample, and (1-w1) represents a weighted value applied to the second prediction sample. As in the example shown in Formula 6, the weighted value applied to the second prediction sample can be derived by subtracting a constant from the weighted value applied to the first prediction sample.

[0360] When the left triangle partition type is applied to the coding block, the boundary area may include prediction samples having the same x-axis coordinate and y-axis coordinate. On the other hand, when the right triangle partition type is applied to the coding block, the boundary area may include prediction samples whose sum of the x-axis coordinate and the y-axis coordinate is above the first threshold and below the second threshold.

[0361] The size of the boundary area may be determined based on at least one of the size of the coding block, the shape of the coding block, motion information of the triangle prediction unit, a motion vector difference of the triangle prediction unit, an output order of the reference image, or a difference between the first prediction sample and the second prediction sample in a diagonal boundary.

[0362] Fig.28 and Fig.29 is a diagram showing an example of deriving a prediction sample based on a weighted sum operation of a first prediction sample and a second prediction sample. Fig.28 An example of applying a left triangle partitioning type to a coding block is shown, and Fig.29 An example of applying the right triangle partition type to the coding block is shown. In addition, Fig.28 (a) and Fig.29 (a) is a diagram showing a prediction pattern of a luminance component, and Fig.28 (b) and Fig.29 (b) is a diagram showing a prediction pattern of a chrominance component.

[0363] In the illustrated figure, the number written in the prediction sample near the boundary of the first prediction unit and the second prediction unit represents the weighted value applied to the first prediction sample. For example, when the number written in the prediction sample is N, a weighted value of N / 8 is applied to the first prediction sample and a weighted value of (1-(N / 8)) is applied to the second prediction sample, thereby the prediction sample can be derived.

[0364] In the non-boundary area, the first prediction sample or the second prediction sample can be determined as the prediction sample. Fig.28 In the example of, in the area belonging to the first triangle prediction unit in the area where the absolute value of the difference between the x-axis coordinate and the y-axis coordinate is greater than the threshold, the first prediction sample derived based on the motion information of the first triangle prediction unit can be determined as the prediction sample. On the other hand, in the area belonging to the second triangle prediction unit in the area where the difference between the x-axis coordinate and the y-axis coordinate is greater than the threshold, the second prediction sample derived based on the motion information of the second triangle prediction unit can be determined as the prediction sample.

[0365] Reference Fig.29 In the example of, in an area where the sum of the x-axis coordinate and the y-axis coordinate is less than the first threshold, the first prediction sample derived based on the motion information of the first triangle prediction unit can be determined as the prediction sample. On the other hand, in an area where the sum of the x-axis coordinate and the y-axis coordinate is greater than the second threshold, the second prediction sample derived based on the motion information of the second triangle prediction unit can be determined as the prediction sample.

[0366] The threshold for determining the non-boundary area may be determined based on at least one of the size of the coding block, the shape of the coding block, or the color component. For example, when the threshold associated with the luminance component is set to N, the threshold associated with the chrominance component may be set to N / 2.

[0367] The prediction sample included in the boundary area may be derived based on a weighted sum operation of the first prediction sample and the second prediction sample. In this case, the weighted value applied to the first prediction sample and the second prediction sample may be determined based on at least one of the position of the prediction sample, the size of the coding block, the shape of the coding block, or the color component.

[0368] For example, as in Fig.28 In the example shown in (a), a prediction sample at a position having the same x-axis coordinate and y-axis coordinate can be derived by applying the same weighting value to the first prediction sample and the second prediction sample. The weighting value ratio applied to the first prediction sample and the second prediction sample can be set to (3:1) or (1:3) to derive a prediction sample whose absolute value of the difference between the x-axis coordinate and the y-axis coordinate is 1. Also, the weighting value ratio applied to the first prediction sample and the second prediction sample can be set to (7:1) or (1:7) to derive a prediction sample whose absolute value of the difference between the x-axis coordinate and the y-axis coordinate is 2.

[0369] Alternatively, if Fig.28 In the example shown in (b), a prediction sample at a position having the same x-axis coordinate and y-axis coordinate can be derived by applying the same weighting value to the first prediction sample and the second prediction sample, and a prediction sample having an absolute value of the difference between the x-axis coordinate and the y-axis coordinate of 1 can be derived by setting the weighting value ratio applied to the first prediction sample and the second prediction sample to (7:1) or (1:7).

[0370] For example, as in Fig.29 In the example shown in (a), a prediction sample whose sum of x-axis coordinates and y-axis coordinates is 1 less than the width or height of the coding block can be derived by applying the same weighting value to the first prediction sample and the second prediction sample. The weighting value ratio applied to the first prediction sample and the second prediction sample can be set to (3:1) or (1:3) to derive a prediction sample whose sum of x-axis coordinates and y-axis coordinates is the same as or 2 less than the width or height of the coding block. The weighting value ratio applied to the first prediction sample and the second prediction sample can be set to (7:1) or (1:7) to derive a prediction sample whose sum of x-axis coordinates and y-axis coordinates is 1 greater or 3 less than the width or height of the coding block.

[0371] Alternatively, as in Fig.29 In the example shown in (b), a prediction sample whose sum of x-axis coordinates and y-axis coordinates is 1 less than the width or height of the coding block can be derived by applying the same weighting value to the first prediction sample and the second prediction sample. The weighting value ratio applied to the first prediction sample and the second prediction sample can be set to (7:1) or (1:7) to derive a prediction sample whose sum of x-axis coordinates and y-axis coordinates is the same as or 2 less than the width or height of the coding block.

[0372] As another example, the weighted value may be determined considering the position of the prediction sample or the shape of the coding block. Formulas 7 to 9 show examples of deriving weighted values ​​when the left triangle partition type is applied to the coding block. Formula 7 shows an example of deriving a weighted value applied to the first prediction sample when the coding block is a square shape.

[0373] [Formula 7]

[0374] w1=(x-y+4) / 8

[0375] In Formula 7, x and y represent the position of the prediction sample. When the coding block is a non-square shape, the weighted value applied to the first prediction sample can be derived as shown in Formula 8 or 9. Formula 8 shows the case where the width of the coding block is greater than the height, and Formula 9 shows the case where the width of the coding block is less than the height.

[0376] [Formula 8]

[0377] w1=((x / whRatio)-y+4) / 8

[0378] [Formula 9]

[0379] w1=(x-(y*whRatio)+4) / 8

[0380] When the right triangle partition type is applied to the coding block, the weighted value applied to the first prediction sample may be determined as shown in Formulas 10 to 12. Formula 10 shows an example of deriving the weighted value applied to the first prediction sample when the coding block is a square shape.

[0381] [Formula 10]

[0382] w1=(CbW-1-xy)+4) / 8

[0383] In Formula 10, CbW represents the width of the coding block. When the coding block is a non-square shape, the weighted value applied to the first prediction sample can be derived as shown in Formula 11 or 12. Formula 11 shows the case where the width of the coding block is greater than the height, and Formula 12 shows the case where the width of the coding block is less than the height.

[0384] [Formula 11]

[0385] w1=(CbH-1-(x / whRatio)-y)+4) / 8

[0386] [Formula 12]

[0387] w1=(CbW-1-x-(y*whRatio)+4) / 8

[0388] In Formula 11, CbH represents the height of the coding block.

[0389] As shown in the example, for the prediction samples within the boundary area, the samples included in the first triangular prediction unit can be derived by assigning a larger weight value to the first prediction sample than to the second prediction sample, and the samples included in the second triangular prediction unit can be derived by assigning a larger weight value to the second prediction sample than to the first prediction sample.

[0390] When diagonal partitioning is applied to a coding block, the coding block may be set to a combined prediction mode that does not apply a combination of an intra prediction mode and a merge mode.

[0391] Intra-frame prediction is to use the reconstructed samples of the surrounding coded / decoded samples of the current block to predict the current block. In this case, the intra-frame prediction of the current block can use the reconstructed samples before applying the in-loop filter.

[0392] Intra-frame prediction techniques include matrix-based intra-frame prediction and general intra-frame prediction that takes into account the directionality of surrounding reconstructed samples. Information indicating the intra-frame prediction technique of the current block can be sent by signaling through a bitstream. The information can be a 1-bit flag. Alternatively, the intra-frame prediction technique of the current block can be determined based on at least one of the position, size, shape, or intra-frame prediction techniques of adjacent blocks of the current block. For example, when the current block exists across an image boundary, the current block is set to not apply matrix-based intra-frame prediction.

[0393] Matrix-based intra prediction is a method of obtaining a prediction block for a current block based on matrix multiplication between matrices stored in the encoder and decoder and reconstructed samples around the current block. Information for specifying any one of a plurality of stored matrices may be signaled via the bitstream. The decoder may determine the matrix to use for intra prediction of the current block based on the information and the size of the current block.

[0394] Generally, intra prediction is a method of obtaining a prediction block related to a current block based on a non-angular intra prediction mode or an angular intra prediction mode.

[0395] The derived residual image can be derived by subtracting the original image from the predicted image. In this case, when the residual image is changed to the frequency domain, even if the high-frequency components in the frequency components are removed, the subjective image quality of the video will not be significantly reduced. Therefore, if the value of the high-frequency component is reduced or the value of the high-frequency component is set to 0, it has the effect of improving the compression efficiency without causing obvious visual distortion. Reflecting the above characteristics, the current block can be transformed to decompose the residual image into 2-dimensional frequency components. The transformation can be performed using transformation techniques such as discrete cosine transform (DCT) or discrete sine transform (DST).

[0396] In the residual image, it is also possible to not perform 2D image transformation on a portion of the blocks. Not performing 2D image transformation may be referred to as transform skip. When transform skip is applied, quantization may be applied to the residual values ​​for which the transformation is not performed.

[0397] After the current block is transformed using DCT or DST, the transformed current block may be transformed again. In this case, the DCT or DST-based transform may be defined as a primary transform, and the process of transforming the block to which the primary transform is applied again may be referred to as a secondary transform.

[0398] The main transform may be performed using any one of a plurality of transform core candidates. For example, the main transform may be performed using any one of DCT2, DCT8, or DCT7.

[0399] Different transform kernels may be used for the horizontal direction and the vertical direction. Information indicating the combination of the transform kernel for the horizontal direction and the transform kernel for the vertical direction may also be signaled via the bitstream.

[0400] The execution units of the main transform and the secondary transform may be different. For example, the main transform may be performed on an 8×8 block, and the secondary transform may be performed on a sub-block of size 4×4 in the transformed 8×8 block. In this case, the transform coefficients of the remaining area where the secondary transform is not performed may also be set to 0.

[0401] Alternatively, the primary transform may be performed on the 4×4 block, and the secondary transform may be performed on a region of size 8×8 including the transformed 4×4 block.

[0402] Information indicating whether to perform secondary transformation may be signaled through a bitstream.

[0403] Alternatively, whether to perform the secondary transform may be determined based on whether the horizontal transform core is the same as the vertical transform core. For example, the secondary transform may be performed only when the horizontal transform core is the same as the vertical transform core. Alternatively, the secondary transform may be performed only when the horizontal transform core is different from the vertical transform core.

[0404] Alternatively, the secondary transform may be allowed only when the horizontal transform and the vertical transform utilize a predefined transform core. For example, the secondary transform may be allowed when the horizontal transform and the vertical transform use a DCT2 transform core.

[0405] Alternatively, whether to perform a secondary transform may be determined based on the number of non-zero transform coefficients of the current block. For example, when the non-zero transform coefficient of the current block is less than or equal to a threshold, it may be set not to use a secondary transform, and when the non-zero transform coefficient of the current block is greater than the threshold, it may be set to use a secondary transform. It may also be set to use a secondary transform only when the current block is encoded using intra-frame prediction.

[0406] The inverse transform of the secondary transform (second inverse transform) may be performed in the decoder, and the inverse transform of the primary transform (first inverse transform) may be performed on the result thereof. As a result of performing the second inverse transform and the first inverse transform, a residual signal of the current block may be obtained.

[0407] If the transform and quantization are performed in the encoder, the decoder can obtain the residual block by inverse quantization and inverse transform. The prediction block and the residual block are added together in the decoder to obtain the reconstructed block of the current block.

[0408] If a reconstructed block of the current block is obtained, information loss generated during quantization and encoding can be reduced by in-loop filtering. The in-loop filter may include at least one of a deblocking filter, a sample adaptive offset filter (SAO), or an adaptive loop filter (ALF).

[0409] It is also within the scope of the present invention to apply the embodiments described centering on the decoding process or the encoding process to the encoding process or the decoding process. It is also within the scope of the present invention to change the multiple embodiments described in the predetermined order to an order different from that described.

[0410] Embodiments have been described based on a series of steps or flow charts, but this does not limit the time sequence order of the invention, and can be executed simultaneously or in another order as needed. In addition, in the above-mentioned embodiments, the structural elements (e.g., units, modules, etc.) constituting the block diagram can also be implemented as hardware devices or software respectively, and multiple structural elements can be combined and implemented as a single hardware device or software. The embodiments can be implemented in the form of program instructions, which can be executed by various computer components and recorded in a computer-readable recording medium. The computer-readable recording medium can include program instructions, data files, data structures, etc. alone or in combination. Examples of computer-readable recording media can include magnetic media such as hard disks, floppy disks and tapes, optical recording media such as CD-ROMs and DVDs, magneto-optical media such as floptical disks, and ROMs, RAMs, flash memories, etc., which are specially configured hardware devices in a manner of storing program instructions and executing the instructions. The hardware device can be configured to operate as one or more software modules to perform processing according to the present invention, and vice versa.

[0411] Industrial Applicability

[0412] The present invention can be applied to electronic devices that encode / decode videos.

Claims

1. A video decoding method, comprising the following steps: Export the merge candidate list of the current block; deriving first motion information and second motion information based on the merge candidate list; as well as Obtaining a prediction sample in the current block based on the first motion information and the second motion information, wherein the first motion information is derived from a first merge candidate in the merge candidate list, and the second motion information is derived from a second merge candidate, and the first merge candidate is different from the second merge candidate; In which, first index information for determining the first merge candidate and second index information for determining the second merge candidate are obtained by decoding from a bit stream, and when a value of the second index information is equal to or greater than a value of the first index information, the second merge candidate is determined to be a merge candidate with a value obtained by adding 1 to the value of the second index information as an index.

2. The method according to claim 1, further comprising: Obtaining a first prediction unit and a second prediction unit of the current block, The first motion information corresponds to the first prediction unit, and the second motion information corresponds to the second prediction unit.

3. The method according to claim 2, wherein: Whether to allow obtaining the first prediction unit and the second prediction unit of the current block is determined based on whether a ratio of a width to a height of the current block is less than a first threshold.

4. The method according to claim 2, wherein: A maximum number of merge candidates included in the merge candidate list is determined based on whether the first prediction unit and the second prediction unit are obtained.

5. The method according to claim 2, wherein: Obtaining the first prediction unit and the second prediction unit of the current block includes: The current block is divided to obtain the first prediction unit and the second prediction unit.

6. The method according to claim 2, wherein: The first prediction unit is a first triangle prediction unit, and the second prediction unit is a second triangle prediction unit.

7. The method according to claim 6, wherein: Deriving the first motion information and the second motion information based on the merge candidate list includes: deriving the first motion information for the first triangle prediction unit from a merge candidate, wherein the merge candidate is determined based on the first index information, and The second motion information for the second triangle prediction unit is derived from another merge candidate, wherein the another merge candidate is determined based on the second index information.

8. A video encoding method, comprising: Export the merge candidate list of the current block; deriving first motion information and second motion information based on the merge candidate list; and Obtaining a prediction sample in the current block based on the first motion information and the second motion information, wherein the first motion information is derived from a first merge candidate in the merge candidate list, and the second motion information is derived from a second merge candidate, and the first merge candidate is different from the second merge candidate; Encode first index information for determining the first merge candidate and second index information for determining the second merge candidate, wherein, when the index of the second merge candidate is equal to or greater than the index of the first merge candidate, the second index information is encoded using the value obtained by subtracting 1 from the index of the second merge candidate.

9. The method according to claim 8, further comprising: Obtaining a first prediction unit and a second prediction unit of the current block; The first motion information corresponds to the first prediction unit, and the second motion information corresponds to the second prediction unit.

10. The method according to claim 9, wherein: Whether to allow obtaining the first prediction unit and the second prediction unit of the current block is determined based on whether a ratio of a width to a height of the current block is less than a first threshold.

11. The method according to claim 9, wherein: A maximum number of merge candidates included in the merge candidate list is determined based on whether the first prediction unit and the second prediction unit are obtained.

12. The method according to claim 9, wherein: Obtaining the first prediction unit and the second prediction unit of the current block includes: The current block is divided to obtain the first prediction unit and the second prediction unit.

13. The method according to claim 9, wherein: The first prediction unit is a first triangle prediction unit, and the second prediction unit is a second triangle prediction unit.

14. The method according to claim 13, wherein: Deriving the first motion information and the second motion information based on the merge candidate list includes: deriving the first motion information for the first triangle prediction unit from a merge candidate, wherein the merge candidate corresponds to the first index information, and The second motion information for the second triangle prediction unit is derived from another merge candidate, wherein the another merge candidate corresponds to the second index information.

15. A video decoding device, comprising an inter-frame prediction unit, the inter-frame prediction unit being configured to perform the method according to any one of claims 1 to 7. 16 . A video encoding device, comprising an inter-frame prediction unit, the inter-frame prediction unit being configured to perform the method according to claim 8 .

17. A computer-readable storage medium storing a bit stream generated by the video encoding method according to any one of claims 8 to 14.

Citation Information

Patent Citations

  • Generating additional merge candidates

    CN104126302A

  • Restriction of prediction units in b slices to uni-directional inter prediction

    CN104160704A

  • Method of intra picture block copy for screen content and video coding

    CN107079161A

  • Method and apparatus for processing video signal

    WO2018008906A1