Video signal encoding / decoding method and apparatus therefor
By dividing the video encoding block into multiple sub-blocks and performing intra prediction, and adaptively partitioning and transformation processing according to the size of the block, the problems of large data volume and low compression rate in high-definition video services are solved, and the encoding of video signals is improved Decoding efficiency.
Patent Information
- Application Number
- CN202411856932.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2019-01-28
- Filing Date
- 2020-01-28
- Publication Date
- 2025-02-11
AI Technical Summary
The existing video encoding technology faces the problems of large data volume and low compression rate in high-definition video services, and the performance of HEVC is gradually showing limitations.
The video signal is encoded/decoded by dividing the encoded block into a plurality of sub-blocks and performing intra prediction based on the sub-blocks. In addition, the coded blocks are adaptively divided according to the size or shape of the current block, and transforms are performed on at least one of the plurality of sub-blocks.
It improves the intra prediction efficiency, enhances the efficiency of video signal encoding/decoding, and adapts to the needs of high-definition video services.
Smart Images

Figure CN119420912A_ABST
Abstract
Description
[0001] This application is a divisional application of the Chinese invention patent application whose international application date is January 28, 2020, the national application number is 202080004289.8, and the invention name is “Video signal encoding / decoding method and device thereof”, which has entered the Chinese national phase. 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 the greatly increased amount of data. In order to solve the above problems, research on improving video compression rates is being actively conducted. As a representative example, the Joint Task Force 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 Standardization Division (ITU-T). JCT-VC proposed a video compression standard: High Efficiency Video Coding (HEVC), which has a compression performance approximately twice that of H.264 / AVC, and was approved as a standard on January 25, 2013. However, with the rapid development of high-definition video services, the performance of HEVC has gradually shown its limitations. Summary of the invention
[0004] Technical Purpose
[0005] An object of the present disclosure is to provide a method for encoding / decoding a video signal by dividing a coding block into a plurality of sub-blocks and then performing intra prediction based on the sub-blocks, and an apparatus for performing the method.
[0006] The present disclosure aims to provide a method for dividing a video coding block into a plurality of sub-blocks and a device for performing the method, which is used to adaptively divide the coding block based on the size or shape of a current block.
[0007] An object of the present disclosure is to provide a method of encoding / decoding a video signal for dividing a coding block into a plurality of prediction units and performing inter-frame prediction on each prediction unit, and an apparatus for performing the method.
[0008] An object of the present disclosure is to provide a method of encoding / decoding a video signal for obtaining motion information of a plurality of prediction units included in one coding block from different merging candidates and an apparatus for performing the method.
[0009] An object of the present disclosure is to provide a method for encoding / decoding a video signal by dividing a coding block into a plurality of sub-blocks and then performing transformation on at least one of the plurality of sub-blocks, and an apparatus for performing the method.
[0010] 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 from the following description by a person of ordinary skill in the technical field to which the present disclosure belongs.
[0011] Technical Solution
[0012] An aspect of the present invention provides a method for decoding video data, the method comprising: determining whether to partition a current block into a plurality of sub-blocks; determining an intra-prediction mode for the current block; and when the current block is partitioned into the plurality of sub-blocks, performing intra-prediction on each of the plurality of sub-blocks based on the intra-prediction mode, wherein whether to partition the current block into the plurality of sub-blocks is determined based on a flag, wherein when the size of the current block is less than a threshold, parsing of the flag from a bitstream is omitted, wherein when parsing of the flag is omitted, the flag is considered to indicate that the current block is not partitioned into the plurality of sub-blocks.
[0013] An aspect of the present invention provides a method for encoding video data, the method comprising: determining whether to partition a current block into a plurality of sub-blocks; determining an intra-prediction mode for the current block; and when the current block is partitioned into the plurality of sub-blocks, performing intra-prediction on each of the plurality of sub-blocks based on the intra-prediction mode, wherein, based on whether the size of the current block is less than a threshold, determining whether to encode a flag indicating whether the current block is partitioned into the plurality of sub-blocks into a bitstream, wherein, when the size of the current block is less than the threshold, encoding of the flag is omitted, and thus determining not to partition the current block into the plurality of sub-blocks.
[0014] In an implementation of the first aspect, the method further includes: determining a reference sample line of the current block, wherein when an index of the determined reference sample line is greater than a threshold, parsing the flag from the bitstream is omitted.
[0015] In an implementation of the first aspect, the number of sub-blocks included in the current block is determined based on at least one of a size or a shape of the current block.
[0016] In one embodiment of the first aspect, the method also includes performing a first inverse transform on the current block, wherein the first inverse transform is performed based on a transform core candidate among at least one transform core candidate, wherein the number of transform core candidates varies depending on whether the current block has been partitioned into the multiple sub-blocks.
[0017] In an implementation of the first aspect, the method further includes performing a second inverse transform on the current block, wherein when performing the second inverse transform, the transform kernel is set to DCT2.
[0018] In an implementation of the first aspect, a transform coefficient of a region in the current block on which the second inverse transform is not performed is 0.
[0019] In an implementation of the first aspect, whether to perform the second inverse transform is determined based on a position of a last transform coefficient in the current block.
[0020] It should be understood that the foregoing summarized features are exemplary aspects of the following detailed description of the present disclosure and do not limit the scope of the present disclosure.
[0021] Technical Effects
[0022] According to the present disclosure, dividing a coding block into a plurality of sub-blocks and then performing intra prediction based on the sub-blocks may improve intra prediction efficiency.
[0023] According to the present disclosure, during intra-frame prediction, the coding block is adaptively divided based on the size or shape of the current block so that the efficiency of intra-frame prediction can be improved.
[0024] According to the present disclosure, dividing a coding block into a plurality of prediction units and then performing inter-frame prediction on each prediction unit may improve inter-frame prediction efficiency.
[0025] According to the present disclosure, when encoding / decoding a video signal, obtaining motion information of a plurality of prediction units included in one coding block from different merge candidates may allow inter-frame prediction efficiency to be improved.
[0026] According to the present disclosure, dividing a coding block into a plurality of sub-blocks and then performing transformation on at least one of the plurality of sub-blocks may improve encoding / decoding efficiency.
[0027] 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 belongs. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a diagram illustrating a block diagram of a video encoding device (encoder) according to an embodiment of the present disclosure.
[0029] Figure 2 is a diagram showing a block diagram of a video decoding device (decoder) according to an embodiment of the present disclosure.
[0030] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present disclosure.
[0031] Figure 4 is a diagram illustrating various partition types of a coding block.
[0032] Figure 5 is a diagram illustrating an example of one aspect of partitioning a CTU.
[0033] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present disclosure.
[0034] Figure 7 is a flow chart of the process of deriving current block motion information in merge mode.
[0035] Figure 8 is a diagram illustrating candidate blocks for deriving merge candidates.
[0036] Fig. 9 is a diagram for describing an example of determining a motion vector for each subblock.
[0037] Fig.10 is a diagram for describing the updating aspect of the motion information table.
[0038] Fig.11 is a diagram illustrating an updating aspect of a motion information table.
[0039] Fig.12 is a diagram illustrating an example of updating an index of a pre-saved motion information candidate.
[0040] Fig.13 is a diagram showing the positions of representative sub-blocks.
[0041] Fig.14 An example of generating a motion information table for each inter prediction mode is presented.
[0042] Fig.15 is a diagram illustrating an example in which a redundancy check is performed only on a part of merge candidates.
[0043] Fig.16 is a diagram illustrating an example of omitting a redundant check with a specific merge candidate.
[0044] Fig.17 is a diagram illustrating an example of splitting a coding block into a plurality of prediction units using diagonal lines.
[0045] Fig.18 is a diagram illustrating an example of splitting a coding block into two prediction units.
[0046] Fig.19 An example of dividing a coding block into a plurality of prediction blocks of different sizes is shown.
[0047] Fig. 20is a diagram illustrating neighboring blocks used to derive partition mode merge candidates.
[0048] Fig.21 is a diagram for describing an example of determining availability of neighboring blocks for each prediction unit.
[0049] Fig. 22 and Fig.23 is a diagram illustrating an example of deriving a prediction sample based on a weighted sum of a first prediction sample and a second prediction sample.
[0050] Fig.24 is a flowchart of an intra-frame prediction method according to an embodiment of the present disclosure.
[0051] Fig.25 is a diagram showing an intra prediction mode.
[0052] Fig.26 and Fig. 27 is a diagram showing an example of a one-dimensional array in which reference samples are arranged in rows.
[0053] Fig.28 is a diagram showing an angle formed by a directional intra prediction mode and a straight line parallel to the x-axis.
[0054] Fig.29 is a diagram illustrating an aspect of obtaining prediction samples when a current block is in a non-square shape.
[0055] Fig.30 is a diagram illustrating a wide-angle intra prediction mode.
[0056] Fig.31 is a diagram showing an example of vertical partitioning and horizontal partitioning.
[0057] Fig.32 is a diagram illustrating an example of determining a partition type of a coding block.
[0058] Fig.33 is a diagram illustrating an example of determining a partition type of a coding block.
[0059] Fig.34 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.
[0060] Fig.35 Diagram used to describe partitioning of coding blocks.
[0061] Fig.36 is a diagram showing an example of differently setting a prediction encoding mode for each subblock.
[0062] Fig.37 is a diagram illustrating application aspects of PDPC.
[0063] Fig.38 and Fig.39 is a diagram showing a sub-block to be subjected to a second transform.
[0064] Fig.40 is a diagram for describing an example of determining a transform type of a current block.
[0065] Fig.41 is a diagram illustrating an example of determining a transform type of a subblock.
[0066] Fig.42 is a diagram for describing an example of setting a residual coefficient of a subblock to 0.
[0067] Fig.43 An example of specifying the position of a sub-block where transformation and / or quantization is performed based on information transmitted by signaling in a bitstream is shown. DETAILED DESCRIPTION
[0068] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
[0069] Image encoding and decoding are performed on a block basis. In an example, encoding / decoding processes such as transform, quantization, prediction, in-loop filtering, reconstruction, etc. may be performed on a coding block, a transform block, or a prediction block.
[0070] 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 encoding / decoding process.
[0071] 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 the example, the coding block and the coding unit can be understood to have the same meaning as each other in the examples described later.
[0072] Figure 1 is a diagram showing a block diagram of an image encoding device (encoder) according to an embodiment of the present disclosure.
[0073] Reference Figure 1 , the image encoding device 100 may include a picture partition unit 110, a prediction unit 120 and a prediction unit 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.
[0074] Figure 1The 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 mean that each component is composed of separate hardware or a software unit. That is, each component is listed only for the convenience of explanation, at least two of the components may constitute one component, or one component may be partitioned into multiple components that can perform their 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.
[0075] In addition, some components are not essential components for performing the essential functions of the present disclosure, but are optional components only for improving performance. The present disclosure may be implemented using essential components for implementing the spirit of the present disclosure other than components only for improving performance, and a structure including only essential components other than optional components only for improving performance is also included in the scope of the present disclosure.
[0076] The picture partition unit 110 may partition the input picture into at least one processing unit. In this regard, the 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 plurality of combinations 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).
[0077] 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.
[0078] 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.
[0079] 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.
[0080] 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.
[0081] The prediction unit 120 and the prediction unit 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 prediction unit on 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 the prediction unit 125 and is sent to the decoding unit.
[0082] 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 encoded 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.
[0083] The reference picture interpolation unit may receive reference picture information from the memory 155, and may generate pixel information of integer pixels or smaller pixels from the reference picture. In the case of luma pixels, an 8-tap interpolation filter based on DCT with different coefficients may be applied so as to generate pixel information about integer pixels or smaller pixels in units of 1 / 4 pixels. In the case of chroma signals, a 4-tap interpolation filter based on DCT with different filter coefficients may be applied so as to generate pixel information about integer pixels or smaller pixels in units of 1 / 8 pixels.
[0084] The motion prediction unit may perform motion prediction based on the reference picture interpolated by the reference picture interpolation unit. Various methods such as a full search based matching algorithm (FBMA), a three-step search (TSS) algorithm, a new three-step search (NTS) algorithm, etc. may be used as a method for calculating a motion vector. The motion vector may have a motion vector value in units of 1 / 2 pixel or 1 / 4 pixel based on the interpolated pixel. The motion prediction unit may predict the current prediction unit by changing the motion prediction method. Various methods such as a skip method, a merge method, an advanced motion vector prediction (AMVP) method, an intra-block copy method, etc. may be used as a motion prediction method.
[0085] The intra prediction unit 125 may generate a prediction unit based on information of reference pixels around the current block as pixel information in the current picture. When the neighboring block of the current prediction unit is a block on which inter prediction is performed, and thus the reference pixel is a pixel on which inter prediction is performed, the reference pixel included in the block on which inter prediction is performed may be replaced with information about the reference pixel 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 applied to replace the unavailable reference pixel information.
[0086] The prediction mode under the intra prediction may include a directional prediction mode that uses reference pixel information according to a prediction direction when performing prediction, 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.
[0087] When performing intra prediction, when the size of the prediction unit is the same as the size of the transformation unit, intra prediction may be performed on the prediction unit based on pixels located to the left, above the left, and at the top of the prediction unit. However, when performing intra prediction, when the size of the prediction unit is different from the size of the transformation unit, intra prediction may be performed using reference pixels based on the transformation unit. In addition, intra prediction using N×N partitions may be used only for the smallest coding unit.
[0088] 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 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, predetermined flag information may be used to send information indicating that the current prediction unit has the same prediction mode as the neighboring prediction unit. 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.
[0089] In addition, 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 the prediction unit 125 and an original block of the prediction unit may be generated. The generated residual block may be input to the transform unit 130.
[0090] The transform unit 130 may perform a transform on the residual block 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 the original block and the prediction unit generated by the prediction unit 120 or the prediction unit 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 in a 4:4:4 format, or a residual block of a chrominance component.
[0091] 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 or block of the image. The value calculated in the quantization unit 135 may be provided to the inverse quantization unit 140 and the rearrangement unit 160.
[0092] The rearrangement unit 160 may perform rearrangement on the transform coefficients with respect to the quantized residual values.
[0093] The rearrangement unit 160 may convert the coefficients in the two-dimensional block form into 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 using a zigzag scanning method so as to convert the coefficients into the one-dimensional vector form. Depending on the size of the transform unit and the intra-frame prediction mode, vertical direction scanning for scanning the coefficients in the two-dimensional block form along the column direction or horizontal direction scanning for scanning the coefficients in the two-dimensional block form along the row direction may be used instead of the zigzag scanning. In other words, which scanning method to use among the zigzag scanning, the vertical direction scanning, and the horizontal direction scanning may be determined according to the size of the transform unit and the intra-frame prediction mode.
[0094] 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).
[0095] The entropy encoding unit 165 may encode various types of information obtained from the rearrangement unit 160 and the prediction units 120 and 125 (such as information about residual value coefficients and information about block types of coding units, information about prediction modes, information about partition units, information about prediction units, information about partition units, information about prediction units and information about transformation units, information about motion vectors, information about reference frames, information about block interpolation, filtering information, and the like).
[0096] The entropy encoding unit 165 may entropy encode coefficients of the coding unit input from the rearrangement unit 160 .
[0097] 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 so as to generate a reconstructed block.
[0098] The filter unit 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).
[0099] 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 rows or 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 performing horizontal direction filtering and vertical direction filtering, the horizontal direction filtering and the vertical direction filtering can be configured to be processed in parallel.
[0100] The offset correction unit can correct the original image with an offset 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 the 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.
[0101] 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 group 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) for a luminance signal, and the shape and filter coefficients 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.
[0102] In the memory 155, a reconstructed block or a reconstructed picture calculated by the filter unit 150 may be stored. When inter prediction is performed, the stored reconstructed block or the reconstructed picture may be provided to the prediction unit 120 or the prediction unit 125.
[0103] Figure 2 is a diagram showing a block diagram of an image decoding device (decoder) according to an embodiment of the present disclosure.
[0104] Reference Figure 2 , the image decoding device 200 may include an entropy decoding unit 210, a rearrangement unit 215, an inverse quantization unit 220, an inverse transform unit 225, a prediction unit 230 and a prediction unit 235, a filter unit 240, and a memory 245.
[0105] 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.
[0106] The entropy decoding unit 210 may perform entropy decoding according to an inverse process of entropy encoding performed by the entropy encoding unit of the image encoder. For example, various methods such as exponential Golomb coding, context adaptive variable length coding (CAVLC), or context adaptive binary arithmetic coding (CABAC) may be applied in association with the method performed by the image encoder device.
[0107] The entropy decoding unit 210 may decode information about intra prediction and inter prediction performed by the encoder.
[0108] The rearrangement unit 215 may perform rearrangement on the bit stream entropy-decoded by the entropy decoding unit 210 based on the rearrangement method used in the encoder. Coefficients represented in a one-dimensional vector form may be reconstructed and rearranged into coefficients in a two-dimensional block form. 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.
[0109] 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.
[0110] The inverse transform unit 225 may perform an inverse transform (i.e., inverse DCT or inverse DST) for 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.).
[0111] The prediction unit 230 or the prediction unit 235 may generate a prediction block based on the information related to the prediction block received from the entropy decoding unit 210 and the information about the previously decoded block or picture received from the memory 245 .
[0112] As described above, like the operation of the image encoder, in the process of performing intra-frame prediction, when the size of the prediction unit is the same as the size of the transformation unit, intra-frame prediction can be performed on the prediction unit based on the pixels located on the left, upper left, and top of the prediction unit. However, in the process of performing intra-frame prediction, when the size of the prediction unit is different from the size of the transformation unit, intra-frame prediction can be performed using reference pixels based on the transformation unit. In addition, intra-frame prediction using N×N partitions can be used only for the minimum coding unit.
[0113] The prediction unit 230 and the prediction unit 235 may include a PU determination module, an inter prediction unit, and an intra prediction unit. The PU determination unit 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, may divide the prediction unit in the current coding unit, and may determine whether to perform inter prediction or intra prediction on the prediction unit. Using the information required for 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.
[0114] In order to perform inter prediction, which method of the skip mode, the merge mode, the AMVP mode, or the intra block copy mode is used as a motion prediction method for a prediction unit included in the coding unit may be determined based on the coding unit.
[0115] 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 that has been subjected to intra prediction, 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 filter the reference pixels of the current block, and may determine whether to apply the filter based on the prediction mode used for the current prediction unit. When AIS filtering is performed on the reference pixels of the current block, the prediction mode of the prediction unit received from the image encoder and information about the AIS filter may be applied. When the prediction mode for the current block is a mode to which AIS filtering is not applied, the AIS filter may not be applied.
[0116] When the prediction mode of the prediction unit is a prediction mode for performing intra prediction 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 integer units or smaller units. When the prediction mode for the current prediction unit is a prediction mode for generating a prediction block without interpolating reference pixels, the reference pixels may not be interpolated. When the prediction mode for the current block is a DC mode, the DC filter may generate a prediction block by filtering.
[0117] 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.
[0118] Information about whether a deblocking filter has been applied to a corresponding block or 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.
[0119] 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.
[0120] 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.
[0121] In the memory 245 , the reconstructed picture or the reconstructed block may be stored in order to be used as a reference picture or a reference block, and the reconstructed picture may be provided to the output unit.
[0122] Figure 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present disclosure.
[0123] 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 showing an example in which a single picture is partitioned into a plurality of CTUs.
[0124] 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.
[0125] In an example, the size of the CTU for the entire picture within the sequence may be set to 128×128. Alternatively, 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 a first picture, and may be set to have a size of 256×256 in a second picture.
[0126] A coding block can be generated by partitioning the CTU. A coding block represents a basic unit for performing encoding / decoding. In an example, prediction or transformation can be performed for each coding block, or a prediction coding mode can 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-frame prediction, inter-frame prediction, current picture reference (CPR), intra-frame block copy (IBC), or combined prediction. For a coding block, a prediction coding mode of at least one of intra-frame prediction, inter-frame prediction, current picture reference, or combined prediction can be used to generate a prediction block of the coding block.
[0127] Information indicating the prediction coding mode for the current block may be signaled in the 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.
[0128] The current picture reference is to set the current picture as the reference picture and obtain the prediction block of the current block from the area that has been encoded / decoded in the current picture. In this regard, the current picture represents the picture including the current block. Information indicating whether the current picture reference is applied to the current block can be transmitted by signal in the bitstream. In an example, the information can be a 1-bit flag. When the flag is true (TRUE), the prediction coding mode for the current block can be determined as the current picture reference, and when the flag is false (FALSE), the prediction coding mode for the current block can be determined as inter-frame prediction.
[0129] Alternatively, the prediction coding mode for 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 area that has been encoded / decoded within the current picture, and the inter-frame prediction is a prediction method using information about another picture that has been encoded / decoded.
[0130] Combined prediction refers to a combined coding mode that combines at least two of intra prediction, inter prediction, and current picture reference. In an example, when combined prediction is applied, a first prediction block may be generated based on one of intra prediction, inter prediction, or current picture reference, and a second prediction block may be generated based on another 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.
[0131] Figure 4 is a diagram illustrating various partition types of a coding block.
[0132] 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 into a plurality of coding blocks based on quadtree partitioning, binary tree partitioning, or ternary tree partitioning.
[0133] 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 (a) "SPLIT_QT").
[0134] 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 in a vertical direction (that is, using a vertical line passing through the current block) may be referred to as vertical binary tree partitioning, and an operation of partitioning a current block into two blocks in a horizontal direction (that is, using a horizontal line passing through the current block) may be referred to as 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" of (b) is a diagram showing the result of binary tree partitioning in the vertical direction. Figure 4 "SPLIT_BT_HOR" of (c) is a diagram showing the result of binary tree partitioning in the horizontal direction.
[0135] Ternary tree partitioning means a method of partitioning a current block into three blocks. The operation of partitioning a current block into three blocks along a vertical direction (that is, using two vertical lines passing through the current block) may be referred to as vertical ternary tree partitioning, and the operation of partitioning a current block into three blocks along a horizontal direction (that is, 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" of (d) is a diagram showing the result of ternary tree partitioning in the vertical direction, Figure 4 "SPLIT_TT_HOR" of (e) is a diagram showing the result of ternary tree partitioning in the horizontal direction.
[0136] 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. Therefore, the maximum partition depth of a CTU may vary based on a sequence or a picture.
[0137] 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.
[0138] The encoder may signal information indicating at least one of a partition type and a partition depth of the current block in a bitstream. The decoder may determine a partition type and a partition depth of the CTU based on the information obtained by parsing the bitstream.
[0139] Figure 5 is a diagram illustrating an example of one aspect of partitioning a CTU.
[0140] The operation of partitioning a coding block using quadtree partitioning, binary tree partitioning, and / or ternary tree partitioning may be referred to as multitree partitioning.
[0141] 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.
[0142] In contrast, for a coding block whose partition depth is k+1, the coding block whose partition depth is k may be referred to as a parent coding block.
[0143] 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 may include at least one of a top 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.
[0144] 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. The information may be 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.
[0145] When split_cu_flag is true, information indicating whether the coding block is partitioned by quadtree partitioning may be signaled in the bitstream. The information is a 1-bit flag split_qt_flag, and when the flag is true, the coding block may be partitioned into four blocks.
[0146] 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 among the four coding blocks generated by quadtree partitioning. As a result, four coding blocks with a partition depth of 2 can be generated.
[0147] 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.
[0148] When quadtree partitioning is not applied to a coding block, it may be determined whether binary tree partitioning or ternary tree partitioning is performed 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 transmitted by signal in the bitstream. The information may be a 1-bit flag mtt_split_cu_vertical_flag. Based on the flag, it may be determined whether the partition direction is vertical or horizontal. In addition, information indicating which of binary tree partitioning or ternary tree partitioning is applied to the coding block may be transmitted by signal in the bitstream. The information may be a 1-bit flag mtt_split_cu_binary_flag. Based on the flag, it may be determined whether binary tree partitioning is applied to the coding block or ternary tree partitioning is applied to the coding block.
[0149] 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 among the coding blocks generated by the vertical binary tree partitioning, and vertical binary tree partitioning is applied to a right coding block.
[0150] Inter prediction is a prediction coding mode that uses information about a previous picture to predict a current block. In an example, a block in the previous picture that is located at the same position as the current block (hereinafter referred to as a co-located block) may be set as a prediction block for 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.
[0151] In contrast, when an object existing in a previous picture has moved to another position in a current picture, the motion of the object can be used to effectively predict the current block. 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 based on the motion information of the object. Hereinafter, a prediction block generated using motion information may be referred to as a motion prediction block.
[0152] 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, using the motion prediction block instead of using the co-located prediction block may reduce the energy of the residual block and thus may improve the compression performance of the residual block.
[0153] As above, the operation of generating a prediction block 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.
[0154] 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 magnitude 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 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 applied 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.
[0155] Figure 6 is a flowchart of an inter-frame prediction method according to an embodiment of the present disclosure.
[0156] 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 (S601), and performing motion compensation prediction for the current block based on the obtained motion information (S603).
[0157] In this regard, the inter prediction mode may represent various methods for determining motion information of the current block, and may 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.
[0158] 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.
[0159] Figure 7 is a flow chart of a process for deriving motion information for a current block in merge mode.
[0160] A merge candidate of a 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.
[0161] Figure 8 is a diagram illustrating candidate blocks for deriving merge candidates.
[0162] 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.
[0163] 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.
[0164] The non-neighboring basic sample points represent samples whose x-axis distance or y-axis distance to the basic sample points adjacent to the current block is a predefined value. In an example, at least one of a block including a basic sample point whose x-axis distance to the left basic sample point is a predefined value, a block including a non-neighboring sample point whose y-axis distance to the top basic sample point is a predefined value, or a block including a non-neighboring sample point whose x-axis distance and y-axis distance to the top 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 indexed from 5 to 26 may be used as a candidate block.
[0165] 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.
[0166] The merge candidate may be derived from a temporally neighboring block included in a different picture 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 the co-located picture. Index information identifying the co-located picture in the reference picture may be signaled in the bitstream. Optionally, a reference picture having a predefined index in the reference picture may be determined as the co-located picture.
[0167] 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 as the motion information of the merge candidate.
[0168] A merge candidate list including merge candidates may be generated S702 .
[0169] 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 a top 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.
[0170] When multiple merge candidates are included in the merge candidate list, at least one of the multiple merge candidates may be selected S703. Specifically, information for specifying one of the multiple merge candidates may be transmitted by signal in the bitstream. In an example, information merge_idx indicating an index of one of the merge candidates included in the merge candidate list may be transmitted by signal in the bitstream.
[0171] A motion vector may be derived for each sub-block.
[0172] Fig. 9 is a diagram for describing an example of determining a motion vector for each subblock.
[0173] Any motion vector of the multiple merge candidates included in the merge candidate list may be set as the initial motion vector of the current block. In this regard, the merge candidate used to derive the initial motion vector may be determined by the syntax merge_idx. Alternatively, when searching for neighboring blocks adjacent to the current block in a predetermined scanning order, the initial motion vector may be derived from the available merge candidate that is found first. In this regard, the predetermined scanning order may be the order of the neighboring block (A1) adjacent to the left side of the current block, the neighboring block (B1) adjacent to the top of the current block, the neighboring block (B0) adjacent to the upper right corner of the current block, and the neighboring block (A0) adjacent to the lower left corner of the current block. Alternatively, the predetermined scanning order may be defined in the order of B1, B0, A1, and A0 or may be determined in the order of B1, A1, B0, and A0.
[0174] When the initial motion vector is determined, the co-located picture of the current block may be determined. In this regard, the co-located picture may be set to a reference picture with a predefined index among the reference pictures included in the reference picture list. For example, the predefined index may be 0 or a maximum index. Optionally, information for determining the co-located picture may be signaled in the bitstream. In an example, a syntax collocated_ref_idx specifying the co-located picture in the reference picture list may be signaled in the bitstream.
[0175] When the co-located picture is determined, a block in the co-located picture that is separated from the co-located block having the same position and size as the current block by the initial motion vector may be determined. The block specified by the initial motion vector may be referred to as a co-located picture corresponding block. In an example, when the initial motion vector (for Fig. 9 , when the motion vector of block A1 is (x1, y1), the block in the co-located picture that is at a distance of (x1, y1) from the block at the same position as the current block (ie, the co-located block) can be determined as the corresponding block of the co-located picture.
[0176] When the co-located picture corresponding block is determined, the motion vector of the sub-block in the co-located picture corresponding block may be set as the motion vector of the sub-block in the current block. In an example, when the current block is partitioned into 4×4-sized sub-blocks, the motion vector of the 4×4-sized sub-block in the co-located picture corresponding block may be set as the motion vector of each sub-block in the current block.
[0177] When a subblock in a corresponding block of a co-located picture has a bidirectional motion vector (e.g., an L0 motion vector and an L1 motion vector), the bidirectional motion vector of the subblock in the corresponding block of the co-located picture may be considered as the bidirectional motion vector of the subblock in the current block. Alternatively, based on whether bidirectional prediction is applied to the current block, only the L0 motion vector or only the L1 motion vector may be obtained from the subblock in the corresponding block of the co-located picture.
[0178] Optionally, when the reference picture of the current block is different from the reference picture of the corresponding block in the same picture, the motion vector of the subblock in the corresponding block in the same picture may be scaled to derive the motion vector of the subblock in the current block.
[0179] The reference picture of the current block and whether bidirectional prediction is applied to the current block may be set to be the same as the merge candidate used to derive the initial motion vector. Optionally, information for specifying the reference picture of the current block and / or information indicating whether bidirectional prediction is applied to the current block may be transmitted by signal in the bitstream.
[0180] Information indicating whether a motion vector is to be derived for each sub-block may be signaled in the bitstream. The information may be a 1-bit flag, but is not limited thereto. Optionally, based on whether bidirectional prediction is applied to the current block or at least one of the multiple available merge candidates, it may be determined whether a motion vector is to be derived for each sub-block.
[0181] 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 obtained by subtracting an offset from the maximum number of merge candidates. The offset may be a natural number such as 1 or 2.
[0182] The motion information table includes motion information candidates derived from blocks encoded / decoded based on inter-frame prediction in the current picture. In an example, the motion information of the motion information candidates included in the motion information table may be set to be the same as the motion information of the blocks 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.
[0183] The motion information candidates included in the motion information table may also be referred to as inter-region merge candidates or prediction region merge candidates.
[0184] The maximum number of motion information candidates that can be included in the motion information table may 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 may be 1, 2, 3, 4, 5, 6, 7, 8 or more (e.g., 16).
[0185] Optionally, information indicating a maximum number of motion information candidates that can be included in a motion information table may be signaled in a bitstream. The information may be signaled at a sequence, picture, or slice level. The information may indicate the maximum number of motion information candidates that can be included in the motion information table. Optionally, the information may indicate a difference between the maximum number of motion information candidates that can be included in the motion information table and the maximum number of merge candidates that can be included in the merge candidate list.
[0186] 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.
[0187] The motion information table may be initialized in units of pictures, slices, tiles, partitions, coding tree units, or coding tree unit lines (rows or columns). In an example, when a slice is initialized, the motion information table is also initialized, and thus the motion information table may not include any motion information candidates.
[0188] 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, tile, partition or block level. Before the information indicates initialization of the motion information table, a pre-configured motion information table may be used.
[0189] 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 applied to a block that is the first encoding / decoding target in the slice.
[0190] 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 having 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.
[0191] The blocks are encoded / decoded in the order of encoding / decoding, and the blocks encoded / decoded based on the inter prediction may be sequentially set as motion information candidates in the order of encoding / decoding.
[0192] Fig.10 is a diagram for describing the updating aspect of the motion information table.
[0193] When inter prediction is performed for a current block 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.
[0194] 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 .
[0195] 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 used 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 having an index exceeding or below a threshold among the pre-stored motion information candidates in the motion information table. Optionally, the redundancy check may be performed for a predefined number of motion information candidates. In an example, 2 motion information candidates having the smallest index or having the largest index may be determined as targets for the redundancy check.
[0196] 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 the motion information (e.g., motion vector / reference picture index, etc.) of the motion information candidates are the same.
[0197] In this regard, when the maximum number of motion information candidates are already 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 or minimum index.
[0198] The motion information candidates may be identified by respective indexes. When a motion information candidate derived from the current block is added to the motion information table, a minimum index (e.g., 0) may be assigned to the motion information candidate, and the index of the pre-stored motion information candidate may be increased by 1. In this regard, when the maximum number of motion information candidates is already stored in the motion information table, the motion information candidate having the largest index is removed.
[0199] 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 decreased by 1.
[0200] Fig.11 is a diagram illustrating an updating aspect of a motion information table.
[0201] 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.
[0202] 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 a maximum value (e.g., Fig.11 n) shown in .
[0203] 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 .
[0204] Optionally, while adding the 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 newly updated is produced.
[0205] Fig.12is a diagram illustrating an example of updating an index of a pre-stored motion information candidate.
[0206] 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.
[0207] And, the motion information candidate mvCand derived based on the current block may be added to the end of the motion information table.
[0208] 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.
[0209] 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 candidates 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 blocks included in the merge processing area is not defined, it is not appropriate to use the motion information of one of the blocks included in the merge processing area for inter-frame prediction of another block therein. Therefore, the motion information candidates derived based on the blocks included in the merge processing area may not be added to the motion information table.
[0210] 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.
[0211] When motion compensated prediction is performed on a per-subblock basis, a motion information candidate may be derived based on motion information of a representative subblock among a plurality of subblocks included in the current block. In an example, when a subblock merge candidate is used for the current block, a motion information candidate may be derived based on motion information of a representative subblock among the subblocks.
[0212] The motion vector of the sub-block may be derived in the following order. First, 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. And, a shifted sub-block whose base sample is located at the position (xColSb, yColSb) may be derived by adding the initial shift vector to the position (xSb, ySb) of the base sample (e.g., the upper left sample or the center sample) of each sub-block in the coding block. The following equation 1 shows a formula for deriving a shifted sub-block.
[0213] [Equation 1]
[0214] (xColSb, yColSb) = (xSb+shVector[0]>>4, ySb+shVector[1]>>4)
[0215] 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).
[0216] The representative sub-block may mean a sub-block including an upper left sample or a center sample of the current block.
[0217] Fig.13 is a diagram showing the positions of representative sub-blocks.
[0218] Fig.13 (a) presents an example of setting a sub-block located at the upper left of the current block as a representative sub-block, and Fig.13 (b) shows an example of setting a subblock located at the center of the current block as a representative subblock. When motion compensation prediction is performed 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 a central sample of the current block.
[0219] 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.
[0220] 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, a sub-block located at the upper left, center, or upper right of the current block may be used to derive the motion information candidate. 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.
[0221] 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.
[0222] Optionally, the motion information table may be configured for the inter prediction mode. In an example, at least one of a motion information table for a block encoded / decoded by intra block copying, a motion information table for a block encoded / decoded based on a translational motion model, or a motion information table for a block encoded / decoded based on an affine motion model may be defined. Depending on the inter prediction mode of the current block, one of the plurality of motion information tables may be selected.
[0223] Fig.14 An example of generating a motion information table for each inter prediction mode is presented.
[0224] When a block is encoded / decoded based on a non-affine motion model, the motion information candidate mvCand derived based on the above block may be added to the non-affine motion information table HmvpCandList.
[0225] The motion information candidate may be set to include additional information in addition to the motion information. In an example, at least one of the size, shape, or partition information of the block may be additionally stored in the motion information candidate. When configuring the merge candidate list of the current block, only the motion information candidates whose size, shape, or partition information is the same as or similar to that of the current block among the motion information candidates may be used, or the motion information candidates whose size, shape, or partition information is the same as or similar to that of the current block may be pre-added to the merge candidate list.
[0226] 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 order of the indexes of the motion information candidates arranged in ascending or descending order. In an example, the motion information candidate with the largest index may be first added to the merge candidate list of the current block.
[0227] When adding a motion information candidate included in the motion information table 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 a pre-stored merge candidate may not be added to the merge candidate list.
[0228] The redundancy check may be performed only for a portion of the motion information candidates included in the motion information table. In an example, the redundancy check may be performed only for motion information candidates having an index exceeding or below a threshold. Alternatively, the redundancy check may be performed only for N motion information candidates having a maximum index or a minimum index.
[0229] Optionally, the redundancy check may be performed only for a portion of the pre-stored merge candidates in the merge candidate list. In an example, the redundancy check may be performed only for merge candidates whose index exceeds or is 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, a top neighboring block, an upper right neighboring block, or a lower left neighboring block of the current block.
[0230] Fig.15 is a diagram illustrating an example in which a redundancy check is performed only on a part of merge candidates.
[0231] When adding a motion information candidate HmvpCand[j] to a merge candidate list, a redundancy check with two 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.
[0232] Unlike the example shown, when adding motion information candidate HmvpCand[j] to the merge candidate list, a redundancy check with 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].
[0233] 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 the merge candidates derived from a neighboring block located at the left side of the current block or at the top of 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.
[0234] When adding a motion information candidate HmvpCand[j] to a merge candidate list, a redundancy check with two 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.
[0235] A redundancy check with a merge candidate may be performed only for a portion of the motion information candidates. In an example, a redundancy check may be performed only for N motion information candidates with large or small indexes among the motion information candidates included in the motion information table. In an example, a redundancy check may be performed only for motion information candidates with an index whose difference between the number of motion information candidates included in the motion information table and the motion information candidate is lower than a threshold. When the threshold is 2, a redundancy check may be performed only for three motion information candidates with the largest index value among the motion information candidates included in the motion information table. For motion information candidates other than the above three motion information candidates, a redundancy check may be omitted. When the redundancy check is omitted, the motion information candidate may be added to the merge candidate list regardless of whether there is the same motion information as the merge candidate.
[0236] On the contrary, the redundancy check is set to be performed only for the motion information candidates having the index for which the difference between the number of motion information candidates included in the motion information table and the motion information candidate exceeds the threshold value.
[0237] 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.
[0238] 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.
[0239] When the same merge candidate as the first motion information candidate is found, redundant check of the same merge candidate as the first motion information candidate may be omitted in redundant check for the second motion information candidate.
[0240] Fig.16 is a diagram illustrating an example of omitting a redundant check with a specific merge candidate.
[0241] 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 the pre-stored merge candidates in the merge candidate list. In this regard, when it is found that the merge candidate mergeCandlist[j] is the same as the motion information candidate HmvpCand[i], a redundancy check between the motion information candidate HmvpCand[i-1] (where its index is i-1) and the merge candidate may be performed without adding the motion information candidate HmvpCand[i] to the merge candidate list. In this regard, the redundancy check between the motion information candidate HmvpCand[i-1] and the merge candidate mergeCandList[j] may be omitted.
[0242] In the example, Fig.16 In the example shown, it has been determined that HmvpCand[i] is the same as mergeCandList[2]. 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.
[0243] When the number of merge candidates included in the merge candidate list of the current block is less than a threshold value, in addition to the motion information candidate, at least one of a paired merge candidate or a zero merge candidate may be further included. The paired merge candidate indicates a merge candidate having a value obtained by averaging motion vectors of more than two merge candidates as a motion vector, and the zero merge candidate indicates a merge candidate having a motion vector of 0.
[0244] For the merge candidate list of the current block, merge candidates may be added in the following order.
[0245] Spatial merging candidate - Temporal merging candidate - Motion information candidate - (affine motion information candidate) - Paired merging candidate - Zero merging candidate
[0246] The spatial merge candidate refers to a merge candidate derived from at least one of a neighboring block or a non-neighboring block, and the temporal merge candidate refers to a merge candidate derived from a previous reference picture. The affine motion information candidate refers to a motion information candidate derived from a block encoded / decoded by an affine motion model.
[0247] The coding block may be partitioned into a plurality of prediction units, and prediction may be performed on each partitioned prediction unit. In this regard, the prediction unit refers to a basic unit for performing prediction.
[0248] The coding block may be partitioned into a plurality of prediction units using at least one of a vertical line, a horizontal line, a slanted line, or a diagonal line. Each of the prediction units obtained by partitioning the block using a partition line may have a shape such as a triangle, a rectangle, a trapezoid, or a pentagon. In one example, the coding block may be partitioned into two triangular-shaped prediction units, two trapezoidal-shaped prediction units, two rectangular-shaped prediction units, or one triangular-shaped prediction unit and one pentagonal-shaped prediction unit.
[0249] Information for determining at least one of the number, angle, or position of lines for partitioning the coding block may be signaled in the bitstream. In one example, information indicating one of the partition type candidates of the coding block may be signaled in the bitstream, or information specifying one of a plurality of line candidates for partitioning the coding block may be signaled in the bitstream. In one example, index information indicating one of the plurality of line candidates may be signaled in the bitstream.
[0250] The multiple line candidates may have different angles and / or positions. 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 may be used as a merge candidate.
[0251] Optionally, information for determining the number or type of line candidates may be signaled in the bitstream. In one 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 sequence, picture, or sequence level.
[0252] Optionally, at least one of the number, angle or position of lines used to divide the coding block can be adaptively determined 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 mode of neighboring blocks.
[0253] When a coding block is partitioned into a plurality of prediction units, intra prediction or inter prediction may be performed on each of the divided prediction units.
[0254] Fig.17 is a diagram illustrating an example of partitioning a coding block into a plurality of prediction units using diagonal lines.
[0255] As in Fig.17 (a) and Fig.17 In the example shown in (b) of FIG. 5 , the coding block may be partitioned into two triangular shaped prediction units using diagonal lines.
[0256] exist Fig.17 (a) and Fig.17 In (b), the coding block is partitioned into two prediction units using a diagonal line connecting two vertices of the coding block. However, the coding block may be partitioned into two prediction units using an oblique line whose at least one end does not intersect with a vertex of the coding block.
[0257] Fig.18 is a diagram illustrating an example of splitting a coding block into two prediction units.
[0258] As in Fig.18 (a) and Fig.18In the example shown in (b) of FIG. 5 , the coding block may be partitioned into two prediction units using an oblique line whose ends intersect the top boundary and the bottom boundary of the coding block respectively.
[0259] Optionally, as in Fig.18 (c) and Fig.18 In the example shown in (d) of FIG. 1 , the coding block may be partitioned into two prediction units using an oblique line whose ends intersect the left boundary and the right boundary of the coding block respectively.
[0260] Optionally, the coding block may be partitioned into two prediction blocks of different sizes. In one example, each end of the oblique line used to divide the coding block may intersect with two boundary lines of the coding block forming a vertex, so that the coding block may be partitioned into two prediction units of different sizes.
[0261] Fig.19 An example of dividing a coding block into a plurality of prediction blocks of different sizes is shown.
[0262] As in Fig.19 (a) and Fig.19 In the example shown in (b), the diagonal line connecting the upper left and lower right portions of the coding block may not intersect with the upper left corner or the lower right corner of the coding block, but may intersect with the left boundary, the right boundary, the top boundary, or the bottom boundary of the coding block, so that the coding block can be partitioned into two prediction units with different sizes.
[0263] Optionally, as in Fig.19 (c) and Fig.19 In the example shown in (d), the diagonal line connecting the upper right and lower left of the coding block may not intersect with the upper left corner or the lower right corner of the coding block, but may intersect with the left boundary, the right boundary, the top boundary or the bottom boundary of the coding block, so that the coding block can be partitioned into two prediction units with different sizes.
[0264] Each of the prediction units generated by partitioning the coding block may be referred to as an "Nth prediction unit". Figures 17 to 19 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 refers to a prediction unit including a sample located at the lower left of a coding block or a sample located at the upper left of a coding block. The second prediction unit may refer to a prediction unit including a sample located at the upper right of a coding block or a sample located at the lower right.
[0265] Contrary to the above definition, a prediction unit including a sample located at the upper right or a sample located at the lower right in the coding block may be defined as a first prediction unit, and a prediction unit including a sample located at the lower left or a sample located at the upper left in the coding block may be defined as a second prediction unit.
[0266] Splitting a coding block using horizontal, vertical, diagonal, or oblique lines may be referred to as prediction unit partitioning. A prediction unit generated by applying the prediction unit partitioning may be referred to as a triangular prediction unit, a quadrilateral prediction unit, or a pentagonal prediction unit according to its shape.
[0267] In the embodiments described below, it is assumed that a coding block is partitioned into multiple prediction units using a diagonal line. Specifically, dividing a coding block into two prediction units using a diagonal line may be referred to as diagonal partitioning or triangular partitioning. However, even when a coding block is partitioned into multiple prediction units using a vertical line, a horizontal line, or an oblique line having an angle different from that of a diagonal line, the prediction unit may be encoded / decoded according to the embodiments to be described later. That is, the principles related to the encoding / decoding of a triangular prediction unit to be described later may also be applied to encoding / decoding a rectangular prediction unit or a pentagonal prediction unit.
[0268] Whether to apply prediction unit partitioning to a coding block may be determined based on at least one of the following: a slice type, a maximum number of merge candidates that a merge candidate list may include, a size of the coding block, a shape of the coding block, a prediction coding mode of the coding block, or a partition mode of a parent node.
[0269] In one example, whether to apply prediction unit partitioning 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.
[0270] Alternatively, whether to apply prediction unit partitioning to the coding block may be determined based on whether the maximum number of merge candidates included in the merge candidate list is 2 or more. Prediction unit partitioning may be allowed only when the maximum number of merge candidates included in the merge candidate list is 2 or more.
[0271] Optionally, when at least one of the width or height of the coding block is greater than 64, there is a disadvantage of redundantly accessing a 64×64-sized data processing unit in terms of hardware implementation. 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 one example, when at least one of the height or width 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.
[0272] Optionally, considering the maximum number of samples that can be processed in parallel in hardware implementation, prediction unit partitioning may not be allowed for coding blocks with a number of samples greater than a threshold. In one example, prediction unit partitioning may not be allowed for coding tree blocks with a number of samples greater than 4096.
[0273] Optionally, for a coding block whose number of samples is less than a threshold, prediction unit partitioning may not be allowed. In one example, when the number of samples is less than 64, prediction unit partitioning may not be applied to the coding block.
[0274] Alternatively, whether to apply the prediction unit partition to the coding block may be determined based on whether the ratio of the width to the height of the coding block is less than a first threshold or whether the ratio of the width to the height of the coding block is greater than a second threshold. In this regard, the ratio of the width to the height of the coding block whRatio may be determined as the ratio of the width CbW to the height CbH of the coding block as shown in the following equation 2:
[0275] [Equation 2]
[0276] whRatio=CbW / CbH
[0277] The second threshold may be the inverse of the first threshold. In one example, when the first threshold is k, the second threshold may be 1 / k.
[0278] Prediction unit partitioning may be applied to the coding block only when a ratio of a width to a height of the coding block exists between a first threshold and a second threshold.
[0279] Optionally, prediction unit partitioning may be applied only when the ratio of the width to the height of the coding block is less than a first threshold or greater than a second threshold. In one example, when the first threshold is 16, prediction unit partitioning may not be allowed for coding blocks of 64×4 or 4×64 size.
[0280] Alternatively, whether prediction unit partitioning is allowed may be determined based on the partitioning mode of the parent node. In one example, when the coding block as the parent node is partitioned based on a quadtree partitioning scheme, prediction unit partitioning may be applied to the coding block as a leaf node. On the contrary, when the coding block as the parent node is partitioned based on a binary tree or ternary tree partitioning scheme, prediction unit partitioning may not be allowed for the coding block as a leaf node.
[0281] Alternatively, whether prediction unit partitioning is allowed may be determined based on a prediction coding mode of the coding block. In one example, prediction unit partitioning may be allowed only when the coding block is encoded via intra prediction, when the coding block is encoded via inter prediction, or when the coding block is encoded using a predefined inter prediction mode. In this regard, 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.
[0282] Alternatively, whether to allow prediction unit partitioning may be determined based on the size of the parallel processing region. In one 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.
[0283] Considering two or more of the conditions listed above, it may be determined whether to apply prediction unit partitioning to a coding block.
[0284] In another example, information indicating whether prediction unit partition is applied to the coding block may be signaled in the bitstream. The information may be signaled at a sequence, picture, slice, or block level. For example, a flag triangle_partition_flag indicating whether prediction unit partition is applied to the coding block may be signaled at a coding block level.
[0285] When it is determined to apply the prediction unit partition to the coding block, information indicating the number of lines for dividing the coding block or the positions of the lines may be signaled in a bitstream.
[0286] In one example, when a coding block is divided into a plurality of prediction units using a diagonal line, information indicating the direction of the diagonal line used to divide the coding block may be transmitted in a bitstream by a signal. In one example, a flag triangle_partition_type_flag indicating the direction of the diagonal line may be transmitted in a bitstream by a signal. The flag indicates whether the coding block is divided using a diagonal line connecting the upper left and lower right of the coding block or a diagonal line connecting the upper right and lower left of the coding block. The scheme of dividing the coding block using a diagonal line connecting the upper left and lower right to each other may be referred to as a left triangle partition type. The scheme of dividing the coding block using a diagonal line connecting the upper right and lower left to each other may be referred to as a right triangle partition type. In one example, when the value of the flag is 0, it may indicate that the partition type of the coding block is a left triangle partition type. When the value of the flag is 1, it may indicate that the partition type of the coding block is a right triangle partition type.
[0287] In addition, information indicating whether the sizes of the prediction units are equal to each other or information indicating the position of the diagonal line used to divide the coding block may be transmitted by signal in the bitstream. In one 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 divided into two prediction units using a diagonal line passing through two vertices of the coding block. On the contrary, when the information indicating the size of the prediction unit indicates that the size of the prediction unit is different from each other, the position of the diagonal line used to divide the coding block may be determined based on the information indicating the position of the diagonal line. In one 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 bottom boundaries of the coding block or whether the diagonal line intersects the top and right boundaries of the coding block. 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 bottom boundaries of the coding block or whether the diagonal line contacts the top and left boundaries of the coding block.
[0288] Information indicating the partition type of a coding block may be signaled at a coding block level. Thus, a partition type may be determined for each coding block to which prediction unit partitioning is applied.
[0289] In another example, information indicating the partition type may be signaled for a sequence, a picture, a slice, a tile, or a coding tree unit. In this case, the partition types of the coding blocks to which diagonal partitioning is applied in the sequence, the picture, the slice, the tile, or the coding tree unit may be set to be the same.
[0290] Optionally, information for determining a partition type for a first coding unit to which a prediction unit partition is applied in a coding tree unit may be encoded in a bitstream and signaled. The same partition type as that of the first coding unit may be applied to a second coding unit and subsequent coding units of the prediction unit partition in the same coding tree unit.
[0291] In another example, the partition type of the coding block may be determined based on the partition type of the neighboring block. In this regard, the neighboring block may include a neighboring block adjacent to the upper left corner of the coding block, a neighboring block adjacent to the upper right corner of the coding block, a neighboring block adjacent to the lower left corner of the coding block, a neighboring block located above the coding block, or at least one of the neighboring blocks located on the left side of the coding block. In one example, the partition type of the current block may be set to be the same as the partition type of the neighboring block. Alternatively, the partition type of the current block may be determined based on whether the left triangle partition type is applied to the neighboring block adjacent to the upper left corner of the current block or whether the right triangle partition type is applied to the neighboring block adjacent to the upper right corner or lower left corner of the current block.
[0292] 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 regard, 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 a general merge candidate list from a merge candidate list for deriving motion information of a prediction unit, the merge candidate list for deriving motion information of a prediction unit may be 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 may be referred to as partition mode merge candidates or triangle merge candidates. However, applying the merge candidate derivation method and the merge candidate list construction scheme as described above to the partition mode merge candidate derivation method and the partition mode merge candidate list construction method may be included in the concept of the present disclosure.
[0293] Information for determining the maximum number of partition mode merge candidates that the partition mode merge candidate list may include may be signaled in the bitstream. The information may indicate a difference between the maximum number of merge candidates that the merge candidate list may include and the maximum number of partition mode merge candidates that the partition mode merge candidate list may include.
[0294] Partition mode merge candidates may be derived from spatially and temporally neighboring blocks of a coding block.
[0295] Fig. 20 is a diagram illustrating neighboring blocks used to derive partition mode merge candidates.
[0296] The partition mode merge candidate may be derived using at least one of a neighboring block located above the coding block, a neighboring block located on the left side of the coding block, or a co-located block included in a picture different from the picture including the coding block. The neighboring block located above the coding block may include at least one of a block including a sample point (xCb+CbW-1, yCb-1) located above the coding block, a block including a sample point (xCb+CbW, yCb-1) located above the coding block, or a block including a sample point (xCb-1, yCb-1) located above the coding block. The neighboring block located on the left side of the coding block may include at least one of a block including a sample point (xCb-1, yCb+CbH-1) located on the left side of the coding block or a block including a sample point (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 in the co-located picture and a block including samples (xCb / 2, yCb / 2) located at the center of the coding block.
[0297] The neighboring blocks may be searched in a predefined order, and the partition mode merge candidate list may be constructed using the searched partition mode merge candidates according to the predefined order. In one example, the partition mode merge candidate list may be constructed by searching for the partition mode merge candidates in the order of B1, A1, B0, A0, C0, B2, and C1.
[0298] The motion information of the prediction unit may be derived based on the partition mode merge candidate list. That is, the prediction units may share a single partition mode merge candidate list.
[0299] 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 one example, index information merge_triangle_idx for specifying at least one of the partition mode merge candidates may be signaled in a bitstream.
[0300] 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 one example, Table 1 below is an example of a combination of merge candidates according to the index information merge_triangle_idx.
[0301] [Form 1]
[0302]
[0303]
[0304] When the value of the index information merge_triangle_idx is 1, this indicates 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. Based on the index information merge_triangle_idx, a partition mode merge candidate for deriving the motion information of the first prediction unit and a partition mode merge candidate for deriving the motion information of the second prediction unit may be determined. The partition type of the coding block to which diagonal partitioning is applied may be determined based on the index information. That is, 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 based on the index information, the information triangle_partition_type_flag indicating the direction of the diagonal used to divide the coding block may not be encoded. Table 2 below shows the partition type of the coding block with the index information merge_triangle_idx.
[0305] [Form 2]
[0306] 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
[0307] The variable TriangleDir is 0 to indicate that the left triangle partition type is applied to the coding block. The variable TriangleDir is 1 to indicate that the right triangle partition type is applied to the coding block. Based on the combination of 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, only the index information for one of the first prediction unit and the second prediction unit may be transmitted by a signal, 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 one example, the merge candidate of the first prediction unit may be determined based on the index information merge_triangle_idx indicating one of the partition mode merge candidates. The merge candidate of the second prediction unit may be determined based on merge_triangle_idx. In one 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 one example, the merge candidate of the second prediction unit may be determined as a partition mode merge candidate indexed by a value obtained by adding 1 to merge_triangle_idx. 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 indexed by a value obtained by subtracting 1 from merge_triangle_idx.
[0308] Optionally, the motion information of the second prediction unit may be derived from a partition mode merge candidate having the same reference picture as the reference picture of the partition mode merge candidate of the first prediction unit specified by the index information. In this regard, the partition mode merge candidate having the same reference picture as the reference picture of the partition mode merge candidate of the first prediction unit may represent a partition mode merge candidate having at least one of the same L0 reference picture image or the same L1 reference picture as the reference picture of 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 reference picture of the partition mode merge candidate of the first prediction unit, one of the multiple partition mode merge candidates may be selected based on whether the corresponding merge candidate includes bidirectional motion information or at least one of the difference between the index of the corresponding merge candidate and the index information.
[0309] In another example, index information may be signaled for each of the first prediction unit and the second prediction unit. In one 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. 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.
[0310] The first index information 1st_merge_idx may indicate 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.
[0311] The partition mode merge candidate indicated by the first index information 1st_merge_idx may not be used 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 indicate an index of 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 indicated by the second index information 2nd_merge_idx. On the contrary, 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 a value obtained by adding 1 to the value of the second index information 2nd_merge_idx as an index.
[0312] Optionally, whether to signal the second index information may be determined based on the number of partition mode merge candidates included in the partition mode merge candidate list. In one example, when the maximum number of partition mode merge candidates that the partition mode merge candidate list may include does not exceed 2, the signaling of the second index information may be omitted. When the signaling of the second index information is omitted, the second partition mode merge candidate may be derived by adding an offset to the first index information or subtracting an offset from the first index information. In an example, when the maximum number of partition mode merge candidates that the partition mode merge candidate list may include is 2, and the first index information indicates 0, the second partition mode merge candidate may be derived by adding 1 to the first index information. Optionally, when the maximum number of partition mode merge candidates that the partition mode merge candidate list may include is 2, and the first index information indicates 1, the second partition mode merge candidate may be derived by subtracting 1 from the first index information.
[0313] Optionally, when signal transmission of the second index information is omitted, the second index information may be set to a default value. In this regard, the default value may be 0. The second partition mode merge candidate may be derived based on a comparison result between the first index information and the second index information. In one example, when the second index information is less than the first index information, a merge candidate with an index of 0 may be determined as the second partition mode merge candidate. When the second index information is equal to or greater than the first index information, a merge candidate with an index of 1 may be determined as the second partition mode merge candidate.
[0314] 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. Conversely, 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 set as the motion information of the prediction unit may be determined based on the index of the partition mode merge candidate or the motion information of another prediction unit.
[0315] In one example, when the index of the partition pattern 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 pattern merge candidate may be set to the L1 motion information of the prediction unit. Conversely, when the index of the partition pattern 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 pattern merge candidate may be set to 0. In another example, when the index of the partition pattern merge candidate is an even number, the L0 motion information of the partition pattern merge candidate may be set to the L0 motion information of the prediction unit. When the index of the partition pattern merge candidate is an odd number, the L1 motion information of the partition pattern merge candidate may be set to the L1 motion information of the prediction unit. Optionally, for the first prediction unit, when the index of the partition pattern merge candidate is an even number, the L0 motion information of the partition pattern merge candidate may be set to the L0 motion information of the first prediction unit. For the second prediction unit, when the index of the partition pattern merge candidate is an odd number, the L1 motion information of the partition pattern merge candidate may be set to the L1 motion information of the second prediction unit.
[0316] 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 information of the second prediction unit. Conversely, 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.
[0317] A partition mode merge candidate list for deriving motion information of a first prediction unit and a partition mode merge candidate list for deriving motion information of a second prediction unit may be separately constructed.
[0318] In one 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 a first prediction unit, motion information of a second prediction unit may be derived using a partition mode merge list including remaining partition mode merge candidates except the partition mode merge candidate indicated by the index information. Specifically, motion information of the second prediction unit may be derived from one of the remaining partition mode merge candidates.
[0319] Therefore, the maximum number of partition mode merge candidates included in the partition mode merge candidate list of the first prediction unit and the maximum number of partition mode merge candidates included in the partition mode merge candidate list of the second prediction unit may be different from each other. In one 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 excluding the partition mode merge candidate indicated by the index information of the first prediction unit.
[0320] In another example, a merge candidate for each prediction unit may be derived based on neighboring blocks adjacent to the coding block. In this regard, the availability of the neighboring blocks may be determined based on the shape or position of the prediction unit.
[0321] Fig.21 is a diagram for describing an example of determining availability of neighboring blocks for each prediction unit.
[0322] Neighboring blocks that are not adjacent to the first prediction unit are set to be unavailable for the first prediction unit. Neighboring blocks that are not adjacent to the second prediction unit may be set to be unavailable for the second prediction unit.
[0323] In one example, as in Fig.21 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, while blocks B0 and B1 not adjacent to the first prediction unit may be set to be unavailable for the first prediction unit. Therefore, the partition mode merge candidate list of the first prediction unit may include partition mode merge candidates derived from blocks A1, A0, and B2, but may not include partition mode merge candidates derived from blocks B0 and B1.
[0324] As in Fig.21 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 set to be available for the second prediction unit, and blocks A1, A0, and B2 may be set to be unavailable for the second prediction unit. Therefore, the partition mode merge candidate list of the second prediction unit may include the partition mode merge candidate derived from blocks B0 and B1, but may not include the partition mode merge candidate derived from blocks A1, A0, and B2.
[0325] Therefore, the number or range of partition mode merging candidates that can be used by the prediction unit may be determined based on at least one of the location of the prediction unit or the partition type of the coding block.
[0326] In another example, the merge mode may be applied to only one of the first prediction unit and the second prediction unit. In this regard, 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 the motion information of the other of the first prediction unit and the second prediction unit may be derived by refining the motion information of the prediction unit to which the merge mode is applied.
[0327] In one example, based on the partition mode merge candidate, a motion vector and a reference picture index of the first prediction unit may be derived. In this regard, the motion vector of the second prediction unit may be derived by refining the motion vector of the first prediction unit. In one example, the motion vector of the second prediction unit may be derived by adding the refined motion vector {Rx, Ry} to the motion vector {mvD1LXx, mvD1LXy} of the first prediction unit or subtracting the refined 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 equal to the reference picture index of the first prediction unit.
[0328] Information for determining a refined motion vector representing 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. The information may include at least one of information indicating a magnitude of the refined motion vector or information indicating a direction of the refined motion vector.
[0329] Alternatively, the direction of the refined motion vector may be derived based on at least one of a position and an index of a prediction unit and a partition type applied to a coding block.
[0330] 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 in the bitstream.The motion vector of the other of the first prediction unit and the second prediction unit may be derived by refining the signaled motion vector.
[0331] In one example, based on information signaled in a bitstream, a motion vector and a reference picture index of a first prediction unit may be determined. The motion vector of a second prediction unit may be derived by refining the motion vector of the first prediction unit. In one example, the motion vector of the second prediction unit may be derived by adding or subtracting the refined 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 equal to the reference picture index of the first prediction unit.
[0332] In another example, the merge mode may be applied to only one of the first prediction unit and the second prediction unit. 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 one example, a 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 regard, the symmetric motion vector has the same size as that of the motion vector of the first prediction unit, but has a direction opposite to that of the motion vector of the first prediction unit in at least one of the x-axis component and the y-axis component. Alternatively, the symmetric motion vector may represent a motion vector having the same size as that of the scaled vector obtained by scaling the motion vector of the first prediction unit, but having a direction opposite to that of the scaled vector in at least one of the x-axis component and the y-axis component. In one 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 of the first prediction unit.
[0333] The reference picture index of one of the first prediction unit and the second prediction unit to which the merge mode is not applied may be set equal to the reference picture index of the other of the first prediction unit and the second 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 regard, the predefined value may be a minimum index or a maximum index in a 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 a reference picture list to which the reference picture of the prediction unit to which the merge mode is applied belongs. In one 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 regard, the reference picture of the prediction unit to which the merge mode is not applied may be derived based on a difference in a picture order count (POC) between the reference picture of the prediction unit to which the merge mode is applied and the current picture. In one 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 whose difference with the current picture is equal to or close to the difference between the reference picture of the prediction unit to which the merge mode is applied and the current picture may be selected as the reference picture of the prediction unit to which the merge mode is not applied.
[0334] When the POC difference between the reference picture of the first prediction unit and the current picture is different from the POC difference between the reference picture of the second prediction unit and the current picture, a symmetric motion vector of a scaled motion vector obtained by scaling the motion vector of the prediction unit to which the merge mode is applied may be set as a motion vector of the prediction unit to which the merge mode is not applied. In this regard, the scaling may be performed based on each POC difference between each reference picture and the current picture.
[0335] In another example, a motion vector for each of the first prediction unit and the second prediction unit may be derived, and then a refinement vector may be added to or subtracted from the derived motion vector. In one example, the motion vector for the first prediction unit may be derived by adding a first refinement vector to or subtracting a first motion vector derived based on a first merge candidate, and the motion vector for the second prediction unit may be derived by adding a second refinement vector to or subtracting a second motion vector derived based on a second merge candidate. Information for determining at least one of the first refinement vector or the second refinement vector may be signaled in the bitstream. The information may include at least one of information for determining a size of the refinement vector or information for determining a direction of the refinement vector.
[0336] The second refinement vector may be a symmetric motion vector with respect to the first refinement vector. In this case, information for determining only one of the first refinement vector and the second refinement vector may be signaled in the bitstream. In one example, when the first refinement vector is determined as (MVDx, MVDy) based on the information signaled in the bitstream, a symmetric motion vector of the first refinement vector (-MVDx, MVDy), (MVDx, -MVDy), or (-MVDx, -MVDy) may be set as the second refinement vector. Based on the POC of the reference picture of each of the prediction units, a symmetric motion vector of a scaled motion vector obtained by scaling the first refinement vector may be set as the second refinement vector.
[0337] In another example, motion information of one of the first prediction unit and the second prediction unit may be derived based on the merge candidate, while the motion information of the other of the first prediction unit and the second prediction unit may be determined based on information transmitted by signal in the bitstream. In one example, a merge index of the first prediction unit may be signaled, while at least one of information for determining a motion vector of the second prediction unit and information for determining a reference picture of the second prediction unit may be signaled in the bitstream. The motion information of the first prediction unit may be set equal to 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 transmitted by signal in the bitstream.
[0338] 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 regard, image quality degradation may occur in the boundary between the first prediction unit and the second prediction unit. In one example, around the edge existing at the boundary between the first prediction unit and the second prediction unit, the continuity of image quality may be degraded. In order to reduce the image quality degradation at the boundary, the prediction sample may be derived via a smoothing filter or weighted prediction.
[0339] The prediction samples in the coding block to which diagonal partitioning is applied may be derived based on a weighted sum 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. In this regard, the prediction samples located in the boundary area between the first prediction unit and the second prediction unit may be derived based on a weighted sum of a first prediction sample included in the first prediction block and a second prediction sample included in the second prediction block. In one example, the following Equation 3 presents an example of deriving prediction samples of the first prediction unit and the second prediction unit.
[0340] [Equation 3]
[0341] P(x, y)=w1*P1(x, y)+(1-w1)*P2(x, y)
[0342] 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.
[0343] When the left triangular partition type is applied to the coding block, the boundary area may include prediction samples, each of which has the same x-axis coordinate and y-axis coordinate. Conversely, when the right triangular partition type is applied to the coding block, the boundary area may include prediction samples, each of which has a sum of an x-axis coordinate and a y-axis coordinate greater than or equal to a first threshold and less than or equal to a second threshold.
[0344] 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 difference between the motion vectors of the prediction units, and the difference between the first prediction sample and the second prediction sample at the POC or diagonal boundary of the reference picture.
[0345] Fig. 22 and Fig.23 is a diagram illustrating an example of deriving a prediction sample based on a weighted sum of a first prediction sample and a second prediction sample. Fig. 22 is an example of a case where the left triangle partition type is applied to a coding block. Fig.23 is an example of a case where the right triangle partition type is applied to a coding block. Fig. 22 (a) and Fig.23 (a) is a diagram showing a prediction pattern for a luminance component. Fig. 22 (b) and Fig.23 (b) is a diagram showing a prediction mode for a chroma component.
[0346] In the illustrated drawings, the numbers marked on the prediction samples located near the boundary of the first prediction unit and the second prediction unit indicate the weight applied to the first prediction sample. In one example, when the number marked on the prediction sample is N, a weight of N / 8 may be applied to the first prediction sample, and a weight of (1-(N / 8)) may be applied to the second prediction sample, thereby deriving the prediction sample.
[0347] In the non-boundary area, the first prediction sample point or the second prediction sample point may be determined as the prediction sample point. Fig. 22 For example, in the region belonging to the first prediction unit, the first prediction sample derived based on the motion information of the first prediction unit may be determined as the prediction sample. Conversely, in the region belonging to the second prediction unit, the second prediction sample derived based on the motion information of the second prediction unit may be determined as the prediction sample.
[0348] Reference Fig.23For example, in a region where the sum of the x-axis coordinate and the y-axis coordinate is less than a first threshold, a first prediction sample derived based on the motion information of the first prediction unit may be determined as the prediction sample. Conversely, in a region where the sum of the x-axis coordinate and the y-axis coordinate is greater than a second threshold, a second prediction sample derived based on the motion information of the second prediction unit may be determined as the prediction sample.
[0349] The threshold for determining the non-boundary area may be determined based on at least one of the coding block size, the coding block shape, or the color component. In one example, when the threshold of the luma component is set to N, the threshold of the chroma component may be set to N / 2.
[0350] The prediction samples included in the boundary area may be derived based on a weighted sum of the first prediction samples and the second prediction samples. In this regard, 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.
[0351] In one example, as in Fig. 22 In the example shown in (a), each 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 1 between the x-axis coordinate and the y-axis coordinate of each sample can be derived by setting the ratio of the weight applied to the first prediction sample to the weight applied to the second prediction sample to (3:1) or (1:3). In addition, a prediction sample having an absolute value of 2 between the x-axis coordinate and the y-axis coordinate of each sample can be derived by setting the ratio of the weight applied to the first prediction sample to the weight applied to the second prediction sample to (7:1) or (1:7).
[0352] Optionally, as in Fig. 22 In the example shown in (b), the prediction sample having the same x-axis coordinate and y-axis coordinate of each sample point can be derived by applying the same weight to the first prediction sample point and the second prediction sample point. By setting the ratio of the weight applied to the first prediction sample point to the weight applied to the second prediction sample point to (7:1) or (1:7), the prediction sample having the absolute value of the difference between the x-axis coordinate and the y-axis coordinate of each sample point being 1 can be derived.
[0353] In one example, as in Fig.23In the example shown in (a), the same weight can be applied to the first prediction sample and the second prediction sample to derive a prediction sample whose sum of the x-axis coordinate and the y-axis coordinate is 1 less than the width or height of the coding block. The prediction sample whose sum of the x-axis coordinate and the y-axis coordinate of each sample 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 ratio of the weight applied to the first prediction sample to the weight applied to the second prediction sample to (3:1) or (1:3). The prediction sample whose sum of the x-axis coordinate and the y-axis coordinate of each sample 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 ratio of the weight applied to the first prediction sample to the weight applied to the second prediction sample to (7:1) or (1:7).
[0354] Optionally, as in Fig.23 In the example shown in (b), the same weight can be applied to the first prediction sample and the second prediction sample to derive a prediction sample in which the sum of the x-axis coordinate and the y-axis coordinate of each sample is 1 less than the width or height of the coding block. The ratio between the weight applied to the first prediction sample and the weight applied to the second prediction sample can be set to (7:1) or (1:7) to derive a prediction sample in which the sum of the x-axis coordinate and the y-axis coordinate of each sample 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.
[0355] In another example, the weight may be determined based on the position of the prediction sample or the shape of the coding block. The following equations 4 to 6 represent examples of deriving weights when the left triangle partition type is applied to the coding block. Equation 4 presents an example of deriving a weight applied to the first prediction sample when the coding block is a square.
[0356] [Equation 4]
[0357] w1=(x-y+4) / 8
[0358] In the above 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 can be derived as in equation 5 or equation 6. Equation 5 represents the case where the width of the coding block is greater than its height. Equation 6 represents the case where the width of the coding block is less than its height.
[0359] [Equation 5]
[0360] w1=((x / whRatio)-y+4) / 8
[0361] [Equation 6]
[0362] w1=(x-(y*whRatio)+4) / 8
[0363] When the right triangle partition type is applied to the coding block, the following Equations 7 to 9 may be applied to determine the weight applied to the first prediction sample. Equation 7 presents an example of deriving the weight applied to the first prediction sample when the coding block is a square.
[0364] [Equation 7]
[0365] w1=(CbW-1-xy)+4) / 8
[0366] In the above 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 can be derived using the following equation 8 or equation 9. Equation 8 represents the case where the width of the coding block is greater than its height. Equation 9 represents the case where the width of the coding block is less than its height.
[0367] [Equation 8]
[0368] w1=(CbH-1-(x / whRatio)-y)+4) / 8
[0369] [Equation 9]
[0370] w1=(CbW-1-x-(y*whRatio)+4) / 8
[0371] In the above Equation 8, CbH represents the height of the coding block.
[0372] 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 applying the first weight to the first prediction sample and applying the second weight less than the first weight to the second prediction sample. The prediction samples included in the second prediction unit among the prediction samples in the boundary area may be derived by applying the first weight to the first prediction sample and applying the second weight greater than the first weight to the second prediction sample.
[0373] When diagonal partitioning is applied to a coding block, a combined prediction mode in which an intra prediction mode and a merge mode are combined may not be applied to the coding block.
[0374] When the encoding / decoding of the current coding block is completed, the motion information of the current coding block that has completed encoding / decoding may be stored for encoding / decoding of the next coding block. The motion information may be stored based on a sub-block having a preset size. In one example, the sub-block having a preset size may have a 4×4 size. Optionally, the size or shape of the sub-block may vary based on the size or shape of the coding block.
[0375] 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. Conversely, 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.
[0376] When the sub-block belongs to the boundary of the first prediction unit and the second prediction unit, 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 one 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.
[0377] In another example, when the subblock belongs to the boundary of the first prediction unit and the second prediction unit, one of the L0 motion information and the L1 motion information of the subblock may be derived from the first prediction unit, and the other of the L0 motion information and the L1 motion information of the subblock may be derived from the second prediction unit. In one example, the L0 motion information of the first prediction unit may be set as the L0 motion information of the subblock, and the L1 motion information of the second prediction unit may be set as the L1 motion information of the subblock. However, when each of the first prediction unit and the second prediction unit has only the L0 motion information or only the L1 motion information, one of the first prediction unit and the second prediction unit may be selected, and then the motion information of the subblock may be determined based on the selected one. 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 subblock.
[0378] The motion information of the current coding block for which encoding / decoding has been completed may be updated to the motion information table. In this regard, the motion information of the coding block to which the prediction unit partition is applied may not be added to the motion information table.
[0379] Alternatively, only the motion information of one of the plurality of prediction units generated by partitioning the coding block may be added to the motion information table. In one 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 regard, the prediction unit to be added to the motion information table may be selected based on at least one of the coding block size, the coding block shape, the prediction unit size, the prediction unit shape, or whether bidirectional prediction has been performed on the prediction unit.
[0380] Optionally, motion information of each of a plurality of prediction units generated by partitioning the coding block may be added to the motion information table. In this regard, the order in which the motion information of the plurality of prediction units is added to the motion information table may be predefined in the encoder and the decoder. In one 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 the prediction unit not including the upper left sample or the lower left sample is added to the motion information table. Optionally, the order in which the motion information of each prediction unit is added to the motion information table may be determined based on at least one of a merge index, a reference picture index, or a motion vector size of each prediction unit.
[0381] Alternatively, a combination of 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. One of the L0 motion information and the L1 motion information of the combination may be derived from the first prediction unit, while the other of the L0 motion information and the L1 motion information of the combination may be derived from the second prediction unit.
[0382] Alternatively, the motion information to be added to the motion information table may be determined based on whether the reference pictures of the first prediction unit and the second prediction unit are identical to each other. In one example, when the reference pictures of the first prediction unit and the second prediction unit are different from each other, the motion information of one of the first prediction unit and the second prediction unit or a combination of 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. On the contrary, when the reference pictures of the first prediction unit and the second prediction unit are identical to each other, an average value 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.
[0383] Alternatively, the motion vector to be added to the motion information table may be determined based on the size of the coding block, the shape of the coding block, or the partition type of the coding block. In one 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. Conversely, 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 a combination of 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.
[0384] A motion information table for storing motion information of coding blocks to which prediction unit partitioning is applied may be defined separately. In one 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. That is, the motion information of coding blocks to which prediction unit partitioning is not applied may be stored in a general motion information table, while 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 of adding the motion information of coding blocks to which prediction unit partitioning is applied to a motion information table as described above may be applied to update a partition mode motion information table. In one example, the partition mode motion information table may include motion information of a first prediction unit, motion information of a second prediction unit, a combination of motion information of a first prediction unit and motion information of a second prediction unit, and motion information obtained by averaging the motion vector of the first prediction unit and the motion vector of the second prediction unit.
[0385] When the prediction mode partition is not applied to the coding block, the merge candidate can be derived using the general motion information table. On the contrary, when the prediction mode partition is applied to the coding block, the merge candidate can be derived using the prediction mode motion information table.
[0386] Intra prediction is to predict the current block by using reconstructed samples that have been encoded / decoded and are around the current block. In this regard, the reconstructed samples before applying the in-loop filter can be applied to the intra prediction of the current block.
[0387] Intra prediction methods include matrix-based intra prediction and intra prediction based on the direction of adjacent reconstruction samples. Information indicating the intra prediction method of the current block can be transmitted by signal in the bit stream. 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 one example, when there is a current block that crosses the picture boundary, the current block can be set so that the matrix-based intra prediction method is not applied to the current block.
[0388] The matrix-based intra prediction method is a method for obtaining a prediction block of a current block based on a matrix stored in an encoder and a decoder and a matrix product of 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 a matrix for performing intra prediction on the current block based on the above information and the size of the current block.
[0389] 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 in detail with reference to the accompanying drawings.
[0390] Fig.24 is a flowchart of an intra-frame prediction method according to an embodiment of the present disclosure.
[0391] A reference sample line of the current block may be determined S2401. The reference sample line refers to a set of reference samples included in a k-th line away from the top and / or left side of the current block. The reference samples may be derived from reconstructed samples encoded / decoded around the current block.
[0392] 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 for each coding block.
[0393] The plurality of reference sample lines may include at least one of a first line, a second line, or a third line at the top and / or the left side of the current block. A reference sample line consisting of a row adjacent to the top of the current block and a column adjacent to the left side of the current block among the plurality of reference sample lines may be referred to as an adjacent reference sample line, and the other reference sample lines may be referred to as a non-adjacent reference sample line.
[0394] Table 3 shows the index assigned to each candidate reference sample line.
[0395] [Form 3]
[0396] 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 point line
[0397] Based on at least one of the position, size, shape of the current block, or the prediction coding mode of the neighboring blocks, the reference sample line of the current block may be determined. In one example, when the current block is adjacent to a boundary of a picture, a tile, a slice, or a coding tree unit, the neighboring reference sample line may be determined as the reference sample line of the current block. The reference sample line may include a top reference sample located at the top of the current block and a left reference sample located at the left side of the current block. The top 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 an in-loop filter is applied.
[0398] Next, the intra prediction mode of the current block may be determined S2402. For the intra prediction mode of the current block, at least one of a non-directional intra prediction mode or a directional intra prediction mode may be determined as the intra prediction mode of the current block. The non-directional intra prediction mode includes plane and DC, and the directional intra prediction mode includes 33 or 65 modes from the lower left diagonal direction to the upper right diagonal direction.
[0399] Fig.25 is a diagram showing an intra prediction mode.
[0400] Fig.25 (a) shows 35 intra prediction modes, Fig.25 (b) shows 67 intra prediction modes.
[0401] Definable ratio Fig.25 A greater or lesser number of intra prediction modes than those shown in .
[0402] 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 a top neighboring block adjacent to the top of the current block.
[0403] The number of MPMs included in the MPM list may be preset in the encoder and the decoder. 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 the bitstream. Optionally, the number of MPMs is determined based on at least one of a prediction coding mode of a neighboring block, a size of a current block, a shape of a current block, or a reference sample line index of a current block. In an example, N MPMs may be applied when an adjacent reference sample line is determined as a reference sample line of a current block, whereas M MPMs may be applied when a non-adjacent reference sample line is determined as a reference sample line of a current block. Since 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 6 candidate intra-frame prediction modes, whereas 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 5 candidate intra-frame prediction modes.
[0404] Alternatively, a fixed number (eg, 6 or 5) of MPM candidates may be applied regardless of the index of the reference sample line of the current block.
[0405] An MPM list including a plurality of MPMs may be generated, and information indicating whether the same MPM as the intra prediction mode of the current block is included in the MPM list may be signaled in the 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 same MPM as the current block is included in the MPM list, index information identifying one of the MPMs may be signaled in the bitstream. In an example, index information mpm_idx specifying any one of a plurality of MPMs may be signaled in the 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 same MPM as 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 the bitstream. The remaining mode information indicates an index value corresponding to the intra prediction mode of the current block when the index is reallocated to the remaining intra prediction modes other than the MPM. The decoder may determine the intra prediction mode of the current block by arranging the MPMs in ascending order and comparing the remaining mode information with the MPM. In an example, when the remaining mode information is equal to or less than the MPM, the intra prediction mode of the current block may be derived by adding 1 to the remaining mode information.
[0406] When deriving the intra prediction mode of the current block, comparison of a part of the MPM with the remaining mode information may be omitted. In the example, the MPM in the 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, the remaining mode information clearly indicates the directional intra prediction mode, so the intra prediction mode of the current block may be derived by comparing the remaining MPMs other than the non-directional intra prediction mode with the remaining mode information. Instead of excluding the non-directional intra prediction mode from the comparison target, the result value may be compared with the remaining MPMs after adding the number of non-directional intra prediction modes to the remaining mode information.
[0407] Instead of 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 the bitstream. The information is 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.
[0408] When the default mode flag is used, it can be set to the same intra prediction mode as the default mode without being set to MPM. In the 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 can be derived by using 5 MPMs excluding the MPM corresponding to the plane.
[0409] When a plurality of intra prediction modes are set as a default mode, index information indicating any one of the default modes may be further signaled in the bitstream. The intra prediction mode of the current block may be set to the default mode indicated by the index information.
[0410] When the index of the reference sample line of the current block is not 0, it may be set to not use the default mode. In one example, when a non-adjacent reference sample line is determined as the reference sample line of the current block, it may be set to not 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 (i.e., false).
[0411] When the intra prediction mode of the current block is determined, prediction samples of the current block may be obtained based on the determined intra prediction mode S2403.
[0412] When the DC mode is selected, the prediction sample for the current block may be generated based on the average value of the reference samples. Specifically, 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 the top reference sample adjacent to the top of the current block and the left reference sample adjacent to the left of the current block.
[0413] The number or range of reference samples used when deriving the average value may vary based on the shape of the current block. In an example, when the current block is a non-square block with a width greater than a height, the average value may be calculated by using the top reference sample. Conversely, when the current block is a non-square block with a width less than a height, the average value may be calculated by using the left reference sample. In other words, when the width and height of the current block are different, reference samples adjacent to the larger length may be applied in order to calculate the average value. Alternatively, whether to calculate the average value by using the top reference sample or by using the left reference sample may be determined based on the ratio between the width and the height of the current block.
[0414] When the planar mode is selected, the prediction sample may be obtained by using the horizontal prediction sample and the vertical prediction sample. In this regard, the horizontal prediction sample may be obtained based on the left reference sample and the right reference sample located at the same horizontal line as the prediction sample, and the vertical prediction sample may be obtained based on the top reference sample and the bottom reference sample located at 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 bottom 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 top reference sample and the bottom 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, 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.
[0415] When a directional prediction mode is selected, a parameter representing a prediction direction (or a prediction angle) of the selected directional prediction mode may be determined. Table 4 below represents an intra directional parameter intraPredAng for each intra prediction mode.
[0416] [Form 4]
[0417]
[0418]
[0419] Table 4 represents the intra-frame direction parameters 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 more than 33 directional intra-frame prediction modes are defined, the intra-frame direction parameters of each intra-frame prediction mode can be set by finely dividing Table 4. The top reference sample and the left reference sample of 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 top reference sample can be arranged in a line.
[0420] Fig.26 and Fig. 27 are diagrams each showing an example of a one-dimensional arrangement in which reference spots are arranged in a line.
[0421] Fig.26 is a diagram showing a one-dimensional arrangement of reference samples arranged in the vertical direction, and Fig. 27is a diagram showing a horizontal one-dimensional arrangement of reference samples arranged in the horizontal direction. The following description will be made assuming that 35 intra prediction modes are defined. Fig.26 and Fig. 27 .
[0422] When the intra prediction mode index is any one of 11 to 18, a one-dimensional arrangement in the horizontal direction may be applied, wherein the top reference sample is rotated counterclockwise, and when the intra prediction mode index is any one of 19 to 25, a one-dimensional arrangement in the vertical direction may be applied, wherein the left reference sample is rotated clockwise. When arranging the reference samples in a line, the intra prediction mode angle may be considered.
[0423] The reference sample determination parameter may be determined based on the intra direction parameter. The reference sample determination parameter may include a reference sample index for specifying a sample, and a weighting factor parameter for determining a weighting factor applied to the reference sample.
[0424] The reference sample index iIdx and the weighting factor parameter ifact may be obtained by the following Equations 10 and 11, respectively.
[0425] [Equation 10]
[0426] iIdx=(y+1)*P ang / 32
[0427] [Equation 11]
[0428] i fact =[(y+1)*P ang ]&31
[0429] 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.
[0430] In order to derive the prediction sample, at least one reference sample is specified. Specifically, according to the slope of the prediction mode, the position of the reference sample used to derive the prediction sample can be specified. In an example, the reference sample used to derive the prediction sample can be specified by using the reference sample index iIdx.
[0431] In this regard, when the slope of the intra-frame 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-frame prediction mode is a value between the slope between the prediction sample and the first reference sample and the slope between the prediction sample and the 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 the intra-frame 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 the top and bottom of the position through which the angle line passes.
[0432] The following Equation 12 represents an example of obtaining a prediction sample based on a reference sample.
[0433] [Equation 12]
[0434] P(x,y)=((32-i fact ) / 32)*Ref_1D(x+iIdx+1)+(i fact / 32)*Ref_1D(x+iIdx+2)
[0435] 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.
[0436] When the slope of the intra prediction mode can be represented by a reference sample, the weighting factor parameter i fact is set to 0. Therefore, Equation 12 can be simplified to the following Equation 13.
[0437] [Equation 13]
[0438] P(x, y) = Ref_1D(x+iIdx+1)
[0439] Intra prediction for the current block may be performed based on a plurality of intra prediction modes. In an example, an intra prediction mode may be derived for each prediction sample, and the prediction sample may be derived based on the intra prediction mode assigned to each prediction sample.
[0440] Optionally, an intra prediction mode may be derived for each region, and intra prediction for each region may be performed based on the intra prediction mode assigned to each region. In this regard, the region may include at least one sample. At least one of the size and shape of the region may be adaptively determined based on at least one of the size of the current block, the shape of the current block, and the intra prediction mode of the current block. Optionally, at least one of the size and shape of the region may be predefined in the encoder and the decoder independently of the size or shape of the current block.
[0441] Fig.28 is a diagram showing the degree formed between a directional intra prediction mode and a straight line parallel to the x-axis.
[0442] As in Fig.28 In the example shown in , the directional prediction mode may exist between the lower left diagonal direction and the upper right diagonal direction. When describing the degree formed between the x-axis and the directional prediction mode, the directional prediction mode may exist from 45 degrees (lower left diagonal direction) to -135 degrees (upper right diagonal direction).
[0443] 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.
[0444] Fig.29 is a diagram illustrating an aspect of obtaining prediction samples when the current block is non-square.
[0445] In the example, as Fig.29 In the example shown in (a) of FIG. 1 , it is assumed that the current block is a non-square with a width greater than a height, and the intra prediction mode of the current block is a directional intra prediction mode with an angle of 0 to 45 degrees. In the above case, when the prediction sample A around the column on the right side of the current block is derived from the reference samples located at the angular mode according to the above angle, there may be a case where the left reference sample L far from the prediction sample is used instead of the top reference sample T close to the prediction sample.
[0446] In another example, as Fig.29 In the example shown in (b), it is assumed that the current block is a non-square 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 the above case, when the prediction sample A around the bottom row of the current block is derived from the reference sample located at the angular mode according to the above angle, there may be a case where the top reference sample T far from the prediction sample is used instead of the left reference sample L close to the prediction sample.
[0447] In order to solve the above problem, when the current block is non-square, the intra prediction mode of the current block can be replaced by the intra prediction mode in the opposite direction. Fig.25 The directional prediction mode of the angle of the directional prediction mode shown in . The above 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.
[0448] Fig.30 is a diagram illustrating a wide-angle intra prediction mode.
[0449] exist Fig.30 In the example shown in , the intra prediction modes having indices from -1 to -14 and the intra prediction modes having indices from 67 to 80 represent the wide-angle intra prediction modes.
[0450] exist Fig.30 , 14 wide-angle intra prediction modes (from -1 to -14) with angles greater than 45 degrees and 4 wide-angle intra prediction modes (from 67 to 80) with angles less than -135 degrees are shown. However, a greater or lesser number of wide-angle intra prediction modes may be defined.
[0451] When the wide-angle intra prediction mode is used, the length of the top reference sample may be set to 2W+1, and the length of the left reference sample may be set to 2H+1.
[0452] By using the wide-angle intra prediction mode, the reference sample T can be used to predict Fig.30 The sample point A shown in (a) can be predicted by the reference sample point L Fig.30 Sample point A shown in (b).
[0453] In addition to the conventional intra prediction mode and the N wide-angle intra prediction modes, a total of 67+N intra prediction modes may be used. In an example, Table 5 represents intra direction parameters for intra prediction modes when 20 wide-angle intra prediction modes are defined.
[0454] [Form 5]
[0455]
[0456]
[0457] When the current block is non-square and the intra prediction mode of the current block obtained in S2502 belongs to the transformation range, the intra prediction mode of the current block can be transformed into a wide-angle intra prediction mode. The transformation range can be determined based on at least one of the size, shape or ratio of the current block. In this regard, the ratio may represent the ratio of the width to the height of the current block. When the current block is non-square with a width greater than the height, the transformation range may be set to the intra prediction mode index in the upper right diagonal direction (e.g., 66) to (intra prediction mode index in the upper right diagonal direction-N). In this regard, N may be determined based on the ratio of the current block. When the intra prediction mode of the current block belongs to the transformation range, the intra prediction mode may be transformed into a wide-angle intra prediction mode. The transformation may be to subtract a predefined value from the intra prediction mode, and the predefined value may be the total number of intra prediction modes that do not include the wide-angle intra prediction mode (e.g., 67).
[0458] In the above example, the intra prediction modes No. 66 to No. 53 may be transformed into the wide-angle intra prediction modes No. -1 to No. -14, respectively.
[0459] When the current block is a non-square with a height greater than a width, the transformation range may be set to be from the intra prediction mode index in the lower left diagonal direction (e.g., 2) to (the intra prediction mode index in the lower left diagonal direction + M). In this regard, M may be determined based on the ratio of the current block. When the intra prediction mode of the current block belongs to the transformation range, the intra prediction mode may be transformed into a wide-angle intra prediction mode. The transformation may be to add a predefined value to the intra prediction mode, and the predefined value may be the total number of directional intra prediction modes (e.g., 65) other than the wide-angle intra prediction mode.
[0460] In the above example, the intra prediction modes No. 2 to No. 15 may be transformed into the wide-angle intra prediction modes No. 67 to No. 80, respectively.
[0461] Hereinafter, the intra prediction mode belonging to the transform range is referred to as a wide-angle intra prediction alternative mode.
[0462] The transform range may be determined based on the ratio of the current block. In an example, Table 6 and Table 7 respectively show transform ranges for a case where 35 intra prediction modes other than the wide intra prediction mode are defined and a case where 67 intra prediction modes other than the wide intra prediction mode are defined.
[0463] [Form 6]
[0464]
[0465]
[0466] [Form 7]
[0467]
[0468] As shown in Table 4 and Table 5, the number of wide-angle intra prediction replacement modes included in the transform range may vary according to the ratio of the current block. The ratio of the current block may be further finely divided to set the transform range as shown in Table 8 below.
[0469] [Form 8]
[0470]
[0471]
[0472] When a non-adjacent reference sample line is determined as a reference sample line of a current block, or when a multi-line intra prediction encoding method for selecting one of a plurality of reference sample lines is used, the prediction method may be configured not to use a wide-angle intra prediction mode. That is, although the current block has a non-square shape and the intra prediction mode of the current block belongs to the transformation range, the intra prediction mode of the current block may not be transformed into a wide-angle intra prediction mode. Alternatively, when the intra prediction mode of the current block is determined as a wide-angle intra prediction mode, the prediction method may be configured so that a non-adjacent reference sample line is not used as a reference sample line of the current block, or the prediction method may be configured not to use a multi-line intra prediction encoding method for selecting one of a plurality of reference sample lines. When the multi-line intra prediction encoding method is not used, an adjacent reference sample line may be determined as a reference sample line of the current block.
[0473] When the wide-angle intra prediction mode is not used, each of refW and refH may be set to the sum of nTbW and nTbH. Therefore, a non-adjacent reference sample line spaced i from the current block may include (nTbW+nTbH+offsetX[i]) top reference samples and (nTbW+nTbH+offsetY[i]) left reference samples in addition to the upper left reference sample. That is, a non-adjacent reference sample line spaced 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 one example, when the value of offsetX may be set to 1, the value of offsetY may be set to 0. Conversely, when the value of whRatio is less than 1, the value of offsetY may be set to a value greater than offsetX. In one example, the value of offsetX may be set to 0, and the value of offsetY may be set to 1.
[0474] Since the wide-angle intra-prediction mode is used in addition to the conventional intra-prediction mode, resources for encoding the wide-angle intra-prediction mode may be increased, and thus encoding efficiency may be reduced. Therefore, an alternative intra-prediction mode of the wide-angle intra-prediction mode is encoded instead of encoding the wide-angle intra-prediction mode as it is, in order to improve encoding efficiency.
[0475] In an example, when the current block is encoded by using the wide-angle intra prediction mode numbered 67, number 2 may be encoded as the intra prediction mode of the current block, where number 2 is the wide-angle replacement intra prediction mode numbered 67. In addition, when the current block is encoded by using the wide-angle intra prediction mode numbered -1, number 66 may be encoded as the intra prediction mode of the current block, where number 67 is the wide-angle replacement intra prediction mode numbered -1.
[0476] The decoder may decode the intra prediction mode of the current block and determine whether the decoded intra prediction mode belongs to the transformation range. When the decoded intra prediction mode is the wide-angle replacement intra prediction mode, the intra prediction mode may be transformed into the wide-angle intra prediction mode.
[0477] Alternatively, when the current block is encoded by the wide-angle intra prediction mode, the wide-angle intra prediction mode may be encoded as it is.
[0478] The encoding of the intra prediction mode may be performed based on the MPM list described above. Specifically, when the neighboring block is encoded in 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.
[0479] The coding block or transform block may be partitioned into a plurality of sub-blocks (or sub-partitions). When the coding block or transform block is partitioned into a plurality of sub-blocks, prediction, transformation, and quantization may be performed for each sub-block. Dividing the coding block or transform block into a plurality of sub-blocks may be defined as a sub-partition intra coding method.
[0480] 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 one 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.
[0481] Alternatively, whether to apply the sub-partition intra-coding method 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 one example, when the intra-prediction mode of the coding block is a non-directional intra-prediction mode (e.g., a plane or DC mode) or a predefined directional intra-prediction mode (e.g., a horizontal intra-prediction mode, a vertical intra-prediction mode, or a diagonal intra-prediction mode), the sub-partition intra-coding method may not be applied. Alternatively, when the size of the coding block is less than a threshold, the sub-partition intra-coding method may not be applied.
[0482] Optionally, when intra prediction of a subblock is performed based on an intra prediction mode of a coding block, whether to apply the subpartition intra coding method may be determined based on whether the reconstructed samples included in the neighboring subblocks should be used as reference samples in intra prediction of the corresponding subblock. In one example, when the intra prediction mode of the coding block is a diagonal intra prediction mode or a wide-angle intra prediction mode, and when the reconstructed samples included in the neighboring subblocks cannot be used as reference samples when intra prediction is performed for the corresponding subblock based on the intra prediction mode, the subpartition intra coding method may not be applied.
[0483] Optionally, when the aspect ratio of the coding block is greater than or less than a threshold, the sub-partition intra-coding method may not be applied. Optionally, when at least one of the height or width of the coding block is less than a threshold, the sub-partition intra-coding method may not be applied. In one example, when the width or height of the coding block is less than a threshold, or when both the height and width of the coding block are less than a threshold, the sub-partition intra-coding method may not be applied. Optionally, when the number of samples included in the coding block is less than or equal to a threshold, the sub-partition intra-coding method may not be applied. The threshold may have a value predefined in the encoder and the decoder. Optionally, information for determining the threshold may be transmitted by a signal in the bitstream.
[0484] Alternatively, whether to signal a flag indicating whether to apply the sub-partition intra-coding method 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 one example, only when both the height and width of the coding block are less than a threshold and / or the size of the coding block is greater than a threshold, the flag indicating whether the sub-partition intra-coding method is applied may be encoded in the bitstream and the flag indicating whether the sub-partition intra-coding method is applied may be signaled. 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.
[0485] When the subpartition intra coding method is not applied, the signaling of the syntax element intra_subpartitions_mode_flag may be omitted. When the signaling of the flag is omitted, the flag may be considered to indicate that the subpartition intra coding method is not applied.
[0486] When the sub-partition intra coding method is applied, the partition type of the coding block or the transform block may be determined. In this regard, the partition type indicates the direction of the partition of the coding block or the transform block. In one example, vertical partitioning refers to partitioning the coding block or the transform block using at least one vertical line. Horizontal partitioning may refer to partitioning the coding block or the transform block using at least one horizontal line.
[0487] Fig.31 is a diagram showing an example of vertical partitioning and horizontal partitioning.
[0488] Fig.31 (a) shows an example of dividing a coding block into two sub-blocks, Fig.31 (b) shows an example of dividing a coding block into four sub-blocks.
[0489] Information for determining the partition type of a coding block or a transform block may be signaled in a bitstream. In one example, information indicating whether vertical partitioning or horizontal partitioning is applied to a coding block or a transform block may be signaled in a bitstream. The information may be a 1-bit flag intra_subpart_type_flag. When the value of the flag value is 1, it indicates that the coding block or the transform block is partitioned in the horizontal direction, and when the flag value is 0, it indicates that the coding block or the transform block is partitioned in the vertical direction.
[0490] 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 one example, the partition type of the coding block may be determined based on the ratio of the width to the height of the coding block. For example, when the value of whRatio representing the aspect ratio of the coding block is greater than or equal to a first threshold, vertical partitioning may be applied to the coding block. Otherwise, horizontal partitioning may be applied to the coding block.
[0491] Fig.32 is a diagram illustrating an example of determining a partition type of a coding block.
[0492] For ease of description, it is assumed that the first threshold is 2. Fig.32 In the example shown in (a), the whRatio of the coding block is 1, and thus 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.
[0493] exist Fig.32 In the example shown in (b), the whRatio of the coding block is 2 and equal to 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.
[0494] A second threshold having a sign opposite to that of the first threshold may be used to determine the partition type of the coding block. In one example, when the value of whRatio is less than the second threshold, horizontal partitioning may be applied to the coding block. Otherwise, vertical partitioning may be applied to the coding block. The absolute values of the first threshold and the second threshold may be the same, and the first threshold and the second threshold may have opposite signs. In one example, when the first threshold is N (where N is an integer such as 1, 2, 4, etc.), the second threshold may be -N.
[0495] Fig.33 is a diagram illustrating an example of determining a partition type of a coding block.
[0496] For ease of description, it is assumed that the second threshold is -2. Fig.33 In the example shown in (a), the whRatio of the coding block is -1 and is greater than the second 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.
[0497] exist Fig.33 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.
[0498] Optionally, the partition type of the coding block may be determined based on a first threshold and a second threshold. In one example, when the value of whRatio is greater than the first threshold, horizontal partitioning may be applied to the coding block. When the value of whRatio is 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, information may be parsed from the bitstream, and the partition type of the current block may be determined based on the parsed information.
[0499] The first threshold and the second threshold may be predefined in the encoder and the decoder. Alternatively, the first threshold and the second threshold may be defined for each sequence, each picture or each slice.
[0500] Optionally, the partition type may be determined based on the size of the coding block or the transform block. In one example, when the size of the coding block is N×n, vertical partitioning may be applied. When the size of the coding block is n×N, horizontal partitioning may be applied. In this regard, n may be a natural number less than N. N and / or n may be predefined values in the encoder and decoder. Optionally, information for determining N and / or N may be signaled in the bitstream. In one example, N may be 32, 64, 128, or 256, etc. Therefore, when the size of the coding block is 128×n (where n is a natural number such as 16, 32, or 64), vertical partitioning may be applied. When the size of the coding block is n×28, horizontal partitioning may be applied.
[0501] 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 one example, when the intra prediction mode of the coding block has a horizontal direction or a direction similar to the horizontal direction, vertical partitioning may be applied to the coding block. In this regard, the intra prediction mode in a direction similar to the horizontal direction may refer to an index corresponding to the horizontal intra prediction mode (e.g., in Fig.25 In contrast, when the intra prediction mode of the coding block has a vertical direction or a direction similar to the vertical direction, horizontal partitioning may be applied to the coding block. In this regard, the intra prediction mode in a direction similar to the vertical direction may refer to an intra prediction mode with an index difference of the vertical intra prediction mode (e.g., INTRA_ANGULAR18±N) less than a threshold. Fig.25 In the intra prediction mode (e.g., INTRA_ANGULAR50±N) whose index difference is less than a threshold value (e.g., INTRA_ANGULAR50±N) shown in (b) of FIG. 1 ). In this regard, the threshold value N may be a predefined value in the encoder and the decoder. Optionally, information for determining the threshold value N may be transmitted by signaling at the sequence, picture, or slice level.
[0502] Fig.34 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.
[0503] As in Fig.34 In the example shown in (a) of FIG. 4 , when the intra prediction mode of the coding block is in a direction similar to the vertical direction, horizontal partitioning may be applied to the coding block.
[0504] On the contrary, as in Fig.34 In the example shown in (b) of FIG. 4 , when the intra prediction mode of the coding block is in a direction similar to the horizontal direction, vertical partitioning may be applied to the coding block.
[0505] In contrast to the illustrated example, when the intra prediction mode of the coding block is in the horizontal direction or a direction similar to the horizontal direction, horizontal partitioning may be applied. When the intra prediction mode of the coding block is in the vertical direction or a direction similar to the vertical direction, vertical partitioning may be applied.
[0506] The partition type of the coding block or the transform block may be determined based on whether at least one of the width or the height of each of the sub-blocks generated by partitioning the coding block or the transform block based on the vertical partition is less than a threshold. In this regard, the threshold may be an integer such as 2, 4, or 8.
[0507] Fig.35 is a diagram for describing partitions of a coding block.
[0508] When horizontal partitioning is applied to Fig.35 When the coding block of size 4×8 is used as shown in (a), the coding block is partitioned into two sub-blocks, each of which has a size of 2×8. In this case, since the width of the sub-block is less than the threshold, horizontal partitioning may not be available for the coding block. In contrast, when vertical partitioning is applied to a coding block of size 4×8, the coding block is partitioned into two sub-blocks, each of which has a size of 4×4. Since both the width and height of the sub-block are 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.
[0509] When vertical partitioning is applied to Fig.35 When the coding block of size 8×4 is used as shown in (b), the coding block is partitioned into two sub-blocks, each of which has a size of 8×2. In this case, since the height of the sub-block is less than the threshold, vertical partitioning may not be applicable to the coding block. In contrast, when horizontal partitioning is applied to a coding block of size 8×4, the coding block is partitioned into two sub-blocks, each of which has a size of 4×4, and since both the width and height of the sub-block are greater than the threshold, horizontal partitioning can be applied to the coding block. Since only horizontal 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.
[0510] When both vertical partitioning and horizontal partitioning are available, information indicating a partition type of a coding block may be parsed, and then the partition type of the coding block may be determined based on the parsed information.
[0511] 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 one example, when one of the width and height of the coding block is 8 and the other of the width and height is 4, the coding block may be partitioned into two sub-blocks. On the contrary, when both the width and height of the coding block are 8 or greater, or when one of the width and height of the coding block is greater than 8, the coding block may be divided into four sub-blocks. In short, when the coding block is 4×4 in size, the coding block may not be partitioned into sub-blocks. When the coding block is 4×8 or 8×4 in size, the coding block may be partitioned into two sub-blocks. In other cases, the coding block may be partitioned into four sub-blocks.
[0512] 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 based on the information indicating the number of sub-blocks. Alternatively, the number of sub-blocks may be determined based on the information indicating the size or shape of the sub-block.
[0513] 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 one example, based on the intra-prediction mode of the neighboring blocks adjacent to the coding block, the MPM for the coding block can be derived, and then the intra-prediction mode of the coding block can be determined based on the derived MPM. When the intra-prediction mode of the coding block is determined, the determined intra-prediction mode can be used to perform intra-prediction of each sub-block.
[0514] 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. That is, when the sub-partition intra coding method is applied, the MPM flag may be considered true even if the MPM flag is not signaled.
[0515] 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 one example, a horizontal intra-prediction mode, a vertical intra-prediction mode, a diagonal intra-prediction mode (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) and a non-directional intra-prediction mode (e.g., at least one of the plane mode or the DC mode) 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 transmitted by signal in the bitstream. Optionally, the number and / or type of the candidate intra-prediction mode may vary according to the partition direction of the coding block. In one example, when horizontal partitioning is applied to the coding block, at least one of the non-directional intra-prediction mode, the vertical intra-prediction mode, the upper left diagonal intra-prediction mode, or the upper right diagonal intra-prediction mode may be set as the candidate intra-prediction mode. In contrast, when vertical partitioning is applied to a coding block, at least one of a non-directional intra prediction mode, a horizontal intra prediction mode, a top-left diagonal intra prediction mode, or a bottom-left diagonal intra prediction mode may be set as a candidate intra prediction mode.
[0516] According to an embodiment of the present disclosure, the intra-frame prediction mode of at least one of the sub-blocks may be set to be different from the intra-frame prediction modes of other sub-blocks. In one example, the intra-frame prediction mode of the Nth sub-block may be 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. The offset may be predefined in the encoder and the decoder. Optionally, the offset may be derived based on at least one of the size, shape or intra-frame prediction mode of the coding block, the size or shape of the sub-block, the number of sub-blocks, or the partition direction of the coding block. Optionally, information for deriving the offset may be transmitted by signal in the bitstream.
[0517] Optionally, when the intra prediction mode of the (N-1)th subblock is a non-directional mode, the intra prediction mode of the Nth subblock may be set to be the same as the intra prediction mode of the (N-1)th subblock. When the intra prediction mode of the (N-1)th subblock is a directional mode, the intra prediction mode derived by adding an offset to the intra prediction mode of the (N-1)th subblock or subtracting an offset from the intra prediction mode of the (N-1)th subblock may be set to be the same as the intra prediction mode of the Nth subblock.
[0518] Optionally, the directional intra prediction mode may be applied to some of the plurality of sub-blocks, while the non-directional intra prediction mode may be applied to the remaining sub-blocks. The sub-block to which the non-directional intra prediction mode is applied may be determined based on at least one of the size, shape or position of the sub-block or the number of sub-blocks. Optionally, the non-directional intra prediction mode may be applied to another sub-block of the plurality of sub-blocks only when the directional intra prediction mode applied to one of the plurality of sub-blocks has a predefined value.
[0519] Alternatively, the intra prediction mode of each subblock may be derived from the MPM. To this end, index information specifying one of the MPMs may be signaled for each subblock.
[0520] Optionally, the intra prediction mode of each sub-block may be derived from predefined candidate intra prediction modes. To this end, index information specifying one of the predefined candidate intra prediction modes may be signaled for each sub-block. Different sub-blocks may have different numbers and / or types of candidate intra prediction modes.
[0521] Alternatively, information indicating whether intra prediction modes of subblocks are set to be the same as each other may be signaled in a bitstream.
[0522] The quantization parameters of the sub-blocks may be determined individually. Therefore, the quantization parameter values for each sub-block may be set differently. In order to determine the quantization parameter of each sub-block, information indicating the difference between the quantization parameter of the sub-block and the quantization parameter of the previous sub-block may be encoded. In one example, in order to determine the quantization parameter of 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.
[0523] Intra-frame prediction of a sub-block may be performed using reference samples. In this regard, the reference samples may be derived from reconstructed samples of a neighboring block adjacent to the sub-block. When a neighboring block adjacent to a sub-block is included in the same coding block including the sub-block, the reference samples of the sub-block may be derived based on the reconstructed samples of the neighboring sub-block. In one example, when a first sub-block is located to the left or top of a second sub-block, the reference samples of the second sub-block may be derived from the reconstructed samples of the first sub-block. To this end, parallel intra-frame prediction may not be applied between sub-blocks. That is, encoding / decoding may be performed sequentially on the sub-blocks included in the coding block. Therefore, after encoding / decoding of the first sub-block is completed, intra-frame prediction of the second sub-block may be performed.
[0524] When the sub-partition intra-frame coding method is applied, the multi-line intra-frame prediction coding method of selecting a reference sample line candidate from a plurality of reference sample line candidates may not be applied. When the multi-line intra-frame prediction coding method is not applied, 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-frame coding method is applied may be omitted. When the encoding of the syntax element intra_subpartitions_mode_flag is omitted, the sub-partition intra-frame coding method may not be applied.
[0525] Optionally, even when the sub-partition intra encoding method is applied, the multi-line intra prediction encoding method may be used. To this end, index information for specifying a reference sample line for each sub-block may be signaled in a bitstream. Optionally, index information for specifying a reference sample line may be signaled in a bitstream for only one sub-block among a plurality of sub-blocks, and this index information may be applied to the remaining sub-blocks. Optionally, index information for specifying a reference sample line for a coding block may be signaled, and the plurality of sub-blocks included in the coding block may share the index information.
[0526] Optionally, only sub-blocks with predefined positions or predefined partition indexes among the sub-blocks may be configured to use the multi-line intra-frame prediction encoding method. In one example, index information specifying one of the reference sample line candidates may be signaled only for the sub-block with partition index 0 among the plurality of sub-blocks or the sub-block adjacent to the top boundary or the left boundary of the coding block. In this regard, the multi-line intra-frame prediction encoding method may not be applied to the remaining sub-blocks. Therefore, the intra-frame prediction of the remaining sub-blocks may be performed using adjacent reference sample lines.
[0527] The prediction coding mode for each sub-block may be different. In one example, intra prediction may be applied to some sub-blocks, while inter prediction, current picture reference, or combined prediction may be applied to the remaining sub-blocks.
[0528] Fig.36 is a diagram showing an example of differently setting a prediction encoding mode for each subblock.
[0529] The intra prediction mode or prediction coding mode for each sub-block can be set differently. Fig.36 In the example shown in , intra prediction may be applied to subblock 0 and subblock 1, while current picture reference may be applied to subblock 1 and subblock 2.
[0530] When the current picture reference is used, the prediction block of the subblock can be derived from the pre-decoded area of the current picture or slice (or tile group). When the current picture reference is applied, a motion vector can be derived to specify the prediction block of the subblock. The motion vector under the current picture reference can be called a "block vector".
[0531] The motion vector may be derived based on motion vectors of neighboring blocks of the coding block or sub-block. Alternatively, information for determining the motion vector may be signaled in the bitstream.
[0532] In this regard, the maximum value of the motion vector of the sub-block may be determined based on the size of the sub-block or the size of the coding block or transform block to which the sub-block belongs. In one example, the motion vector of the sub-block may be set not to exceed the boundary of the coding block or transform block to which the sub-block belongs. That is, the prediction block of the sub-block may be derived from a pre-encoded / pre-decoded area in the coding block to which the sub-block belongs.
[0533] Index information indicating one of the pre-decoded sub-blocks in the coding block may be encoded and signaled in the bitstream instead of the motion vector. The prediction block of the sub-block may be determined as the pre-decoded sub-block specified by the index information.
[0534] In another example, the motion vector of a sub-block may be allowed to exceed the boundary of the coding block or transform block to which the sub-block belongs.
[0535] When a prediction block is generated as a result of performing intra prediction, each of the prediction samples may be updated based on the position of each of the prediction samples included in the prediction block. The updating method may be referred to as a sample position-based intra weighted prediction method (or Position Dependent Prediction Combination: PDPC).
[0536] Whether to apply 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, or the color component. In one example, PDPC may be applied when the intra prediction mode of the current block is at least one of a plane mode, a DC mode, a vertical direction mode, a horizontal direction mode, a mode with an index value less than the index value of the vertical direction mode, or a mode with an index value greater than the index value of the horizontal direction mode. Optionally, PDPC may be applied only when at least one of the width and height of the current block is greater than 4. Optionally, PDPC may be applied only when the index of the reference picture line of the current block is 0. Optionally, PDPC may be applied only when the index of the reference picture line of the current block is greater than a predefined value. Optionally, PDPC may be applied only to the luminance component. Optionally, whether to apply PDPC may be determined based on whether two or more of the conditions listed above are met.
[0537] Alternatively, whether to apply PDPC may be determined based on whether a sub-partition intra-coding method is applied. In one example, when a sub-partition intra-coding method is applied to a coding block or a transform block, PDPC may not be applied. Alternatively, when a sub-partition intra-coding method is applied to a coding block or a transform block, PDPC may be applied to at least one of a plurality of sub-blocks. In this regard, the sub-block to which PDPC is to be applied may 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 one example, PDPC may be applied to a sub-block adjacent to the top boundary and / or the left boundary of the coding block or to a sub-block adjacent to the bottom boundary and / or the right boundary of the coding block. Optionally, based on the size or shape of the sub-block, PDPC may be applied to all sub-blocks included in the coding block, or PDPC may not be applied to all sub-blocks included in the coding block. In one example, when at least one of the width or height of the sub-block is less than a threshold, the application of PDPC may be omitted. In another example, PDPC may be applied to all sub-blocks in the coding block.
[0538] Optionally, whether to apply PDPC to each sub-block may be determined based on whether at least one of the size, shape, intra-prediction mode, or reference picture index of each sub-block generated by partitioning the coding block or the transform block satisfies a preset condition. In one example, when at least one of the width or height of the sub-block is greater than 4, PDPC may be applied to the sub-block.
[0539] In another example, information indicating whether PDPC is applied may be signaled in the bitstream.
[0540] Optionally, the area to which PDPC is applied may be determined based on at least one of the size, shape, or position of the intra prediction mode or prediction sample of the current block. In one example, when the index of the intra prediction mode of the current block is greater than the index of the vertical direction mode, at least one of the prediction samples whose x-axis coordinates or y-axis coordinates are greater than a threshold value may not be corrected, and correction may be performed only on the prediction samples whose x-axis coordinates or y-axis coordinates are less than or equal to the threshold value. Optionally, when the index of the intra prediction mode of the current block is less than the index of the horizontal direction mode, at least one of the prediction samples whose x-axis coordinates or y-axis coordinates are greater than a threshold value may not be corrected, and correction may be performed only on the prediction samples whose x-axis coordinates or y-axis coordinates are less than or equal to the threshold value. In this regard, the threshold may be determined based on at least one of the size, shape, or intra prediction mode of the current block.
[0541] When the prediction sample is obtained via intra prediction, a reference sample for correcting the obtained prediction sample may be determined based on the position of the obtained prediction sample. For ease of description, in an embodiment as described later, the reference sample for correcting the prediction sample may be referred to as a PDPC reference sample. In addition, the prediction sample obtained via intra prediction may be referred to as a first prediction sample, and the prediction sample obtained by correcting the first prediction sample may be referred to as a second prediction sample.
[0542] Fig.37 is a diagram illustrating application aspects of PDPC.
[0543] At least one PDPC reference sample may be used to correct the first prediction sample. The PDPC reference sample may include at least one of an upper left reference sample adjacent to an upper left corner of the current block, a top reference sample at the top of the current block, or a left reference sample at the left side of the current block.
[0544] At least one of the reference samples included in the reference sample line of the current block may be set as the PDPC reference sample. Alternatively, regardless of the reference sample line of the current block, at least one of the reference samples belonging to the reference sample line with index 0 may be set as the PDPC reference sample. In one example, even when the first prediction sample is obtained using the reference sample included in the reference sample line with index 1 or index 2, the second prediction sample may be obtained using the reference sample included in the reference sample line with index 0.
[0545] The number or position of the PDPC reference samples used to correct the first prediction samples may be determined based on at least one of an intra prediction mode of the current block, a size of the current block, a shape of the current block, or a position of the first prediction samples.
[0546] In one example, when the intra prediction mode of the current block is the planar mode or the DC mode, the second prediction sample may be obtained using the top reference sample and the left reference sample. In this regard, the top reference sample may be a reference sample vertically aligned with the first prediction sample (e.g., a reference sample having the same x-coordinate as the first prediction sample), and the left reference sample may be a reference sample horizontally aligned with the first prediction sample (e.g., a reference sample having the same y-coordinate as the first prediction sample).
[0547] When the intra prediction mode of the current block is a horizontal intra prediction mode, the second prediction sample may be obtained using the top reference sample. In this regard, the top reference sample may be a reference sample vertically aligned with the first prediction sample.
[0548] When the intra prediction mode of the current block is a vertical intra prediction mode, the second prediction sample may be obtained using the left reference sample. In this regard, the left reference sample may be a reference sample horizontally aligned with the first prediction sample.
[0549] When the intra prediction mode of the current block is a lower left diagonal intra prediction mode or an upper right diagonal intra prediction mode, the second prediction sample may be obtained based on the upper left reference sample, the upper reference sample, and the left reference sample. The upper left reference sample may be a reference sample adjacent to the upper left corner of the current block (e.g., a reference sample at a (-1, -1) position). The top reference sample may be a reference sample diagonally located above and to the right of the first prediction sample, and the left reference sample may be a reference sample diagonally located below and to the left of the first prediction sample.
[0550] In summary, when the position of the first prediction sample is (x, y), R(-1, -1) may be set as the upper left reference sample, and R(x+y+1, -1) or R(x, -1) may be set as the top reference sample. In addition, R(-1, x+y+1) or R(-1, y) may be set as the left reference sample.
[0551] In another example, the position of the left reference sample or the top reference sample may be determined based on at least one of the shape of the current block or whether the wide-angle intra mode is applied.
[0552] Specifically, when the intra prediction mode of the current block is the wide-angle intra prediction mode, the reference sample that is offset from the reference sample located in the diagonal direction of the first prediction sample may be set as the PDPC reference sample. In one example, the top reference sample R (x+y+k+1, -1) and the left reference sample R (-1, x+y-k+1) may be set as the PDPC reference sample.
[0553] In this regard, the offset k may be determined based on the wide-angle intra prediction mode. The following Equations 14 and 15 represent examples of deriving an offset based on the wide-angle intra prediction mode.
[0554] [Equation 14]
[0555] k = CurrIntraMode - 66
[0556] if(CurrIntraMode>66)
[0557] [Equation 15]
[0558] k=-CurrIntraMode
[0559] if(CurrIntraMode<0)
[0560] The second prediction sample may be determined based on a weighted sum between the first prediction sample and the PDPC reference sample. In one example, the second prediction sample may be obtained based on the following Equation 16.
[0561] [Equation 16]
[0562] pred(x,y)=(xL*R L +wT*R T -wTL*R TL +(64-wL-wT+wTL)*pred(x,y)+32)>>6
[0563] In Equation 16, R L Represents the left reference sample point, R T represents the top reference sample point, and R TL represents the upper left reference sample. pred(x,y) represents the prediction sample at the (x,y) position. wL represents the weight assigned to the left reference sample, wT represents the weight assigned to the top reference sample, and wTL represents the weight assigned to the upper left reference sample. The weight assigned to the first prediction sample can be derived by subtracting the weight assigned to the reference sample from the maximum value. For ease of description, the weight assigned to the PDPC reference sample may be referred to as the PDPC weight.
[0564] Each weight assigned to each reference sample may be determined based on at least one of an intra prediction mode of the current block or a position of the first prediction sample.
[0565] In one example, at least one of wL, wT, or wTL may be proportional or inversely proportional to at least one of the x-axis coordinate value or the y-axis coordinate value of the prediction sample point. Alternatively, at least one of wL, wT, or wTL may be proportional or inversely proportional to at least one of the width or height of the current block.
[0566] When the intra prediction mode of the current block is the DC mode, the PDPC weight may be determined as in Equation 17 below.
[0567] [Equation 17]
[0568] wT=32>>((y<<1)>>shift)
[0569] wL=32>>((x<<1)>>shift)
[0570] wTL=(wL>>4)+(wT>>4)
[0571] In the above Equation 17, x and y represent the position of the first prediction sample.
[0572] The variable shift used in the bit shift operation in Equation 17 may be derived based on the width or height of the current block. In one example, the variable shift may be derived based on Equation 18 or Equation 19 below.
[0573] [Equation 18]
[0574] shift=(log2(width)-2+log2(height)-2+2)>>2
[0575] [Equation 19]
[0576] shif=((Log2(nTbW)+Log2(nTbH)-2)>>2)
[0577] Optionally, the variable shift may be derived based on an intra direction parameter of the current block.
[0578] The number or type of parameters used to derive the variable shift may vary based on the intra-frame prediction mode of the current block. In one example, when the intra-frame prediction mode of the current block is a plane mode, a DC mode, a vertical direction mode, or a horizontal direction mode, as in the examples shown in Equation 18 or Equation 19 above, the variable shift can be derived using the width (width) and height (height) of the current block. When the intra-frame prediction mode of the current block is an intra-frame prediction mode with an index greater than the index of the vertical intra-frame prediction mode, the height and intra-frame direction parameters of the current block can be used to derive the variable shift. When the intra-frame prediction mode of the current block is an intra-frame prediction mode with an index less than the index of the horizontal intra-frame prediction mode, the width and intra-frame direction parameters of the current block can be used to derive the variable shift.
[0579] When the intra prediction mode of the current block is the planar mode, the wTL value may be set to 0. wL and wT may be derived based on Equation 20 below.
[0580] [Equation 20]
[0581] wT[y]=32>>((y<<1)>>shift)
[0582] wL[x]=32>>((x<<1)>>shift)
[0583] When the intra prediction mode of the current block is a horizontal intra prediction mode, wT may be set to 0, and wTL and wL may be set to be equal to each other. Conversely, when the intra prediction mode of the current block is a vertical intra prediction mode, wL may be set to 0, and wTL and wT may be set to be equal to each other.
[0584] When the intra prediction mode of the current block is an intra prediction mode whose index value in the upper right direction is greater than the index value of the vertical intra prediction mode, the PDPC weight may be derived based on the following Equation 21.
[0585] [Equation 21]
[0586] wT=16>>((y<<1)>>shift)
[0587] wL=16>>((x<<1)>>shift)
[0588] wTL=0
[0589] On the contrary, when the intra prediction mode of the current block is an intra prediction mode whose index value in the lower left direction is smaller than the index value of the horizontal intra prediction mode, the PDPC weight may be derived based on Equation 22 below.
[0590] [Equation 22]
[0591] wT=16>>((y<<1)>>shift)
[0592] wL=16>>((x<<1)>>shift)
[0593] wTL=0
[0594] As in the above-described embodiment, the PDPC weights may be determined based on the locations x and y of the prediction samples.
[0595] In another example, the weight assigned to each of the PDPC reference samples may be determined based on the sub-block. The prediction samples included in the sub-block may share the same PDPC weight.
[0596] The size of the sub-block as a basic unit for determining the weight may be predefined in the encoder and the decoder. In one example, the weight may be determined for each sub-block of a 2×2 size or a 4×4 size.
[0597] Optionally, the size or shape of the sub-block, or the number of sub-blocks, may be determined based on the size or shape of the current block. In one example, regardless of the size of the coding block, the coding block may be partitioned into 4 sub-blocks. Optionally, depending on the size of the coding block, the coding block may be partitioned into 4 or 16 sub-blocks.
[0598] Optionally, the size or shape of the subblock, or the number of subblocks may be determined based on the intra prediction mode of the current block. In one example, when the intra prediction mode of the current block has a horizontal direction, N columns (or N rows) may be set as one subblock. When the intra prediction mode of the current block has a vertical direction, N rows (or N columns) may be set as one subblock.
[0599] The following Equations 23 to 19 represent examples of determining the PDPC weight of a sub-block of a 2×2 size. Equation 23 illustrates a case where the intra prediction mode of the current block is the DC mode.
[0600] [Equation 23]
[0601] wT=32>>(((y<<log2K)> >log2K)<<1)>>shift)
[0602] wL=32>>(((x<<log2K))> >log2K))<<1)>>shift)
[0603] wTL=(wL>>4)+(wT>>4)
[0604] In Equation 23, K may be determined based on the size of the sub-block.
[0605] Equation 24 illustrates a case where the intra prediction mode of the current block is an intra prediction mode having an index value in an upper right direction greater than an index value of a vertical intra prediction mode.
[0606] [Equation 24]
[0607] wT=16>>(((y<<log2K))> >log2K))<<1)>>shift)
[0608] wL=16>>(((x<<log2K))> >log2K))<<1)>>shift)
[0609] wTL=0
[0610] Equation 25 illustrates a case where the intra prediction mode of the current block is an intra prediction mode having an index value in a lower left direction smaller than an index value of a horizontal intra prediction mode.
[0611] [Equation 25]
[0612] wT=16>>(((y<<log2K))> >log2K))<<1)>>shift)
[0613] wL=16>>(((x<<log2K))> >log2K))<<1)>>shift)
[0614] wTL=0
[0615] In each of Equations 23 to 25, x and y represent the position of the reference sample in the subblock. The reference sample may be one of a sample located at the upper left of the subblock, a sample located at the center of the subblock, or a sample located at the lower right of the subblock.
[0616] The following Equations 26 to 28 represent examples of determining the PDPC weight of a sub-block of a 4×4 size. Equation 26 illustrates a case where the intra prediction mode of the current block is the DC mode.
[0617] [Equation 26]
[0618] wT=32>>(((y<<2)>>2)<<1)>>shift)
[0619] wL=32>>(((x<<2)>>2)<<1)>>shift)
[0620] wTL=(wL>>4)+(wT>>4)
[0621] Equation 27 illustrates a case where the intra prediction mode of the current block is an intra prediction mode having an index value in an upper right direction greater than an index value of a vertical intra prediction mode.
[0622] [Equation 27]
[0623] wT=16>>(((y<<2)>>2)<<1)>>shift)
[0624] wL=16>>(((x<<2)>>2)<<1)>>shift)
[0625] wTL=0
[0626] Equation 28 exemplifies a case where the intra prediction mode of the current block is an intra prediction mode having an index value in a lower left direction smaller than an index value of a horizontal intra prediction mode.
[0627] [Equation 28]
[0628] wT=16>>(((y<<2)>>2)<<1)>>shift)
[0629] wL=16>>(((x<<2)>>2)<<1)>>shift)
[0630] wTL=0
[0631] In the above-mentioned embodiment, it has been described that the PDPC weight is determined considering the position of the first prediction sample or the plurality of prediction samples included in the sub-block. In another example, the PDPC weight may be determined based on the shape of the current block.
[0632] In one example, in DC mode, the PDPC weight derivation method may vary depending on whether the current block is a non-square with a width greater than a height or a non-square with a height greater than a width.
[0633] The following equation 29 represents an example of deriving a PDPC weight when the current block is a non-square whose width is greater than its height. The following equation 30 represents an example of deriving a PDPC weight when the current block is a non-square whose height is greater than its width.
[0634] [Equation 29]
[0635] wT=32>>((y<<1)>>shift)
[0636] wL=32>>(x>>shift)
[0637] wTL=(wL>>4)+(wT>>4)
[0638] [Equation 30]
[0639] wT>>(y>>shift)
[0640] wL=32>>(x<<1)>>shift)
[0641] wTL=((xL>>4)+(wT>>4)
[0642] When the current block is non-square, the wide-angle intra prediction mode may be used to predict the current block. In this way, even when the wide-angle intra prediction mode is applied, the first prediction sample may be updated by applying PDPC.
[0643] When wide-angle intra prediction is applied to the current block, the PDPC weight may be determined based on the shape of the coding block.
[0644] In one example, when the current block is a non-square whose width is greater than its height, depending on the position of the first prediction sample, a top reference sample located above and to the right of the first prediction sample may be closer to the first prediction sample than a left reference sample located below and to the left of the first prediction sample. Therefore, when correcting the first prediction sample, the weight applied to the top reference sample may be set to have a larger value than the weight applied to the left reference sample.
[0645] On the contrary, when the current block is a non-square whose height is greater than its width, depending on the position of the first prediction sample, a left reference sample located at the lower left of the first prediction sample may be closer to the first prediction sample than a top reference sample located at the upper right of the first prediction sample. Therefore, when correcting the first prediction sample, the weight applied to the left reference sample may be set to have a larger value than the weight applied to the top reference sample.
[0646] The following Equation 31 represents an example of deriving a PDPC weight when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index greater than 66.
[0647] [Equation 31]
[0648] wT=16>>(y>>shift)
[0649] wL=16>((x<<1)>>shift)
[0650] wTL=0
[0651] Equation 32 represents an example of deriving the PDPC weight when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index less than 0.
[0652] [Equation 32]
[0653] wT=16>>((y<<1)>>shift)
[0654] wL=16>>(x>>shift)
[0655] wTL=0
[0656] Based on the ratio of the current block, the PDPC weight may be determined. The ratio of the current block represents a ratio of a width to a height of the current block and may be defined as the following Equation 33.
[0657] [Equation 33]
[0658] whRatio=CUwidth / CUheight
[0659] Based on the intra prediction mode of the current block, the method for deriving the PDPC weights may vary.
[0660] In one example, the following equations 34 and 35 represent examples of deriving PDPC weights when the intra prediction mode of the current block is the DC mode. Specifically, equation 34 shows an example of deriving PDPC weights when the current block is a non-square whose width is greater than its height. Equation 35 shows an example of deriving PDPC weights when the current block is a non-square whose width is less than its height.
[0661] [Equation 34]
[0662] wT=32>>((y<<1)>>shift)
[0663] wL=32>>(((x<<1)>>whRatio)>>shift)
[0664] wTL=(wL>>4)+(wT>>4)
[0665] [Equation 35]
[0666] wT=32>>(((y<<1)>>1 / whRatio)>>shift)
[0667] wL=32>>((x<<1)>>shift)
[0668] wTL=(wL>>4)+(wT>>4)
[0669] Equation 36 represents an example of deriving the PDPC weight when the intra prediction mode of the current block is a wide angle intra prediction mode with an index greater than 66.
[0670] [Equation 36]
[0671] wT=16>>(((y<<1)>>1 / whRatio)>>shift)
[0672] wL=16>>((x<<1)>>shift)
[0673] wTL=0
[0674] Equation 37 represents an example of deriving the PDPC weight when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index less than 0.
[0675] [Equation 37]
[0676] wT=16>>((y<<1)>>shift)
[0677] wL=16>>(((x<<1)>>whRatio)>>shift
[0678] wTL=0
[0679] The residual image can be derived by subtracting the predicted image from the original image. In this regard, when the residual image is converted into 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.
[0680] DCT is configured to decompose (or transform) the residual image into two-dimensional frequency components using cosine transform, and DST is configured to decompose (or transform) the residual image into 2D frequency components using sine transform. As a result of transforming the residual image, the frequency components can be represented as a base image. In one example, when DCT transform is performed on a block of size N×N, N 2The size of each basic mode component included in the N×N size block can be obtained through transformation. According to the transformation scheme used, the size of the basic mode component can be called a DCT coefficient or a DST coefficient.
[0681] The DCT transform scheme is mainly used to transform images with relatively large non-zero low-frequency components. The DST transform scheme is mainly used to transform images with relatively large high-frequency components.
[0682] It is also possible that a transform scheme other than DCT or DST may be used to transform the residual image.
[0683] Hereinafter, transforming the residual image into 2D frequency components may be referred to as 2D image transform. In addition, the size of each basic mode component obtained as a result of the transform may be referred to as a transform coefficient. In one example, the transform coefficient may refer to a DCT coefficient or a DST coefficient. When both a first transform and a second transform to be described later are applied, the transform coefficient may represent the size of the basic mode component generated as a result of the second transform.
[0684] The transformation method may be determined based on the block. The transformation method may be determined based on at least one of a prediction coding mode for the current block, a size of the current block, or a shape of the current block. In an example, when the current block is encoded by an intra prediction mode and the size of the current block is less than N×N, the transformation may be performed by a transformation method using DST. On the other hand, when the above conditions are not met, the transformation may be performed by a transformation method using DCT.
[0685] For some blocks of the residual image, two-dimensional image transformation may not be performed. Not performing two-dimensional image transformation may be referred to as transform skipping. When transform skipping is applied, quantization may be applied to the residual value for which the transformation is not performed.
[0686] 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 transform may be defined as a first transform, and performing the transform again on the block to which the first transform is applied may be defined as a second transform.
[0687] 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.
[0688] Different transform kernels may be used for the horizontal direction and the vertical direction. Information indicating the combination of the transform kernel for the horizontal direction and the transform kernel for the vertical direction may be signaled in the bitstream.
[0689] The first transform and the second transform may be performed based on different block sizes, respectively. In one example, the first transform may be performed on the basis of a block of 8×8 size, and the second transform may be performed on the basis of a sub-block of 4×4 size of the transformed 8×8 block. Optionally, the second transform may be performed on transform coefficients belonging to three sub-blocks, each of which has a 4×4 size. 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 located at the upper left of the current block, and a sub-block adjacent to the bottom of the sub-block located at the upper left of the current block. Optionally, the second transform may be performed on a block of 8×8 size.
[0690] The transform coefficient of the residual region where the second transform is not performed may be set to zero.
[0691] Alternatively, the first transform may be performed on a 4×4 block, and the second transform may be performed on an 8×8 sized region including the transformed 4×4 block.
[0692] Information indicating whether to perform the second transformation may be transmitted by signaling in the bitstream. In one example, a flag indicating whether to perform the second transformation, or index information specifying whether to perform the second transformation and a transformation core for the second transformation may be transmitted by signaling in the bitstream. In one example, when the index information is 0, this indicates that the second transformation is not performed on the current block. Conversely, when the index information is greater than 0, a transformation core for performing the second transformation may be determined based on the index information.
[0693] Alternatively, whether to perform the second transform may be determined based on whether the horizontal transform kernel is the same as the vertical transform kernel. In one example, the second transform may be performed only when the horizontal transform kernel is the same as the vertical transform kernel. Alternatively, the second transform may be performed only when the horizontal transform kernel and the vertical transform kernel are different from each other.
[0694] Optionally, the second transform may be allowed only when the horizontal transform and the vertical transform are performed by using a predefined transform kernel. In one example, the second transform may be allowed when the DCT2 transform kernel is used for the horizontal transform and the vertical transform. Optionally, when the sub-partition intra coding method is applied to the current block, the second transform may be allowed only when the DCT2 transform kernel is used for the horizontal transform and the vertical transform.
[0695] Alternatively, whether to perform the second 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 second transform may not be applied. When the number of non-zero transform coefficients of the current block is greater than a threshold, the second transform may be applied. The second transform may be applied only when the current block is encoded using intra prediction.
[0696] Alternatively, it may be determined whether to perform the second transform based on the position of the last non-zero transform coefficient of the current block. In one 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, the second transform may not be performed. In this regard, the threshold may be predefined in the encoder and the decoder. Alternatively, the threshold may be determined based on the size or shape of the current block.
[0697] Alternatively, when only the transform coefficient of the DC component exists in the current block, the second transform may not be applied. In this regard, the DC component represents the transform coefficient of the upper left position in the current block.
[0698] Based on the shape of the current block, the size or shape of the subblock on which the second transform is to be performed may be determined.
[0699] Fig.38 and Fig.39 is a diagram showing a subblock on which a second transform is performed.
[0700] When the current block is a square, the first transform may be performed, and then the second transform may be performed on the N×N size sub-block at the upper left of the current block. In one example, when the current block is an 8×8 size coding block, the first transform may be performed on the current block, and then the second transform may be performed on the 4×4 size sub-block at the upper left of the current block (see Fig.38 ).
[0701] When the current block is a non-square whose width is 4 times or more as large as its height, the first transform may be performed, and then the second transform may be performed on the sub-block of (kN)×(4kN) size at the upper left of the current block. In one example, when the current block is a non-square of 16×4 size, the first transform may be performed on the current block, and then the second transform may be performed on the sub-block of 2×8 size at the upper left of the current block (see Fig.39 (a)).
[0702] When the current block is a non-square whose height is 4 times or more as large as its width, the first transform may be performed, and then the second transform may be performed on the sub-block of (4kN)×(kN) size at the upper left of the current block. In one example, when the current block is a non-square of 16×4 size, the first transform may be performed on the current block, and then the second transform may be performed on the sub-block of 2×8 size at the upper left of the current block (see Fig.39 (b)).
[0703] In the decoder, an inverse transform of the second transform (second inverse transform) may be performed, and an inverse transform of the first transform (first inverse transform) may be performed on a result of the second inverse transform. As a result of performing the second inverse transform and the first inverse transform, a residual signal of the current block may be obtained.
[0704] Information indicating a transform type of a current block may be signaled in a bitstream. The information may be index information tu_mts_idx indicating one of a combination of a horizontal transform type and a vertical transform type.
[0705] Based on the transform type candidates specified by the index information tu_mts_idx, a vertical transform kernel and a horizontal transform kernel may be determined. Tables 9 and 10 show transform type combinations based on tu_mts_idx.
[0706] [Form 9]
[0707]
[0708]
[0709] [Form 10]
[0710]
[0711] The transform type may be determined as one of DCT2, DST7, DCT8, or transform skip. Alternatively, only transform kernels other than transform skip may be used to form transform type combination candidates. When Table 9 is used, and when tu_mts_idx is 0, transform skip may be applied to the horizontal and vertical directions. When tu_mts_idx is 1, DCT2 may be applied to the horizontal and vertical directions. When tu_mts_idx is 3, DCT8 may be applied to the horizontal direction, and DCT7 may be applied to the vertical direction.
[0712] When Table 10 is used, and when tu_mts_idx is 0, DCT2 may be applied to the horizontal and vertical directions. When tu_mts_idx is 1, transform skip may be applied to the horizontal and vertical directions. When tu_mts_idx is 3, DCT8 may be applied to the horizontal direction, and DCT7 may be applied to the vertical direction.
[0713] Whether to encode the index information may be determined based on at least one of the size, shape or number of non-zero coefficients of the current block, whether the second transform has been performed, or whether the sub-partition intra-coding method has been applied. In one example, when the sub-partition intra-coding method is applied to the current block, or when the number of non-zero coefficients of the current block is equal to or less than a threshold value, the signal transmission of the index information may be omitted. When the signal transmission of the index information is omitted, a default transform type may be applied to the current block. 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 based on the size, shape or intra-prediction mode of the current block, whether the second transform has been performed, or whether the sub-partition intra-coding method has been applied. In one example, based on whether the width of the current block falls within a preset range, one of the multiple transform types may be determined as a horizontal transform type. Based on whether the height of the current block falls within a preset range, one of the multiple transform types may be determined as a vertical transform type. Optionally, the default mode may vary according to the size, shape or intra-prediction mode of the current block, or whether the second transform has been applied.
[0714] Optionally, when only the transform coefficient of the DC component exists in the current block, each of the horizontal transform type and the vertical transform type may be set to a default transform type. In one example, when only the transform coefficient of the DC component exists in the current block, each of the horizontal transform type and the vertical transform type may be set to DCT2.
[0715] The threshold may be determined based on the size or shape of the current block. In one example, when the size of the current block is less than or equal to 32×32, the threshold may be set to 2. When the current block is larger than 32×32 (e.g., when the current block is a coding block of 32×64 or 64×32 size), the threshold may be set to 4.
[0716] A plurality of lookup tables may be pre-stored in the encoder / decoder. Each of the plurality of lookup tables may be distinguished by at least one of an index value assigned to a transform type combination candidate, a type of the transform type combination candidate, and / or the number of transform type combination candidates.
[0717] The lookup table of the current block may be selected based on at least one of a size, a shape, a prediction coding mode or an intra prediction mode of the current block, whether a second transform has been applied, or whether application of a transform to a neighboring block has been skipped.
[0718] In one example, when the size of the current block is 4×4 or smaller, or when the current block is encoded via inter prediction, the lookup table of Table 9 may be selected. When the size of the current block is greater than 4×4 or when the current block is encoded via intra prediction, the lookup table of Table 10 may be selected.
[0719] Alternatively, information indicating one of the plurality of lookup tables may be signaled in the bitstream. The decoder may select a lookup table for the current block based on the information.
[0720] In another example, the index assigned to the transform type combination candidate may be adaptively determined based on the size, shape, prediction coding mode or intra prediction mode of the current block, whether the second transform has been applied, or whether transform skipping has been applied to at least one of the neighboring blocks. In one example, the value of the index assigned to the transform skip when the size of the current block is 4×4 may be smaller 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 applied to the transform skip. When the current block is greater than 4×4 and less than or equal to 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.
[0721] Alternatively, when the current block is encoded via inter prediction, an index of 0 may be assigned to the transform skip. When the current block is encoded via intra prediction, an index greater than 0 (eg, index 1) may be assigned to the transform skip.
[0722] Optionally, when the current block is 4×4 in size and is encoded via inter-frame prediction, an index of 0 may be assigned to transform skip. Conversely, when the current block is not encoded via inter-frame prediction, or when the size of the current block is greater than 4×4, an index of a value greater than 0 (e.g., index 1) may be assigned to transform skip.
[0723] Transform type combination candidates different from the transform type combination candidates listed in Tables 9 and 10 may be defined and used. In one example, transform skipping may be applied to one of horizontal transform and vertical transform, and a transform type combination candidate to which a transform kernel including DCT2, DCT8, or DST7 is applied may be applied to the other of the horizontal transform and the vertical transform. In this regard, whether transform skipping is used as a horizontal transform type candidate or a vertical transform type candidate may be determined based on a size (e.g., width and / or height), a shape, or at least one of a prediction coding mode or an intra prediction mode of a current block.
[0724] Alternatively, information indicating whether a specific transform type candidate is available may be signaled in the bitstream. In one example, a flag indicating whether transform skipping can be used as a horizontal transform type candidate or a vertical transform type candidate may be signaled in the bitstream. Based on the flag, it may be determined whether a specific transform type combination candidate among a plurality of transform type combination candidates is included.
[0725] Optionally, whether a specific transform type candidate is applied to the current block may be signaled in the bitstream. In one example, a flag cu_mts_flag indicating whether DCT2 is applied to the horizontal direction and the vertical direction may be signaled in the bitstream. When the value of cu_mts_flag is 1, DCT2 may be set as the vertical transform kernel and the horizontal transform kernel. When the value of cu_mts_flag is 0, DCT8 or DST7 may be set as the vertical transform kernel and the horizontal transform kernel. Optionally, when the value of cu_mts_flag is 0, information tu_mts_idx specifying one of a plurality of transform type combination candidates may be signaled in the bitstream.
[0726] When the current block is a non-square whose width is greater than its height or whose height is greater than its width, the encoding of cu_mts_flag may be omitted. Therefore, the value of cu_mts_flag may be inferred to be 0.
[0727] The number of available transform type combination candidates may be set to vary according to the size, shape, or intra prediction mode of the current block. In one example, when the current block is square, three or more transform type combination candidates may be used. When the current block is non-square, two transform type combination candidates may be used. Alternatively, when the current block is square, only transform type combination candidates whose horizontal transform type and vertical transform type are different from each other may be used.
[0728] When there are three or more transform type combination candidates that can be used by the current block, index information tu_mts_idx indicating one of the transform type combination candidates may be signaled in the bitstream. Conversely, when there are two transform type combination candidates that can be used by the current block, a flag mts_flag indicating one of the transform type combination candidates may be signaled in the bitstream. Table 11 below shows encoding of information for specifying transform type combination candidates based on the shape of the current block.
[0729] [Form 11]
[0730]
[0731] According to the shape of the current block, the indexes of the transform type combination candidates may be rearranged (or reordered). In one example, the indexes assigned to the transform type combination candidates when the current block is square may be different from the indexes assigned to the transform type combination candidates when the current block is non-square. In one example, when the current block is square, the transform type combination may be selected based on the following Table 12. When the current block is non-square, the transform type combination may be selected based on the following Table 13.
[0732] [Form 12]
[0733]
[0734] [Form 13]
[0735]
[0736] The transform type may be determined based on the number of horizontal non-zero coefficients or vertical non-zero coefficients of the current block. In this regard, the number of horizontal non-zero coefficients represents the number of non-zero coefficients included in 1×N (where N is the width of the current block). The number of vertical non-zero coefficients represents the number of non-zero coefficients included in N×1 (where N is the height of the current block). When the maximum value of the number of horizontal non-zero coefficients is less than or equal to the threshold, the first transform type may be applied to the horizontal direction. When the maximum value of the horizontal non-zero coefficients is greater than the threshold, the second transform type may be applied to the horizontal direction. When the maximum value of the number of vertical non-zero coefficients is less than or equal to the threshold, the first transform type may be applied to the vertical direction. When the maximum value of the number of vertical non-zero coefficients is greater than the threshold, the second transform type may be applied to the vertical direction. Fig.40 is a diagram for describing an example of determining a transform type of a current block.
[0737] In one example, when the current block is encoded via intra prediction and the maximum value of the number of horizontal non-zero coefficients of the current block is 2 or less (see Fig.40 When (a) is used, DST7 can be determined as the horizontal transformation type.
[0738] When the current block is encoded via intra prediction and the maximum value of the number of vertical non-zero coefficients of the current block is greater than 2 (see Fig.40 (b)), DCT2 or DCT8 can be determined as the vertical transform type.
[0739] Information indicating whether index information for determining a transform type of a current block is explicitly signaled may be signaled in a bitstream. In one example, information sps_explicit_intra_mts_flag indicating whether explicit transform type determination is allowed for a block encoded via intra prediction and / or information sps_explicit_inter_mts_flag indicating whether explicit transform type determination is allowed for a block encoded via inter prediction may be signaled at a sequence level.
[0740] 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 the bitstream. Conversely, when explicit transform type determination is not allowed, the transform type of the current block may be determined based on at least one of the size or shape of the current block, whether subblock-based transform is allowed, the position of the subblock including the non-zero transform coefficient, whether the second transform has been performed, or whether the sub-partition intra-coding method has been applied. In one example, the horizontal transform type of the current block may be determined based on the width of the current block. 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, its horizontal transform type may be determined as DCT2. Otherwise, its horizontal transform type may be determined as DST7. When the height of the current block is less than 4 or greater than 16, its vertical transform type may be determined as DCT2. Otherwise, its vertical transform type may be determined as DST7. In this regard, in order to determine the horizontal transform type and the vertical transform type, a threshold to be compared with the width and the height may be determined based on at least one of the size, shape, or intra-prediction mode of the current block.
[0741] Optionally, when the current block is a square whose height is equal to the width, the horizontal transform type and the vertical transform type may be set to be the same as each other. When the current block is a non-square whose height and width are not equal to each other, the horizontal transform type and the vertical transform type may be set to be different from each other. In one example, when the width of the current block is greater than its height, the horizontal transform type may be determined as DST7, and the vertical transform type may be determined as DCT2. When the height of the current block is greater than the width, the vertical transform type may be determined as DST7, and the horizontal transform type may be determined as DCT2.
[0742] The number and / or type of transform type candidates or the number and / or type of transform type combination candidates may vary depending on whether explicit transform type determination is allowed. In one example, when explicit transform type determination is allowed, DCT2, DST7, and DCT8 may be used as transform type candidates. Therefore, each of the horizontal transform type and the vertical transform type may be set to DCT2, DST8, 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 transform type and the vertical transform type may be determined to be DCT2 or DST7.
[0743] The coding block or the transform block may be partitioned into a plurality of sub-blocks, and a transform may be performed on each of the plurality of sub-blocks. In one example, when the above-mentioned sub-partitioned intra-frame encoding method is applied to the coding block, the coding block may be divided into the plurality of sub-blocks, and then a transform may be performed on each of the plurality of sub-blocks.
[0744] The transform types of the sub-blocks may be the same as each other. In one example, when determining the transform type of the first sub-block among the plurality of sub-blocks, the transform type of the first sub-block may also be applied to the remaining sub-blocks. Optionally, the transform type of the coding block may be determined, and then the transform type of the coding block may be determined as the transform type of each sub-block.
[0745] In another example, the transform types of the plurality of sub-blocks may be determined individually. The transform type of each sub-block may be determined based on information transmitted by a signal for each sub-block. In one example, index information tu_mts_idx may be signaled for each sub-block. The index information tu_mts_idx may specify one of a plurality of combinations of a horizontal transform type and a vertical transform type. Depending on the value of tu_mts_idx, the horizontal transform type and the vertical transform type may be determined as DCT2, DST7, or DCT8. Based on the index information tu_mts_idx, it may be determined whether the horizontal transform type and the vertical transform type are the same.
[0746] Information indicating whether a transform type of a current subblock is the same as a transform type of a previous subblock may be signaled in a bitstream. When the information indicates that the transform type of the current subblock is the same as the transform type of the previous subblock, encoding of the index information tu_mts_idx for the current subblock may be omitted. The transform type of the previous subblock may be applied to the current subblock. Conversely, when the information indicates that the transform type of the current subblock is different from the transform type of the previous subblock, the index information tu_mts_idx for the current subblock may be encoded. In this regard, the index information of the current subblock may indicate one of the remaining transform type combinations except the transform type combination indicated by the index information of the previous subblock.
[0747] Optionally, the method may be configured such that when a coding block is partitioned into a plurality of sub-blocks, explicit transform type determination is not allowed. In this regard, when explicit transform type determination is allowed, the transform type may be determined based on the index information tu_mts_idx. Conversely, when explicit transform type determination is not allowed, the transform type may be determined considering at least one of the size or shape of the sub-block, or the position of the sub-block including the non-zero coefficient.
[0748] Fig.41 is a diagram illustrating an example of determining a transform type of a subblock.
[0749] exist Fig.41 , examples where the aspect ratio of the sub-blocks is 1:2 or 2:1 are shown.
[0750] The horizontal transform type and the vertical transform type may be determined based on the width and height of the sub-block, respectively. Fig.41 (a) and Fig.41In the example shown in (b), when the width of the sub-block is less than the threshold, the first transform type (e.g., DCT2) may be used as the horizontal transform type. Conversely, when the width of the sub-block is greater than or equal to the threshold, the second transform type (e.g., DST7) may be used as the horizontal transform type.
[0751] In addition, when the height of the sub-block is less than the threshold, the first transform type (e.g., DCT2) may be used as the vertical transform type. Conversely, when the width of the sub-block is greater than or equal to the threshold, the second transform type (e.g., DST7) may be used as the vertical transform type.
[0752] In this regard, the threshold value may be a natural number such as 2, 4, or 8. The threshold value may be variable based on at least one of the size, shape, intra prediction mode, or prediction coding mode of the coding block. Alternatively, information for determining the threshold value may be signaled in the bitstream.
[0753] In the above examples, the width and height of the sub-block are compared with a single threshold. However, the present disclosure is not limited thereto. The width and height of the sub-block may be compared with two thresholds, and then the transform type may be determined based on the comparison result. In one example, when the width of the sub-block is less than the first threshold or greater than the second threshold, the horizontal transform type may be determined as DCT2. Otherwise, the horizontal transform type may be determined as DST7. In addition, when the height of the sub-block is less than the first threshold or greater than the second threshold, the vertical transform type may be determined as DCT2. Otherwise, the vertical transform type may be determined as DST7. The second threshold may be a natural number greater than the first threshold. The first threshold may be a natural number such as 2, 4, or 8. The second threshold may be a natural number such as 8, 16, or 32.
[0754] In another example, when the sub-block is a square whose height is the same as the width, the horizontal transform type and the vertical transform type may be set to be the same, but when the sub-block is a non-square whose height and width are not equal to each other, the horizontal transform type and the vertical transform type may be set to be different from each other. In one example, when the width of the sub-block is greater than its height, the horizontal transform type may be determined as DST7, and the vertical transform type may be determined as DCT2. When the height of the sub-block is greater than its width, the vertical transform type may be determined as DST7, and the horizontal transform type may be determined as DCT2.
[0755] The value of the residual coefficient included in at least one of the plurality of sub-blocks may be set to 0. In this regard, the residual coefficient refers to a transform coefficient generated via transform, a transform skip coefficient generated via transform skip, or a quantization coefficient generated by quantizing the transform coefficient. In one example, the value of the residual coefficient included in a sub-block spaced a predetermined distance or more from a boundary of the coding block may be set to 0.
[0756] Fig.42 is a diagram for describing an example of setting a residual coefficient of a subblock to 0.
[0757] exist Fig.42 In the example shown, the CBF (coded block flag) indicates whether there is a non-zero residual coefficient in the sub-block. When the value of CBF is 0, it indicates that there is no non-zero residual coefficient in the sub-block, and when the value of CBF is 1, it indicates that there is a non-zero residual coefficient in the sub-block.
[0758] When the distance from the boundary of the coding block to the sub-block is greater than a threshold value, the residual coefficient included in the sub-block may be set to 0. In this regard, the distance from the boundary of the coding block to the sub-block may be obtained based on a first sample point located at the boundary of the coding block and a second sample point included in the sub-block. In an example, the first sample point may be a sample point located at the upper left corner of the coding block, a sample point located at the lower left corner of the coding block, a sample point located at the middle of the left side of the coding block, a sample point located at the upper right corner of the coding block, a sample point located at the lower right corner of the coding block, a sample point located at the middle of the right side of the coding block, a sample point located at the top center of the coding block, or a sample point located at the bottom center of the coding block. The second sample point may be a sample point located at the upper left corner of the sub-block, a sample point located at the lower left corner of the sub-block, a sample point located at the middle of the left side of the sub-block, a sample point located at the upper right corner of the sub-block, a sample point located at the lower right corner of the sub-block, a sample point located at the middle of the right side of the sub-block, a sample point located at the top center of the sub-block, or a sample point located at the bottom center of the sub-block.
[0759] The threshold may be determined based on at least one of a size, a shape, a number of subblocks included in the coding block, or a size of the subblock. Alternatively, information for determining the threshold may be signaled in a bitstream.
[0760] In one example, when vertical partitioning is applied to the current block, the residual coefficients of the sub-blocks whose distance from the left boundary of the coding block is greater than or equal to a threshold value may be set to 0. Fig.42 In the example shown in (a), when the size of the coding block is 64 and the threshold is 32, the residual coefficients of the sub-blocks (sub-CU2 and sub-CU3) whose distance from the left boundary of the coding block is greater than or equal to 32 can be set to 0.
[0761] Optionally, when horizontal partitioning is applied to the current block, the residual coefficients of the sub-blocks whose distance from the top boundary of the coding block is greater than or equal to a threshold value may be set to 0. Fig.42 In the example shown in (b), when the size of the coding block is 64 and the threshold is 32, the residual coefficients of the sub-blocks (sub-CU2 and sub-CU3) whose distance from the top boundary of the coding block is greater than or equal to 32 can be set to 0.
[0762] Contrary to the illustrated example, residual coefficients included in subblocks having a distance from a boundary of a coding block less than a threshold value may be set to zero.
[0763] Optionally, the residual coefficients of the remaining sub-blocks except the sub-block located at the preset position among the multiple sub-blocks may be set to 0. In one example, when vertical partitioning is applied to the coding block, the residual coefficients of the remaining sub-blocks except the leftmost or rightmost sub-block among the multiple sub-blocks may be set to 0. Optionally, when horizontal partitioning is applied to the coding block, the residual coefficients of the remaining sub-blocks except the sub-block located at the topmost or bottommost among the multiple sub-blocks may be set to 0.
[0764] The encoding of information indicating whether there are non-zero coefficients in the sub-block, such as the encoding of the CBF, may be omitted. When the CBF encoding is omitted, whether each sub-block includes a non-zero residual coefficient may be determined based on the distance between the boundary of the coding block and the sub-block or the position of the sub-block. In one example, Fig.42 In the example shown, the CBF values of sub-block 0 and sub-block 1 (sub-CU0, sub-CU1) may be derived as 1, and the CBF values of sub-block 2 and sub-block 3 (sub-CU2, sub-CU3) may be derived as 0.
[0765] Transformation and / or quantization may be performed on a sub-block including a non-zero coefficient, while transformation and quantization may be omitted on a sub-block not including a non-zero coefficient.
[0766] In another example, information indicating whether the transform is performed only on a partial area of the coding block or a partial area of the transform block may be encoded in the bitstream and signaled. 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 some of the multiple sub-blocks generated by partitioning the coding block or the transform block. When the flag is 0, this indicates that the transform is performed without dividing the coding block or the transform block into sub-blocks.
[0767] The technique for performing a transform on only a partial area of a coding block may be configured to be allowed only when a sub-partition intra coding scheme is applied to a coding block. Therefore, cu_sbt_flag may be encoded in the bitstream and transmitted with a signal only when the sub-partition intra coding method is applied to a coding block. When the value of cu_sbt_flag is 1, the transform is performed only on some of the multiple sub-blocks generated by partitioning a coding block or a transform block. The residual coefficients of the remaining sub-blocks may be set to 0. When the value of cu_sbt_flag is 1, the transform may be performed on all sub-blocks.
[0768] Optionally, when the sub-partition intra coding method is applied to the coding block, the encoding of cu_sbt_flag may be omitted and the value of cu_sbt_flag may be inferred to be 1.
[0769] In another example, only when the prediction coding mode of the coding block is inter-frame prediction or current picture reference, a technology that performs transformation only on a partial area of the coding block may be allowed. When the coding block is encoded via inter-frame prediction or via current picture reference, information indicating whether the transformation is performed only on a partial area of the coding block may be encoded in the bitstream and transmitted by signal. When the transformation is performed only on a partial area of the coding block, information indicating the partition type of the coding block may be encoded in the bitstream and transmitted by signal. The information indicating the partition type of the coding block may include at least one of information indicating whether the coding block is divided into four sub-blocks, information indicating the division direction of the coding block, or information indicating the number of sub-blocks. In one example, when cu_sbt_flag is 1, a flag cu_sbt_quadtree_flag indicating whether the coding block is partitioned into four sub-blocks may be transmitted in the bitstream with a signal. When cu_sbt_quadtree_flag is 1, this indicates that the coding block is partitioned into four sub-blocks. In one example, the coding block can be partitioned into 4 sub-blocks by using 3 vertical lines or 3 horizontal lines. Optionally, the coding block may be partitioned into 4 sub-blocks using one vertical line and one horizontal line. When cu_sbt_quadtree_flag is 0, this indicates that the coding block is partitioned into two sub-blocks. In one example, the coding block may be partitioned into two sub-blocks by using one vertical line or one horizontal line.
[0770] In addition, a flag indicating the partition direction of the coding block can be signaled in the bitstream. In one example, a flag cu_sbt_horizontal_flag indicating whether horizontal partitioning is applied to the coding block can be encoded and signaled in the bitstream. When the value of cu_sbt_horizontal_flag is 1, it indicates that horizontal partitioning is applied to the coding block, and when the value of cu_sbt_horizontal_flag is 0, it indicates that vertical partitioning is applied to the coding block.
[0771] Information indicating the position of the sub-blocks where there are no non-zero coefficients or the position of the sub-blocks where the transformation is not performed can be transmitted by signaling in the bitstream. Based on the information, the sub-blocks where the transformation and / or quantization has been performed and the sub-blocks where the transformation and / or quantization has been omitted can be determined.
[0772] Fig.43 An example of specifying the position of a subblock on which transformation and / or quantization has been performed based on information transmitted by signaling in a bitstream is shown.
[0773] A flag sbt_upleft_flag indicating whether a non-zero coefficient exists in a specific position or in the first sub-block may be signaled in the bitstream. When the value of sbt_upleft_flag is 1, this indicates that a transform and / or quantization has been performed on a sub-block located at the top or left side of the coding block, and indicates that a transform and / or quantization has not been performed on a sub-block located at the right or bottom of the coding block. When the value of sbt_upleft_flag is 0, this indicates that a transform and / or quantization has been performed on a sub-block located at the top or left side of the coding block, and indicates that a transform and / or quantization has not been performed on a sub-block located at the right or bottom of the coding block.
[0774] When the coding block is partitioned into 4 sub-blocks, sbt_upleft_flag may indicate that transformation and / or quantization has been performed on N sub-blocks. In one example, when the value of sbt_upleft_flag is 1, this indicates that transformation and / or quantization has been performed on the top or left two sub-blocks. When the value of sbt_upleft_flag is 0, this indicates that transformation and / or quantization has been performed on the right or bottom two sub-blocks.
[0775] Different from the above example, the value of N can be set to 1 or 3.
[0776] The residual coefficients of the sub-blocks for which transformation and / or quantization have not been performed may be set to zero.
[0777] The transform type of the sub-block may be determined based on the partition direction of the coding block and the position of the sub-block. In one example, when the coding block is divided in the vertical direction, and when the transformation is performed on the left sub-block in the sub-block, the horizontal transform type and the vertical transform type of the sub-block may be set to be different from each other. In one example, the horizontal transform type may be set to DCT8, and the vertical transform type may be set to DST7. Conversely, when the coding block is divided in the vertical direction, and when the transformation is performed on the right sub-block in the sub-block, the horizontal transform type and the vertical transform type of the sub-block may be set to be the same as each other. In one example, the horizontal transform type and the vertical transform type may be set to DST7.
[0778] Optionally, when the coding block is divided in the horizontal direction, and when the top sub-block in the sub-block is transformed, the horizontal transform type and the vertical transform type may be set to be different from each other. In one example, the horizontal transform type may be set to DST7, and the vertical transform type may be set to DCT8. Conversely, when the coding block is divided in the horizontal direction, and when the bottom sub-block in the sub-block is transformed, the horizontal transform type and the vertical transform type of the sub-block may be set to be the same as each other. In one example, the horizontal transform type and the vertical transform type may be set to DST7.
[0779] The encoding of information indicating whether there are non-zero coefficients in the sub-block, such as the encoding of the CBF, may be omitted. When the CBF encoding is omitted, whether a non-zero residual coefficient is included in each sub-block may be determined based on the position of the sub-block on which the transform is performed. In one example, when the value of sbt_upleft_flag is 0, the CBF value of the left or top sub-block may be inferred to be 0, and the CBF value of the right or bottom sub-block may be inferred to be 1. Alternatively, when the value of sbt_upleft_flag is 1, the CBF value of the left or top sub-block may be inferred to be 1, and the CBF value of the right or bottom sub-block may be inferred to be 0.
[0780] The reconstructed samples of the sub-block to which the transformation is performed may be derived as the sum of the prediction samples and the residual samples. Conversely, the prediction samples of the sub-block to which the transformation is omitted may be set as the reconstructed samples. Quantization is to reduce the energy of the block, and the quantization process includes a process of dividing the transform coefficients by a specific constant value. The constant value may be derived based on a quantization parameter, and the quantization parameter may be defined as a value between 1 and 63.
[0781] When the encoder performs transformation and quantization, the decoder can obtain a residual block through inverse quantization and inverse transformation. The decoder can obtain the sum of the residual block and the prediction block to obtain a reconstructed block of the current block.
[0782] When obtaining a reconstructed block of the current block, information loss occurring in the quantization and encoding process may be reduced via in-loop filtering. The in-loop filter may include at least one of a deblocking filter, a sample adaptive offset filter (SAO), or an adaptive loop filter (ALF). Hereinafter, the reconstructed block before applying the in-loop filter is referred to as a first reconstructed block, and the reconstructed block after applying the in-loop filter is referred to as a second reconstructed block.
[0783] The second reconstructed block may be obtained by applying at least one of a deblocking filter, SAO, or ALF to the first reconstructed block. In this regard, the SAO or ALF may be applied after the deblocking filter is applied.
[0784] The operation of applying the above-described embodiments of the decoding process or the encoding process to the encoding process or the decoding process, respectively, may be included in the scope of the present disclosure. Within the scope of the present disclosure, the embodiments in which the operations occur in a predetermined order may be modified to embodiments in which the operations occur in an order different from the predetermined order.
[0785] Although the above embodiments are described based on a series of operations or flow charts, the embodiments are not limited to the time sequence of the operations of the method. In another example, these operations may be performed simultaneously, or may be performed in different orders, as required. In addition, in the above embodiments, each of the components (e.g., units, modules, etc.) constituting the block diagram may be implemented in the form of a hardware device or software. Multiple components may be combined with each other into a single component that may be implemented using a single hardware device or software. The above embodiments may be implemented using program instructions that may be run via various computer components. The instructions may be recorded in a computer-readable storage medium. The computer-readable storage medium may include program instructions, data files, data structures, etc. that are separate or combined with each other. Examples of computer-readable storage media include magnetic media (such as hard disks, floppy disks, and tapes), optical storage media (such as CD-ROMs, DVDs), and magneto-optical media (such as floppy disks), and hardware devices (such as ROMs, RAMs, flash memories, etc.) that are specifically configured to store and run program instructions. The hardware device may be configured to operate as one or more software modules to perform processing according to the present disclosure, or vice versa.
[0786] [Industrial Availability]
[0787] The present disclosure may be applied to an electronic device that encodes / decodes a video.
Claims
1. A method for decoding a video, the method comprising: determining a partition type of the coding block, wherein the partition type is determined based on index information specifying one of a plurality of partition type candidates; Based on the determined partition type, dividing the coding block into a first prediction unit and a second prediction unit; deriving motion information of each of the first prediction unit and the second prediction unit; as well as Based on the derived motion information, prediction samples of the first prediction unit and the second prediction unit are obtained.
2. The method according to claim 1, wherein: The plurality of partition type candidates include a horizontal partition type.
3. The method according to claim 1, wherein: The plurality of partition type candidates include a vertical partition type.
4. A system, comprising: one or more processors; and A memory storing instructions, which, when executed by the one or more processors, cause the one or more processors to perform operations, the operations comprising: determining a partition type of the coding block, wherein the partition type is determined based on index information specifying one of a plurality of partition type candidates; Based on the determined partition type, dividing the coding block into a first prediction unit and a second prediction unit; deriving motion information of each of the first prediction unit and the second prediction unit; and Based on the derived motion information, prediction samples of the first prediction unit and the second prediction unit are obtained.
5. The system according to claim 4, wherein: The plurality of partition type candidates include a horizontal partition type.
6. The system according to claim 4, wherein: The plurality of partition type candidates include a vertical partition type.
7. One or more non-transitory computer-readable storage media having instructions stored thereon, which, when executed by one or more processors, cause the one or more processors to perform operations, the operations comprising: determining a partition type of the coding block, wherein the partition type is determined based on index information specifying one of a plurality of partition type candidates; Based on the determined partition type, dividing the coding block into a first prediction unit and a second prediction unit; deriving motion information of each of the first prediction unit and the second prediction unit; as well as Based on the derived motion information, prediction samples of the first prediction unit and the second prediction unit are obtained.
8. The one or more non-transitory computer-readable storage media of claim 7, wherein: The plurality of partition type candidates include a horizontal partition type.
9. The one or more non-transitory computer-readable storage media of claim 7, wherein: The plurality of partition type candidates include a vertical partition type.
10. A method for encoding a video, the method comprising: determining a partition type of a coding block associated with the video, wherein the partition type is selected from a plurality of partition type candidates; Encoding index information representing the partition type; Based on the determined partition type, dividing the coding block into a first prediction unit and a second prediction unit; determining motion information of each of the first prediction unit and the second prediction unit; Determining prediction samples of the first prediction unit and the second prediction unit based on the motion information; as well as The video is encoded based on the predicted samples.
11. The method according to claim 10, wherein: The plurality of partition type candidates include a horizontal partition type.
12. The method according to claim 10, wherein: The plurality of partition type candidates include a vertical partition type.
13. A system, comprising: one or more processors; and A memory storing instructions, which, when executed by the one or more processors, cause the one or more processors to perform operations, the operations comprising: determining a partition type of a coding block associated with a video, wherein the partition type is selected from a plurality of partition type candidates; Encoding index information representing the partition type; Based on the determined partition type, dividing the coding block into a first prediction unit and a second prediction unit; determining motion information of each of the first prediction unit and the second prediction unit; Determining prediction samples of the first prediction unit and the second prediction unit based on the motion information; and The video is encoded based on the predicted samples.
14. The system according to claim 13, wherein: The plurality of partition type candidates include a horizontal partition type.
15. The system of claim 13, wherein: The plurality of partition type candidates include a vertical partition type.
16. One or more non-transitory computer-readable storage media having instructions stored thereon, which, when executed by one or more processors, cause the one or more processors to perform operations, the operations comprising: determining a partition type of a coding block associated with a video, wherein the partition type is selected from a plurality of partition type candidates; Encoding index information representing the partition type; Based on the determined partition type, dividing the coding block into a first prediction unit and a second prediction unit; determining motion information of each of the first prediction unit and the second prediction unit; Determining prediction samples of the first prediction unit and the second prediction unit based on the motion information; as well as The video is encoded based on the predicted samples.
17. The one or more non-transitory computer-readable storage media of claim 16, wherein: The plurality of partition type candidates include a horizontal partition type.
18. The one or more non-transitory computer-readable storage media of claim 16, wherein: The plurality of partition type candidates include a vertical partition type.