Method for encoding / decoding video signal and apparatus for the same

By dividing coding blocks and deriving motion information using an inter-motion information list, the method addresses the limitations of existing video compression standards, enhancing inter-prediction efficiency and improving video compression performance.

JP2026012870APending Publication Date: 2026-01-27GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2025181211
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2018-11-27
Filing Date
2025-10-27
Publication Date
2026-01-27

AI Technical Summary

Technical Problem

The increasing demand for high-definition video services has led to a significant increase in data volume, and existing video compression standards like HEVC are reaching their performance limitations.

Method used

A method for dividing a coding block into multiple prediction blocks and deriving motion information for each block, using an inter-motion information list to improve inter-prediction efficiency.

Benefits of technology

This approach enhances inter-prediction efficiency by optimizing the encoding and decoding process through the division of coding blocks and the use of merge candidates, improving video compression performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026012870000001_ABST
    Figure 2026012870000001_ABST
Patent Text Reader

Abstract

To provide a method and apparatus for partitioning a coding block into a plurality of prediction blocks when encoding / decoding video signal.SOLUTION: A method for partitioning a coding block into a plurality of prediction units using a diagonal line includes determining whether to partition the coding block into a first prediction unit PU1 and a second prediction unit PU2, determining a partition type of the coding block when it is determined to partition the coding block, deriving first motion information of the first prediction unit and second motion information of the second prediction unit of the coding block, and obtaining prediction samples in the coding block according to the first motion information and the second motion information.SELECTED DRAWING: Figure 33
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to a method for encoding / decoding a video signal and to an apparatus for said method. [Background technology]

[0002] As display panels become larger, video services with higher image quality are becoming increasingly necessary. The biggest problem with high-definition video services is the significant increase in data volume. To address this issue, active research is being conducted to improve video compression rates. As a representative example, the Motion Picture Experts Group (MPEG) and the Video Coding Experts Group (VCEG) of the International Telecommunication Union-Telecommunication (ITU-T) established the Joint Collaborative Team on Video Coding (JCT-VC) in 2009. JCT-VC proposed the video compression standard HEVC (High Efficiency Video Coding), which was approved on January 25, 2013. However, its compression performance is approximately twice that of H.264 / AVC. With the rapid development of high-definition video services, the performance limitations of HEVC are gradually becoming apparent. Summary of the Invention [Problem to be solved by the invention]

[0003] SUMMARY OF THE INVENTION 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 an apparatus for implementing said method.

[0004] SUMMARY OF THE INVENTION An object of the present invention is to provide a method for deriving motion information of each prediction block among a plurality of prediction blocks when encoding / decoding a video signal, and an apparatus for carrying out said method.

[0005] SUMMARY OF THE INVENTION An object of the present invention is to provide a method for deriving merge candidates using an inter-motion information list when encoding / decoding a video signal, and an apparatus for performing the method.

[0006] The technical problems that the present invention aims to achieve are not limited to those mentioned above, and those skilled in the art will be able to clearly understand other technical problems not mentioned from the following description. [Means for solving the problem]

[0007] A video signal encoding / decoding method of the present invention includes: determining whether to divide a coding block into a first prediction unit and a second prediction unit; determining a division type of the coding block if it is determined to divide the coding block; deriving first motion information of the first prediction unit and second motion information of the second prediction unit of the coding block; and obtaining a prediction sample for the coding block based on the first motion information and the second motion information. In this case, the first motion information of the first prediction unit may be obtained based on a first merge candidate, where the first merge candidate is selected from a plurality of merge candidates included in a merge candidate list by first index information; and the second motion information of the second prediction unit may be obtained based on a second merge candidate, where the second merge candidate is selected from a plurality of merge candidates included in the merge candidate list by second index information.

[0008] In the video signal encoding / decoding method of the present invention, if the value of the second index information is greater than or equal to the value of the first index information, the second merging candidate may have an index value that is 1 greater than the value of the second index information.

[0009] In the video signal encoding / decoding method of the present invention, when the value of the second index information is smaller than the value of the first index information, the value of the second index information may be set as the index of the second merging candidate.

[0010] In the video signal encoding / decoding method of the present invention, when the predicted sample is included in a boundary area between the first prediction unit and the second prediction unit, the predicted sample may be derived by weighting and calculating the first predicted sample derived based on the first motion information and the second predicted sample derived based on the second motion information.

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

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

[0013] In the video signal encoding / decoding method of the present invention, the size of the boundary area may be determined based on at least one of the size of the encoding block or the shape of the encoding block.

[0014] The above briefly described features of the present invention are exemplary embodiments of the detailed description of the invention to be set forth below and are not intended to limit the scope of the invention. [Effects of the Invention]

[0015] According to the present invention, by providing a method for dividing a coding block into a plurality of prediction blocks and deriving motion information of each of the plurality of prediction blocks, it is possible to improve inter-prediction efficiency.

[0016] According to the present invention, a method for deriving merge candidates using an inter motion information list is provided, thereby improving inter prediction efficiency.

[0017] The effects that can be achieved by the present invention are not limited to the above effects, and those skilled in the art will be able to clearly understand other effects not mentioned in the following description. [Brief explanation of the drawings]

[0018] [Figure 1] FIG. 1 is a block diagram of a video encoder according to an embodiment of the present invention. [Figure 2] FIG. 2 is a block diagram of a video decoder according to an embodiment of the present invention. [Figure 3] FIG. 3 is a diagram showing a basic coding tree unit according to an embodiment of the present invention. [Figure 4] FIG. 4 is a diagram showing a variety of division types of coding blocks. [Figure 5] FIG. 5 is a diagram showing an example of division of a coding tree unit. [Figure 6] FIG. 6 is a flowchart of an inter prediction method according to an embodiment of the present invention. [Figure 7] FIG. 7 is a diagram illustrating the nonlinear motion of an object. [Figure 8] FIG. 8 is a flowchart illustrating an affine motion-based inter-prediction method according to an embodiment of the present invention. [Figure 9] FIG. 9 is a diagram showing examples of affine seed vectors for each affine motion model. [Figure 10] FIG. 10 is a diagram showing an example of affine vectors of sub-blocks in a four-parameter motion model. [Figure 11] FIG. 11 is a diagram illustrating neighboring blocks that can be used to derive merge candidates. [Figure 12] FIG. 12 is a diagram illustrating deriving an affine seed vector for a current block based on the affine seed vectors of affine neighboring blocks. [Figure 13]FIG. 13 is a diagram showing an example in which the motion vector of a sub-block is set as the affine seed vector of an affine adjacent block. [Figure 14] FIG. 14 is a diagram showing the positions of the reference samples. [Figure 15] FIG. 15 is a diagram showing the positions of the reference samples. [Figure 16] FIG. 16 is a diagram showing the positions of the reference samples. [Figure 17] FIG. 17 is a diagram showing an application example of the modified affine merge vector derivation method. [Figure 18] FIG. 18 is a diagram showing an example of deriving an affine seed vector of an affine merge candidate based on a plurality of motion vectors of a plurality of sub-blocks belonging to adjacent blocks. [Figure 19] FIG. 19 is a diagram illustrating an example of deriving an affine seed vector of an affine merge candidate based on the motion vectors of multiple sub-blocks located to the left of the current block. [Figure 20a] 10A and 10B are diagrams illustrating an example of deriving an affine seed vector of an affine merge candidate based on motion information of a non-adjacent block or an adjacent block located to the left of a current block. [Figure 20b] 10A and 10B are diagrams illustrating an example of deriving an affine seed vector of an affine merge candidate based on motion information of a non-adjacent block or an adjacent block located to the left of a current block. [Figure 21a] FIG. 10 illustrates the location of blocks for deriving affine seed vectors for affine merge candidates. [Figure 21b] FIG. 10 illustrates the location of blocks for deriving affine seed vectors for affine merge candidates. [Figure 22] FIG. 22 is a diagram illustrating an example of deriving combined merge candidates by combining a plurality of motion vectors of a plurality of adjacent blocks. [Figure 23] FIG. 23 shows that adjacent blocks cannot be used. [Figure 24]FIG. 24 is a flowchart of a process for deriving motion information of a current block in merge mode. [Figure 25] FIG. 25 is a diagram for explaining an example of updating the inter-exercise information list. [Figure 26] FIG. 26 shows an example of updating the inter-merge candidate list. [Figure 27] FIG. 27 is a diagram showing an example in which the indices of pre-stored inter-merge candidates are updated. [Figure 28a] FIG. 10 illustrates the location of a representative sub-block. [Figure 28b] FIG. 10 illustrates the location of a representative sub-block. [Figure 29] FIG. 29 is an example showing generating inter motion information lists for different inter prediction modes. [Figure 30] FIG. 30 is a diagram showing an example of adding an inter-merge candidate included in the long-term exercise information list to the merge candidate list. [Figure 31] FIG. 31 shows an example in which redundancy checks are performed on only some of the merge candidates. [Figure 32] FIG. 32 shows an example in which redundancy checks are omitted for specific merge candidates. [Figure 33] FIG. 33 is a diagram showing an example of dividing a coding block into a plurality of prediction units using diagonals. [Figure 34] FIG. 34 is a diagram showing an example of dividing a coding block into two prediction units. [Figure 35] FIG. 35 is a diagram showing an example of dividing a coding block into a plurality of prediction blocks of different sizes. [Figure 36] FIG. 36 is a diagram showing adjacent blocks for deriving triangle merge candidates. [Figure 37] FIG. 37 is a diagram illustrating an example of determining the availability of neighboring blocks for each triangular prediction unit. [Figure 38]FIG. 38 is a diagram showing an example of deriving a predicted sample by weighting and calculating the first predicted sample and the second predicted sample. [Figure 39] FIG. 39 is a diagram showing an example of deriving a predicted sample by weighting and calculating the first predicted sample and the second predicted sample. [Figure 40] FIG. 40 is a flowchart illustrating an intra prediction method according to an embodiment of the present invention. [Figure 41a] FIG. 10 is a diagram illustrating intra-prediction modes. [Figure 41b] FIG. 10 is a diagram illustrating intra-prediction modes. [Figure 42] FIG. 42 is a diagram showing an example of a one-dimensional array in which reference samples are arranged in one row. [Figure 43] FIG. 43 is a diagram showing an example of a one-dimensional array in which reference samples are arranged in one row. [Figure 44] FIG. 44 is a diagram showing angles formed between angular intra prediction modes and a line parallel to the x-axis. [Figure 45a] FIG. 10 illustrates an example of obtaining prediction samples when the current block is non-square. [Figure 45b] 10 is a diagram illustrating an example of obtaining predicted samples when the current block is non-square. FIG. [Figure 46] FIG. 46 is a diagram showing wide-angle intra prediction modes. [Figure 47] FIG. 47 is a flowchart showing the process of determining the blocking strength. [Figure 48] FIG. 48 shows predefined filter candidates. DETAILED DESCRIPTION OF THE INVENTION

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

[0020] Video encoding and decoding is performed on a block-by-block basis, for example, encoding / decoding processes such as transform, quantization, prediction, in-loop filtering, or reconstruction can be performed on coding blocks, transform blocks, or prediction blocks.

[0021] Hereinafter, the block to be coded / decoded is referred to as a “current block.” For example, depending on the current coding / decoding process step, the current block may refer to a coding block, a transformation block, or a prediction block.

[0022] Additionally, the term "unit" as used herein may be understood to refer to a basic unit for performing a specific encoding / decoding process, and "block" may be understood to refer to a sample array of a predetermined size. Unless otherwise specified, "block" and "unit" are used interchangeably. For example, in the embodiments described below, a coding block and a coding unit may be understood to have the same meaning.

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

[0024] As shown in FIG. 1, the video encoding device 100 may include a picture partitioning unit 110, prediction units 120 and 125, a transform unit 130, a quantization unit 135, a reordering unit 160, an entropy encoding unit 165, an inverse quantization unit 140, an inverse transform unit 145, a filter unit 150, and a memory 155.

[0025] 1 are shown independently to illustrate various characteristic functions of the video encoding device, without indicating that each component is a separate hardware or software component. That is, for convenience of explanation, each component is listed and included as a representative component, and at least two components may be combined into one component, or one component may be divided into multiple components to perform a function. Both combinations of such components and separate components are within the scope of the present invention, provided they do not deviate from the essence of the present invention.

[0026] In addition, some structural elements are not necessary to perform the essential functions of the present invention, but are optional structural elements used only to improve performance. The present invention may be implemented by including only the components necessary to realize the essence of the present invention (excluding structural elements for improving performance), and a structure including only the necessary structural elements (excluding structural elements for improving performance) also falls within the scope of the present invention.

[0027] The picture partitioning unit 110 may divide an input picture into at least one processing unit. In this case, the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The picture partitioning unit 110 may divide one picture into a plurality of combinations of coding units, prediction units, and transform units, and may select a combination of coding units, prediction units, and transform units based on a predetermined standard (e.g., a cost function) to code the picture.

[0028] For example, a picture may be divided into multiple coding units. To divide a picture into coding units, a recursive tree structure, such as a quad tree structure, may be used, where one video or largest coding unit is used as the root and the coding unit may be divided into other coding units. The coding unit may have as many child nodes as the number of divided coding units. Coding units that are not further divided due to some restrictions become leaf nodes. That is, assuming that one coding unit can only realize square division, one coding unit can be divided into at most four other coding units.

[0029] Hereinafter, in the embodiments of the present invention, the encoding unit may refer to a unit that performs encoding, and may also refer to a unit that performs decoding.

[0030] The prediction units in one coding unit may be divided into at least one square or rectangle of the same size, or one prediction unit in one coding unit may be divided into a different shape and / or size than the other prediction units.

[0031] When a prediction unit for performing intra prediction using a coding unit is not the smallest coding unit, intra prediction may be performed without dividing the prediction unit into a plurality of N×N prediction units.

[0032] The prediction units 120 and 125 may include an inter prediction unit 120 that performs inter prediction and an intra prediction unit 125 that performs intra prediction. It may be determined whether to use inter prediction or intra prediction for a prediction unit, and specific information (e.g., intra prediction mode, motion vector, reference picture, etc.) may be determined 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 may be determined by the prediction unit, or the prediction may be performed by a transform unit. The generated residual values ​​(residual block) between the prediction block and the original block may be input to the transform unit 130. In addition, prediction mode information, motion vector information, etc. for prediction may be coded together with the residual values ​​by the entropy coding unit 165 and transmitted to the decoder. When a specific coding mode is used, the original block may be directly coded and transmitted to the decoder without generating a prediction block by the prediction units 120 and 125.

[0033] The inter prediction unit 120 may predict a prediction unit based on information about at least one picture before or after the current picture. In some cases, the prediction unit may also be predicted based on information about some coded regions in the current picture. The inter prediction unit 120 may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.

[0034] The reference picture interpolator receives reference picture information from memory 155 and can generate integer pixel or fractional pixel pixel information based on the reference picture. For luma pixels, a DCT-based 8-dimensional interpolation filter with different filter coefficients may be used to generate fractional pixel pixel information in 1 / 4 pixel units. For chroma signals, a DCT-based 4-dimensional interpolation filter with different filter coefficients may be used to generate fractional pixel pixel information in 1 / 8 pixel units.

[0035] The motion prediction unit may perform motion prediction based on the reference picture interpolated by the reference picture interpolator. A motion vector may be calculated using a variety of methods, such as a full search-based block matching algorithm (FBMA), a three-step search (TSS), or a new three-step search algorithm (NTS). The motion vector may have a motion vector value in half-pixel or quarter-pixel units based on the interpolated pixels. The motion prediction unit may predict the current prediction unit using various motion prediction methods. The motion prediction method may include a skip method, a merge method, an advanced motion vector prediction (AMVP), an intra block copy method, and the like.

[0036] The intra prediction unit 125 may generate a prediction unit based on reference pixel information surrounding the current block (the reference pixel information is pixel information in the current picture). If a neighboring block of the current prediction unit is a block on which inter prediction has been performed and the reference pixels are pixels on which inter prediction has been performed, the reference pixels included in the block on which inter prediction has been performed may be used as reference pixel information for the neighboring block on which intra prediction has been performed. That is, if reference pixels are unavailable, at least one of the available reference pixels may replace the unavailable reference pixel information.

[0037] In intra prediction, prediction modes may include an angular prediction mode that uses reference pixel information based on the prediction direction, and a non-angular mode that does not use direction information when performing prediction. The prediction mode for luma information and the prediction mode for chroma information may be different, and intra prediction mode information used to predict luma information or predicted luma signal information may be used to predict chroma information.

[0038] When performing intra prediction, if the size of the prediction unit is the same as the size of the transform unit, intra prediction may be performed on the prediction unit based on the pixel located to the left, the pixel located to the top left, and the pixel located above the prediction unit. However, when performing intra prediction, if the size of the prediction unit is different from the size of the transform unit, intra prediction may be performed based on reference pixels of the transform unit. Also, intra prediction using NxN division may be applied only to the smallest coding unit.

[0039] The intra prediction method may generate a predicted block after applying an adaptive intra smoothing (AIS) filter to reference pixels based on the prediction mode. The type of adaptive intra smoothing filter applied to the reference pixels may vary. To perform the intra prediction method, the intra prediction mode of the current prediction unit may be predicted based on the intra prediction mode of prediction units located around the current prediction unit. When predicting the prediction mode of the current prediction unit using mode information predicted from surrounding prediction units, if the intra prediction modes of the current prediction unit and the surrounding prediction units are the same, information indicating that the prediction modes of the current prediction unit and the surrounding prediction units are the same may be transmitted using predetermined flag information. If the prediction modes of the current prediction unit and the surrounding prediction units are different, the prediction mode information of the current block may be encoded by performing entropy coding.

[0040] Also, a residual block including residual information can be generated, where the residual information is the difference between the prediction unit and the original block of the prediction unit, which is predicted by the prediction unit generated in the prediction units 120 and 125. The generated residual block can be input to the conversion unit 130.

[0041] The transform unit 130 may transform the residual block using a transform method such as a discrete cosine transform (DCT) or a discrete sine transform (DST), where the residual block includes residual information between the original block and the prediction unit generated by the prediction unit 120 or 125. The DCT transform core may include at least one of a DCT2 or a DCT8, and the DST transform core may include a DST7. It may be determined whether to transform the residual block using a DCT or a DST based on intra-prediction mode information of the prediction unit used to generate the residual block. Furthermore, the transform of the residual block may be skipped. A flag indicating whether to skip the transform of the residual block may be coded. Residual blocks whose size is equal to or smaller than a threshold, luma component, or chroma component (4:4:4 format or smaller) may be allowed to skip the transform.

[0042] The quantization unit 135 may quantize the values ​​transformed into the frequency domain by the transform unit 130. The quantization coefficients may vary depending on the importance of the block or video. The values ​​calculated by the quantization unit 135 may be provided to the inverse quantization unit 140 and the reordering unit 160.

[0043] The reordering unit 160 may perform reordering of the coefficient values ​​on the quantized residual values.

[0044] The reordering unit 160 may convert two-dimensional block shape coefficients into one-dimensional vector format using a coefficient scanning method. For example, the reordering unit 160 may scan DC coefficients through high-frequency region coefficients using a zig-zag scan method and convert them into one-dimensional vector format. Depending on the size of the transform unit and the intra prediction mode, instead of zig-zag scanning, vertical scanning, which scans two-dimensional block shape coefficients along the column direction, and horizontal scanning, which scans two-dimensional block shape coefficients along the row direction, may be used. That is, depending on the size of the transform unit and the intra prediction mode, it may be determined which scanning method to use among zig-zag scanning, vertical scanning, and horizontal scanning.

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

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

[0047] The entropy coding unit 165 can perform entropy coding on the coefficient values ​​of the coding unit input from the rearrangement unit 160 .

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

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

[0050] A deblocking filter can remove block artifacts generated in a reconstructed picture due to boundaries between blocks. To determine whether to perform deblocking, it may determine whether to apply a deblocking filter to a current block based on pixels included in several columns or rows included in the block. When applying a deblocking filter to a block, a strong filter or a weak filter may be applied based on the required deblocking filtering strength. In addition, when performing vertical filtering and horizontal filtering in the process of using a deblocking filter, horizontal filtering and vertical filtering may be processed synchronously.

[0051] The offset correction unit may correct the offset between the deblocked picture and the original picture on a pixel-by-pixel basis. After dividing the pixels included in the picture into a predetermined number of regions, the offset correction unit may determine the regions to which the offset is to be applied and apply the offset to the corresponding regions, or may apply the offset in consideration of edge information of each pixel, thereby offset correcting the designated picture.

[0052] Adaptive loop filtering (ALF) may be performed based on a comparison between the filtered reconstructed picture and the original picture. After dividing the pixels included in the picture into predetermined groups, one filter to be used for the corresponding group may be determined, and filtering may be performed separately for each group. Information regarding whether adaptive loop filtering is to be applied may be transmitted to each coding unit (CU) according to the luminance signal, and the shape and filter coefficients of the adaptive loop filter to be applied may differ for each block. Furthermore, the same type (fixed type) of ALF may be applied regardless of the characteristics of the block to which it is applied.

[0053] The memory 155 can store the reconstructed blocks or pictures calculated by the filter unit 150 and can provide the stored reconstructed blocks or pictures to the prediction units 120 and 125 when performing inter prediction.

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

[0055] As shown in FIG. 2, the video decoder 200 may include an entropy decoding unit 210, a reordering unit 215, an inverse quantization unit 220, an inverse transform unit 225, a prediction unit 230, a prediction unit 235, a filter unit 240, and a memory 245.

[0056] When a video bitstream is input from a video encoder, the input bitstream may be decoded according to the reverse steps of the video encoder.

[0057] The entropy decoding unit 210 may perform entropy decoding in a manner that is the reverse of the entropy encoding performed by the entropy encoding unit of the video encoder. For example, the entropy decoding unit 210 may apply a number of methods, such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC), in accordance with the methods performed in the video encoder.

[0058] The entropy decoder 210 may decode information related to intra- and inter-prediction performed by the encoder.

[0059] The reordering unit 215 may perform reordering based on the method used in the encoder to reorder the bitstream entropy decoded by the entropy decoding unit 210. The reordering unit 215 may restore a plurality of coefficients represented in a one-dimensional vector format to two-dimensional block-shaped coefficients and reorder them. The reordering unit 215 may receive information related to coefficient scanning performed by the encoder and perform reordering by performing a reverse scan according to the scanning order performed by the corresponding encoder.

[0060] The inverse quantization unit 220 may perform inverse quantization based on a quantization parameter provided by the encoder and the coefficient values ​​of the block to be reordered.

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

[0062] The prediction units 230 and 235 can generate prediction blocks based on information related to the generation of the prediction blocks provided by the entropy decoding unit 210 and pre-decoded block or picture information provided by the memory 245 .

[0063] As described above, when performing intra prediction in the same manner as the operation in a 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 located to the left, the pixel located to the upper left, and the pixel located above the prediction unit, and if the size of the prediction unit when performing intra prediction is different from the size of the transform unit, intra prediction may be performed using reference pixels based on the transform unit.Furthermore, intra prediction using NxN division may be applied only to the smallest coding unit.

[0064] The prediction units 230 and 235 may include a prediction unit determination unit, an inter prediction unit, and an intra prediction unit. The prediction unit determination unit receives multiple types of information, such as prediction unit information, prediction mode information for the intra prediction method, and motion prediction-related information for the inter prediction method, input from the entropy decoding unit 210, classifies the prediction unit based on the current coding unit, and determines whether the prediction unit performs inter prediction or intra prediction. The inter prediction unit 230 may use information necessary for performing inter prediction on the current prediction unit provided by the video encoder, and perform inter prediction on the current prediction unit based on information included in at least one picture preceding or following the current picture to which the current prediction unit belongs. Alternatively, the inter prediction may also be performed based on information on a reconstructed region of the current picture to which the current prediction unit belongs.

[0065] To perform inter prediction, the coding unit may determine which of the following modes is the motion prediction method of the prediction unit included in the corresponding coding unit: skip mode, merge mode, advanced motion vector prediction mode (AMVP mode), or intra block copy mode.

[0066] The intra prediction unit 235 may generate a prediction block based on pixel information in the current picture. If the prediction unit is a prediction unit for which intra prediction has been performed, the intra prediction may be performed based on 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) filter, a reference pixel interpolator, and a DC filter. The adaptive intra smoothing filter performs filtering on reference pixels of the current block and may determine whether to apply the filter based on the prediction mode of the current prediction unit. Adaptive intra smoothing filtering may be performed on reference pixels of the current block using the prediction mode of the prediction unit and adaptive intra smoothing filter information provided by the video encoder. 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.

[0067] If the prediction mode of the prediction unit is a prediction unit that performs intra prediction based on pixel values ​​of interpolated reference pixels, the reference pixel interpolator may generate reference pixels in pixel units of integer or fractional values ​​by interpolating the reference pixels. If the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating reference pixels, the reference pixels may not need to be interpolated. If the prediction mode of the current block is a DC mode, the DC filter may generate a prediction block by filtering.

[0068] The reconstructed block or picture may be provided to the filter unit 240. The filter unit 240 may include a deblocking filter, an offset correction unit, and an ALF.

[0069] The video decoder may receive, from the video encoder, information related to whether to apply a deblocking filter to a corresponding block or picture, and information related to whether to apply a strong filter or a weak filter when applying the deblocking filter. The deblocking filter of the video decoder may receive information related to the deblocking filter provided by the video encoder, and the video decoder may perform deblocking filtering on the corresponding block.

[0070] The offset correction unit can perform offset correction on the reconstructed picture based on the type of offset correction applied to the picture during encoding, offset amount information, and the like.

[0071] ALF may be applied to a coding unit based on information provided by the encoder regarding whether to apply ALF, ALF coefficient information, etc. Such ALF information may be provided by being included in a specific parameter set.

[0072] The memory 245 can store the reconstructed pictures or blocks, make them available as reference pictures or blocks, and provide the reconstructed pictures to an output.

[0073] FIG. 3 is a diagram showing a basic coding tree unit according to an embodiment of the present invention.

[0074] A coding block of the largest size may be defined as a coding tree block. A picture may be divided into multiple coding tree units (CTUs). A coding tree unit is a coding unit of the largest size and may also be referred to as a largest coding unit (LCU). Figure 3 shows an example of dividing a picture into multiple coding tree units.

[0075] The size of the coding tree unit may be defined at the picture level or the sequence level, and therefore, information indicating the size of the coding tree unit may be signaled by a picture parameter set or a sequence parameter set.

[0076] For example, the size of the coding tree unit for all pictures in a sequence may be set to 128 x 128. Alternatively, the size of the coding tree unit at the picture level may be determined to be either 128 x 128 or 256 x 256. For example, the size of the coding tree unit for the first picture may be set to 128 x 128, and the size of the coding tree unit for the second picture may be set to 256 x 256.

[0077] Coding blocks can be generated by dividing a coding tree unit. A coding block indicates a basic unit for encoding / decoding processing. For example, prediction or transformation may be performed by different coding blocks, or a predictive coding mode may be determined by different coding blocks. The predictive coding mode indicates a method for generating a predicted picture. For example, the predictive coding mode may include intra prediction (intra prediction), inter prediction (inter prediction), current picture referencing (CPR, current picture referencing, or intra block copy (IBC)), or combined prediction. For a coding block, a predictive block related to the coding block may be generated using at least one predictive coding mode from intra prediction, inter prediction, current picture referencing, or combined prediction.

[0078] Information indicating the predictive coding mode of the current block may be transmitted by a signal via the bitstream. For example, the information may be a one-bit flag indicating whether the predictive coding mode is intra mode or inter mode. Current picture reference or combined prediction may be used only when it is determined that the predictive coding mode of the current block is inter mode.

[0079] The current picture reference is used to set the current picture as a reference picture and obtain a prediction block for the current block from a coded / decoded area in the current picture. The current picture refers to a picture including the current block. Information indicating whether the current picture reference is applied to the current block may be transmitted by a signal via a bitstream. For example, the information may be a 1-bit flag. If the flag is true, the predictive coding mode of the current block may be determined as the current picture reference. If the flag is false, the prediction mode of the current block may be determined as inter prediction.

[0080] Alternatively, the predictive coding mode of the current block may be determined based on a reference picture index. For example, if the reference picture index points to the current picture, the predictive coding mode of the current block may be determined as current picture reference. If the reference picture index points to another picture other than the current picture, the predictive coding mode of the current block may be determined as inter prediction. That is, current picture reference is a prediction method that uses information on an area in the current picture after encoding / decoding, and inter prediction is a prediction method that uses information on another picture after encoding / decoding.

[0081] Combined prediction refers to a coding mode that combines two or more of intra prediction, inter prediction, and current picture reference. For example, when combined prediction is applied, a first predicted block may be generated by one of intra prediction, inter prediction, or current picture reference, and a second predicted block may be generated by another of intra prediction, inter prediction, or current picture reference. When generating the first predicted block and the second predicted block, a final predicted block may be generated by averaging or weighting and calculating the first predicted block and the second predicted block. Information indicating whether combined prediction is applied may be transmitted via a signal in a bitstream. The information may be a one-bit flag.

[0082] FIG. 4 is a diagram showing a variety of division types of coding blocks.

[0083] A coding block may be divided into multiple coding blocks by quadtree division, binary tree division, or ternary tree division. Furthermore, a coding block divided by quadtree division, binary tree division, or ternary tree division may be further divided into multiple coding blocks.

[0084] Quadtree partitioning refers to a partitioning technique that divides the current block into four blocks. As a result of the quadtree partitioning, the current block may be divided into four square segments (see "SPLIT_QT" in part (a) of Figure 4).

[0085] Binary tree splitting refers to a splitting technique that splits a current block into two blocks. The process of splitting a current block into two blocks along the vertical direction (i.e., using a vertical line crossing the current block) may be referred to as vertical binary tree splitting, and the process of splitting a current block into two blocks along the horizontal direction (i.e., using a horizontal line crossing the current block) may be referred to as horizontal binary tree splitting. As a result of the binary tree splitting, the current block may be split into two non-square segments. 'SPLIT_BT_VER' in part (b) of Figure 4 indicates the result of vertical binary tree splitting, and 'SPLIT_BT_HOR' in part (c) of Figure 4 indicates the result of horizontal binary tree splitting.

[0086] Ternary tree partitioning refers to a partitioning technique that divides a current block into three blocks. The process of dividing the current block into three blocks along the vertical direction (i.e., using two vertical lines crossing the current block) may be referred to as vertical ternary tree partitioning, and the process of dividing the current block into three blocks along the horizontal direction (i.e., using two horizontal lines crossing the current block) may be referred to as horizontal ternary tree partitioning. As a result of ternary tree partitioning, the current block may be divided into three non-square segments. In such a case, the width / height of the segment located at the center of the current block may be twice the width / height of the other segments. 'SPLIT_TT_VER' in part (d) of Figure 4 indicates the result of vertical ternary tree partitioning, and 'SPLIT_TT_HOR' in part (e) of Figure 4 indicates the result of horizontal ternary tree partitioning.

[0087] The number of times a coding tree unit is divided may be defined as the partitioning depth. The maximum partitioning depth of a coding tree unit may be determined at the sequence or picture level. Therefore, the maximum partitioning depth of a coding tree unit may differ for different sequences or pictures.

[0088] Alternatively, the maximum decomposition depth may be determined independently for each of multiple decomposition techniques, e.g., the maximum decomposition depth allowed for quadtree decomposition may be different from the maximum decomposition depth allowed for binary and / or ternary tree decomposition.

[0089] The encoder may transmit information indicating at least one of the partition type and partition depth of the current block by signaling through the bitstream, and the decoder may determine the partition type and partition depth of the coding tree unit based on the information parsed from the bitstream.

[0090] FIG. 5 is a diagram showing an example of division of a coding tree unit.

[0091] The process of dividing a coding block using a division technique such as quad-tree division, binary tree division, and / or ternary tree division may be referred to as multi-tree partitioning.

[0092] A coding block generated by applying multi-tree partitioning to a coding block may be called a downward-flying coding block. When the partitioning depth of a coding block is k, the partitioning depth of multiple downstream coding blocks is set to k+1.

[0093] On the other hand, with respect to the coding block of division depth k+1, the coding block of division depth k may be referred to as an upstream coding block.

[0094] The partition type of the currently coded block may be determined based on at least one of the partition type of the upstream coded block or the partition type of the adjacent coded block. The adjacent coded block may be adjacent to the currently coded block and 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 currently coded block. The partition type may include at least one of whether to split into a quadtree, whether to split into a binary tree, the split direction of the binary tree, whether to split into a ternary tree, or the split direction of the ternary tree.

[0095] To determine the split type of a coding block, a signal may be sent via the bitstream to indicate whether the coding block has been split, such as a 1-bit flag "split_cu_flag" that, if true, indicates that the coding block is split using the multi-tree splitting technique.

[0096] If "split_cu_flag" is true, a signal may be sent via the bitstream indicating whether the coding block has been quadtree split. The information is a 1-bit flag "split_qt_flag", and if the flag is true, the coding block may be split into four blocks.

[0097] For example, the example shown in Figure 5 shows that a coding tree unit is quadtree divided to generate four coding blocks with a division depth of 1. It also shows that quadtree division is applied again to the first and fourth coding blocks among the four coding blocks generated as a result of the quadtree division. Finally, four coding blocks with a division depth of 2 can be generated.

[0098] Furthermore, quadtree division may be applied again to an encoding block with a division depth of 2 to generate an encoding block with a division depth of 3.

[0099] When quadtree partitioning is not applied to a coding block, it may be determined whether to perform binary tree partitioning or ternary tree partitioning on the coding block, taking into account at least one of the size of the coding block, whether the coding block is located on a picture boundary, the maximum partition depth, or the partition type of an adjacent block. When it is determined to perform binary tree partitioning or ternary tree partitioning on the coding block, it may be transmitted by a signal via a bitstream, indicating the partitioning direction. The information may be a one-bit flag "mtt_split_cu_vertical_flag." It may be determined based on the flag whether the partitioning direction is vertical or horizontal. It may also be transmitted by a signal via a bitstream, indicating whether binary tree partitioning or ternary tree partitioning is applied to the coding block. The information may be a one-bit flag "mtt_split_cu_binary_flag." It may be determined based on the flag whether to apply binary tree partitioning or ternary tree partitioning to the coding block.

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

[0101] Inter-prediction refers to predicting the predictive coding mode of a current block using information from a previous picture. For example, a block located at the same position as the current block in the previous picture (hereinafter referred to as a collocated block) may be set as the predictive block of the current block. Hereinafter, a predictive block generated based on a block located at the same position as the current block is referred to as a collocated prediction block.

[0102] On the other hand, if an object in a previous picture has already moved to another position in the current picture, the current block may be effectively predicted based on the object's motion. For example, if the object's movement direction and size can be determined by comparing the previous picture with the current picture, a predicted block (or predicted picture) of the current block may be generated taking into account the object's motion information. Hereinafter, the predicted block generated based on the motion information may be referred to as a motion predicted block.

[0103] A residual block can be generated by removing the predicted block from the current block. In this case, if an object moves, the energy of the residual block can be reduced by replacing the co-located predicted block with the motion predicted block, thereby improving the compression performance of the residual block.

[0104] The process of generating a prediction block using motion information as described above may be referred to as motion compensated prediction. In most inter predictions, a prediction block may be generated using motion compensated prediction.

[0105] The motion information may include at least one of a motion vector, a reference picture index, a prediction direction, or a bidirectional weighting value index. The motion vector indicates the direction of movement and size of an object. The reference picture index specifies a reference picture of the current block from multiple reference pictures included in a reference picture list. The prediction direction indicates one of unidirectional L0 prediction, unidirectional L1 prediction, or bidirectional prediction (L0 prediction and L1 prediction). At least one of L0-directional motion information or L1-directional motion information may be used based on the prediction direction of the current block. The bidirectional weighting value index specifies a weighting value to be applied to the L0 prediction block and a weighting value to be applied to the L1 prediction block.

[0106] FIG. 6 is a flowchart of an inter prediction method according to an embodiment of the present invention.

[0107] As shown in FIG. 6, the inter prediction method includes determining an inter prediction mode for a current block (S601), obtaining motion information for the current block based on the determined inter prediction mode (S602), and performing motion compensation prediction for the current block based on the obtained motion information (S603).

[0108] The inter prediction mode indicates a number of techniques for determining motion information of the current block, and may include an inter prediction mode using translational motion information and an inter prediction mode using affine motion information. For example, the inter prediction mode using translational motion information may include a merge mode and an advanced motion vector prediction mode, and the inter prediction mode using affine motion information may include an affine merge mode and an affine motion vector prediction mode. Depending on the inter prediction mode, the motion information of the current block may be determined based on information analyzed from a neighboring block adjacent to the current block or a bitstream.

[0109] The inter prediction method using affine motion information will now be described in detail.

[0110] FIG. 7 is a diagram illustrating the nonlinear motion of an object.

[0111] The motion of an object in a video may be nonlinear. For example, in the example shown in FIG. 7, nonlinear motion of an object may occur due to zoom-in, zoom-out, rotation, or affine transformation of a video camera. When nonlinear motion of an object occurs, the motion of the object cannot be effectively represented by a translational motion vector. Therefore, in parts where nonlinear motion of an object occurs, translational motion may be replaced by affine motion, thereby improving coding efficiency.

[0112] FIG. 8 is a flowchart illustrating an affine motion-based inter-prediction method according to an embodiment of the present invention.

[0113] Whether to apply an affine motion-based inter prediction technique to the current block may be determined based on information analyzed from the bitstream. Specifically, whether to apply an affine motion-based inter prediction technique to the current block may be determined based on at least one of a flag indicating whether to apply an affine merge mode to the current block or a flag indicating whether to apply an affine motion vector prediction mode to the current block.

[0114] When applying an affine motion-based inter-prediction technique to a current block, an affine motion model of the current block may be determined (S801). The affine motion model may be determined as at least one of a six-parameter affine motion model or a four-parameter affine motion model. The six-parameter affine motion model represents affine motion with six parameters, and the four-parameter affine motion model represents affine motion with four parameters.

[0115] Equation 1 shows the affine motion with six parameters. Affine motion is the translational motion of a given region determined by an affine seed vector.

[0116] equation 1

number

[0117] When affine motion is represented by six parameters, complex motion can be represented, but the number of bits required to encode each parameter increases, resulting in a decrease in coding efficiency. Therefore, affine motion can be represented by four more parameters. Equation 2 shows the case where affine motion is represented by four parameters.

[0118] equation 2

number

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

[0120] 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 four-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 coded and transmitted as a signal 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."

[0121] Next, an affine seed vector for the current block may be derived (S802). If a four-parameter affine motion model is selected, motion vectors for two control points of the current block may be derived. On the other hand, if a six-parameter affine motion model is selected, motion vectors for three control points of the current block may be derived. The motion vectors for the control points may be referred to as affine seed vectors. The control points may include at least one of the upper left corner, upper right corner, or lower left corner of the current block.

[0122] FIG. 9 is a diagram showing examples of affine seed vectors for each affine motion model.

[0123] In a four-parameter affine motion model, affine seed vectors associated with two of the upper-left corner, the upper-right corner, or the lower-left corner may be derived. For example, in the example shown in part (a) of FIG. 9, when the four-parameter affine motion model is selected, an affine seed vector sv0 associated with the upper-left corner of the current block (e.g., the upper-left sample (x0, y0)) and an affine seed vector sv1 associated with the upper-right corner of the current block (e.g., the upper-right sample (x1, y1)) may be used to derive an affine vector. Furthermore, the affine seed vector associated with the lower-left corner may be substituted for the affine seed vector associated with the upper-left corner, or the affine seed vector associated with the lower-left corner may be substituted for the affine seed vector associated with the upper-right corner.

[0124] In a six-parameter affine motion model, affine seed vectors associated with the top-left corner, the top-right corner, and the bottom-left corner may be derived. For example, in the example shown in part (b) of Figure 9, when a six-parameter affine motion model is selected, affine vectors may be derived using an affine seed vector sv0 associated with the top-left corner of the current block (e.g., the top-left sample (x0, y0)), an affine seed vector sv1 associated with the top-right corner of the current block (e.g., the top-right sample (x1, y1)), and an affine seed vector sv2 associated with the top-left corner of the current block (e.g., the top-left sample (x2, y2)).

[0125] In the embodiments described below, in the four-parameter affine motion model, the affine seed vectors of the top-left and top-right control points are referred to as the first and second affine seed vectors, respectively. In the embodiments described below that use the first and second affine seed vectors, at least one of the first and second affine seed vectors may be replaced with the affine seed vector of the bottom-left control point (third affine seed vector) or the affine seed vector of the bottom-right control point (fourth affine seed vector).

[0126] In the six-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 referred to as the first affine seed vector, the second affine seed vector, and the third affine seed vector, respectively. In the embodiment described below that uses the first affine seed vector, the second affine seed vector, and the third affine seed vector, at least one of the first affine seed vector, the second affine seed vector, and the third affine seed vector may be replaced with the affine seed vector of the lower-right control point (fourth affine seed vector).

[0127] The affine seed vector may be used to derive affine vectors for different sub-blocks (S803). The affine vectors represent translational motion vectors derived based on the affine seed vector. The affine vectors of sub-blocks may also be referred to as affine sub-block motion vectors or sub-block motion vectors.

[0128] FIG. 10 is a diagram showing an example of affine vectors of sub-blocks in a four-parameter motion model.

[0129] The affine vectors for the sub-blocks may be derived based on the control point positions, the sub-block positions, and the affine seed vectors. For example, Equation 3 shows an example of deriving affine sub-block vectors.

[0130] equation 3

number

[0131] In Equation 3, (x, y) indicates the position of the sub-block. The position of the sub-block indicates the position of the reference sample included in the sub-block. The reference sample may be a sample located in the upper left corner of the sub-block, or a sample whose x-axis or y-axis coordinate is at the center. (x0, y0) indicates the position of the first control point, and (sv 0x ,sv 0y ) indicates the first affine seed vector. Also, (x1, y1) indicates the position of the second control point, and (sv 1x ,sv 1y ) denotes the second affine seed vector.

[0132] If the first and second control points correspond to the upper left and upper right corners of the current block, respectively, x1-x0 may be set to the same value as the width of the current block.

[0133] Then, motion compensated prediction may be performed on each sub-block using the affine vector of each sub-block (S804). After performing motion compensated prediction, a predicted block associated with each sub-block may be generated. The predicted block of the sub-block may be set as the predicted block of the current block.

[0134] The affine seed vector of the current block may be derived based on the affine seed vectors of neighboring blocks adjacent to the current block. If the inter prediction mode of the current block is the affine merge mode, the affine seed vector of a merge candidate included in the merge candidate list may be determined as the affine seed vector of the current block. Furthermore, if the inter prediction mode of the current block is the affine merge mode, at least one motion information of a reference picture index including the current block, a specific direction prediction flag, or a bidirectional weighting value may be set to be the same as that of a merge candidate.

[0135] The merging candidates may be derived based on neighboring blocks of the current block, which may include at least one of spatial neighboring blocks that are spatially neighboring to the current block and temporal neighboring blocks included in a picture other than the current picture.

[0136] FIG. 11 is a diagram illustrating neighboring blocks that can be used to derive merge candidates.

[0137] The neighboring blocks of the current block may include at least one of the neighboring block (A) to the left of the current block, the neighboring block (B) above the current block, the neighboring block (C) at the top right corner of the current block, the neighboring block (D) at the bottom left corner of the current block, or the neighboring block at the top left corner of the current block. If the coordinates of the top left sample of the current block are (x0, y0), the left neighboring block A includes a sample at the position (x0-1, y0+H-1), and the top neighboring block B includes a sample at the position (x0+W-1, y0-1). W and H indicate the width and height of the current block, respectively. The top right neighboring block C includes a sample at the position (x0+W, y0-1), and the bottom left neighboring block D includes a sample at the position (x0-1, y0+H). The top left neighboring block E includes a sample at the position (x0-1, y0-1).

[0138] When a neighboring block is coded in affine inter prediction mode, the affine seed vector of a merge candidate may be derived based on the affine seed vector of the corresponding neighboring block. Hereinafter, a neighboring block coded in affine inter prediction mode is referred to as an affine neighboring block, and a merge candidate derived from the affine neighboring block is referred to as an affine merge candidate.

[0139] Affine merge candidates related to a current block may be generated by searching neighboring blocks according to a predefined scanning order. The scanning order may be predefined in the encoder and decoder. For example, neighboring blocks may be searched in the order A, B, C, D, and E. Merge candidates may also be derived from the searched affine neighboring blocks in order. Alternatively, the scanning order may be adaptively determined based on at least one of the size, shape, and affine motion model of the current block. That is, blocks having different sizes, shapes, and affine motion models have different scanning orders.

[0140] Alternatively, the multiple blocks located above the current block are searched in order to derive one affine merge candidate from the previously found affine neighboring blocks, and the multiple blocks located to the left of the current block are searched in order to derive one affine merge candidate from the previously found affine neighboring blocks. The multiple neighboring blocks located above the current block may include at least one of neighboring block E, neighboring block B, or neighboring block C, and the multiple blocks located to the left of the current block may include at least one of block A or block D. In this case, neighboring block E may be further classified as a block located to the left of the current block.

[0141] Although not shown, affine merge candidates may also be derived from temporally neighboring blocks of the current block. The temporally neighboring blocks may include blocks located at the same position as the current block in a co-located picture or blocks neighboring the current block. Specifically, if the temporally neighboring blocks of the current block are coded in affine inter-prediction mode, affine merge candidates may be derived based on the affine seed vectors of the temporal affine merge candidates.

[0142] A merge candidate list including affine merge candidates may be generated, and the affine seed vector of one of the merge candidates included in the merge candidate list may be determined as the affine seed vector of the current block. To this end, index information indicating one of the merge candidates may be encoded and transmitted via a bitstream.

[0143] As another example, multiple neighboring blocks may be searched according to the scan order, and the affine seed vector of the current block may be derived from the affine seed vectors of previously searched affine neighboring blocks.

[0144] As described above, in affine merge mode, the affine seed vector of the current block may be derived using the affine seed vectors of neighboring blocks.

[0145] When the inter prediction mode of the current block is an affine motion vector prediction mode, an affine seed vector of a motion vector prediction candidate included in the motion vector prediction candidate list may be determined as an affine seed vector prediction value of the current block, and an affine seed vector difference may be added to the affine seed vector prediction value to derive an affine seed vector of the current block.

[0146] Affine seed vector prediction candidates may be derived based on neighboring blocks of the current block. Specifically, a plurality of neighboring blocks located above the current block may be searched in a predetermined scanning order, and a first affine seed vector prediction candidate may be derived from the first affine neighboring block. Alternatively, a plurality of neighboring blocks located to the left of the current block may be searched in a predetermined scanning order, and a second affine seed vector prediction candidate may be derived from the first affine neighboring block.

[0147] Information for determining the affine seed vector difference may be coded and transmitted via a bitstream. The information may include magnitude information indicating the magnitude of the affine seed vector difference and a sign signal indicating the sign of the affine seed vector difference. The affine seed vector difference associated with each control point may be set to be the same. Alternatively, a different affine seed vector difference may be set for each control point.

[0148] As described above, the affine seed vector of an affine merge candidate or an affine seed vector prediction candidate may be derived from the affine seed vector of an affine neighboring block, and the affine seed vector of the current block may be derived using the affine seed vector of the derived affine merge candidate or affine seed vector prediction candidate. Alternatively, after searching for a plurality of affine neighboring blocks according to a predetermined scanning order, the affine seed vector of the current block may be derived from the affine seed vector of the previously searched affine neighboring block.

[0149] A method for deriving an affine seed vector, an affine merge candidate, or an affine seed vector prediction candidate of a current block from the affine seed vectors of affine neighboring blocks will be described in detail below. In the embodiments described below, deriving an affine seed vector of a current block may be understood as deriving an affine seed vector of an affine merge candidate, or may further be understood as deriving an affine seed vector of an affine seed vector prediction candidate.

[0150] FIG. 12 is a diagram illustrating deriving an affine seed vector for a current block based on the affine seed vectors of affine neighboring blocks.

[0151] If an affine neighboring block stores a first affine seed vector nv0 associated with the top-left control point and a second affine seed vector nv1 associated with the top-right control point, a third affine seed vector nv2 associated with the bottom-left control point of the affine neighboring block may be derived based on the first and second affine seed vectors. Equation 4 shows an example of deriving the third affine seed vector.

[0152] equation 4

number

[0153] In equation 4, (nv 0x ,nv 0y ) denotes the first affine seed vector nv0, and (nv 1x ,nv 1y ) denotes the second affine seed vector nv1, and (nv 2x ,nv 2y ) denotes the third affine seed vector nv2. Also, (x n0 ,x n0 ) indicates the position of the first control point, and (x n1 ,x n1 ) indicates the position of the second control point, and (x n2 ,x n2 ) indicates the position of the third control point.

[0154] Then, the affine seed vector for the current block may be derived using the first affine seed vector, the second affine seed vector, and the third affine seed vector. Equation 5 shows an example of deriving the first affine seed vector v0 for the current block, and Equation 6 shows an example of deriving the second affine seed vector v1 for the current block.

[0155] Equation 5

number

[0156] Equation 6

number

[0157] In Equation 5 and Equation 6, (v 0x ,v 0y ) denotes the first affine seed vector sv0 of the current block, and (v 1x ,v 1y ) indicates the second affine seed vector sv1 of the current block. Also, (x0, y0) indicates the position of the first control point, and (x1, y1) indicates the position of the second control point. For example, the first control point indicates the upper left corner of the current block, and the second control point indicates the upper right corner of the current block.

[0158] In the above example, three affine seed vectors associated with affine neighboring blocks are used to derive multiple affine seed vectors for the current block. As another example, two of the multiple affine seed vectors of the affine neighboring blocks may be used to derive an affine seed vector for the current block.

[0159] Alternatively, the multiple affine seed vectors for the current block may be derived using a fourth affine seed vector associated with the lower right corner, without using the first affine seed vector in the upper left corner, the second affine seed vector in the upper right corner, or the third affine seed vector in the lower left corner associated with the affine neighboring blocks.

[0160] In particular, when the upper boundary of the current block touches the upper boundary of a coding tree unit and an affine seed vector of an upper control point (e.g., the upper-left corner or the upper-right corner) of an affine neighboring block (hereinafter referred to as an upper affine neighboring block) adjacent to the current block above is to be used, the affine seed vectors must be stored in memory in advance. This may result in an increase in the number of row buffer areas. Therefore, when the upper boundary of the current block touches the upper boundary of a coding tree unit, the affine seed vector of a lower control point (e.g., the lower-left corner or the lower-right corner) may be used for the upper affine neighboring block instead of the affine seed vector of the upper control point. For example, multiple affine seed vectors for the current block may be derived using the third affine seed vector associated with the lower-left corner and the fourth affine seed vector associated with the lower-right corner of the upper affine neighboring block. In such a case, the affine seed vector associated with the lower corner may be derived by copying the affine seed vector associated with the upper corner, or may be derived from the affine seed vectors associated with multiple upper corners. For example, the first affine seed vector, the second affine seed vector, or the third affine seed vector may be transformed / substituted with a fourth affine seed vector associated with the bottom right corner.

[0161] Equation 7 and Equation 8 show an example of deriving the first and second affine seed vectors of the current block using the third affine seed vector associated with the bottom-left control point and the fourth affine seed vector associated with the bottom-right control point of the adjacent affine vectors.

[0162] Equation 7

number

[0163] equation 8

number

[0164] In equations 7 and 8, (x n2 ,y n2 ) indicates the coordinate of the bottom-left control point of the affine neighboring block, and (x n3 ,y n3 ) indicates the coordinates of the bottom right control point of the affine adjacent block. (x0,y0) indicates the coordinates of the top left control point of the current block, and (x1,y1) indicates the coordinates of the top right control point of the current block. (nv 2x ,nv 2y ) denotes the affine seed vector of the lower-left control point of the affine neighboring block (i.e., the third affine seed vector), and (nv 3x ,nv 3y ) denotes the affine seed vector of the lower-right control point of the affine neighboring block (i.e., the fourth affine seed vector). 0x ,v 0y ) denotes the affine seed vector of the top-left control point of the current block (i.e., the first affine seed vector), and (v 1x ,v 1y ) indicates the affine seed vector of the top right control point of the current block (i.e., the second affine seed vector).

[0165] Furthermore, the division operations in Equation 7 and Equation 8 may be changed to shift operations. The shift operation is the width between the bottom-left control point and the bottom-right control point (i.e., (x n3 -x n2 )) may be performed based on the values ​​derived by

[0166] In the above example, multiple affine seed vectors for the current block may be derived based on multiple affine seed vectors for the affine neighboring blocks after encoding / decoding. Therefore, multiple affine seed vectors for the affine neighboring blocks after encoding / decoding must be stored in memory. However, in addition to multiple translational motion vectors (i.e., multiple affine vectors) of multiple sub-blocks included in the affine neighboring blocks, multiple affine seed vectors for the affine neighboring blocks must also be stored in memory, resulting in increased memory usage. To address this issue, the affine seed vector for the current block may be derived using the motion vector of a sub-block adjacent to a control point of the affine neighboring block, thereby replacing the affine seed vector of the affine neighboring block. That is, the motion vector of the sub-block adjacent to the control point of the affine neighboring block may be set as the affine seed vector of the affine neighboring block. The sub-block may be a block having a size / shape predefined in the encoder and decoder, and may store the basic size / shape of the motion vector. For example, the sub-block may be a square block having a size of 4×4. Alternatively, a motion vector specifying the sample position may be set as the affine seed vector of the affine neighboring block.

[0167] FIG. 13 is a diagram showing an example in which the motion vector of a sub-block is set as the affine seed vector of an affine adjacent block.

[0168] The motion vector of a sub-block adjacent to a control point may be set as the affine seed vector of the corresponding control point. For example, in the example shown in FIG. 13, the motion vector (nv 4x ,nv 4y ) to the affine seed vector (nv 2x ,nv 2y ), and the motion vector (nv 5x ,nv 5y) is the affine seed vector (nv 3x ,nv 3y ) of the adjacent affine block. n2 ,y n2 ) adjacent samples (e.g., (x n2 ,y n2 -1) of the adjacent affine block, and the bottom-right sub-block is the sub-block containing the bottom-right control point (x n3 ,y n3 ) adjacent samples (e.g., (x n3 -1,y n3 When deriving the affine seed vector of the current block based on Equation 7 and Equation 8, the third affine seed vector of the affine neighboring block may be replaced with the motion vector of the lower-left sub-block, and the fourth affine seed vector may be replaced with the motion vector of the lower-right sub-block.

[0169] Hereinafter, in the embodiments described below, the sub-blocks of an affine seed vector that are used as affine neighbors are referred to as affine sub-blocks.

[0170] According to an embodiment of the present invention, an affine sub-block may be determined based on a sample at a specific position. For example, a sub-block including a sample at a specific position may be set as an affine sub-block. Hereinafter, the sample at the specific position is referred to as an affine reference sample. Furthermore, the reference sample of the affine sub-block for determining the bottom-left control point is referred to as the bottom-left reference sample, and the reference sample of the affine sub-block for determining the bottom-right control point is referred to as the bottom-right reference sample.

[0171] The lower-left reference sample and the lower-right reference sample may be selected from a plurality of samples included in the affine neighboring blocks. For example, at least one of the upper-left sample, the lower-left sample, the upper-right sample, or the lower-left sample of the lower-left sub-block may be set as the lower-left reference sample, and at least one of the upper-left sample, the lower-left sample, the upper-right sample, or the lower-left sample of the lower-right sub-block may be set as the lower-right reference sample. Therefore, the motion vectors of the lower-left sub-block including the lower-left reference sample and the lower-right sub-block including the lower-right reference sample may be set as the affine seed vector associated with the lower-left control point and the affine seed vector associated with the lower-right control point, respectively.

[0172] As another example, at least one of the lower-left reference sample and the lower-right reference sample may be set as a sample located outside the affine neighboring block, as will be described in detail with reference to FIGS.

[0173] 14 to 16 are diagrams showing the positions of the reference samples.

[0174] In the example shown in part (a) of FIG. 14, for the bottom-left control point, the top-left sample of the bottom-left sub-block is used as the reference sample (x n4 ,y n4 ) can be set as the reference sample (x n4 ,y n4 ) may be set as the affine sub-block associated with the lower-left control point.

[0175] For the bottom-right control point, the sample located to the right of the top-right sample of the bottom-right sub-block is the reference sample (x n5 ,y n5 ) can be set as the reference sample (x n5 ,y n5 ) may be set as the affine sub-block associated with the lower-right control point.

[0176] Alternatively, in the example shown in part (b) of FIG. 14, for the bottom-left control point, the sample located to the left of the top-left sample of the bottom-left sub-block is used as the reference sample (x n4 ,y n4 ) can be set as the reference sample (x n4 ,y n4 ) may be set as the affine sub-block associated with the lower-left control point.

[0177] For the bottom-right control point, the top-right sample of the bottom-right sub-block is the reference sample (x n5 ,y n5 ) can be set as the reference sample (x n5 ,y n5 ) may be set as the affine sub-block associated with the lower-right control point.

[0178] Alternatively, in the example shown in part (a) of FIG. 15, for the bottom-left control point, the bottom-left sample of the bottom-left sub-block is used as the reference sample (x n4 ,y n4 ) can be set as the reference sample (x n4 ,y n4 ) may be set as the affine sub-block associated with the lower-left control point.

[0179] For the bottom-right control point, the sample located to the right of the bottom-right sample of the bottom-right sub-block is the reference sample (x n5 ,y n5 ) can be set as the reference sample (x n5 ,y n5 ) may be set as the affine sub-block associated with the lower-right control point.

[0180] Alternatively, in the example shown in part (b) of FIG. 15, for the bottom-left control point, the sample located to the left of the bottom-left sample of the bottom-left sub-block is used as the reference sample (x n4 ,y n4) can be set as the reference sample (x n4 ,y n4 ) may be set as the affine sub-block associated with the lower-left control point.

[0181] For the bottom-right control point, the bottom-right sample of the bottom-right sub-block is used as the reference sample (x n5 ,y n5 ) can be set as the reference sample (x n5 ,y n5 ) may be set as the affine sub-block associated with the lower-right control point.

[0182] Alternatively, in the example shown in part (a) of FIG. 16, for the bottom-left control point, a sample located between the top-left sample and the bottom-left sample of the bottom-left sub-block (e.g., the left middle sample) is used as the reference sample (x n4 ,y n4 ) can be set as the reference sample (x n4 ,y n4 ) may be set as the affine sub-block associated with the lower-left control point.

[0183] For the lower-right control point, the sample to the right of the sample located between the upper-right sample and the lower-right sample of the lower-right sub-block (e.g., the right-side middle sample) is used as the reference sample (x n5 ,y n5 ) can be set as the reference sample (x n5 ,y n5 ) may be set as the affine sub-block associated with the lower-right control point.

[0184] Alternatively, in the example shown in part (b) of FIG. 16, for the bottom-left control point, the sample to the left of the sample located between the top-left sample and the bottom-left sample of the bottom-left sub-block is set as the reference sample (x n4 ,y n4 ) can be set as the reference sample (x n4 ,yn4 ) may be set as the affine sub-block associated with the lower-left control point.

[0185] For the bottom-right control point, the sample located between the top-right sample and the bottom-right sample of the bottom-right sub-block is the reference sample (x n5 ,y n5 ) can be set as the reference sample (x n5 ,y n5 ) may be set as the affine sub-block associated with the lower-right control point.

[0186] When deriving the multiple affine seed vectors for the current block based on Equation 7 and Equation 8, the third affine seed vector of the affine neighboring block may be replaced with the motion vector of the affine sub-block associated with the bottom-left control point, the fourth affine seed vector may be replaced with the motion vector of the affine sub-block associated with the bottom-right control point, the position of the bottom-left control point may be replaced with the position of the bottom-left reference sample, and the position of the bottom-right control point may be replaced with the position of the bottom-right reference sample.

[0187] Unlike the contents described in FIGS. 14 to 16, a sub-block including a sample adjacent to the reference sample may be set as an affine sub-block. Specifically, a sample located outside an affine adjacent sub-block may be set as a reference sample, or a sub-block included in an affine adjacent block may be set as an affine sub-block. For example, in the example shown in FIG. 14(a), a sample located to the right of the upper right sample of the lower right sub-block is set as a reference sample (x n5 ,y n5 ) and the bottom right sub-block may be set as the affine sub-block associated with the bottom right corner. Alternatively, in the example shown in part (b) of FIG. 14, the sample located to the left of the top left sample of the bottom left sub-block may be set as the reference sample (x n4 ,y n4) and the bottom left sub-block may be set as the affine sub-block associated with the bottom left corner.

[0188] The embodiments illustrated in Figures 15 and 16 may be applied in a similar manner. That is, in the example shown in Figure 15(a) or Figure 16(a), the sample located to the right of the bottom right sample of the bottom right sub-block or the right middle sample is used as the reference sample (x n5 ,y n5 ) and the bottom right sub-block may be set as the affine sub-block associated with the bottom right corner. Alternatively, in the example shown in part (b) of FIG. 15 or part (b) of FIG. 16, the bottom left sample of the bottom left sub-block or the sample located to the left of the left middle sample may be set as the reference sample (x n4 ,y n4 ) and the bottom left sub-block may be set as the affine sub-block associated with the bottom left corner.

[0189] In the above example, the motion vectors of the affine sub-blocks may be used to derive the affine seed vectors of the affine neighboring blocks, and therefore, the motion vectors may be stored on a sub-block basis for the coded / decoded blocks.

[0190] As another example, after a minimum number of affine seed vectors are stored for affine neighboring blocks, the stored affine seed vectors may be used to derive motion vectors for the affine sub-blocks.

[0191] Equation 9 and Equation 10 show an example of deriving the motion vector of an affine sub-block using the affine seed vectors of affine neighboring blocks.

[0192] equation 9

number

[0193] Equation 10

number

[0194] In Equation 9 and Equation 10, (nv 4x ,nv 4y ) denotes the motion vector of the affine sub-block relative to the bottom-left control point, and (nv 5x ,nv 5y ) denotes the motion vector of the affine sub-block associated with the bottom-right control point. The motion vector of the affine sub-block and the affine seed vector of the control point are set to be the same, so (nv 4x ,nv 4y ) is the affine seed vector (nv 2x ,nv 2y ) or (nv 5x ,nv 5y ) is the affine seed vector (nv 3x ,nv 3y ) may be substituted.

[0195] (x n4 ,y n4 ) indicates the position of the reference sample of the lower left sub-block. Alternatively, the position may be replaced by the center position of the lower left sub-block or the position of the lower left control point. (x n5 ,y n5 ) indicates the position of the reference sample of the lower right sub-block. Alternatively, the position may be further replaced with the center position of the lower right sub-block or the position of the lower right control point.

[0196] If the current block does not touch the boundary of the coding tree unit, Equation 9 and Equation 10 may be applied. If the current block touches the upper boundary of the coding tree unit, instead of using Equation 9 and Equation 10, the translational motion vector of the affine sub-block determined based on the lower-left reference sample may be set as the third affine seed vector, and the translational motion vector of the affine sub-block determined based on the lower-right reference sample may be set as the fourth affine seed vector.

[0197] In equations 7 and 8, (xn3 -x n2 ) indicates the width between the bottom left control point and the bottom right control point. n3 is the position of the lower right reference sample x n5 may be substituted with x n2 is the position of the lower left reference sample x n4 It may be replaced by (x n3 -x n2 ) or the value obtained by substituting the position of the above equation with the position of the reference sample (e.g., (x n5 -x n4 )) to variable W seed where the variable is called the subseed vector width.

[0198] Depending on the position of the reference sample, the subseed vector width may not be a power series of 2 (e.g., 2n). For example, if the lower-left sample of the lower-left subblock is set as the lower-left reference sample and the lower-right sample of the lower-right subblock is set as the lower-right reference sample, the width of the subseed vector is not a multiple of 2. As described above, if the subseed vector width is not a power series of 2, the subseed vector width may be converted to a power series of 2. The conversion may include adding an offset to the subseed vector width, subtracting an offset from the subseed vector width, or substituting the position of the reference sample with the position of a sample adjacent to the reference sample. For example, the converted subseed vector width may be derived by adding 1 to the width between the lower-left reference sample and the lower-right reference sample. Alternatively, the width between the adjacent reference sample adjacent to the right of the lower-right reference sample and the lower-left reference sample may be set as the converted subseed vector width. The converted subseed vector width may then be substituted into Equations 7 and 8 to derive the affine seed vector for the current block.

[0199] Furthermore, the division operations in Equation 7 and Equation 8 may be changed to shift operations. The shift operations may be performed based on values ​​derived from the transformed subseed vector widths (i.e., values ​​expressed as a power series of 2).

[0200] If the reference sample for determining the affine sub-block does not belong to the affine neighboring block, the affine seed vector of the affine neighboring block may be derived based on a sample adjacent to the reference sample among the multiple samples included in the affine neighboring block. Specifically, the translational motion vector of a sub-block including a sample adjacent to the reference sample in the affine neighboring block (hereinafter referred to as an adjacent reference sample) may be set as the affine seed vector of the affine neighboring block. As described above, the method of deriving an affine seed vector using an adjacent reference sample may be defined as a method of deriving a modified affine merge vector.

[0201] FIG. 17 is a diagram showing an application example of the modified affine merge vector derivation method.

[0202] The lower right reference sample (x n5 ,y n5 ) does not belong to the affine neighboring block, the sample (x n5 -1,y n5 ) may be used to derive an affine seed vector. Specifically, the neighboring reference samples (x n5 -1,y n5 ) may be set as the affine seed vector of the bottom-right control point.

[0203] 17, the sample adjacent to the right of the upper right sample of the lower right sub-block is designated as the lower right reference sample. When the sample adjacent to the right of the lower right sample of the lower right sub-block or the sample adjacent to the right of the right middle sample of the lower right sub-block is set as the lower right reference sample, an affine seed vector may be derived based on the sample adjacent to the left of the adjacent reference sample.

[0204] Also, if the bottom-left reference sample does not belong to an affine neighboring block, the affine seed vector may be derived based on the neighboring sample to the right of the bottom-left reference sample according to the described embodiment.

[0205] By setting the positions of the reference samples and the sub-blocks for deriving the affine seed vectors in different ways, the sub-seed vector width may be set as a power series of two.

[0206] Alternatively, if the motion vectors of the bottom-left and bottom-right sub-blocks are available, multiple affine seed vectors may be derived based on the widths of the neighboring blocks.

[0207] FIG. 18 is a diagram showing an example of deriving an affine seed vector of an affine merge candidate based on a plurality of motion vectors of a plurality of sub-blocks belonging to adjacent blocks.

[0208] If the upper boundary of the current block touches the boundary of a coding tree unit, the affine seed vector of the affine merge candidate may be derived based on the motion vectors of the lower-left and lower-right sub-blocks of the upper neighboring block located above the current block. Assuming that the position of the upper-left sample of the upper neighboring block is (xNb, yNb) and the width and height of the upper neighboring block are NbW and NbH, respectively, the lower-left sub-block may include a sample at the position (xNb, yNb+yNbH-1), and the lower-right sub-block may include a sample at the position (xNb+NbW-1, yNb+NbH-1).

[0209] The affine seed vectors of the affine merge candidate may be derived based on the width of the adjacent block and the coordinate difference between the adjacent block and the current block. For example, the affine seed vectors of the affine merge candidate may be derived based on the following equations 11 to 13.

[0210] Equation 11

number

[0211] Equation 12

number

[0212] Equation 13

number

[0213] In the above equations 11 to 13, (v 0x ,v 0y ) denotes the first affine seed vector, and (v 1x ,v 1y ) denotes the second affine seed vector, and (v 2x ,v 2y ) indicates the third affine seed vector. Vlbx indicates the horizontal component motion vector of the lower left sub-block, and Vlby indicates the vertical component motion vector of the lower left sub-block. Vrbx indicates the horizontal component motion vector of the lower right sub-block, and Vrby indicates the vertical component motion vector of the lower right sub-block. NbW indicates the width of the neighboring block, and xCbW and xCbH indicate the width and height of the current block, respectively. xCb indicates the x-coordinate of the top left sample of the current block, and xNb indicates the x-coordinate of the top left sample of the neighboring block.

[0214] Furthermore, affine merge candidates may be generated by combining the affine seed vectors derived from the first neighboring block with the motion vector of the second neighboring block. For example, in the example shown in Figure 18, instead of deriving the third affine seed vector of the affine merge candidate based on the motion vectors of the lower-left sub-block and the lower-right sub-block, the third affine seed vector of the affine merge candidate may be derived based on the motion vector of the sub-block located further to the left of the current block.

[0215] FIG. 19 is a diagram illustrating an example of deriving an affine seed vector of an affine merge candidate based on the motion vectors of multiple sub-blocks located to the left of the current block.

[0216] The affine seed vectors of the affine merge candidate may be derived based on the motion vectors of the lower-left and lower-right sub-blocks of the upper neighboring block located above the current block. Specifically, the first and second affine seed vectors of the affine merge candidate may be derived based on the motion vectors of the lower-left and lower-right sub-blocks. For example, the first and second affine seed vectors of the affine merge candidate may be derived based on Equation 11 and Equation 12.

[0217] The third affine seed vector of the affine merge candidate may be derived based on the motion vector of the neighboring block located to the left of the current block. For example, the motion vector of the neighboring block adjacent to the left of the current block or the neighboring block adjacent to the bottom left corner of the current block may be set as the third affine seed vector. The neighboring block adjacent to the left of the current block may include a sample at the (xCb-1, yCb+CbH-1) position, and the neighboring block adjacent to the bottom left corner of the current block may include a sample at the (xCb-1, yCb+CbH) position. Equation 14 and Equation 15 show an example of setting the motion vector of the neighboring block located to the left of the current block as the third affine seed vector.

[0218] Equation 14

number

[0219] Equation 15

number

[0220] In equation 14, V Leftxdenotes the horizontal motion vector of the neighboring block on the left side of the current block, and V Lefty denotes the vertical motion vector of the neighboring block adjacent to the left of the current block. In Equation 15, V LBx denotes the horizontal motion vector of the neighboring block adjacent to the bottom left corner of the current block, and V LBy denotes the vertical motion vector of the neighboring block adjacent to the lower left corner of the current block.

[0221] Only if the motion vector of the neighboring block adjacent to the left side of the current block is unavailable, the motion vector of the neighboring block adjacent to the bottom left corner of the current block can be used to derive the third affine seed vector.

[0222] Furthermore, the method for deriving the third affine seed vector of different affine merge candidates may be set depending on whether the motion vector of the neighboring block located to the left of the current block is available. For example, if the motion vector of the neighboring block located to the left of the current block (e.g., the sub-block adjacent to the left of the current block or the sub-block adjacent to the bottom left corner of the current block) is available, the third affine seed vector may be derived using Equation 14 or Equation 15. On the other hand, if the motion vector of the neighboring block located to the left of the current block is unavailable, the third affine seed vector may be derived using Equation 13.

[0223] Furthermore, a third affine seed vector may be derived based on the motion vector of a non-adjacent block in the reference sample that is not adjacent to the current block. To derive the third affine seed vector, it may be determined whether to use the motion vector of the adjacent block in the reference sample that is adjacent to the current block or the motion vector of the non-adjacent block in the reference sample that is not adjacent to the current block, based on the position of the upper adjacent block used in deriving the affine merge candidate.

[0224] FIG. 20 is a diagram illustrating an example of deriving an affine seed vector of an affine merge candidate based on motion information of a non-adjacent block or an adjacent block located to the left of the current block.

[0225] The position of the block for deriving the third affine seed vector may be determined by comparing the position of the top left sample of the upper neighboring block for deriving an affine merge candidate with the position of the top left sample of the current block. For example, in the example shown in part (a) of Figure 20, if the x-coordinate (xNb) of the top left sample of the upper neighboring block is smaller than the x-coordinate (xCb) of the top left sample of the current block, the third affine seed vector may be derived based on the motion vector of a non-neighboring block that is not adjacent to the left of the current block. Specifically, the third affine seed vector may be derived based on the motion vector of the left non-neighboring block including the sample (xNb, yCb+CbH-1) having the same x-coordinate as the top left sample of the upper neighboring block or the motion vector of the bottom left non-neighboring block including a sample at the (xNb, yCb+CbH) position. Equation 16 and Equation 17 show examples of deriving the third affine seed vector based on the motion vectors of non-neighboring blocks.

[0226] Equation 16

number

[0227] Equation 17

number

[0228] In Equation 16, V Left2x denotes the horizontal motion vector of the left non-adjacent block, and V Left2y denotes the vertical motion vector of the left non-adjacent block. In Equation 17, V LB2x denotes the horizontal motion vector of the bottom-left non-adjacent block, and V LB2y denotes the vertical motion vector of the bottom-left non-adjacent block.

[0229] Only if the motion vector of the left non-adjacent block is unavailable can the motion vector of the bottom-left non-adjacent block be used to derive the third affine seed vector.

[0230] In the example shown in part (b) of Figure 20, if the x-coordinate (xNb) of the upper-left sample of the upper-neighboring block is the same as the x-coordinate (xCb) of the upper-left sample of the current block, or if the x-coordinate (xNb) of the upper-left sample of the upper-neighboring block is greater than the x-coordinate (xCb) of the upper-left sample of the current block, the third affine seed vector may be derived based on the motion vector of the neighboring block adjacent to the left or bottom-left corner of the current block. Specifically, the third affine seed vector may be derived based on the motion vector of the left-neighboring block including the sample (xCb, yCb+CbH-1) adjacent to the left of the current block, or the motion vector of the bottom-left neighboring block including the sample (xCb, yCb+CbH) adjacent to the bottom-left corner of the current block.

[0231] Furthermore, the positions of the reference samples of the left adjacent block or the left non-adjacent block may be set in a manner different from that shown in Figures 18 to 20. For example, a block including a sample (xCb-1, yCb+subH-1) adjacent to the current block may be set as the left adjacent block, or a block including a sample (xNb, yCb+subH-1) not adjacent to the current block may be set as the left non-adjacent block. subH indicates the minimum height of the block storing motion information and may be an integer such as 2, 4, or 8.

[0232] FIG. 21 is a diagram showing the positions of blocks for deriving affine seed vectors of affine merge candidates.

[0233] For example, in the example shown in part (a) of Figure 21, if the x-coordinate (xNb) of the top-left sample of the upper neighboring block is smaller than the x-coordinate (xCb) of the top-left sample of the current block, the third affine seed vector may be derived based on the motion vector of a non-neighboring block that is not adjacent to the left of the current block. Specifically, the third affine seed vector may be derived based on the motion vector of a left non-neighboring block that includes a sample (xNb, yCb+subH-1) that has the same x-coordinate as the top-left sample of the upper neighboring block and is a predetermined distance (e.g., subH) away from the bottom-left sample of the upper neighboring block. Equation 18 shows an example of deriving the third affine seed vector based on the motion vector of a non-neighboring block.

[0234] Equation 18

number

[0235] In equation 18, V LeftT2x denotes the horizontal motion vector of the left non-adjacent block containing a sample that is a predetermined distance away from the bottom-left sample of the upper adjacent block. LeftT2y denotes the vertical motion vector of the left non-adjacent block containing a sample that is a predetermined distance away from the bottom left sample of the upper adjacent block.

[0236] Alternatively, in the example shown in part (b) of Figure 21, if the x-coordinate (xNb) of the upper-left sample of the upper-neighboring block is the same as or greater than the x-coordinate (xCb) of the upper-left sample of the current block, the third affine seed vector may be derived based on the motion vector of the left-neighboring block that is adjacent to the left of the current block and includes a sample (xCb-1, yCb+subH-1) that is a predetermined distance (e.g., subH-1) away from the upper-left sample of the current block along the vertical direction. Equation 19 shows an example of deriving the third affine seed vector based on the motion vector of the neighboring block.

[0237] Equation 19

number

[0238] In equation 19, V LeftTx V denotes the horizontal motion vector of the left neighboring block, which is adjacent to the left of the current block and includes a sample that is a predetermined distance away from the top-left sample of the current block along the vertical direction. LeftTy denotes the vertical motion vector of the left neighboring block that is adjacent to the left of the current block and includes a sample that is a predetermined distance away from the top left sample of the current block along the vertical direction.

[0239] Alternatively, the reference sample may be set at a position different from that shown in Figures 18 to 21. For example, a sample (xCb-1, yCb) adjacent to the left side of the current block and having the same y coordinate as the top-left sample of the current block, or a sample (xNb, yCb) not adjacent to the left side of the current block and having the same y coordinate as the top-left sample of the current block may be set as the reference sample.

[0240] In the illustrated example, the first and second affine seed vectors of the affine merge candidate may be derived from the neighboring block located above the current block, the third affine seed vector of the affine merge candidate may be derived from the neighboring block located to the left of the current block, the first and third affine seed vectors of the affine merge candidate may be derived from the neighboring block located to the left of the current block, and the second affine seed vector of the affine merge candidate may be derived from the neighboring block located above the current block.

[0241] In the example shown in Equation 11 to Equation 13, the motion vector V of the lower left sub-block of the upper adjacent block is LB and the motion vector V of the lower right sub-block RBThe affine seed vector of the affine merge candidate may be derived based on the difference between the motion vector of the lower-left sub-block V and the motion vector of the lower-right sub-block V. In such a case, the affine seed vector of the affine merge candidate may be derived using the motion vector of another block instead of the motion vector of the lower-left sub-block V or the motion vector of the lower-right sub-block V. For example, if the motion vector V of the lower-left sub-block V of the upper neighboring block is LB and the motion vector V of the lower right sub-block RB If the values ​​of are the same, the motion vector of the block of samples located to the right or below the bottom right sub-block is V RB For example, the motion vector V of the bottom right sub-block may be RB Alternatively, the motion vector of the block containing the sample at the (xNb+NbW, yNb+NbH-1) position may be used to derive the motion vector of the affine merge candidate.

[0242] Alternatively, the motion vector V of the lower left sub-block of the upper neighboring block LB and the motion vector V of the lower right sub-block RB If the values ​​of are the same, the motion vector of the block containing the sample located to the left or below the bottom-left sub-block is V LB For example, the motion vector V of the bottom left sub-block may be LB Alternatively, the motion vector of the block containing the sample at the (xNb, yNb+NbH-1+offset) position may be used to derive the motion vector of the affine merge candidate. The offset amount may be an integer equal to or greater than 1.

[0243] Alternatively, the VRB may be replaced with a motion vector of a block containing samples located to the left or below the bottom-left sub-block, or the VLB may be replaced with a motion vector of a block containing samples located to the right or below the bottom-right sub-block.

[0244] Furthermore, a merge candidate may be derived by combining multiple motion vectors of multiple neighboring blocks adjacent to the current block. A merge candidate formed by combining multiple motion vectors of multiple neighboring blocks may be referred to as a combined merge candidate. When deriving a combined merge candidate, an affine seed vector of the control point may be derived from one of the multiple neighboring blocks adjacent to the control point.

[0245] FIG. 22 is a diagram illustrating an example of deriving combined merge candidates by combining a plurality of motion vectors of a plurality of adjacent blocks.

[0246] The neighboring blocks may include an upper neighboring block located above the current block and a left neighboring block located to the left of the current block. The upper neighboring block may be at least one of block B0 including a sample at the (xCb+CbW, yCb-1) position, block B1 including a sample at the (xCb+CbW-1, yCb-1) position, block B2 including a sample at the (xCb-1, yCb-1) position, or block B3 including a sample at the (xCb, yCb-1) position. (xCb, yCb) indicates the position of the top-left sample of the current block, and CbW indicates the width of the current block. The left neighboring block may be at least one of block A0 including a sample at the (xCb-1, yCb+CbH) position, block A1 including a sample at the (xCb-1, yCb+CbH-1) position, or block A2 including a sample at the (xCb-1, yCb) position. CbH indicates the height of the current block.

[0247] Additionally, the neighboring blocks may further include time neighboring blocks of the current block.

[0248] The motion information of two or more adjacent blocks may be combined to derive a combined merge candidate. The motion information of two or three adjacent blocks may be combined to derive a combined merge candidate. Specifically, the combined merge candidate may be further derived by combining two or more of the motion information of the adjacent block adjacent to the first control point, the motion information of the adjacent block adjacent to the second control point, or the motion information of the adjacent block adjacent to the third control point.

[0249] For example, the motion vectors of two or more adjacent blocks among the adjacent blocks A2, B2, or B3 adjacent to the top-left control point CP0, the adjacent blocks B1 or B0 adjacent to the top-right control point CP1, or the temporal adjacent block T associated with the bottom-left control point CP2 may be combined to derive a combined merge candidate.

[0250] In such a case, when scanning multiple neighboring blocks adjacent to a control point according to a predefined scanning order, the motion vector of the first available neighboring block may be set as the affine seed vector of the control point. For example, the first affine seed vector of the combined merge candidate associated with CP0 may be set as the motion vector of the first available neighboring block when searching multiple neighboring blocks according to the order B2, B3, and A2. The second affine seed vector of the combined merge candidate associated with CP1 may be set as the motion vector of the first available neighboring block when searching multiple neighboring blocks according to the order B1 and B0. The third affine seed vector of the combined merge candidate associated with CP2 may be set as the motion vector of the first available neighboring block when searching multiple neighboring blocks according to the order A1 and A0.

[0251] When deriving combined merge candidates, neighboring blocks coded with an affine motion model or neighboring blocks derived by affine merge candidates may be set to be unusable.

[0252] FIG. 23 shows that adjacent blocks cannot be used.

[0253] When deriving an affine merge candidate from a neighboring block B1 located above the current block, it may be determined that the neighboring block B1 cannot be used to derive a combined merge candidate, and therefore, the motion vector of B1 may not be used when deriving an affine seed vector for a combined merge candidate associated with CP1.

[0254] Alternatively, when encoding a neighboring block using an affine motion model, the combined merge candidates may be derived based on the affine vectors of the sub-blocks containing the reference samples. For example, when encoding a neighboring block containing a sample at the B1 position using an affine motion model, the combined merge candidates may be derived using the affine vectors of the sub-blocks containing the sample at the B1 position of the neighboring block.

[0255] Alternatively, the scanning order may be determined based on whether the neighboring block is coded using an affine motion model or whether the neighboring block is derived using an affine merge candidate. For example, the scanning order of the neighboring block coded using an affine motion model or the neighboring block derived using an affine merge candidate may be set to last. For example, when coding the neighboring block at the B1 position using an affine motion model, the second affine seed vector of the combined merge candidate associated with CP2 may be derived by searching multiple neighboring blocks according to the order of B0 and B1.

[0256] If the reference picture indexes of multiple neighboring blocks are different, the motion vector may be scaled based on the reference picture with the smallest index or the reference picture with the largest index, or the scaling may be performed based on the picture order count (POC) difference between the reference picture and the current picture.

[0257] Alternatively, the combination of multiple neighboring blocks may be performed using only neighboring blocks with the same reference picture index among the multiple neighboring blocks. For example, if at least one reference picture index among the multiple neighboring blocks is different, the combination may be set to be unavailable as a combination merge candidate. Furthermore, the availability of the combination may be determined regardless of whether the motion information or motion vectors of the neighboring blocks are the same. For example, if the motion vectors (e.g., the CP0 affine seed vector and the CP1 affine seed vector) of multiple neighboring blocks are the same, the multiple neighboring blocks with the same reference picture index may be combined to derive a combination merge candidate. Alternatively, the scanning order of the multiple neighboring blocks may be determined taking into account the reference picture indexes of the multiple neighboring blocks. Alternatively, the combination may be performed using only neighboring blocks with the same prediction direction among the multiple neighboring blocks.

[0258] Merge candidates may be generated according to a set combination order. For example, the combination order may be set as follows: 1. {CP0 affine seed vector, CP1 affine seed vector, CP2 affine seed vector} 2. {CP0 affine seed vector, CP1 affine seed vector, CP3 affine seed vector} 3. {CP0 affine seed vector, CP2 affine seed vector, CP3 affine seed vector} 4. {CP1 affine seed vector, CP2 affine seed vector, CP3 affine seed vector} 5. {CP0 affine seed vector, CP1 affine seed vector} 6. {CP0 affine seed vector, CP2 affine seed vector}.

[0259] Although six example combinations are shown, fewer or more example combinations may be used.

[0260] A combined merge candidate generated by combining three affine seed vectors may be referred to as a six-parameter set merge candidate, and a combined merge candidate generated by combining two affine seed vectors may be referred to as a four-parameter set merge candidate.

[0261] The combination order may be predefined in the encoder and decoder. Alternatively, the combination order may be determined based on at least one of the size, shape, partition type, affine motion model, position of the current block in a coding tree unit, or output order of reference pictures of the current block. For example, when a four-parameter affine motion model is applied to the current block, the combination examples used for four-parameter set merging candidates may be set to have higher priority than the combination examples used for six-parameter set merging candidates.

[0262] Although combined merge candidates may be generated according to the combination order, it may be determined that only merge candidates generated by combining multiple neighboring blocks with the same reference picture may be used. Alternatively, if at least one reference picture among the multiple neighboring blocks is different, merge candidates may be derived by scaling motion vectors based on the reference picture with the largest index or the reference picture with the smallest index. The scaling may be performed according to the difference in output order between the current picture and the reference pictures. Alternatively, if two reference pictures among the multiple neighboring blocks are the same but other reference pictures are different, combined merge candidates may be derived by scaling motion vectors of the other neighboring blocks based on the reference picture jointly applied to the two neighboring blocks.

[0263] The number of combined merge candidates added to the merge candidate list may be determined based on at least one of the number of merge candidates included in the merge candidate list or the maximum number of merge candidates. Alternatively, only six parameter set merge candidates may be added to the merge candidate list, or only four parameter set merge candidates may be added to the combined merge candidate list based on the affine motion model of the current block.

[0264] For example, if the number of combined merge candidates to be added to the merge candidate list is one and a six-parameter motion model is applied to the current block, one six-parameter set merge candidate may be added to the merge candidate list based on the set combination order. Specifically, if the CP0 affine seed vector, CP1 affine seed vector, and CP2 affine seed vector are all available, the combined merge candidate {CP0 affine seed vector, CP1 affine seed vector, CP2 affine seed vector} may be added to the merge candidate list. Alternatively, if the CP2 affine seed vector is unavailable and the CP3 affine seed vector is available, the combined merge candidate {CP0 affine seed vector, CP1 affine seed vector, CP3 affine seed vector} may be added to the merge candidate list.

[0265] Alternatively, if the number of combination merge candidates to be added to the merge candidate list is one and a six-parameter motion model is applied to the current block, one four-parameter set merge candidate based on the set combination order may be added to the merge candidate list.

[0266] As another example, the number of combination merge candidates to be added to the merge candidate list may be set to vary depending on the affine motion model of the current block. For example, if a six-parameter motion model is applied to the current block, one combination merge candidate may be added to the merge candidate list. On the other hand, if a four-parameter motion model is applied to the current block, two combination merge candidates may be added to the merge candidate list.

[0267] The combination merge candidates to be added to the merge candidate list may be selected based on the number of available affine merge candidates. For example, if the number of available affine merge candidates is two or more, only four-parameter set merge candidates may be added to the merge candidate list. On the other hand, if the number of available affine merge candidates is one or less, only six-parameter set merge candidates may be added to the merge candidate list. Alternatively, if the number of available affine merge candidates is one or less, N six-parameter set merge candidates and M four-parameter set merge candidates may be added to the merge candidate list. N and M may be integers, and M may be derived based on the maximum number of merge candidates minus N. Alternatively, if the number of available affine merge candidates is one or less, only four-parameter set merge candidates may be added to the merge candidate list.

[0268] Alternatively, the combination order may be determined based on the availability of multiple affine seed vectors. For example, taking into consideration the availability of multiple affine seed vectors, 1. When CP0 affine seed vector, CP1 affine seed vector, and CP2 affine seed vector are available {CP0 affine seed vector, CP1 affine seed vector, CP2 affine seed vector} 2. When CP0 affine seed vector, CP1 affine seed vector, and CP3 affine seed vector are available {CP0 affine seed vector, CP1 affine seed vector, CP3 affine seed vector} 3. When CP0 affine seed vector, CP2 affine seed vector, and CP3 affine seed vector are available {CP0 affine seed vector, CP2 affine seed vector, CP3 affine seed vector} 4. When CP0 affine seed vector, CP2 affine seed vector, and CP3 affine seed vector are available {CP1 affine seed vector, CP2 affine seed vector, CP3 affine seed vector} 5. When CP0 affine seed vector and CP1 affine seed vector are available {CP0 affine seed vector, CP1 affine seed vector} 6. When the CP0 affine seed vector and the CP2 affine seed vector are available, the combined merge candidates may be added to the merge candidate list in the order {CP0 affine seed vector, CP2 affine seed vector}.

[0269] If the number of combination merge candidates that can be added to the merge candidate list is one, the combination merge candidate that satisfies the first of the conditions 1 to 6 may be added to the merge candidate list. If the conditions 1 to 6 are not satisfied, the combination merge candidate may not be added to the merge candidate list.

[0270] As another example, the maximum number of combined merge candidates that can be added to the merge candidate list may be determined further based on the number of available affine merge candidates.

[0271] If the number of merge candidates included in the merge candidate list is less than the maximum number, a zero merge candidate with a motion vector of 0 may be added to the merge candidate list. Thus, in the affine merge mode, merge candidates may be derived in the following order: 1. Derive affine merge candidates, 2. Combined merge candidates, 3. Zero merge candidates.

[0272] Next, the inter prediction method using translational motion information will be described in detail.

[0273] The motion information of the current block may be derived from the motion information of another block of the current block. The other block may be a block that was coded / decoded using inter prediction before the current block. When the motion information of the current block is set to be the same as the motion information of another block, this may be defined as a merge mode. Also, when the motion vector of another block is set as a predicted value of the motion vector of the current block, this may be defined as a motion vector prediction mode.

[0274] FIG. 24 is a flowchart of a process for deriving motion information of a current block in merge mode.

[0275] Merge candidates for the current block may be derived (S2401). The merge candidates for the current block may be derived from blocks that have been coded / decoded using inter prediction before the current block.

[0276] The candidate blocks used to derive merge candidates may include neighboring blocks, i.e., samples neighboring the current block. For example, if the coordinates of the top-left sample of the current block are (0,0), at least one of the block containing the reference sample on the (-1,H-1) position, the block containing the reference sample on the (W-1,-1) position, the block containing the reference sample on the (W,-1) position, the block containing the reference sample on the (-1,H) position, or the block containing the reference sample on the (-1,-1) position may be used as the candidate block.

[0277] Alternatively, candidate blocks that do not belong to the same coding tree unit as the current block may be set as ineligible for use as merge candidates. For example, if a reference sample exceeds the upper boundary of the coding tree unit to which the current block belongs, the candidate block containing the reference sample may be set as ineligible for use as a merge candidate.

[0278] Further, merging candidates may be derived from temporally adjacent blocks included in a picture different from the current block. For example, merging candidates may be derived from a collocated block included in a collocated picture. Any one of multiple reference pictures included in the reference picture list may be set as the collocated picture. Index information indicating the collocated picture among the multiple reference pictures may be transmitted by a signal via the bitstream. Alternatively, a reference picture having a predefined index among the multiple reference pictures may be determined as the collocated picture.

[0279] 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 picture index, prediction direction, or bidirectional weighting index of the candidate block may be set as the motion information of the merge candidate.

[0280] A merge candidate list including the merge candidates may be generated (S2402).

[0281] The indices of the multiple merge candidates in the merge candidate list may be assigned according to a predetermined order, for example, the order of merge candidates derived from the left neighboring block, merge candidates derived from the above neighboring block, merge candidates derived from the above-right neighboring block, merge candidates derived from the below-left neighboring block, merge candidates derived from the above-left neighboring block, and merge candidates derived from the temporal neighboring blocks.

[0282] If the merge candidate list includes multiple merge candidates, at least one of the multiple merge candidates may be selected (S2403). Specifically, information for specifying one of the multiple merge candidates specified by a signal may be transmitted via the bitstream. For example, index information merge_idx indicating one of the multiple merge candidates included in the merge candidate list may be transmitted via the bitstream.

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

[0284] The inter motion information list includes merge candidates derived from blocks coded / decoded by inter prediction in the current picture. For example, the motion information of the merge candidates included in the inter motion information list may be set to be the same as the motion information of the blocks coded / decoded by inter prediction. The motion information may include at least one of a motion vector, a reference picture index, a prediction direction, or a bidirectional weighting value index.

[0285] For convenience of explanation, merge candidates included in the inter motion information list will be referred to as inter merge candidates.

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

[0287] Alternatively, information indicating the maximum number of merge candidates in the inter motion information list may be signaled via the bitstream, at the sequence level, the picture level, or the slice level.

[0288] Alternatively, the maximum number of merge candidates in the inter motion information list may be determined based on the size of the picture, the size of the slice, or the size of the coding tree unit.

[0289] The inter-motion information list may be initialized in units of pictures, slices, segments, blocks, coding tree units, or coding tree unit rows (rows or columns). For example, when a slice is initialized, the inter-motion information list is also initialized, and the inter-motion information list may not include any merge candidates.

[0290] Alternatively, information indicating whether to initialize the inter-motion information list may be further transmitted by a signal via the bitstream. The information may be transmitted by a signal at the slice level, segment level, block level, or block level. Before the information indicates that the inter-motion information list is to be initialized, the set inter-motion information list may be used.

[0291] Alternatively, information related to inter merge candidates may be signaled via a picture parameter set or slice header. When a slice is initialized, the inter motion information list may also include initial inter merge candidates. Therefore, the inter merge candidates may be used for the first coded / decoded blocks in the slice.

[0292] Blocks may be coded / decoded in accordance with the coding / decoding order, and multiple blocks coded / decoded by inter prediction in accordance with the coding / decoding order may be set as inter merge candidates in order.

[0293] FIG. 25 is a diagram for explaining an example of updating the inter-exercise information list.

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

[0295] If the inter-motion information list is empty (S2503), an inter-merge candidate derived based on the current block may be added to the inter-motion information list (S2504).

[0296] If the inter-motion information list includes the inter-merge candidate (S2503), a redundancy check may be performed on the motion information of the current block (or the inter-merge candidate derived based on the current block) (S2505). The redundancy check is used to determine whether the motion information of the inter-merge candidate stored in the inter-motion information list is the same as the motion information of the current block. The redundancy check may be performed with all inter-merge candidates stored in the inter-motion information list as objects. Alternatively, the redundancy check may be performed with inter-merge candidates whose indexes are greater than or less than a threshold value among the inter-merge candidates stored in the inter-motion information list as objects.

[0297] If no inter-merge candidate has the same motion information as the current block, the inter-merge candidate derived based on the current block may be added to the inter-motion information list (S2508). Whether the inter-merge candidates are the same may be determined based on whether their motion information (e.g., motion vectors and / or reference picture indexes) is the same.

[0298] In this case, if the maximum number of inter-merge candidates is stored in the inter-motion information list (S2506), the first inter-merge candidate may be deleted (S2507), and an inter-merge candidate derived based on the current block may be added to the inter-motion information list (S2508).

[0299] Multiple inter merge candidates may be identified based on each index. When an inter merge candidate derived from the current block is added to the inter motion information list, the smallest index (e.g., 0) may be assigned to the inter merge candidate, and the index of each stored inter merge candidate may be incremented by 1. In this case, if the maximum number of inter merge candidates is stored in the inter motion information list, the inter merge candidate with the largest index is removed.

[0300] Alternatively, when an inter merge candidate derived from the current block is added to the inter motion information list, the largest index may be assigned to the inter merge candidate. For example, if the number of inter merge candidates stored in the inter motion information list is less than the maximum value, the inter merge candidate may be assigned an index whose value is equal to the number of stored inter merge candidates. Alternatively, if the number of inter merge candidates stored in the inter motion information list is equal to the maximum value, the inter merge candidate may be assigned an index whose value is the maximum value minus 1. Furthermore, the inter merge candidate with the smallest index is removed, and 1 is subtracted from each of the indexes of the remaining stored inter merge candidates.

[0301] FIG. 26 shows an example of updating the inter-merge candidate list.

[0302] Assume that an intermerge candidate derived from the current block is added to the intermerge candidate list and assigned the maximum index, and that the maximum number of intermerge candidates is stored in the intermerge candidate list.

[0303] When adding an intermerge candidate HmvpCand[n+1] derived from the current block to the intermerge candidate list HmvpCandList, the intermerge candidate HmvpCand[0] with the smallest index is deleted from the stored intermerge candidates, and the index of each of the remaining intermerge candidates is subtracted by 1. Alternatively, the index of the intermerge candidate HmvpCand[n+1] derived from the current block may be set to the maximum value (n in the example shown in FIG. 26).

[0304] If an intermerge candidate that is the same as the intermerge candidate derived based on the current block is stored (S2505), the intermerge candidate derived based on the current block may not be added to the inter motion information list (S2509).

[0305] Alternatively, as an inter merge candidate derived based on the current block is added to the inter motion information list, stored inter merge candidates that are the same as the inter merge candidate may be removed, resulting in the index of the stored inter merge candidate being updated.

[0306] FIG. 27 is a diagram showing an example in which the indices of pre-stored inter-merge candidates are updated.

[0307] If the index of a stored inter-merge candidate that is the same as the inter-merge candidate mvCand derived based on the current block is hIdx, the stored inter-merge candidate may be deleted, and 1 may be subtracted from each of the indexes of inter-merge candidates whose index is greater than hIdx. For example, the example shown in Figure 27 shows that HmvpCand[2], which is the same as mvCand, is deleted from the inter-motion information list HvmpCandList, and 1 is subtracted from each of the indexes of HmvpCand[3] to HmvpCand[n].

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

[0309] Alternatively, the index assigned to a stored inter merge candidate that is the same as the inter merge candidate derived based on the current block may be updated, for example, the index of the stored inter merge candidate may be changed to the minimum or maximum value.

[0310] The motion information of blocks included in a specified region may be set so that it cannot be added to the inter motion information list. For example, inter merge candidates derived based on the motion information of blocks included in the merge processing region cannot be added to the inter motion information list. Because the encoding / decoding order of the blocks included in the merge processing region is not defined, it is inappropriate to use the motion information of any one of these blocks for inter prediction of other blocks. Therefore, inter merge candidates derived based on blocks included in the merge processing region do not need to be added to the inter motion information list.

[0311] When motion compensated prediction is performed based on sub-blocks, inter-merge candidates may be derived based on motion information of a representative sub-block among a plurality of sub-blocks included in the current block. For example, when sub-block merging candidates are used for the current block, inter-merge candidates may be derived based on motion information of a representative sub-block among the sub-blocks.

[0312] The motion vector of a sub-block may be derived in the following order: First, one of the merging candidates included in the merging candidate list of the current block may be selected, and an initial shift vector (shVector) may be derived based on the motion vector of the selected merging candidate. Alternatively, a shift sub-block at the reference sample position (xColSb, yColSb) may be derived by adding the initial shift vector to the position (xSb, ySb) of the reference sample (e.g., the upper-left sample or the middle sample) of each sub-block of the coding block. The following equation 20 shows an equation for deriving the shift sub-block.

[0313] Equation 20

number

[0314] Next, the motion vector of the collocated block corresponding to the center position of the sub-block containing (xColSb, yColSb) is set as the motion vector of the sub-block containing (xSb, ySb).

[0315] The representative sub-block may refer to the sub-block that includes the top-left sample or the center sample of the current block.

[0316] FIG. 28 shows the locations of representative sub-blocks.

[0317] 28(a) shows an example in which a sub-block located at the top left of a current block is set as a representative sub-block, and FIG. 28(b) shows an example in which a sub-block located at the center of the current block is set as a representative sub-block. When motion compensated prediction is performed in units of sub-blocks, inter-merge candidates for the current block may be derived based on the motion vector of a sub-block including an upper left sample of the current block or a sub-block including a center sample of the current block.

[0318] Furthermore, whether to use the current block as an inter-merge candidate may be determined based on the inter-prediction mode of the current block. For example, a block encoded / decoded based on an affine motion model may be set to be unavailable as an inter-merge candidate. Therefore, even if the current block is encoded / decoded using inter prediction, if the inter-prediction mode of the current block is an affine prediction mode, the inter-prediction motion information list is not updated based on the current block.

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

[0320] Alternatively, the inter-merge candidate may be derived based on the average value of the affine seed vectors of the blocks further 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, and the third affine seed vector of the current block may be set as the motion vector of the inter-merge candidate.

[0321] Alternatively, the inter motion information list may be set for different inter prediction modes. For example, at least one of the inter motion information list of a block to be coded / decoded by intra block copying, the inter motion information list of a block to be coded / decoded based on a translational motion model, or the inter motion information list of a block to be coded / decoded based on an affine motion model may be defined. Any one of the multiple inter motion information lists may be selected based on the inter prediction mode of the current block.

[0322] FIG. 29 shows an example of generating inter motion information lists for different inter prediction modes.

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

[0324] The affine seed vector of the block may be stored in an inter-merge candidate derived from the coded / decoded block based on the affine motion model, and the inter-merge candidate may then be used as a merge candidate to derive the affine seed vector of the current block.

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

[0326] If both the first inter-motion information list and the second inter-motion information list are empty, inter-merge candidates may be added to the second inter-motion information list first. After the number of available inter-merge candidates in the second inter-motion information list reaches the maximum number, inter-merge candidates can be added to the first inter-motion information list.

[0327] Alternatively, one more inter merge candidate may be added to both the second inter motion information list and the first inter motion information list.

[0328] In such a case, the set second inter motion information list may not be updated again. Alternatively, the second inter motion information list may be updated when the decoding area is equal to or larger than a predetermined ratio of the slice. Alternatively, the second inter motion information list may be updated every N coding tree unit rows.

[0329] On the other hand, the first inter motion information list may be updated every time a block coded / decoded by inter prediction occurs. However, the inter merge candidates added to the second inter motion information list may be set not to be used in updating the first inter motion information list.

[0330] Information for selecting either the first inter-motion information list or the second inter-motion information list may be transmitted by a signal via a bitstream, and if the number of merge candidates included in the merge candidate list is less than a threshold, the merge candidates included in the inter-motion information list indicated by the information may be added to the merge candidate list.

[0331] Alternatively, the inter motion information list may be selected further depending on the size, shape, and inter prediction mode of the current block, whether bidirectional prediction is performed, whether the motion vector is subdivided, or whether triangulation is performed.

[0332] Alternatively, if the number of merge candidates included in the merge candidate list is less than the maximum number of merges even after adding the merge candidates included in the first merge candidate information list, the merge candidate included in the second merge candidate information list may be added to the merge candidate list.

[0333] FIG. 30 is a diagram showing an example of adding an inter-merge candidate included in the long-term exercise information list to the merge candidate list.

[0334] If the number of merge candidates included in the merge candidate list is less than the maximum number, the inter-merge candidates included in the first inter-motion information list HmvpCandList may be added to the merge candidate list.If the inter-merge candidates included in the first inter-motion information list are added to the merge candidate list, but the number of merge candidates included in the merge candidate list is also less than the maximum number, the inter-merge candidates included in the long-term motion information list HmvpLTCandList may be added to the merge candidate list.

[0335] Table 1 shows the process of adding inter-merge candidates included in the long-term motion information list to the merge candidate list.

[0336] [Table 1]

[0337] The intermerge candidates may be configured to include additional information in addition to the motion information. For example, the size, shape, or block division information of the storage block may be added to the intermerge candidates. When constructing a merge candidate list for the current block, only intermerge candidates whose size, shape, or division information is the same as or similar to the current block may be used, or intermerge candidates whose size, shape, or division information is the same as or similar to the current block may be preferentially added to the merge candidate list.

[0338] Alternatively, inter-motion information lists may be generated for different block sizes, shapes, or partition information. A merge candidate list for the current block may be generated using an inter-motion information list corresponding to the shape, size, or partition information of the current block among the multiple inter-motion information lists.

[0339] If the number of merge candidates included in the merge candidate list of the current block is less than a threshold, inter merge candidates included in the inter motion information list may be added to the merge candidate list. The addition process may be performed in ascending or descending order of index. For example, the inter merge candidate with the highest index may be added to the merge candidate list.

[0340] When an inter merge candidate included in the inter motion information list is to be added to the merge candidate list, a redundancy check may be performed on the inter merge candidate and the multiple merge candidates stored in the merge candidate list.

[0341] For example, Table 2 shows the process of adding inter-merge candidates to the merge candidate list.

[0342] [Table 2]

[0343] Furthermore, the redundancy check may be performed only on some of the inter merge candidates included in the inter motion information list. For example, the redundancy check may be performed only on inter merge candidates whose indexes are greater than or equal to a threshold value. Alternatively, the redundancy check may be performed only on the N merge candidates with the highest indexes or the N merge candidates with the lowest indexes.

[0344] Alternatively, the redundancy check may be performed on only some of the merge candidates stored in the merge candidate list. For example, the redundancy check may be performed on only merge candidates whose index is greater than or equal to a threshold value or less than or equal to a threshold value, or on merge candidates derived from a block at a specific location. The specific location may include at least one of the left neighboring block, the upper neighboring block, the upper right neighboring block, or the lower left neighboring block of the current block.

[0345] FIG. 31 shows an example in which redundancy checks are performed on only some of the merge candidates.

[0346] When adding an inter-merge candidate HmvpCand[j] to the merge candidate list, a redundancy check may be performed on the inter-merge candidate and the two merge candidates with the highest indices, mergeCandList[NumMerge-2] and mergeCandList[NumMerge-1]. NumMerge may indicate the number of available spatial and temporal merge candidates.

[0347] Unlike the illustrated example, when adding an inter-merge candidate HmvpCand[j] to the merge candidate list, a redundancy check may be performed on the inter-merge candidate and the two merge candidates with the smallest index. For example, it may be possible to check whether mergeCandList[0] and mergeCandList[1] are the same as HmvpCand[j]. Alternatively, a redundancy check may be performed only on merge candidates derived from a specific position. For example, a redundancy check may be performed on at least one of merge candidates derived from adjacent blocks located to the left of the current block or merge candidates derived from adjacent blocks located above the current block. If there are no merge candidates derived from a specific position in the merge candidate list, the inter-merge candidate may be added to the merge candidate list without performing a redundancy check.

[0348] If a merge candidate that is the same as the first intermerge candidate is found, the redundancy check for the merge candidate that is the same as the first intermerge candidate may be omitted when performing a redundancy check on a second intermerge candidate.

[0349] FIG. 32 shows an example in which redundancy checks for specific merge candidates are omitted.

[0350] When adding an inter merge candidate HmvpCand[i] with index i to the merge candidate list, a redundancy check may be performed on the inter merge candidate and the merge candidates stored in the merge candidate list. In this case, if a merge candidate mergeCandList[j] identical to the inter merge candidate HmvpCand[i] is found, the inter merge candidate HmvpCand[i] is not added to the merge candidate list, and a redundancy check may be performed on the inter merge candidate HmvpCand[i-1] with index i-1 and the merge candidate. In this case, the redundancy check on the inter merge candidate HmvpCand[i-1] and the merge candidate mergeCandList[j] may be omitted.

[0351] For example, in the example shown in Figure 32, 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 may be performed on HmvpCand[i-1]. In such a case, the redundancy check of HmvpCand[i-1] and mergeCandList[2] may be omitted.

[0352] If the number of merge candidates included in the merge candidate list of the current block is less than a threshold, the list may further include at least one of paired merge candidates or zero merge candidates in addition to inter merge candidates. A paired merge candidate refers to a merge candidate whose motion vector is the average of the motion vectors of two or more merge candidates, and a zero merge candidate refers to a merge candidate whose motion vector is 0.

[0353] The merge candidate list for the current block may be added to merge candidates in the following order: spatial merge candidate - temporal merge candidate - inter merge candidate - (inter affine merge candidate) - paired merge candidate - zero merge candidate.

[0354] The spatial merge candidates refer to merge candidates derived from at least one of adjacent or non-adjacent blocks, the temporal merge candidates refer to merge candidates derived from previous reference pictures, and the inter-affine merge candidate list refers to inter-merge candidates derived from blocks coded / decoded by an affine motion model.

[0355] In the advanced motion vector prediction mode, an inter-motion information list may be used. For example, if the number of motion vector prediction candidates included in the motion vector prediction candidate list for the current block is less than a threshold, an inter-merge candidate included in the inter-motion information list is set as a motion vector prediction candidate related to the current block. Specifically, the motion vector of the inter-merge candidate is set as a motion vector prediction candidate.

[0356] If one of the motion vector prediction candidates included in the motion vector prediction candidate list for the current block is selected, the selected candidate is set as the motion vector prediction value for the current block. Then, after decoding the motion vector residual value for the current block, the motion vector prediction value and the motion vector residual value may be added to obtain the motion vector for the current block.

[0357] The motion vector prediction candidate list for the current block may be constructed in the following order: spatial motion vector prediction candidate - temporal motion vector prediction candidate - inter-decoded region merge candidate - (inter-decoded region affine merge candidate) - zero motion vector prediction candidate.

[0358] The spatial motion vector prediction candidate refers to a motion vector prediction candidate derived from at least one of adjacent blocks or non-adjacent blocks, and the temporal motion vector prediction candidate refers to a motion vector prediction candidate derived from a previous reference picture. The inter-affine merge candidate list indicates inter-motion vector prediction candidates derived from blocks coded / decoded using an affine motion model. The zero motion vector prediction candidate indicates a candidate whose motion vector value is 0.

[0359] A coding block may be divided into a plurality of prediction units, and prediction may be performed for each of the divided prediction units. A prediction unit refers to a basic unit for prediction.

[0360] The coding block may be divided using at least one of vertical lines, horizontal lines, diagonal lines, or diagonal lines. Information for determining at least one of the number, angle, or position of lines dividing the coding block may be transmitted by a signal via the bitstream. For example, information indicating any one of candidate division types of the coding block may be transmitted by a signal via the bitstream, or information specifying any one of multiple line candidates for dividing the coding block may be transmitted by a signal via the bitstream. Alternatively, information for determining the number or type of line candidates for dividing the coding block may be transmitted by a signal via the bitstream. For example, a one-bit flag may be used to determine whether diagonal lines with angles greater than a diagonal and / or diagonal lines with angles smaller than a diagonal can be used as line candidates.

[0361] Alternatively, at least one of the number, angle or position of lines dividing the coding block may be adaptively determined based on at least one of the intra prediction mode, inter prediction mode of the coding block, the position of available merging candidates or the division type of neighboring blocks.

[0362] When a coding block is divided into multiple prediction units, intra prediction or inter prediction may be performed on each of the divided prediction units.

[0363] FIG. 33 is a diagram showing an example of dividing a coding block into a plurality of prediction units using diagonals.

[0364] In the example shown in parts (a) and (b) of Figure 33, a diagonal line may be used to divide the coding block into two triangular prediction units.

[0365] Parts (a) and (b) of Figure 33 show that a coding block is divided into two prediction units using a diagonal line connecting two vertices of the coding block. However, a coding block may also be divided into two prediction units using a diagonal line in which at least one end of the line does not pass through a vertex of the coding block.

[0366] FIG. 34 is a diagram showing an example of dividing a coding block into two prediction units.

[0367] In the example shown in parts (a) and (b) of Figure 34, the coding block may be divided into two prediction units using a diagonal line whose ends touch the upper and lower boundaries of the coding block, respectively.

[0368] Alternatively, in the example shown in parts (c) and (d) of Figure 34, the coding block may be divided into two prediction units using a diagonal line whose ends touch the left and right boundaries of the coding block, respectively.

[0369] Alternatively, a coding block may be divided into two prediction units of different sizes, for example, by setting the diagonal line dividing the coding block to touch two boundary surfaces that form one vertex.

[0370] FIG. 35 is a diagram showing an example of dividing a coding block into a plurality of prediction blocks of different sizes.

[0371] In the examples shown in Figures 35(a) and 35(b), the coding block can be divided into two prediction units of different sizes by setting the diagonal line connecting the upper left or lower right corner of the coding block to pass through the left boundary, right boundary, upper boundary or lower boundary of the coding block without passing through the upper left or lower right corner of the coding block.

[0372] Alternatively, in the examples shown in Figures 35(c) and 35(d), the coding block can be divided into two prediction units of different sizes by setting the diagonal line connecting the upper right or lower left corner of the coding block to pass through the left boundary, right boundary, upper boundary or lower boundary of the coding block without passing through the upper left or lower right corner of the coding block.

[0373] Each prediction unit generated by dividing a coding block is referred to as an "Nth prediction unit." For example, in the examples shown in Figures 33 to 35, PU1 may be defined as the first prediction unit, and PU2 may be defined as the second prediction unit. The first prediction unit may refer to a prediction unit including a lower left sample or an upper left sample in a coding block, and the second prediction unit may refer to a prediction unit including an upper right sample or a lower right sample in a coding block.

[0374] Conversely, a prediction unit including the top right sample or bottom right sample in a coding block may be defined as the first prediction unit, and a prediction unit including the bottom left sample or top left sample in a coding block may be defined as the second prediction unit.

[0375] The following embodiments mainly describe a division example using a diagonal line. In particular, the process of dividing a coding block into two prediction units using a diagonal line is called diagonal division or triangular division, and the prediction unit generated by diagonal division is called a triangular prediction unit. However, of course, the following embodiments may use a division example using a vertical line, a horizontal line, or a diagonal line at an angle different from the diagonal line.

[0376] Whether to apply diagonal splitting to a coding block may be determined based on at least one of the slice type, the maximum number of merge candidates that can be included in the merge candidate list, the size of the coding block, the shape of the coding block, the predictive coding mode of the coding block, or the splitting type of the parent node.

[0377] For example, whether or not to apply diagonal division to a coding block may be determined depending on whether the current slice is of type B. Diagonal division is only allowed if the current slice is of type B.

[0378] Alternatively, whether to apply diagonal splitting to a coding block may be determined depending on whether the maximum number of merge candidates included in the merge candidate list is greater than or equal to 2. Diagonal splitting is only allowed when the maximum number of merge candidates included in the merge candidate list is greater than or equal to 2.

[0379] Alternatively, if at least one of the width or height of the hardware is greater than 64, a 64x64 size data processing unit will be accessed redundantly. Therefore, if at least one of the width or height of the coding block is greater than a threshold, it may not be permitted to divide the coding block into multiple prediction blocks. For example, if at least one of the height and width of the coding block is greater than 64, diagonal division may not be used.

[0380] Alternatively, whether to apply diagonal division to a coding block may be determined based on at least one of whether the number of samples included in the coding block is equal to or less than a first threshold or whether the number of samples included in the coding block is equal to or greater than a second threshold. For example, if the number of samples included in the coding block is equal to or less than the first threshold or if the number of samples included in the coding block is equal to or greater than the second threshold, a setting is made to not apply diagonal division to the coding block. Alternatively, whether to apply diagonal division to a coding block may be determined based on whether the ratio of the width to the height of the coding block is smaller than a first threshold or larger than a second threshold. The width-to-height ratio whRatio of the coding block may be determined as the ratio of the width CbW to the height CbH of the coding block, and is shown in Equation 21 below.

[0381] Equation 21

number

[0382] The second threshold may be the reciprocal of the first threshold, for example, if the first threshold is k, the second threshold may be 1 / k.

[0383] Diagonal division can be applied to a coding block only if the ratio of the width to the height of the coding block is between the first and second thresholds.

[0384] Alternatively, triangular division can be used only if the ratio of width to height of the coding block is less than a first threshold or greater than a second threshold, e.g., if the first threshold is 16, diagonal division may not be allowed for coding blocks of size 64x4 or 4x64.

[0385] Alternatively, whether diagonal splitting is allowed may be determined based on the split type of the parent node. For example, if the coding block as the parent node is split using a quadtree, diagonal splitting can be applied to the coding block as the leaf node. On the other hand, if the coding block as the parent node is split using a binary or ternary tree, diagonal splitting may be set to not be allowed for the coding block as the leaf node.

[0386] Alternatively, whether diagonal division is allowed may be determined based on the predictive coding mode of the coding block. For example, diagonal division may be allowed only when the coding block is coded by intra prediction, when the coding block is coded by inter prediction, or when the coding block is coded in a predefined inter prediction mode. The predefined inter prediction mode may indicate at least one of a merge mode, an advanced motion vector prediction mode, an affine merge mode, or an affine motion vector prediction mode.

[0387] Alternatively, whether diagonal division is allowed may be determined based on the size of the parallel processing region, for example, if the size of the coding block is larger than the size of the parallel processing region, diagonal division may not be used.

[0388] Furthermore, it may be possible to determine whether to apply diagonal division to a coding block by taking into consideration two or more of the above listed conditions.

[0389] Furthermore, information indicating whether diagonal partitioning is allowed may be transmitted by signaling via the bitstream, and the information may be transmitted by signaling at the sequence level, picture level, slice level, or block level. The information indicates that diagonal partitioning is allowed, and diagonal partitioning can be applied to a coding block only if at least one of the listed conditions is satisfied.

[0390] If it is decided to apply diagonal division to the coding block, information indicating the number of lines dividing the coding block or the position of the lines may be transmitted by a signal via the bitstream.

[0391] For example, if a coding block is divided by a diagonal, information indicating the direction of the diagonal along which the coding block is divided may be transmitted by a signal via the bitstream. For example, a flag triangle_partition_type_flag indicating the direction of the diagonal may be transmitted by a signal via the bitstream. The flag indicates whether the coding block is divided by a diagonal connecting the upper left and lower right, or by a diagonal connecting the upper right and lower left. Dividing the coding block by a diagonal connecting the upper left and lower right may be referred to as a left triangular partition type, while dividing the coding block by a diagonal connecting the upper right and lower left may be referred to as a right triangular partition type. For example, a value of 0 for the flag indicates that the division type of the coding block is a left triangular partition type, and a value of 1 for the flag indicates that the division type of the coding block is a right triangular partition type.

[0392] Information indicating the partition type of a coding block may be signaled at the coding block level, and thus the partition type may be determined for different coding blocks that apply diagonal partitioning.

[0393] As another example, information indicating the partition type may be transmitted by a signal for a sequence, a picture, a slice, a segment, or a coding tree unit. In such a case, the partition type of a coding block that uses diagonal partitioning may be set to be the same for the sequence, the picture, the slice, the segment, or the coding tree unit.

[0394] Alternatively, for the first coding unit that applies diagonal partitioning in the coding tree unit, information for determining the partitioning type is coded and transmitted by a signal, and the second and subsequent coding units that apply diagonal partitioning are configured to use the same partitioning type as the first coding unit.

[0395] As another example, the partition type of the coding block may be determined based on the partition type of neighboring blocks. The neighboring blocks may include at least one of the neighboring block adjacent to the upper left corner of the coding block, the neighboring block adjacent to the upper right corner, the neighboring block adjacent to the lower left corner, the neighboring block located above, or the neighboring block located to the left. For example, the partition type of the current block may be set to be the same as the partition type of the neighboring block. Alternatively, the partition type of the current block may be determined depending on whether the upper left neighboring block applies a left triangulation type and whether the upper right neighboring block or the lower left neighboring block applies a right triangulation type.

[0396] To perform motion prediction compensation on the first triangular prediction unit and the second triangular prediction unit, motion information for each of the first triangular prediction unit and the second triangular prediction unit may be derived. In this case, the motion information for the first triangular prediction unit and the second triangular prediction unit may be derived from merge candidates included in a merge candidate list. To distinguish between a general merge candidate list and a merge candidate list used to derive motion information for a triangular prediction unit, a merge candidate list for deriving motion information for a triangular prediction unit is referred to as a triangle merge candidate list, and merge candidates included in the triangle merge candidate list are referred to as triangle merge candidates. However, triangle merge candidates and list construction methods using the above merge candidate derivation method and merge candidate list construction method for triangle merge candidates are also within the scope of the present invention.

[0397] The signal may transmit information via the bitstream to determine the maximum number of triangle merge candidates that can be included in the triangle merge candidate list, and the information may indicate a difference between the maximum number of merge candidates that can be included in the merge candidate list and the maximum number of triangle merge candidates that can be included in the triangle merge candidate list.

[0398] Triangle merging candidates may be derived from the spatial and temporal neighboring blocks of a coding block.

[0399] FIG. 36 is a diagram showing adjacent blocks for deriving triangle merge candidates.

[0400] Triangle merging candidates may be derived using at least one of a neighboring block located above the coding block, a neighboring block located to the left of the coding block, or a co-located block included in a different picture from the coding block. The upper neighboring block may be at least one of a block including samples (xCb+CbW-1, yCb-1) located above the coding block, a block including samples (xCb+CbW, yCb-1) located above the coding block, or a block including samples (xCb-1, yCb-1) located above the coding block. The left neighboring block may be at least one of a block including samples (xCb-1, yCb+CbH-1) located to the left of the coding block, or a block including samples (xCb-1, yCb+CbH) located to the left of the coding block. The collocated block may be determined as either the block containing the sample (xCb+CbW, yCb+CbH) adjacent to the upper right corner of the coding block in the collocated picture, or the block containing the sample (xCb / 2, yCb / 2) located at the center of the coding block.

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

[0402] The motion information of the triangle prediction units may be derived based on the triangle merge candidate list, i.e., the triangle prediction units may share one triangle merge candidate list.

[0403] To derive the motion information of the triangle merging unit, at least one of the pieces of information for specifying a triangle merge candidate included in the triangle merge candidate list may be transmitted by a signal via the bitstream, for example, at least one piece of index information for specifying a triangle merge candidate, such as merge_triangle_idx, may be transmitted by a signal via the bitstream.

[0404] The index information may specify a combination of merge candidates for the first triangular prediction unit and the second triangular prediction unit. For example, Table 3 below shows an example of a combination of merge candidates based on the index information merge_triangle_idx.

[0405] [Table 3]

[0406] When the value of the index information merge_triangle_idx is 1, it indicates that the motion information of the first triangular prediction unit is derived from the merge candidate with index 1, and the motion information of the second triangular prediction unit is derived from the merge candidate with index 0. The index information merge_triangle_idx may determine the triangle merge candidate for deriving the motion information of the first triangular prediction unit and the triangle merge candidate for deriving the motion information of the second triangular prediction unit.

[0407] Furthermore, the partition type of the coding block that uses diagonal partitioning may be determined based on index information. That is, the index information may specify a combination of merge candidates for the first triangular prediction unit, merge candidates for the second triangular prediction unit, and the partition direction of the coding block. When the partition type of the coding block is determined based on index information, it is not necessary to encode information triangle_partition_type_flag, which indicates the direction of the diagonal line that divides the coding block. Table 4 shows the partition types of the coding block with respect to index information merge_triangle_idx.

[0408] [Table 4]

[0409] When the variable TriangleDir is 0, it indicates that the coding block applies left triangulation type, and when the variable TriangleDir is 1, it indicates that the coding block applies right triangulation type. By combining Table 3 and Table 4, it is possible to specify a combination of merge candidates for the first triangular prediction unit, merge candidates for the second triangular prediction unit, and division direction of the coding block based on the index information merge_triangle_idx.

[0410] As another example, index information used for only one of the first triangular prediction unit and the second triangular prediction unit may be transmitted via a signal, and an index of a triangle merge candidate used for the other of the first triangular prediction unit and the second triangular prediction unit may be determined based on the index information. For example, a triangle merge candidate for the first triangular prediction unit may be determined based on index information merge_triangle_idx indicating the index of one of the triangle merge candidates. Furthermore, a triangle merge candidate for the second triangular prediction unit may be specified based on the merge_triangle_idx. For example, a triangle merge candidate for the second triangular prediction unit may be derived by adding or subtracting an offset amount to or from the index information merge_triangle_idx. The offset amount may be an integer such as 1 or 2. For example, a triangle merge candidate for the second triangular prediction unit may be determined as a triangle merge candidate indexed by adding 1 to merge_triangle_idx. If merge_triangle_idx indicates the triangle merge candidate with the largest index value among the triangle merge candidates, motion information of the second triangular prediction unit may be derived from the triangle merge candidate with index 0 or the triangle merge candidate with an index obtained by subtracting 1 from merge_triangle_idx.

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

[0412] As another example, index information may be transmitted by a signal to each of the first triangular prediction unit and the second triangular prediction unit. For example, first index information 1st_merge_idx for determining triangle merge candidates for the first triangular prediction unit and second index information 2nd_merge_idx for determining triangle merge candidates for the second triangular prediction unit may be transmitted by a signal via a bitstream. Motion information for the first triangular prediction unit may be derived from the triangle merge candidates determined based on the first index information 1st_merge_idx, and motion information for the second triangular prediction unit may be derived from the triangle merge candidates determined based on the second index information 2nd_merge_idx.

[0413] The first index information 1st_merge_idx may indicate the index of any one of the triangle merge candidates included in the triangle merge candidate list, and the triangle merge candidate of the first triangular prediction unit may be determined as the triangle merge candidate indicated by the first index information 1st_merge_idx.

[0414] The triangle merge candidate indicated by the first index information 1st_merge_idx may be set to be unavailable as a triangle merge candidate for the second triangular prediction unit. Therefore, the second index information 2nd_merge_idx of the second triangular prediction unit may indicate the index of any one of the remaining triangle merge candidates other than the triangle merge candidate indicated by the first index information. If the value of the second index information 2nd_merge_idx is smaller than the value of the first index information 1st_merge_idx, the triangle merge candidate for the second triangular prediction unit may be determined as the triangle merge candidate having index information indicated by the second index information 2nd_merge_idx. On the other hand, if 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 for the second triangular prediction unit may be determined as the triangle merge candidate indexed by adding 1 to the value of the second index information 2nd_merge_idx.

[0415] Alternatively, the determination of whether to transmit the second index information via a signal may be based on the number of triangle merge candidates included in the triangle merge candidate list. For example, if the maximum number of triangle merge candidates that can be included in the triangle merge candidate list is two or less, the transmission of the second index information via a signal may be omitted. If the transmission of the second index information via a signal is omitted, the second triangle merge candidate may be derived by adding or subtracting an offset from the first index information. For example, if the maximum number of triangle merge candidates that can be included in the triangle merge candidate list is two and the first index information is an index of zero, the second triangle merge candidate may be derived by adding one to the first index information. Alternatively, if the maximum number of triangle merge candidates that can be included in the triangle merge candidate list is two and the first index information is one, the second triangle merge candidate may be derived by subtracting one from the first index information.

[0416] Alternatively, if the second index information is not transmitted by the signal, the second index information may be set as a default value, which may be 0. The second triangle merge candidate can be derived by comparing the first index information with the second index information. For example, if the second index information is smaller than the first index information, the merge candidate with index 0 is set as the second triangle merge candidate; if the second index information is equal to or larger than the first index information, the merge candidate with index 1 is set as the second triangle merge candidate.

[0417] If a 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, if a triangle merge candidate has bidirectional motion information, only one of the L0 motion information or the L1 motion information is set as the motion information of the triangle prediction unit. Whether the L0 motion information or the L1 motion information is to be acquired may be determined based on the index of the triangle merge candidate or the motion information of other triangle prediction units.

[0418] For example, if the index of a triangle merge candidate is even, 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, if the index of a triangle merge candidate is odd, 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. Conversely, if the index of a triangle merge candidate is even, the L0 motion information of the triangle merge candidate may be set to the L0 motion information of the triangle prediction unit, and if the index of a triangle merge candidate is odd, the L1 motion information of the triangle merge candidate may be set to the L1 motion information of the triangle prediction unit. Alternatively, for a first triangle prediction unit, if the triangle merge candidate is even, the L0 motion information of the triangle merge candidate may be set to the L0 motion information of the first triangle prediction unit, while for a second triangle prediction unit, if the triangle merge candidate is odd, the L1 motion information of the triangle merge candidate may be set to the L1 motion information of the second triangle prediction unit.

[0419] Alternatively, if the first triangle prediction unit has L0 motion information, the L0 motion information of the second triangle prediction unit may be set to 0, and the L1 motion information of the triangle merge candidate may be set as the L1 information of the second triangle prediction unit. On the other hand, if the first triangle prediction unit has L1 motion information, the L1 motion information of the second triangle prediction unit may be set to 0, and the L0 motion information of the triangle merge candidate may be set as the L0 motion information of the second triangle prediction unit.

[0420] Furthermore, the triangle merge candidate list for deriving motion information of the first triangular prediction unit and the triangle merge candidate list for deriving motion information of the second triangular prediction unit may be set to be different.

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

[0422] Therefore, the maximum number of triangle merge candidates included in the triangle merge candidate list of the first triangular prediction unit is different from the maximum number of triangle merge candidates included in the triangle merge candidate list of the second triangular prediction unit. For example, if the triangle merge candidate list of the first triangular prediction unit includes M merge candidates, the triangle merge candidate list of the second triangular prediction unit may include M-1 merge candidates other than the triangle merge candidate indicated by the index information of the first triangular prediction unit.

[0423] As another example, merging candidates for each triangular prediction unit may be derived based on neighboring blocks adjacent to the coding block, and the availability of neighboring blocks may be determined taking into account the shape or position of the triangular prediction unit.

[0424] FIG. 37 is a diagram illustrating an example of determining the availability of neighboring blocks for each triangular prediction unit.

[0425] Neighboring blocks that are not adjacent to the first triangular prediction unit may be set as unavailable neighboring blocks for the first triangular prediction unit, and neighboring blocks that are not adjacent to the second triangular prediction unit may be set as unavailable neighboring blocks for the second triangular prediction unit.

[0426] 37(a), when the left triangulation type is applied to the coding block, it can be determined that blocks A1, A0, and A2 adjacent to the first triangular prediction unit among the adjacent blocks adjacent to the coding block can be used for the first triangular prediction unit, but blocks B0 and B1 cannot be used for the first triangular prediction unit. Therefore, the triangle merge candidate list associated with the first triangular prediction unit includes triangle merge candidates derived from blocks A1, A0, and A2, but does not include triangle merge candidates derived from blocks B0 and B1.

[0427] In the example shown in Figure 37(b), when the left triangulation type is applied to the coding block, it can be determined that blocks B0 and B1 adjacent to the second triangular prediction unit can be used for the second triangular prediction unit, but blocks A1, A0, and A2 cannot be used for the second triangular prediction unit. Therefore, the triangle merge candidate list associated with the second triangular prediction unit includes triangle merge candidates derived from blocks B0 and B1, but does not include triangle merge candidates derived from blocks A1, A0, and A2.

[0428] Therefore, the number or range of triangle merging candidates that the triangular prediction unit can use may be determined based on at least one of the position of the triangular prediction unit or the division type of the coding block.

[0429] As another example, only the merge mode may be applied to one of the first and second triangular prediction units, and the motion information of the other of the first and second triangular prediction units may be set to be the same as the motion information of the triangular prediction unit to which the merge mode is applied, or the motion information of the triangular prediction unit to which the merge mode is applied may be derived by subdividing it.

[0430] For example, the motion vector and reference picture index of the first triangular prediction unit may be derived based on the triangle merge candidate, or the motion vector of the second triangular prediction unit may be derived by subdividing the motion vector of the first triangular prediction unit. For example, the motion vector of the second triangular prediction unit may be derived by adding the refined motion vector {Rx, Ry} to the motion vector {mvD1LXx, mvD1LXy} of the first triangular prediction unit or by subtracting the refined motion vector {Rx, Ry} from the motion vector {mvD1LXx, mvD1LXy} of the first triangular prediction unit. The reference picture index of the second triangular prediction unit may be set to be the same as the reference picture index of the first triangular prediction unit.

[0431] The information for determining a fine motion vector indicating a difference between the motion vector of the first triangular prediction unit and the motion vector of the second triangular prediction unit may be transmitted by a signal via a bitstream, and the information may include at least one of information indicating a size of the fine motion vector or information indicating a symbol of the fine motion vector.

[0432] Alternatively, the symbols 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 triangular prediction unit.

[0433] As another example, a motion vector and a reference picture index for one of the first triangular prediction unit and the second triangular prediction unit may be transmitted by a signal, and the motion vector for the other of the first triangular prediction unit and the second triangular prediction unit may be derived by subdividing the transmitted motion vector.

[0434] For example, the motion vector and reference picture index of the first triangular prediction unit may be determined based on information signaled from a bitstream. Alternatively, the motion vector of the second triangular prediction unit may be derived by subdividing the motion vector of the first triangular prediction unit. For example, the motion vector of the second triangular prediction unit may be derived by adding the refined motion vector {Rx, Ry} to the motion vector {mvD1LXx, mvD1LXy} of the first triangular prediction unit or by subtracting the refined motion vector {Rx, Ry} from the motion vector {mvD1LXx, mvD1LXy} of the first triangular prediction unit. The reference picture index of the second triangular prediction unit may be set to be the same as the reference picture index of the first triangular prediction unit.

[0435] Motion prediction and compensation prediction may be performed on the coding blocks based on the motion information of the first triangular prediction unit and the motion information of the second triangular prediction unit. In this case, image quality may be degraded at the boundary between the first triangular prediction unit and the second triangular prediction unit. For example, image quality may be continuously degraded near the edge on the boundary between the first triangular prediction unit and the second triangular prediction unit. To reduce image quality degradation at the boundary, prediction samples may be derived using smoothing filtering or weighted prediction.

[0436] Prediction samples applying diagonal division of a coding block may be derived by weighting and calculating first prediction samples obtained based on motion information of the first triangular prediction unit and second prediction samples obtained based on motion information of the second triangular prediction unit. Alternatively, prediction samples of the first triangular prediction unit may be derived from a first prediction block determined based on motion information of the first triangular prediction unit, prediction samples of the second triangular prediction unit may be derived from a second prediction block determined based on motion information of the second triangular prediction unit, and prediction samples located in a boundary region between the first triangular prediction unit and the second triangular prediction unit may be derived by weighting and calculating the first prediction samples included in the first prediction block and the second prediction samples included in the second prediction block. For example, Equation 22 below shows an example of deriving prediction samples of the first triangular prediction unit and the second triangular prediction unit.

[0437] Equation 22

number

[0438] In Equation 22, P1 represents the first predicted sample, P2 represents the second predicted sample, w1 represents the weighting value applied to the first predicted sample, and (1-w1) represents the weighting value applied to the second predicted sample. In the example shown in Equation 22, the weighting value applied to the second predicted sample can be derived by subtracting the weighting value applied to the first predicted sample from a constant.

[0439] When a left triangulation type is applied to a coding block, the boundary region may include predicted samples having the same x-axis and y-axis coordinates, whereas when a right triangulation type is applied to a coding block, the boundary region may include predicted samples whose sum of the x-axis and y-axis coordinates is greater than or equal to a first threshold and less than or equal to a second threshold.

[0440] 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, the motion information of the triangular prediction unit, the motion vector difference of the triangular prediction unit, the output order of the reference picture, or the difference between the first predicted sample and the second predicted sample on the diagonal boundary.

[0441] Figures 38 and 39 show examples of deriving predicted samples by weighting and calculating the first and second predicted samples. Figure 38 shows a case where the coding block applies a left triangular division type, and Figure 39 shows a case where the coding block applies a right triangular division type. Figures 38(a) and 39(a) show prediction states related to the luma component, and Figures 38(b) and 39(b) show prediction states related to the chroma component.

[0442] In the drawing, a number written in a prediction sample near the boundary between the first prediction unit and the second prediction unit indicates a weighting value applied to the first prediction sample. For example, if the number written in a prediction sample is N, the first prediction sample may be derived by applying a weighting value of N / 8 to the first prediction sample and a weighting value of (1-(N / 8)) to the second prediction sample.

[0443] In a non-boundary region, the first prediction sample or the second prediction sample may be determined as the prediction sample. In the example of Figure 38, in a region belonging to the first triangular prediction unit among regions where the absolute value of the difference between the x-axis coordinate and the y-axis coordinate is greater than a threshold, the first prediction sample derived based on the motion information of the first triangular prediction unit may be determined as the prediction sample. On the other hand, in a region belonging to the second triangular prediction unit among regions where the difference between the x-axis coordinate and the y-axis coordinate is greater than a threshold, the second prediction sample derived based on the motion information of the second triangular prediction unit may be determined as the prediction sample.

[0444] 39, in a region where the sum of the x-axis coordinate and the y-axis coordinate is smaller than a first threshold, a first prediction sample derived based on the motion information of the first triangular prediction unit may be determined as the prediction sample, while in a region where the sum of the x-axis coordinate and the y-axis coordinate is greater than a second threshold, a second prediction sample derived based on the motion information of the second triangular prediction unit may be determined as the prediction sample.

[0445] The threshold for determining the non-border region 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, if the threshold associated with the luma component is set as N, the threshold associated with the chroma component may be set as N / 2.

[0446] A predicted sample included in the boundary region may be derived by weighting and calculating the first predicted sample and the second predicted sample. In such a case, the weighting values ​​applied to the first predicted sample and the second predicted sample may be determined based on at least one of the position of the predicted sample, the size of the coding block, the shape of the coding block, or the color component.

[0447] For example, in the example shown in Figure 38(a), by applying the same weighting value to the first predicted sample and the second predicted sample, it is possible to derive predicted samples at positions having the same x-axis coordinate and y-axis coordinate. By setting the weighting value ratio applied to the first predicted sample and the second predicted sample to (3:1) or (1:3), it is possible to derive a predicted sample whose absolute value of the difference between the x-axis coordinate and the y-axis coordinate is 1. Furthermore, by setting the weighting value ratio applied to the first predicted sample and the second predicted sample to (7:1) or (1:7), it is possible to derive a predicted sample whose absolute value of the difference between the x-axis coordinate and the y-axis coordinate is 2.

[0448] Alternatively, in the example shown in Figure 38(b), by applying the same weighting value to the first predicted sample and the second predicted sample, predicted samples at positions having the same x-axis coordinate and y-axis coordinate can be derived, and by setting the weighting value ratio applied to the first predicted sample and the second predicted sample as (7:1) or (1:7), a predicted sample whose absolute value of the difference between the x-axis coordinate and the y-axis coordinate is 1 can be derived.

[0449] For example, in the example shown in Figure 39(a), by applying the same weighting value to the first predicted sample and the second predicted sample, it is possible to derive a predicted sample whose sum of the x-axis coordinate and the y-axis coordinate is 1 less than the width or height of the coding block. By setting the weighting value ratio applied to the first predicted sample and the second predicted sample to (3:1) or (1:3), it is possible to derive a predicted sample whose sum of the x-axis coordinate and the y-axis coordinate is the same as the width or height of the coding block or 2 less than the width or height of the coding block. By setting the weighting value ratio applied to the first predicted sample and the second predicted sample to (7:1) or (1:7), it is possible to derive a predicted sample whose sum of the x-axis coordinate and the y-axis coordinate is 1 more than the width or height of the coding block or 3 less than the width or height of the coding block.

[0450] Alternatively, in the example shown in Figure 39(b), by applying the same weighting value to the first predicted sample and the second predicted sample, it is possible to derive a predicted sample whose sum of the x-axis coordinate and the y-axis coordinate is 1 less than the width or height of the coding block. By setting the weighting value ratio applied to the first predicted sample and the second predicted sample as (7:1) or (1:7), it is possible to derive a predicted sample whose sum of the x-axis coordinate and the y-axis coordinate is the same as the width or height of the coding block or 2 less than the width or height of the coding block.

[0451] As another example, the weighting value may be determined taking into consideration the position of the predicted sample or the shape of the coding block. Equation 23 to Equation 25 show examples of deriving the weighting value when a left triangulation type is applied to the coding block. Equation 23 shows an example of deriving the weighting value to be applied to the first predicted sample when the coding block is square.

[0452] Equation 23

number

[0453] In Equation 23, x and y represent the position of the predicted sample. If the coding block is non-square, the weighting value applied to the first predicted sample may be derived as shown in Equation 24 or 25. Equation 24 illustrates the case where the width of the coding block is greater than the height, and Equation 25 illustrates the case where the width of the coding block is less than the height.

[0454] Equation 24

number

[0455] Equation 25

number

[0456] When a right triangulation type is applied to the coding block, the weighting values ​​applied to the first predicted samples may be determined as shown in Equations 26 to 28. Equation 26 shows an example of deriving the weighting values ​​applied to the first predicted samples when the coding block is square.

[0457] Equation 26

number

[0458] In Equation 26, CbW represents the width of the coding block. If the coding block is non-square, the weighting value applied to the first predicted sample may be derived as shown in Equation 27 or 28. Equation 27 illustrates the case where the width of the coding block is greater than the height, and Equation 28 illustrates the case where the width of the coding block is less than the height.

[0459] Equation 27

number

[0460] Equation 28

number

[0461] In equation 27, CbH denotes the height of the coding block.

[0462] In the illustrated example, for prediction samples in the boundary region, a sample included in the first triangular prediction unit can be derived by assigning a higher weighting value to the first prediction sample than to the second prediction sample, and a sample included in the second triangular prediction unit can be derived by assigning a higher weighting value to the second prediction sample than to the first prediction sample.

[0463] When diagonal division is applied to a coding block, the coding block may be set not to apply a combined prediction mode that combines an intra prediction mode and a merge mode.

[0464] Intra prediction predicts the current block using reconstructed samples after encoding / decoding of the surrounding area of ​​the current block. In this case, the intra prediction of the current block may use reconstructed samples before applying the in-loop filter.

[0465] Intra prediction techniques include matrix-based intra prediction and general intra prediction that takes into account the directionality of surrounding reconstructed samples. Information indicating the intra prediction technique for the current block may be transmitted by a signal via the bitstream. The information may be a one-bit flag. Alternatively, the intra prediction technique for the current block may be determined based on at least one of the position, size, and shape of the current block, or the intra prediction techniques of neighboring blocks. For example, if the current block straddles a picture boundary, the current block may be set not to use matrix-based intra prediction.

[0466] Matrix-based intra prediction is a method of obtaining a prediction block for a current block by matrix multiplication of a matrix stored in an encoder and a decoder with reconstructed samples surrounding the current block. Information for specifying one of a plurality of matrices stored by a signal may be transmitted via a bitstream. The decoder may determine a matrix for intra prediction of the current block based on the information and the size of the current block.

[0467] General intra prediction is a method of obtaining a predicted block related to a current block based on a non-angular intra prediction mode or an angular intra prediction mode. Hereinafter, a process of performing intra prediction based on general intra prediction will be described in more detail with reference to the accompanying drawings.

[0468] FIG. 40 is a flowchart illustrating an intra prediction method according to an embodiment of the present invention.

[0469] A reference sample line of the current block may be determined (S4001). The reference sample line refers to a set of reference samples included in the Kth line from the top and / or left side of the current block. The reference sample may be derived from reconstructed samples after encoding / decoding around the current block.

[0470] Index information indicating a reference sample line of a current block among a plurality of reference sample lines may be transmitted by a signal via a bitstream. For example, index information intra_luma_ref_idx for specifying a reference sample line of the current block may be transmitted by a signal via a bitstream. The index information may be transmitted by a signal for each coding block.

[0471] The plurality of reference sample lines may include at least one of a first line, a second line, a third line, and a fourth line located above and / or to the left of the current block. Of the plurality of reference sample lines, a reference sample line consisting of a row adjacent to the above of the current block and a column adjacent to the left of the current block may be referred to as an adjacent reference sample line, and the other reference sample lines may be further referred to as non-adjacent reference sample lines.

[0472] Some of the plurality of reference sample lines may be selected as the reference sample line of the current block. For example, the remaining reference sample lines other than the third non-adjacent reference sample line among the plurality of reference sample lines may be set as candidate reference sample lines. Table 5 shows the indexes assigned to each candidate reference sample line.

[0473] [Table 5]

[0474] More or fewer candidate reference sample lines may be set than the described sample lines. Furthermore, the number or positions of non-adjacent reference sample lines set as candidate reference sample lines is not limited to the described examples. For example, the first and third non-adjacent reference sample lines may be set as candidate reference sample lines, or the second and third non-adjacent reference sample lines may be set as candidate reference sample lines. Alternatively, all of the first, second, and third non-adjacent reference sample lines may be set as candidate reference sample lines.

[0475] The number or type of candidate reference sample lines may be determined based on at least one of the size, shape, and position of the current block, whether sub-blocks are split, or the intra-prediction mode.

[0476] Furthermore, the reference sample line of the current block may be determined based on at least one of the position, size, shape, or predictive coding mode of the neighboring block of the current block. For example, if the current block contacts the boundary of a picture, a segment, a slice, or a coding tree unit, the first reference sample line may be determined as the reference sample line of the current block.

[0477] Alternatively, if the current block is non-square, the adjacent reference sample line may be set as the reference sample line of the current block. Alternatively, if the width-to-height ratio of the current block is greater than or equal to a threshold value or less than or equal to a threshold value, the adjacent reference sample line may be determined as the reference sample line of the current block.

[0478] The reference sample line may include upper reference samples located above the current block and left reference samples located to the left of the current block. The upper reference samples and left reference samples may be derived from reconstructed samples around the current block. The reconstructed samples may be in a state before application of an in-loop filter.

[0479] Next, an intra prediction mode of the current block may be determined (S4002). At least one of a non-angular intra prediction mode or an angular intra prediction mode may be determined as the intra prediction mode of the current block. The non-angular intra prediction modes include planar and DC, and the angular intra prediction modes include 33 or 65 modes from the lower-left diagonal to the upper-right diagonal.

[0480] FIG. 41 is a diagram showing intra prediction modes.

[0481] FIG. 41(a) shows 35 intra prediction modes, and FIG. 41(b) shows 67 intra prediction modes.

[0482] Furthermore, more or fewer intra-prediction modes than those shown in FIG. 41 may be defined.

[0483] A most probable mode (MPM) may be set based on the intra-prediction modes of neighboring blocks adjacent to the current block. The neighboring blocks may include a left neighboring block adjacent to the left of the current block and an upper neighboring block adjacent above the current block.

[0484] The number of MPMs included in the MPM list may be predefined in the encoder and decoder. For example, the number of MPMs may be three, four, five, or six. Alternatively, information indicating the number of MPMs may be transmitted by a signal via a bitstream. Alternatively, the number of MPMs may be determined based on at least one of the predictive coding mode of neighboring blocks and the size or shape of the current block. For example, when neighboring reference sample lines are determined as reference sample lines for the current block, N MPMs may be used, whereas when non-neighboring reference sample lines are determined as reference sample lines for the current block, M MPMs may be used. M is an integer smaller than N, e.g., N may be 6, or M may be 5, 4, or 3. Thus, when the index of the reference sample line of the current block is 0 and the MPM flag is true, the intra prediction mode of the current block may be determined as one of six candidate intra prediction modes. However, when the index of the reference sample line of the current block is greater than 0 and the MPM flag is true, the intra prediction mode of the current block may be determined as one of five candidate intra prediction modes.

[0485] Alternatively, a fixed number of MPM candidates (eg, six or five) may also be used regardless of the index of the reference sample line of the current block.

[0486] An MPM list including multiple MPMs may be generated, and information indicating whether the MPM that is the same as the intra prediction mode of the current block is included in the MPM list may be transmitted via a signal via a bitstream. The information is a 1-bit flag and may be referred to as an MPM flag. If the MPM flag indicates that the same MPM as the current block is included in the MPM list, index information indicating one of the MPMs may be transmitted via a signal via a bitstream. For example, index information mpm_idx that specifies one of the multiple MPMs may be transmitted via a signal via a bitstream. The MPM specified by the index information may be set as the intra prediction mode of the current block. If the MPM flag indicates that the same MPM as the current block is not included in the MPM list, remaining mode information indicating one of the remaining intra prediction modes other than the MPM may be transmitted via a signal via a bitstream. The remaining mode information indicates an index value corresponding to the intra prediction mode of the current block when reassigning indexes to the remaining intra prediction modes other than the MPM. The decoder may arrange the MPMs in ascending order and compare the remaining mode information with the MPM to determine the intra prediction mode of the current block. For example, if the residual mode information is equal to or smaller than the MPM, 1 may be added to the residual mode information to derive the intra prediction mode of the current block.

[0487] When deriving the intra prediction mode of the current block, comparison of some of the MPMs with the remaining mode information may be omitted. For example, the MPM of the non-angular intra prediction mode may be excluded from the comparison object. When a non-angular intra prediction mode is set as the MPM, the remaining mode information clearly indicates the angular intra prediction mode, so the intra prediction mode of the current block may be derived by comparing the remaining MPMs other than the non-angular intra prediction mode with the remaining mode information. Instead of excluding the non-angular intra prediction mode from the comparison object, the MPM may be compared with a value obtained by adding the number of non-angular intra prediction modes to the remaining mode information.

[0488] Instead of setting the default mode as an MPM, information indicating whether the intra prediction mode of the current block is the default mode may be transmitted by signaling via the bitstream. The information may be a 1-bit flag, and the flag may be referred to as a default mode flag. The default mode flag may be transmitted by signaling only if the MPM flag indicates that the same MPM as the current block is included in the MPM list. As described above, the default mode may include at least one of planar, DC, vertical mode, or horizontal mode. For example, if planar is set as the default mode, the default mode flag may indicate whether the intra prediction mode of the current block is planar. If the default mode flag indicates that the intra prediction mode of the current block is not the default mode, one of the MPMs indicated by the index information may be set as the intra prediction mode of the current block.

[0489] When the default mode flag is used, the intra prediction mode that is the same as the default mode does not need to be set as the MPM. For example, if the default mode flag indicates whether the intra prediction mode of the current block is planar, the intra prediction mode of the current block may be derived using five MPMs other than the MPM corresponding to planar.

[0490] When multiple intra prediction modes are set as default modes, index information indicating one of the default modes may be further transmitted by a signal, and the intra prediction mode of the current block may be set as the default mode indicated by the index information.

[0491] If the index of the reference sample line of the current block is not 0, the default mode is set not to be used. For example, if a non-adjacent reference sample line is determined as the reference sample line of the current block, a non-angular intra prediction mode such as DC mode or planar mode may be set not to be used. Therefore, if the index of the reference sample line is not 0, the default mode flag may not be transmitted by a signal, and the value of the default mode flag may be set to a predefined value (i.e., false).

[0492] When the intra-prediction mode of the current block is determined, a prediction sample related to the current block may be obtained based on the determined intra-prediction mode (S4003).

[0493] When the DC mode is selected, a predicted sample related to the current block may be generated based on an average value of reference samples. Specifically, values ​​of all samples in the predicted block may be generated based on the average value of the reference samples. The average value may be derived using at least one of an upper reference sample located above the current block and a left reference sample located to the left of the current block.

[0494] The number or range of reference samples for deriving the average value may vary depending on the shape of the current block. For example, if the current block is a non-square block whose width is greater than its height, the average value may be calculated using only the upper reference samples. On the other hand, if the current block is a non-square block whose width is less than its height, the average value may be calculated using only the left reference samples. That is, if the width and height of the current block are different, the average value may be calculated using only the adjacent reference samples on the longer side. Alternatively, whether to calculate the average value using only the upper reference samples or only the left reference samples may be determined based on the ratio of the width and height of the current block.

[0495] When the planar mode is selected, a prediction sample may be obtained using a horizontal prediction sample and a vertical prediction sample. The horizontal prediction sample is obtained based on a left reference sample and a right reference sample located on the same horizontal line as the prediction sample, and the vertical prediction sample is obtained based on an upper reference sample and a lower reference sample located on the same vertical line as the prediction sample. A right reference sample may be generated by copying a reference sample adjacent to the upper right corner of the current block, and a lower reference sample may be generated by copying a reference sample adjacent to the lower left corner of the current block. The horizontal prediction sample may be obtained by weighting and calculating the left reference sample and the right reference sample, and the vertical prediction sample may be obtained by weighting and calculating the upper reference sample and the lower reference sample. In this case, a weighting value assigned to each reference sample may be determined based on the position of the prediction sample. The prediction sample may be obtained by averaging or weighting and calculating the horizontal prediction sample and the vertical prediction sample. When performing the weighting and calculation, the weighting values ​​assigned to the horizontal prediction sample and the vertical prediction sample may be determined based on the position of the prediction sample.

[0496] When an angular prediction mode is selected, a parameter indicating the prediction direction (or prediction angle) of the selected angular prediction mode may be determined. Table 6 below shows the intra prediction parameter intraPredAng for each intra prediction mode.

[0497] [Table 6]

[0498] Table 6 shows the intra direction parameters of each intra prediction mode having an index of 2 to 34 when 35 intra prediction modes are defined. When 33 or more angular intra prediction modes are defined, Table 6 is further subdivided to set the intra direction parameters of each angular intra prediction mode.

[0499] After arranging the upper reference sample and the left reference sample of the current block in a row, a predicted sample may be obtained based on the value of the intra direction parameter. In this case, if the value of the intra direction parameter is negative, the left reference sample and the upper reference sample may be arranged in a row.

[0500] 42 and 43 are diagrams showing examples of a one-dimensional array in which reference samples are arranged in one row.

[0501] Figure 42 shows an example of a one-dimensional vertical array in which reference samples are arranged in the vertical direction, and Figure 43 shows an example of a one-dimensional horizontal array in which reference samples are arranged in the horizontal direction. The examples of Figures 42 and 43 will be described assuming that 35 intra prediction modes are defined.

[0502] If the intra prediction mode index is one of 11 to 18, a horizontal one-dimensional array in which the upper reference sample is rotated counterclockwise may be applied, and if the intra prediction mode index is one of 19 to 25, a vertical one-dimensional array in which the left reference sample is rotated clockwise may be applied. When arranging the reference samples in a row, the intra prediction mode angle may be taken into consideration.

[0503] Reference sample determination parameters may be determined based on the intra direction parameters, and may include a reference sample index for specifying the reference sample and a weighting value parameter for determining a weighting value to be applied to the reference sample.

[0504] The reference sample index iIdx and the weighting parameter ifact may be obtained by the following Equations 30 and 31, respectively.

[0505] equation 30

number

[0506] Equation 31

number

[0507] In equations 30 and 31, P ang indicates an intra direction parameter. The reference sample specified based on the reference sample index iIdx corresponds to an integer pel.

[0508] One or more reference samples may be specified to derive a prediction sample. Specifically, the positions of the reference samples to derive the prediction sample may be specified in consideration of the gradient of the prediction mode. For example, the reference samples to derive the prediction sample may be specified using a reference sample index iIdx.

[0509] In such a case, if the gradient of the intra prediction mode cannot be represented by a single reference sample, a prediction sample may be generated by interpolating multiple reference samples. For example, if the gradient of the intra prediction mode is a value between the gradient between the prediction sample and a first reference sample and the gradient between the prediction sample and a second reference sample, the prediction sample may be obtained by interpolating the first reference sample and the second reference sample. That is, if an angular line according to the intra prediction angle does not pass through a reference sample located at an integer pixel, the prediction sample may be obtained by interpolating reference samples adjacent to the left, right, top, or bottom of the position where the angular line passes.

[0510] Equation 32 below shows an example of obtaining a predicted sample based on a reference sample.

[0511] Equation 32

number

[0512] In Equation 32, P denotes a predicted sample, and Ref_1D denotes any one of the reference samples in the one-dimensional array. In such a case, the position of the reference sample may be determined based on the position (x, y) of the predicted sample and the reference sample index iIdx.

[0513] If the gradient of the intra prediction mode may be represented as one reference sample, the weighting value parameter ifact may be set as 0. Therefore, Equation 32 may be simplified to the following Equation 33.

[0514] Equation 33

number

[0515] Furthermore, intra prediction may be performed on the current block based on multiple intra prediction modes. For example, intra prediction modes may be derived for different prediction samples, or prediction samples may be derived based on the intra prediction mode assigned to each prediction sample.

[0516] Alternatively, intra-prediction modes may be derived for different regions, and intra-prediction may be performed for each region based on the intra-prediction mode assigned to each region. The regions may include at least one sample. At least one of the sizes or shapes of the regions may be adaptively determined based on at least one of the size, shape, or intra-prediction mode of the current block. Alternatively, at the encoder and decoder, at least one of the sizes or shapes of the regions may be predefined regardless of the size or shape of the current block.

[0517] Alternatively, intra prediction may be performed based on multiple intra predictions, and a final prediction sample may be derived by averaging or weighting and calculating multiple prediction samples obtained by the multiple intra predictions. For example, a first prediction sample may be obtained by performing intra prediction based on a first intra prediction mode, and a second prediction sample may be obtained by performing intra prediction based on a second intra prediction mode. Then, a final prediction sample may be obtained by averaging or weighting and calculating the first and second prediction samples. In this case, the weighting values ​​assigned to the first and second prediction samples may be determined based on whether the first intra prediction mode is a non-angular / angular prediction mode and whether the second intra prediction mode is at least one of a non-angular / angular prediction mode and the intra prediction mode of a neighboring block.

[0518] The multiple intra prediction modes may be a combination of a non-angular intra prediction mode and an angular prediction mode, a combination of angular prediction modes, or a combination of non-angular prediction modes.

[0519] FIG. 44 is a diagram showing angles formed between angular intra prediction modes and a line parallel to the x-axis.

[0520] In the example shown in Figure 44, the angular prediction modes may exist between the bottom left diagonal direction and the top right diagonal direction. When described as the angle between the x-axis and the angular prediction modes, the angular prediction modes may exist between 45 degrees (bottom left diagonal direction) and -135 degrees (top right diagonal direction).

[0521] If the current block is non-square, a prediction sample is derived based on the intra prediction mode of the current block using a reference sample that is away from the prediction sample among the reference samples located on a corner line according to the intra prediction angle, rather than a reference sample that is close to the prediction sample.

[0522] FIG. 45 is a diagram showing an example of obtaining predicted samples when the current block is non-square.

[0523] For example, in the example shown in Figure 45(a), it is assumed that the current block is a non-square block whose width is greater than its height, and that the intra prediction mode of the current block is an angular intra prediction mode whose angle is between 0 and 45 degrees. In this case, when deriving a predicted sample A near the right column of the current block, a situation occurs in which a left reference sample L, which is far from the predicted sample among reference samples in the angular mode located at the angle, replaces an upper reference sample T, which is close to the predicted sample.

[0524] As another example, in the example shown in Figure 45(b), it is assumed that the current block is a non-square block with its height greater than its width, and the intra prediction mode of the current block is an angular intra prediction mode with an angle between -90 degrees and -135 degrees. In this case, when deriving a predicted sample A near the bottom row of the current block, a situation occurs in which an upper reference sample T, which is far from the predicted sample among reference samples in the angular mode located at the angle, replaces a left reference sample L, which is close to the predicted sample.

[0525] To solve this problem, if the current block is non-square, the intra prediction mode of the current block may be replaced with an intra prediction mode in the opposite direction. Therefore, for a non-square block, an angular prediction mode having an angle larger or smaller than the angle of the angular prediction mode shown in Figure 41 may be used. Such an angular intra prediction mode may be defined as a wide-angle intra prediction mode. A wide-angle intra prediction mode refers to an angular intra prediction mode that exceeds the range of 45 degrees to -135 degrees.

[0526] FIG. 46 is a diagram showing wide-angle intra prediction modes.

[0527] In the example shown in FIG. 46, the intra prediction modes with indexes −1 to −14 and the intra prediction modes with indexes 67 to 80 indicate wide-angle intra prediction modes.

[0528] Figure 46 shows 14 wide-angle intra prediction modes (-1 to -14) with angles greater than 45 degrees and 14 wide-angle intra prediction modes (67 to 80) with angles less than -135 degrees, but a greater or lesser number of wide-angle intra prediction modes may be defined.

[0529] When using a wide-angle intra prediction mode, the length of the upper reference sample is set as 2W+1, and the length of the left reference sample is set as 2H+1.

[0530] When using wide-angle intra prediction mode, reference sample T may be used to predict sample A shown in Figure 45(a), and reference sample L may be used to predict sample A shown in Figure 45(b).

[0531] By adding the existing intra prediction modes and the N wide-angle intra prediction modes, a total of 67+N intra prediction modes can be used. For example, Table 7 shows the intra direction parameters of the intra prediction modes when 20 wide-angle intra prediction modes are defined.

[0532] [Table 7]

[0533] If the current block is non-square and the intra prediction mode of the current block obtained in step S4002 is within the conversion range, the intra prediction mode of the current block may be converted to a wide-angle intra prediction mode. The conversion range may be determined based on at least one of the size, shape, or ratio of the current block. The ratio may indicate the ratio of the width to the height of the current block.

[0534] If the current block is non-square, with its width greater than its height, the transform range may be set to the right upper diagonal intra prediction mode index (e.g., 66) to (right upper diagonal intra prediction mode index - N). N may be determined based on the ratio of the current block. If the intra prediction mode of the current block is within the transform range, the intra prediction mode may be converted to a wide-angle intra prediction mode. The transform may be performed by subtracting a predefined value from the intra prediction mode, and the predefined value may be the total number of intra prediction modes other than the wide-angle intra prediction mode (e.g., 67).

[0535] Based on the above embodiment, the 66th to 53rd intra prediction modes may be converted into the −1st to −14th wide-angle intra prediction modes, respectively.

[0536] If the current block is non-square, with its height greater than its width, the transform range may be set to the lower-left diagonal intra prediction mode index (e.g., 2) to (lower-left diagonal intra prediction mode index + M). M may be determined based on the ratio of the current block. If the intra prediction mode of the current block is within the transform range, the intra prediction mode may be converted to a wide-angle intra prediction mode. The transform may be performed by adding a predefined value to the intra prediction mode, and the predefined value may be the total number of angle intra prediction modes other than the wide-angle intra prediction mode (e.g., 65).

[0537] Based on the above embodiment, the 2nd to 15th intra prediction modes may be converted into the 67th to 80th wide-angle intra prediction modes, respectively.

[0538] Hereinafter, the intra prediction modes within the transform range are referred to as wide-angle intra substitution prediction modes.

[0539] The transform range may be determined based on the ratio of the current block. For example, Tables 8 and 9 show transform ranges when 35 and 67 intra prediction modes other than the wide-angle intra prediction mode are defined, respectively.

[0540] [Table 8]

[0541] [Table 9]

[0542] In the examples shown in Tables 8 and 9, the number of wide-angle intra-substitution prediction modes within the transform range may vary depending on the proportion of the current block.

[0543] By subdividing the ratio of the current block, the conversion range can be set as shown in Table 10.

[0544] [Table 10]

[0545] When a multi-line intra prediction coding method for determining a non-adjacent reference sample line as a reference sample line of a current block or selecting one of a plurality of reference sample lines is used, it may be set not to use a wide-angle intra prediction mode. That is, even if the current block is non-square and the intra prediction mode of the current block is within the conversion range, the intra prediction mode of the current block may not be converted to the wide-angle intra prediction mode.

[0546] Alternatively, when the intra prediction mode of the current block is determined as a wide-angle intra prediction mode, non-adjacent reference sample lines may be set to be unavailable as reference sample lines of the current block, or a multi-line intra prediction coding method for selecting one of a plurality of reference sample lines may be set to be unavailable. When a multi-line intra prediction coding method is not used, an adjacent reference sample line may be set as a reference sample line of the current block.

[0547] When the wide-angle intra prediction mode is not used, refW and refH are set as the sum of nTbW and nTbH. Therefore, in addition to the upper left reference sample, non-adjacent reference samples that are a distance i from the current block may include (nTbW + nTbH + offsetX[i]) upper reference samples and (nTbW + nTbH + offsetY[i]) left reference samples. That is, non-adjacent reference samples that are a distance i from the current block may include (2nTbW + 2nTbH + offsetX[i] + offsetY[i] + 1) reference samples. For example, if the value of whRatio is greater than 1, the value of offsetX is set greater than the value of offsetY. For example, the value of offsetX is set to 1 and the value of offsetY is set to 0. On the other hand, if the value of whRatio is less than 1, the value of offsetY is set greater than the value of offsetX. For example, set the value of offsetX as 0 and the value of offsetY as 1.

[0548] As wide-angle intra-prediction modes are used in addition to existing intra-prediction modes, the resources required to encode the wide-angle intra-prediction modes increase, which may reduce coding efficiency. Therefore, instead of directly encoding the wide-angle intra-prediction modes, coding a replacement intra-prediction mode related to the wide-angle intra-prediction mode improves coding efficiency.

[0549] For example, when the current block is encoded using the 67th wide-angle intra prediction mode, the intra prediction mode of the current block may be coded as the 67th wide-angle replacement intra prediction mode, i.e., number 2. When the current block is encoded using the −1th wide-angle intra prediction mode, the intra prediction mode of the current block may be coded as the −1st wide-angle replacement intra prediction mode, i.e., number 66.

[0550] The decoder may decode the intra-prediction mode of the current block to determine whether the decoded intra-prediction mode is within the transform range. If the decoded intra-prediction mode is a wide-angle replacement intra-prediction mode, the decoder may transform the intra-prediction mode to a wide-angle intra-prediction mode.

[0551] Alternatively, when encoding the current block in a wide-angle intra-prediction mode, a wider-angle intra-prediction mode may be directly encoded.

[0552] The encoding of the intra prediction mode may be realized based on the MPM list. Specifically, when encoding a neighboring block in a wide-angle intra prediction mode, the MPM may be set based on a wide-angle replacement intra prediction mode corresponding to the wide-angle intra prediction mode.

[0553] A residual picture may be derived by subtracting a predicted picture from an original picture. In this case, when converting the residual picture to the frequency domain, removing high-frequency components in the frequency domain does not significantly degrade the subjective quality of the video. Therefore, converting the values ​​of high-frequency components to relatively small values ​​or setting the values ​​of high-frequency components to zero can improve compression efficiency without causing noticeable visual distortion. To reflect these characteristics, the current block may be transformed to decompose the residual picture into two-dimensional frequency components. The transformation may be performed using a transform technique such as a discrete cosine transform (DCT) or a discrete sine transform (DST).

[0554] While the DCT uses a cosine transform to decompose (or transform) the residual picture into two-dimensional frequency components, the DST uses a sine transform to decompose (or transform) the residual picture into two-dimensional frequency components. As a result of the transformation of the residual picture, the frequency components may be referred to as base pictures. For example, when performing a DCT transform on a block of size NxN, N 2 basic pattern components may be obtained. The size of each basic pattern component contained in a block of size N×N may be obtained by transformation. Depending on the transformation technique used, the size of the basic pattern component may be referred to as a DCT coefficient or a DST coefficient.

[0555] The DCT transform technique is mainly used to transform pictures with a higher distribution of non-zero low-frequency components, while the DST transform technique is mainly used to transform pictures with a higher distribution of high-frequency components.

[0556] Additionally, transform techniques other than DCT or DST may be used to transform the residual picture.

[0557] Hereinafter, the process of transforming the residual picture into two-dimensional frequency components is referred to as two-dimensional picture transform. The size of the basic pattern components obtained by the transform result is referred to as transform coefficients. For example, the transform coefficients may refer to DCT coefficients or DST coefficients. When a primary transform and a secondary transform (to be described later) are simultaneously applied, the transform coefficients may indicate the size of the basic pattern components generated by the secondary transform result.

[0558] A transform technique may be determined on a block-by-block basis. The transform technique may be determined based on at least one of the predictive coding mode of the current block, the size of the current block, or the shape of the current block. For example, if the current block is coded in intra prediction mode and the size of the current block is smaller than N×N, the transform technique DST may be used to perform the transform. On the other hand, if the above conditions cannot be met, the transform technique DCT may be used to perform the transform.

[0559] In the residual picture, two-dimensional picture transform may not be performed on some blocks. Not performing two-dimensional picture transform may be referred to as transform skip. When transform skip is applied, quantization may be applied to the residual values ​​that are not transformed.

[0560] After transforming a current block using a DCT or DST, the transformed current block may be transformed again. In this case, the transformation based on the DCT or DST may be defined as a primary transformation, and the process of transforming the block again using the primary transformation is called a secondary transformation.

[0561] The main transform may be performed using any one of a number of possible transform cores, for example, any one of the DCT2, DCT8 or DCT7 may be used to perform the main transform.

[0562] Different transform cores may also be used for the horizontal and vertical directions, and information indicating the combination of horizontal and vertical transform cores may be transmitted by a signal via the bitstream.

[0563] The execution units of the primary transform and the secondary transform are different. For example, the primary transform may be performed on an 8x8 block, and the secondary transform may be performed on a 4x4 sub-block of the transformed 8x8 block. In such a case, the transform coefficients of the spare area where the secondary transform is not performed may be set to 0.

[0564] Alternatively, the primary transform may be performed on the 4x4 block, and the secondary transform may be performed on a region of size 8x8 that contains the transformed 4x4 block.

[0565] Information indicating whether or not to perform a secondary transformation may be transmitted by signaling via the bitstream.

[0566] The decoder may perform an inverse transform (second inverse transform) of the secondary transform, and then perform an inverse transform (first inverse transform) of the primary transform on the result. A residual signal of the current block may be obtained as a result of performing the second inverse transform and the first inverse transform.

[0567] Quantization is used to reduce the energy of a block, and the quantization process involves dividing the transform coefficients by a specific constant, which may be derived from a quantization parameter, which may be defined as a value between 1 and 63.

[0568] If the encoder performs transform and quantization, the decoder may obtain a residual block by inverse quantization and inverse transform, and may add the predicted block and the residual block to obtain a reconstructed block of the current block.

[0569] When a reconstructed block of the current block is obtained, information loss occurring during the quantization and encoding processes 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). Hereinafter, the reconstructed block before applying the in-loop filter is referred to as a first reconstructed block, and the reconstructed block after applying the in-loop filter is referred to as a second reconstructed block.

[0570] The second reconstructed block may be obtained by applying at least one of a deblocking filter, SAO, or ALF to the first reconstructed block. In this case, the SAO or ALF may be applied after applying the deblocking filter.

[0571] The deblocking filter is used to reduce image quality degradation (blocking artifacts) that occur at block boundaries when quantization is performed on a block-by-block basis. To apply the deblocking filter, a blocking strength (BS) between a first restored block and an adjacent restored block may be determined.

[0572] FIG. 47 is a flowchart showing the process of determining the blocking strength.

[0573] 47, P indicates the first reconstruction block and Q indicates the adjacent reconstruction block, which may be adjacent to the left or above the current block.

[0574] The example shown in Figure 47 shows that the blocking strength is determined based on the predictive coding mode taking into account P and Q, whether or not non-zero transform coefficients are included, whether or not inter-prediction is performed using the same reference picture, and whether or not the difference in motion vectors is greater than or equal to a threshold.

[0575] Whether to apply a deblocking filter may be determined based on the blocking strength, for example, if the blocking strength is 0, no filtering may be performed.

[0576] SAO is used to reduce ringing artifacts that occur when quantization is performed in the frequency domain. SAO can be performed by adding or subtracting an offset determined based on the pattern of the first reconstructed picture. Methods for determining the offset include edge offset (EO) and band offset. EO refers to a method of determining the offset of a current sample based on the pattern of surrounding pixels. BO refers to a method of applying the same offset to a set of pixels with similar luminance values ​​in a region. Specifically, pixel luminance may be divided into 32 equal intervals, and pixels with similar luminance values ​​may be grouped together. For example, four adjacent bands out of 32 bands may be grouped together, and the same offset may be applied to samples belonging to the four bands.

[0577] ALF is a method of generating a second restored picture by applying a filter of a predefined size / shape to a first restored picture or a restored picture to which a deblocking filter is applied. The following equation 34 shows an example of applying ALF.

[0578] Equation 34

number

[0579] Any one of predefined filter candidates may be selected in units of a picture, a coding tree unit, a coding block, a prediction block, or a transform block, and any one of the sizes or shapes of each filter candidate may be different.

[0580] FIG. 48 shows predefined filter candidates.

[0581] In the example shown in FIG. 48, at least one of a 5x5, 7x7 and 9x9 diamond may be selected.

[0582] Only diamonds of size 5x5 can be used for the chromaticity components.

[0583] It is within the scope of the present invention to use an embodiment described primarily for a decoding or encoding process for an encoding or decoding process. It is also within the scope of the present invention to modify the embodiments described according to a predetermined order in a different order than the order in which they are described.

[0584] Although the embodiments have been described based on a series of steps or flowcharts, the embodiments do not limit the time sequence order of the present invention, and the steps may be executed simultaneously or in another order as needed. Furthermore, in the above embodiments, structural elements (e.g., units, modules, etc.) constituting the block diagrams may be implemented as hardware devices or software, and multiple structural elements may be implemented in combination as a single hardware device or software. The embodiments may be implemented in the form of program instructions, which may be executed by various computer components and stored on a computer-readable storage medium. The computer-readable storage medium may include program instructions, data files, data structures, etc., independently or in combination. Examples of computer-readable storage media include magnetic media such as hard disks, floppy disks, and magnetic tape; optical media such as CD-ROMs and DVDs; magneto-optical media such as floptical disks; and hardware devices specifically configured to store and execute program instructions, such as ROM, RAM, and flash memory. The hardware devices may be configured to operate as one or more software modules to perform the processes of the present invention, and vice versa. [Industrial Applicability]

[0585] The present invention may be applied to electronic devices that encode / decode video.

Claims

1. 1. A video decoding method comprising: determining a first prediction unit and a second prediction unit in a decoded block; deriving first motion information of the first prediction unit and second motion information of the second prediction unit of the decoded block; obtaining a predicted sample in the decoded block based on the first motion information and the second motion information; obtaining the first motion information of the first prediction unit based on a first merging candidate, the first merging candidate being selected from a plurality of merging candidates included in a merging candidate list by first index information; obtaining the second motion information of the second prediction unit based on a second merging candidate, the second merging candidate being designated from a plurality of merging candidates included in the merging candidate list by second index information; If the value of the second index information is smaller than the value of the first index information, the index of the second merging candidate is equal to the value of the second index information; A video decoding method comprising: deriving the predicted sample by weighting and calculating a first predicted sample derived based on the first motion information and a second predicted sample derived based on the second motion information.

2. 2. The video decoding method of claim 1, wherein, when the prediction sample is included in a boundary area between the first prediction unit and the second prediction unit, the prediction sample is derived by weighting and calculating the first prediction sample derived based on the first motion information and the second prediction sample derived based on the second motion information.

3. 3. The video decoding method of claim 2, wherein a first weighting value to be applied to the first predicted sample is determined based on an x-axis coordinate and a y-axis coordinate of the predicted sample.

4. 4. The video decoding method of claim 3, further comprising deriving a second weighting value to be applied to the second predicted sample by subtracting the first weighting value from a constant.

5. 1. A video encoding method comprising: determining a first prediction unit and a second prediction unit in a coding block; deriving first motion information of the first prediction unit and second motion information of the second prediction unit of the coding block; obtaining a predicted sample in the coding block based on the first motion information and the second motion information; obtaining the first motion information of the first prediction unit based on a first merging candidate among a plurality of merging candidates included in a merging candidate list; obtaining the second motion information of the second prediction unit based on a second merging candidate among a plurality of merging candidates included in the merging candidate list; encoding first index information for specifying the first merging candidate and second index information for specifying the second merging candidate, If the value of the second index information is smaller than the value of the first index information, the index of the second merging candidate is equal to the value of the second index information; A video encoding method comprising: deriving the predicted sample by weighting and calculating a first predicted sample derived based on the first motion information and a second predicted sample derived based on the second motion information.

6. A video decoding device comprising: an inter prediction unit; the inter prediction unit is used for determining a first prediction unit and a second prediction unit in a decoded block, deriving first motion information of the first prediction unit and second motion information of the second prediction unit in the decoded block, and obtaining a prediction sample in the decoded block based on the first motion information and the second motion information; obtaining the first motion information of the first prediction unit based on a first merging candidate, the first merging candidate being selected from a plurality of merging candidates included in a merging candidate list by first index information; obtaining the second motion information of the second prediction unit based on a second merging candidate, the second merging candidate being selected from a plurality of merging candidates included in the merging candidate list by second index information; If the value of the second index information is smaller than the value of the first index information, the index of the second merging candidate is equal to the value of the second index information; A video decoding device deriving the predicted sample by weighting and calculating a first predicted sample derived based on the first motion information and a second predicted sample derived based on the second motion information.

7. 1. A video encoding device, comprising: a memory storing instructions; and a processor, the processor executing the instructions to determining a first prediction unit and a second prediction unit in a coding block; deriving first motion information of the first prediction unit and second motion information of the second prediction unit of the coding block; and obtaining a prediction sample in the coding block based on the first motion information and the second motion information, wherein: obtaining the first motion information of the first prediction unit based on a first merging candidate among a plurality of merging candidates included in a merging candidate list; obtaining the second motion information of the second prediction unit based on a second merging candidate among a plurality of merging candidates included in the merging candidate list; encoding first index information for specifying the first merging candidate and second index information for specifying the second merging candidate, If the value of the second index information is smaller than the value of the first index information, the index of the second merging candidate is equal to the value of the second index information; A video encoding apparatus for deriving the predicted sample by weighting and calculating a first predicted sample derived based on the first motion information and a second predicted sample derived based on the second motion information.

8. A computer-readable storage medium containing a computer program and a bitstream, A computer-readable storage medium, the computer program, when executed by a processor, causing the processor to perform the video encoding method of claim 5 to generate the bitstream.

Citation Information

Patent Citations

  • Image prediction method and device

    WO2020083403A1

  • Side information signaling for inter prediction with geometric partitioning

    WO2020094052A1

  • An encoder, a decoder and corresponding methods for inter prediction

    WO2020106190A1

  • Triangle motion information for video coding

    WO2020118064A1

  • Method and apparatus for video coding

    WO2020123220A1