Method for encoding / decoding image signal and apparatus therefor
By jointly encoding the video signal and selectively using the joint chroma signal, the problem of low encoding efficiency in high-definition video services is solved, and more efficient video signal encoding and decoding is achieved.
Patent Information
- Application Number
- CN202410931598.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2019-05-15
- Filing Date
- 2020-03-12
- Publication Date
- 2024-11-08
AI Technical Summary
Existing video encoding technologies such as HEVC show performance limitations in high-definition video services, making it difficult to effectively improve the video compression rate, resulting in large data volume and low encoding efficiency.
When encoding/decoding the video signal, the residual components of the chromaticity component are jointly encoded, and the generated joint chromaticity signal is selectively used to perform a secondary transformation to improve encoding/decoding efficiency.
The encoding/decoding efficiency of video signals is improved, and the compression performance of video data is optimized through joint encoding and selective use of joint chromaticity signals.
Smart Images

Figure CN118921455A_ABST
Abstract
Description
[0001] This application is a divisional application of an invention patent application with a filing date of March 12, 2020, named “Method and device for encoding / decoding image signals” and application number 202080005033.9. 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 required. 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] The present disclosure aims to provide a method for jointly encoding a residual component of a chrominance component when encoding / decoding a video signal and a device for performing the method.
[0006] An object of the present disclosure is to provide a method of selectively using various methods of generating a joint chrominance signal for chrominance components when encoding / decoding a video signal and an apparatus for performing the method.
[0007] An object of the present disclosure is to provide a method of performing secondary transformation when encoding / decoding a video signal and an apparatus 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] According to the present disclosure, the video signal decoding method may include: deriving residual coefficients of a current block, dequantizing the residual coefficients, deriving a joint residual signal by performing an inverse transform on the dequantized residual coefficients, and deriving a first residual signal for a first chroma component and a second residual signal for a second chroma component based on the joint residual signal.
[0011] According to the present disclosure, the video signal encoding method may include: generating a joint residual signal based on a first residual signal for a first chrominance component and a second residual signal for a second chrominance component, transforming the joint residual signal, deriving residual coefficients by quantizing the transformed joint residual signal, and encoding the residual coefficients.
[0012] The video signal decoding method according to the present disclosure may further include: determining one residual signal reconstruction mode candidate among the plurality of residual signal reconstruction mode candidates as the residual signal reconstruction mode for the current block.
[0013] In the video signal decoding method according to the present disclosure, a method of deriving a first residual signal may be different between when a first residual signal reconstruction mode is selected among the plurality of residual signal reconstruction mode candidates and when a second residual signal reconstruction mode is selected among the plurality of residual signal reconstruction mode candidates.
[0014] In the video signal decoding method according to the present disclosure, when the first residual signal reconstruction mode is selected, the first residual signal can be derived to be the same as the joint residual signal, and when the second residual signal reconstruction mode is selected, the first residual signal can be derived to have an opposite sign to the joint residual signal, or the first residual signal can be derived by scaling the joint residual signal.
[0015] The video signal decoding method according to the present disclosure may further include: parsing information for specifying a residual signal reconstruction mode.
[0016] In the video signal decoding method according to the present disclosure, the information may include a first flag and a second flag, wherein the first flag indicates whether there is a non-zero transform coefficient of a first chrominance component in the current block, and the second flag indicates whether there is a non-zero transform coefficient of a second chrominance component in the current block.
[0017] In the video signal decoding method according to the present disclosure, the first residual signal may have the same sign as the joint residual signal, and the second residual signal may have an opposite sign to the joint residual signal.
[0018] It will be appreciated 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.
[0019] Technical Effects
[0020] According to the present disclosure, the encoding / decoding efficiency of a video signal may be improved by jointly encoding residual components of chrominance components.
[0021] According to the present disclosure, encoding / decoding efficiency of a video signal may be improved by selectively using various methods of generating a joint chrominance signal.
[0022] According to the present disclosure, encoding / decoding efficiency can be improved by performing transformation on a residual signal multiple times.
[0023] 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
[0024] Figure 1 is a diagram illustrating a block diagram of a video encoding device (encoder) according to an embodiment of the present disclosure.
[0025] Figure 2 is a diagram showing a block diagram of a video decoding device (decoder) according to an embodiment of the present disclosure.
[0026] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present disclosure.
[0027] Figure 4 is a diagram illustrating various partition types of a coding block.
[0028] Figure 5 is a diagram illustrating an example of aspects of partitioning a CTU.
[0029] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present disclosure.
[0030] Figure 7 is a flow chart of the process of deriving current block motion information in merge mode.
[0031] Figure 8 is a diagram illustrating candidate blocks for deriving merge candidates.
[0032] Fig. 9 is a diagram illustrating candidate blocks for deriving merge candidates.
[0033] Fig.10 is a diagram for explaining the updating aspect of the motion information table.
[0034] Fig.11 is a diagram illustrating an updating aspect of a motion information table.
[0035] Fig.12 is a diagram illustrating an example of updating an index of a pre-stored motion information candidate.
[0036] Fig.13 is a diagram showing the positions of representative sub-blocks.
[0037] Fig.14 An example of generating a motion information table in the inter prediction mode is shown.
[0038] Fig.15 An example of generating a motion information table at each motion vector resolution is shown.
[0039] Fig.16 An example is shown in which motion information of a block to which the merge offset encoding method is applied is stored in a separate motion information table.
[0040] Fig.17 is a diagram illustrating an example of adding motion information candidates included in a long-term motion information table to a merge candidate list.
[0041] Fig.18 is a diagram illustrating an example of performing redundancy check on only a part of merge candidates.
[0042] Fig.19 is a diagram showing an example in which a redundancy check on a specific merge candidate is omitted.
[0043] Fig. 20 is a diagram showing 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.
[0044] Fig.21 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.
[0045] Fig. 22 is a diagram showing a temporary motion information table.
[0046] Fig.23 is a diagram showing an example of making the motion information table and the temporary motion information table consistent.
[0047] Fig.24 is a diagram illustrating an example of partitioning a coding block into a plurality of prediction units by using diagonal lines.
[0048] Fig.25 is a diagram illustrating an example in which a coding block is partitioned into two prediction units.
[0049] Fig.26 An example is shown in which a coding block is partitioned into a plurality of prediction blocks of different sizes.
[0050] Fig. 27 is a diagram illustrating neighboring blocks used to derive partition mode merge candidates.
[0051] Fig.28 is a diagram for explaining an example of determining availability of neighboring blocks per prediction unit.
[0052] Fig.29 and Fig.30 is a diagram illustrating an example of deriving a prediction sample based on a weighted sum operation of a first prediction sample and a second prediction sample.
[0053] Fig.31 is a flowchart of an intra-frame prediction method according to an embodiment of the present disclosure.
[0054] Fig.32 is a diagram showing an intra prediction mode.
[0055] Fig.33 and Fig.34 is a diagram showing an example of arranging reference points in a one-dimensional array in one line.
[0056] Fig.35 is a diagram showing an angle formed by a directional intra prediction mode and a straight line parallel to the x-axis.
[0057] Fig.36 is a diagram illustrating an aspect of obtaining prediction samples when a current block has a non-square shape.
[0058] Fig.37 is a diagram illustrating a wide-angle intra prediction mode.
[0059] Fig.38 : is a diagram showing an example of vertical direction partitioning and horizontal direction partitioning.
[0060] Fig.39 is a diagram illustrating an example of determining a partition type of a coding block.
[0061] Fig.40 is a diagram illustrating an example of determining a partition type of a coding block.
[0062] Fig.41 is a diagram illustrating an example of determining a partition type of a coding block based on an intra prediction mode of the coding block.
[0063] Fig.42 is a diagram used to describe the partitioning aspects of a coding block.
[0064] Fig.43 is a diagram illustrating an example of determining whether to perform transform skip per sub-block.
[0065] Fig.44is a diagram showing an example in which sub-blocks use the same transform type.
[0066] Fig.45 and Fig.46 is a diagram illustrating application aspects of the sub-transform block coding method.
[0067] Fig.47 and Fig.48 A horizontal direction transform type and a vertical direction transform type according to the position of a subblock that is a transform target are shown.
[0068] Fig.49 is a diagram showing aspects of encoding of transform coefficients when the reduction factor is 16.
[0069] Fig.50 and Fig.51 is a diagram illustrating an example of performing secondary transformation on available sub-blocks.
[0070] Fig.52 and Fig.53 is a diagram illustrating a flowchart of a joint chroma residual transformation method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0071] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
[0072] 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.
[0073] 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.
[0074] 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.
[0075] Figure 1 is a diagram showing a block diagram of an image encoding device (encoder) according to an embodiment of the present disclosure.
[0076] 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.
[0077] 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, each component is listed only for the convenience of explanation, 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.
[0078] 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.
[0079] 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).
[0080] 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.
[0081] 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.
[0082] 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.
[0083] 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.
[0084] 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.
[0085] 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.
[0086] 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.
[0087] 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 size in units of 1 / 2 pixel or 1 / 4 pixel. 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.
[0088] The intra prediction unit 125 may generate a prediction unit based on information about reference pixels around the current block (which is 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 therefore 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.
[0089] 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.
[0090] 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 based on the transform unit by using reference pixels. In addition, intra prediction using N×N partitions can be used only for the minimum coding unit.
[0091] 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.
[0092] 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.
[0093] 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.
[0094] 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.
[0095] The rearrangement unit 160 may perform rearrangement on coefficient values with respect to the quantized residual values.
[0096] 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.
[0097] 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).
[0098] 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 and information about transform units, information about motion vectors, information about reference frames, information about block interpolation, filtering information, and the like).
[0099] The entropy encoding unit 165 may entropy encode coefficients of the coding unit input from the rearrangement unit 160 .
[0100] 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.
[0101] The filter unit 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).
[0102] 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.
[0103] 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.
[0104] 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.
[0105] 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.
[0106] Figure 2 is a diagram showing a block diagram of an image decoding device (decoder) according to an embodiment of the present disclosure.
[0107] 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 .
[0108] 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.
[0109] 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 encoder device, various methods such as exponential Golomb coding, context adaptive variable length coding (CAVLC), or context adaptive binary arithmetic coding (CABAC) may be applied.
[0110] The entropy decoding unit 210 may decode information about intra prediction and inter prediction performed by the encoder.
[0111] 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.
[0112] 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.
[0113] 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.
[0114] 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 .
[0115] 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 based on the transform unit by using reference pixels. In addition, intra prediction using N×N partitions may be used only for the minimum coding unit.
[0116] 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.
[0117] 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.
[0118] 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.
[0119] 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.
[0120] 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.
[0121] 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.
[0122] 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.
[0123] 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.
[0124] 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.
[0125] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present disclosure.
[0126] 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.
[0127] 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.
[0128] 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.
[0129] 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.
[0130] 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.
[0131] 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.
[0132] 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.
[0133] 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.
[0134] Figure 4 is a diagram illustrating various partition types of a coding block.
[0135] 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.
[0136] 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").
[0137] 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.
[0138] 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.
[0139] 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.
[0140] 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.
[0141] The encoder may signal information indicating at least one of a partition type and a partition depth of the current block in a bitstream, and the decoder may determine a partition type and a partition depth of the CTU based on the information obtained by parsing the bitstream.
[0142] Figure 5 is a diagram illustrating an example of aspects of partitioning a CTU.
[0143] 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.
[0144] 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.
[0145] 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.
[0146] 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.
[0147] In order to determine the partition type of the coding block, information indicating whether the coding block is partitioned may be signaled in the bitstream. This information is a 1-bit flag "split_cu_flag", and when the flag is true, it may indicate that the coding block is partitioned by a multi-tree partitioning method.
[0148] 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.
[0149] 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 quadtree partitioning is applied again to the first coding block and the fourth coding block of the four coding blocks generated by quadtree partitioning. As a result, four coding blocks with a partition depth of 2 can be generated.
[0150] 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.
[0151] 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 the 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 the binary tree partitioning is applied to the coding block or the ternary tree partitioning is applied to the coding block.
[0152] 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.
[0153] 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.
[0154] 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.
[0155] 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 using the co-located prediction block, and thus the compression performance of the residual block may be improved.
[0156] 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.
[0157] 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.
[0158] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present disclosure.
[0159] 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.
[0160] 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.
[0161] 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.
[0162] Figure 7 is a flow chart of a process for deriving motion information for a current block in merge mode.
[0163] 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.
[0164] Figure 8 is a diagram illustrating candidate blocks for deriving merge candidates.
[0165] 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.
[0166] 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.
[0167] 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.
[0168] Sample points that are not located on the same vertical line, horizontal line, or diagonal line as adjacent basic sample points may be set as non-adjacent basic sample points.
[0169] Hereinafter, a candidate block including neighboring basic samples among the candidate blocks is referred to as a neighboring block, and a candidate block including non-neighboring basic samples is referred to as a non-neighboring block.
[0170] When the distance between the current block and the candidate block is equal to or greater than a threshold, the candidate block may be set to be unavailable as a merge candidate. The threshold may be determined based on the size of the coding tree unit. In an example, the threshold may be set to the height of the coding tree unit (ctu_height) or a value obtained by adding an offset to the height of the coding tree unit or subtracting an offset from the height of the coding tree unit (ctu_height±N). When the offset N is a predefined value in the encoding device and the decoding device, it may be set to 4, 8, 16, 32, or ctu_height.
[0171] When a difference between a y-axis coordinate of the current block and a y-axis coordinate of a sample included in the candidate block is greater than a threshold value, the candidate block may be determined to be unusable as a merge candidate.
[0172] 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.
[0173] When the upper boundary of the current block is adjacent to the upper boundary of the coding tree unit, multiple candidate blocks may be determined to be unavailable as merge candidates, so the encoding / decoding efficiency of the current block may be reduced. In order to solve such a problem, the number of candidate blocks located on the left side of the current block may be set to be greater than the number of candidate blocks located above the current block.
[0174] Fig. 9 is a diagram illustrating candidate blocks for deriving merge candidates.
[0175] As in Fig. 9 In the example shown in, the upper blocks of the N block rows above the current block and the left blocks of the M block columns on the left side of the current block can be set as candidate blocks. In this case, the number of left candidate blocks can be set to be greater than the number of upper candidate blocks by setting M to be greater than N.
[0176] In an example, the difference between the y-axis coordinate of the basic sample point in the current block and the y-axis coordinate of the upper block that can be used as the candidate block can be set to not more than N times the height of the current block. In addition, the difference between the x-axis coordinate of the basic sample point in the current block and the x-axis coordinate of the left block that can be used as the candidate block can be set to not more than M times the width of the current block.
[0177] In the example, Fig. 9The example shown in shows that blocks belonging to two block rows above the current block and blocks belonging to five left block columns to the left of the current block are set as candidate blocks.
[0178] 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.
[0179] 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.
[0180] A merge candidate list including merge candidates may be generated S702.
[0181] 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.
[0182] 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.
[0183] 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.
[0184] 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.
[0185] 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.
[0186] 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).
[0187] 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.
[0188] 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.
[0189] 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.
[0190] 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 partition level, or a block level. A preconfigured motion information table may be used until the information indicates initialization of the motion information table.
[0191] 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.
[0192] 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.
[0193] 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.
[0194] Fig.10 It is a diagram explaining the updating aspect of the motion information table.
[0195] For the current block, when inter prediction is performed S1001, a motion information candidate may be derived based on the current block S1002. The motion information of the motion information candidate may be set to be the same as the motion information of the current block.
[0196] When the motion information table is empty S1003 , the motion information candidate derived based on the current block may be added to the motion information table S1004 .
[0197] When the motion information table already includes motion information candidates S1003, a redundancy check S1005 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.
[0198] When a motion information candidate having the same motion information as the current block is not included, a motion information candidate derived based on the current block may be added to the motion information table S1008. Whether the motion information candidates are the same may be determined based on whether their motion information (e.g., motion vector / reference picture index, etc.) is the same.
[0199] In this regard, when the maximum number of motion information candidates has been stored in the motion information table S1006, the oldest motion information candidate may be deleted S1007, and the motion information candidate derived based on the current block may be added to the motion information table S1008. In this regard, the oldest motion information candidate may be a motion information candidate having a maximum index or a minimum index.
[0200] 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 has been stored in the motion information table, the motion information candidate having the largest index is removed.
[0201] 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.
[0202] Fig.11 is a diagram illustrating an updating aspect of a motion information table.
[0203] 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.
[0204] 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.11 The example shown in , n).
[0205] When the same motion information candidate as the motion information candidate derived based on the current block is pre-stored S1005 , the motion information candidate derived based on the current block may not be added to the motion information table S1009 .
[0206] 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.
[0207] Fig.12is a diagram showing an example in which indexes of pre-stored motion information candidates are updated.
[0208] 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.12 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.
[0209] Also, the motion information candidate mvCand derived based on the current block may be added to the end of the motion information table.
[0210] 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.
[0211] 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 not appropriate 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.
[0212] 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.
[0213] 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.
[0214] 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.
[0215] [Equation 1]
[0216] (xColSb, yColSb) = (xSb+shVector[0]>>4, ySb+shVector[1]>>4
[0217] 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).
[0218] The representative sub-block may mean a sub-block including an upper left sample point, a center sample point, a lower right sample point, an upper right sample point, or a lower left sample point of the current block.
[0219] Fig.13 is a diagram showing the positions of representative sub-blocks.
[0220] Fig.13 (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.13 (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.
[0221] 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.
[0222] Alternatively, based on at least one of a motion vector resolution of the current block, whether a merge offset encoding method is applied, whether combined prediction is applied, or whether triangle partitioning is applied, it may be determined whether the current block is to be used as a motion information candidate. In an example, the current block may be set to be unusable as a motion information candidate in at least one of the following cases: a case where a motion information resolution of the current block is equal to or greater than 2 integer pixels, a case where combined prediction is applied to the current block, or a case where a merge offset encoding method is applied to the current block.
[0223] 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.
[0224] 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.
[0225] 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, and a motion information table for a block encoded / decoded based on an affine motion model may be defined. According to the inter prediction mode of the current block, any one of the plurality of motion information tables may be selected.
[0226] Fig.14 An example of generating a motion information table in the inter prediction mode is shown.
[0227] 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.
[0228] The affine seed vector of the above block may be stored in a motion information candidate derived from a block encoded / decoded based on an affine motion model. Therefore, the motion information candidate may be used as a merge candidate for deriving an affine seed vector of the current block.
[0229] Alternatively, the motion information table may be configured according to the motion vector resolution. In an example, at least one of a motion information table for storing motion information having a motion vector resolution of 1 / 16 pixels, a motion information table for storing motion information having a motion vector resolution of 1 / 4 pixels, a motion information table for storing motion information having a motion vector resolution of 1 / 2 pixels, a motion information table for storing motion information having a motion vector resolution of integer pixels, or a motion information table for storing motion information having a motion vector resolution of 4 integer pixels may be defined.
[0230] Fig.15 An example of generating a motion information table at each motion vector resolution is shown.
[0231] When the motion vector resolution of the block has 1 / 4 pixel, the motion information mvCand of the block may be stored in the quarter pixel motion information table HmvpQPCandList. On the other hand, when the motion vector resolution of the block has integer pixels, the motion information mvCand of the block may be stored in the integer pixel motion information table HmvpIPCandList. When the motion vector resolution of the block has 4 integer pixels, the motion information mvCand of the block may be stored in the 4 integer pixel motion information table Hmvp4IPCandList.
[0232] Based on the motion vector resolution of the current block, the merge candidate of the current block can be derived by selecting a motion information table. In the example, when the motion vector resolution of the current block is 1 / 4 pixel, the merge candidate of the current block can be derived by using the quarter pixel motion information table HmvpQPCandList. On the other hand, when the motion vector resolution of the current block is integer pixel, the merge candidate of the current block can be derived by using the integer pixel motion information table HmvpIPCandList.
[0233] Alternatively, the motion information of the block to which the merge offset encoding method is applied may be stored in a separate motion information table.
[0234] Fig.16 An example is shown in which motion information of a block to which the merge offset encoding method is applied is stored in a separate motion information table.
[0235] When the merge offset vector encoding method is not applied to the block, the motion information mvCand of the block may be stored in the motion information table HmvpCandList. On the other hand, when the merge offset vector encoding method is applied to the block, the motion information mvCand of the block may not be stored in the motion information table HmvpCandList, but may be stored in the merge offset motion information table HmvpMMVDCandList.
[0236] Based on whether the merge offset vector encoding method is applied to the current block, the motion information table may be selected. In the example, when the merge offset encoding method is not applied to the current block, the merge candidate of the current block may be derived by using the motion information table HmvpCandList. On the other hand, when the merge offset encoding method is applied to the current block, the merge candidate of the current block may be derived by using the merge offset motion information table HmvpMMVDCandList.
[0237] 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.
[0238] 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.
[0239] Alternatively, one motion information candidate may be added to both the second motion information table and the first motion information table.
[0240] 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.
[0241] 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.
[0242] 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.
[0243] 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.
[0244] Optionally, 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, the motion information candidates included in the second motion information table may be further added to the merge candidate list.
[0245] Fig.17 is a diagram illustrating an example of adding motion information candidates included in a long-term motion information table to a merge candidate list.
[0246] 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 also be added to the merge candidate list.
[0247] 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 motion information candidates whose size, shape, or partition information is the same as or similar to that of the current block in the motion information candidate may be used, or 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. Optionally, 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.
[0248] 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.
[0249] 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.
[0250] A redundancy check may be performed only for a portion of the motion information candidates included in the motion information table. In an example, a redundancy check may be performed only for motion information candidates whose indexes exceed or are below a threshold. Alternatively, a redundancy check may be performed only for N motion information candidates having a maximum index or a minimum index. Alternatively, a redundancy check may be performed only for a portion of the pre-stored merge candidates in a merge candidate list. In an example, a redundancy check may be performed only for merge candidates whose indexes exceed or are below 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.
[0251] Fig.18 is a diagram showing an example in which a redundancy check is performed only on a part of merging candidates.
[0252] 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.
[0253] 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].
[0254] 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.
[0255] 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.
[0256] 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 having a large index or a minimum index among motion information candidates included in a motion information table. In an example, redundancy check may be performed only for motion information candidates having an index 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 having 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 motion information identical to the merge candidate.
[0257] 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.
[0258] 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.
[0259] 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.
[0260] 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.
[0261] Fig.19 is a diagram illustrating an example of omitting a redundant check on a specific merge candidate.
[0262] 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].
[0263] In the example, Fig.19In 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.
[0264] 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.
[0265] For the merge candidate list of the current block, merge candidates may be added in the following order.
[0266] Spatial merging candidate - Temporal merging candidate - Motion information candidate - (affine motion information candidate) - Paired merging candidate - Zero merging candidate
[0267] 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.
[0268] 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.
[0269] If any one of the motion vector prediction candidates included in the motion vector prediction candidate list of the current block is selected, the selected candidate 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.
[0270] The motion vector prediction candidate list of the current block may be configured in the following order.
[0271] Spatial motion vector prediction candidate - Temporal motion vector prediction candidate - Motion information candidate - (affine motion information candidate) - Zero motion vector prediction candidate
[0272] 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.
[0273] 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.
[0274] 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).
[0275] 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.
[0276] Fig. 20 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.
[0277] exist Fig. 20 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.
[0278] exist Fig.23 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.
[0279] 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.
[0280] Fig.21 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.
[0281] As in Fig.21 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.
[0282] 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.
[0283] 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.21 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.
[0284] 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.
[0285] 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.
[0286] (y1,y3,y4,y0,y2,x1,x3,x4,x0,x2)
[0287] 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.
[0288] 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.
[0289] 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.
[0290] 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.
[0291] 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.
[0292] Alternatively, the motion information table may be updated by using only blocks at predefined positions in the merge processing area. The predefined position may include at least one of a block at an upper left position, a block at an upper right position, a block at a lower left position, a block at a lower right position, a block at a center position, a block adjacent to a right boundary, or a block adjacent to a lower boundary in the merge processing area. In an example, only the motion information of a block adjacent to the lower right corner in the merge processing area may be updated in the motion information table, and the motion information of other blocks may not be updated in the motion information table.
[0293] Alternatively, after all blocks included in the merge processing area are decoded, motion information candidates derived from the blocks may be added to the motion information table. In other words, although the blocks included in the merge processing area are encoded / decoded, the motion information table may not be updated.
[0294] In an example, if motion compensation prediction is performed for a block included in a merge processing area, motion information candidates derived from the block may be added to a 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.
[0295] 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.
[0296] 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.
[0297] 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.
[0298] 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.
[0299] 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.
[0300] Fig. 22 is a diagram showing a temporary motion information table.
[0301] 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.
[0302] Optionally, only motion information of some blocks included in the merge processing area may be added to the temporary motion information table. In an example, only blocks at predefined positions in the merge processing area may be used to update the motion information table. The predefined position may include at least one of a block at an upper left position, a block at an upper right position, a block at a lower left position, a block at a lower right position, a block at a center position, a block adjacent to a right boundary, and a block adjacent to a lower boundary in the merge processing area. In an example, only motion information of a block adjacent to the lower right corner in the merge processing area may be added to the temporary motion information table, and motion information of other blocks may not be added to the temporary motion information table.
[0303] The maximum number of temporary motion information candidates that the temporary motion information table may include may be set to be equal to the maximum number of motion information candidates. Alternatively, the maximum number of temporary motion information candidates that the temporary motion information table may include may be determined according to the size of the coding tree unit or the merge processing region. Alternatively, the maximum number of temporary motion information candidates that the temporary motion information table may include may be set to be smaller than the maximum number of motion information candidates that the motion information table may include.
[0304] 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.
[0305] 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.
[0306] Fig.23 is a diagram showing an example of making the motion information table and the temporary motion information table consistent.
[0307] If encoding / decoding of all blocks included in the coding tree unit or the merge processing area is completed, as in Fig.23 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.
[0308] 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).
[0309] 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.
[0310] 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.
[0311] 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.
[0312] 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.
[0313] 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.
[0314] The coding block may be partitioned into a plurality of prediction units, and prediction may be performed for each of the partitioned prediction units. In this case, the prediction unit refers to a basic unit for performing prediction.
[0315] The coding block may be partitioned by using at least one of a vertical line, a horizontal line, a slanted line, or a diagonal line. The prediction unit partitioned by the partition line may have a shape such as a triangle, a quadrilateral, a trapezoid, or a pentagon. In an example, the coding block may be partitioned into two triangular prediction units, two trapezoidal prediction units, two quadrilateral prediction units, or one triangular prediction unit and one pentagonal prediction unit.
[0316] Information for determining at least one of the number, angle, or position of lines for partitioning the coding block may be signaled in a bitstream. In an example, information indicating one of the partition type candidates of the coding block may be signaled in a bitstream, or information specifying one of the plurality of line candidates for partitioning the coding block may be signaled in a bitstream. In an example, index information indicating one of the plurality of line candidates may be signaled in a bitstream.
[0317] For each of the plurality of candidate lines, at least one of the angle or position may be different. The number of line candidates available for the current block may be determined based on the size or shape of the current block, the number of available merge candidates, or whether a neighboring block at a specific position is available as a merge candidate.
[0318] Optionally, information for determining the number or type of line candidates may be signaled in a bitstream. In an example, a 1-bit flag may be used to determine whether a slanted line with an angle greater than a diagonal line and / or a slanted line with an angle less than a diagonal line may be used as a line candidate. The information may be signaled at a picture level or a sequence level.
[0319] Optionally, based on at least one of the intra-frame prediction mode or inter-frame prediction mode of the coding block, the position of available merge candidates, or the partition type of the neighboring block, at least one of the number, angle or position of lines for partitioning the coding block can be adaptively determined.
[0320] When a coding block is partitioned into a plurality of prediction units, intra prediction or inter prediction may be performed on each of the partitioned prediction units.
[0321] Fig.24 is a diagram illustrating an example of partitioning a coding block into a plurality of prediction units by using diagonal lines.
[0322] As in Fig.24 In the examples shown in (a) and (b) of , the coding block may be partitioned into two triangular prediction units by using diagonal lines.
[0323] Fig.24 (a) and (b) show that a coding block is partitioned into two prediction units by using a diagonal line connecting two vertices of the coding block. However, the coding block may be partitioned into two prediction units by using a diagonal line in which at least one end of the line does not pass through a vertex of the coding block.
[0324] Fig.25 is a diagram illustrating an example in which a coding block is partitioned into two prediction units.
[0325] As in Fig.25 In the examples shown in (a) and (b) of FIG. 1 , the coding block may be partitioned into two prediction units by using a slanted line whose ends are adjacent to the upper boundary and the lower boundary of the coding block, respectively.
[0326] Optionally, as in Fig.25 In the examples shown in (c) and (d) of FIG. 1 , the coding block may be partitioned into two prediction units by using a slanted line whose ends are adjacent to the left and right boundaries of the coding block, respectively.
[0327] Optionally, the coding block may be partitioned into two prediction units having different sizes. In an example, the coding block may be partitioned into two prediction units having different sizes by setting a slant line for partitioning the coding block to intersect two boundaries forming one vertex.
[0328] Fig.26 An example is shown in which a coding block is partitioned into a plurality of prediction blocks of different sizes.
[0329] As in Fig.26 In the examples shown in (a) and (b), the coding block can be partitioned into two prediction units with different sizes by setting the diagonal line connecting the upper left and lower right of the coding block to pass through the left boundary, right boundary, upper boundary or lower boundary of the coding block instead of the upper left corner or the lower right corner.
[0330] Optionally, as in Fig.26 In the examples shown in (c) and (d), the coding block can be partitioned into two prediction units with different sizes by setting the diagonal line connecting the upper right and lower left of the coding block to pass through the left boundary, right boundary, upper boundary or lower boundary of the coding block instead of the upper right corner or lower left corner.
[0331] Each prediction unit generated by partitioning the coding block is referred to as an "Nth prediction unit". Figure 24 to Figure 26 In the example shown in , PU1 may be defined as a first prediction unit, and PU2 may be defined as a second prediction unit. The first prediction unit may represent a prediction unit including a sample at a lower left position or a sample at an upper left position in the coding block, and the second prediction unit may represent a prediction unit including a sample at an upper right position or a sample at a lower right position in the coding block.
[0332] Conversely, a prediction unit including a sample at the upper right position or a sample at the lower right position in the coding block may be defined as a first prediction unit, and a prediction unit including a sample at the lower left position or a sample at the upper left position in the coding block may be defined as a second prediction unit.
[0333] When a coding block is partitioned by using horizontal, vertical, diagonal, or oblique lines, this may be referred to as a prediction unit partition. A prediction unit generated by applying the prediction unit partition may be referred to as a triangular prediction unit, a quadrilateral prediction unit, or a pentagonal prediction unit according to its shape.
[0334] In the following embodiments, it will be assumed that the coding block is partitioned by using a diagonal line. Specifically, when the coding block is partitioned into two prediction units by using a diagonal line, this is called diagonal partitioning or triangular partitioning. However, even when the coding block is partitioned by using oblique lines having different angles from vertical lines, horizontal lines, or diagonal lines, the prediction units may be encoded / decoded according to the following embodiments. In other words, matters related to the encoding / decoding of the triangular prediction unit described below may also be applied to the encoding / decoding of the quadrilateral prediction unit or the pentagonal prediction unit.
[0335] Whether a prediction unit partition is to be applied to a coding block may be determined based on at least one of a slice type, a maximum number of merge candidates that may be included in a merge candidate list, a size of a coding block, a shape of a coding block, a prediction encoding mode of the coding block, or a partitioning aspect of a parent node.
[0336] In an example, whether prediction unit partitioning is to be applied to a coding block may be determined based on whether the current slice is of type B. Prediction unit partitioning may be allowed only when the current slice is of type B.
[0337] Alternatively, whether prediction unit partitioning is to be applied to the coding block may be determined based on whether the maximum number of merge candidates included in the merge candidate list is equal to or greater than 2. Prediction unit partitioning may be allowed only when the maximum number of merge candidates included in the merge candidate list is equal to or greater than 2.
[0338] Optionally, when at least one of the width or height is greater than 64, disadvantages may occur during the implementation of hardware in which data processing units of 64×64 size are redundantly accessed. Therefore, when at least one of the width or height of the coding block is greater than a threshold, partitioning the coding block into multiple prediction units may not be allowed. In an example, when at least one of the width or height of the coding block is greater than 64 (for example, when at least one of the width or height is 128), prediction unit partitioning may not be used.
[0339] Optionally, by considering the maximum number of samples that can be processed simultaneously by the implemented hardware, prediction unit partitioning may not be allowed for coding blocks with a number of samples greater than a threshold. In an example, prediction unit partitioning may not be allowed for coding tree blocks with a number of samples greater than 4096.
[0340] Optionally, the prediction unit partition may not be allowed for a coding block where the number of samples included in the coding block is less than a threshold. In an example, when the number of samples included in the coding block is less than 64, the prediction unit partition may be set not to be applied to the coding block.
[0341] Alternatively, whether the prediction unit partition is to be applied to the coding block may be determined based on at least one of whether the aspect ratio of the coding block is less than a first threshold or whether the aspect ratio of the coding block is greater than a second threshold. In this case, as shown in the following equation 2, the aspect ratio whRatio of the coding block may be determined as a ratio of a width CbW and a height CbH of the coding block.
[0342] [Equation 2]
[0343] whRatio=abs(Log2(CbW / CbH))
[0344] Optionally, when the aspect ratio of the coding block is less than a first threshold or greater than a second threshold, prediction unit partitioning may be applied to the coding block. In an example, when the first threshold is 4, prediction unit partitioning may not be allowed for coding blocks of 64×4 or 4×64 size.
[0345] Optionally, based on the partition type of the parent node, it may be determined whether prediction unit partitioning is allowed. In the example, when the coding block and parent node are partitioned based on quadtree partitioning, prediction unit partitioning may be applied to the coding block and leaf node. On the other hand, when the coding block and parent node are partitioned based on binary or ternary tree partitioning, prediction unit partitioning may be set to be not allowed for coding blocks and leaf nodes.
[0346] Optionally, based on the prediction coding mode of the coding block, it may be determined whether prediction unit partitioning is allowed. In an example, prediction unit partitioning may be allowed only when the coding block is encoded by intra prediction, when the coding block is encoded by inter prediction, or when the coding block is encoded by a predefined inter prediction mode. In this case, the predefined inter prediction mode may include at least one of a merge mode, a motion vector prediction mode, an affine merge mode, or an affine motion vector prediction mode.
[0347] Optionally, based on the size of the parallel processing region, it may be determined whether prediction unit partitioning is allowed. In an example, when the size of the coding block is larger than the size of the parallel processing region, prediction unit partitioning may not be used.
[0348] By considering two or more of the conditions listed above, it may be determined whether a prediction unit partition is to be applied to a coding block.
[0349] In another example, information indicating whether the prediction unit partition is to be applied to the coding block may be signaled in the bitstream. The information may be signaled at a sequence level, a picture level, a slice level, or a block level. For example, a flag triangle_partition_flag indicating whether the prediction unit partition is applied to the coding block may be signaled at the coding block level.
[0350] When it is determined to apply prediction unit partitioning to a coding block, information indicating the number of lines partitioning the coding block or positions of the lines may be signaled in a bitstream.
[0351] In the example, when the coding block is partitioned by a diagonal line, information indicating the direction of the diagonal line that partitions the coding block can be sent with a bitstream signal. In the example, a flag triangle_partition_type_flag indicating the direction of the diagonal line can be sent with a bitstream signal. The flag indicates whether the coding block is partitioned by a diagonal line connecting the upper left and lower right, or whether the coding block is partitioned by a diagonal line connecting the upper right and lower left. When the coding block is partitioned by a diagonal line connecting the upper left and lower right, this may be referred to as a left triangle partition type, and when the coding block is partitioned by a diagonal line connecting the upper right and lower left, this may be referred to as a right triangle partition type. In the example, when the value of the flag is 0, this may indicate that the partition type of the coding block is a left triangle partition type, and when the value of the flag is 1, this may indicate that the partition type of the coding block is a right triangle partition type.
[0352] In addition, information indicating whether the size of the prediction unit is the same or information indicating the position of the diagonal line for partitioning the coding block may be sent as a bitstream signal. In the example, when the information indicating the size of the prediction unit indicates that the size of the prediction unit is the same, the encoding of the information indicating the position of the diagonal line may be omitted, and the coding block may be partitioned into two prediction units by using a diagonal line passing through two vertices of the coding block. On the other hand, when the information indicating the size of the prediction unit indicates that the size of the prediction unit is not the same, the position of the diagonal line for partitioning the coding block may be determined based on the information indicating the position of the diagonal line. In the example, when the left triangle partition type is applied to the coding block, the position information may indicate whether the diagonal line intersects the left and lower boundaries of the coding block or whether the diagonal line intersects the upper and right boundaries. Optionally, when the right triangle partition type is applied to the coding block, the position information may indicate whether the diagonal line intersects the right and lower boundaries of the coding block or whether the diagonal line intersects the upper and left boundaries.
[0353] Information indicating the partition type of a coding block may be signaled at a coding block level. Thus, a partition type may be determined per coding block to which prediction unit partitioning is applied.
[0354] In another example, information indicating a partition type for a sequence, picture, slice, tile, or coding tree unit may be sent by a signal. In this case, the partition types of coding blocks to which diagonal partitioning is applied in a sequence, picture, slice, tile, or coding tree unit may be set to be the same.
[0355] Alternatively, information for determining a partition type of a first coding unit to which prediction unit partitioning is applied in a coding tree unit may be encoded and signaled, and a second or later coding unit to which prediction unit partitioning is applied may be set to use the same partition type as the first coding unit.
[0356] In another example, the partition type of the coding block may be determined based on the partition type of the neighboring block. In this case, the neighboring block may include at least one of a neighboring block adjacent to the upper left corner of the coding block, a neighboring block adjacent to the upper right corner, a neighboring block adjacent to the lower left corner, a neighboring block located above, or a neighboring block located on the left. In the example, the partition type of the current block may be set to be the same as the partition type of the neighboring block. Optionally, the partition type of the current block may be determined based on whether the left triangle partition type is applied to the upper left neighboring block or whether the right triangle partition type is applied to the upper right neighboring block or the lower left neighboring block.
[0357] In order to perform motion prediction compensation for the first prediction unit and the second prediction unit, motion information of each of the first prediction unit and the second prediction unit may be derived. In this case, the motion information of the first prediction unit and the second prediction unit may be derived from the merge candidates included in the merge candidate list. In order to distinguish between a general merge candidate list and a merge candidate list for deriving motion information of a prediction unit, the merge candidate list for deriving motion information of a prediction unit is referred to as a partition mode merge candidate list or a triangle merge candidate list. In addition, the merge candidates included in the partition mode merge candidate list are referred to as partition mode merge candidates or triangle merge candidates. However, the operation of applying the above-mentioned method of deriving merge candidates and the above-mentioned method of constructing a merge candidate list to derive partition mode merge candidates and construct a partition mode merge candidate list is also included in the scope of the present disclosure.
[0358] Information for determining a maximum number of partition mode merge candidates that can be included in the partition mode merge candidate list can be signaled in a bitstream. The information can represent a difference between the maximum number of merge candidates that can be included in the merge candidate list and the maximum number of partition mode merge candidates that can be included in the partition mode merge candidate list.
[0359] Partition mode merge candidates may be derived from spatially and temporally neighboring blocks of a coding block.
[0360] Fig. 27 is a diagram illustrating neighboring blocks used to derive partition mode merge candidates.
[0361] The partition mode merge candidate may be derived by using at least one of a neighboring block located above the coding block, a neighboring block located on the left side of the coding block, or a co-located block included in a different picture from the coding block. The upper neighboring block may include at least one of the following blocks: a block including a sample (xCb+CbW-1, yCb-1) located above the coding block, a block including a sample (xCb+CbW, yCb-1) located above the coding block, or a block including a sample (xCb-1, yCb-1) located above the coding block. The left neighboring block may include at least one of the following blocks: a block including a sample (xCb-1, yCb+CbH-1) located on the left side of the coding block, or a block including a sample (xCb-1, yCb+CbH) located on the left side of the coding block. The co-located block may be determined as one of a block including samples (xCb+CbW, yCb+CbH) adjacent to the upper right corner of the coding block or a block including samples (xCb / 2, yCb / 2) located at the center of the coding block in the co-located picture.
[0362] The neighboring blocks may be searched in a predefined order, and the partition mode merge candidate list may be configured with the partition mode merge candidates according to the predefined order. In an example, the partition mode merge candidates may be searched in the order of B1, A1, B0, A0, C0, B2, and C1 to configure the partition mode merge candidate list.
[0363] The motion information of the prediction unit may be derived based on the partition mode merge candidate list. In other words, the prediction units may share a single partition mode merge candidate list.
[0364] In order to derive motion information of a prediction unit, information for specifying at least one of the partition mode merge candidates included in the partition mode merge candidate list may be signaled in a bitstream. In an example, index information merge_triangle_idx for specifying at least one of the partition mode merge candidates may be signaled in a bitstream.
[0365] The index information may specify a combination of a merge candidate of the first prediction unit and a merge candidate of the second prediction unit. In an example, the following Table 1 is an example representing a combination of merge candidates according to the index information merge_triangle_idx.
[0366]
Table 1
[0367]
[0368]
[0369] When the value of the index information merge_triangle_idx is 1, this means that the motion information of the first prediction unit is derived from the merge candidate with an index of 1 and the motion information of the second prediction unit is derived from the merge candidate with an index of 0. The partition mode merge candidate for deriving the motion information of the first prediction unit and the partition mode merge candidate for deriving the motion information of the second prediction unit can be determined by the index information merge_triangle_idx. The partition type of the coding block to which diagonal partitioning is applied can also be determined based on the index information. In other words, the index information may specify a combination of the merge candidate of the first prediction unit, the merge candidate of the second prediction unit, and the partition direction of the coding block. When the partition type of the coding block is determined by the index information, the information triangle_partition_type_flag indicating the direction of the diagonal for partitioning the coding block may not be encoded. Table 2 represents the partition type of the coding block for the index information merge_triangle_idx.
[0370]
Table 2
[0371] merge_triangle_idx 0 1 2 3 4 5 6 7 8 TriangleDir 0 1 1 0 0 1 1 1 0 merge_triangle_idx 9 10 11 12 13 14 15 16 17 TriangleDir 0 0 0 1 0 0 0 0 1 merge_triangle_idx 18 19 20 21 22 23 24 25 26 TriangleDir 1 1 1 0 0 1 1 1 1 merge_triangle_idx 27 28 29 30 31 32 33 34 35 TriangleDir 1 1 1 0 0 1 0 1 0 merge_triangle_idx 36 37 38 39 TriangleDir 0 1 0 0
[0372] When the variable TriangleDir is 0, this indicates that the left triangle partition type is applied to the coding block, and when the variable TriangleDir is 1, this indicates that the right triangle partition type is applied to the coding block. By combining Table 1 and Table 2, the index information merge_triangle_idx may be set to specify a combination of a merge candidate of the first prediction unit, a merge candidate of the second prediction unit, and a partition direction of the coding block. In another example, the available signal may send index information for only one of the first prediction unit and the second prediction unit, and the index of the merge candidate for the other of the first prediction unit and the second prediction unit may be determined based on the index information. In the example, the merge candidate of the first prediction unit may be determined based on the index information merge_triangle_idx representing the index of one of the partition mode merge candidates. Moreover, the merge candidate of the second prediction unit may be specified based on merge_triangle_idx. In the example, the merge candidate of the second prediction unit may be derived by adding an offset to the index information merge_triangle_idx or subtracting an offset from the index information merge_triangle_idx. The offset may be an integer such as 1 or 2. In an example, the merge candidate of the second prediction unit may be determined as a partition mode merge candidate having a value obtained by adding 1 to merge_triangle_idx as an index. When merge_triangle_idx indicates a partition mode merge candidate having a maximum index value among the partition mode merge candidates, the motion information of the second prediction unit may be derived from a partition mode merge candidate having an index of 0 or a partition mode merge candidate having a value subtracted from merge_triangle_idx by 1 as an index.
[0373] Alternatively, the motion information of the second prediction unit may be derived from a partition mode merge candidate having the same reference picture as the partition mode merge candidate of the first prediction unit specified by the index information. In this case, the partition mode merge candidate having the same reference picture as the partition mode merge candidate of the first prediction unit may represent at least one of the L0 reference picture or the L1 reference picture that is the same as the partition mode merge candidate of the first prediction unit. When there are multiple partition mode merge candidates having the same reference picture as the partition mode merge candidate of the first prediction unit, any one may be selected based on whether the merge candidate includes bidirectional motion information or at least one of the difference between the index of the merge candidate and the index information.
[0374] In another example, index information may be signaled for each of the first prediction unit and the second prediction unit. In an example, first index information 1st_merge_idx for determining a partition mode merge candidate of the first prediction unit and second index information 2nd_merge_idx for determining a partition mode merge candidate of the second prediction unit may be signaled in a bitstream. Motion information of the first prediction unit may be derived from the partition mode merge candidate determined based on the first index information 1st_merge_idx, and motion information of the second prediction unit may be derived from the partition mode merge candidate determined based on the second index information 2nd_merge_idx.
[0375] The first index information 1st_merge_idx may represent an index of one of the partition mode merge candidates included in the partition mode merge candidate list. The partition mode merge candidate of the first prediction unit may be determined as the partition mode merge candidate indicated by the first index information 1st_merge_idx.
[0376] The partition mode merge candidate indicated by the first index information 1st_merge_idx may be set to be unusable as the partition mode merge candidate of the second prediction unit. Therefore, the second index information 2nd_merge_idx of the second prediction unit may represent the index of any one of the remaining partition mode merge candidates except the partition mode merge candidate indicated by the first index information. When the value of the second index information 2nd_merge_idx is less than the value of the first index information 1st_merge_idx, the partition mode merge candidate of the second prediction unit may be determined as the partition mode merge candidate having the index information represented by the second index information 2nd_merge_idx. On the other hand, when the value of the second index information 2nd_merge_idx is equal to or greater than the value of the first index information 1st_merge_idx, the partition mode merge candidate of the second prediction unit may be determined as the partition mode merge candidate having the value obtained by adding 1 to the value of the second index information 2nd_merge_idx as an index.
[0377] Optionally, it can be determined whether the second index information is sent by signaling based on the number of partition mode merge candidates included in the partition mode merge candidate list. In the example, when the maximum number of partition mode merge candidates that can be included in the partition mode merge candidate list does not exceed 2, the operation of sending the second index information by signaling can be omitted. When the operation of sending the second index information by signaling is omitted, the second partition mode merge candidate can be derived by adding an offset to the first index information or subtracting the offset from the first index information. In the example, when the maximum number of partition mode merge candidates that can be included in the partition mode merge candidate list is 2 and the first index information indicates index 0, the second partition mode merge candidate can be derived by adding 1 to the first index information. Optionally, when the maximum number of partition mode merge candidates that can be included in the partition mode merge candidate list is 2 and the first index information indicates 1, the second partition mode merge candidate can be derived by subtracting 1 from the first index information.
[0378] Optionally, when the operation of signaling the second index information is omitted, the second index information may be inferred as a default value. In this case, the default value may be 0. The second partition mode merge candidate may be derived by comparing the first index information with the second index information. In the example, when the second index information is less than the first index information, the merge candidate with an index of 0 may be set as the second partition mode merge candidate, and when the second index information is the same as or greater than the first index information, the merge candidate with an index of 1 may be set as the second partition mode merge candidate.
[0379] When the partition mode merge candidate has unidirectional motion information, the unidirectional motion information of the partition mode merge candidate may be set as the motion information of the prediction unit. On the other hand, when the partition mode merge candidate has bidirectional motion information, only one of the L0 motion information or the L1 motion information may be set as the motion information of the prediction unit. Which of the L0 motion information or the L1 motion information is to be adopted may be determined based on the index of the partition mode merge candidate or the motion information of another prediction unit.
[0380] In an example, when the index of the partition mode merge candidate is an even number, the L0 motion information of the prediction unit may be set to 0, and the L1 motion information of the partition mode merge candidate may be set to the L1 motion information of the prediction unit. On the other hand, when the index of the partition mode merge candidate is an odd number, the L1 motion information of the prediction unit may be set to 0, and the L0 motion information of the partition mode merge candidate may be set to 0. Conversely, when the index of the partition mode merge candidate is an even number, the L0 motion information of the partition mode merge candidate may be set to the L0 motion information of the prediction unit, and when the index of the partition mode merge candidate is an odd number, the L1 motion information of the partition mode merge candidate may be set to the L1 motion information of the prediction unit. Optionally, for the first prediction unit, when the partition mode merge candidate for the first prediction unit is an even number, the L0 motion information of the partition mode merge candidate may be set to the L0 motion information of the first prediction unit, but for the second prediction unit, when the partition mode merge candidate for the second prediction unit is an odd number, the L1 motion information of the partition mode merge candidate may be set to the L1 motion information of the second prediction unit.
[0381] Alternatively, when the first prediction unit has L0 motion information, the L0 motion information of the second prediction unit may be set to 0, and the L1 motion information of the partition mode merge candidate may be set to the L1 motion information of the second prediction unit. On the other hand, when the first prediction unit has L1 motion information, the L1 motion information of the second prediction unit may be set to 0, and the L0 motion information of the partition mode merge candidate may be set to the L0 motion information of the second prediction unit.
[0382] The partition mode merge candidate list used to derive motion information of the first prediction unit may be set to be different from the partition mode merge candidate list used to derive motion information of the second prediction unit.
[0383] In an example, when a partition mode merge candidate for deriving motion information of a first prediction unit in a partition mode merge candidate list is specified based on index information for the first prediction unit, the motion information of the second prediction unit may be derived by using the partition mode merge list including the remaining partition mode merge candidates except the partition mode merge candidate indicated by the index information. Specifically, the motion information of the second prediction unit may be derived from one of the remaining partition mode merge candidates.
[0384] Therefore, the maximum number of partition mode merge candidates included in the partition mode merge candidate list of the first prediction unit may be different from the maximum number of partition mode merge candidates included in the partition mode merge candidate list of the second prediction unit. In an example, when the partition mode merge candidate list of the first prediction unit includes M merge candidates, the partition mode merge candidate list of the second prediction unit may include M-1 merge candidates in addition to the partition mode merge candidate indicated by the index information of the first prediction unit.
[0385] In another example, in addition to considering the shape or position of the prediction unit, the availability of the neighboring blocks may be determined by deriving merge candidates for each prediction unit based on neighboring blocks adjacent to the coding block.
[0386] Fig.28 is a diagram for explaining an example of determining availability of neighboring blocks per prediction unit.
[0387] Neighboring blocks that are not adjacent to the first prediction unit may be set to be unavailable for the first prediction unit, and neighboring blocks that are not adjacent to the second prediction unit may be set to be unavailable for the second prediction unit.
[0388] In the example, as in Fig.28 In the example shown in (a), when the left triangle partition type is applied to the coding block, blocks A1, A0, and A2 adjacent to the first prediction unit among the neighboring blocks adjacent to the coding block may be determined to be available for the first prediction unit, but blocks B0 and B1 may be determined to be unavailable for the first prediction unit. Therefore, the partition mode merge candidate list for the first prediction unit may include the partition mode merge candidates derived from blocks A1, A0, and A2, but it may not include the partition mode merge candidates derived from blocks B0 and B1.
[0389] As in Fig.28 In the example shown in (b), when the left triangle partition type is applied to the coding block, blocks B0 and B1 adjacent to the second prediction unit may be determined to be available for the second prediction unit, but blocks A1, A0, and A2 may be determined to be unavailable for the second prediction unit. Therefore, the partition mode merge candidate list for the second prediction unit may include the partition mode merge candidate derived from blocks B0 and B1, but it may not include the partition mode merge candidate derived from blocks A1, A0, and A2.
[0390] Therefore, the number of partition mode merging candidates that can be used by the prediction unit or the range of the partition mode merging candidates may be determined based on at least one of the position of the prediction unit or the partition type of the coding block.
[0391] In another example, the merge mode may be applied to only one of the first prediction unit and the second prediction unit. Furthermore, the motion information of the other of the first prediction unit and the second prediction unit may be set to be the same as the motion information of the prediction unit to which the merge mode is applied, or may be derived by modifying the motion information of the prediction unit to which the merge mode is applied.
[0392] In an example, a motion vector and a reference picture index of a first prediction unit may be derived based on a partition mode merge candidate, and a motion vector of a second prediction unit may be derived by correcting the motion vector of the first prediction unit. In an example, the motion vector of the second prediction unit may be derived by adding the corrected motion vector {Rx, Ry} to the motion vector {mvD1LXx, mvD1LXy} of the first prediction unit or by subtracting the corrected motion vector {Rx, Ry} from the motion vector {mvD1LXx, mvD1LXy} of the first prediction unit. The reference picture index of the second prediction unit may be set to be the same as the reference picture index of the first prediction unit.
[0393] Information for determining a modified motion vector indicating a difference between a motion vector of a first prediction unit and a motion vector of a second prediction unit may be signaled in a bitstream, and the information may include at least one of information indicating a magnitude of the modified motion vector or information indicating a sign of the modified motion vector.
[0394] Alternatively, the sign of the modified motion vector may be derived based on at least one of a position or an index of a prediction unit or a partition type applied to the coding block.
[0395] In another example, the motion vector and the reference picture index of one of the first prediction unit and the second prediction unit may be signaled. The motion vector of the other of the first prediction unit and the second prediction unit may be derived by modifying the signaled motion vector.
[0396] In an example, based on information signaled in a bitstream, a motion vector and a reference picture index of a first prediction unit may be determined. Moreover, a motion vector of a second prediction unit may be derived by correcting the motion vector of the first prediction unit. In an example, the motion vector of the second prediction unit may be derived by adding the corrected motion vector {Rx, Ry} to the motion vector {mvD1LXx, mvD1LXy} of the first prediction unit or by subtracting the corrected motion vector {Rx, Ry} from the motion vector {mvD1LXx, mvD1LXy} of the first prediction unit. The reference picture index of the second prediction unit may be set to be the same as the reference picture index of the first prediction unit.
[0397] In another example, the merge mode may be applied to only one of the first prediction unit and the second prediction unit. Moreover, the motion information of the other of the first prediction unit and the second prediction unit may be derived based on the motion information of the prediction unit to which the merge mode is applied. In the example, the symmetric motion vector of the motion vector of the first prediction unit may be set to the motion vector of the second prediction unit. In this case, the symmetric motion vector may represent a motion vector having the same size as the motion vector of the first prediction unit but having at least one x-axis component or y-axis component of the opposite sign, or a motion vector having the same size as the scaled vector obtained by scaling the motion vector of the first prediction unit but having at least one x-axis component or y-axis component of the opposite sign. In the example, when the motion vector of the first prediction unit is (MVx, MVy), the motion vector of the second prediction unit may be set to (MVx, -MVy), (-MVx, MVy) or (-MVx, -MVy) as the symmetric motion vector of the motion vector.
[0398] The reference picture index of the prediction unit to which the merge mode is not applied in the first prediction unit and the second prediction unit may be set to be the same as the reference picture index of the prediction unit to which the merge mode is applied. Optionally, the reference picture index of the prediction unit to which the merge mode is not applied may be set to a predefined value. In this case, the predefined value may be the minimum index or the maximum index in the reference picture list. Optionally, information specifying the reference picture index of the prediction unit to which the merge mode is not applied may be signaled in a bitstream. Optionally, the reference picture of the prediction unit to which the merge mode is not applied may be selected from a reference picture list different from the reference picture list to which the reference picture of the prediction unit to which the merge mode is applied belongs. In the example, when the reference picture of the prediction unit to which the merge mode is applied is selected from the L0 reference picture list, the reference picture of the prediction unit to which the merge mode is not applied may be selected from the L1 reference picture list. In this case, the reference picture of the prediction unit to which the merge mode is not applied may be derived based on the picture order count (POC) difference between the reference picture of the prediction unit to which the merge mode is applied and the current picture. In the example, when a reference picture of a prediction unit to which a merge mode is applied is selected from the L0 reference picture list, a reference picture in the L1 reference picture list having a difference value with the current picture and a difference value between the reference picture of the prediction unit to which the merge mode is applied and the current picture that is the same as or similar to the difference value between the reference picture of the prediction unit to which the merge mode is applied and the current picture may be selected as a reference picture of the prediction unit to which the merge mode is not applied.
[0399] When the picture order count difference value between the reference picture of the first prediction unit and the current picture is different from the picture order count difference value between the reference picture of the second prediction unit and the current picture, the symmetric motion vector of the scaled motion vector of the prediction unit to which the merge mode is applied may be set to the motion vector of the prediction unit to which the merge mode is not applied. In this case, the scaling may be performed based on the picture order count difference value between each reference picture and the current picture.
[0400] In another example, after deriving the motion vector of each of the first prediction unit and the second prediction unit, a correction vector may be added to the derived motion vector or subtracted from the derived motion vector. In an example, the motion vector of the first prediction unit may be derived by adding the first correction vector to the first motion vector derived based on the first merge candidate or subtracting the first correction vector from the first motion vector derived based on the first merge candidate, and the motion vector of the second prediction unit may be derived by adding the second correction vector to the second motion vector derived based on the second merge candidate or subtracting the second correction vector from the second motion vector derived based on the second merge candidate. Information for determining at least one of the first correction vector or the second correction vector may be signaled in a bitstream. The information may include at least one of information for determining a size of the correction vector or information for determining a sign of the correction vector.
[0401] The second correction vector may be a symmetric motion vector of the first correction vector. In this case, information for determining the correction vector may be signaled for only one of the first correction vector and the second correction vector. In an example, when the first correction vector is determined as (MVDx, MVDy) by information signaled in a bitstream, (-MVDx, MVDy), (MVDx, -MVDy), or (-MVDx, -MVDy), which is a symmetric motion vector of the first correction vector, may be set as the second correction vector. According to the picture order count of the reference picture of each prediction unit, a symmetric motion vector of the scaled motion vector obtained by scaling the first correction vector may be set as the second correction vector.
[0402] In another example, information of one of the first prediction unit and the second prediction unit may be derived based on the merge candidate, and motion information of the other may be determined based on information signaled in the bitstream. In the example, a merge index may be signaled for the first prediction unit, and at least one of information for determining a motion vector and information for determining a reference picture may be signaled for the second prediction unit. The motion information of the first prediction unit may be set to be the same as the motion information of the merge candidate specified by the merge index. The motion information of the second prediction unit may be specified by at least one of information for determining a motion vector and information for determining a reference picture signaled in the bitstream.
[0403] Motion prediction compensation prediction for each coding block may be performed based on the motion information of the first prediction unit and the motion information of the second prediction unit. In this case, quality degradation may occur at the boundary between the first prediction unit and the second prediction unit. In an example, quality continuity may deteriorate around the edge at the boundary between the first prediction unit and the second prediction unit. In order to reduce quality degradation at the boundary, prediction samples may be derived by a smoothing filter or weighted prediction.
[0404] The prediction samples in the coding block to which the diagonal partitioning is applied may be derived based on a weighted sum operation of a first prediction sample obtained according to motion information of the first prediction unit and a second prediction sample obtained according to motion information of the second prediction unit. Alternatively, the prediction samples of the first prediction unit may be derived from a first prediction block determined based on motion information of the first prediction unit, and the prediction samples of the second prediction unit may be derived from a second prediction block determined based on motion information of the second prediction unit, but the prediction samples on the boundary area of the first prediction unit and the second prediction unit may be derived based on a weighted sum operation of the first prediction sample included in the first prediction block and the second prediction sample included in the second prediction block. In the example, the following Equation 3 represents an example of deriving the prediction samples of the first prediction unit and the second prediction unit.
[0405] [Equation 3]
[0406] P(x, y)=w1*P1(x, y)+(1-w1)*P2(x, y)
[0407] In Equation 3, P1 represents a first prediction sample, and P2 represents a second prediction sample. w1 represents a weight applied to the first prediction sample, and (1-w1) represents a weight applied to the second prediction sample. As in the example shown in Equation 3, the weight applied to the second prediction sample can be derived by subtracting the weight applied to the first prediction sample from a constant value.
[0408] When the left triangle partition type is applied to the coding block, the boundary area may include prediction samples having the same x-axis coordinate and y-axis coordinate. On the other hand, when the right triangle partition type is applied to the coding block, the boundary area may include prediction samples whose sum of the x-axis coordinate and the y-axis coordinate is equal to or greater than the first threshold and equal to or less than the second threshold.
[0409] The size of the boundary area may be determined based on at least one of the size of the coding block, the shape of the coding block, the motion information of the prediction unit, the motion vector difference of the prediction unit, the picture order count of the reference picture, or the difference between the first prediction sample and the second prediction sample on the diagonal boundary.
[0410] Fig.29 and Fig.30 is a diagram illustrating an example of deriving a prediction sample based on a weighted sum operation of a first prediction sample and a second prediction sample. Fig.29 The left triangle partition type is shown as being applied to the coding block, and Fig.30 The right triangle partition type is shown as being applied to the coding block. Fig.29 (a) and Fig.30 (a) is a diagram showing the prediction aspect for the luminance component, and Fig.29 (b) and Fig.30 (b) is a diagram showing the prediction aspect for the chrominance component.
[0411] In the illustrated diagram, the numbers marked on the prediction samples around the boundary of the first prediction unit and the second prediction unit represent the weights applied to the first prediction samples. In an example, when the number marked on the prediction sample is N, the prediction sample can be derived by applying the weight N / 8 to the first prediction sample and the weight (1-(N / 8)) to the second prediction sample.
[0412] In the non-boundary area, the first prediction sample point or the second prediction sample point can be determined as the prediction sample point. Fig.29 In the example of , the first prediction sample derived based on the motion information of the first prediction unit can be determined as the prediction sample in the area belonging to the first prediction unit. On the other hand, the second prediction sample derived based on the motion information of the second prediction unit can be determined as the prediction sample in the area belonging to the second prediction unit.
[0413] Check Fig.30 In the example of , the first prediction sample derived based on the motion information of the first prediction unit may be determined as the prediction sample in the region where the sum of the x-axis coordinate and the y-axis coordinate is less than the first threshold. On the other hand, the second prediction sample derived based on the motion information of the second prediction unit may be determined as the prediction sample in the region where the sum of the x-axis coordinate and the y-axis coordinate is greater than the second threshold.
[0414] The threshold for determining the non-boundary area may be determined based on at least one of the size of the coding block, the shape of the coding block, or the color component. In an example, when the threshold for the luma component is set to N, the threshold for the chroma component may be set to N / 2.
[0415] The prediction samples included in the boundary area may be derived based on a weighted sum operation of the first prediction samples and the second prediction samples. In this case, the weights applied to the first prediction samples and the second prediction samples may be determined based on at least one of a position of the prediction samples, a size of the coding block, a shape of the coding block, or a color component.
[0416] In the example, Fig.29 In the example shown in (a) of FIG. 1 , a prediction sample having the same x-axis coordinate and y-axis coordinate can be derived by applying the same weight to the first prediction sample and the second prediction sample. A prediction sample having an absolute value of a difference between the x-axis coordinate and the y-axis coordinate of 1 can be derived by setting the weight ratio applied to the first prediction sample and the second prediction sample to (3:1) or (1:3). In addition, a prediction sample having an absolute value of a difference between the x-axis coordinate and the y-axis coordinate of 2 can be derived by setting the weight ratio applied to the first prediction sample and the second prediction sample to (7:1) or (1:7).
[0417] Alternatively, if Fig.29 In the example shown in (b) of , a prediction sample having the same x-axis coordinate and y-axis coordinate can be derived by applying the same weight to the first prediction sample and the second prediction sample, and a prediction sample having an absolute value of a difference between the x-axis coordinate and the y-axis coordinate of 1 can be derived by setting the weight ratio applied to the first prediction sample and the second prediction sample to (7:1) or (1:7).
[0418] In the example, Fig.30 In the example shown in (a) of , a prediction sample whose sum of x-axis coordinates and y-axis coordinates is 1 less than the width or height of the coding block can be derived by applying the same weight to the first prediction sample and the second prediction sample. A prediction sample whose sum of x-axis coordinates and y-axis coordinates is the same as the width or height of the coding block or is 2 less than the width or height of the coding block can be derived by setting the weight ratio applied to the first prediction sample and the second prediction sample to (3:1) or (1:3). A prediction sample whose sum of x-axis coordinates and y-axis coordinates is 1 greater than the width or height of the coding block or 3 less than the width or height of the coding block can be derived by setting the weight ratio applied to the first prediction sample and the second prediction sample to (7:1) or (1:7).
[0419] Alternatively, if Fig.30In the example shown in (b) of FIG. 1 , a prediction sample whose sum of x-axis coordinates and y-axis coordinates is 1 less than the width or height of the coding block can be derived by applying the same weight to the first prediction sample and the second prediction sample. A prediction sample whose sum of x-axis coordinates and y-axis coordinates is the same as the width or height of the coding block or is 2 less than the width or height of the coding block can be derived by setting the weight ratio applied to the first prediction sample and the second prediction sample to (7:1) or (1:7).
[0420] In another example, the weight may be determined by considering the position of the prediction sample or the shape of the coding block. Equations 4 to 6 represent examples of deriving weights when the left triangle partition type is applied to the coding block. Equation 4 represents an example of deriving a weight applied to the first prediction sample when the coding block is a square.
[0421] [Equation 4]
[0422] w1=(x-y+4) / 8
[0423] In Equation 4, x and y represent the positions of the prediction samples. When the coding block is non-square, the weight applied to the first prediction sample may be derived as in the following Equation 5 or Equation 6. Equation 5 represents the case where the width of the coding block is greater than the height, and Equation 6 represents the case where the width of the coding block is less than the height.
[0424] [Equation 5]
[0425] w1=((x / whRatio)-y+4) / 8 [Equation 6]
[0426] w1=(x-(y*whRatio)+4) / 8
[0427] When the right triangle partition type is applied to the coding block, the weight applied to the first prediction sample may be determined as in Equation 7 to Equation 9. Equation 7 represents an example of deriving the weight applied to the first prediction sample when the coding block is a square.
[0428] [Equation 7]
[0429] w1=(CbW-1-xy)+4) / 8
[0430] In Equation 7, CbW represents the width of the coding block. When the coding block is non-square, the weight applied to the first prediction sample may be derived as in Equation 8 or Equation 9 below. Equation 8 represents the case where the width of the coding block is greater than the height, and Equation 9 represents the case where the width of the coding block is less than the height.
[0431] [Equation 8]
[0432] w1=(CbH-1-(x / whRatio)-y)+4) / 8
[0433] [Equation 9]
[0434] w1=(CbW-1-x-(y*whRatio)+4) / 8
[0435] In Equation 8, CbH represents the height of the coding block.
[0436] As in the illustrated example, the prediction samples included in the first prediction unit among the prediction samples in the boundary area may be derived by assigning a greater weight to the first prediction sample than to the second prediction sample, and the prediction samples included in the second prediction unit among the prediction samples in the boundary area may be derived by assigning a greater weight to the second prediction sample than to the first prediction sample.
[0437] When diagonal partitions are applied to a coding block, a combined prediction mode combining an intra prediction mode and a merge mode may be set not to be applied to the coding block.
[0438] When the encoding / decoding of the coding block is completed, the motion information of the coding block that has completed the encoding / decoding may be stored for the subsequent encoding / decoding of the coding block. The motion information may be stored in units of sub-blocks of a preset size. In an example, the sub-block of the preset size may have a 4×4 size. Optionally, the size or shape of the sub-block may be determined differently according to the size or shape of the coding block.
[0439] When the subblock belongs to the first prediction unit, the motion information of the first prediction unit may be stored as the motion information of the subblock. On the other hand, when the subblock belongs to the second prediction unit, the motion information of the second prediction unit may be stored as the motion information of the subblock.
[0440] When the sub-block is on the boundary of the first prediction unit and the second prediction unit, any one of the motion information of the first prediction unit and the motion information of the second prediction unit may be set as the motion information of the sub-block. In an example, the motion information of the first prediction unit may be set as the motion information of the sub-block, or the motion information of the second prediction unit may be set as the motion information of the sub-block.
[0441] In another example, when the sub-block is on the boundary of the first prediction unit and the second prediction unit, any one of the L0 motion information and the L1 motion information of the sub-block may be derived from the first prediction unit, and the other of the L0 motion information and the L1 motion information of the sub-block may be derived from the second prediction unit. In the example, the L0 motion information of the first prediction unit may be set as the L0 motion information of the sub-block, and the L1 motion information of the second prediction unit may be set as the L1 motion information of the sub-block. However, when the first prediction unit and the second prediction unit have only the L0 motion information or only the L1 motion information, the motion information of the sub-block may be determined by selecting any one of the first prediction unit or the second prediction unit. Optionally, the average of the motion vectors of the first prediction unit and the second prediction unit may be set as the motion vector of the sub-block.
[0442] The motion information of the coding block for which encoding / decoding is completed may be updated in the motion information table. In this case, the motion information of the coding block to which the prediction unit partition is applied may be set not to be added to the motion information table.
[0443] Alternatively, only the motion information of any one prediction unit among the plurality of prediction units generated by partitioning the coding block may be added to the motion information table. In an example, although the motion information of the first prediction unit may be added to the motion information table, the motion information of the second prediction unit may not be added to the motion information table. In this case, the prediction unit to be added to the motion information table may be selected based on at least one of the size of the coding block, the shape of the coding block, the size of the prediction unit, the shape of the prediction unit, or whether bidirectional prediction is performed for the prediction unit.
[0444] Optionally, the motion information of each prediction unit of the plurality of prediction units generated by partitioning the coding block may be added to the motion information table. In this case, the order of addition for the motion information table may be predefined in the encoding device and the decoding device. In an example, the motion information of the prediction unit including the upper left sample or the lower left sample may be added to the motion information table before the motion information of another prediction unit. Optionally, the order of addition for the motion information table may be determined based on at least one of a merge index or a reference picture index of each prediction unit or a size of a motion vector.
[0445] Alternatively, motion information combining motion information of the first prediction unit and motion information of the second prediction unit may be added to the motion information table. Any one of L0 motion information and L1 motion information of the combined motion information may be derived from the first prediction unit, and the other of the L0 motion information and L1 motion information may be derived from the second prediction unit.
[0446] Optionally, based on whether the reference picture of the first prediction unit is the same as the reference picture of the second prediction unit, the motion information to be added to the motion information table may be determined. In an example, when the reference picture of the first prediction unit is different from the reference picture of the second prediction unit, the motion information of any one of the first prediction unit and the second prediction unit or the motion information of the first prediction unit and the second prediction unit combined may be added to the motion information table. On the other hand, when the reference picture of the first prediction unit is the same as the reference picture of the second prediction unit, the average of the motion vector of the first prediction unit and the motion vector of the second prediction unit may be added to the motion information table.
[0447] Optionally, based on the size of the coding block, the shape of the coding block, or the partition shape of the coding block, the motion vector to be added to the motion information table may be determined. In the example, when the right triangular partition is applied to the coding block, the motion information of the first prediction unit may be added to the motion information table. On the other hand, when the left triangular partition is applied to the coding block, the motion information of the second prediction unit may be added to the motion information table, or the motion information combining the motion information of the first prediction unit and the motion information of the second prediction unit may be added to the motion information table.
[0448] A motion information table for storing motion information of coding blocks to which prediction unit partitioning is applied may be defined separately. In the example, the motion information of coding blocks to which prediction unit partitioning is applied may be stored in a partition mode motion information table. The partition mode motion information table may be referred to as a triangle motion information table. In other words, the motion information of coding blocks to which prediction unit partitioning is not applied may be stored in a general motion information table, and the motion information of coding blocks to which prediction unit partitioning is applied may be stored in a partition mode motion information table. An embodiment in which the motion information of coding blocks to which the above-mentioned prediction unit partitioning is applied is added to the motion information table may be applied to update the partition mode motion information table. In the example, the motion information of the first prediction unit, the motion information of the second prediction unit, the motion information combining the motion information of the first prediction unit and the motion information of the second prediction unit, and the motion information averaging the motion vector of the first prediction unit and the motion vector of the second prediction unit may be added to the partition mode motion information table.
[0449] When prediction mode partition is not applied to the coding block, the merge candidate may be derived by using the general motion information table. On the other hand, when prediction mode partition is applied to the coding block, the merge candidate may be derived by using the partition mode motion information table.
[0450] Intra prediction is a method for performing prediction on a current block by using reconstructed samples that have been encoded / decoded and 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.
[0451] The intra prediction method includes matrix-based intra prediction and direction-based intra prediction using 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 adjacent 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.
[0452] 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 may be signaled in a bitstream. The decoder may determine the matrix for performing intra prediction on the current block based on the above information and the size of the current block.
[0453] 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.
[0454] Fig.31 is a diagram illustrating a flowchart of an intra prediction method according to an embodiment of the present disclosure.
[0455] A reference sample line of the current block may be determined S3101. 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 around the current block that have been encoded / decoded.
[0456] 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.
[0457] The plurality of reference sample lines may include at least one of a first line, a second line, or a third line above and / or on the left side of the current block. Reference sample lines including 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 adjacent reference sample lines, and the remaining reference sample lines may be referred to as non-adjacent reference sample lines.
[0458] Table 3 shows the index assigned to each of the candidate reference sample point lines.
[0459]
Table 3
[0460] 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
[0461] Based on at least one of the position, size, shape of the current block or the prediction coding mode of its neighboring blocks, a 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, an adjacent reference sample line may be determined as a reference sample line for the current block. The reference sample line may include an upper reference sample located above the current block and a left reference sample located on the left side of the current block. The upper reference sample and the left reference sample may be derived from the reconstructed samples around the current block. The reconstructed samples may be in a state before the in-loop filter is applied.
[0462] Next, an intra prediction mode for the current block may be determined S3102. 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.
[0463] Fig.32 is a diagram showing an intra prediction mode.
[0464] Fig.32 (a) shows 35 intra prediction modes. Fig.32 (b) shows 67 intra prediction modes.
[0465] Definable ratio Fig.32 The number of intra prediction modes shown in FIG. 1 may be a greater or lesser number of intra prediction modes.
[0466] 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.
[0467] The number of MPMs included in the MPM list may be pre-set in the encoding device and the decoding device. In an example, the number of MPMs may be 3, 4, 5, or 6. Alternatively, information indicating the number of MPMs may be signaled in a bitstream. Optionally, the number of MPMs may be determined based on at least one of a prediction coding mode of a neighboring block, a size, a shape, or a reference sample line index of a current block. In an example, N MPMs may be used when an adjacent reference sample line is determined as a reference sample line of the current block, and M MPMs may be used when a non-adjacent reference sample line is determined as a reference sample line of the current block. When M is a natural number less than N, in an example, N may be 6 and M may be 5, 4, or 3. Therefore, when the index of the reference sample line of the current block is 0 and the MPM flag is true, the intra-frame prediction mode of the current block may be determined as any one of the 6 candidate intra-frame prediction modes, and when the index of the reference sample line of the current block is greater than 0 and the MPM flag is true, the intra-frame prediction mode of the current block may be determined as any one of the 5 candidate intra-frame prediction modes.
[0468] Alternatively, a fixed number (eg, 6 or 5) of MPM candidates may be used regardless of the index of the reference sample line of the current block.
[0469] When matrix-based intra prediction is applied to neighboring blocks, the intra prediction modes of the neighboring blocks may be considered as a plane and MPM candidates may be derived.
[0470] When intra BDPCM is applied to a neighboring block, the intra prediction mode of the neighboring block may be considered as a default mode and an MPM candidate may be derived. In this case, the default mode may be at least one of DC, planar, vertical direction, or horizontal direction.
[0471] Optionally, based on the intra BDPCM application direction of the neighboring block, the intra prediction mode of the neighboring block may be determined. In an example, when the intra BDPCM in the horizontal direction is applied to the neighboring block, the intra prediction mode of the neighboring block may be considered to have a horizontal direction. On the other hand, when the intra BDPCM in the vertical direction is applied to the neighboring block, the intra prediction mode of the neighboring block may be considered to have a vertical direction.
[0472] An MPM list including a plurality of MPMs may be generated, and information indicating whether the MPM identical to the intra prediction mode of the current block is included in the MPM list may be signaled in a bitstream. When the information is a 1-bit flag, it may be referred to as an MPM flag. When the MPM flag indicates that the MPM identical to the current block is included in the MPM list, index information identifying one of the MPMs may be signaled in a bitstream. In an example, index information mpm_idx specifying any one of the plurality of MPMs may be signaled in a bitstream. The MPM specified by the index information may be set as the intra prediction mode of the current block. When the MPM flag indicates that the MPM identical to the current block is not included in the MPM list, the remaining mode information indicating any one of the remaining intra prediction modes other than the MPM may be signaled in a bitstream. The remaining mode information indicates an index value corresponding to the intra prediction mode of the current block in the remaining intra prediction modes to which the index is reallocated other than the MPM. The decoding device arranges the MPMs in ascending order, and determines the intra prediction mode of the current block by comparing the remaining mode information with the MPM. In an example, when the remaining mode information is the same as or less than the MPM, the intra prediction mode of the current block may be derived by adding 1 to the remaining mode information.
[0473] When deriving the intra prediction mode of the current block, the comparison between a part of the MPM and the remaining mode information may be omitted. In the example, the MPM that is a non-directional intra prediction mode in the MPM may be excluded from the comparison target. When the non-directional intra prediction mode is set to the MPM, it is obvious that the remaining mode information indicates the directional intra prediction mode, so the intra prediction mode of the current block may be derived by comparing the remaining MPM excluding the non-directional intra prediction mode with the remaining mode information. As an alternative to excluding the non-directional intra prediction mode from the comparison target, the number of non-directional intra prediction modes may be added to the remaining mode information to compare the resulting value with the remaining MPM.
[0474] As an alternative to setting the default mode to MPM, information indicating whether the intra-frame prediction mode of the current block is the default mode may be signaled in a bitstream. The information may be a 1-bit flag, and the flag may be referred to as a default mode flag. The default mode flag may be signaled only when the MPM flag indicates that the same MPM as the current block is included in the MPM list. As described above, the default mode may include at least one of a plane, a DC, a vertical direction mode, or a horizontal direction mode. In the example, when the plane is set to the default mode, the default mode flag may indicate whether the intra-frame prediction mode of the current block is a plane. When the default mode flag indicates that the intra-frame prediction mode of the current block is not the default mode, one of the MPMs indicated by the index information may be set as the intra-frame prediction mode of the current block.
[0475] When the default mode flag is used, the intra prediction mode same as the default mode may be set to not be set to MPM. In an example, when the default mode flag indicates whether the intra prediction mode of the current block is plane, the intra prediction mode of the current block may be derived by using 5 MPMs excluding the MPM corresponding to the plane.
[0476] When a plurality of intra prediction modes are set as default modes, index information indicating any one of the default modes may also be signaled. The intra prediction mode of the current block may be set to the default mode indicated by the index information.
[0477] When the index of the reference sample line of the current block is not 0, it may be set not to use the default mode. In an example, when a non-adjacent reference sample line is determined as a reference sample line of the current block, it may be set not to use a non-directional intra prediction mode such as a DC mode or a planar mode. Therefore, when the index of the reference sample line is not 0, the default mode flag may not be signaled, and the value of the default mode flag may be inferred to be a predefined value (ie, false).
[0478] 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 S3503.
[0479] 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.
[0480] 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 having 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 having 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, the average value may be calculated using a reference sample adjacent to a larger length. 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.
[0481] 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 on the same horizontal line as the prediction sample, and the vertical prediction sample may be obtained based on the upper reference sample and the lower reference sample located on the same vertical line as the 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.
[0482] 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.
[0483]
Table 4
[0484] 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
[0485] Table 4 represents the intra-frame direction parameter of each intra-frame prediction mode, wherein, when 35 intra-frame prediction modes are defined, the index of each intra-frame prediction mode is one of 2 to 34. When the directional intra-frame prediction mode is defined as more than 33, the intra-frame direction parameter of each intra-frame prediction mode can be set by subdividing Table 4. The upper reference sample and the left reference sample for the current block are arranged in a line, and then the prediction sample can be obtained based on the value of the intra-frame direction parameter. In this regard, when the value of the intra-frame direction parameter is a negative value, the left reference sample and the upper reference sample can be arranged in a line.
[0486] Fig.33 and Fig.34 is a diagram showing an example of arranging reference points in a one-dimensional array in one line.
[0487] Fig.33 An example in which the reference samples are arranged in a one-dimensional array in the vertical direction is shown, and Fig.34 An example in which reference samples are arranged in a one-dimensional array in the horizontal direction is shown. The following describes the case where 35 intra prediction modes are defined. Fig.33 and 34Embodiment of the invention.
[0488] When the intra prediction mode index is any one of 11 to 18, a one-dimensional array in the horizontal direction of the upper reference sample may be applied by rotating counterclockwise, and when the intra prediction mode index is any one of 19 to 25, a one-dimensional array in the vertical direction of the left reference sample may be applied by rotating clockwise. When arranging the reference samples in a line, the intra prediction mode angle may be considered.
[0489] Based on the intra direction parameter, a reference sample determination parameter may be determined. The reference sample determination parameter may include a reference sample index for specifying a reference sample and a weight parameter for determining a weight applied to the reference sample.
[0490] The reference sample index iIdx and the weighting factor parameter ifact may be obtained by the following Equation 10 and Equation 11, respectively.
[0491] [Equation 10]
[0492] iIdx=(y+1)*P ang / 32
[0493] [Equation 11]
[0494] i fact =[(y+1)*P ang ]&31
[0495] In Equation 10 and Equation 11, P ang Indicates intra-frame direction parameters. The reference sample specified by the reference sample index iIdx corresponds to an integer pixel.
[0496] 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.
[0497] 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 the prediction sample and a first reference sample and a slope between the prediction sample and a second reference sample, the prediction sample may be obtained by interpolating the first reference sample and the second reference sample. 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.
[0498] Equation 12 below represents an example of obtaining a prediction sample based on a reference sample.
[0499] [Equation 12]
[0500] P(x,y)=((32-i fact ) / 32)*Ref_1D(x+iIdx+1)+(i fact / 32)*Ref_1D(x+iIdx+2)In Equation 12, P represents a prediction sample, and Ref_1D represents any one of the reference samples arranged in a line. 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.
[0501] When the slope of the intra prediction mode may be represented by one reference sample, the weighting factor parameter ifact is set to 0. Therefore, Equation 12 can be simplified to the following Equation 13.
[0502] [Equation 13]
[0503] P(x, y) = Ref_1D(x+iIdx+1)
[0504] Based on the plurality of intra prediction modes, intra prediction for the current block may be performed. In an example, the intra prediction mode may be derived per prediction sample, and the prediction sample may be derived based on the intra prediction mode assigned to the prediction sample.
[0505] Alternatively, the intra prediction mode may be derived per region, and intra prediction for each region may be performed based on the intra prediction mode assigned to each region. In this case, the region may include at least one sample. At least one of the size or shape of the region may be adaptively determined based on the size or shape of the current block or at least one of the intra prediction modes. Alternatively, at least one of the size or shape of the region may be independently predefined in the encoding device and the decoding device regardless of the size or shape of the current block.
[0506] Fig.35 is a diagram showing an angle formed by a directional intra prediction mode and a straight line parallel to the x-axis.
[0507] As in Fig.35 In the example shown in , the directional prediction mode may exist between the lower left diagonal direction and the upper right diagonal direction. As described by the angle formed by the x-axis and the directional prediction mode, the directional prediction mode may exist between 45 degrees (lower left diagonal direction) and -135 degrees (upper right diagonal direction).
[0508] When the current block is non-square, there may be a case where prediction samples are derived by using reference samples located at an angle line according to an intra prediction angle that are located farther than reference samples close to prediction samples according to an intra prediction mode for the current block.
[0509] Fig.36 is a diagram illustrating an aspect of obtaining prediction samples when a current block has a non-square shape.
[0510] In the example, as in Fig.36 In the example shown in (a) of FIG. 1 , it is assumed that the current block has a non-square shape in which the width is greater than the height, and the intra prediction mode of the current block is a directional intra prediction mode having an angle from 0 degrees to 45 degrees. In this case, when deriving a prediction sample A near the right column of the current block, the following may occur: a left reference sample L far from the prediction sample among reference samples located in the angular pattern conforming to the angle is used instead of an upper reference sample T close to the prediction sample.
[0511] In another example, as in Fig.36 In the example shown in (b) of FIG. 1 , it is assumed that the current block has a non-square shape with a height greater than a width, and the intra prediction mode of the current block is a directional intra prediction mode from -90 degrees to -135 degrees. In this case, when deriving a prediction sample A near a lower row of the current block, the following may occur: an upper reference sample T far from the prediction sample among reference samples located in an angular pattern conforming to the angle is used instead of a left reference sample L close to the prediction sample.
[0512] To solve the above problem, when the current block is non-square, the intra prediction mode for the current block can be replaced by an intra prediction mode in the opposite direction. Fig.32 The directional prediction mode of the angle of the directional prediction mode shown in . The above-mentioned directional intra prediction mode can 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.
[0513] Fig.37 is a diagram illustrating a wide-angle intra prediction mode.
[0514] exist Fig.37 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.
[0515] exist Fig.37, 14 wide-angle intra prediction modes (from -1 to -14) with angles greater than 45 degrees and 14 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.
[0516] 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.
[0517] When using wide-angle intra prediction mode, the reference sample T can be used to predict Fig.36 The sample point A shown in (a) of FIG. 1 and can be predicted by using the reference sample point L Fig.36 Sample point A shown in (b).
[0518] A total of 67+N intra prediction modes constructed with the existing intra prediction modes in addition to the N wide intra prediction modes may be used. In an example, Table 5 represents intra direction parameters of the intra prediction modes when 20 wide intra prediction modes are defined.
[0519]
Table 5
[0520]
[0521]
[0522] When the current block is non-square and the intra prediction mode of the current block obtained in S2502 belongs to the conversion range, the intra prediction mode of the current block may be converted to a wide-angle intra prediction mode. The conversion range may be determined based on at least one of the size or shape or ratio of the current block. In this regard, the ratio may represent the aspect ratio of the current block. When the current block has a non-square shape with a width greater than a height, the conversion range may be set to an intra prediction mode index in the upper right diagonal direction (e.g., 66) to (from the index of the intra prediction mode in the upper right diagonal direction minus N). In this case, N may be determined based on the ratio of the current block. When the intra prediction mode of the current block belongs to the conversion range, the intra prediction mode may be converted to a wide-angle intra prediction mode. The conversion may be performed by subtracting a predefined value from the intra prediction mode, and the predefined value may be the total number of intra prediction modes excluding the wide-angle intra prediction mode (e.g., 67).
[0523] According to the embodiment, each of the intra prediction modes between No. 66 and No. 53 may be converted into the wide-angle intra prediction modes between No. -1 and No. -14, respectively.
[0524] When the current block has a non-square shape with a height greater than a width, the conversion range may be set from the intra prediction mode index in the lower left diagonal direction (e.g., 2) to (the index of the intra prediction mode in the lower left diagonal direction + M). In this case, M may be determined based on the ratio of the current block. When the intra prediction mode of the current block belongs to the conversion range, the intra prediction mode may be converted into the wide-angle intra prediction mode. The conversion may be performed by adding a predefined value to the intra prediction mode, and the predefined value may be the total number of directional intra prediction modes excluding the wide-angle intra prediction mode (e.g., 65).
[0525] According to the embodiment, each of the intra prediction modes No. 2 to No. 15 may be converted into the wide-angle intra prediction mode No. 67 to No. 80, respectively.
[0526] Hereinafter, the intra prediction mode belonging to the conversion range is referred to as a wide-angle replacement intra prediction mode.
[0527] The conversion range may be determined based on the ratio of the current block. In an example, Table 6 and Table 7 respectively represent conversion ranges when 35 intra prediction modes are defined and when 67 intra prediction modes are defined (excluding the wide-angle intra prediction mode).
[0528]
Table 6
[0529] condition Replace intra prediction mode W / H=2 Mode 2, 3, 4 W / H>2 Mode 2,3,4,5,6 W / H=1 none H / W=1 / 2 Mode 32,33,34 H / W<1 / 2 Mode 30,31,32,33,34
[0530]
Table 7
[0531] condition Replace intra prediction mode W / H=2 Mode 2,3,4,5,6,7 W / H>2 Mode 2,3,4,5,6,7,8,9,10,11 W / H=1 none H / W=1 / 2 Mode 61,62,63,64,65,66 H / W<1 / 2 Mode 57,58,59,60,61,62,63,64,65,66
[0532] As in the examples shown in Tables 6 and 7, the number of wide-angle replacement intra prediction modes included in the conversion range may vary according to the ratio of the current block. By subdividing the ratio of the current block, the conversion range may be further subdivided as shown in Table 8 below.
[0533]
Table 8
[0534]
[0535]
[0536] When a non-adjacent reference sample line is determined as a reference sample line of the current block, or when a multi-line intra prediction encoding method of selecting any one of a plurality of reference sample lines is used, it may be set not to use the wide-angle intra prediction mode. In other words, although the current block is non-square and the intra prediction mode of the current block belongs to the conversion range, the intra prediction mode of the current block may not be converted into the wide-angle intra prediction mode. Optionally, when the intra prediction mode of the current block is determined as the wide-angle intra prediction mode, it may be set so that the non-adjacent reference sample line cannot be used as the reference sample line of the current block, or the multi-line intra prediction encoding method of selecting any one of a plurality of reference sample lines is not used. When the multi-line intra prediction encoding method is not used, the adjacent reference sample line may be determined as the reference sample line of the current block.
[0537] When the wide-angle intra prediction mode is not used, refW and refH may be set to the sum of nTbW and nTbH. Therefore, the non-adjacent reference samples at a distance i from the current block may include (nTbW+nTbH+offsetX[i]) upper reference samples and (nTbW+nTbH+offsetY[i]) left reference samples in addition to the upper left reference sample. In other words, the non-adjacent reference samples at a distance i from the current block may include (2nTbW+2nTbH+offsetX[i]+offsetY[i]+1) reference samples. For example, when the value of whRatio is greater than 1, the value of offsetX may be set to a value greater than offsetY. In the example, the value of offsetX may be set to 1, and the value of offsetY may be set to 0. On the other hand, when the value of whRatio is less than 1, the value of offsetY may be set to a value greater than offsetX. In the example, the value of offsetX may be set to 0, and the value of offsetY may be set to 1.
[0538] Since the wide-angle intra-frame prediction mode is used in addition to the existing intra-frame prediction mode, the resources required for encoding the wide-angle intra-frame prediction mode may increase and the encoding efficiency may decrease. Therefore, instead of encoding the wide-angle intra-frame prediction mode as it is, an alternative intra-frame prediction mode for the wide-angle intra-frame prediction mode may be encoded to improve the encoding efficiency.
[0539] In an example, when the current block is encoded by using the wide-angle intra prediction mode No. 67, No. 2 (wide-angle replacement intra prediction mode No. 67) may be encoded as the intra prediction mode of the current block. In addition, when the current block is encoded as the wide-angle intra prediction mode No. -1, No. 66 (wide-angle replacement intra prediction mode No. -1) may be encoded as the intra prediction mode of the current block.
[0540] The decoding device may decode the intra prediction mode of the current block and determine whether the decoded intra prediction mode is included in the conversion range. When the decoded intra prediction mode is the wide-angle replacement intra prediction mode, the intra prediction mode may be converted to the wide-angle intra prediction mode.
[0541] Alternatively, when the current block is encoded as the wide-angle intra prediction mode, the wide-angle intra prediction mode may be encoded as is.
[0542] The encoding of the intra prediction mode may be performed based on the above-mentioned MPM list. Specifically, when the neighboring block is encoded as the wide-angle intra prediction mode, the MPM may be set based on the wide-angle replacement intra prediction mode corresponding to the wide-angle intra prediction mode.
[0543] A coding block or a transform block may be partitioned into a plurality of sub-blocks (or sub-partitions). When a coding block or a transform block is partitioned into a plurality of sub-blocks, prediction, transformation, and quantization may be performed for each sub-block. Partitioning a coding block or a transform block into a plurality of sub-blocks may be defined as a sub-partition intra coding method.
[0544] Information indicating whether the sub-partition intra coding method is applied may be signaled in the bitstream. The information may be a 1-bit flag. In an example, a syntax element "intra_subpartitions_mode_flag" indicating whether a coding block or a transform block is partitioned into multiple sub-blocks may be signaled in the bitstream.
[0545] Optionally, whether the sub-partition intra-coding method is applied may be determined based on at least one of the size, shape or intra-prediction mode of the coding block or the transform block. In the example, when the intra-prediction mode of the coding block is a non-directional intra-prediction mode (e.g., plane or DC) or a predefined directional intra-prediction mode (e.g., an intra-prediction mode in the horizontal direction, an intra-prediction mode in the vertical direction, or an intra-prediction mode in the diagonal direction), the sub-partition intra-coding method may be set not to be applied. Optionally, when the size of the coding block is less than a threshold, the sub-partition intra-coding method may be set not to be applied.
[0546] Optionally, when intra prediction is performed for a subblock based on an intra prediction mode of a coding block, whether the sub-partition intra coding method is applied may be determined based on whether the reconstructed samples included in the neighboring subblocks should be used as reference samples for intra prediction of the subblock. In an example, when the intra prediction mode of the coding block is an intra prediction mode in a diagonal direction or a wide-angle intra prediction mode, and the neighboring subblocks cannot be used as reference samples when intra prediction is performed for the subblock based on the intra prediction mode, it may be set not to use the sub-partition intra coding method.
[0547] Optionally, when the aspect ratio of the coding block is equal to or greater than a threshold or equal to or less than a threshold, it may be set not to use the sub-partition intra-coding method. Optionally, when at least one of the height or width of the coding block is equal to or less than a threshold, it may be set not to use the sub-partition intra-coding method. In the example, when the width or height of the coding block is equal to or less than a threshold, or when both the height and width of the coding block are equal to or less than a threshold, the sub-partition intra-coding method may not be used. Optionally, when the number of samples included in the coding block is equal to or less than a threshold, the sub-partition intra-coding method may not be used. The threshold may have a predefined value in the encoding device and the decoding device. Optionally, information for determining the threshold may be sent as a bitstream signal.
[0548] Alternatively, whether to signal a flag indicating whether the sub-partition intra-coding method is applied may be determined based on at least one of the size, shape, or intra-prediction mode of the coding block or the transform block. In an example, a flag indicating whether the sub-partition intra-coding method is applied may be encoded and signaled only when both the height and width of the coding block are equal to or less than a threshold and / or when the size of the coding block is equal to or greater than a threshold. When the flag indicating whether the sub-partition intra-coding method is applied is not encoded, the sub-partition intra-coding method may not be applied.
[0549] When the subpartition intra coding method is not used, the operation of signaling the syntax element intra_subpartitions_mode_flag may be omitted. When the operation of signaling the flag is omitted, the flag may be regarded as indicating that the subpartition intra coding method is not applied.
[0550] When the sub-partition intra encoding method is applied, the partition type of the coding block or the transform block may be determined. In this case, the partition type indicates a partition direction of the coding block or the transform block. In an example, partitioning in a vertical direction may indicate partitioning the coding block or the transform block by using at least one vertical line, and partitioning in a horizontal direction may indicate partitioning the coding block or the transform block by using at least one horizontal line.
[0551] Fig.38 : is a diagram showing an example of vertical direction partitioning and horizontal direction partitioning.
[0552] Fig.38 (a) shows an example where a coding block is partitioned into 2 sub-blocks, and Fig.38 (b) shows an example where a coding block is partitioned into 4 sub-blocks.
[0553] Information for determining the partition type of a coding block or a transform block may be sent with a signal in a bitstream. In an example, information indicating whether a vertical partition is applied to a coding block or a transform block or whether a horizontal partition is applied to a coding block or a transform block may be sent with a signal. The information may be a 1-bit flag intra_subpart_type_flag. When the value of the flag is 1, this indicates that the coding block or the transform block is partitioned in the horizontal direction, and when the value of the flag is 0, this indicates that the coding block or the transform block is partitioned in the vertical direction.
[0554] Optionally, the partition type of the coding block or transform block may be determined based on the size, shape, or intra prediction mode of the coding block or transform block. In an example, the partition type of the coding block may be determined based on the aspect ratio of the coding block. For example, when the value of whRatio representing the aspect ratio of the coding block is equal to or greater than a first threshold, vertical partitioning may be applied to the coding block. Otherwise, horizontal partitioning may be applied to the coding block.
[0555] Fig.39 is a diagram illustrating an example of determining a partition type of a coding block.
[0556] For ease of description, it is assumed that the first threshold is 2. Fig.39 In the example shown in (a), the whRatio of the coding block is 1 which is less than the first threshold. Therefore, encoding of information indicating the partition type of the coding block may be omitted, and horizontal partitioning may be applied to the coding block.
[0557] exist Fig.39 In the example shown in (b), the whRatio of the coding block is 2, which is the same as the first threshold. Therefore, encoding of information indicating the partition type of the coding block can be omitted, and vertical partitioning can be applied to the coding block.
[0558] The partition type of the coding block can be determined by using a second threshold whose sign is opposite to the first threshold. In the example, when the value of whRatio is equal to or less than the second threshold, horizontal partitioning can be applied to the coding block, otherwise, vertical partitioning can be applied to the coding block. The absolute values of the first threshold and the second threshold may be the same, and their signs may be different. In the example, when the first threshold is N (in this case, N is an integer such as 1, 2, 4, etc.), the second threshold may be -N.
[0559] Fig.40 is a diagram illustrating an example of determining a partition type of a coding block.
[0560] For ease of description, it is assumed that the second threshold is -2. Fig.40In the example shown in (a), the whRatio of the coding block is -1 which is greater than the second threshold. Therefore, encoding of information indicating the partition type of the coding block may be omitted, and vertical partitioning may be applied to the coding block.
[0561] exist Fig.40 In the example shown in (b), the whRatio of the coding block is -2 which is the same as the second threshold. Therefore, encoding of information indicating the partition type of the coding block can be omitted, and horizontal partitioning can be applied to the coding block.
[0562] Optionally, the partition type of the coding block may be determined based on a first threshold and a second threshold. In the example, when the value of whRatio is equal to or greater than the first threshold, horizontal partitioning may be applied to the coding block, and when the value of whRatio is equal to or less than the second threshold, vertical partitioning may be applied to the coding block. When the value of whRatio is between the first threshold and the second threshold, the partition type of the coding block may be determined by parsing the information in the bitstream.
[0563] The first threshold and the second threshold may be predefined in the encoding device and the decoding device. Alternatively, the first threshold and the second threshold may be defined per sequence, per picture, or per slice.
[0564] Optionally, the partition type may be determined based on the size of the coding block or the transform block. In the example, when the size of the coding block is N×n, vertical partitioning may be applied, and when the size of the coding block is n×N, horizontal partitioning may be applied. In this case, n may be a natural number less than N. N and / or n may be predefined values in the encoding device and the decoding device. Optionally, information for determining N and / or n may be signaled in a bitstream. In the example, N may be 32, 64, 128, or 256, etc. Therefore, when the size of the coding block is 128×n (in this case, n is a natural number such as 16, 32, or 64), vertical partitioning may be applied, and when the size of the coding block is n×128, horizontal partitioning may be applied.
[0565] Optionally, the partition type of the coding block or the transform block may be determined based on the intra prediction mode of the coding block or the transform block. In an example, when the intra prediction mode of the coding block has a horizontal direction or has a direction similar to the horizontal direction, the vertical direction partition may be applied to the coding block. In this case, the intra prediction mode having a direction similar to the horizontal direction means that the intra prediction mode in the horizontal direction (e.g., Fig.32Intra prediction modes (e.g., INTRA_ANGULAR18±N) whose index difference is equal to or less than a threshold value (e.g., INTRA_ANGULAR18±N) shown in (b) of FIG. 1 . On the other hand, when the intra prediction mode of the coding block has a vertical direction or has a direction similar to the vertical direction, horizontal partitioning may be applied to the coding block. In this case, the intra prediction mode having a direction similar to the vertical direction indicates an intra prediction mode in the vertical direction (e.g., Fig.32 (b) is equal to or less than a threshold value of the intra prediction mode (e.g., INTRA_ANGULAR50±N). In this case, the threshold value N may be a predefined value in the encoding apparatus and the decoding apparatus. Alternatively, information for determining the threshold value N may be signaled at a sequence level, a picture level, or a slice level.
[0566] Fig.41 is a diagram illustrating an example of determining a partition type of a coding block based on an intra prediction mode of the coding block.
[0567] As in Fig.41 In the example shown in (a) of FIG. 1 , when the intra prediction mode of the coding block has a direction similar to the vertical direction, horizontal direction partitioning may be applied to the coding block.
[0568] On the other hand, as in Fig.41 In the example shown in (b) of FIG. 1 , when the intra prediction mode of the coding block has a direction similar to the horizontal direction, vertical direction partitioning may be applied to the coding block.
[0569] Contrary to the example shown, when the intra-frame prediction mode of the coding block has a horizontal direction or a direction similar to the horizontal direction, horizontal direction partitioning can be applied, and when the intra-frame prediction mode of the coding block has a vertical direction or a direction similar to the vertical direction, vertical direction partitioning can be applied.
[0570] When vertical partitioning or horizontal partitioning is applied, the partition type of the coding block or the transform block may be determined based on whether at least one of the width or height of the sub-block generated by partitioning the coding block or the transform block is less than a threshold. In this case, the threshold may be an integer such as 2, 4, or 8.
[0571] Fig.42 is a diagram used to describe the partitioning aspects of a coding block.
[0572] If horizontal partitions are applied to Fig.42For the 4×8 sized coding block shown in (a), the coding block is partitioned into sub-blocks of 2×8 size. In this case, the width of the sub-block is less than the threshold, so horizontal partitioning is not available for the coding block. On the other hand, if vertical partitioning is applied to a 4×8 sized coding block, the coding block is partitioned into sub-blocks of 4×4 size. Since both the width and height of the sub-block are equal to or greater than the threshold, vertical partitioning can be used for the coding block. Since only vertical partitioning can be used for coding blocks, encoding of information indicating the partition type of the coding block can be omitted, and vertical partitioning can be applied to the coding block.
[0573] If vertical partitions are applied to Fig.42 For the 8×4 sized coding block shown in (b), the coding block is partitioned into sub-blocks of 8×2 size. In this case, the height of the sub-block is less than the threshold, so the vertical partitioning is not available for the coding block. On the other hand, if the horizontal partitioning is applied to the 8×4 sized coding block, the coding block is partitioned into sub-blocks of 4×4 size. Since both the width and height of the sub-block are equal to or greater than the threshold, the horizontal partitioning can be used for the coding block. Since only the horizontal partitioning can be used for the coding block, the encoding of the information representing the partition type of the coding block can be omitted, and the horizontal partitioning can be applied to the coding block.
[0574] If both vertical partitioning and horizontal partitioning are available, the partition type of the coding block may be determined by parsing information indicating the partition type of the coding block.
[0575] The number of sub-blocks may be determined based on at least one of the size or shape of the coding block or the transform block. In the example, when one of the width or height of the coding block is 8 and the other is 4, the coding block may be partitioned into 2 sub-blocks. On the other hand, when both the width and height of the coding block are 8 or greater, or when one of the width or height of the coding block is greater than 8, the coding block may be partitioned into 4 sub-blocks. In short, when the coding block has a 4×4 size, the coding block may not be partitioned into sub-blocks. When the coding block has a 4×8 or 8×4 size, the coding block may be partitioned into 2 sub-blocks. Otherwise, the coding block may be partitioned into 4 sub-blocks.
[0576] Alternatively, information indicating the size or shape of the sub-block or the number of sub-blocks may be signaled in the bitstream. The size or shape of the sub-block may be determined by the information indicating the number of sub-blocks. Alternatively, the number of sub-blocks may be determined by the information indicating the size or shape of the sub-block.
[0577] When the sub-partition intra-coding method is applied, the sub-blocks generated by partitioning the coding block or the transform block can use the same intra-prediction mode. In an example, the MPM for the coding block can be derived based on the intra-prediction mode of the neighboring blocks adjacent to the coding block, and the intra-prediction mode for the coding block can be determined based on the derived MPM. When the intra-prediction mode of the coding block is determined, each sub-block can perform intra-prediction by using the determined intra-prediction mode.
[0578] When the sub-partition intra coding method is applied, one of the MPMs may be determined as the intra prediction mode of the coding block. In other words, when the sub-partition intra coding method is applied, although the MPM flag is not signaled, the MPM flag may be inferred to be true.
[0579] Optionally, when the sub-partition intra-coding method is applied, one of the predefined candidate intra-prediction modes may be determined as the intra-prediction mode of the coding block. In the example, one of the intra-prediction modes with a horizontal direction, an intra-prediction mode with a vertical direction, an intra-prediction mode with a diagonal direction (e.g., at least one of the upper left intra-prediction mode, the upper right intra-prediction mode, or the lower left intra-prediction mode) or a non-directional intra-prediction mode (e.g., at least one of the plane or DC) may be determined as the intra-prediction mode of the coding block. Index information specifying one of the predefined candidate intra-prediction modes may be sent with a bitstream signal. Optionally, the number and / or type of candidate intra-prediction modes may be different depending on the partition direction of the coding block. In the example, when horizontal partitioning is applied to the coding block, at least one of the non-directional intra-prediction mode, the intra-prediction mode with a vertical direction, the intra-prediction mode with an upper left diagonal direction, or the intra-prediction mode with an upper right diagonal direction may be set as a candidate intra-prediction mode. On the other hand, when vertical partitioning is applied to the coding block, at least one of a non-directional intra prediction mode, an intra prediction mode with a horizontal direction, an intra prediction mode with an upper left diagonal direction, or an intra prediction mode with a lower left diagonal direction may be set as a candidate intra prediction mode.
[0580] According to an embodiment of the present disclosure, at least one intra prediction mode of a subblock may be set differently from other subblocks. In an example, the intra prediction mode of the Nth subblock may be derived by adding an offset to the intra prediction mode of the (N-1)th subblock or subtracting the offset from the intra prediction mode of the (N-1)th subblock. The offset may be predefined in the encoding device and the decoding device. Optionally, the offset may be derived based on at least one of the size, shape or intra prediction mode of the coding block, the size or shape of the subblock, the number of subblocks, or the partition direction of the coding block. Optionally, information for deriving the offset may be sent as a bitstream signal.
[0581] Optionally, when the intra-frame prediction mode of the (N-1)th sub-block is a non-directional mode, the intra-frame prediction mode of the Nth sub-block may also be set to be the same as the intra-frame prediction mode of the (N-1)th sub-block, and when the intra-frame prediction mode of the (N-1)th sub-block is a directional mode, the intra-frame prediction mode derived by adding an offset to the intra-frame prediction mode of the (N-1)th sub-block or subtracting the offset from the intra-frame prediction mode of the (N-1)th sub-block may be set as the intra-frame prediction mode of the Nth sub-block.
[0582] Optionally, the directional intra prediction mode may be applied to a portion of the plurality of subblocks, and the non-directional intra prediction mode may be applied to the remaining portion of the subblocks. The subblock to which the non-directional intra prediction mode is applied may be determined by considering at least one of the size, shape or position of the subblock or the number of subblocks. Optionally, the non-directional intra prediction mode may be applied to another subblock only when the directional intra prediction mode applied to one of the plurality of subblocks is a predefined value.
[0583] Alternatively, the intra prediction mode of each sub-block may be derived from the MPM. To this end, index information of any one of the MPMs may be signaled for each sub-block.
[0584] Optionally, the intra prediction mode of each sub-block may be derived from predefined candidate intra prediction modes. To this end, index information specifying any one of the predefined candidate intra prediction modes may be signaled for each sub-block. The number and / or type of candidate intra prediction modes may be set differently per sub-block.
[0585] Alternatively, information indicating whether the intra prediction modes of the subblocks are set to be the same may be signaled in a bitstream.
[0586] The quantization parameters of the sub-blocks may be determined separately. Therefore, the value of the quantization parameter of each sub-block may be set differently. Information representing the difference from the quantization parameter of the previous sub-block may be encoded to determine the quantization parameter of each sub-block. In an example, for the Nth sub-block, the difference between the quantization parameter of the Nth sub-block and the quantization parameter of the (N-1)th sub-block may be encoded.
[0587] Intra-frame prediction of a sub-block may be performed by using reference samples. In this case, the reference samples may be derived from reconstructed samples of a neighboring block adjacent to the sub-block. When the neighboring block adjacent to the sub-block is another sub-block included in the same coding block as the sub-block, the reference samples of the sub-block may be derived based on the reconstructed samples of the other sub-block. In the example, when a first sub-block is located to the left or above a second sub-block, the reference samples of the second sub-block may be derived from the reconstructed samples of the first sub-block. In this regard, parallel intra-frame prediction may not be applied between sub-blocks. In other words, encoding / decoding may be performed sequentially for the sub-blocks included in the coding block. Therefore, after encoding / decoding of the first sub-block is completed, intra-frame prediction for the second sub-block may be performed.
[0588] When the sub-partition intra coding method is applied, it may be set not to use the multi-line intra prediction coding method of selecting any one of the multiple reference sample line candidates. When the multi-line intra prediction coding method is not used, the adjacent reference sample line adjacent to each sub-block may be determined as the reference sample line of each sub-block. Optionally, when the index of the reference sample line of the current block is greater than 0, the encoding of the syntax element intra_subpartitions_mode_flag indicating whether the sub-partition intra coding method is applied may be omitted. When the encoding of the syntax element intra_subpartitions_mode_flag is omitted, the sub-partition intra coding method may not be applied.
[0589] Optionally, although the sub-partition intra encoding method is applied, a multi-line intra prediction encoding method may be used. For this, index information for specifying a reference sample line may be signaled for each sub-block. Optionally, index information for specifying a reference sample line may be signaled for only any one of a plurality of sub-blocks, and the index information may also be applied to the remaining sub-blocks. Optionally, index information for specifying a reference sample line may be signaled for a coding block, and a plurality of sub-blocks included in the coding block may share the index information.
[0590] Optionally, the multi-line intra-frame prediction encoding method may be used only for sub-blocks at predefined positions in the sub-blocks or sub-blocks with predefined partition indexes. In an example, index information of any one of the reference sample line candidates may be signaled only for sub-blocks with a partition index of 0 in the plurality of sub-blocks or sub-blocks adjacent to the upper boundary or left boundary of the coding block. The multi-line intra-frame prediction encoding method may not be applied to the remaining sub-blocks. Therefore, the remaining sub-blocks may perform intra-frame prediction by using adjacent reference sample lines.
[0591] 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 an intra weighted prediction method based on sample position (or position-dependent prediction combination PDPC).
[0592] Whether to use PDPC may be determined by considering the size, shape or 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 can 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 2 of the conditions listed above are met.
[0593] Optionally, based on whether the sub-partition intra-coding method is used, it can be determined whether to use PDPC. In an example, when the sub-partition intra-coding method is applied to a coding block or a transform block, PDPC can be set to not be used. Optionally, when the sub-partition intra-coding method is applied to a coding block or a transform block, PDPC can be applied to at least one of a plurality of sub-blocks. In this case, the sub-block as the target of PDPC can be determined based on at least one of the size, shape, position, intra-prediction mode, or reference sample line index of the coding block or sub-block. In an example, PDPC can be applied to a sub-block adjacent to the upper boundary and / or left boundary of the coding block or to a sub-block adjacent to the lower boundary and / or right boundary of the coding block. Optionally, based on the size or shape of the sub-block, it can be set to apply PDPC to all sub-blocks included in the coding block, or not to apply PDPC to all sub-blocks included in the coding block. In an example, when at least one of the width or height of the sub-block is less than a threshold, the application of PDPC can be omitted. In another example, PDPC can be applied to all sub-blocks in the coding block.
[0594] Optionally, whether to apply PDPC may be determined for each sub-block based on whether at least one of the size, shape, intra-prediction mode, or reference picture index of a sub-block generated by partitioning a coding block or a transform block satisfies a preset condition. In an example, PDPC may be applied to a sub-block when at least one of the width or height of the sub-block is greater than 4.
[0595] In another example, information showing whether PDPC is applied may be signaled in a bitstream.
[0596] Optionally, the area to which PDPC is applied may be determined based on at least one of the size, shape, or intra-prediction mode of the current block or the position of the prediction sample. In the example, when the intra-prediction mode of the current block has an index greater than the vertical direction, at least one of the prediction samples whose x-axis coordinates or y-axis coordinates are greater than the threshold may not be corrected, and only the prediction samples whose x-axis coordinates or y-axis coordinates are equal to or less than the threshold may be corrected. Optionally, when the intra-prediction mode of the current block has an index less than the horizontal direction, at least one of the prediction samples whose x-axis coordinates or y-axis coordinates are greater than the threshold may not be corrected, and only the prediction samples whose x-axis coordinates or y-axis coordinates are equal to or less than the threshold may be corrected. In this case, the threshold may be determined based on at least one of the size, shape, or intra-prediction mode of the current block.
[0597] When the prediction sample is obtained by intra-prediction sample, the reference sample used to correct the prediction sample may be determined based on the position of the obtained prediction sample.
[0598] 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.
[0599] DCT is used to decompose (or transform) the residual image into two-dimensional frequency components by using cosine transform, and DST is used to synthesize (or transform) the residual image into two-dimensional frequency components by using sine transform. As a result of transforming the residual image, the frequency components can be represented as basic images. In the example, when DCT transform is performed for a block of N×N size, N2 basic mode components can be obtained. The size of each basic mode component included in the basic mode components of the block of N×N size can be obtained by transformation. Depending on the transform method used, the size of the basic mode component can be referred to as a DCT coefficient or a DST coefficient.
[0600] The transform method DCT is mainly used to transform images with many non-zero low-frequency components. The transform method DST is mainly used to transform images with many high-frequency components.
[0601] The residual image may also be transformed by using a transform method other than DCT or DST.
[0602] Hereinafter, the operation of transforming the residual image into two-dimensional frequency components is referred to as two-dimensional image transformation. In addition, the size of the basic mode component obtained by the transformation is referred to as a transformation coefficient. In an example, the transformation coefficient may represent a DCT coefficient or a DST coefficient. When both the first transformation and the second transformation described below are applied, the transformation coefficient may represent the basic mode component generated by the result of the second transformation. In addition, the residual sample points skipped by applying the transformation are also referred to as transformation coefficients.
[0603] The transformation method may be determined in units of blocks. The transformation method may be determined based on at least one of a prediction coding mode of 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 using a DST transformation method. On the other hand, when the condition is not met, the transformation may be performed by using a DCT transformation method.
[0604] For some blocks of the residual image, a two-dimensional image transform may not be performed. Not performing a two-dimensional image transform may be referred to as transform skipping. Transform skipping means that a primary transform and a secondary transform are not applied to the current block. When transform skipping is applied, quantization may be applied to the residual values for which the transform is not performed.
[0605] Whether transform skipping is allowed for the current block may be determined based on at least one of the size or shape of the current block. In an example, transform skipping may be applied only when the size of the current block is less than a threshold. The threshold is related to at least one of the width, height, or number of samples of the current block, and may be defined as 32×32, etc. Optionally, transform skipping may be allowed only for square blocks. In an example, transform skipping may be allowed for square blocks of 32×32, 16×16, 8×8, or 4×4 size. Optionally, transform skipping may be allowed only when a sub-partition intra coding method is not used.
[0606] Alternatively, when the subpartition intra encoding method is applied to the current block, whether to apply transform skip may be determined for each subblock.
[0607] Fig.43 is a diagram illustrating an example of determining whether to perform transform skip per sub-block.
[0608] Transform skipping may be applied to only a portion of the sub-blocks in the plurality of sub-blocks. Fig.43 In the example shown in , it may be set that the transformation is skipped and applied to the sub-block at the upper position of the current block, and the transformation is not skipped and applied to the sub-block at the lower position.
[0609] The transform type of the subblock for which transform skipping is not allowed may be determined based on information signaled in a bitstream. In an example, the transform type may be determined based on tu_mts_idx, which will be described below.
[0610] Optionally, the transform type of the sub-block may be determined based on the size of the sub-block. In an example, the horizontal transform type may be determined based on whether the width of the sub-block is equal to or greater than and / or equal to or less than a threshold, and the vertical transform type may be determined based on whether the height of the sub-block is equal to or greater than and / or equal to or less than a threshold.
[0611] 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.
[0612] 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 DST7.
[0613] 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.
[0614] 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. Optionally, the second transform may be performed on transform coefficients belonging to three 4×4 sized sub-blocks. The three sub-blocks may include a sub-block located at the upper left of the current block, a sub-block adjacent to the right of the sub-block, and a sub-block adjacent to the bottom of the sub-block. Optionally, the second transform may be performed on an 8×8 sized block.
[0615] The transform coefficients in the remaining regions where the secondary transform is not performed may also be set to 0.
[0616] Alternatively, the first transform may be performed on the 4×4 block, and the second transform may be performed on a region having a size of 8×8 including the transformed 4×4 block.
[0617] Information indicating whether to perform a secondary transformation may be sent as a signal in a bitstream. In an example, a flag indicating whether to perform a secondary transformation or index information specifying whether to perform a secondary transformation and a transformation core for the secondary transformation may be sent as a signal. In an example, when the index information is 0, this indicates that a secondary transformation is not performed for the current block. On the other hand, when the index information is greater than 0, the transformation core for the secondary transformation may be determined by the index information.
[0618] 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.
[0619] Optionally, 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. Optionally, when the sub-partition intra encoding method is applied to the current block, the secondary transform may be allowed only when a DCT2 transform kernel is used for the horizontal transform and the vertical transform.
[0620] 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.
[0621] Alternatively, whether to perform a secondary transform may be determined based on the position of the last non-zero transform coefficient of the current block. In an example, when at least one of the x-axis coordinate or the y-axis coordinate of the last non-zero transform coefficient of the current block is greater than a threshold, or when at least one of the x-axis coordinate or the y-axis coordinate of the sub-block to which the last non-zero transform coefficient of the current block belongs is greater than a threshold, a secondary transform may not be performed. In this case, the threshold may be predefined in the encoding device and the decoding device. Alternatively, the threshold may be determined based on the size or shape of the current block.
[0622] Optionally, when there is only a transform coefficient of a DC component in the current block, it may be set not to perform a secondary transform. In this case, the DC component represents a transform coefficient at an upper left position in the current block.
[0623] Optionally, when matrix-based intra prediction is applied to the current block, it may be configured not to perform secondary transform.
[0624] The information indicating the transform type of the current block may be signaled in a bitstream. The information may be index information tu_mts_idx indicating one of a combination of a transform type for a horizontal direction and a transform type for a vertical direction.
[0625] Based on the transform type candidates specified by the index information tu_mts_idx, a transform kernel for a vertical direction and a transform kernel for a horizontal direction may be determined. Table 9 represents transform type combinations according to tu_mts_idx.
[0626]
Table 9
[0627]
[0628]
[0629] The transform type may be determined as one of DCT2, DST7, or DCT 8. Optionally, transform skip may be inserted in the transform type candidate.
[0630] When Table 9 is used, when tu_mts_idx is 0, DCT2 may be applied in the horizontal direction and in the vertical direction. When tu_mts_idx is 2, DCT8 may be applied in the horizontal direction, and DCT7 may be applied in the vertical direction.
[0631] When the sub-partition intra encoding method is applied, the transform kernel of the sub-block may be determined independently. In an example, information for specifying a transform type combination candidate may be encoded and signaled per sub-block. Therefore, the transform kernel may be different between sub-blocks.
[0632] Optionally, the subblocks may use the same transform type. In this case, tu_mts_idx specifying the transform type combination candidate may be signaled only for the first subblock. Optionally, tu_mts_idx may be signaled at a coding block level, and the transform type of the subblock may be determined by referring to the tu_mts_idx signaled at the coding block level. Optionally, the transform type may be determined based on at least one of a size, a shape, or an intra prediction mode of one of the subblocks, and the determined transform type may be set for all subblocks.
[0633] Fig.44 is a diagram showing an example in which sub-blocks use the same transform type.
[0634] When the coding block is partitioned in the horizontal direction, the transform type of the sub-block (Sub-CU0) at the upper position of the coding block can be set to be the same as the transform type of the sub-block (Sub-CU1) at the lower position. Fig.44 In the example shown in (a) of FIG. 2 , when a horizontal transform type and a vertical transform type are determined based on tu_mts_idx that is signaled for an upper subblock, the determined transform type may also be applied to a lower subblock.
[0635] When the coding block is partitioned in the vertical direction, the transform type of the sub-block (Sub-CU0) at the left position of the coding block may be set to be the same as the transform type of the sub-block (Sub-CU1) at the right position. Fig.44 In the example shown in (b) of FIG. 2 , when the horizontal transform type and the vertical transform type are determined for the left subblock based on the signaled tu_mts_idx, the determined transform type may also be applied to the right subblock.
[0636] Whether to encode the index information may be determined based on at least one of the size or shape of the current block, the number of non-zero coefficients, whether a secondary transform is performed, or whether a sub-partition intra encoding method is applied. In an example, when the sub-partition intra encoding method is applied to the current block, or when the number of non-zero coefficients is equal to or less than a threshold value, the operation of signaling the index information may be omitted. When the operation of signaling the index information is omitted, a default transform type may be applied to the current block.
[0637] The default transform type may include at least one of DCT2 or DST7. When there are multiple default transform types, one of the multiple default transform types may be selected by considering at least one of the size, shape, or intra prediction mode of the current block, whether the secondary transform is performed, or whether the sub-partition intra encoding method is applied. In an example, one of the multiple transform types may be determined as a horizontal transform type based on whether the width of the current block is within a preset range, and one of the multiple transform types may be determined as a vertical transform type based on whether the height of the current block is within a preset range. Optionally, the default mode may be determined differently according to the size, shape, or intra prediction mode of the current block, or whether the secondary transform is performed.
[0638] Optionally, when there is only a transform coefficient of a DC component in the current block, the horizontal transform type and the vertical transform type may be set to a default transform type. In an example, when there is only a transform coefficient of a DC component in the current block, the horizontal transform type and the vertical transform type may be set to DCT2.
[0639] The threshold may be determined based on the size or shape of the current block. In an example, when the size of the current block is equal to or less than 32×32, the threshold may be set to 2, and when the current block is larger than 32×32 (e.g., when the current block is a 32×64 or 64×32 size coding block), the threshold may be set to 4.
[0640] A plurality of lookup tables may be pre-stored in the encoding device / decoding device. At least one of an index value assigned to a transform type combination candidate, a type of the transform type combination candidate, or the number of transform type combination candidates may be different for each of the plurality of lookup tables.
[0641] A lookup table for the current block may be selected based on at least one of a size, a shape, or an intra prediction mode of the current block, whether a secondary transform is applied, or whether transform skipping is applied to a neighboring block.
[0642] In an example, when the size of the current block is equal to or less than 4×4, or when the current block is encoded by inter-frame prediction, a first lookup table may be used, and when the size of the current block is greater than 4×4, or when the current block is encoded by intra-frame prediction, a second lookup table may be used.
[0643] Alternatively, information indicating one of the plurality of lookup tables may be signaled in a bitstream, and the decoding device may select a lookup table for the current block based on the information.
[0644] In another example, the index assigned to the transform type combination candidate may be adaptively determined based on at least one of the size, shape, prediction coding mode or intra prediction mode of the current block, whether a secondary transform is applied, or whether a transform skip is applied to a neighboring block. In the example, the index assigned to the transform skip when the size of the current block is 4×4 may be less than the index assigned to the transform skip when the size of the current block is greater than 4×4. Specifically, when the size of the current block is 4×4, index 0 may be assigned to the transform skip, and when the current block is greater than 4×4 and equal to or less than 16×16, an index greater than 0 (e.g., index 1) may be assigned to the transform skip. When the current block is greater than 16×16, a maximum value (e.g., 5) may be assigned to the index of the transform skip.
[0645] Alternatively, when the current block is encoded by inter prediction, an index of 0 may be assigned to the transform skip. When the current block is encoded by intra prediction, an index greater than 0 (eg, index 1) may be assigned to the transform skip.
[0646] Alternatively, when the current block is a 4×4 sized block encoded by inter-frame prediction, an index of 0 may be assigned to transform skip. On the other hand, when the current block is not encoded by inter-frame prediction, or when the current block is larger than 4×4, an index greater than 0 (e.g., index 1) may be assigned to transform skip.
[0647] Transform type combination candidates different from the transform type combination candidates listed in Table 9 may also be used. In an example, a transform type combination candidate consisting of a transform skip applied to one of a horizontal direction transform or a vertical direction transform and a transform kernel (such as DCT2, DCT8, or DST7, etc.) applied to the other of the horizontal direction transform or the vertical direction transform may be used. In this case, whether the transform skip is to be used as a transform type candidate for the horizontal direction or the vertical direction may be determined based on at least one of a size (e.g., width and / or height), a shape, a prediction coding mode, or an intra prediction mode of a current block.
[0648] Information indicating whether index information for determining a transform type of a current block is explicitly signaled may be signaled in a bitstream. In an example, information sps_explicit_intra_mts_flag indicating whether explicit transform type determination is allowed for a block encoded by intra prediction and / or information sps_explicit_inter_mts_flag indicating whether explicit transform type determination is allowed for a block encoded by inter prediction may be signaled at a sequence level.
[0649] When explicit transform type determination is allowed, the transform type of the current block may be determined based on index information tu_mts_idx signaled in a bitstream. On the other hand, when explicit transform type determination is not allowed, the transform type may be determined based on at least one of the size or shape of the current block, whether transform is allowed to be performed in units of subblocks, the position of the subblock including non-zero transform coefficients, whether the secondary transform is performed, or whether the sub-partition intra-coding method is applied. In an example, the horizontal transform type of the current block may be determined based on the width of the current block, and the vertical transform type of the current block may be determined based on the height of the current block. For example, when the width of the current block is less than 4 or greater than 16, the horizontal transform type may be determined as DCT2. Otherwise, the horizontal transform type may be determined as DST7. When the height of the current block is less than 4 or greater than 16, the vertical transform type may be determined as DCT2. Otherwise, the vertical transform type may be determined as DST7. In this case, a threshold to be compared with the width and height may be determined based on at least one of the size, shape, or intra-prediction mode of the current block to determine the horizontal transform type and the vertical transform type.
[0650] Alternatively, when the current block has a square shape with the same height and width, the horizontal direction transform type and the vertical direction transform type may be set to be the same, but when the current block has a non-square shape with a height and a width different from each other, the horizontal direction transform type and the vertical direction transform type may be set differently. In an example, when the width of the current block is greater than the height, the horizontal direction transform type may be determined as DST7, and the vertical direction transform type may be determined as DCT2. When the height of the current block is greater than the width, the vertical direction transform type may be determined as DST7, and the horizontal direction transform type may be determined as DCT2.
[0651] The number and / or type of transform type candidates or the number and / or type of transform type combination candidates may differ depending on whether explicit transform type determination is allowed. In an example, when explicit transform type determination is allowed, DCT2, DST7, and DCT8 may be used as transform type candidates. Therefore, each of the horizontal direction transform type and the vertical direction transform type may be set to DCT2, DST7, or DCT8. When explicit transform type determination is not allowed, only DCT2 and DST7 may be used as transform type candidates. Therefore, each of the horizontal direction transform type and the vertical direction transform type may be determined to be DCT2 or DST7.
[0652] A coding block or a transform block may be partitioned into a plurality of subblocks, and transform may be performed only on a portion of the plurality of subblocks. An operation of applying transform to only a portion of the plurality of subblocks may be defined as a sub-transform block encoding method.
[0653] Fig.45 and 46 is a diagram illustrating application aspects of the sub-transform block coding method.
[0654] Fig.45 is a diagram showing an example in which transformation is performed on only one sub-block among four sub-blocks, Fig.50 is a diagram showing an example of performing transformation on only one of two sub-blocks. Fig.45 and Fig.46 In , it is assumed that the transformation is performed only on the sub-blocks marked as "target".
[0655] As in Fig.45 In the example shown in , after partitioning a coding block into 4 sub-blocks by using mutually orthogonal vertical and horizontal lines, transformation and quantization may be performed on only one of the sub-blocks. Transform coefficients in the sub-block on which transformation is not performed may be set to 0.
[0656] Optionally, as in Fig.46In the example shown in , after partitioning a coding block into 2 sub-blocks by using vertical lines or horizontal lines, transformation and quantization may be performed on only one of the sub-blocks. Transform coefficients in the sub-block on which transformation is not performed may be set to 0.
[0657] Information indicating whether a sub-transform block encoding method is applied to a coding block may be signaled in a bitstream. The information may be a 1-bit flag cu_sbt_flag. When the flag is 1, this indicates that the transform is performed only on a portion of the plurality of sub-blocks generated by partitioning the coding block or the transform block, and when the flag is 0, this indicates that the transform is performed without partitioning the coding block or the transform block into sub-blocks.
[0658] Whether the sub-transform block encoding method can be used for the coding block can be determined based on the size, shape, or prediction coding mode of the coding block or whether the combined prediction mode is used for at least one of the coding blocks. In an example, the sub-transform block encoding method can be used for the coding block when at least one of the following conditions is satisfied: at least one of the width or height of the coding block is equal to or greater than a threshold, inter-frame prediction is applied to the coding block, or the combined prediction mode is not applied to the coding block. In this case, the threshold value may be a natural number such as 4, 8, or 16.
[0659] Optionally, when the aspect ratio of the coding block is greater than a threshold, the sub-transform block coding method may not be allowed to be applied.
[0660] When intra prediction is applied to the coding block or when the intra block copy mode is applied, the sub-transform block encoding method may be determined to be unavailable.
[0661] Alternatively, whether the sub-transform block encoding method is available for the encoding block may be determined based on whether the sub-partition intra encoding method is applied to the encoding block. In an example, when the sub-partition intra encoding method is applied, the sub-transform block encoding method may be determined to be available.
[0662] When the sub-transform block coding method is determined to be applicable to the coding block, the syntax cu_sbt_flag may be signaled in the bitstream. According to the parsed value of cu_sbt_flag, it may be determined whether the sub-transform block coding method is applied.
[0663] On the other hand, when the sub-transform block encoding method is determined to be unavailable for the coding block, the operation of signaling the syntax cu_sbt_flag may be omitted. When the operation of signaling the syntax cu_sbt_flag is omitted, it may be determined that the sub-transform block encoding method is not applied to the coding block.
[0664] When the sub-transform coding method is applied to the coding block, information indicating the partition shape of the coding block may be signaled in a bitstream. The information indicating the partition shape of the coding block may include at least one of information indicating whether the coding block is partitioned into 4 sub-blocks, information indicating the partition direction of the coding block, or information indicating the number of sub-blocks.
[0665] In an example, when the syntax cu_sbt_flag is 1, a flag cu_sbt_quadtree_flag indicating whether the coding block is partitioned into 4 sub-blocks may be signaled. When the syntax cu_sbt_quadtree_flag is 1, this indicates that the coding block is partitioned into 4 sub-blocks. In an example, the coding block may be partitioned into 4 sub-blocks by using 3 vertical lines or 3 horizontal lines, or the coding block may be partitioned into 4 sub-blocks by using 1 vertical line and 1 horizontal line. The operation of partitioning the coding block into 4 sub-blocks may be referred to as quadtree partitioning.
[0666] When the syntax cu_sbt_quadtree_flag is 0, this indicates that the coding block is partitioned into 2 sub-blocks. In an example, the coding block can be partitioned into 2 sub-blocks by using 1 vertical line or 1 horizontal line. The operation of partitioning the coding block into 2 sub-blocks may be referred to as binary tree partitioning. When the value of the syntax cu_sbt_quad_tree_flag is 0, a sub-block of 1 / 2 the size of the coding block may be included in the coding block.
[0667] In addition, a flag indicating the partition direction of the coding block can be signaled in the bitstream. In the example, a flag cu_sbt_horizontal_flag indicating whether horizontal partitioning is applied to the coding block can be encoded and signaled. When the value of cu_sbt_horizontal_flag is 1, this indicates that horizontal partitioning using at least one partition line parallel to the upper and lower sides of the coding block is applied. When the value of cu_sbt_horizontal_flag is 0, this indicates that vertical partitioning using at least one partition line parallel to the left and right sides of the coding block is applied.
[0668] According to the size or shape of the coding block, the partition shape of the coding block may be determined. In an example, when at least one of the width or height of the coding block is equal to or greater than a first threshold, the quadtree partition may be available. In an example, the first threshold may be a natural number such as 4, 8, or 16. The first threshold may be referred to as a quadtree threshold.
[0669] When quadtree partitioning is determined to be available, the syntax cu_sbt_quadtree_flag may be signaled in the bitstream. According to the parsed value of cu_sbt_quadtree_flag, it may be determined whether quadtree partitioning is applied to the coding block.
[0670] When quadtree partitioning is determined to be unavailable, the operation of signaling the syntax cu_sbt_quadtree_flag may be omitted. When the operation of signaling the syntax cu_sbt_quadtree_flag is omitted, it may be determined that binary tree partitioning is applied to the coding block.
[0671] Table 10 shows a syntax structure used to determine whether to parse the syntax cu_sbt_quadtree_flag.
[0672]
Table 10
[0673]
[0674]
[0675] In Table 10, the variable allowSbtVerQ indicates whether quadtree partitioning in the vertical direction is allowed, and the variable allowSbtHorQ indicates whether quadtree partitioning in the horizontal direction is allowed. The variables allowSbtVerQ and allowSbtHorQ may be determined based on the quadtree threshold. In an example, when the quadtree threshold is 16, allowSbtVerQ may be determined based on whether the width of the coding block is equal to or greater than 16, and allowSbtHorQ may be determined based on whether the height of the coding block is equal to or greater than 16.
[0676] As shown in the example of Table 10, when the variables allowSbtVerQ and allowSbtHorQ are both true, the syntax cu_sbt_quad_flag may be parsed from the bitstream. In the example, when the coding block is 16×8, the variable allowSbtHorQ is set to false, so the parsing of the syntax cu_sbt_quad_flag may be omitted. Alternatively, when the coding block is 8×16, the variable allowSbtVerQ is set to false, so the parsing of the syntax cu_sbt_quad_flag may be omitted. When the parsing of the syntax cu_sbt_quad_flag is omitted, binary tree partitioning may be applied to the coding block.
[0677] Optionally, unlike the example shown in Table 10, the syntax cu_sbt_quad_flag may be parsed when either the variable allowSbtVerQ or the variable allowSbtHorQ is true. In other words, quadtree partitioning may be available when only either the width and height of the coding block is equal to or greater than the quadtree threshold.
[0678] Optionally, although either the width or height of the coding block is equal to or greater than the first threshold, when the other of the width or height of the coding block is equal to or less than the second threshold, the quadtree partition of the coding block may be determined to be unavailable. In this case, the second threshold may have a value less than the first threshold. In an example, the second threshold may be a natural number such as 2, 4, or 8.
[0679] The variable allowSbtHorH indicates whether the binary tree partition in the horizontal direction is available. When the height of the coding block is equal to or greater than the threshold, the binary tree partition in the horizontal direction can be set to be available. The variable allowSbtVerH indicates whether the binary tree partition in the vertical direction is available. When the width of the coding block is equal to or greater than the threshold, the binary tree partition in the vertical direction can be set to be available. In this case, the threshold can be a natural number such as 4, 8, or 16.
[0680] When both horizontal quadtree partitioning / binary tree partitioning and vertical quadtree partitioning / binary tree partitioning are available, the syntax cu_sbt_horizontal_flag may be signaled in the bitstream. Depending on the value of the syntax cu_sbt_horizontal_flag, partitioning in the horizontal direction or partitioning in the vertical direction may be applied to the coding block.
[0681] On the other hand, when only one of the quadtree partitioning / binary tree partitioning in the horizontal direction and the quadtree partitioning / binary tree partitioning in the vertical direction is available, the operation of signaling the syntax cu_sbt_horizontal_flag can be omitted. When the operation of signaling the syntax cu_sbt_horizontal_flag is omitted, the available one of the quadtree partitioning / binary tree partitioning in the horizontal direction and the quadtree partitioning / binary tree partitioning in the vertical direction can be applied.
[0682] Optionally, the partition type of the coding block may be determined based on the shape of the coding block. In an example, whether quadtree partitioning is allowed, whether quadtree partitioning / binary tree partitioning in the horizontal direction is allowed, or whether quadtree partitioning / binary tree partitioning in the vertical direction is allowed may be determined based on whether the aspect ratio of the coding block is greater than a threshold. At least one of the partitioning may be determined. The threshold may be a natural number such as 2, 3, or 4.
[0683] Table 11 shows an example of determining whether a partition type is allowed based on the shape of a coding block.
[0684]
Table 11
[0685]
[0686]
[0687] In Table 11, the variable allowSbtHorH indicates whether binary tree partitioning in the horizontal direction is allowed, and the variable allowSbtVerH indicates whether binary tree partitioning in the vertical direction is allowed.
[0688] When the width of the coding block is greater than twice the height, the variable allowSbtHorH may be set to false. In other words, when the width of the coding block is greater than twice the height, binary tree partitioning in the horizontal direction may not be allowed.
[0689] When the height of the coding block is greater than twice the width, the variable allowSbtVerH may be set to false. In other words, when the height of the coding block is greater than twice the width, binary tree partitioning in the vertical direction may not be allowed.
[0690] When horizontal binary tree partitioning or vertical binary tree partitioning is not available, the operation of signaling the syntax cu_sbt_horizontal_flag may be omitted.
[0691] When the operation of signaling the syntax cu_sbt_horizontal_flag is omitted and the variable allowSbtHorH is true, binary tree partitioning in the horizontal direction may be applied to the coding block.
[0692] When the operation of signaling the syntax cu_sbt_horizontal_flag is omitted and the variable allowSbtVerH is true, binary tree partitioning in the vertical direction may be applied to the coding block.
[0693] Information for specifying a sub-block as a target of a transform among a plurality of sub-blocks may be signaled in a bitstream. In an example, the syntax cu_sbt_pos_flag may be signaled in a bitstream. The syntax cu_sbt_pos_flag indicates whether the transform target is the first sub-block in the coding block. In the example, when quadtree partitioning / binarytree partitioning in the horizontal direction is applied to the coding block, when cu_sbt_pos_flag is 1, the leftmost sub-block is determined as the transform target, and when cu_sbt_pos_flag is 0, the rightmost sub-block is determined as the transform target. When quadtree partitioning / binarytree partitioning in the vertical direction is applied to the coding block, when cu_sbt_pos_flag is 1, the topmost sub-block is determined as the transform target, and when cu_sbt_pos_flag is 0, the bottommost sub-block is determined as the transform target.
[0694] When a coding block is partitioned into 4 subblocks whose height and width are 1 / 2 of the coding block, respectively, an index cu_sbt_pos_idx specifying any one of the 4 subblocks may be signaled instead of the flag cu_sbt_pos_flag. The syntax cu_sbt_pos_idx may have a value from 0 to 3, and a subblock having an index indicated by cu_sbt_pos_idx may be determined as a transform target.
[0695] Optionally, when the coding block is partitioned into 4 sub-blocks, multiple sub-blocks may be selected as transform targets. The multiple sub-blocks may be adjacent to each other in the horizontal direction or the vertical direction.
[0696] The transform type of the subblock may be determined by considering the partition direction of the coding block and the position of the subblock. In an example, when the coding block is partitioned in the vertical direction and a transform is performed on a subblock at a left position in the subblock, the horizontal direction transform type and the vertical direction transform type may be set differently.
[0697] Fig.47 and Fig.48 A horizontal direction transform type and a vertical direction transform type according to the position of a subblock that is a transform target are shown.
[0698] exist Fig.47 In the example shown in , when the subblock as the target of the transform includes the upper left sample point or the lower right sample point of the coding block, the horizontal direction transform type and the vertical direction transform type can be set to be the same. In the example, Fig.51 The example shown in shows that when the subblock as the target of transformation includes the upper left sample point of the coding block, the horizontal direction transform type and the vertical direction transform type are set to DCT8, and when the subblock as the target of transformation includes the lower right sample point of the coding block, the horizontal direction transform type and the vertical direction transform type are set to DST7.
[0699] When the subblock as the target of the transform includes the upper right sample point or the lower left sample point of the coding block, the horizontal direction transform type and the vertical direction transform type may be set differently. In the example, Fig.47 The example shown in shows that when the subblock as the target of transformation includes the upper right sample point of the coding block, the horizontal direction transform type is set to DST7, and the vertical direction transform type is set to DCT8. When the subblock as the target of transformation includes the lower left sample point of the coding block, the horizontal direction transform type is set to DCT8, and the vertical direction transform type is set to DST7.
[0700] and Fig.47 Unlike the example shown in , when a sub-block including an upper left sample point or a sub-block including a lower right sample point in the coding block is determined as a transform target, the horizontal transform type and the vertical transform type may be set differently, and when a sub-block including an upper right sample point or a sub-block including a lower left sample point in the coding block is determined as a transform target, the horizontal transform type and the vertical transform type may be set to be the same.
[0701] Fig.47 It is shown that a sub-block whose height and width are 1 / 2 of the coding block is set as a transformation target. Unlike the example shown, a sub-block whose width is the same as the coding block but whose height is 1 / 4 of the coding block or a sub-block whose height is the same as the coding block but whose width is 1 / 4 of the coding block may be set as a transformation target.
[0702] exist Fig.48 In the example shown in , when the subblock as the target of transformation includes the upper left sample point of the coding block, the horizontal direction transformation type and the vertical direction transformation type can be set differently. Fig.48 In the example shown in , when binary tree partitioning in the horizontal direction is applied and the upper subblock is determined as the transform target, the horizontal direction transform type may be set to DST7, and the vertical direction transform type may be set to DCT7. When binary tree partitioning in the vertical direction is applied and the left subblock is determined as the transform target, the horizontal direction transform type may be set to DCT8, and the vertical direction transform type may be set to DST7.
[0703] and Fig.48 Different from the example shown in , when the sub-block as the target of the transform includes the upper left sample point of the coding block, the horizontal direction transform type and the vertical direction transform type may be set to the same, and when the sub-block as the target of the transform includes the lower right sample point of the coding block, the horizontal direction transform type and the vertical direction transform type may be set differently.
[0704] When the subblock as the target of the transform includes the lower right sample of the coding block, the horizontal transform type and the vertical transform type may be set to be the same. Fig.48 In the example shown in , when the binary tree partitioning in the horizontal direction is applied and the lower sub-block is determined as the transform target, the horizontal transform type and the vertical transform type may be set to DST7. When the binary tree partitioning in the vertical direction is applied and the right sub-block is determined as the transform target, the horizontal transform type and the vertical transform type may be set to DST7.
[0705] As in the above example, whether the horizontal transform type and the vertical transform type are set to be the same may be determined according to the position of the subblock as the target of the transform in the coding block. In addition, the horizontal transform type and the vertical transform type may be determined according to the position of the subblock as the target of the transform in the coding block.
[0706] For a sub-block, encoding of information indicating whether there is a non-zero coefficient (e.g., CBF) may be omitted. When encoding of the CBF is omitted, whether a non-zero residual coefficient is included in each sub-block may be determined based on the position of the block on which the transform is performed. In an example, when a sub-block at a right or lower position in a coding block to which binary tree partitioning is applied is determined as a transform target, a CBF value for a sub-block at a left or upper position may be inferred to be 0, and a CBF value for a sub-block at a right or lower position may be inferred to be 1. Alternatively, when a sub-block at a left or lower position in a coding block to which binary tree partitioning is applied is determined as a transform target, a CBF value for a sub-block at a left or upper position may be inferred to be 1, and a CBF value for a sub-block at a right or lower position may be inferred to be 0.
[0707] The secondary transform may be performed on the block to which the primary transform is performed. The secondary transform may be performed on the upper left sub-region in the transform block to which the primary transform has been applied.
[0708] If residual coefficients on which primary and secondary transforms have been performed are encoded, the decoding apparatus may perform secondary inverse transform as an inverse process of secondary transform on a transform block, and perform primary inverse transform as an inverse process of primary transform on a transform block on which secondary inverse transform has been performed.
[0709] Whether the secondary transform is applied to the current block may be determined based on at least one of the size of the current block, the number of residual coefficients, a coding mode or an intra prediction mode, or whether a subpartition intra encoding method is applied to the current block.
[0710] In an example, when at least one of the width or height of the current block is less than a threshold, the secondary transform may not be performed. In this case, the threshold may be a natural number such as 4, 8, or 16.
[0711] Alternatively, when the number of residual coefficients included in the current block is equal to or less than a threshold, the secondary transform may not be performed on the current block. In an example, when the current block includes only a single residual coefficient of a DC component, the secondary transform may not be performed.
[0712] Optionally, when the current block is encoded by inter-frame prediction, it may be set not to apply secondary transform.
[0713] Alternatively, although the current block is encoded by intra prediction, when matrix-based intra prediction is performed, it may be set so that secondary transform is not applied.
[0714] Information indicating whether the secondary transform is applied may be signaled in a bitstream. In an example, the information may be one of a flag indicating whether the secondary transform is applied or index information specifying an inseparable transform matrix used in the secondary transform. When the value of the flag or index signaled in the bitstream is 0, this indicates that the secondary transform is not applied. When the value of the flag or index is equal to or greater than 1, this indicates that the secondary transform is applied.
[0715] Alternatively, whether to encode the syntax indicating whether the secondary transform is applied may be determined by using the above-listed parameters related to the current block for determining whether the secondary transform is applied.
[0716] In an example, when at least one of the size of the current block, the number of residual coefficients, the coding mode or the intra prediction mode, or whether the sub-partition intra coding method is applied does not satisfy a preset condition, the encoding of the syntax indicating whether the secondary transform is applied may be omitted. When the encoding of the syntax is omitted, the secondary transform may not be applied.
[0717] Based on the above description, a method of performing secondary transform in an encoding device and a decoding device will be described in detail.
[0718] A secondary transformation may be performed on the upper left sub-region in the current block. The sub-region may have a predefined size or a predefined shape. The sub-region on which the secondary transformation is performed may have a square block shape such as 4×4 or 8×8 or a non-square block shape such as 4×8 or 8×4.
[0719] Alternatively, when the current block is evenly partitioned into N regions, at least one of the N regions may be set as a sub-region. In this case, N may be a natural number such as 2, 4, 8, or 16. The variable N may be predefined in the encoding device and the decoding device. Alternatively, the variable N may be determined based on the size and / or shape of the current block.
[0720] Alternatively, the sub-region may be determined based on the number of transform coefficients. In an example, a predetermined number of transform coefficients may be determined as a sub-region according to a predetermined scanning order.
[0721] Alternatively, information for specifying the size and / or shape of the sub-region may be encoded and transmitted in a bitstream. The information may include at least one of information indicating the size of the sub-region or information indicating the number of 4×4 blocks included in the sub-region.
[0722] Alternatively, the entire current block may be set as the sub-region. In an example, when the size of the current block is the same as the minimum size of the sub-region (eg, 4×4), the entire current block may be set as a target for secondary transform.
[0723] The secondary transform may be applied in a non-separable form. Therefore, the secondary transform may also be referred to as a non-separable secondary transform (NSST).
[0724] Transform coefficients in a sub-region to which a secondary transform is applied may be arranged in a single column. In an example, when a secondary transform is performed on a sub-region of an N×N size, the transform coefficients included in the sub-region may be converted into N 2 ×1 size input matrix. When a 4×4 size block is set as a sub-region, the transform coefficients included in the sub-region may be converted into a 16×1 size input matrix. When an 8×8 size block is set as a sub-region, the transform coefficients included in the sub-region may be converted into a 64×1 size input matrix.
[0725] The non-separable transform matrix may be applied to an input matrix generated by arranging transform coefficients included in the sub-region into one line. The size of the non-separable transform matrix may be differently determined according to the size of the input matrix.
[0726] In the example, when the input matrix size is N 2 ×1, based on N 2 ×N 2 For example, when the size of the input matrix is 16×1, a 16×16 sized non-separable transformation matrix may be used, and when the size of the input matrix is 64×1, a 64×64 sized non-separable transformation matrix may be used.
[0727] The plurality of non-separable transform matrices may be stored in the encoding apparatus and the decoding apparatus. Information for specifying any one of the plurality of non-separable transform matrices may be signaled in a bitstream.
[0728] Alternatively, the non-separable transform matrix may be specified based on at least one of a size, a shape, a quantization parameter, an intra prediction mode, or a transform type of the current block used in the first transform.
[0729] Alternatively, a non-separable transform matrix candidate that can be used by the current block may be specified based on at least one of a size, a shape, a quantization parameter, an intra prediction mode, or a transform type of the current block used in the first transform. When there are a plurality of non-separable transform matrix candidates that can be used by the current block, information indicating one of the plurality of non-separable transform matrix candidates may be encoded and signaled.
[0730] The transformation matrix may be obtained by multiplying the non-separable transformation matrix with the input matrix. In an example, Equation 14 shows an example ...
Claims
1. A method for decoding a video, the method comprising: Derive the residual coefficients of the current block; Dequantizing the residual coefficients; deriving joint residual samples by performing an inverse transform on the inverse quantized residual coefficients; Determine a residual sample decoding mode candidate from a plurality of residual sample decoding mode candidates as a residual sample decoding mode for a current block; as well as deriving a first residual sample for the first chrominance component and a second residual sample for the second chrominance component based on the joint residual sample, wherein when a first residual sample decoding mode is selected from the plurality of residual sample decoding mode candidates, a first residual sample is derived based on a first derivation method, wherein when a second residual sample decoding mode is selected from the plurality of residual sample decoding mode candidates, the first residual sample is derived based on a second derivation method, wherein the first derivation method is different from the second derivation method, When the first residual sample decoding mode is selected, the first residual sample is derived to be the same as the joint residual sample, When the second residual sample decoding mode is selected, the first residual sample is derived to have an opposite sign to the joint residual sample, or the first residual sample is derived by scaling the joint residual sample.
2. The method of claim 1, wherein one of the first residual sample or the second residual sample has the same sign as the joint residual sample, and the other has an opposite sign to the joint residual sample.
3. The method of claim 1, wherein when the second residual sample decoding mode is selected, the absolute value of the first residual sample is derived by scaling the joint residual sample.
4. The method of claim 1, wherein the first residual sample decoding mode or the second residual sample decoding mode is selected based on information parsed from the bitstream.
5. The method of claim 1, wherein the first chrominance component represents one of a Cb component or a Cr component, and wherein the second chrominance component represents the other of the Cb component or the Cr component.
6. The method of claim 1, wherein the first chrominance component represents one of a U component or a V component, and wherein the second chrominance component represents the other of the U component or the V component.
7. A system comprising: one or more processors; as well as One or more non-transitory computer-readable media storing instructions that, when executed by the one or more processors, cause the one or more processors to perform operations comprising: Derive the residual coefficients of the current block; Dequantizing the residual coefficients; deriving joint residual samples by performing an inverse transform on the inverse quantized residual coefficients; Determine a residual sample decoding mode candidate from a plurality of residual sample decoding mode candidates as a residual sample decoding mode for a current block; and deriving a first residual sample for the first chrominance component and a second residual sample for the second chrominance component based on the joint residual sample, wherein when a first residual sample decoding mode is selected from the plurality of residual sample decoding mode candidates, a first residual sample is derived based on a first derivation method, wherein when a second residual sample decoding mode is selected from the plurality of residual sample decoding mode candidates, the first residual sample is derived based on a second derivation method, wherein the first derivation method is different from the second derivation method, When the first residual sample decoding mode is selected, the first residual sample is derived to be the same as the joint residual sample, When the second residual sample decoding mode is selected, the first residual sample is derived to have an opposite sign to the joint residual sample, or the first residual sample is derived by scaling the joint residual sample.
8. The system of claim 7, wherein one of the first residual sample or the second residual sample has the same sign as the joint residual sample and the other has an opposite sign than the joint residual sample.
9. The system of claim 7, wherein when the second residual sample decoding mode is selected, the absolute value of the first residual sample is derived by scaling the joint residual sample.
10. The system of claim 7, wherein the first residual sample decoding mode or the second residual sample decoding mode is selected based on information parsed from the bitstream.
11. The system of claim 7, wherein the first chrominance component represents one of a Cb component or a Cr component, and wherein the second chrominance component represents the other of the Cb component or the Cr component.
12. The system of claim 7, wherein the first chrominance component represents one of a U component or a V component, and wherein the second chrominance component represents the other of the U component or the V component.
13. One or more non-transitory computer-readable media storing instructions that, when executed by one or more processors, cause the one or more processors to perform operations comprising: Derive the residual coefficients of the current block; Dequantizing the residual coefficients; deriving joint residual samples by performing an inverse transform on the inverse quantized residual coefficients; Determine a residual sample decoding mode candidate from a plurality of residual sample decoding mode candidates as a residual sample decoding mode for a current block; as well as deriving a first residual sample for the first chrominance component and a second residual sample for the second chrominance component based on the joint residual sample, wherein when a first residual sample decoding mode is selected from the plurality of residual sample decoding mode candidates, a first residual sample is derived based on a first derivation method, wherein when a second residual sample decoding mode is selected from the plurality of residual sample decoding mode candidates, the first residual sample is derived based on a second derivation method, wherein the first derivation method is different from the second derivation method, When the first residual sample decoding mode is selected, the first residual sample is derived to be the same as the joint residual sample, When the second residual sample decoding mode is selected, the first residual sample is derived to have an opposite sign to the joint residual sample, or the first residual sample is derived by scaling the joint residual sample.
14. The one or more non-transitory computer-readable media of claim 13, wherein one of the first residual sample or the second residual sample has the same sign as the joint residual sample and the other has an opposite sign than the joint residual sample.
15. The one or more non-transitory computer-readable media of claim 13, wherein when the second residual sample decoding mode is selected, the absolute value of the first residual sample is derived by scaling the joint residual sample.
16. The one or more non-transitory computer-readable media of claim 13, wherein the first residual sample decoding mode or the second residual sample decoding mode is selected based on information parsed from a bitstream.
17. The one or more non-transitory computer-readable media of claim 13, wherein the first chrominance component represents one of a Cb component or a Cr component, and wherein the second chrominance component represents the other of the Cb component or the Cr component.
18. The one or more non-transitory computer-readable media of claim 13, wherein the first chrominance component represents one of a U component or a V component, and wherein the second chrominance component represents the other of the U component or the V component.
