Video signal encoding / decoding method and apparatus therefor
By partitioning the video coding block into multiple prediction units and utilizing a combined prediction method of merging candidate lists and weighted operations, the problem of insufficient compression ratio of HEVC in high-definition video services is solved, achieving more efficient video signal encoding and decoding.
Patent Information
- Application Number
- CN202410870361.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2018-12-21
- Filing Date
- 2019-12-20
- Publication Date
- 2024-09-10
AI Technical Summary
Existing video coding standards such as HEVC exhibit performance limitations in high-definition video services, making it difficult to effectively improve video compression rates and leading to an increase in data volume.
A combined prediction method is adopted, which divides the coding block into multiple prediction units, derives motion information by merging candidate lists, obtains prediction samples using multiple merged candidates, and improves inter-frame prediction efficiency through weighted operations.
It improves the inter-frame prediction efficiency of video signals and enhances video compression rate and coding efficiency by combining prediction methods and multi-partition technology.
Smart Images

Figure CN118632018A_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application with the application date of December 20, 2019, application number "201980037808.8", and title "Video signal encoding / decoding method and device thereof". Technical Field
[0002] The present disclosure relates to a video signal encoding / decoding method and a device thereof. Background Art
[0003] As display panels become larger, higher quality video services are needed. The biggest problem with high-definition video services is that the amount of data has greatly increased. In order to solve the above problems, research on improving video compression rates is being actively conducted. As a representative example, the Joint Collaboration Team on Video Coding (JCT-VC) was established in 2009 by the Moving Picture Experts Group (MPEG) and the Video Coding Experts Group (VCEG) under the International Telecommunication Union-Telecommunication (ITU-T). JCT-VC proposed High Efficiency Video Coding (HEVC), a video compression standard with a compression performance that is about twice that of H.264 / AVC and was approved as a standard on January 25, 2013. However, with the rapid development of high-definition video services, the performance of HEVC has gradually shown its limitations. Summary of the invention
[0004] Technical Purpose
[0005] An object of the present disclosure is to provide a combined prediction method for combining a plurality of prediction methods when encoding / decoding a video signal and a device for executing the method.
[0006] An object of the present disclosure is to provide a method for partitioning a coding block into a plurality of prediction units when encoding / decoding a video signal and a device for performing the method.
[0007] An object of the present disclosure is to provide a method for obtaining prediction samples using a plurality of merging candidates when encoding / decoding a video signal and a device for performing the method.
[0008] Technical objectives obtainable from the present disclosure are not limited to the above-mentioned technical objectives, and other unmentioned technical objectives may be clearly understood by a person of ordinary skill in the technical field to which the present disclosure pertains from the following description.
[0009] Technical Solution
[0010] A video signal decoding / encoding method according to the present disclosure may include: partitioning a coding block into a first partition and a second partition; deriving a merge candidate list for the coding block; determining a first merge candidate and a second merge candidate by using the merge candidate list; deriving a first prediction sample and a second prediction sample based on first motion information of the first merge candidate and second motion information of the second merge candidate; and obtaining a third prediction sample for the coding block based on the first prediction sample and the second prediction sample. In this regard, the third prediction sample may be obtained based on a weighted sum operation of the first prediction sample and the second prediction sample, and the weights applied to the first prediction sample and the second prediction sample may be different between when the third prediction sample is included in the first partition and when the third prediction sample is included in the second partition.
[0011] In the video signal decoding / encoding method according to the present disclosure, a partition line that partitions the coding block into the first partition and the second partition may be at least one of a vertical line, a horizontal line, or a diagonal line.
[0012] The video signal decoding / encoding method according to the present disclosure may include: decoding first index information for specifying a first merge candidate and second index information for specifying a second merge candidate from a bitstream. In this regard, when a value of the second index information is equal to or greater than a value of the first index information, the second merge candidate may have a value obtained by adding 1 to the value of the second index information as an index.
[0013] In the video signal decoding / encoding method according to the present disclosure, the second merge candidate may be derived by adding an offset to an index of the first merge candidate or subtracting the offset from the index of the first merge candidate.
[0014] In the video signal decoding / encoding method according to the present disclosure, the number of merging candidates included in the merging candidate list may be lower than a predefined number.
[0015] In the video signal decoding / encoding method according to the present disclosure, when the third prediction sample is included in the above-mentioned first partition, the weight applied to the first prediction sample may be set to be greater than the weight applied to the second prediction sample, and when the third prediction sample is included in the second partition, the weight applied to the above-mentioned second prediction sample may be set to be greater than the weight applied to the first prediction sample.
[0016] It is to be understood that the foregoing summarized features are exemplary aspects of the following detailed description of the present disclosure and do not limit the scope of the present disclosure.
[0017] Technical Effects
[0018] According to the present disclosure, a combined prediction method that combines multiple prediction methods can be provided to improve inter-frame prediction efficiency.
[0019] According to the present disclosure, a method of partitioning a coding block into a plurality of prediction blocks and deriving motion information of each prediction block may be provided to improve inter-frame prediction efficiency.
[0020] According to the present disclosure, a method for obtaining prediction samples by using a plurality of merging candidates may be provided to improve inter-frame prediction efficiency.
[0021] Effects obtainable from the present disclosure may not be limited to the above-mentioned effects, and other unmentioned effects may be clearly understood from the following description by a person of ordinary skill in the technical field to which the present disclosure pertains. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a diagram illustrating a block diagram of a video encoding device (encoder) according to an embodiment of the present disclosure.
[0023] Figure 2 is a diagram showing a block diagram of a video decoding device (decoder) according to an embodiment of the present disclosure.
[0024] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present disclosure.
[0025] Figure 4 is a diagram illustrating various partition types of a coding block.
[0026] Figure 5 is a diagram illustrating an example of aspects of partitioning a CTU.
[0027] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present disclosure.
[0028] Figure 7 is a flow chart of the process of deriving current block motion information in merge mode.
[0029] Figure 8 is a diagram illustrating candidate blocks for deriving merge candidates.
[0030] Fig. 9 is a diagram for explaining the updating aspect of the motion information table.
[0031] Fig.10 is a diagram illustrating an updating aspect of a motion information table.
[0032] Fig.11 : is a diagram showing an example of updating the index of the saved motion information candidate.
[0033] Fig.12 is a diagram showing the positions of representative sub-blocks.
[0034] Fig.13An example of generating a motion information table in the inter prediction mode is shown.
[0035] Fig.14 is a diagram illustrating an example of adding motion information candidates included in a long-term motion information table to a merge candidate list.
[0036] Fig.15 is a diagram illustrating an example of performing redundancy check on only a part of merge candidates.
[0037] Fig.16 is a diagram showing an example in which a redundancy check on a specific merge candidate is omitted.
[0038] Fig.17 is a diagram illustrating an example in which a candidate block included in the same merge processing region as a current block is set to be unusable as a merge candidate.
[0039] Fig.18 is a diagram illustrating an example of deriving a merge candidate for a current block when the current block is included in a merge processing region.
[0040] Fig.19 is a diagram showing a temporary motion information table.
[0041] Fig. 20 is a diagram showing an example of making the motion information table and the temporary motion information table consistent.
[0042] Fig.21 is a flowchart of an intra-frame prediction method according to an embodiment of the present disclosure.
[0043] Fig. 22 is a diagram showing an intra prediction mode.
[0044] Fig.23 is a diagram illustrating a wide-angle intra prediction mode.
[0045] Fig.24 is a diagram illustrating application aspects of PDPC.
[0046] Fig.25 is a diagram showing aspects of application of weights.
[0047] Fig.26 An example is shown in which different weights are assigned to subblocks according to whether a merge candidate has bidirectional motion information.
[0048] Fig. 27 An example of assigning different weights to subblocks according to the intra prediction mode of the current block is shown.
[0049] Fig.28 is a diagram illustrating an example in which a current block is partitioned into a plurality of sub-partitions.
[0050] Fig.29 An example is shown in which the second merge candidate is specified in consideration of the search order of the candidate blocks.
[0051] Fig.30 An example of selecting a first merge candidate and a second merge candidate from merge candidates derived from non-neighboring blocks is shown.
[0052] Fig.31 is a diagram showing an example in which merge candidates are rearranged.
[0053] Fig.32 is a diagram for explaining an example of determining a second merge candidate.
[0054] Fig.33 is a diagram illustrating an example of determining a weight applied to a prediction block based on the shape of a candidate block.
[0055] Fig.34 is a diagram illustrating an example of differently setting a weight applied to a prediction block by sub-partition.
[0056] Fig.35 is a diagram illustrating an example in which a merge candidate is replaced. DETAILED DESCRIPTION
[0057] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
[0058] Image encoding and decoding are performed on a block basis. In an example, for a coding block, a transform block, or a prediction block, encoding / decoding processes such as transform, quantization, prediction, in-loop filtering, reconstruction, etc. may be performed.
[0059] Hereinafter, the encoding / decoding target block is referred to as a “current block.” In an example, the current block may refer to a coding block, a transform block, or a prediction block according to a current process of encoding / decoding.
[0060] In addition, the term "unit" used in this specification means a basic unit for performing a specific encoding / decoding process, and "block" can be understood to mean a sample array having a predetermined size. Unless otherwise specified, "block" and "unit" can be used interchangeably. In examples, in the examples described later, the coding block and the coding unit can be understood to have the same meaning as each other.
[0061] Figure 1 is a diagram showing a block diagram of an image encoding device (encoder) according to an embodiment of the present disclosure.
[0062] Reference Figure 1, the image encoding apparatus 100 may include a picture partition unit 110, prediction units 120 and 125, a transform unit 130, a quantization unit 135, a rearrangement 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.
[0063] Figure 1 The components described in the figure are shown independently in order to illustrate different characteristic functions in the image encoding device, and the figure does not indicate that each component is composed of a separate hardware or a software unit. That is, for the sake of convenience of explanation, each component is only listed, and at least two of the components may constitute one component, or one component may be divided into multiple components that can perform its functions. Even embodiments in which the components are integrated and embodiments in which the components are divided are included in the scope of the present disclosure unless they depart from the spirit of the present disclosure.
[0064] In addition, some components are not necessary parts for performing the necessary functions of the present disclosure, but are optional components only for improving performance. The present disclosure can be implemented using necessary components for realizing the spirit of the present disclosure other than components only for improving performance, and a structure including only necessary components other than optional components only for improving performance is also included in the scope of the present disclosure.
[0065] The picture partition unit 110 may partition an input picture into at least one processing unit. In this regard, a processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). In the picture partition unit 110, a single picture may be partitioned into a combination of a plurality of coding units, prediction units, and transform units, and the picture may be encoded by selecting a combination of coding units, prediction units, and transform units according to a predetermined condition (e.g., a cost function).
[0066] For example, a single picture may be partitioned into a plurality of coding units. In order to partition a picture into coding units, a recursive tree structure such as a quadtree structure may be used, and a coding unit derived from a root such as a single image or a maximum coding unit may be partitioned into other coding units and may have as many child nodes as the partitioned coding units. Coding units that are no longer partitioned according to certain restrictions become leaf nodes. That is, when it is assumed that only square partitions are available for a single coding unit, a single coding unit may be partitioned into up to four other coding units.
[0067] Hereinafter, in an embodiment of the present disclosure, a coding unit may be used as a unit for encoding or may be used as a unit for decoding.
[0068] The prediction units may be obtained by partitioning a single coding unit into at least one square or rectangle having the same size, or may be partitioned into prediction units in such a manner that one prediction unit may be different in shape and / or size from another prediction unit.
[0069] When a prediction unit is generated based on a coding block on which intra prediction is being performed, when the coding unit is not a minimum coding unit, intra prediction may be performed without performing partitioning into a plurality of N×N prediction units.
[0070] The prediction units 120 and 125 may include an inter-frame prediction unit 120 that performs inter-frame prediction and an intra-frame prediction unit 125 that performs intra-frame prediction. It may be determined whether inter-frame prediction or intra-frame prediction is performed on the prediction unit, and detailed information (e.g., intra-frame prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. In this regard, the processing unit on which the prediction is performed may be different from the processing unit in which the prediction method and its details are determined. For example, the prediction method, prediction mode, etc. may be determined based on the prediction unit, and the prediction may be performed based on the transform unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transform unit 130. In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded by the entropy encoding unit 165 using the residual value and may be sent to the decoder. When a specific encoding mode is used, the original block is encoded as it is without generating a prediction block through the prediction unit 120 or 125 and is sent to the decoding unit.
[0071] The inter-frame prediction unit 120 may predict the prediction unit based on information about at least one of a previous picture and a subsequent picture of the current picture, or in some cases, may predict the prediction unit based on information about some coding regions in the current picture. The inter-frame prediction unit 120 may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.
[0072] The reference picture interpolation unit may receive reference picture information from the memory 155 and generate pixel information of integer pixels or smaller pixels from the reference picture. In the case of luma pixels, an 8-tap DCT-based interpolation filter with different coefficients may be used to generate pixel information about integer pixels or smaller pixels for 1 / 4 pixel units. In the case of chroma signals, a 4-tap DCT-based interpolation filter with different filter coefficients may be used to generate pixel information about integer pixels or smaller pixels for 1 / 8 pixel units.
[0073] The motion prediction unit may perform motion prediction based on the reference picture interpolated by the reference picture interpolation unit. As a method for calculating a motion vector, various methods may be used, such as a full search based block matching algorithm (FBMA), a three-step search (TSS) algorithm, a new three-step search (NTS) algorithm, and the like. Based on the interpolated pixels, the motion vector may have a motion vector value in units of 1 / 2 or 1 / 4 pixels. The motion prediction unit may predict the current prediction unit by changing the motion prediction method. As a motion prediction method, various methods may be used, such as a skip method, a merge method, an advanced motion vector prediction (AMVP) method, an intra-block copy method, and the like.
[0074] The intra prediction unit 125 may generate a prediction unit based on information about reference pixels around the current block (pixel information in the current picture). When the neighboring block of the current prediction unit is a block on which inter prediction is performed, and thus the reference pixel is a pixel on which inter prediction is performed, the reference pixel included in the block on which inter prediction is performed may be replaced with information about reference pixels of the neighboring block on which intra prediction is performed. In other words, when the reference pixel is unavailable, at least one reference pixel among the available reference pixels may be used to replace the unavailable reference pixel information.
[0075] The prediction mode in the intra prediction may include a directional prediction mode using reference pixel information according to a prediction direction and a non-directional mode that does not use directional information when performing prediction. The mode for predicting luma information may be different from the mode for predicting chroma information. In order to predict chroma information, information about the intra prediction mode for predicting luma information or information about the predicted luma signal may be used.
[0076] When performing intra prediction, when the size of the prediction unit is the same as the transform unit, intra prediction can be performed on the prediction unit based on pixels located to the left, above the left, and above the prediction unit. However, when performing intra prediction, when the size of the prediction unit is different from the transform unit, intra prediction can be performed by using reference pixels based on the transform unit. In addition, intra prediction using N×N partitions can be used only for the minimum coding unit.
[0077] In the intra prediction method, a prediction block may be generated after an adaptive intra smoothing (AIS) filter is applied to reference pixels according to a prediction mode. The type of the AIS filter applied to the reference pixels may vary. In order to perform the intra prediction method, an intra prediction mode for a current prediction unit may be predicted from intra prediction modes of prediction units existing around the current prediction unit. When the prediction mode for the current prediction unit is predicted by using mode information predicted from neighboring prediction units, when the intra prediction mode for the current prediction unit is the same as the intra prediction mode of the neighboring prediction unit, information indicating that the current prediction unit and the neighboring prediction unit have the same prediction mode may be sent by using predetermined flag information. When the prediction mode for the current prediction unit is different from the prediction mode of the neighboring prediction unit, entropy coding may be performed to encode information about the prediction mode for the current block.
[0078] Also, a residual block including information on a residual value which is a difference value between a prediction unit predicted by the prediction unit 120 or 125 and an original block of the prediction unit may be generated. The generated residual block may be input to the transform unit 130.
[0079] The transform unit 130 may perform a transform on a residual block by using a transform method such as a discrete cosine transform (DCT) or a discrete sine transform (DST), wherein the residual block includes information about a residual value between an original block and a prediction unit generated by the prediction unit 120 or 125. In this regard, the DCT transform kernel includes at least one of DCT2 or DCT8, and the DST transform kernel includes DST7. Whether to apply DCT or DST in order to perform a transform on the residual block may be determined based on information about an intra prediction mode of a prediction unit used to generate the residual block. The transform for the residual block may be skipped. A flag indicating whether to skip the transform for the residual block may be encoded. Transform skipping may be allowed for a residual block whose size is less than or equal to a threshold, a residual block of a luminance component, or a residual block of a chrominance component in a 4:4:4 format.
[0080] The quantization unit 135 may perform quantization on the value transformed into the frequency domain by the transformation unit 130. The quantization coefficient may vary according to the importance of the block or image. The value calculated in the quantization unit 135 may be provided to the inverse quantization unit 140 and the rearrangement unit 160.
[0081] The rearrangement unit 160 may perform rearrangement on coefficient values with respect to the quantized residual values.
[0082] The rearrangement unit 160 may change the coefficients in the two-dimensional block form into the coefficients in the one-dimensional vector form by a coefficient scanning method. For example, the rearrangement unit 160 may scan from the DC coefficient to the coefficients in the high frequency domain by using a zigzag scanning method so as to change the coefficients into the form of a one-dimensional vector. Depending on the size of the transform unit and the intra-frame prediction mode, vertical direction scanning or horizontal direction scanning may be used instead of zigzag scanning, wherein the coefficients in the two-dimensional block form are scanned in the column direction in the vertical direction scanning and the coefficients in the two-dimensional block form are scanned in the row direction in the horizontal direction scanning. In other words, which scanning method to use among zigzag scanning, vertical direction scanning, and horizontal direction scanning may be determined according to the size of the transform unit and the intra-frame prediction mode.
[0083] The entropy encoding unit 165 may perform entropy encoding based on the value calculated by the rearrangement unit 160. The entropy encoding may use various encoding methods, for example, exponential Golomb coding, context adaptive variable length coding (CAVLC), or context adaptive binary arithmetic coding (CABAC).
[0084] The entropy coding unit 165 may encode various types of information obtained from the rearrangement unit 160 and the prediction units 120 and 125 (such as information about residual value coefficients and information about block types of coding units, information about prediction modes, information about partition units, information about prediction units, information about transform units, information about motion vectors, information about reference frames, information about block interpolation, filtering information, and the like).
[0085] The entropy encoding unit 165 may entropy encode coefficients of the coding unit input from the rearrangement unit 160 .
[0086] The inverse quantization unit 140 may perform inverse quantization on the value quantized in the quantization unit 135, and the inverse transform unit 145 may perform inverse transform on the value transformed in the transform unit 130. The residual value generated by the inverse quantization unit 140 and the inverse transform unit 145 may be added to the prediction unit predicted by the motion estimation unit, the motion compensation unit, or the intra prediction unit included in the prediction units 120 and 125 in order to generate a reconstructed block.
[0087] The filter unit 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).
[0088] The deblocking filter can remove block distortion that occurs due to the boundaries between blocks in the reconstructed picture. In order to determine whether to perform deblocking, it can be determined whether to apply the deblocking filter to the current block based on the pixels included in the number of rows and columns included in the block. When the deblocking filter is applied to the block, a strong filter or a weak filter is applied according to the required deblocking filter strength. In addition, when applying the deblocking filter, when horizontal direction filtering and vertical direction filtering are performed, the horizontal direction filtering and the vertical direction filtering can be configured to be processed in parallel.
[0089] The offset correction unit can correct the original image by offsetting in pixels relative to the image on which deblocking is performed. In order to perform offset correction on a specific picture, a method of applying an offset to an area determined after partitioning pixels of the image into a predetermined number of areas or a method of applying an offset according to edge information of each pixel can be used.
[0090] Adaptive loop filtering (ALF) may be performed based on a value obtained by comparing a filtered reconstructed image with an original image. Pixels included in an image may be partitioned into predetermined groups, a filter to be applied to each of the groups may be determined, and filtering may be performed separately for each group. Information on whether ALF is applied may be sent for each coding unit (CU) of a luminance signal, and the shape and filter coefficient of the ALF filter to be applied may vary based on each block. Alternatively, an ALF filter having the same shape (fixed shape) may be applied regardless of the characteristics of the block to which the filter is applied.
[0091] In the memory 155, a reconstructed block or picture calculated by the filter unit 150 may be stored. When inter prediction is performed, the stored reconstructed block or picture may be provided to the prediction unit 120 or 125.
[0092] Figure 2 is a diagram showing a block diagram of an image decoding device (decoder) according to an embodiment of the present disclosure.
[0093] Reference Figure 2 , the image decoding apparatus 200 may include: an entropy decoding unit 210 , a rearrangement unit 215 , an inverse quantization unit 220 , an inverse transform unit 225 , prediction units 230 and 235 , a filter unit 240 , and a memory 245 .
[0094] When an image bitstream is input from an encoder, the input bitstream may be decoded according to an inverse process of the image encoding apparatus.
[0095] The entropy decoding unit 210 may perform entropy decoding according to an inverse process of entropy encoding performed by an entropy encoding unit of an image encoder. For example, in association with a method performed by an image encoding apparatus, various methods such as exponential Golomb coding, context adaptive variable length coding (CAVLC), or context adaptive binary arithmetic coding (CABAC) may be applied.
[0096] The entropy decoding unit 210 may decode information about intra prediction and inter prediction performed by the encoder.
[0097] The rearrangement unit 215 may perform rearrangement on the bitstream entropy-decoded by the entropy decoding unit 210 based on the rearrangement method used in the encoder. Coefficients represented in the form of a one-dimensional vector may be reconstructed and rearranged into coefficients in the form of a two-dimensional block. The rearrangement unit 215 may perform rearrangement by receiving information related to coefficient scanning performed in the encoder and performing inverse scanning based on the scanning order performed in the encoder.
[0098] The inverse quantization unit 220 may perform inverse quantization based on the quantization parameter received from the encoder and the coefficient value of the rearranged block.
[0099] The inverse transform unit 225 may perform an inverse transform (i.e., inverse DCT or inverse DST) opposite to the transform (i.e., DCT or DST) performed on the quantization result by the transform unit in the image encoder. In this regard, the DCT transform core may include at least one of DCT2 or DCT8, and the DST transform core may include DST7. Optionally, when the transform is skipped in the image encoder, the inverse transform is not performed in the inverse transform unit 225. The inverse transform may be performed based on the transform unit determined by the image encoder. The inverse transform unit 225 of the image decoder may selectively perform a transform method (e.g., DCT or DST) according to a plurality of pieces of information such as a prediction method, a size of a current block, a prediction direction, etc.
[0100] The prediction unit 230 or 235 may generate a prediction block based on information related to the prediction block received from the entropy decoding unit 210 and information about a previously decoded block or picture received from the memory 245 .
[0101] As described above, as an operation of the image encoder, when intra prediction is performed, when the size of the prediction unit is the same as the transform unit, intra prediction may be performed on the prediction unit based on pixels located to the left, above the left, and above the prediction unit. However, when intra prediction is performed, when the size of the prediction unit is different from the transform unit, intra prediction may be performed by using reference pixels based on the transform unit. In addition, intra prediction using N×N partitions may be used only for the minimum coding unit.
[0102] The prediction units 230 and 235 may include a PU determination module, an inter prediction unit, and an intra prediction unit. The PU determination module may receive various types of information (such as information about the prediction unit, information about the prediction mode of the intra prediction method, information about the motion prediction of the inter prediction method, etc.) input from the entropy decoding unit 210, divide the prediction unit in the current coding unit, and determine whether to perform inter prediction or intra prediction on the prediction unit. By using the information required in the inter prediction of the current prediction unit received from the image encoder, the inter prediction unit 230 may perform inter prediction on the current prediction unit based on information about at least one of a previous picture and a subsequent picture of the current picture including the current prediction unit. Optionally, inter prediction may be performed based on information about some pre-reconstructed areas in the current picture including the current prediction unit.
[0103] In order to perform inter prediction, which method of the skip mode, the merge mode, the AMVP mode, or the intra block copy mode to use as a motion prediction method for a prediction unit included in the coding unit may be determined based on the coding unit.
[0104] The intra prediction unit 235 may generate a prediction block based on information about pixels within the current picture. When the prediction unit is a prediction unit for which intra prediction has been performed, intra prediction may be performed based on information about the intra prediction mode of the prediction unit received from the image encoder. The intra prediction unit 235 may include an adaptive intra smoothing (AIS) filter, a reference pixel interpolation module, or a DC filter. The AIS filter may perform filtering on the reference pixels of the current block, and may determine whether to apply the filter based on the prediction mode for the current prediction unit. When AIS filtering is performed on the reference pixels of the current block, information about the AIS filter received from the image encoder and the prediction mode of the prediction unit may be used. When the prediction mode for the current block is a mode in which AIS filtering is not applied, the AIS filter may not be applied.
[0105] When the prediction mode of the prediction unit is a prediction mode in which intra prediction is performed based on a pixel value obtained by interpolating reference pixels, the reference pixel interpolation unit may interpolate the reference pixels so as to generate reference pixels having an integer or smaller unit. When the prediction mode for the current prediction unit is a prediction mode in which a prediction block is generated without interpolating reference pixels, the reference pixels may not be interpolated. When the prediction mode for the current block is a DC mode, a DC filter may generate a prediction block by filtering.
[0106] The reconstructed block or the reconstructed picture may be provided to the filter unit 240. The filter unit 240 may include a deblocking filter, an offset correction module, and an ALF.
[0107] Information about whether a deblocking filter has been applied to a corresponding block or a corresponding picture and information about whether a strong filter or a weak filter is applied when the deblocking filter is applied may be received from the image encoder. A deblocking filter of an image decoder may receive information about the deblocking filter from the image encoder, and the image decoder may perform deblocking filtering on the corresponding block.
[0108] The offset correction unit may perform offset correction on the reconstructed image based on the type of offset correction applied to the image when encoding is performed, information about the offset value, and the like.
[0109] ALF may be applied to the coding unit based on information on whether ALF is applied, information on an ALF coefficient, etc. received from the encoder. The above ALF information may be provided by being included in a specific parameter set.
[0110] In the memory 245 , the reconstructed picture or the reconstructed block may be stored so as to be used as a reference picture or a reference block, and the reconstructed picture may be provided to the output unit.
[0111] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present disclosure.
[0112] The largest coding block may be defined as a coding tree block. A single picture may be partitioned into a plurality of coding tree units (CTUs). A CTU may be a coding unit of the largest size and may be referred to as a largest coding unit (LCU). Figure 3 is a diagram illustrating an example of partitioning a single picture into a plurality of CTUs.
[0113] The size of a CTU may be defined at a picture level or a sequence level. Similarly, information indicating the size of a CTU may be signaled via a picture parameter set or a sequence parameter set.
[0114] In an example, the size of the CTU for the entire picture within the sequence may be set to 128×128. Alternatively, any one of 128×128 or 256×256 may be determined as the size of the CTU at the picture level. In an example, the CTU may be set to have a size of 128×128 in the first picture and a size of 256×256 in the second picture.
[0115] The coding block may be generated by partitioning the CTU. The coding block represents a basic unit for performing encoding / decoding. In an example, prediction or transformation may be performed for each coding block, or a prediction coding mode may be determined for each coding block. In this regard, the prediction coding mode represents a method for generating a predicted image. In an example, the prediction coding mode may include intra prediction, inter prediction, current picture reference (CPR), intra block copy (IBC), or combined prediction. For a coding block, a prediction block of the coding block may be generated by using a prediction coding mode of at least one of intra prediction, inter prediction, current picture reference, or combined prediction.
[0116] Information indicating the prediction coding mode for the current block may be signaled in a bitstream. In an example, the information may be a 1-bit flag indicating whether the prediction coding mode is an intra mode or an inter mode. When the prediction coding mode for the current block is determined to be an inter mode, current picture reference or combined prediction may be available.
[0117] The current picture reference sets the current picture as the reference picture, and obtains the prediction block of the current block from the area within the current picture that has been encoded / decoded. In this regard, the current picture refers to the picture that includes the current block. Information indicating whether the current picture reference is applied to the current block can be signaled in a bitstream. In an example, the information can be a 1-bit flag. When the flag is true, the prediction coding mode for the current block can be determined as the current picture reference, and when the flag is false, the prediction coding mode for the current block can be determined as inter-frame prediction.
[0118] Alternatively, the prediction coding mode of the current block may be determined based on the reference picture index. In an example, when the reference picture index indicates the current picture, the prediction coding mode for the current block may be determined as the current picture reference. When the reference picture index indicates a picture other than the current picture, the prediction coding mode for the current block may be determined as the inter-frame prediction. In other words, the current picture reference is a prediction method using information about an already encoded / decoded area within the current picture, and the inter-frame prediction is a prediction method using information about another already encoded / decoded picture.
[0119] Combined prediction refers to a combined coding mode that combines at least two of intra prediction, inter prediction, and current picture reference. In the example, when combined prediction is applied, a first prediction block may be generated based on any one of intra prediction, inter prediction, or current picture reference, and a second prediction block may be generated based on another one of intra prediction, inter prediction, or current picture reference. When the first prediction block and the second prediction block are generated, a final prediction block may be generated by calculating an average or weighted sum of the first prediction block and the second prediction block. Information indicating whether combined prediction is applied to the current block may be signaled in a bitstream. The information may be a 1-bit flag.
[0120] Figure 4 is a diagram illustrating various partition types of a coding block.
[0121] The coding block may be partitioned into a plurality of coding blocks based on quadtree partitioning, binary tree partitioning, or ternary tree partitioning. The partitioned coding block may be partitioned again into a plurality of coding blocks based on quadtree partitioning, binary tree partitioning, or ternary tree partitioning.
[0122] Quadtree partitioning represents a method of partitioning the current block into four blocks. As a result of quadtree partitioning, the current block can be partitioned into four square partitions (refer to Figure 4 of "SPLIT_QT").
[0123] Binary tree partitioning refers to a method of partitioning a current block into two blocks. An operation of partitioning a current block into two blocks along a vertical direction (i.e., using a vertical line passing through the current block) may be referred to as a vertical binary tree partitioning, and an operation of partitioning a current block into two blocks along a horizontal direction (i.e., using a horizontal line passing through the current block) may be referred to as a horizontal binary tree partitioning. As a result of the binary tree partitioning, the current block may be partitioned into two non-square partitions. Figure 4 "SPLIT_BT_VER" is a diagram showing the result of binary tree partitioning in the vertical direction, and Figure 4 “SPLIT_BT_HOR” is a diagram showing the result of binary tree partitioning in the horizontal direction.
[0124] Ternary tree partitioning means a method of partitioning a current block into three blocks. An operation of partitioning a current block into three blocks along a vertical direction (i.e., using two vertical lines passing through the current block) may be referred to as vertical ternary tree partitioning, and an operation of partitioning a current block into three blocks along a horizontal direction (i.e., using two horizontal lines passing through the current block) may be referred to as horizontal ternary tree partitioning. As a result of the ternary tree partitioning, the current block may be partitioned into three non-square partitions. In this regard, the width / height of the partition located at the center of the current block may be twice the width / height of the other partitions. Figure 4"SPLIT_TT_VER" is a diagram showing the result of the vertical ternary tree partitioning, and Figure 4 “SPLIT_TT_HOR” is a diagram showing the result of ternary tree partitioning in the horizontal direction.
[0125] The number of partitions of a CTU may be defined as a partition depth. The maximum partition depth of a CTU may be determined at a sequence level or a picture level. Thus, the maximum partition depth of a CTU may vary based on a sequence or a picture.
[0126] Optionally, the maximum partition depth may be determined independently for each partitioning method. In an example, the maximum partition depth allowed for quadtree partitioning may be different from the maximum partition depth allowed for binary tree partitioning and / or ternary tree partitioning.
[0127] The encoder may signal information indicating at least one of a partition type and a partition depth of the current block in a bitstream. The decoder may determine a partition type and a partition depth of the CTU based on the information obtained by parsing the bitstream.
[0128] Figure 5 is a diagram illustrating an example of aspects of partitioning a CTU.
[0129] An operation of partitioning a coding block by using quadtree partitioning, binary tree partitioning, and / or ternary tree partitioning may be referred to as multi-tree partitioning.
[0130] A coding block generated by partitioning a coding block by applying multi-tree partitioning may be referred to as a sub coding block. When the partition depth of the coding block is k, the partition depth of the sub coding block is set to k+1.
[0131] On the contrary, for a coding block having a partition depth of k+1, a coding block having a partition depth of k may be referred to as a parent coding block.
[0132] The partition type of the current coding block may be determined based on at least one of the partition type of the parent coding block and the partition type of the adjacent coding block. In this regard, the adjacent coding block may be a block adjacent to the current coding block, and includes at least one of an upper adjacent block, a left adjacent block, or an adjacent block adjacent to the upper left corner of the current coding block. In this regard, the partition type may include whether quadtree partitioning is applied, whether binary tree partitioning is applied, the direction of binary tree partitioning, whether ternary tree partitioning is applied, or the direction of ternary tree partitioning.
[0133] In order to determine the partition type of the coding block, information indicating whether the coding block is partitioned can be signaled in the bitstream. This information is a 1-bit flag "split_cu_flag", and when the flag is true, it can indicate that the coding block is partitioned by a multi-tree partitioning method.
[0134] When split_cu_flag is true, information indicating whether the coding block is partitioned by quadtree partitioning may be signaled in the bitstream. This information is a 1-bit flag split_qt_flag, and when this flag is true, the coding block may be partitioned into four blocks.
[0135] In the example, Figure 5 In the example shown in , the CTU is partitioned by quadtree partitioning, and thus four coding blocks with a partition depth of 1 are generated. In addition, it is shown that the quadtree partitioning is applied again to the first coding block and the fourth coding block of the four coding blocks generated by the quadtree partitioning. As a result, four coding blocks with a partition depth of 2 can be generated.
[0136] In addition, by applying quadtree partitioning again to the coding block with a partition depth of 2, a coding block with a partition depth of 3 may be generated.
[0137] When quadtree partitioning is not applied to a coding block, it may be determined whether to perform binary tree partitioning or ternary tree partitioning for the coding block according to at least one of the size of the coding block, whether the coding block is located at a picture boundary, the maximum partition depth, or the partition type of the neighboring block. When it is determined that binary tree partitioning or ternary tree partitioning is performed for the coding block, information indicating the partition direction may be sent with a bitstream signal. The information may be a 1-bit flag mtt_split_cu_vertical_flag. Based on the flag, it may be determined whether the partition direction is vertical or horizontal. In addition, information indicating which of binary tree partitioning or ternary tree partitioning is applied to the coding block may be sent with a bitstream signal. The information may be a 1-bit flag mtt_split_cu_binary_flag. Based on the flag, it may be determined whether binary tree partitioning is applied to the coding block or ternary tree partitioning is applied to the coding block.
[0138] In the example, Figure 5 In the example shown in , vertical binary tree partitioning is applied to a coding block with a partition depth of 1, vertical ternary tree partitioning is applied to a left coding block in the coding blocks generated by partitioning, and vertical binary tree partitioning is applied to a right coding block.
[0139] Inter prediction is a prediction coding mode that predicts a current block by using information about a previous picture. In an example, a block at the same position as the current block in the previous picture (hereinafter, a co-located block) may be set as a prediction block of the current block. Hereinafter, a prediction block generated based on the co-located block of the current block may be referred to as a co-located prediction block.
[0140] In contrast, when an object existing in a previous picture has moved to another position in a current picture, the current block can be effectively predicted by using the motion of the object. For example, when the motion direction and size of the object are determined by comparing the previous picture with the current picture, a prediction block (or a prediction image) of the current block can be generated according to the motion information of the object. Hereinafter, a prediction block generated by using motion information may be referred to as a motion prediction block.
[0141] The residual block may be generated by subtracting the prediction block from the current block. In this regard, in the case where the object moves, the energy of the residual block may be reduced by using the motion prediction block instead of the co-located prediction block, and thus the compression performance of the residual block may be improved.
[0142] As above, the operation of generating a prediction block by using motion information may be referred to as motion estimation prediction. In most inter predictions, a prediction block may be generated based on motion compensation prediction.
[0143] The motion information may include at least one of a motion vector, a reference picture index, a prediction direction, and a bidirectional weighting factor index. The motion vector represents the motion direction and size of an object. The reference picture index specifies a reference picture of a current block among reference pictures included in a reference picture list. The prediction direction indicates any one of unidirectional L0 prediction, unidirectional L1 prediction, or bidirectional prediction (L0 prediction and L1 prediction). At least one of L0 direction motion information and L1 direction motion information may be used according to the prediction direction of the current block. The bidirectional weighting factor index specifies a weighting factor applied to an L0 prediction block and a weighting factor applied to an L1 prediction block.
[0144] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present disclosure.
[0145] Reference Figure 6 The inter-frame prediction method includes: determining an inter-frame prediction mode for a current block S601, obtaining motion information of the current block according to the determined inter-frame prediction mode S602, and performing motion compensation prediction for the current block based on the obtained motion information S603.
[0146] In this regard, the inter prediction mode may refer to various methods for determining motion information of the current block, and include an inter prediction mode using translational motion information, an inter prediction mode using affine motion information. In an example, the inter prediction mode using translational motion information may include a merge mode and a motion vector prediction mode, and the inter prediction mode using affine motion information may include an affine merge mode and an affine motion vector prediction mode. The motion information about the current block may be determined based on a neighboring block adjacent to the current block or information obtained by parsing a bitstream.
[0147] The motion information of the current block may be derived from the motion information of another block. In this regard, the other block may be a block that is encoded / decoded by inter-frame prediction before the current block. An operation of setting the motion information of the current block to be the same as the motion information of the other block may be defined as a merge mode. In addition, an operation of setting the motion vector of the other block to a predicted value of the motion vector of the current block may be defined as a motion vector prediction mode.
[0148] Figure 7 is a flow chart of a process for deriving motion information for a current block in merge mode.
[0149] A merge candidate of the current block may be derived S701. The merge candidate of the current block may be derived from a block encoded / decoded by inter prediction before the current block.
[0150] Figure 8 is a diagram illustrating candidate blocks for deriving merge candidates.
[0151] The candidate block may include at least one of a neighboring block or a non-neighboring block, wherein the neighboring block includes samples adjacent to the current block and the non-neighboring block includes samples not adjacent to the current block. Hereinafter, samples determining the candidate block are defined as basic samples. In addition, basic samples adjacent to the current block are referred to as neighboring basic samples, and basic samples not adjacent to the current block are referred to as non-neighboring basic samples.
[0152] The neighboring basic sample points may be included in the neighboring columns of the leftmost column of the current block or the neighboring rows of the uppermost row of the current block. In an example, when the coordinates of the upper left sample point of the current block are (0,0), at least one of the blocks including the basic sample points at positions (-1,H-1), (W-1,-1), (W,-1), (-1,H) or (-1,-1) may be used as a candidate block. Referring to the diagram, neighboring blocks of indexes 0 to 4 may be used as candidate blocks.
[0153] The non-neighboring basic sample points represent samples whose at least one of the x-axis distance or the y-axis distance from the basic sample points adjacent to the current block has a predefined value. In an example, at least one of a block including a basic sample point whose x-axis distance from the left basic sample point is a predefined value, a block including a non-neighboring sample point whose y-axis distance from the upper basic sample point is a predefined value, or a block including a non-neighboring sample point whose x-axis distance and y-axis distance from the upper left basic sample point are predefined values may be used as a candidate block. The predefined value may be a natural number such as 4, 8, 12, 16, etc. Referring to the accompanying drawings, at least one of the blocks of indexes 5 to 26 may be used as a candidate block.
[0154] Optionally, a candidate block that does not belong to the same coding tree unit as the current block may be set to be unavailable as a merge candidate. In an example, when a base sample is outside the upper boundary of the coding tree unit to which the current block belongs, the candidate block including the base sample may be set to be unavailable as a merge candidate.
[0155] The merge candidate may be derived from a temporally adjacent block included in a picture different from the current block. In an example, the merge candidate may be derived from a co-located block included in a co-located picture. Any one of the reference pictures included in the reference picture list may be set as a co-located picture. Index information identifying a co-located picture in the reference picture may be signaled in a bitstream. Optionally, a reference picture with a predefined index in the reference picture may be determined as a co-located picture.
[0156] The motion information of the merge candidate may be set to be the same as the motion information of the candidate block. In an example, at least one of a motion vector, a reference picture index, a prediction direction, or a bidirectional weight index of the candidate block may be set to the motion information of the merge candidate.
[0157] A merge candidate list including merge candidates may be generated S702.
[0158] The indexes of the merge candidates in the merge candidate list may be assigned according to a predetermined order. In an example, the indexes may be assigned in the order of a merge candidate derived from a left neighboring block, a merge candidate derived from an upper neighboring block, a merge candidate derived from an upper right neighboring block, a merge candidate derived from a lower left neighboring block, a merge candidate derived from an upper left neighboring block, and a merge candidate derived from a temporal neighboring block.
[0159] When multiple merge candidates are included in the merge candidate list, at least one merge candidate among the multiple merge candidates may be selected S703. Specifically, information for specifying any one of the multiple merge candidates may be sent as a bitstream signal. In the example, information merge_idx indicating an index of any one of the merge candidates included in the merge candidate list may be sent as a bitstream signal.
[0160] When the number of merge candidates included in the merge candidate list is less than a threshold value, the motion information candidate included in the motion information table may be added to the merge candidate list as a merge candidate. In this regard, the threshold value may be the maximum number of merge candidates that may be included in the merge candidate list or a value minus an offset from the maximum number of merge candidates. The offset may be a natural number such as 1 or 2.
[0161] The motion information table includes motion information candidates derived from a block encoded / decoded based on inter-frame prediction in a current picture. In an example, motion information of the motion information candidate included in the motion information table may be set to be the same as the motion information of the block encoded / decoded based on inter-frame prediction. In this regard, the motion information may include at least one of a motion vector, a reference picture index, a prediction direction, or a bidirectional weight index.
[0162] The motion information candidates included in the motion information table may also be referred to as inter region merging candidates or prediction region merging candidates.
[0163] The maximum number of motion information candidates that can be included in the motion information table can be predefined in the encoder and the decoder. In an example, the maximum number of motion information candidates that can be included in the motion information table can be 1, 2, 3, 4, 5, 6, 7, 8 or more (e.g., 16).
[0164] Optionally, information indicating a maximum number of motion information candidates that can be included in the motion information table may be signaled in the bitstream. The information may be signaled at a sequence level, a picture level, or a slice level. The information may indicate a maximum number of motion information candidates that can be included in the motion information table. Optionally, the information may indicate a difference between a maximum number of motion information candidates that can be included in the motion information table and a maximum number of merge candidates that can be included in the merge candidate list.
[0165] Alternatively, the maximum number of motion information candidates that can be included in the motion information table may be determined according to a picture size, a slice size, or a coding tree unit size.
[0166] The motion information table may be initialized in units of a picture, a slice, a tile, a brick, a coding tree unit, or a coding tree unit line (row or column). In an example, when a slice is initialized, the motion information table is also initialized, so the motion information table may not include any motion information candidates.
[0167] Optionally, information indicating whether the motion information table is to be initialized may be signaled in the bitstream. The information may be signaled at a slice level, a tile level, a tile level, or a block level. A preconfigured motion information table may be used until the information indicates initialization of the motion information table.
[0168] Alternatively, information about the initial motion information candidate may be signaled in a picture parameter set or a slice header. Although the slice is initialized, the motion information table may include the initial motion information candidate. Therefore, the initial motion information candidate may be used for a block that is the first encoding / decoding target in the slice.
[0169] Optionally, the motion information candidate included in the motion information table of the previous coding tree unit may be set as the initial motion information candidate. In an example, the motion information candidate with the smallest index or the largest index among the motion information candidates included in the motion information table of the previous coding tree unit may be set as the initial motion information candidate.
[0170] The blocks are encoded / decoded in a coding / decoding order, and the blocks encoded / decoded based on the inter prediction may be sequentially set as motion information candidates in the coding / decoding order.
[0171] Fig. 9 is a diagram for explaining the updating aspect of the motion information table.
[0172] For the current block, when inter prediction is performed S901, a motion information candidate may be derived based on the current block S902. The motion information of the motion information candidate may be set to be the same as the motion information of the current block.
[0173] When the motion information table is empty S903 , the motion information candidate derived based on the current block may be added to the motion information table S904 .
[0174] When the motion information table already includes motion information candidates S903, a redundancy check S905 for the motion information of the current block (or the motion information candidates derived based on the current block) may be performed. The redundancy check is to determine whether the motion information of the pre-stored motion information candidates in the motion information table is the same as the motion information of the current block. The redundancy check may be performed for all pre-stored motion information candidates in the motion information table. Optionally, the redundancy check may be performed for motion information candidates whose indexes among the pre-stored motion information candidates in the motion information table exceed or are lower than a threshold. Optionally, the redundancy check may be performed for a predefined number of motion information candidates. In an example, two motion information candidates with the smallest index or with the largest index may be determined as targets for the redundancy check.
[0175] When a motion information candidate having the same motion information as the current block is not included, the motion information candidate derived based on the current block may be added to the motion information table S908. Whether the motion information candidates are the same may be determined based on whether the motion information (e.g., motion vector / reference picture index, etc.) of the motion information candidates are the same.
[0176] In this regard, when the maximum number of motion information candidates has been stored in the motion information table S906, the oldest motion information candidate may be deleted S907, and the motion information candidate derived based on the current block may be added to the motion information table S908. In this regard, the oldest motion information candidate may be a motion information candidate having a maximum or minimum index.
[0177] The motion information candidates may be identified by corresponding indices. When a motion information candidate derived from the current block is added to the motion information table, a minimum index (e.g., 0) may be assigned to the motion information candidate, and the index of the pre-stored motion information candidate may be increased by 1. In this regard, when the maximum number of motion information candidates is already stored in the motion information table, the motion information candidate having the largest index is removed.
[0178] Optionally, when adding a motion information candidate derived from the current block to the motion information table, the maximum index may be assigned to the motion information candidate. In an example, when the number of pre-stored motion information candidates in the motion information table is less than the maximum value, an index having the same value as the number of pre-stored motion information candidates may be assigned to the motion information candidate. Optionally, when the number of pre-stored motion information candidates in the motion information table is equal to the maximum value, an index obtained by subtracting 1 from the maximum value may be assigned to the motion information candidate. Optionally, the motion information candidate having the smallest index is removed, and the indexes of the remaining pre-stored motion information candidates are reduced by 1.
[0179] Fig.10 is a diagram illustrating an updating aspect of a motion information table.
[0180] It is assumed that when a motion information candidate derived from the current block is added to the motion information table, a maximum index is assigned to the motion information candidate. In addition, it is assumed that a maximum number of motion information candidates have been stored in the motion information table.
[0181] When the motion information candidate HmvpCand[n+1] derived from the current block is added to the motion information table HmvpCandList, the motion information candidate HmvpCand[0] having the smallest index among the pre-stored motion information candidates may be deleted, and the indexes of the remaining motion information candidates may be reduced by 1. In addition, the index of the motion information candidate HmvpCand[n+1] derived from the current block may be set to the maximum value (for Fig.10 The example shown in , n).
[0182] When the same motion information candidate as the motion information candidate derived based on the current block is pre-stored S905, the motion information candidate derived based on the current block may not be added to the motion information table S909.
[0183] Optionally, when adding a motion information candidate derived based on the current block to the motion information table, the pre-stored motion information candidate identical to the motion information candidate may be removed. In this case, the same effect as when the index of the pre-stored motion information candidate is re-updated is produced.
[0184] Fig.11is a diagram illustrating an example of updating an index of a pre-stored motion information candidate.
[0185] When the index of the pre-stored motion information candidate that is the same as the motion information candidate mvCand derived from the current block is hIdx, the pre-stored motion information candidate may be removed, and the index of the motion information candidate with an index greater than hIdx may be reduced by 1. In an example, Fig.11 The example shown in shows that HmvpCand[2] identical to mvCand is deleted in the motion information table HvmpCandList, and the indexes from HmvpCand[3] to HmvpCand[n] are decreased by 1.
[0186] Also, the motion information candidate mvCand derived based on the current block may be added to the end of the motion information table.
[0187] Alternatively, an index assigned to the same pre-stored motion information candidate as the motion information candidate derived based on the current block may be updated. For example, the index of the pre-stored motion information candidate may be changed to a minimum value or a maximum value.
[0188] The motion information of the blocks included in the predetermined area may be set not to be added to the motion information table. In an example, the motion information candidate derived based on the motion information of the blocks included in the merge processing area may not be added to the motion information table. Since the encoding / decoding order for the plurality of blocks included in the merge processing area is not defined, it is inappropriate to use the motion information of any one of the plurality of blocks for inter-frame prediction of another block of the plurality of blocks. Therefore, the motion information candidate derived based on the blocks included in the merge processing area may not be added to the motion information table.
[0189] Optionally, the motion information of a block smaller than a preset size may be set not to be added to the motion information table. In an example, the motion information candidate derived based on the motion information of a coding block with a width or height less than 4 or 8 or the motion information of a coding block of 4×4 size may not be added to the motion information table.
[0190] When motion compensation prediction is performed based on each sub-block, a motion information candidate may be derived based on motion information of a representative sub-block among a plurality of sub-blocks included in the current block. In an example, when a sub-block merge candidate is used for the current block, a motion information candidate may be derived based on motion information of a representative sub-block among the sub-blocks.
[0191] The motion vector of the sub-block may be derived in the following order. First, any one of the merge candidates included in the merge 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 merge candidate. Moreover, a shifted sub-block of a basic sample at a position (xColSb, yColSb) may be derived by adding the initial shift vector to the position (xSb, ySb) of a basic sample (e.g., an upper left sample or a center sample) of each sub-block in the coding block. Equation 1 below shows a formula for deriving a shifted sub-block.
[0192] [Equation 1]
[0193] (xColSb, yColSb) = (xSB+shVector[0]>>4, ySb+shVector[1]>>4)
[0194] Then, a motion vector of a co-located block corresponding to a center position of a sub-block including (xColSb, yColSb) may be set as a motion vector of a sub-block including (xSb, ySb).
[0195] The representative sub-block may mean a sub-block including an upper left sample point or a center sample point of the current block.
[0196] Fig.12 is a diagram showing the positions of representative sub-blocks.
[0197] Fig.12 (a) shows an example in which a sub-block located at the upper left of the current block is set as a representative sub-block, and Fig.12 (b) shows an example in which a subblock located at the center of the current block is set as a representative subblock. When motion compensation prediction is performed based on subblocks, a motion information candidate of the current block may be derived based on a motion vector of a subblock including an upper left sample of the current block or including a central sample of the current block.
[0198] Based on the inter prediction mode of the current block, it may be determined whether the current block will be used as a motion information candidate. In an example, a block encoded / decoded based on an affine motion model may be set to be unusable as a motion information candidate. Therefore, although the current block is encoded / decoded by inter prediction, when the inter prediction mode of the current block is an affine prediction mode, the motion information table may not be updated based on the current block.
[0199] Alternatively, the motion information candidate may be derived based on at least one sub-block vector of a sub-block included in a block encoded / decoded based on an affine motion model. In an example, the motion information candidate may be derived by using a sub-block located at the upper left, center, or upper right of the current block. Alternatively, an average value of sub-block vectors of a plurality of sub-blocks may be set as a motion vector of the motion information candidate.
[0200] Alternatively, the motion information candidate may be derived based on an average value of affine seed vectors of blocks encoded / decoded according to an affine motion model. In an example, at least an average value of a first affine seed vector, a second affine seed vector, or a third affine seed vector of the current block may be set as a motion vector of the motion information candidate.
[0201] Optionally, the motion information table may be configured according to the inter prediction mode. In an example, at least one of a motion information table for a block encoded / decoded by intra block copying, a motion information table for a block encoded / decoded based on a translational motion model, or a motion information table for a block encoded / decoded based on an affine motion model may be defined. Depending on the inter prediction mode of the current block, any one of the plurality of motion information tables may be selected.
[0202] Fig.13 An example of generating a motion information table in the inter prediction mode is shown.
[0203] When a block is encoded / decoded based on a non-affine motion model, the motion information candidate mvCand derived based on the block can be added to the non-affine motion information table HmvpCandList. On the other hand, when a block is encoded / decoded based on an affine motion model, the motion information candidate mvAfCand derived based on the above model can be added to the affine motion information table HmvpCandList.
[0204] The affine seed vector of the above block may be stored in the motion information candidate derived from the block encoded / decoded based on the affine motion model. Therefore, the motion information candidate may be used as a merge candidate for deriving the affine seed vector of the current block.
[0205] In addition to the described motion information table, an additional motion information table may be defined. In addition to the above-mentioned motion information table (hereinafter, referred to as the first motion information table), a long-term motion information table (hereinafter, referred to as the second motion information table) may be defined. In this regard, the long-term motion information table includes long-term motion information candidates.
[0206] When both the first motion information table and the second motion information table are empty, first, the motion information candidate may be added to the second motion information table. After the number of motion information candidates available for the second motion information table reaches the maximum number, the motion information candidate may be added to the first motion information table.
[0207] Alternatively, one motion information candidate may be added to both the second motion information table and the first motion information table.
[0208] In this regard, the filled second motion information table may not be updated any more. Alternatively, when the decoded area exceeds a predetermined ratio in the slice, the second motion information table may be updated. Alternatively, the second motion information table may be updated every N coding tree unit lines.
[0209] On the other hand, whenever an encoding / decoding block is generated by inter prediction, the first motion information table may be updated. However, the motion information candidates added to the second motion information table may be set not to be used for updating the first motion information table.
[0210] Information for selecting any one of the first motion information table or the second motion information table may be signaled in a bitstream. When the number of merge candidates included in the merge candidate list is less than a threshold, the motion information candidate included in the motion information table indicated by the information may be added as a merge candidate to the merge candidate list.
[0211] Alternatively, the motion information table may be selected based on the size of the current block, the shape of the current block, the inter prediction mode of the current block, whether bidirectional prediction is applied to the current block, whether the motion vector is corrected, or whether triangle partitioning is applied to the current block.
[0212] Alternatively, when the number of merge candidates included in the merge candidate list is less than the maximum number, even if the motion information candidate included in the first motion information table is added, the motion information candidate included in the second motion information table may be added to the merge candidate list.
[0213] Fig.14 is a diagram illustrating an example of adding motion information candidates included in a long-term motion information table to a merge candidate list.
[0214] In the case where the number of merge candidates included in the merge candidate list is less than the maximum number, the motion information candidates included in the first motion information table HmvpCandList may be added to the merge candidate list. When the number of merge candidates included in the merge candidate list is less than the maximum number, even if the motion information candidates included in the first motion information table are added to the merge candidate list, the motion information candidates included in the long-term motion information table HmvpLTCandList may be added to the merge candidate list.
[0215] Table 1 shows a process of adding motion information candidates included in the long-term motion information table to a merge candidate list.
[0216]
Table 1
[0217]
[0218]
[0219] The motion information candidate may be set to include additional information in addition to the motion information. In an example, at least one of the size, shape, or partition information of the block may be additionally stored in the motion information candidate. When configuring the merge candidate list of the current block, only the motion information candidates whose size, shape, or partition information is the same as or similar to that of the current block among the motion information candidates may be used, or the motion information candidates whose size, shape, or partition information is the same as or similar to that of the current block may be pre-added to the merge candidate list.
[0220] Alternatively, a motion information table may be generated according to block size, shape, or partition information. The merge candidate list of the current block may be configured by using a motion information table that matches the shape, size, or partition information of the current block among a plurality of motion information tables.
[0221] When the number of merge candidates included in the merge candidate list of the current block is less than a threshold value, the motion information candidate included in the motion information table may be added to the merge candidate list as a merge candidate. The additional processing is performed in an order reflecting the sorting of the indexes of the motion information candidates in ascending or descending order. In an example, the motion information candidate with the largest index may be added to the merge candidate list of the current block first.
[0222] When a motion information candidate included in the motion information table is added to a merge candidate list, a redundancy check between the motion information candidate and a pre-stored merge candidate in the merge candidate list may be performed. As a result of the redundancy check, a motion information candidate having the same motion information as the pre-stored merge candidate may not be added to the merge candidate list.
[0223] In an example, Table 2 shows a process of adding motion information candidates to the merge candidate list.
[0224]
Table 2
[0225]
[0226] The redundancy check may be performed only for a portion of the motion information candidates included in the motion information table. In an example, the redundancy check may be performed only for motion information candidates whose index exceeds or is below a threshold. Alternatively, the redundancy check may be performed only for N motion information candidates having the largest index or the smallest index.
[0227] Optionally, redundancy check may be performed only for a portion of the pre-stored merge candidates in the merge candidate list. In an example, redundancy check may be performed only for merge candidates whose index exceeds or is lower than a threshold or for merge candidates derived from a block at a specific position. In this regard, the specific position may include at least one of a left neighboring block, an upper neighboring block, an upper right neighboring block, or a lower left neighboring block of the current block.
[0228] Fig.15 is a diagram showing an example in which a redundancy check is performed only on a part of merging candidates.
[0229] When the motion information candidate HmvpCand[j] is added to the merge candidate list, a redundancy check of 2 merge candidates mergeCandList[NumMerge-2] and mergeCandList[NumMerge-1] having the largest index may be performed for the motion information candidate. In this regard, NumMerge may show the number of available spatial merge candidates and temporal merge candidates.
[0230] Unlike the example shown, when the motion information candidate HmvpCand[j] is added to the merge candidate list, a redundancy check of the two merge candidates with the smallest index may be performed for the motion information candidate. For example, it may be checked whether mergeCandList[0] and mergeCandList[1] are the same as HmvpCand[j].
[0231] Optionally, a redundancy check may be performed only for merge candidates derived from a specific position. In an example, a redundancy check may be performed for at least one of merge candidates derived from a neighboring block located to the left of the current block or above the current block. When there is no merge candidate derived from a specific position in the merge candidate list, the motion information candidate may be added to the merge candidate list without performing a redundancy check.
[0232] When the motion information candidate HmvpCand[j] is added to the merge candidate list, a redundancy check of 2 merge candidates mergeCandList[NumMerge-2] and mergeCandList[NumMerge-1] having the largest index may be performed for the motion information candidate. In this regard, NumMerge may show the number of available spatial merge candidates and temporal merge candidates.
[0233] Redundancy check on merge candidates may be performed only for a portion of motion information candidates among motion information candidates. In an example, redundancy check may be performed only for N motion information candidates with large indexes or small indexes among motion information candidates included in a motion information table. In an example, redundancy check may be performed only for motion information candidates with indexes whose sum difference of numbers of motion information candidates included in the motion information table is lower than a threshold. When the threshold is 2, redundancy check may be performed only for 3 motion information candidates with the largest index value among motion information candidates included in the motion information table. Redundancy check may be omitted for motion information candidates other than the above 3 motion information candidates. When redundancy check is omitted, the motion information candidate may be added to the merge candidate list regardless of whether there is the same motion information as the merge candidate.
[0234] In contrast, the redundancy check is set to be performed only for the motion information candidates having the index whose sum of the numbers of the motion information candidates included in the motion information table exceeds the threshold value.
[0235] The number of motion information candidates for performing redundancy check may be redefined in the encoder and the decoder. In an example, the threshold may be an integer such as 0, 1 or 2.
[0236] Alternatively, the threshold may be determined based on at least one of the number of merge candidates included in the merge candidate list or the number of motion information candidates included in the motion information table.
[0237] When a merge candidate identical to the first motion information candidate is found, redundant checking of the merge candidate identical to the first motion information candidate may be omitted in redundant checking for the second motion information candidate.
[0238] Fig.16 is a diagram illustrating an example of omitting a redundant check on a specific merge candidate.
[0239] When a motion information candidate HmvpCand[i] with an index of i is added to a merge candidate list, a redundancy check is performed between the motion information candidate and a pre-stored merge candidate in the merge candidate list. In this regard, when a merge candidate mergeCandlist[j] identical to the motion information candidate HmvpCand[i] is found, a redundancy check may be performed between the motion information candidate HmvpCand[i-1] with an index of i-1 and the merge candidate without adding the motion information candidate HmvpCand[i] to the merge candidate list. In this regard, a redundancy check may be omitted between the motion information candidate HmvpCand[i-1] and the merge candidate mergeCandList[j].
[0240] In the example, Fig.16In the example shown in , it is determined that HmvpCand[i] and mergeCandList[2] are the same. Therefore, a redundancy check for HmvpCand[i-1] may be performed without adding HmvpCand[i] to the merge candidate list. In this regard, a redundancy check between HmvpCand[i-1] and mergeCandList[2] may be omitted.
[0241] When the number of merge candidates included in the merge candidate list of the current block is less than a threshold value, at least one of a paired merge candidate or a zero merge candidate may be further included in addition to the motion information candidate. The paired merge candidate indicates a merge candidate having a value obtained by averaging motion vectors of more than 2 merge candidates as a motion vector, and the zero merge candidate indicates a merge candidate having a motion vector of 0.
[0242] For the merge candidate list of the current block, merge candidates may be added in the following order.
[0243] Spatial merging candidate - Temporal merging candidate - Motion information candidate - (affine motion information candidate) - Paired merging candidate - Zero merging candidate
[0244] The spatial merge candidate indicates a merge candidate derived from at least one of a neighboring block or a non-neighboring block, and the temporal merge candidate indicates a merge candidate derived from a previous reference picture. The affine motion information candidate indicates a motion information candidate derived from a block encoded / decoded by an affine motion model.
[0245] The motion information table may be used in the motion vector prediction mode. In an example, when the number of motion vector prediction candidates included in the motion vector prediction candidate list of the current block is less than a threshold value, the motion information candidate included in the motion information table may be set as a motion vector prediction candidate for the current block. Specifically, the motion vector of the motion information candidate may be set as a motion vector prediction candidate.
[0246] If any one of the motion vector prediction candidates included in the motion vector prediction candidate list of the current block is selected, the selected candidate may be set as a motion vector predictor of the current block. Then, after decoding the motion vector residual value of the current block, the motion vector of the current block may be obtained by adding the motion vector predictor and the motion vector residual value.
[0247] The motion vector prediction candidate list of the current block may be configured in the following order.
[0248] Spatial motion vector prediction candidate - Temporal motion vector prediction candidate - Motion information candidate - (affine motion information candidate) - Zero motion vector prediction candidate
[0249] The spatial motion vector prediction candidate represents a motion vector prediction candidate derived from at least one of a neighboring block or a non-neighboring block, and the temporal motion vector prediction candidate represents a motion vector prediction candidate derived from a previous reference picture. The affine motion information candidate represents a motion information candidate derived from a block encoded / decoded by an affine motion model. The zero motion vector prediction candidate represents a candidate whose motion vector value is 0.
[0250] A merge processing area larger than a coding block may be defined. The coding blocks included in the merge processing area may be processed in parallel without being encoded / decoded sequentially. In this regard, not being encoded / decoded sequentially means that the order of encoding / decoding is not defined. Therefore, the encoding / decoding processing of the blocks included in the merge processing area may be processed independently. Optionally, the blocks included in the merge processing area may share merge candidates. In this regard, merge candidates may be derived based on the merge processing area.
[0251] According to the above features, the merged processing region may be referred to as a parallel processing region, a shared merge region (SMR), or a merged estimation region (MER).
[0252] A merge candidate of the current block may be derived based on the coding block. However, when the current block is included in a merge processing region larger than the current block, a candidate block included in the same merge processing region as the current block may be set to be unusable as a merge candidate.
[0253] Fig.17 is a diagram illustrating an example in which a candidate block included in the same merge processing region as a current block is set to be unusable as a merge candidate.
[0254] exist Fig.17 In the example shown in (a) of FIG. 5 , in encoding / decoding of CU5, a block including basic samples adjacent to CU5 may be set as a candidate block. In this regard, candidate blocks x3 and x4 included in the same merge processing region as CU5 may be set to be unusable as merge candidates for CU5. However, candidate blocks x0, x1, and x2 not included in the same merge processing region as CU5 may be set to be usable as merge candidates.
[0255] exist Fig.17 In the example shown in (b) of FIG. 1 , in encoding / decoding of CU8, blocks including basic samples adjacent to CU8 may be set as candidate blocks. In this regard, candidate blocks x6, x7, and x8 included in the same merge processing region as CU8 may be set to be unusable as merge candidates. However, candidate blocks x5 and x9 not included in the same merge processing region as CU8 may be set to be usable as merge candidates.
[0256] Alternatively, when the current block is included in the merge processing region, neighboring blocks adjacent to the current block and the merge processing region may be set as candidate blocks.
[0257] Fig.18 is a diagram illustrating an example of deriving a merge candidate for a current block when the current block is included in a merge processing region.
[0258] As in Fig.18 In the example shown in (a), a neighboring block adjacent to the current block may be set as a candidate block for deriving a merge candidate for the current block. In this regard, a candidate block included in the same merge processing region as the current block may be set to be unusable as a merge candidate. In the example, when deriving a merge candidate for the coding block CU3, the upper neighboring block y3 and the upper right neighboring block y4 included in the same merge processing region as the coding block CU3 may be set to be unusable as a merge candidate for the coding block CU3.
[0259] By scanning neighboring blocks adjacent to the current block in a predefined order, a merge candidate may be derived. In an example, the predefined order may be the order of y1, y3, y4, y0, and y2.
[0260] When the number of merge candidates that can be derived from neighboring blocks adjacent to the current block is less than the value of the maximum number of merge candidates minus the offset or the maximum number, the Fig.18 The example shown in (b) of derives a merge candidate for the current block by using a neighboring block adjacent to the merge processing region. In the example, a neighboring block adjacent to the merge processing region including the coding block CU3 may be set as a candidate block for the coding block CU3. In this regard, the neighboring block adjacent to the merge processing region may include at least one of a left neighboring block x1, an upper neighboring block x3, a lower left neighboring block x0, an upper right neighboring block x4, or an upper left neighboring block x2.
[0261] By scanning neighboring blocks adjacent to the merge processing area in a predefined order, a merge candidate can be derived. In an example, the predefined order can be the order of x1, x3, x4, x0 and x2.
[0262] In summary, a merge candidate for the coding block CU3 included in the merge processing area can be derived by scanning the candidate blocks in the following scanning order.
[0263] (y1,y3,y4,y0,y2,x1,x3,x4,x0,x2)
[0264] However, the scanning order of the candidate blocks shown above only shows an example of the present disclosure, and the candidate blocks may be scanned in an order different from the above example. Optionally, the scanning order may be adaptively determined based on at least one of the size or shape of the current block or the merge processing area.
[0265] The merged processing area may be square or non-square. Information for determining the merged processing area may be sent as a bitstream signal. The information may include at least one of information indicating the shape of the merged processing area or information indicating the size of the merged processing area. When the merged processing area is non-square, at least one of information indicating the size of the merged processing area, information indicating the width or height of the merged processing area, or information indicating the aspect ratio of the merged processing area may be sent as a bitstream signal.
[0266] The size of the merge processing area may be determined based on at least one of information signaled in a bitstream, a picture resolution, a size of a slice, or a size of a tile.
[0267] If motion compensation prediction is performed on a block included in the merge processing region, motion information candidates derived based on motion information of the block on which motion compensation prediction is performed may be added to the motion information table.
[0268] However, if the motion information candidate derived from the block included in the merge processing area is added to the motion information table, a situation may occur where the motion information candidate derived from the block is used in encoding / decoding of other blocks in the merge processing area whose encoding / decoding is actually slower than that of the block. In other words, although the dependency between blocks should be excluded in encoding / decoding of the block included in the merge processing area, a situation may occur where motion prediction compensation is performed by using motion information of other blocks included in the merge processing area. In order to solve such a problem, although encoding / decoding of the block included in the merge processing area is completed, the motion information of the block for which encoding / decoding is completed may not be added to the motion information table.
[0269] Optionally, if motion compensation prediction is performed for a block included in the merge processing area, the motion information candidate derived from the block may be added to the motion information table in a predefined order. In this regard, the predefined order may be determined according to a scanning order of coding blocks in the merge processing area or coding tree unit. The scanning order may be at least one of raster scanning, horizontal scanning, vertical scanning, or zigzag scanning. Optionally, the predefined order may be determined based on the motion information of each block or the number of blocks having the same motion information.
[0270] Alternatively, a motion information candidate including unidirectional motion information may be added to the motion information table before a motion information candidate including bidirectional motion information. Conversely, a motion information candidate including bidirectional motion information may be added to the motion information table before a motion information candidate including unidirectional motion information.
[0271] Alternatively, the motion information candidates may be added to the motion information table in order of high usage frequency or low usage frequency in the merge processing region or the coding tree unit.
[0272] When the current block is included in the merge processing region and the number of merge candidates included in the merge candidate list of the current block is less than the maximum number, the motion information candidate included in the motion information table may be added to the merge candidate list. In this regard, the motion information candidate derived from the block included in the same merge processing region as the current block may be set not to be added to the merge candidate list of the current block.
[0273] Optionally, when the current block is included in the merge processing region, it may be set not to use the motion information candidates included in the motion information table. In other words, although the number of merge candidates included in the merge candidate list of the current block is less than the maximum number, the motion information candidates included in the motion information table may not be added to the merge candidate list.
[0274] In another example, a motion information table for a merge processing region or a coding tree unit may be configured. This motion information table plays a role of temporarily storing motion information of blocks included in the merge processing region. In order to distinguish a general motion information table from a motion information table for a merge processing region or a coding tree unit, the motion information table for the merge processing region or the coding tree unit is referred to as a temporary motion information table. Furthermore, the motion information candidates stored in the temporary motion information table are referred to as temporary motion information candidates.
[0275] Fig.19 is a diagram showing a temporary motion information table.
[0276] A temporary motion information table for a coding tree unit or a merge processing area may be configured. When motion compensation prediction is performed on a current block included in a coding tree unit or a merge processing area, the motion information of the block may not be added to the motion information table HmvpCandList. Alternatively, a temporary motion information candidate derived from the block may be added to the temporary motion information table HmvpMERCandList. In other words, the temporary motion information candidate added to the temporary motion information table may not be added to the motion information table. Therefore, the motion information table may not include a motion information candidate derived based on the motion information of a block included in the coding tree unit or the merge processing area including the current block.
[0277] The maximum number of temporary motion information candidates that can be included in the temporary motion information table can be set to be the same as the maximum number of motion information candidates. Alternatively, the maximum number of temporary motion information candidates that can be included in the temporary motion information table can be determined according to the size of the coding tree unit or the merge processing area.
[0278] The current block included in the coding tree unit or the merge processing area may be set not to use the temporary motion information table about the corresponding coding tree unit or the merge processing area. In other words, when the number of merge candidates included in the merge candidate list of the current block is less than a threshold value, the motion information candidates included in the motion information table may be added to the merge candidate list, and the temporary motion information candidates included in the temporary motion information table may not be added to the merge candidate list. Therefore, the motion information of other blocks included in the same coding tree unit or the same merge processing area as the current block may not be used for motion compensation prediction of the current block.
[0279] If encoding / decoding of all blocks included in the coding tree unit or the merge processing area is completed, the motion information table and the temporary motion information table may be made consistent.
[0280] Fig. 20 is a diagram showing an example of making the motion information table and the temporary motion information table consistent.
[0281] If encoding / decoding of all blocks included in the coding tree unit or the merge processing area is completed, as in Fig. 20 In the example shown in , the temporary motion information candidates included in the temporary motion information table may be updated in the motion information table.
[0282] In this regard, the temporary motion information candidates included in the temporary motion information table may be added to the motion information table in the order of insertion in the temporary motion information table (in other words, in ascending or descending order of index values).
[0283] In another example, the temporary motion information candidates included in the temporary motion information table may be added to the motion information table in a predefined order. In this regard, the predefined order may be determined according to a scanning order of coding blocks in a merge processing area or a coding tree unit. The scanning order may be at least one of a raster scan, a horizontal scan, a vertical scan, or a zigzag scan. Alternatively, the predefined order may be determined based on the motion information of each block or the number of blocks having the same motion information.
[0284] Alternatively, a temporary motion information candidate including unidirectional motion information may be added to the motion information table before a temporary motion information candidate including bidirectional motion information. Conversely, a temporary motion information candidate including bidirectional motion information may be added to the motion information table before a temporary motion information candidate including unidirectional motion information.
[0285] Alternatively, the temporary motion information candidates may be added to the motion information table in the order of high usage frequency or low usage frequency in the merge processing region or the coding tree unit.
[0286] In the case where a temporary motion information candidate included in the temporary motion information table is added to the motion information table, a redundancy check for the temporary motion information candidate may be performed. In an example, when a motion information candidate identical to the temporary motion information candidate included in the temporary motion information table is pre-stored in the motion information table, the temporary motion information candidate may not be added to the motion information table. In this regard, a redundancy check may be performed for a portion of the motion information candidates included in the motion information table. In an example, a redundancy check may be performed for motion information candidates having an index exceeding or below a threshold. In an example, when the temporary motion information candidate is equal to a motion information candidate having an index higher than a predefined value, the temporary motion information candidate may not be added to the motion information table.
[0287] This may limit the use of motion information candidates derived from blocks included in the same coding tree unit or the same merge processing region as the current block as the merge candidate of the current block. To this end, address information of the block may be additionally stored for the motion information candidate. The address information of the block may include at least one of the position of the block, the address of the block, the index of the block, the position of the merge processing region including the block, the address of the merge processing region including the block, the index of the merge processing region including the block, the position of the coding tree region including the block, the address of the coding tree region including the block, or the index of the coding tree region including the block.
[0288] Intra prediction is a method for performing prediction on a current block by using reconstructed samples that have been encoded / decoded and are around the current block. In this regard, the reconstructed samples before applying the in-loop filter may be used for intra prediction of the current block.
[0289] The intra prediction method includes matrix-based intra prediction and intra prediction according to the direction of adjacent reconstruction samples. Information indicating the intra prediction method of the current block can be sent as a bitstream signal. The information can be a 1-bit flag. Optionally, the intra prediction of the current block can be determined based on at least one of the position of the current block, the size of the current block, the shape of the current block, or the intra prediction method of the neighboring block. In the example, when there is a current block that crosses the picture boundary, it can be set so that the matrix-based intra prediction method is not applied to the current block.
[0290] The matrix-based intra prediction method is a method for obtaining a prediction block of a current block based on the matrix product of the matrix stored in the encoder and the decoder and the reconstructed samples around the current block. Information for specifying any one of a plurality of pre-stored matrices can be signaled in a bitstream. The decoder can determine the matrix used to perform intra prediction on the current block based on the above information and the size of the current block.
[0291] General intra prediction is a method of obtaining a prediction block of a current block based on a non-directional intra prediction mode or a directional intra prediction mode. Hereinafter, a process of intra prediction based on general intra prediction will be described with reference to the accompanying drawings.
[0292] Fig.21 is a diagram illustrating a flowchart of an intra prediction method according to an embodiment of the present disclosure.
[0293] A reference sample line of the current block may be determined S2101. The reference sample line represents a set of reference samples included in the kth line spaced above and / or to the left of the current block. The reference samples may be derived from reconstructed samples that have been encoded / decoded around the current block.
[0294] Index information identifying a reference sample line for a current block among a plurality of reference sample lines may be signaled in a bitstream. In an example, index information intra_luma_ref_idx for specifying a reference sample line for a current block may be signaled in a bitstream. The index information may be signaled based on a coding block.
[0295] The plurality of reference sample lines may include at least one of a first line, a second line, a third line, or a fourth line from above and / or from the left side of the current block. A reference sample line consisting of a row adjacent to the top of the current block and a column adjacent to the left side of the current block among the plurality of reference sample lines may be referred to as an adjacent reference sample line, and the remaining reference sample lines may be referred to as a non-adjacent reference sample line.
[0296] Only some of the reference sample lines may be selected as reference sample lines for the current block. In an example, the remaining reference sample lines except the third non-adjacent reference sample line may be set as candidate reference sample lines. Table 3 shows an index assigned to each of the candidate reference sample lines.
[0297]
Table 3
[0298] Index (intra_luma_ref_idx) Reference sample line 0 Adjacent reference sample point line 1 The first non-adjacent reference sample line 2 The second non-adjacent reference sample line
[0299] A greater or lesser number of candidate reference sample lines than the number of the above-mentioned candidate reference sample lines may be set. In addition, the number or position of the non-adjacent reference sample lines set as candidate reference sample lines may not be limited to the above-mentioned examples. In one example, the first non-adjacent reference sample line and the third non-adjacent reference sample line may be set as candidate reference sample lines, or the second non-adjacent reference sample line and the third non-adjacent reference sample line may be set as candidate reference sample lines. Optionally, the first non-adjacent reference sample line, the second non-adjacent reference sample line, and the third non-adjacent reference sample line may all be set as candidate reference sample lines.
[0300] The number or type of candidate reference sample lines may be determined based on at least one of a size, a shape, and a position of a current block, whether the current block is divided into subblocks, or an intra prediction mode for the current block.
[0301] Based on at least one of the position, size, shape of the current block or the prediction coding mode of its neighboring blocks, the reference sample line for the current block may be determined. In one example, when the current block is adjacent to a boundary of a picture, a tile, a slice, or a coding tree unit, the neighboring reference sample line may be determined as the reference sample line for the current block.
[0302] Optionally, when the current block has a non-square shape, the adjacent reference sample line may be determined as the reference sample line for the current block. Optionally, when the aspect ratio of the current block exceeds or falls below a threshold, the adjacent reference sample line may be determined as the reference sample line for the current block.
[0303] The reference sample line may include an upper reference sample located above the current block and a left reference sample located to the left of the current block. The upper reference sample and the left reference sample may be derived from reconstructed samples around the current block. The reconstructed samples may be in a state before applying an in-loop filter.
[0304] Next, an intra prediction mode for the current block may be determined S2102. In this regard, at least one of a non-directional intra prediction mode or a directional intra prediction mode may be determined as the intra prediction mode for the current block. The non-directional intra prediction mode includes a plane mode and a DC mode. The directional intra prediction mode includes 33 or 65 modes from the lower left diagonal direction to the upper right diagonal direction.
[0305] Fig. 22 is a diagram showing an intra prediction mode.
[0306] Fig. 22 (a) shows 35 intra prediction modes. Fig. 22 (b) shows 67 intra prediction modes.
[0307] Definable ratio Fig. 22The number of intra prediction modes shown in FIG. 1 may be a greater or lesser number of intra prediction modes.
[0308] Based on the intra prediction mode of the neighboring blocks adjacent to the current block, the MPM (Most Probable Mode) may be set. In this regard, the neighboring blocks may include a left neighboring block adjacent to the left side of the current block and an upper neighboring block adjacent to the upper side of the current block.
[0309] When the intra prediction mode for the current block is determined, prediction samples for the current block may be obtained based on the determined intra prediction mode S2103.
[0310] In the case where the DC mode is selected, a prediction sample for the current block is generated based on an average value of the reference samples. In detail, the values of all samples in the prediction 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 adjacent to the upper side of the current block and a left reference sample adjacent to the left side of the current block.
[0311] The number or range of reference samples used when deriving the average value may vary based on the shape of the current block. In an example, when the current block is a non-square block with a width greater than a height, the average value may be calculated by using an upper reference sample. Conversely, when the current block is a non-square block with a width less than a height, the average value may be calculated by using a left reference sample. In other words, when the width and height of the current block are different, reference samples adjacent to a longer side may be used in order to calculate the average value. Alternatively, whether to calculate the average value by using an upper reference sample or a left reference sample may be determined based on the aspect ratio of the current block.
[0312] When the planar mode is selected, the prediction sample may be obtained by using the horizontal prediction sample and the vertical prediction sample. In this regard, the horizontal prediction sample may be obtained based on the left reference sample and the right reference sample located at the same horizontal line as the horizontal prediction sample, and the vertical prediction sample may be obtained based on the upper reference sample and the lower reference sample located at the same vertical line as the vertical prediction sample. In this regard, the right reference sample may be generated by copying the reference sample adjacent to the upper right corner of the current block, and the lower reference sample may be generated by copying the reference sample adjacent to the lower left corner of the current block. The horizontal prediction sample may be obtained based on the weighted sum of the left reference sample and the right reference sample, and the vertical prediction sample may be obtained based on the weighted sum of the upper reference sample and the lower reference sample. In this regard, the weighting factor assigned to each reference sample may be determined according to the position of the prediction sample. The prediction sample may be obtained based on the average or weighted sum of the horizontal prediction sample and the vertical prediction sample. When the weighted sum is used, the weighting factors assigned to the horizontal direction prediction samples and the vertical direction prediction samples may be determined based on the positions of the prediction samples.
[0313] When a directional prediction mode is selected, a parameter representing a prediction direction (or prediction angle) of the selected directional prediction mode may be determined. Table 4 below represents an intra directional parameter of intraPredAng for each intra prediction mode.
[0314]
Table 4
[0315] PredModeIntra 1 2 3 4 5 6 7 IntraPredAng - 32 26 21 17 13 9 PredModeIntra 8 9 10 11 12 13 14 IntraPredAng 5 2 0 -2 -5 -9 -13 PredModeIntra 15 16 17 18 19 20 21 IntraPredAng -17 -21 -26 -32 -26 -21 -17 PredModeIntra 22 23 24 25 26 27 28 IntraPredAng -13 -9 -5 -2 0 2 5 PredModeIntra 29 30 31 32 33 34 IntraPredAng 9 13 17 21 26 32
[0316] Table 4 shows the intra-frame direction parameter of each intra-frame prediction mode, where, when 35 intra-frame prediction modes are defined, the index of the intra-frame prediction mode is one of 2 to 34. When more than 33 directional intra-frame prediction modes are defined, the intra-frame direction parameter of each intra-frame prediction mode can be set by subdividing Table 4.
[0317] The upper reference sample and the left reference sample for the current block are arranged in a row, and then the prediction sample can be obtained based on the value of the intra direction parameter. In this regard, when the value of the intra direction parameter is a negative value, the left reference sample and the upper reference sample can be arranged in a row.
[0318] The reference sample index iIdx and the weighting factor parameter ifact may be obtained by the following Equation 2 and Equation 3, respectively.
[0319] [Equation 2]
[0320] iIdx=(y+1)*P ang / 32 [Equation 3]
[0321] j fact =[(y+1)*P ang ]&31
[0322] In Equation 2 and Equation 3, P ang Indicates intra-frame direction parameters. The reference sample specified by the reference sample index iIdx corresponds to an integer pixel.
[0323] In order to derive the prediction sample, at least one reference sample may be specified. In detail, according to the slope of the prediction mode, the position of the reference sample used to derive the prediction sample may be specified. In an example, the reference sample used to derive the prediction sample may be specified by using the reference sample index iIdx.
[0324] In this regard, when the slope of the intra prediction mode is not represented by one reference sample, the prediction sample may be generated by interpolating a plurality of reference samples. In an example, when the slope of the intra prediction mode is a value between a slope between a prediction sample and a first reference sample and a slope between a prediction sample and a second reference sample, the prediction sample may be obtained by interpolating the first reference sample and the second reference sample. In other words, when an angle line according to an 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 and right sides or above and below the position where the angle line passes.
[0325] Equation 4 below represents an example of obtaining a prediction sample based on a reference sample.
[0326] [Equation 4]
[0327] P(x,y)=((32-i fact ) / 32)*Ref_1D(x+iIdx+1)+(i fact / 32)*Ref_1D(x+iIdx+2)
[0328] In Equation 4, P represents a prediction sample, and Ref_1D represents any one of the reference samples arranged in a row. In this regard, the position of the reference sample may be determined by the position (x, y) of the prediction sample and the reference sample index iIdx.
[0329] When the slope of the intra prediction mode can be represented by a reference sample, i fact The weighting factor parameter of is set to 0. Therefore, Equation 4 can be simplified to the following Equation 5.
[0330] [Equation 5]
[0331] P(x, y) = Ref_1D(x+iIdx+1)
[0332] When the current block is non-square, the following situation may exist: according to the intra-frame prediction mode for the current block, the prediction sample is derived by using a reference sample located farther than the reference sample close to the prediction sample among the reference samples located at the angle line according to the intra-frame prediction angle.
[0333] To solve the above problem, when the current block is non-square, the intra prediction mode for the current block can be replaced by the intra prediction mode in the opposite direction. Fig. 22 The directional prediction mode of the angle of the directional prediction mode shown in may be used. The above directional intra prediction mode may be defined as a wide-angle intra prediction mode. The wide-angle intra prediction mode indicates a directional intra prediction mode that does not belong to the range of 45 degrees to -135 degrees.
[0334] Fig.23 is a diagram illustrating a wide-angle intra prediction mode.
[0335] exist Fig.23 In the example shown in , the intra prediction modes with indices from -1 to -14 and the intra prediction modes with indices from 67 to 80 represent the wide-angle intra prediction modes.
[0336] exist Fig.23 , 14 wide-angle intra prediction modes (from -1 to -14) with angles greater than 45 degrees and 4 wide-angle intra prediction modes (from 67 to 80) with angles less than -135 degrees are shown. However, a greater or lesser number of wide-angle intra prediction modes may be defined.
[0337] When the wide-angle intra prediction mode is used, the length of the upper reference sample may be set to 2W+1, and the length of the left reference sample may be set to 2H+1.
[0338] When a prediction block is generated as a result of intra prediction, the prediction samples may be updated based on each position of the prediction samples included in the prediction block. Such an updating method may be referred to as a sample position-based intra weighted prediction method (or position-dependent prediction combination, PDPC).
[0339] Whether to use PDPC may be determined by considering the intra prediction mode of the current block, the reference sample line of the current block, the size or color component of the current block. In the example, PDPC may be used when the intra prediction mode of the current block is at least one of plane, DC, vertical direction, horizontal direction, a mode with an index value less than the vertical direction, or a mode with an index value greater than the horizontal direction. Optionally, PDPC may be used only when at least one of the width or height of the current block is greater than 4. Optionally, PDPC may be used only when the index of the reference picture line of the current block is 0. Optionally, PDPC may be used only when the index of the reference picture line of the current block exceeds a predefined value. Optionally, PDPC may be used only for the luminance component. Optionally, whether to use PDPC may be determined based on whether more than two of the conditions listed above are met.
[0340] In another example, information showing whether PDPC is applied may be signaled in a bitstream.
[0341] When a prediction sample is obtained by intra prediction, a reference sample for correcting the prediction sample may be determined based on the position of the obtained prediction sample. For ease of explanation, the reference sample for correcting the prediction sample is referred to as a PDPC reference sample in an embodiment described later. In addition, the prediction sample obtained by intra prediction is referred to as a first prediction sample, and the prediction sample obtained by correcting the first prediction sample is referred to as a second prediction sample.
[0342] Fig.24 is a diagram illustrating application aspects of PDPC.
[0343] The first prediction sample may be corrected using at least one PDPC reference sample, which may include at least one of a reference sample adjacent to the upper left corner of the current block, an upper reference sample located above the current block, or a left reference sample located on the left side of the current block.
[0344] At least one of the reference samples of the reference sample line belonging to the current block may be set as the PDPC reference sample. Alternatively, regardless of the reference sample line of the current block, at least one of the reference samples of the reference sample line having an index of 0 may be set as the PDPC reference sample. In the example, although the first prediction sample is obtained by using the reference samples included in the reference sample line having an index of 1 or 2, the second prediction sample may be obtained by using the reference samples included in the reference sample line having an index of 0.
[0345] The number or positions of PDPC reference samples used to correct the first prediction samples may be determined considering at least one of an intra prediction mode of the current block, a size of the current block, a shape of the current block, or a position of the first prediction samples.
[0346] In an example, when the intra prediction mode of the current block is the planar mode or the DC mode, the second prediction sample may be obtained by using an upper reference sample and a left reference sample. In this regard, the upper reference sample may be a reference sample that is perpendicular to the first prediction sample (e.g., a reference sample that has the same x-coordinate), and the left reference sample may be a reference sample that is horizontal to the first prediction sample (e.g., a reference sample that has the same y-coordinate).
[0347] When the intra prediction mode of the current block is a horizontal intra prediction mode, the second prediction sample may be obtained by using an upper reference sample. In this regard, the upper reference sample may be a reference sample that is perpendicular to the first prediction sample.
[0348] When the intra prediction mode of the current block is a vertical intra prediction mode, the second prediction sample may be obtained by using a left reference sample. In this regard, the left reference sample may be a reference sample horizontal to the first prediction sample.
[0349] When the intra prediction mode of the current block is a lower left diagonal intra prediction mode or an upper right diagonal intra prediction mode, the second prediction sample may be obtained based on the upper left reference sample, the upper reference sample, and the left reference sample. The upper left reference sample may be a reference sample adjacent to the upper left corner of the current block (e.g., a reference sample located at (-1, -1)). The upper reference sample may be a reference sample located in the upper right diagonal direction of the first prediction sample, and the left reference sample may be a reference sample located in the lower left diagonal direction of the first prediction sample.
[0350] In summary, when the first prediction sample is located at (x, y), R(-1, -1) may be set as the upper left reference sample, and R(x+y+1, -1) or R(x, -1) may be set as the upper reference sample. In addition, R(-1, x+y+1) or R(-1, y) may be set as the left reference sample.
[0351] A single prediction mode may be applied to the current block multiple times, or multiple prediction modes may be repeatedly applied. Also, a prediction method using the same type or different types of prediction modes may be referred to as a combined prediction mode (or a multi-hypothesis prediction mode).
[0352] The combined prediction mode may include at least one of a mode combining a merge mode and a merge mode, a mode combining inter-frame prediction and intra-frame prediction, a mode combining a merge mode and a motion vector prediction mode, a mode combining a motion vector prediction mode and a motion vector prediction mode, or a mode combining a merge mode and an intra-frame prediction.
[0353] In the combined prediction mode, a first prediction block may be generated based on the first prediction mode, and a second prediction block may be generated based on the second prediction mode. Then, a third prediction block may be generated based on a weighted sum operation of the first prediction block and the second prediction block. The third prediction block may be set as the final prediction block of the current block.
[0354] Based on the size or shape of the current block, it may be determined whether to use the combined prediction mode. In an example, it may be determined whether to use the combined prediction mode based on at least one of the size of the coding block, the number of samples included in the coding block, the width of the coding block, or the height of the coding block. In an example, when at least one of the width or height of the coding block exceeds 128 or when the number of samples included in the coding block is less than 64, the combined prediction mode may not be applied to the coding block.
[0355] Optionally, information showing whether the combined prediction mode is applied to the current block may be signaled in the bitstream. In an example, the information may be a 1-bit flag. In an example, a flag mh_intra_flag indicating whether the combined prediction mode combining the merge mode and the intra prediction is used may be signaled in the bitstream. When mh_intra_flag is 1, it indicates that the combined prediction mode combining the merge mode and the intra prediction is used, and when mh_intra_flag is 0, it indicates that the combined prediction mode combining the merge mode and the intra prediction is not used.
[0356] Only when the prediction coding mode of the current block is the inter prediction mode and when the merge mode is applied to the current block, the combined prediction mode combining the merge mode and the intra prediction can be applied to the current block. In other words, when the value of the flag merge_flag indicating whether the merge mode is applied to the current block is 1, mh_intra_flag can be sent by the signal.
[0357] In a prediction mode combining the merge mode and the intra prediction, the intra prediction mode of the current block may be set to a predefined intra prediction mode. In an example, when the combined prediction mode is used, the intra prediction mode of the current block may be set to a planar mode.
[0358] In another example, when a combined prediction mode combining a merge mode and an intra prediction is used, the intra prediction mode of the current block may be determined as one of the candidate intra prediction modes. In this regard, the candidate intra prediction mode may include at least one of a non-directional intra prediction mode or a directional intra prediction mode for a specific direction. In this regard, the non-directional intra prediction mode may include at least one of a DC or a plane, and the directional intra prediction mode may include at least one of an intra prediction mode in a horizontal direction, an intra prediction mode in a vertical direction, or an intra prediction mode in a diagonal direction. In the example, when the combined prediction mode is used, only the DC, plane, or the intra prediction mode in the horizontal or vertical direction may be set as the intra prediction mode of the current block. Optionally, when the combined prediction mode is used, only the plane, the horizontal or vertical intra prediction mode may be set as the intra prediction mode of the current block. Optionally, when the combined prediction mode is used, only the DC, plane, or vertical intra prediction mode may be set as the intra prediction mode of the current block. Alternatively, when the combined prediction mode is used, only the intra prediction mode of the DC, planar or horizontal direction may be set as the intra prediction mode of the current block.
[0359] Index information for specifying any one of the candidate intra prediction modes may be sent as a bitstream signal. In an example, an index mh_intra_idx specifying any one of the candidate intra prediction modes may be sent as a bitstream signal. Tables 5 and 6 show intra prediction modes according to the value of mh_intra_idx. The intra prediction mode of the current block may be determined as the intra prediction mode indicated by mh_intra_idx.
[0360]
Table 5
[0361] mh_intra_idx 0 1 2 3 Intra mode flat DC vertical level
[0362]
Table 6
[0363] mh_intra_idx 0 1 2 Intra mode flat vertical level
[0364] The number of candidate intra prediction modes may have a fixed value in the encoder and the decoder. Alternatively, the number or type of candidate intra prediction modes may vary according to at least one of the size or shape of the current block or whether a neighboring block is encoded by intra prediction.
[0365] In another example, when a combined prediction mode that combines a merge mode and an intra prediction is applied, based on the MPM, the intra prediction mode of the current block may be determined. In this regard, the number of MPMs included in the MPM list when general intra prediction is applied may be different from the number of MPMs included in the MPM list when the combined prediction mode is applied. In the example, the MPM list includes 6 or 5 MPMs when the combined prediction mode is not applied, and the MPM list may include 4 or 3 MPMs when the combined prediction mode is applied. In other words, when general intra prediction is performed, N MPMs are used, and when the combined prediction mode is applied, less than N MPMs may be used.
[0366] In the example, when the general intra prediction mode is applied, it is assumed that the MPMs derived based on the intra prediction modes of neighboring blocks adjacent to the current block are plane, DC, INTRA_MODE32, INTRA_MODE31, INTRA_MODE33, and INTRA_MODE30. When the combined prediction mode is applied to the current block, the intra prediction mode of the current block can be determined by using only a part of the above 6 MPMs. In the example, the intra prediction mode of the current block can be determined by using an MPM list including 3 MPMs (plane, DC, and INTRA_MODE32) with the smallest index among the MPMs. Optionally, the MPM with a predefined index value among the MPMs can be determined as the intra prediction mode of the current block.
[0367] In another example, the number of MPMs used to determine the intra prediction mode of the current block when general intra prediction is applied may be set to be the same as the number of MPMs used to determine the intra prediction mode of the current block when the combined prediction mode is applied.
[0368] When the combined prediction mode is applied, encoding of the MPM flag may be omitted and the MPM flag may be inferred to be true. In other words, when the combined prediction mode is applied, any one of the MPMs may be determined as the intra prediction mode of the current block.
[0369] Optionally, based on the intra prediction mode of the neighboring block adjacent to the current block, the intra prediction mode of the current block may be derived. In this regard, the neighboring block may include at least one of an upper neighboring block, a left neighboring block, an upper left neighboring block, an upper right neighboring block, or a lower left neighboring block. The intra prediction mode of the current block may be set to the intra prediction mode with the highest frequency among the intra prediction modes of the neighboring blocks adjacent to the current block.
[0370] Optionally, the intra-frame prediction mode of the current block may be determined by comparing the intra-frame prediction modes of the neighboring blocks at the predefined positions. In an example, when the intra-frame prediction modes of the upper neighboring block and the left neighboring block of the current block are the same, the intra-frame prediction mode of the current block may be set to be the same as the intra-frame prediction modes of the upper neighboring block and the left neighboring block.
[0371] Optionally, index information for specifying a neighboring block of the same intra-frame prediction mode as the current block among a plurality of neighboring blocks may be signaled in the bitstream. In an example, information indicating any one of an upper neighboring block or a left neighboring block may be signaled in the bitstream, and the intra-frame prediction mode of the current block may be set to be the same as the intra-frame prediction mode of the block indicated by the information.
[0372] Alternatively, when the combined prediction mode is applied to the neighboring block, the intra prediction mode of the neighboring block to which the combined prediction mode is applied may be set as the intra prediction mode of the current block.
[0373] When the combined prediction mode combining the merge mode and the intra prediction is applied to the current block, it can be set not to use the multi-line intra prediction encoding method. If the multi-line intra prediction encoding method is not used, the adjacent reference sample point line can be used for the intra prediction of the current block.
[0374] Optionally, when a combined prediction mode combining a merge mode and an intra prediction is applied to the current block, it may be set to use a multi-line intra prediction encoding method. Information for determining a reference sample line of the current block among a plurality of reference sample lines may be signaled in a bitstream. Optionally, the reference sample line of the current block may be determined in consideration of at least one of a size of the current block, a shape of the current block, an intra prediction mode of the current block, or a reference sample line of a neighboring block.
[0375] Optionally, information indicating whether the multi-line intra method is applied in the combined prediction mode may be sent as a bitstream signal. The information may be a 1-bit flag. When the above indicates that the multi-line intra method is applied, index information specifying any one of the multiple lines may be sent as a bitstream signal.
[0376] The number of available candidate intra prediction modes may be set differently according to the reference sample line of the current block. In an example, when an adjacent reference sample line is used, the candidate intra prediction mode may include at least one of a plane, a DC, a horizontal intra prediction mode, a vertical intra prediction mode, a lower left diagonal intra prediction mode, or an upper right diagonal intra prediction mode. On the other hand, when a non-adjacent reference sample line is used, the candidate intra prediction mode may include at least one of a horizontal intra prediction mode, a vertical intra prediction mode, a lower left diagonal intra prediction mode, or an upper right diagonal intra prediction mode.
[0377] The first prediction block may be generated by using a merge candidate selected in a merge mode, and the second prediction block may be generated by using an intra prediction mode. In this regard, when the first prediction block is generated, the triangle partition may be set to not be applied to the current block. In other words, in a combined prediction mode combining the merge mode and the intra prediction, the triangle partition may not be allowed. In addition, when the second prediction block is generated, the PDPC may be set to not be applied to the current block. In other words, in a combined prediction mode combining the merge mode and the intra prediction, the PDPC may not be allowed.
[0378] Based on the weighted sum operation of the first prediction block and the second prediction block, a third prediction block may be generated. In an example, Equation 6 is a diagram showing an example of generating a third prediction block based on the weighted sum operation of the first prediction block and the second prediction block.
[0379] [Equation 6]
[0380] P comb =(w*P merge +(Nw)*P intra +4)>>log2N
[0381] In Equation 6, P mergerepresents the first prediction block obtained based on the merge mode, and P intra P represents the second prediction block obtained based on intra-frame prediction. comb represents a third prediction block obtained by combining the first prediction block and the second prediction block. w represents a first weight applied to the first prediction block. A second weight applied to the second prediction block may be derived by differentiating the first weight w from a constant N. In this regard, N may have a predefined value in the encoder and the decoder. In an example, N may be 4 or 8. Optionally, the constant N may be derived based on at least one of a size, a shape, or an intra prediction mode of the current block.
[0382] Unlike the example shown in Equation 6, w may be set as the second weight, and a value obtained by differentiating the second weight from a predetermined constant N may be set as the first weight.
[0383] The weights applied to the first prediction block and the second prediction block may be determined based on at least one of whether the intra prediction mode or merge mode of the current block has bidirectional motion information. In an example, the value of the first weight w when the intra prediction mode of the current block is a directional prediction mode may be greater than the value of the first weight w when the intra prediction mode of the current block is a non-directional prediction mode. Optionally, the value of the first weight w when bidirectional prediction is performed by merging candidates may be greater than the value of the first weight w when unidirectional prediction is performed by merging candidates.
[0384] In another example, the weight may be determined by considering the prediction coding mode of the neighboring blocks adjacent to the current block. In this regard, the neighboring block may include at least one of the upper neighboring block adjacent to the upper part of the current block, the left neighboring block adjacent to the left side of the current block, or the upper left neighboring block adjacent to the upper left corner of the current block. The weight may be determined based on the number of neighboring blocks encoded by intra-frame prediction in the neighboring blocks adjacent to the current block. In the example, when the number of neighboring blocks encoded by intra-frame prediction in the neighboring blocks adjacent to the current block is increasing, the first weight may be set to have a smaller value and the second weight may have a larger value. On the other hand, when the number of neighboring blocks encoded by non-intra-frame prediction in the neighboring blocks adjacent to the current block is decreasing, the first weight may be set to have a larger value and the second weight may have a smaller value. In the example, when both the left neighboring block and the upper neighboring block are encoded by intra-frame prediction, the second weight may be set to n. When only one of the left neighboring block and the upper neighboring block is encoded by intra-frame prediction, the second weight may be set to n / 2. When both the left neighboring block and the upper neighboring block are not encoded by intra prediction, the second weight may be set to n / 4. In this regard, n represents an integer equal to or less than N.
[0385] The weight may be determined in units of samples or subblocks in the current block. In an example, the current block is partitioned into a plurality of subblocks, and the weight applied to each subblock may be set to have different values, respectively. In this regard, the number of subblocks may have a fixed value in the encoder and the decoder. Alternatively, the number of subblocks may be adaptively determined based on at least one of the size or shape of the current block, the intra-frame prediction mode of the current block, or the prediction coding mode of the neighboring blocks.
[0386] Fig.25 is a diagram showing aspects of application of weights.
[0387] The current block is partitioned into a plurality of sub-blocks, and the weight applied to each sub-block may be set to a different value from each other. Fig.25 In the examples shown in (a) and (b) of , the second weight may be set to have a value greater than the first weight for a sub-block including a sample located at the upper left corner in the current block, and the first weight may be set to have a value greater than the second weight for a sub-block including a sample located at the lower right corner in the current block.
[0388] The third predicted sub-block for the sub-block can be obtained by weighted prediction of the first predicted sub-block and the second predicted sub-block corresponding to the sub-block. In this regard, Fig.25 In the example shown in , the weight for weighted prediction for each sub-block may be set differently.
[0389] The weight assigned to the subblock may be determined differently depending on whether the merge candidate has bidirectional motion information.
[0390] Fig.26 An example is shown in which different weights are assigned to subblocks according to whether a merge candidate has bidirectional motion information.
[0391] When the merge candidate has bidirectional motion information, the first weight w assigned to at least one of the sub-blocks may be set to a larger value than when the merge candidate has unidirectional motion information. Fig.26 (a) and (b) show that, with respect to all sub-blocks, the weight w applied when bidirectional prediction is applied has a larger value than the weight w applied when unidirectional prediction is applied.
[0392] Alternatively, based on the intra prediction mode of the current block, the weights applied to the sub-blocks may be determined.
[0393] Fig. 27 An example of assigning different weights to subblocks according to the intra prediction mode of the current block is shown.
[0394] When the intra prediction mode of the current block has a vertical direction, the second weight of the subblock located above the current block may be set to have a greater value than the second weight of the subblock located below the current block.
[0395] In an example, for a sub-block located above the current block, the second weight may be set to have a larger value than the first weight, and for a sub-block located below the current block, the first weight may be set to have a value equal to or larger than the second weight.
[0396] When the intra prediction mode of the current block has a horizontal direction, the second weight of the subblock located on the left side of the current block may be set to have a greater value than the second weight of the subblock located on the right side of the current block.
[0397] In an example, for a sub-block located on the left side of the current block, the second weight may be set to have a larger value than the first weight, and for a sub-block located on the right side of the current block, the first weight may be set to have a value equal to or larger than the second weight.
[0398] In another example, when the intra-frame prediction mode of the current block has a vertical direction, the first weight of the sub-block located above the current block can be set to have a larger value than the first weight of the sub-block located below the current block, or when the intra-frame prediction mode of the current block has a horizontal direction, the first weight of the sub-block located on the left side of the current block can be set to have a larger value than the first weight of the sub-block located on the right side of the current block.
[0399] In another example, the weight assigned to each sub-block may be determined based on a prediction coding mode of a neighboring block adjacent to the current block. In one example, when an upper neighboring block of the current block is encoded by intra-frame prediction and a left neighboring block of the current block is not encoded by intra-frame prediction, a second weight of a sub-block located above the current block may be set to have a larger value than a second weight of a sub-block located below the current block. On the other hand, when an upper neighboring block of the current block is not encoded by intra-frame prediction and a left neighboring block of the current block is encoded by intra-frame prediction, a second weight of a sub-block located on the left side of the current block may be set to have a larger value than a second weight of a sub-block located on the right side of the current block.
[0400] For at least one of the plurality of subblocks, the first weight or the second weight may be set to 0. In other words, for at least one of the plurality of subblocks, the first prediction subblock or the second prediction subblock may be set to the third prediction subblock. Therefore, combined prediction may not be performed on at least one of the plurality of subblocks. In one example, for at least one of the plurality of subblocks, the first weight w may be set to 0 or a constant N.
[0401] A block to which a combined prediction mode combining a merge mode and an intra prediction is applied may be considered to be encoded by inter prediction. Therefore, the intra prediction mode of a block encoded by the combined prediction mode may be set to be unavailable for deriving an intra prediction mode of a block to be encoded / decoded. When deriving an MPM, the intra prediction mode of an unavailable block may be considered to be flat.
[0402] On the other hand, motion information of a block encoded by a combined prediction mode may be set as motion information that may be used to derive a block to be encoded / decoded.
[0403] In a mode in which the merge mode and the merge mode are combined, motion compensation prediction can be performed by using multiple merge candidates. Specifically, a first prediction block can be generated by using a first merge candidate, and a second prediction block can be generated by using a second merge candidate. Based on a weighted operation of the first prediction block and the second prediction block, a third prediction block can be generated.
[0404] Alternatively, after partitioning the current block into a plurality of sub-partitions (eg, sub-blocks), the combined prediction mode may be applied.
[0405] Fig.28 is a diagram illustrating an example of partitioning a current block into a plurality of sub-partitions.
[0406] like Fig.28 In the examples shown in (a) to (d) of FIG. 1 , the current block may be partitioned into two sub-partitions based on a horizontal line, a vertical line, a diagonal line in an upper left direction, or a diagonal line in an upper right direction.
[0407] At least one of information indicating whether the current block is partitioned into a plurality of sub-partitions or information indicating a partition type of the current block may be signaled in a bitstream. The information indicating the partition type of the current block represents at least one of a type, a direction, or a position of a partition line for partitioning the current block. In one example, based on the information indicating the partition type, at least one of whether the partition line for partitioning the current block is a horizontal line, a vertical line, or a diagonal line, or whether the partition line for partitioning the current block connects the upper right and lower left of the current block or connects the upper left and lower right of the current block may be determined.
[0408] The current block is partitioned into a plurality of sub-partitions, and the motion information of each sub-partition may be set to be derived from different merge candidates. In one example, if the motion information of the first sub-partition is derived from the first merge candidate, the motion information of the second sub-partition may be derived from a second merge candidate different from the first merge candidate.
[0409] In the combined prediction mode that combines the merge mode and the merge mode, information for specifying the first merge candidate and the second merge candidate may be respectively transmitted in a bitstream signal. In one example, index information merge_idx for specifying the first merge candidate and index information merge_2nd_idx for specifying the second merge candidate may be transmitted in a bitstream signal. The second merge candidate may be determined based on the index information merge_2nd_idx and the index information merge_idx.
[0410] The index information merge_idx specifies any one of the merge candidates included in the merge candidate list.
[0411] The index information merge_2nd_idx may specify any one of the remaining merge candidates except the merge candidate specified by merge_idx. Therefore, when the value of merge_2nd_idx is less than the value of merge_idx, the merge candidate indexed by the value of merge_2nd_idx may be set as the second merge candidate. When the value of merge_2nd_idx is equal to or greater than the value of merge_idx, the merge candidate whose index value is obtained by adding 1 to the value of merge_2nd_idx may be set as the second merge candidate.
[0412] Optionally, considering the search order of candidate blocks, a second merge candidate may be specified.
[0413] Fig.29 An example is shown in which the second merge candidate is specified in consideration of the search order of the candidate blocks.
[0414] exist Fig.29 In the example shown in , the indexes marked in the neighboring samples and non-neighboring samples show the search order of the candidate blocks. In one example, the candidate blocks may be searched sequentially from positions A0 to A14.
[0415] When block A4 is selected as the first merge candidate, the merge candidate derived from the candidate block after A4 in the search order may be designated as the second merge candidate. In one example, the merge candidate derived from A5 may be selected as the second merge candidate. If the candidate block at the position of A5 is not available as a merge candidate, the merge candidate derived from the next candidate block may be selected as the second merge candidate.
[0416] The first merge candidate and the second merge candidate may be selected among merge candidates derived from non-neighboring blocks.
[0417] Fig.30 An example of selecting a first merge candidate and a second merge candidate from merge candidates derived from non-neighboring blocks is shown.
[0418] like Fig.30 In the example shown in , merge candidates derived from a first candidate block and a second candidate block that are not adjacent to the current block may be selected as the first merge candidate and the second merge candidate, respectively. In this regard, the block line to which the first candidate block belongs may be different from the block line to which the second candidate block belongs. In one example, the first merge candidate may be derived from any candidate block from A5 to A10, and the second merge candidate may be derived from any candidate block from A11 to A15.
[0419] Optionally, the first candidate block and the second candidate block may be set not to be included in the same line (eg, row, column).
[0420] In another example, the second merge candidate may be specified based on the first merge candidate. In this regard, the first merge candidate may be specified by index information merge_idx that is signaled through the bitstream. In one example, a merge candidate adjacent to the first merge candidate may be determined as the second merge candidate. In this regard, the merge candidate adjacent to the first merge candidate may represent a merge candidate whose index difference value with the first merge candidate is 1. In one example, a merge candidate having an index value of merge_idx+1 may be set as the second merge candidate. In this regard, when the value of merge_idx+1 is greater than the maximum index value (or, when the index value of the first merge candidate is the maximum index), a merge candidate having an index value of merge_idx-1 or an index value of a predefined value (e.g., 0) may be set as the second merge candidate.
[0421] Alternatively, the merge candidate adjacent to the first merge candidate may represent a merge candidate derived from a candidate block that is spatially adjacent to the candidate block used to derive the first merge candidate. In this regard, the neighboring candidate block of the candidate block may represent a block adjacent to the left, right, above, below, or diagonally of the candidate block.
[0422] In another example, the second merge candidate may be specified based on the motion information of the first merge candidate. In one example, a merge candidate having the same reference picture as the first merge candidate may be selected as the second merge candidate. When there are multiple merge candidates having the same reference picture as the first merge candidate, a merge candidate having the smallest index among the multiple merge candidates, a merge candidate having the smallest index difference from the first merge candidate, or a merge candidate having the smallest motion vector difference from the first merge candidate may be selected as the second merge candidate. Optionally, the second merge candidate may be selected based on index information specifying any one of the multiple merge candidates.
[0423] Optionally, when the first merge candidate has unidirectional prediction information of the first direction, the merge candidate including motion information about the second direction may be set as the second merge candidate. In one example, when the first merge candidate has motion information of the L0 direction, the merge candidate having motion information of the L1 direction may be selected as the second merge candidate. When there are multiple merge candidates having motion information of the L1 direction, the merge candidate having the smallest index among the multiple merge candidates or the merge candidate having the smallest index difference with the first merge candidate may be set as the second merge candidate. Optionally, the second merge candidate may be selected based on index information specifying any one of the multiple merge candidates.
[0424] When a first merge candidate is selected in the merge candidate list and the selected first merge candidate has unidirectional motion information of a first direction, the merge candidate list may be rearranged, and based on the rearranged merge candidate list, a second merge candidate may be selected. The rearrangement may be performed so that an index of a merge candidate having motion information of the second direction has a smaller value than an index of a merge candidate having motion information of the first direction.
[0425] Fig.31 is a diagram illustrating an example of rearranging merge candidates.
[0426] When the first merge candidate has unidirectional motion information of the L0 direction, reordering may be performed to arrange the merge candidate having the motion information of L1 at the front of the merge candidate list.
[0427] In one example, if Fig.31 In the example shown in , reordering may be performed such that a merge candidate having motion information in an L1 direction has a smaller index value than a merge candidate having unidirectional motion information in an L0 direction.
[0428] Different from Fig.31 In the example shown in , the unidirectional merge candidate in the L1 direction may be set to have a higher priority than the bidirectional merge candidate.
[0429] Optionally, a first merge candidate list and a second merge candidate list may be generated. In this regard, the corresponding first merge candidate and second merge candidate may be derived from different merge candidate lists. In one example, the first merge candidate may be derived from the first merge candidate list, and the second merge candidate may be derived from the second merge candidate list. In this regard, the first merge candidate list may include a merge candidate including motion information in the L0 direction, and the second merge candidate list may include a merge candidate including motion information in the L1 direction. Optionally, when the merge candidate has bidirectional motion information, it may be set to use only one of the L0 motion information or the L1 motion information. In this regard, whether to use which of the L0 motion information or the L1 motion information may be determined based on the index of the merge candidate.
[0430] In one example, when the index of the merge candidate is an even number, only the L1 motion information of the merge candidate may be used. On the other hand, when the index of the merge candidate is an odd number, only the L0 motion information of the merge candidate may be used. Contrary to the described example, when the index of the merge candidate is an even number, it may be set to use only the L0 motion information, and when the index of the merge candidate is an odd number, it may be set to use only the L1 motion information.
[0431] In another example, the first merge candidate may be set to one of merge candidates derived from neighboring blocks adjacent to the current block, and the second merge candidate may be set to one of merge candidates derived from non-neighboring blocks not adjacent to the current block.
[0432] In another example, the first merge candidate may be set to one of merge candidates derived from a candidate block located above the current block, and the second merge candidate may be set to one of merge candidates derived from a candidate block located on the left side of the current block.
[0433] In the combined prediction mode combining the above-mentioned merge mode and merge mode, the merge mode may represent a merge mode based on a translation motion model (hereinafter, referred to as a translation merge mode) or a merge mode based on an affine motion model (hereinafter, referred to as an affine merge mode). In other words, motion compensated prediction may be performed by combining the translation merge mode and the translation merge mode or by combining the affine merge mode and the affine merge mode.
[0434] In another example, when a neighboring block used to derive a first merge candidate is encoded based on affine motion information, a merge candidate derived from the neighboring block encoded based on the affine motion information may be set as a second merge candidate. In one example, when the first merge candidate is an affine merge candidate or the first merge candidate is derived based on motion information of a sub-block in a coding block encoded according to affine motion information, a merge candidate derived based on the affine motion information or based on motion information of a sub-block in a coding block encoded according to the affine merge candidate may be selected as the second merge candidate. In this regard, the second merge candidate may include at least one of a merge candidate whose search order is closest to the first merge candidate among the merge candidates that satisfy the above conditions, a merge candidate whose index has the smallest difference from the first merge candidate, a merge candidate with the smallest index, or a merge candidate whose motion vector has the smallest difference from the first merge candidate.
[0435] In contrast to the above example, when a neighboring block used to derive a first merge candidate is encoded based on translational motion information (i.e., non-affine motion information), a merge candidate derived from the neighboring block encoded based on the translational motion information may be set as a second merge candidate. In one example, when the first merge candidate is a non-affine merge candidate, the non-affine merge candidate may be selected as the second merge candidate. In this regard, the second merge candidate may include at least one of a merge candidate whose search order is closest to the first merge candidate among the non-affine merge candidates, a merge candidate whose index has the smallest difference from the first merge candidate, a merge candidate with the smallest index, or a merge candidate whose motion vector has the smallest difference from the first merge candidate.
[0436] Alternatively, the second merge candidate may be derived by adding an offset to the index of the first merge candidate or subtracting the offset from the index of the first merge candidate, but when the encoding methods of the neighboring blocks used to derive the first merge candidate and the second merge candidate are different from each other, the second merge candidate may be replaced by another merge candidate. Only when the number of merge candidates included in the merge candidate list is less than a predefined number, the second merge candidate may be derived by adding an offset to the first merge candidate or subtracting the offset from the first merge candidate. In this regard, the predefined number may be 2, 3, 4, etc.
[0437] Fig.32 is a diagram for explaining an example of determining a second merge candidate.
[0438] When the first merge candidate is selected, a merge candidate having an index derived by adding an offset to the index of the first merge candidate or subtracting an offset from the index of the first merge candidate may be selected as the second merge candidate. In one example, a merge candidate having a value indicated by merge_idx signaled through a bitstream as an index may be selected as the first merge candidate, and a merge candidate having merge_idx+1 as an index may be selected as the second merge candidate.
[0439] In this regard, when the first merge candidate is derived from a sub-block belonging to a coding block encoded by an affine merge candidate or an affine motion model, the second merge candidate should also be set to a merge candidate derived from a sub-block belonging to a coding block encoded by an affine merge candidate or an affine motion model. When a merge candidate having merge_idx+1 as an index is not an affine merge candidate or is not derived from a sub-block belonging to a coding block encoded by an affine motion model, another merge candidate may be set to the second merge candidate. In this regard, the other merge candidate may be a merge candidate whose index among merge candidates derived from a sub-block belonging to a coding block encoded by an affine merge candidate or an affine motion model has the smallest difference from the first merge candidate or from merge_idx+1.
[0440] Conversely, when the first merge candidate is a non-affine merge candidate, the second merge candidate should also be set as a non-affine merge candidate. When a merge candidate having merge_idx+1 as an index is derived from a subblock belonging to a coding block encoded by an affine merge candidate or an affine motion model, another merge candidate may be set as the second merge candidate. In this regard, the other merge candidate may be a merge candidate whose index among the non-affine merge candidates has the smallest difference from the first merge candidate or from merge_idx+1. In one example, Fig.32 The example shown in shows that merge candidate A3 having merge_idx+2 as an index is set as the second merge candidate.
[0441] In another example, motion compensated prediction may be performed by combining the translation merge mode and the affine merge mode. In other words, of the first merge candidate or the second merge candidate, one may be an affine merge candidate and the other may be a non-affine merge candidate.
[0442] The combined prediction block may be obtained by a weighted sum operation of a first prediction block derived from the first merge candidate and a second prediction block derived based on the second merge candidate. The weight may be a real number including 0. In this regard, the value of the weight applied to the first prediction block may be set to be greater than the value of the weight applied to the second prediction block.
[0443] Optionally, based on the motion information of the first merge candidate and the second merge candidate, a weight may be determined. In one example, based on the difference in output order between the reference picture and the current picture, a weight applied to the first prediction block and the second prediction block may be determined. Specifically, when the difference in output order between the reference picture and the current picture is large, the weight applied to the prediction block may be set to a smaller value.
[0444] Optionally, the weights applied to the first prediction block and the second prediction block may be determined considering the size or shape of the candidate block for deriving the first merge candidate (hereinafter, referred to as the first candidate block) and the size or shape of the candidate block for deriving the second merge candidate (hereinafter, referred to as the second candidate block). In one example, the weight applied to the prediction block derived from the candidate block having a similar shape to the current block among the first candidate block and the second candidate block may be set to a larger value. On the other hand, the weight applied to the prediction block derived from the prediction block having a dissimilar shape to the current block may be set to a smaller value.
[0445] Fig.33 is a diagram illustrating an example of determining a weight applied to a prediction block based on the shape of a candidate block.
[0446] Assume that the current block has a non-square shape with a width greater than the height.
[0447] The first prediction block and the second prediction block may be derived based on the first merge candidate and the second merge candidate, and a combined prediction block may be generated based on a weighted sum operation of the first prediction block and the second prediction block. In this regard, weights applied to the first prediction block and the second prediction block may be determined based on shapes of the first candidate block and the second candidate block.
[0448] In one example, in Fig.33 In the example shown in , the first candidate block has a square shape and the second candidate block has a non-square shape with a width greater than a height. Since the shape of the second candidate block is the same as the current block, the weight applied to the second prediction block may be set to have a larger value than the weight applied to the first prediction block. In one example, a 5 / 8 weight may be applied to the second prediction block and a 3 / 8 weight may be applied to the first prediction block. Equation 7 below shows an example of deriving a combined prediction block based on a weighted sum operation of the first prediction block and the second prediction block.
[0449] [Equation 7]
[0450] P(x, y)=(3*P1(x, y)+5*P2(x, y))>>3
[0451] P(x, y) represents a combined prediction block, P1(x, y) represents a first prediction block, and P2(x, y) represents a second prediction block.
[0452] In another example, based on the shape of the current block, the weights applied to the first prediction block and the second prediction block may be determined. In one example, when the current block has a non-square shape with a width greater than a height, a larger weight may be applied to a prediction block generated based on a candidate block located above the current block in the first merge candidate and the second merge candidate. When both the first merge candidate and the second merge candidate are derived from a candidate block located above, the weight applied to the first prediction block may be set equal to the weight applied to the second prediction block. On the other hand, when the current block has a non-square shape with a height greater than a width, a larger weight may be applied to a prediction block generated based on a candidate block located to the left of the current block in the first merge candidate and the second merge candidate. When both the first merge candidate and the second merge candidate are derived from a candidate block located to the left, the weight applied to the first prediction block may be set equal to the weight applied to the second prediction block. When the current block is a square, the weight applied to the first prediction block may be set equal to the weight applied to the second prediction block.
[0453] In another example, based on the distance between the current block and the candidate block, the weight applied to each prediction block may be determined. In this regard, the distance may be derived based on the x-axis coordinate difference from the current block, the y-axis coordinate difference from the current block, or a minimum value therebetween. The weight applied to a prediction block derived from a merge candidate having a small distance from the current block may be set to be greater than the weight applied to a prediction block derived from a merge candidate having a large distance from the current block. In one example, Fig.30 In the example shown in , the first merge candidate is derived from a neighboring block adjacent to the current block, and the second merge candidate is derived from a non-neighboring block that is not adjacent to the current block. In this case, since the x-axis distance between the first candidate block and the current block is smaller than the x-axis distance between the second candidate block and the current block, the weight applied to the first prediction block may be set to be greater than the weight applied to the second prediction block.
[0454] Optionally, when both the first merge candidate and the second merge candidate are derived from non-neighboring blocks, a larger weight may be assigned to the prediction block derived from the non-neighboring block that is closer to the current block. Fig.32 In the example shown in , since the y-axis distance between the first candidate block and the current block is smaller than the y-axis distance between the second candidate block and the current block, the weight applied to the first prediction block can be set to be greater than the weight applied to the second prediction block.
[0455] Considering the priority between the merge candidates, the weight applied to the first prediction block and the second prediction block may be determined. In this regard, the priority between the merge candidates may be determined based on at least one of the following items: whether the merge candidate is derived from a spatially neighboring block, whether the merge candidate is derived from a temporally neighboring block, whether the merge candidate is added to the merge candidate list from a motion information table, whether the merge candidate is generated by combining two merge candidates, or an index assigned to the merge candidate.
[0456] In one example, considering whether the first merge candidate or the second merge candidate is a merge candidate added to the merge candidate list from the motion information table, the weights applied to the first prediction block and the second prediction block may be determined. Specifically, the weight applied to the prediction block derived based on the motion information of the merge candidate derived from the motion information table may be set to be smaller than the weight applied to the prediction block derived based on the motion information of the merge candidate not derived from the motion information table.
[0457] In one example, when both the first merge candidate and the second merge candidate are derived from a spatial neighboring block or a temporal neighboring block, the combined prediction block may be derived by applying Equation 7. On the other hand, when the first merge candidate is derived from a spatial neighboring block or a temporal neighboring block and the second merge candidate is derived from a motion information candidate included in the motion information table, the weight applied to the first prediction block may be set to be greater than the weight applied to the second prediction block. In one example, Equation 8 shows an example in which the weight applied to the first prediction block is greater than the weight applied to the second prediction block.
[0458] [Equation 8]
[0459] P(x, y) = (5*P1(x, y) + 3*P2(x, y))>>3 Alternatively, if Fig.25 As described in the example in , the weights applied to the first prediction block and the second prediction block may be set differently for each sub-block.
[0460] Optionally, when the current block is partitioned into a plurality of sub-partitions, the weight applied to the first prediction block and the weight applied to the second prediction block may be set differently for each sub-block. In one example, it may be set that: for the first sub-partition, the weight applied to the first prediction block is greater than the weight applied to the second prediction block, and for the second sub-partition, the weight applied to the second prediction block is greater than the weight applied to the first prediction block.
[0461] Optionally, it may be set that: for the first sub-partition, the weight applied to the first prediction block is greater than the weight applied to the second prediction block, and for the second sub-partition, the weight applied to the second prediction block is greater than the weight applied to the first prediction block, but for the boundary area between the first sub-partition and the second sub-partition, the weight applied to the first prediction block and the weight applied to the second prediction block have the same value. In this regard, the boundary area may include at least one of samples located on a partition line that partitions the current block or samples whose distances to these samples are lower than a threshold.
[0462] Optionally, it can be set that: for one of the first subpartition and the second subpartition, the weight applied to the first prediction block is different from the weight applied to the second prediction block, and for the other of the first subpartition and the second subpartition, the weight applied to the first prediction block is equal to the weight applied to the second prediction block.
[0463] Fig.34 is a diagram illustrating an example of differently setting a weight applied to a prediction block for each sub-partition.
[0464] The example shown shows that for the first sub-partition, the weight applied to the second prediction block is set to be greater than the weight applied to the first prediction block, and for the second sub-partition, the weight applied to the first prediction block is set to be equal to the weight applied to the second prediction block. In one example, the combined prediction block for the first sub-partition can be derived based on Equation 9 below, and the combined prediction block for the second sub-partition can be derived based on Equation 10 below.
[0465] [Equation 9]
[0466] P(x, y)=(3*P1(x, y)+5*P2(x, y))>>3
[0467] [Equation 10]
[0468] P(x, y)=(4*P1(x, y)+4*P2(x, y))>>3
[0469] The consistent motion information may be derived based on the first merge candidate and the second merge candidate, and motion compensation prediction may be performed on the current block based on the consistent motion information. In one example, the motion vector of the current block may be derived based on an average operation or a weighted sum operation of motion vectors between the first merge candidate and the second merge candidate. In this regard, the weight of the motion vector applied to the first merge candidate and the weight of the motion vector applied to the second merge candidate may be determined by the above-mentioned embodiment.
[0470] When the first merge candidate is a non-affine merge candidate and the second merge candidate is an affine merge candidate, the motion vector of the current block may be derived by scaling the motion vector of the second merge candidate. Equation 11 represents an example of deriving the motion vector of the current block.
[0471] [Equation 11]
[0472] (mvX, mvY)=(mv0x, mv0y)+((mv1x, mv1y)>>M)
[0473] In Equation 11, (mvX, mvY) represents the motion vector of the current block, (mv0x, mv0y) represents the motion vector of the first merge candidate, and (mv1x, mv1y) represents the motion vector of the second merge candidate. M represents a scaling parameter. M may be predefined in the encoder and the decoder. Optionally, the value of the scaling parameter M may be determined according to the size of the current block or the candidate block. In an example, when the width or height of the second candidate block is greater than 32, M may be set to 3, otherwise, M may be set to 2.
[0474] The motion information of the first merge candidate or the second merge candidate may be stored as the motion information of the block to which the combined prediction mode combining the merge mode and the merge mode is applied. The stored motion information may be used to derive motion information of a block to be encoded / decoded later.
[0475] Optionally, the block may be partitioned into a plurality of sub-blocks, and any one of the motion information of the first merge candidate or the second merge candidate may be stored as the motion information of each sub-block. In this regard, the motion information of a portion of the plurality of sub-blocks may be set as the motion information of the first merge candidate, and the motion information of the other sub-blocks of the plurality of sub-blocks may be set as the motion information of the second merge candidate.
[0476] Alternatively, consistent motion information derived based on motion information of the first merge candidate and the second merge candidate may be stored as motion information of a block to which a combined prediction mode combining the merge mode and the merge mode is applied.
[0477] In a prediction mode combining the merge mode and the motion vector prediction mode, a first prediction block may be generated by using motion information derived from a merge candidate, and a second prediction block may be generated by using a motion vector derived from a motion vector prediction candidate.
[0478] In the motion vector prediction mode, a motion vector prediction candidate may be derived from a neighboring block adjacent to the current block or from a co-located block in a co-located picture. Afterwards, any one of a plurality of motion vector prediction candidates may be designated, and the designated motion vector prediction candidate may be set as a motion vector prediction factor for the current block. Hereinafter, the motion vector of the current block may be derived by adding the motion vector prediction factor of the current block to the difference value of the motion vector.
[0479] In a prediction mode that combines a merge mode and a motion vector prediction mode, a merge candidate and a motion vector prediction candidate may be derived from the same candidate block. In one example, if a merge candidate is specified by merge_idx, the motion vector of the candidate block used to derive the specified merge candidate may be set as a motion vector predictor. Alternatively, if a motion vector prediction candidate is specified by mvp_flag, a merge candidate derived from the candidate block used to derive the specified merge candidate may be selected.
[0480] Optionally, the candidate block used to derive the merge candidate may be different from the candidate block used to derive the motion vector prediction candidate. In one example, if the merge candidate derived from the candidate block located above the current block is selected, the motion vector prediction candidate derived from the candidate block located on the left side of the current block may be set to be selected.
[0481] Optionally, when a merge candidate selected by index information and a motion vector prediction candidate selected by index information are derived from the same candidate block, the motion vector prediction candidate may be replaced by a motion vector prediction candidate derived from a candidate block adjacent to the candidate block, or the merge candidate may be replaced by a merge candidate derived from a candidate block adjacent to the candidate block.
[0482] Fig.35 is a diagram illustrating an example of replacing a merge candidate.
[0483] Fig.35 The example shown in (a) of FIG. 1 shows that the merge candidate and the motion vector prediction candidate derived from the candidate block at the position of A2 are selected. As shown in the figure, when the merge candidate and the motion vector prediction candidate are derived from the same candidate block, the merge candidate or the motion vector prediction candidate derived from the candidate block adjacent to the candidate block can be used to replace the merge candidate or the motion vector prediction candidate. In an example, as Fig.35 In the example shown in (b) of , the merge candidate at the position of A1 may be used instead of the merge candidate at the position of A2.
[0484] The first prediction block may be derived based on the merge candidate of the current block, and the second prediction block may be derived based on the motion vector prediction candidate. Hereinafter, the combined prediction block may be derived by a weighted sum operation of the first prediction block and the second prediction block. In this regard, the weight applied to the second prediction block generated in the motion vector prediction mode may be set to be greater than the weight applied to the first prediction block generated in the merge mode. Alternatively, conversely, the weight applied to the first prediction block generated in the merge mode may be set to be greater than the weight applied to the second prediction block generated in the motion vector prediction mode.
[0485] Alternatively, if Fig.25 As described in the examples of , the weights applied to the first prediction block and the second prediction block may be set differently for each subblock.
[0486] The residual image can be derived by subtracting the predicted image from the original image. In this regard, when the residual image is converted to the frequency domain, the subjective image quality of the image will not be significantly reduced even if the high-frequency components are removed from the frequency components. Therefore, when the value of the high-frequency component is transformed to a small value, or when the value of the high-frequency component is set to 0, the compression efficiency can be improved without causing large visual distortion. Reflecting the above characteristics, a transformation can be performed on the current block so as to decompose the residual image into two-dimensional frequency components. The transformation can be performed by using a transformation method such as DCT (discrete cosine transform), DST (discrete sine transform), etc.
[0487] The transformation method may be determined based on the block. The transformation method may be determined based on at least one of a prediction coding mode for the current block, a size of the current block, or a shape of the current block. In an example, when the current block is encoded by an intra prediction mode and the size of the current block is less than N×N, the transformation may be performed by a transformation method using DST. On the other hand, when the above conditions are not met, the transformation may be performed by a transformation method using DCT.
[0488] For some blocks of the residual image, two-dimensional image transform may not be performed. Not performing two-dimensional image transform may be referred to as transform skipping. When transform skipping is applied, quantization may be applied to the residual value where transform is not performed.
[0489] After the current block is transformed by using DCT or DST, the transformed current block may be transformed again. In this regard, the DCT or DST-based transformation may be defined as a primary transformation, and performing the transformation again on the block to which the primary transformation is applied may be defined as a secondary transformation.
[0490] The first transform may be performed by using any one of a plurality of transform kernel candidates. In an example, the first transform may be performed by using any one of DCT2, DCT8, or DCT7.
[0491] Different transform kernels may be used for the horizontal direction and the vertical direction. Information indicating a combination of a transform kernel for the horizontal direction and a transform kernel for the vertical direction may be signaled in a bitstream.
[0492] The processing unit of the first transform may be different from that of the second transform. In an example, the first transform may be performed on an 8×8 block, and the second transform may be performed on a 4×4 sized sub-block within the transformed 8×8 block. In this regard, the transform coefficients for the remaining regions where the second transform is not performed may be set to 0.
[0493] Alternatively, the first transform may be performed on the 4×4 block, and the second transform may be performed on the region having a size of 8×8 including the transformed 4×4 block.
[0494] Information indicating whether to perform secondary transformation may be signaled in a bit stream.
[0495] Alternatively, whether to perform the secondary transformation may be determined based on whether the horizontal transformation kernel and the vertical transformation kernel are identical to each other. In one example, the secondary transformation may be performed only when the horizontal transformation kernel and the vertical transformation kernel are identical to each other. Alternatively, the secondary transformation may be performed only when the horizontal transformation kernel and the vertical transformation kernel are different from each other.
[0496] Alternatively, the secondary transform may be allowed only when a predefined transform kernel is used for the horizontal transform and the vertical transform. In one example, the secondary transform may be allowed when a DCT2 transform kernel is used for the horizontal transform and the vertical transform.
[0497] Alternatively, whether to perform a secondary transform may be determined based on the number of non-zero transform coefficients of the current block. In one example, when the number of non-zero transform coefficients of the current block is less than or equal to a threshold, the prediction method may be configured not to use a secondary transform. When the number of non-zero transform coefficients of the current block is greater than a threshold, the prediction method may be configured to use a secondary transform. As long as the current block is encoded using intra prediction, the prediction method may be configured to use a secondary transform.
[0498] The decoder may perform an inverse transform with respect to the secondary transform (secondary inverse transform), and may perform an inverse transform with respect to the first transform as a result of the secondary inverse transform (first inverse transform). As a result of performing the secondary inverse transform and the first inverse transform, a residual signal for the current block may be obtained.
[0499] When the encoder performs transformation and quantization, the decoder may obtain a residual block through inverse quantization and inverse transformation. The decoder may add the prediction block and the residual block to each other to obtain a reconstructed block for the current block.
[0500] When obtaining a reconstructed block of the current block, the loss of information occurring in the quantization and encoding process can be reduced through in-loop filtering. The in-loop filter may include at least one of a deblocking filter, a sample adaptive offset filter (SAO), or an adaptive loop filter (ALF).
[0501] The operation of applying the embodiments described for the decoding process or the encoding process to the encoding process or the decoding process, respectively, may be included in the scope of the present disclosure. Within the scope of the present disclosure, the embodiments in which the operations occur in a predetermined order may be modified to embodiments in which the operations occur in an order different from the predetermined order.
[0502] Although the above embodiments are described based on a series of operations or flow charts, the embodiments do not limit the time series order of the operations of the method to this. In another example, the operations can be performed simultaneously or in a different order from them as needed. In addition, in the above embodiments, each component (e.g., unit, module, etc.) in the components constituting the block diagram can be implemented in the form of hardware devices or software. Multiple components can be combined with each other as a single component that can be implemented using a single hardware device or software. The above embodiments can be implemented using program instructions that can be executed via various computer components. Instructions can be recorded in a computer-readable storage medium. The computer-readable storage medium can include program instructions, data files, data structures, etc., individually or in combination with each other. Examples of computer-readable storage media include magnetic media (such as hard disks, floppy disks, and tapes), optical storage media (such as CD-ROMs, DVDs), and magneto-optical media (such as floppy disks) and hardware devices (such as ROMs, RAMs, flash memories, etc.) that are specifically configured to store and execute program instructions therein. The hardware device can be configured to operate as one or more software modules to perform processing according to the present disclosure, and vice versa.
[0503] Industrial Applicability
[0504] The present disclosure may be applied to an electronic device that encodes / decodes a video.
Claims
1. A method for decoding a video, the method comprising: generating a merge candidate list for the current block, the merge candidate list being generated by adding at least one of a spatial merge candidate and a temporal merge candidate to the merge candidate list; In response to determining that the number of merge candidates included in the merge candidate list is less than a threshold value, updating the merge candidate list by adding a motion information candidate included in a motion information table as a new merge candidate to the merge candidate list; as well as Obtaining motion information of the current block based on the updated merge candidate list, Wherein, in the case where the current block is included in a parallel processing region, blocks included in the same parallel processing region as the current block are not used to update the motion information table.
2. The method according to claim 1, wherein: The method further comprises: updating the motion information table by adding the motion information of the current block as a new motion information candidate, In which, in response to determining that the motion information candidate identical to the new motion information candidate has been included in the motion information table, the motion information candidate identical to the new motion information candidate is deleted from the motion information table, and then the new motion information candidate is added to the motion information table with the highest index.
3. The method according to claim 1, wherein: The step of updating the merge candidate list includes: performing a redundancy check of the motion information candidate with the merge candidates included in the merge candidate list, Therein, the redundancy check of the motion information candidates is performed only on merge candidates derived from blocks at predefined positions.
4. The method according to claim 3, wherein: The blocks include a top neighboring block and a left neighboring block adjacent to the current block.
5. The method according to claim 1, wherein: The method further includes: re-updating the merge candidate list by adding pairs of merge candidates to the merge candidate list, The paired merge candidates are derived by averaging motion vectors of two merge candidates already included in the merge candidate list.
6. The method according to claim 1, wherein: The threshold is derived by subtracting a predefined offset from a maximum number of merge candidates that can be included in the merge candidate list.
7. The method according to claim 1, wherein: The current block is located at a lower right position in the parallel processing region.
8. A method for encoding a video, the method comprising: generating a merge candidate list of the current block, wherein the merge candidate list is generated by adding at least one of a spatial merge candidate and a temporal merge candidate to the merge candidate list; In response to determining that the number of merge candidates included in the merge candidate list is less than a threshold value, updating the merge candidate list by adding a motion information candidate included in a motion information table as a new merge candidate to the merge candidate list; as well as Obtaining motion information of the current block based on the updated merge candidate list, Wherein, in the case where the current block is included in a parallel processing region, blocks included in the same parallel processing region as the current block are not used to update the motion information table.
9. The method according to claim 8, wherein: The method further includes: updating the motion information table by adding the motion information of the current block as a new motion information candidate, and In which, in response to determining that the motion information candidate identical to the new motion information candidate has been included in the motion information table, the motion information candidate identical to the new motion information candidate is deleted from the motion information table, and then the new motion information candidate is added to the motion information table with the highest index.
10. The method according to claim 8, wherein: The step of updating the merge candidate list includes: performing a redundancy check of the motion information candidate with the merge candidates included in the merge candidate list, and Therein, the redundancy check of the motion information candidates is performed only on merge candidates derived from blocks at predefined positions.
11. The method according to claim 10, wherein: The blocks include a top neighboring block and a left neighboring block adjacent to the current block.
12. The method according to claim 8, wherein: The method further includes: re-updating the merge candidate list by adding pairs of merge candidates to the merge candidate list, The paired merge candidates are derived by averaging motion vectors of two merge candidates already included in the merge candidate list.
13. The method according to claim 8, wherein: The threshold is derived by subtracting a predefined offset from a maximum number of merge candidates that can be included in the merge candidate list.
14. The method according to claim 8, wherein: The current block is located at a lower right position in the parallel processing region.
15. A device for storing compressed video data generated by program instructions, wherein: When the program instructions are executed, the device is configured to: generating a merge candidate list of the current block, wherein the merge candidate list is generated by adding at least one of a spatial merge candidate and a temporal merge candidate to the merge candidate list; In response to determining that the number of merge candidates included in the merge candidate list is less than a threshold value, updating the merge candidate list by adding a motion information candidate included in a motion information table as a new merge candidate to the merge candidate list; as well as Obtaining motion information of the current block based on the updated merge candidate list, Wherein, in the case where the current block is included in a parallel processing region, blocks included in the same parallel processing region as the current block are not used to update the motion information table.
