Method for encoding / decoding image signal and apparatus therefor
By using intra-frame BDPCM and sub-block transformation methods in video signal encoding, the problem of large data volume and low compression rate in high-definition video services is solved, and more efficient video signal encoding and decoding is achieved.
Patent Information
- Application Number
- CN202411794401.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2019-06-20
- Filing Date
- 2020-02-27
- Publication Date
- 2025-03-21
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.
Intra-frame BDPCM (Block-based Incremental Pulse Coding Modulation) method is adopted, and after the encoding block is partitioned into multiple sub-blocks, transform is performed on at least one sub-block to improve the encoding/decoding efficiency of the video signal.
Through intra-BDPCM and sub-block transformation, the encoding/decoding efficiency of video signals is improved and the video compression performance is improved.
Smart Images

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