Video signal encoding and decoding method and device thereof
Patent Information
- Application Number
- JP2024009480
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2019-01-18
- Filing Date
- 2024-01-25
- Publication Date
- 2025-02-26
- Estimated Expiration
- 2039-10-11
AI Technical Summary
【0015】 本願の発明は以下の技術的効果を有する。
Smart Images

Figure 0007636596000039 
Figure 0007636596000040 
Figure 0007636596000041
Abstract
Description
[Technical field]
[0001] The present application relates to a method and an apparatus for encoding and decoding a video signal. [Background technology]
[0002] With the trend of larger display panels, higher quality video services are gradually being pursued. The biggest problem with high-definition video services is the significant increase in data volume, and in order to solve these problems, active research is being conducted to improve video compression rates. As a representative example, in 2009, the Motion Picture Experts Group (MPEG) and the Video Coding Experts Group (VCEG) of the International Telecommunication Union-Telecommunication (ITU-T) formed the Joint Collaborative Team on Video Coding (JCT-VC). JCT-VC proposed High Efficiency Video Coding (HEVC), a video compression standard with approximately twice the compression performance of H.264 / AVC, and the standard was approved on January 25, 2013. However, with the rapid development of high-definition video services, the performance of HEVC is gradually showing its limitations. Summary of the Invention [Problem to be solved by the invention]
[0003] It is an object of the present application to provide a method for deriving a candidate intra-prediction mode based on the intra-prediction modes of neighboring blocks adjacent to a current block in encoding or decoding a video signal, and an apparatus for performing said method.
[0004] An object of the present application is to provide a method and an apparatus for implementing said method in encoding or decoding a video signal, for dividing a coding block or a transform block into a number of sub-blocks and performing intra prediction on each sub-block.
[0005] The object of the present application is to provide a method and an apparatus for implementing said method in the encoding or decoding of a video signal, in which a coding or transformation block is divided into a number of sub-blocks and a transformation is performed only on a part of the sub-blocks.
[0006] The technical problems that the present application aims to achieve are not limited to the technical problems mentioned above, and other technical problems not mentioned can be clearly understood by those skilled in the art from the following description. [Means for solving the problem]
[0007] The video signal decoding or encoding method of the present application includes: determining a reference sample line of a current block; determining whether there is a candidate intra prediction mode that is the same as the intra prediction mode of the current block; deriving an intra prediction mode of the current block according to the determined result; and performing intra prediction on the current block according to the reference sample line and the intra prediction mode. In this case, at least one of the candidate intra prediction modes may be derived by adding or subtracting an offset to the maximum value of the intra prediction mode of a top neighboring block of the current block and the intra prediction mode of a left neighboring block of the current block.
[0008] In the video signal decoding or encoding method of the present application, when the difference between the intra prediction mode of the top adjacent block and the intra prediction mode of the left adjacent block is 64, at least one of the candidate intra prediction modes may be derived by adding or subtracting 2 to the maximum value.
[0009] In the video signal decoding or encoding method of the present application, the number of the candidate intra-prediction modes may be different according to the index of the reference sample line.
[0010] In the video signal decoding or encoding method of the present application, the method further includes determining whether to divide the current block into a plurality of sub-blocks, and if the current block is divided into a plurality of sub-blocks, the plurality of sub-blocks can share one intra prediction mode.
[0011] In the video signal decoding or encoding method of the present application, the inverse transform can be skipped for some of the plurality of sub-blocks.
[0012] In the video signal decoding or encoding method of the present application, the horizontal transformation type of the sub-block can be determined according to the width of the sub-block, and the vertical transformation type of the sub-block can be determined according to the height of the sub-block.
[0013] In the video signal decoding or encoding method of the present application, the horizontal transformation type and vertical transformation type of the sub-block can be determined according to the shape of the sub-block.
[0014] The features summarized for the present application above are merely exemplary embodiments in the specific description of the present application described below, and are not intended to limit the scope of the present application. Effect of the Invention
[0015] The present invention has the following technical effects.
[0016] According to the present application, by deriving a candidate intra prediction mode similar to the intra prediction mode of a neighboring block adjacent to a current block, it is possible to improve intra prediction efficiency.
[0017] According to the present application, intra prediction efficiency can be improved by dividing a coding block or a transform block into multiple sub-blocks and performing intra prediction on each sub-block.
[0018] According to the present application, the coding or decoding efficiency can be improved by dividing a coding or transform block into multiple sub-blocks and performing transform on only some of the sub-blocks.
[0019] The effects that can be obtained by the present application are not limited to those mentioned above, and other effects not mentioned can be clearly understood by those skilled in the art from the following description. [Brief description of the drawings]
[0020] [Figure 1] FIG. 1 is a block diagram of a video encoder according to an embodiment of the present application. [Diagram 2] FIG. 2 is a block diagram of a video decoder (decoder) according to an embodiment of the present application. [Diagram 3] 1 illustrates a basic coding tree unit according to an embodiment of the present application. [Figure 4] 1 is a diagram showing a number of division shapes of a coding block; [Diagram 5] FIG. 2 is a schematic diagram of a division shape of a coding tree unit. [Figure 6] 1 is a flowchart of an inter prediction method according to an embodiment of the present application; [Figure 7] 1 is a diagram showing a collocated block. [Figure 8] 1 is a flowchart of an intra prediction method according to an embodiment of the present application. [Figure 9] 1 is a diagram showing reference samples included in each reference sample line. [Figure 10] 1 is a diagram showing intra prediction modes. [Figure 11] FIG. 1 is a schematic diagram of an example of a one-dimensional array in which reference samples are arranged in a row. [Figure 12] FIG. 1 is a schematic diagram of an example of a one-dimensional array in which reference samples are arranged in a row. [Figure 13] FIG. 13 is a schematic diagram of the angles that directional intra prediction modes form with a line parallel to the X-axis. [Figure 14] FIG. 13 is a schematic diagram of how prediction samples are obtained when the current block is non-square shaped. [Figure 15] 1 is a diagram illustrating a wide-angle intra prediction mode. [Figure 16] 1 is a diagram showing an example of vertical partitioning and horizontal partitioning. [Figure 17] 13 is a diagram showing an example of determining a division shape of a coding block; [Figure 18] 13 is a diagram showing an example of determining a division shape of a coding block; [Figure 19] 13 is a diagram illustrating an example of determining a partition shape of a coding block based on an intra prediction mode of the coding block. [Figure 20] 1 is a diagram illustrating a division shape of a coding block; [Figure 21] 11 is a diagram illustrating an example in which a predictive coding mode is set differently for each sub-block; [Figure 22] 1 is a diagram showing an embodiment in which a PDPC is applied. [Figure 23] 13 is a diagram showing a sub-block that performs a second transformation. [Figure 24] 13 is a diagram showing a sub-block that performs a second transformation. [Diagram 25] 11 is a diagram illustrating an example in which a transformation type of a current block is determined. [Figure 26] 11 is a diagram showing an example of determining a transformation type of a sub-block; [Figure 27] 13 is a diagram illustrating an example in which residual coefficients of a sub-block are set to 0. [Figure 28]13 illustrates an example of determining the location of sub-blocks that perform transform and / or quantization based on information signaled by the bitstream. [Figure 29] 1 is a flow chart illustrating a process for determining block strength. [Diagram 30] Shows predefined filter suggestions. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0021] Hereinafter, the embodiments of the present application will be described in detail with reference to the drawings.
[0022] Video encoding and decoding is performed on a block-by-block basis. For example, encoding or decoding processes such as transform, quantization, prediction, in-loop filtering or reconstruction may be performed on a coding block, a transform block or a predictive block.
[0023] Hereinafter, the block to be encoded or decoded is referred to as a “current block.” As an example, the current block can be represented as a coding block, a transformation block, or a prediction block according to a current encoding or decoding process step.
[0024] Furthermore, the term "unit" as used herein refers to a basic unit for performing a particular encoding or decoding process, and "block" can be understood to refer to a sample array of a certain size. Unless otherwise specified, "block" and "unit" can be used interchangeably. As an example, in the embodiments described below, a coding block and a coding unit can be understood to have the same meaning as each other.
[0025] FIG. 1 is a block diagram of a video encoder according to an embodiment of the present invention.
[0026] As shown in FIG. 1, the video encoding device 100 may include an image division unit 110, a prediction unit 120, 125, a transformation unit 130, a quantization unit 135, a re-sorting 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.
[0027] 1 are illustrated independently to show different characteristic functions in the video encoding device, but this does not mean that each component is composed of separate hardware or one software unit. That is, each component is listed in each component for convenience of explanation, and at least two components among each component are combined into one component, or one component can perform functions divided into multiple components, and integrated and separated embodiments of each of these components are also included in the scope of protection of this application as long as they do not deviate from the essence of this application.
[0028] Furthermore, some components may not be essential components for performing essential functions in the present application, but may be optional components for simply improving performance. The present application may include only components essential for embodying the essence of the present application (i.e., the present application may not include components used solely for merely improving performance), and a structure including only necessary components, excluding optional components used solely for merely improving performance, is also included in the scope of protection of the present application.
[0029] The image division unit 110 can divide the input image into at least one processing unit. In this case, the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The image division unit 110 can divide one image into a combination of multiple coding units, prediction units, and transform units, and select a combination of the coding unit, prediction unit, and transform unit according to a predetermined criterion (e.g., a cost function) to code the image.
[0030] For example, an image can be divided into multiple coding units. A recursive tree structure such as a quad tree structure can be used to divide the coding units from an image, and a video or coding unit that is divided into different coding units with a largest coding unit as the root can be divided using child nodes equal to the number of divided coding units. A coding unit that is not further divided according to a certain restriction becomes a leaf node. That is, assuming that only a square division is possible for one coding unit, one coding unit can be divided into a maximum of four different coding units.
[0031] Hereinafter, in the embodiments of the present application, a coding unit may be used to mean a unit for performing coding, or a unit for performing decoding.
[0032] The prediction units may be divided into at least one shape of the same size, such as a square or rectangle, within a single coding unit, or may be divided such that any one of the prediction units divided within a single coding unit has a different shape and / or size from the other prediction units.
[0033] When generating a prediction unit for performing intra prediction based on a coding unit, if the coding unit is not the smallest coding unit, intra prediction can be performed without dividing a plurality of N×N prediction units.
[0034] The prediction units 120 and 125 may include an inter prediction unit 120 that performs inter prediction and an intra prediction unit 125 that performs intra prediction. It is possible to determine whether to use inter prediction or intra prediction for a prediction unit, and to determine specific information (e.g., intra prediction mode, motion vector, reference image, etc.) based on each prediction method. In this case, the processing unit in which the prediction is performed may be different from the processing unit in which the prediction method and specific content are determined. For example, the prediction method and prediction mode, etc. may be determined for a prediction unit, and the prediction may also be performed for a transform unit. A residual value (residual block) between the generated prediction block and the original block may be input to the transform unit 130. Furthermore, prediction mode information, motion vector information, etc. used for prediction may be coded by the entropy coding unit 165 together with the residual value and signaled to the decoder. When a specific coding mode is used, the prediction units 120 and 125 may directly code the original block without generating a prediction block and transmit it to the decoder.
[0035] The inter prediction unit 120 can predict the prediction unit based on information of at least one image of a previous image or a subsequent image of the current image, and can also predict the prediction unit according to information of a coded partial region in the current image in some cases. The inter prediction unit 120 can include a reference image interpolation unit, a motion prediction unit, and a motion compensation unit.
[0036] The reference image interpolation unit can obtain reference image information provided from the memory 155 and generate pixel information of integer pixels or less in the reference image. In the case of luminance pixels, a DCT-based 8-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 4 pixel units. In the case of color difference signals, a DCT-based 4-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 8 pixel units.
[0037] The motion prediction unit may perform motion prediction based on the reference image interpolated by the reference image interpolation unit. As a method used to calculate a motion vector, multiple methods such as a full search-based block matching algorithm (FBMA), a three step search (TSS), and a new three-step search algorithm (NTS) may be used. The motion vector may have a motion vector value in 1 / 2 or 1 / 4 pixel units based on the interpolated pixel. The motion prediction unit may predict the current prediction unit using different motion prediction methods. As a motion prediction method, multiple modes such as a skip mode, a merge mode, an advanced motion vector prediction (AMVP) mode, and an intra block copy mode may be used.
[0038] The intra prediction unit 125 may generate a prediction unit based on reference pixel information surrounding a current block, which is pixel information within a current image. Since neighboring blocks of the current prediction unit are blocks performing inter prediction, when a reference pixel is a pixel performing inter prediction, the reference pixel included in the block performing inter prediction may be replaced with reference pixel information of a neighboring block performing intra prediction and used. That is, when a reference pixel is unavailable, at least one of the available reference pixels may replace the unavailable reference pixel information.
[0039] In intra prediction, the prediction mode may have a directional prediction mode that uses reference pixel information according to the prediction direction, and a non-directional mode that does not use directional information when performing prediction. The mode for predicting luma information may be different from the mode for predicting chroma information, and the intra prediction mode information used to predict luma information or the predicted luma signal information may be used to predict chroma information.
[0040] When performing intra prediction, if the size of the prediction unit is the same as the size of the transform unit, intra prediction can be performed on the prediction unit according to the left pixel, the top left pixel, and the top pixel of the prediction unit. However, when performing intra prediction, if the size of the prediction unit is different from the size of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. Furthermore, intra prediction using N×N partitioning can only be used for the smallest coding unit.
[0041] The intra prediction method may generate a prediction block after applying an Adaptive Intra Smoothing (AIS) filter to the reference pixels according to the prediction mode. The type of the AIS filter applied to the reference pixels may be different. To perform the intra prediction method, the intra prediction mode of the current prediction unit may be predicted from the intra prediction mode of the prediction unit existing in the vicinity of the current prediction unit. When predicting the prediction mode of the current prediction unit using the mode information predicted from the surrounding prediction unit, if the current prediction unit is the same as the intra prediction mode of the surrounding prediction unit, information indicating that the current prediction unit is the same as the prediction mode of the surrounding prediction unit may be transmitted using predetermined identifier information, and if the current prediction unit is different from the prediction mode of the surrounding prediction unit, entropy coding may be performed to encode the prediction mode information of the current block.
[0042] Furthermore, a residual block including residual value information, which is a difference between a prediction unit for performing prediction based on the prediction unit generated by the prediction units 120 and 125 and an original block of the prediction unit, can be generated. The generated residual block can be input to the conversion unit 130.
[0043] The transform unit 130 transforms a residual block including an original block and residual value information of a prediction unit generated by the prediction units 120 and 125 using a transform method such as a discrete cosine transform (DCT), a discrete sine transform (DST), or a KLT. Whether to apply a DCT, a DST, or a KLT to transform the residual block may be determined based on intra prediction mode information of a prediction unit used to generate the residual block.
[0044] The quantizer 135 can quantize the values transformed into the frequency domain by the transformer 130. The quantization coefficients are changed according to the importance of the block or video. The values calculated by the quantizer 135 can be provided to the inverse quantizer 140 and the re-sorter 160.
[0045] A resorting unit 160 may perform a resorting of the coefficient values on the quantized residual values.
[0046] The re-sorting unit 160 may convert the two-dimensional block shape coefficients into a one-dimensional vector shape through a coefficient scanning method. For example, the re-sorting unit 160 may convert the two-dimensional block shape coefficients into a one-dimensional vector shape by scanning from DC coefficients to high frequency region coefficients using a zig-zag scan method. Instead of performing zig-zag scanning according to the size of the transform unit and the intra prediction mode, vertical scanning, which scans the two-dimensional block shape coefficients in the column direction, and horizontal scanning, which scans the two-dimensional block shape coefficients in the row direction, may be used. That is, it may be possible to determine which scanning method to use among zig-zag scanning, vertical scanning, and horizontal scanning, according to the size of the transform unit and the intra prediction mode.
[0047] The entropy coding unit 165 may perform entropy coding based on the values calculated by the re-sorting unit 160. The entropy coding may use a number of coding methods, such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC).
[0048] The entropy coding unit 165 can code multiple pieces of information such as residual value coefficient information of the coding unit, block type information, prediction mode information, division unit information, prediction unit information and transmission unit information, motion vector information, reference frame information, block interpolation information, and filtering information from the re-sorting unit 160 and the prediction units 120 and 125.
[0049] The entropy coding unit 165 can perform entropy coding on the coefficient values of the coding unit input from the re-sorting unit 160 .
[0050] The inverse quantization unit 140 and the inverse transform unit 145 inversely quantize the values quantized by the quantization unit 135, and inversely transform the values transformed by the transform unit 130. The residual values (Residual) generated by the inverse quantization unit 140 and the inverse transform unit 145 can be used in combination with prediction units predicted via the motion prediction unit, the motion compensation unit, and the intra prediction unit included in the prediction units 120 and 125 to generate a reconstructed block (Reconstructed Block).
[0051] The filter unit 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).
[0052] The deblocking filter can remove block distortion caused by the boundaries between blocks from the restored image. To determine whether to perform deblocking, it can be determined whether to apply the deblocking filter to the current block based on the pixels contained in some columns or rows contained in the block. When applying the deblocking filter to the block, a strong filter or a weak filter can be applied according to the required deblocking filtering strength. Furthermore, in the aspect of applying the deblocking filter, when performing vertical filtering and horizontal filtering, horizontal filtering and vertical filtering can be processed in parallel.
[0053] The offset correction unit can correct the offset between the original video and the video to be deblocked on a pixel-by-pixel basis. In order to perform offset correction for a specific image, a method of dividing pixels included in the video into a predetermined number of regions, determining the region to perform offset, and applying the offset to the corresponding region, or a method of applying the offset by considering edge information of each pixel, can be used.
[0054] Adaptive Loop Filtering (ALF) can be performed based on a comparison between the filtered restored video and the original video. After dividing pixels included in an image into predetermined groups, one filter to be applied to the corresponding group can be determined, and each group can be differentially filtered. A luminance signal, which is information on whether or not to apply ALF, can be transmitted for each coding unit (CU), and the shape and filter coefficients of the ALF filter to be applied can be different for each block. Furthermore, an ALF filter of the same shape (fixed shape) can be used regardless of the characteristics of the block to which it is applied.
[0055] The memory 155 may store the reconstructed blocks or images calculated by the filter unit 150, and the stored reconstructed blocks or images may be provided to the prediction units 120, 125 when performing inter prediction.
[0056] FIG. 2 is a block diagram of a video decoder (decoder) according to an embodiment of the present application.
[0057] As shown in FIG. 2, the video decoder 200 may include an entropy decoding unit 210, a re-sorting unit 215, an inverse quantization unit 220, an inverse transform unit 225, prediction units 230 and 235, a filter unit 240, and a memory 245.
[0058] When a video bitstream is input to a video encoder, the input bitstream can be decoded in a procedure opposite to that of the video encoder.
[0059] The entropy decoding unit 210 may perform entropy decoding in a procedure opposite to that performed by the entropy encoding unit of the video encoder. For example, a number of methods, such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC), may be used in correspondence with the method performed by the video encoder.
[0060] The entropy decoding unit 210 may decode information related to intra-prediction and inter-prediction performed in the encoder.
[0061] The re-sorting unit 215 may perform re-sorting based on a method of re-sorting the bitstream entropy decoded by the entropy decoding unit 210 in the encoding unit. The re-sorting unit 215 may perform re-sorting by restoring coefficients represented in the shape of a one-dimensional vector to coefficients in the shape of a two-dimensional block. The re-sorting unit 215 may receive information related to the coefficient scan performed in the encoding unit and perform re-sorting in a reverse scanning manner based on the scan order performed in the corresponding encoding unit.
[0062] The inverse quantizer 220 may perform inverse quantization based on the quantization parameters provided by the encoder and the coefficient values of the re-sorted blocks.
[0063] The inverse transform unit 225 can perform inverse transforms such as inverse DCT, inverse DST, and inverse KLT on the transforms performed in the transform unit on the quantization result performed in the video encoder, i.e., DCT, DST, and KLT. The inverse transform can be performed based on the transmission unit determined in the video encoder. The inverse transform unit 225 of the video decoder can selectively perform a transform method (e.g., DCT, DST, KLT) according to a number of pieces of information such as a prediction method, a size of a current block, and a prediction direction.
[0064] The prediction units 230 and 235 can generate a prediction block based on information related to the generation of the prediction block provided by the entropy decoding unit 210 and information on a previously decoded block or image provided by a memory 245 .
[0065] As described above, when performing intra prediction, as in the operation of a video encoder, if the size of the prediction unit is the same as the size of the transform unit, intra prediction is performed for the prediction unit based on the left pixel, the top left pixel, and the top pixel of the prediction unit, but when performing intra prediction, if the size of the prediction unit is different from the size of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. Furthermore, intra prediction using N×N division can also be performed only for the smallest coding unit.
[0066] The prediction unit 230, 235 may include a prediction unit discrimination unit, an inter prediction unit, and an intra prediction unit. The prediction unit discrimination unit may receive various information such as prediction unit information input by the entropy decoding unit 210, prediction mode information of the intra prediction method, and motion prediction related information of the inter prediction method, and may distinguish a prediction unit in a current coding unit and determine whether the prediction unit performs inter prediction or intra prediction. The inter prediction unit 230 may perform inter prediction on the current prediction unit based on information included in at least one image of the previous image or the next image of the current image included in the current prediction unit, using information necessary for inter prediction of the current prediction unit provided by the video encoder. Alternatively, the inter prediction may be performed based on information of a partial area restored in the current image including the current prediction unit.
[0067] To perform inter prediction, it is possible to determine, based on a coding unit, which of the motion prediction methods of the prediction units included in the corresponding coding unit is skip mode, merge mode, motion vector prediction mode (AMVP mode), or intra block copy mode.
[0068] The intra prediction unit 235 may generate a prediction block based on pixel information in a current image. If the prediction unit is a prediction unit for performing intra prediction, the intra prediction may be performed based on intra prediction mode information of the prediction unit provided by the video encoder. The intra prediction unit 235 may include an AIS (Adaptive Intra Smoothing) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter, as a part for performing filtering on the reference pixels of the current block, may determine whether or not to apply a filter according to the prediction mode of the current prediction unit and apply the filter. The AIS filtering may be performed on the reference pixels of the current block using the prediction mode and AIS filter information of the prediction unit provided by the video encoder. If the prediction mode of the current block is a mode in which AIS filtering is not performed, the AIS filter may not be applied.
[0069] The reference pixel interpolation unit may generate reference pixels of pixel units of integer or less values by interpolating reference pixel values when the prediction mode of the prediction unit is a prediction mode that performs intra prediction based on pixel values obtained by interpolating reference pixel values. When the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating reference pixel values, the reference pixels may not be interpolated. When the prediction mode of the current block is a DC mode, the DC filter may generate a prediction block through filtering.
[0070] The reconstructed block or image may be provided to a filter unit 240. The filter unit 240 may include a deblocking filter, an offset correction unit, and an ALF.
[0071] It is possible to obtain information from the video encoder as to whether a deblocking filter has been applied to a corresponding block or image, and, if a deblocking filter has been applied, as to whether a strong or weak filter has been applied. The deblocking filter of the video decoder can accept the deblocking filter related information provided by the video encoder, and the video decoder can perform deblocking filtering of the corresponding block.
[0072] The offset correction unit may perform offset correction on the restored video based on, for example, the type of offset correction and offset value information applied to the video when encoding.
[0073] The ALF may be applied to a coding unit based on information on whether or not to apply the ALF provided by the encoder, ALF coefficient information, etc. Such ALF information may be provided by being included in a specific parameter set.
[0074] The memory 245 is capable of storing the reconstructed images or blocks so that they can be used as reference images or blocks, and of providing the reconstructed images to an output.
[0075] FIG. 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present application.
[0076] A coding block of a maximum size can be defined as a coding tree block. One image is divided into a number of coding tree units (CTUs). A coding tree unit is a coding unit of a maximum size and can also be called a Largest Coding Unit (LCU). Figure 3 shows an example in which one image is divided into a number of coding tree units.
[0077] The size of the coding tree unit can be defined at a picture level or a sequence level, so that information indicating the size of the coding tree unit can be signaled via a picture parameter set or a sequence parameter set.
[0078] As an example, the coding tree unit size for the entire image in the sequence may be set to 128x128. Or, at the image level, the coding tree unit size may be determined to be either 128x128 or 256x256. As an example, in a first image, the coding tree unit size may be set to 128x128, and in a second image, the coding tree unit size may be set to 256x256.
[0079] A coding tree unit may be divided to generate a coding block. A coding block indicates a basic unit for encoding or decoding processing. As an example, prediction or transformation may be performed for each coding block, or a predictive coding mode may be determined for each coding block. Here, the predictive coding mode indicates a method of generating a predictive video. As an example, the predictive coding mode may include intra prediction (Intra Prediction), inter prediction (Inter Prediction), current picture referencing (CPR: Current Picture Referencing or Intra Block Copy (IBC)), or combined prediction. For a coding block, at least one predictive coding mode of intra prediction, inter prediction, current picture referencing, or combined prediction may be used to generate a predictive block for the coding block.
[0080] Information indicating the predictive coding mode of the current block may be signaled via a bitstream. As an example, the information may be a 1-bit identifier indicating whether the predictive coding mode is an intra mode or an inter mode. Only if the predictive coding mode of the current block is determined as an inter mode, can the current image reference or hybrid prediction be used.
[0081] The current image reference is for setting the current image as a reference image and obtaining a prediction block of the current block from an encoded or decoded area in the current image. Here, the current image refers to an image including the current block. Information indicating whether the current image reference is applied to the current block may be signaled via a bitstream. As an example, the information may be a 1-bit identifier. If the identifier is true, the prediction coding mode of the current block may be determined to the current image reference, and if the identifier is false, the prediction mode of the current block may be determined to inter prediction.
[0082] Alternatively, the predictive coding mode of the current block may be determined based on the reference image index. As an example, if the reference image index refers to the current image, the predictive coding mode of the current block may be determined to be current image reference. If the reference image index refers to another image other than the current image, the predictive coding mode of the current block may be determined to be inter prediction. That is, the current image reference is a prediction method that uses information of an encoded or decoded area in the current image, and the inter prediction is a prediction method that uses information of another image that has been encoded or decoded.
[0083] Hybrid prediction refers to a coding mode that combines two or more of intra prediction, inter prediction, and current image reference. As an example, when hybrid prediction is applied, a first prediction block may be generated based on either intra prediction, inter prediction, or current image reference, and a second prediction block may be generated based on another one. Once the first prediction block and the second prediction block are generated, a final prediction block may be generated through an average operation or a weighted sum operation of the first prediction block and the second prediction block. Information indicating whether hybrid prediction is applied may be signaled via a bitstream. The information may be a 1-bit identifier.
[0084] FIG. 4 is a diagram showing a number of division shapes of a coding block.
[0085] A coding block may be divided into multiple coding blocks based on a quad tree partition, a binary tree partition, or a triple tree partition. The divided coding block may also be divided again into multiple coding blocks based on a quad tree partition, a binary tree partition, or a triple tree partition.
[0086] Quad tree partitioning indicates a partitioning method for dividing the current block into four blocks. As a result of the quad tree partitioning, the current block can be partitioned into four square partitions (see “SPLIT_QT” in (a) of FIG. 4).
[0087] Binary tree splitting refers to a splitting method for splitting the current block into two blocks. Splitting the current block into two blocks along the vertical direction (i.e., using a vertical line across the current block) can be referred to as vertical binary tree splitting, and splitting the current block into two blocks along the horizontal direction (i.e., using a horizontal line across the current block) can be referred to as horizontal binary tree splitting. As a result of the binary tree splitting, the current block can be split into two non-square partitions. (b) "SPLIT_BT_VER" in FIG. 4 shows the vertical binary tree splitting result, and (c) "SPLIT_BT_HOR" in FIG. 4 shows the horizontal binary tree splitting result.
[0088] Triple tree splitting refers to a splitting method for splitting the current block into three blocks. Splitting the current block into three blocks along the vertical direction (i.e., using two vertical lines crossing the current block) can be referred to as vertical triple tree splitting, and splitting the current block into three blocks along the horizontal direction (i.e., using two horizontal lines crossing the current block) can be referred to as horizontal triple tree splitting. As a result of the triple tree splitting, the current block can be split into three non-square partitions. In this case, the width or height of the partition located in the center of the current block can be twice the width or height of the other partitions. (d) "SPLIT_TT_VER" in FIG. 4 shows the vertical triple tree splitting result, and (e) "SPLIT_TT_HOR" in FIG. 4 shows the horizontal triple tree splitting result.
[0089] The number of times a coding tree unit is divided can be defined as a partitioning depth. At a sequence level or an image level, a maximum partitioning depth of a coding tree unit can be determined. This allows the maximum partitioning depth of a coding tree unit to be different for each sequence or image.
[0090] Alternatively, the maximum partitioning depth for each partitioning method can be determined separately. As an example, the maximum partitioning depth allowing for a quad-tree partitioning can be different from the maximum partitioning depth allowing for a binary tree partitioning and / or a triple tree partitioning.
[0091] The encoder may be signaled by the bitstream information indicating at least one of the partition shape or partition depth of the current block, and the decoder may determine the partition shape and partition depth of the coding tree unit based on the information parsed from the bitstream.
[0092] FIG. 5 is a diagram showing a division shape of a coding tree unit.
[0093] Partitioning a coding block using partitioning methods such as quad tree partitioning, binary tree partitioning, and / or triple tree partitioning may be referred to as multi-tree partitioning.
[0094] A coding block generated by applying multi-tree partitioning to a coding block may be referred to as a lower coding block. If the partition depth of a coding block is k, the partition depth of the lower coding block is set to k+1.
[0095] Conversely, for a coding block with a division depth of k+1, a coding block with a division depth of k may be referred to as an upper coding block.
[0096] The partition type of the current coding block may be determined based on at least one of the partition shape of the top coding block or the partition type of the neighboring coding block. Here, the neighboring coding block may be adjacent to the current coding block and may include at least one of the top neighboring block, the left neighboring block, or the neighboring block adjacent to the top left corner of the current coding block. Here, the partition type may include at least one of whether or not it is a quad tree partition, whether or not it is a binary tree partition, whether or not it is a binary tree partition direction, whether or not it is a triple tree partition, or whether or not it is a triple tree partition direction.
[0097] To determine the partition shape of the coding block, information indicating whether the coding block is partitioned can be signaled via a bitstream, the information being a 1-bit identifier "split_cu_flag", which, when true, indicates that the coding block is partitioned according to the quadtree partitioning method.
[0098] If split_cu_flag is true, information on whether the coding block is quad-tree split can be signaled via the bitstream. The information is a 1-bit identifier split_qt_flag, and if the identifier is true, the coding block can be split into 4 blocks.
[0099] 5, a coding tree unit is illustrated as generating four coding blocks with a division depth of 1 through quad-tree division. In addition, it is illustrated that quad-tree division is again applied to a first coding block and a fourth coding block among the four coding blocks generated as a result of the quad-tree division. As a result, four coding blocks with a division depth of 2 can be generated.
[0100] Furthermore, by applying quad-tree partitioning again to the coding block with a partition depth of two, a coding block with a partition depth of three can be generated.
[0101] If quad-tree partitioning is not applied to a coding block, it may be determined whether to perform binary tree partitioning or triple tree partitioning on the coding block, taking into account at least one of the following: the size of the coding block, whether the coding block is located on an image boundary, the maximum partition depth, or the partition shape of an adjacent block. If it is determined to perform binary tree partitioning or triple tree partitioning on the coding block, information indicating a partitioning direction may be signaled via a bitstream. The information may be a 1-bit identifier mtt_split_cu_vertical_flag. Based on the identifier, it may be determined whether the partitioning direction is vertical or horizontal. In addition, information indicating whether binary tree partitioning or triple tree partitioning is applied to the coding block may be signaled via a bitstream. The information may be a 1-bit identifier mtt_split_cu_binary_flag. Based on the identifier, it may be determined whether binary tree partitioning or triple tree partitioning is applied to the coding block.
[0102] As an example, in the example shown in FIG. 5, vertical binary tree partitioning is applied to a coding block with a partitioning depth of 1, and among the coding blocks generated as a result of the partitioning, vertical triple tree partitioning is applied to the left coding block and vertical binary tree partitioning is applied to the right coding block.
[0103] Inter prediction is a predictive coding mode that predicts a current block using information of a previous image. As an example, a block located at the same position as the current block in the previous image (hereinafter referred to as a collocated block) can be set as a prediction block of the current block. Hereinafter, a prediction block generated based on a block located at the same position as the current block is referred to as a collocated prediction block.
[0104] Conversely, if an object in a previous image moves to another position in a current image, the object's motion can be used to effectively predict the current block. For example, by comparing a previous image with a current image, the object's motion direction and size can be known, and a prediction block (or a prediction video) of the current block can be generated according to the object's motion information. Hereinafter, the prediction block generated by the motion information can be referred to as a motion prediction block.
[0105] The predictive block can be subtracted from the current block to generate a residual block, where if the object moves, the moving predictive block can be used instead of the collocated predictive block, thereby reducing the energy of the residual block and thereby improving the compression performance of the residual block.
[0106] As described above, using motion information to generate a predictive block may be referred to as motion compensated prediction. In most inter predictions, a predictive block may be generated based on motion compensated prediction.
[0107] The motion information may include at least one of a motion vector, a reference image index, a prediction direction, or a bidirectional weight index. The motion vector indicates the moving direction and size of an object. The reference image index indicates a reference image of the current block among reference images included in a reference image list. The prediction direction refers to one of unidirectional L0 prediction, unidirectional L1 prediction, or bidirectional prediction (L0 prediction and L1 prediction). According to the prediction direction of the current block, at least one of the motion information in the L0 direction or the motion information in the L1 direction can be used. The bidirectional weight index can identify the weight applied to the L0 prediction block and the weight applied to the L1 prediction block.
[0108] FIG. 6 is a flowchart of an inter prediction method according to an embodiment of the present application.
[0109] As shown in FIG. 6, the inter prediction method includes determining an inter prediction mode of a current block (S601), obtaining motion information of the current block according to the determined inter prediction mode (S602), and performing motion compensation prediction for the current block based on the obtained motion information (S603).
[0110] Here, the inter prediction mode indicates a number of ways for determining motion information of the current block, and may include an inter prediction mode using translation motion information and an inter prediction mode using affine motion information. As an example, the inter prediction mode using translation 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. According to the inter prediction mode, the motion information of the current block may be determined based on information analyzed from a neighboring block adjacent to the current block or a bitstream.
[0111] As an example, the motion information of the current block may be obtained according to the motion information of a spatial neighboring block included in the same image as the current block or a collocated block included in an image different from the current block. The spatial neighboring block includes at least one of a neighboring block adjacent to the top edge of the current block, a neighboring block adjacent to the left side, a neighboring block adjacent to the upper left corner, a neighboring block adjacent to the upper right corner, or a neighboring block adjacent to the lower left corner. The collocated block may have the same position and size as the current block in the reference image. As an example, FIG. 7 is a diagram showing a collocated block. The reference image may be determined according to a reference image indicated by index information.
[0112] The accuracy of the motion vector of the current block may be determined as one of a plurality of motion vector accuracy candidates. As an example, the motion vector accuracy candidates may include at least one of an octo pel, a quarter pel, a half pel, an integer pel, a 2-integer pel, or a 4-integer pel. The number or type of the motion vector accuracy candidates may be determined according to a sequence, a slice, or a block unit. As an example, information for determining the number or type of the motion vector accuracy candidates may be signaled via a bitstream. Alternatively, the number or type of the model motion vector accuracy candidates may be determined based on whether an inter prediction mode or an affine motion model of the current block is used. Information for identifying one of a plurality of motion vector accuracy candidates may also be signaled via a bitstream.
[0113] Intra prediction refers to predicting a current block using reconstructed samples that are encoded or decoded around the current block, in which case the intra prediction of the current block can use reconstructed samples before applying loop filtering.
[0114] The intra prediction method includes intra prediction based on a matrix and normal intra prediction considering the directionality with surrounding reconstruction samples. Information indicating the intra prediction method of the current block may be signaled through a bitstream. The information may be a 1-bit identifier. Alternatively, the intra prediction method of the current block may be determined based on at least one of the position, size, shape, or intra prediction method of a neighboring block of the current block. As an example, if the current block is located across an image boundary, it may be set that the matrix-based intra prediction is not applied to the current block.
[0115] Matrix-based intra prediction is a method of obtaining a prediction block of a current block based on a matrix product between a matrix pre-stored in an encoder and a decoder and a surrounding reconstructed sample of the current block. Information specifying one of a plurality of pre-stored matrices can be signaled via a bitstream. The decoder can determine a matrix for intra prediction of the current block based on the information and the size of the current block.
[0116] Conventional intra prediction is a method of obtaining a prediction block for a current block based on a non-directional intra prediction mode or a directional intra prediction mode. The following describes in more detail the process of performing intra prediction based on conventional intra prediction with reference to the drawings.
[0117] FIG. 8 is a flowchart of an intra prediction method according to an embodiment of the present application.
[0118] A reference sample line of a current block may be determined (S801). The reference sample line refers to a set of reference samples included in a line k-th away from the top and / or left side of the current block. The reference samples may be obtained from encoded or decoded reconstruction samples around the current block.
[0119] Index information for identifying a reference sample line of the current block among a plurality of reference sample lines may be signaled via a bitstream. For example, index information intra_luma_ref_idx for identifying a reference sample line of the current block may be signaled via a bitstream. The index information may be signaled in a coding block unit.
[0120] The multiple reference sample lines may include at least one of the first, second, third, or fourth lines at the top and / or left side of the current block. A reference sample line formed by a row adjacent to the top of the current block and a column adjacent to the left side of the current block of the multiple reference sample lines may be referred to as an adjacent reference sample line, and other reference sample lines may be referred to as non-adjacent reference sample lines.
[0121] FIG. 9 is a drawing showing a reference sample line.
[0122] FIG. 9 illustrates one adjacent reference sample line formed by rows or columns adjacent to the current block and three non-adjacent reference sample lines formed by rows or columns not adjacent to the current block.
[0123] Only a part of the multiple reference sample lines may be selected as the reference sample lines of the current block. As an example, the remaining reference sample lines other than the second non-adjacent reference sample line among the reference sample lines shown in FIG. 9 may be set as candidate reference sample lines. Table 1 shows indexes assigned to each candidate reference sample line.
[0124] [Table 1]
[0125] More or less than the number of candidate reference sample lines described above may also be set. Furthermore, the number or positions of the non-adjacent reference sample lines set as the candidate reference sample lines are not limited to the examples described above. As an example, the first non-adjacent reference sample line and the third non-adjacent reference sample line may be set as the candidate reference sample lines, or the second non-adjacent reference sample line and the third non-adjacent reference sample line may be set as the candidate reference sample lines. Alternatively, the first non-adjacent reference sample line, the second non-adjacent reference sample line, and the third non-adjacent reference sample line may all be set as the candidate reference sample lines.
[0126] The number or type of candidate reference sample lines may be determined based on at least one of the size, shape, and position of the current block, whether or not to divide it into sub-blocks, or an intra-prediction mode.
[0127] The reference sample line of the current block may also be determined based on at least one of the position, size, shape, or predictive coding mode of the neighboring block of the current block. As an example, if the current block borders the boundary of an image, a tile, a slice, or a coding tree unit, the neighboring reference sample line may be determined as the reference sample line of the current block.
[0128] Alternatively, if the current block is non-square, the adjacent reference sample line may be determined as the reference sample line of the current block, or if the ratio of the width and height of the current block is greater than or equal to a threshold value, the adjacent reference sample line may be determined as the reference sample line of the current block.
[0129] The reference sample line may include a top reference sample located at the top of the current block and a left reference sample located to the left of the current block. The top reference sample and the left reference sample may be obtained from reconstructed samples around the current block. The reconstructed samples may be in a state before applying a loop filter.
[0130] The number of reference samples included in the reference sample line may be determined based on the distance between the reference sample lines. For example, the number of reference samples included in the reference sample line having a distance i from the current block may be greater than the number of reference samples included in the reference sample line having a distance i-1 from the current block. Therefore, the number of reference samples included in the non-adjacent reference sample line is greater than the number of reference samples included in the adjacent reference sample line.
[0131] The difference between the number of reference samples included in a non-adjacent reference sample line having a distance i from the current block and the number of reference samples included in an adjacent reference sample line may be defined as a reference sample quantity offset. In this case, the difference in the number of top reference samples located at the top of the current block may be defined as offsetX[i], and the difference in the number of left reference samples located to the left of the current block may be defined as offsetY[i]. offsetX and offsetY may be determined based on the distance between the current block and the non-adjacent reference sample line. For example, offsetX and offsetY may be set to an integer multiple of i. For example, offsetX[i] and offset[i] may be 2i.
[0132] Alternatively, the reference sample number offset can be determined based on the width-to-height ratio of the current block. Equation 1 shows an example of quantifying the width-to-height ratio of the current block.
number
[0133] Methods other than those shown in Equation 1 may be used to quantify the width-to-height ratio of the current block.
[0134] Based on the ratio of the width and height of the current block, the values of offsetX and offsetY can be determined. For example, if the value of whRatio is greater than 1, the value of offsetX can be set greater than offsetY. For example, the value of offsetX can be set to 1 and the value of offsetY can be set to 0. Conversely, if the value of whRatio is less than 1, the value of offsetY can be set greater than offsetX. For example, the value of offsetX can be set to 0 and the value of offsetY can be set to 1.
[0135] In addition to the top-left reference sample having the same coordinates on the x-axis and y-axis, a non-adjacent reference sample line having a distance i from the current block can be composed of (refW+offsetX[i]) top reference samples and (refH+offsetY[i]) left reference samples, where refW and refH indicate the lengths of the adjacent reference sample lines and can be set as shown in Equations 2 and 3 below, respectively.
number
[0136] In Equation 2 and Equation 3, nTbW denotes the width of a coding block or a transform block on which intra prediction is performed, and nTbH denotes the height of a coding block or a transform block on which intra prediction is performed.
[0137] As a result, a reference sample line with a distance i from the current block can be constructed by (refW+refH+offsetX[i]+offsetY[i]+1) reference samples.
[0138] According to an intra prediction mode of the current block, at least one of the reference samples belonging to a reference sample line is used to obtain a prediction sample.
[0139] Next, the intra prediction mode of the current block can be determined (S802). For the intra prediction mode of the current block, at least one of the non-directional intra prediction mode or the directional intra prediction mode can be determined as the intra prediction mode of the current block. The non-directional intra prediction mode includes planner and DC, and the directional intra prediction mode includes 33 or 65 modes from the lower left diagonal direction to the upper right diagonal direction.
[0140] FIG. 10 is a diagram showing intra prediction modes.
[0141] FIG. 10(a) shows 35 intra prediction modes, and FIG. 10(b) shows 67 intra prediction modes.
[0142] More or less intra-prediction modes than those shown in FIG. 10 may also be defined.
[0143] A Most Probable Mode (MPM) may be set based on the intra prediction modes of adjacent blocks adjacent to the current block. Here, the adjacent blocks may include a left adjacent block adjacent to the left side of the current block and a top adjacent block adjacent to the top of the current block. If the coordinates of the top left sample of the current block are referred to as (0,0), the left adjacent block may include a sample at a position of (-1,0), (-1,H-1), or (-1,(H-1) / 2), where H indicates the height of the current block. The top adjacent block may include a sample at a position of (0,-1), (W-1,-1), or ((W-1) / 2,-1), where W indicates the width of the current block.
[0144] When the neighboring blocks are coded by normal intra prediction, the MPM can be obtained based on the intra prediction modes of the neighboring blocks. Specifically, the intra prediction mode of the left neighboring block can be set to a variable candIntraPredModeA, and the intra prediction mode of the top neighboring block can be set to a variable candIntraPredModeB.
[0145] In this case, if the neighboring block cannot be used (e.g., if the neighboring block has not been coded or decoded or if the neighboring block's position exceeds an image boundary), if the neighboring block is coded with matrix-based intra prediction, if the neighboring block is coded with inter prediction, or if the neighboring block is included in a different coding tree unit than the current block, a variable candIntraPredModeX (where X is A or B) derived based on the intra prediction mode of the neighboring block can be set to a default mode. Here, the default mode may include at least one of planner, DC, vertical mode, or horizontal mode.
[0146] Alternatively, when a neighboring block is coded by intra prediction of a matrix, an intra prediction mode corresponding to an index value for specifying one of the matrices can be set to candIntraPredModeX. Therefore, a lookup table indicating a mapping relationship between index values for specifying a matrix and intra prediction modes can be stored in advance in the encoder and decoder.
[0147] The MPM may be obtained based on variables candIntraPredModeA and candIntraPredModeB. As an example, candIntraPredModeA and candIntraPredModeB may be set as the MPM, or an intra prediction mode similar to a larger or smaller value of candIntraPredModeA or candIntraPredModeB may be set as the MPM. Here, an intra prediction mode similar to candIntraPredModeX (X is A or B) may be an intra prediction mode whose index difference value from candIntraPredModeX is ±1 or ±2.
[0148] The number of MPMs included in the MPM list can be preset in the encoder and decoder. As an example, the number of MPMs can be 3, 4, 5, or 6. Or, information indicating the number of MPMs can be signaled via a bitstream. Or, the number of MPMs can be determined based on at least one of the predictive coding mode of the neighboring block, the size, shape, or reference sample line index of the current block. As an example, if a neighboring reference sample line is determined as the reference sample line of the current block, N MPMs can be used, and conversely, if a non-neighboring reference sample line is determined as the reference sample line of the current block, M MPMs can be used. M is a natural number smaller than N, and as an example, N is 6, and M can be 5, 4, or 3. Therefore, if the index of the reference sample line of the current block is 0 and the MPM identifier is true, the intra prediction mode of the current block can be determined to be one of the six candidate intra prediction modes, and conversely, if the index of the reference sample line of the current block is greater than 0 and the MPM identifier is true, the intra prediction mode of the current block can be determined to be one of the five candidate intra prediction modes.
[0149] Alternatively, a fixed number of MPM candidates (eg, 6 or 5) can be used regardless of the index of the reference sample line of the current block.
[0150] In the embodiments described below, the number of MPMs is assumed to be six, and the six MPMs are referred to as MPM[0], MPM[1], MPM[2], MPM[3], MPM[4], and MPM[5]. In embodiments with fewer than six MPMs, implementations can be implemented using only a portion of the six MPMs described in the embodiments described below. Alternatively, in embodiments with more than six MPMs, implementations can be implemented including the six MPMs described in the embodiments described below.
[0151] The initial value of the MPM can be set to candIntraPredModeA and a non-directional intra prediction mode or a directional intra prediction mode different from candIntraPredModeA. Here, the directional intra prediction mode that can be set to the MPM may include at least one of a vertical intra prediction mode, a horizontal intra prediction mode, a lower left diagonal intra prediction mode, an upper left diagonal intra prediction mode, or an upper right diagonal intra prediction mode. As an example, the initial value of the MPM can be set as follows.
[0152] MPM[0]=candIntraPredModeA MPM[1]=(candIntraPredModeA==INTRA_PLANAR)?INTRA_DC:INTRA_PLANAR MPM[2]=INTRA_ANGULAR50 MPM[3]=INTRA_ANGULAR18 MPM[4]=INTRA_ANGULAR2 MPM[5]=INTRA_ANGULAR34 In the above example, ((A)?B:C) denotes a function that returns a value B if the condition described in A is true, and returns a value C if the condition described in A is false.
[0153] If candIntraPredModeA is the same as candIntraPredModeB and candIntraPredModeA is a directional intra prediction mode, MPM[0] can be set to candIntraPredModeA, and an intra prediction mode similar to candIntraPredModeA can be set to MPM. The intra prediction mode similar to candIntraPredModeA may be an intra prediction mode whose index difference value from candIntraPredModeA is ±1 or ±2. Modulus operation (%) and offset can be used to derive an intra prediction mode similar to candIntraPredModeA. Furthermore, at least one of a non-directional intra prediction mode or an intra prediction mode whose angle difference from candIntraPredModeA is a predefined value can be set to MPM. Here, the intra prediction mode whose angle difference from candIntraPredModeA is a predefined value may be an intra prediction mode perpendicular to candIntraPredModeA or an intra prediction mode opposite to candIntraPredModeA. As an example, the MPM can be obtained as follows:
[0154] MPM[0]=candIntraPredModeA MPM[1]=INTRA_PLANAR MPM[2]=INTRA_DC MPM[3]=2+((candIntraPredModeA+62)%65) MPM[4]=2+((candIntraPredModeA-1)%65) MPM[5]=2+((candIntraPredModeA+94)%65) MPM[3] corresponds to (candIntraPredModeA-1), MPM[4] corresponds to (candIntraPredModeA+1), and MPM[5] indicates an intra prediction mode perpendicular to candIntraPredModeA.
[0155] If candIntraPredModeA is different from candIntraPredModeB, candIntraPredModeA and candIntraPredModeB can be set to MPM[0] and MPM[1], respectively. Alternatively, candIntraPredA can be compared with candIntraPredModeB and the maximum value can be set to MPM[0] and the minimum value can be set to MPM[1]. Conversely, the minimum value can be set to MPM[0] and the maximum value can be set to MPM[1].
[0156] In this case, if candIntraPredModeA and candIntraPredModeB are both directional intra-prediction modes, they can be set to the non-directional intra-prediction mode MPM. As an example, planner and DC can be set to MPM[2] and MPM[3], respectively.
[0157] In addition, an intra prediction mode similar to the larger or smaller value of candIntraPredModeA and candIntraPredModeB may be set to the MPM. An intra prediction mode similar to candIntraPredModeX may be obtained by adding or subtracting an offset to candIntraPredModeX. In this case, the maximum size of the offset may be determined based on the difference between the maximum and minimum values of candIntraPredModeA and candIntraPredModeB. As an example, the offset may be a natural number such as 1 or 2.
[0158] As an example, if the value obtained by subtracting MIN(candIntraPredModeA, candIntraPredModeB) from MAX(candIntraPredModeA, candIntraPredModeB) is not 64 or 1, MPM[4] and MPM[5] can be obtained using the following formula.
[0159] MPM[4]=2+((MAX(MPM[0],MPM[1])+62)%65 MPM[5]=2+((MAX(MPM[0],MPM[1])-1)%65 Here, the MAX(A,B) function is a function that returns the larger of A and B, and the MIN(A,B) function is a function that returns the smaller of A and B. MPM[4] corresponds to (MAX(MPM[0],MPM[1])-1), and MPM[5] corresponds to (MAX(MPM[0],MPM[1])+1). Conversely, if the difference between MAX(candIntraPredModeA,candIntraPredModeB) and MIN(candIntraPredModeA,candIntraPredModeB) is 64 or 1, MPM[4] and MPM[5] can be obtained as follows.
[0160] MPM[4]=2+((MAX(MPM[0],MPM[1])+61)%65 MPM[5]=2+(MAX(MPM[0],MPM[1])%65 MPM[4] corresponds to (MAX(MPM[0],MPM[1])-2) and MPM[5] corresponds to (MAX(MPM[0],MPM[1])+2).
[0161] If one of candIntraPredModeA and candIntraPredModeB is a directional intra prediction mode and the other is a non-directional intra prediction mode, at least one of a non-directional intra prediction mode different from MIN(candIntraPredModeA, candIntraPredModeB), a directional intra prediction mode similar to MAX(candIntraPredModeA, candIntraPredModeB), or an intra prediction mode whose angle difference with MAX(candIntraPredModeA, candIntraPredModeB) is a predefined value can be set to MPM. As an example, MPM[2] to MPM[5] can be obtained as follows.
[0162] MPM[2] = !MIN(MPM[0],MPM[1]) MPM[3]=2+((MAX(MPM[0],MPM[1])+62)%65 MPM[4]=2+((MAX(MPM[0],MPM[1])-1)%65 MPM[5]=2+((MAX(MPM[0],MPM[1])+94)%65 MPM[2] indicates a non-directional intra prediction mode different from MPM[0] or MPM[1]. For example, if MIN(MPM[0], MPM[1]) is DC, MPM[2] is set to planner, and if MIN(MPM[0], MPM[1]) is planner, MPM[2] is set to DC. MPM[3] corresponds to ((MAX(MPM[0], MPM[1])-1), and MPM[4] corresponds to (MAX(MPM[0], MPM[1])+1). MPM[5] indicates an intra prediction mode perpendicular to (MAX(MPM[0], MPM[1]). Unlike the above example, an MPM obtained by adding or subtracting 2 from (MAX(MPM[0], MPM[1]) can also be added to the MPM list.
[0163] If one of candIntraPredA and candIntraPredB is a non-directional intra mode and the other is a directional intra prediction mode, that is, if one of candIntraPredA and PredIntraPredB is less than 2 and the other is greater than or equal to 2, the maximum value of candIntraPredA and candIntraPredB can be set as MPM. In addition, an intra prediction mode similar to the maximum value or an intra prediction mode perpendicular to the maximum value can be set as MPM. As an example, MPM[0] to MPM[5] can be obtained as follows:
[0164] MPM[0]=MAX(candIntraPredA,candIntraPredB) MPM[1]=INTRA_PLANAR MPM[2]=INTRA_DC MPM[3]=2+((MAX(candIntraPredA,candIntraPredB)+62)%65 MPM[4]=2+((MAX(candIntraPredA,candIntraPredB])-1)%65 MPM[5]=2+((MAX(candIntraPredA,candIntraPredB)+94)%65 MPM[3] corresponds to ((MAX(candIntraPredA, candIntraPredB)-1), and MPM[4] corresponds to (MAX(candIntraPredA, candIntraPredB)+1). MPM[5] indicates an intra prediction mode perpendicular to (MAX(candIntraPredA, candIntraPredB). Unlike the example above, an MPM obtained by adding 2 to or subtracting 2 from (MAX(candIntraPredA, candIntraPredB) can also be added to the MPM list.
[0165] The MPM can be obtained by considering the index of the reference sample line of the current block. In particular, if a non-adjacent reference sample line is determined as the reference sample line of the current block, a non-directional prediction mode such as planner or DC may not be set as the MPM. As an example, the initial value of the MPM can be set as follows according to whether an adjacent reference sample line is determined as the reference sample line of the current block.
[0166] MPM[0]=(IntraLumaRefLineIdx==0)?candIntraPredModeA:INTRA_ANGULAR2 MPM[1]=(IntraLumaRefLineIdx==0)?(candIntraPredModeA:==INTRA_PLANAR?INTRA_DC:INTRA_PLANAR):INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR50 MPM[3]=(IntraLumaRefLineIdx==0)?INTRA_ANGULAR18:INTRA_ANGULAR34 MPM[4]=(IntraLumaRefLineIdx==0)?INTRA_ANGULAR2:INTRA_ANGULAR66 MPM[5]=(IntraLumaRefLineIdx==0)?INTRA_ANGULAR34:INTRA_ANGULAR42 If the reference sample line of the current block is a non-adjacent reference sample line, and candIntraPredModeA and candIntraPredModeB are both directional intra-prediction modes, the MPM can be obtained as follows:
[0167] MPM[0]=candIntraPredModeA MPM[1]=candIntraPredModeB MPM[2]=INTRA_ANGULAR2 MPM[3]=INTRA_ANGULAR18 MPM[4]=INTRA_ANGULAR50 MPM[5]=INTRA_ANGULAR34 If the reference sample line of the current block is a non-adjacent reference sample line, and one of candIntraPredModeA and candIntraPredModeB is a non-directional intra prediction mode and another one is a directional intra prediction mode, the MPM can be obtained as follows:
[0168] MPM[0]=MAX(candIntraPredModeA,candIntraPredModeB) MPM[1]=INTRA_ANGULAR2 MPM[2]=INTRA_ANGULAR18 MPM[3]=INTRA_ANGULAR50 MPM[4]=INTRA_ANGULAR34 MPM[5]=INTRA_ANGULAR66 After generating an MPM list including a plurality of MPMs, information indicating whether the same MPM as the intra prediction mode of the current block is included in the MPM list is signaled via a bitstream. An identifier having one bit of the information may be referred to as an MPM identifier. If the MPM identifier indicates that the same MPM as the current block is included in the MPM list, index information identifying one of the MPMs may be signaled via a bitstream. As an example, index information mpm_idx identifying one of the plurality of MPMs may be signaled via a bitstream. The MPM identified by the index information may be set as the intra prediction mode of the current block. If the MPM identifier indicates that the same MPM as the current block is not included in the MPM list, residual mode information indicating one of the residual intra prediction modes other than the MPM may be signaled via a bitstream. When the residual mode information reallocates an index to a residual intra prediction mode other than the MPM, it points to an index value corresponding to the intra prediction mode of the current block. The decoder may arrange the MPMs in ascending order and compare the residual mode information with the MPMs to determine the intra-prediction mode of the current block. For example, if the residual mode information is equal to or less than the MPM, the decoder may add 1 to the residual mode information to obtain the intra-prediction mode of the current block.
[0169] When obtaining the intra-prediction mode of the current block, the comparison of some of the MPMs with the residual mode information can be skipped. As an example, the MPM used as the non-directional intra-prediction mode of the MPM can be excluded from the comparison. When the non-directional intra-prediction mode is set to the MPM, it is clear that the residual mode information refers to the directional intra-prediction mode, so that the residual MPM other than the non-directional intra-prediction mode can be compared with the residual mode information to obtain the intra-prediction mode of the current block. Instead of excluding the non-directional intra-prediction mode from the comparison, the number of the non-directional intra-prediction modes can be added to the residual mode information, and then the resultant value can be compared with the residual MPM.
[0170] Instead of setting the default mode to the MPM, information indicating whether the intra prediction mode of the current block is the default mode may be signaled via the bitstream. The information may be a 1-bit identifier, and the identifier may be referred to as a default mode identifier. The default mode identifier may be signaled only if the MPM identifier 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 planner, DC, vertical mode, or horizontal mode. As an example, if planner is set as the default mode, the default mode identifier may indicate whether the intra prediction mode of the current block is planner. If the default mode identifier indicates that the intra prediction mode of the current block is not the default mode, one of the multiple MPMs indicated by the index information may be set as the intra prediction mode of the current block.
[0171] When using a default mode identifier, the same intra prediction mode as the default mode may be set so that it is not set to the MPM. As an example, if the default mode identifier indicates whether the intra prediction mode of the current block is planner, the MPM corresponding to the planner of the above six MPMs may be replaced with another mode, or the five MPMs other than the MPM corresponding to the planner may be used to obtain the intra prediction mode of the current block.
[0172] When multiple intra prediction modes are set to a default mode, index information indicating one of the default modes may be signaled, and the intra prediction mode of the current block may be set to the default mode indicated by the index information.
[0173] If the index of the reference sample line of the current block is not 0, the default mode may be set not to be used. As an example, if it is determined that a non-adjacent reference sample line is the reference sample line of the current block, a non-directional intra prediction mode such as DC mode or planner mode may be set not to be used. Therefore, if the index of the reference sample line is not 0, the default mode identifier may not be signaled, and the value of the default mode identifier may be set to a predefined value (i.e., false).
[0174] After the intra-prediction mode of the current block is determined, a prediction sample for the current block can be obtained based on the determined intra-prediction mode (S803).
[0175] When the DC mode is selected, a predicted sample for the current block can be generated based on an average value of the reference samples. Specifically, the values of all samples in the predicted block can be generated based on an average value of the reference samples. The average value can be obtained based on at least one of a top reference sample located at the top of the current block and a left reference sample located to the left of the current block.
[0176] According to the shape of the current block, the number or range of reference samples used to obtain the average value varies. As an example, if the current block is a non-square block with a width greater than its height, the average value can be calculated using only the top reference sample. Conversely, if the current block is a non-square block with a width less than its height, the average value can be calculated using only the left reference sample. That is, if the width of the current block is different from its height, the average value can be calculated using only the adjacent reference sample on the longer side. Alternatively, based on the ratio of the width and height of the current block, it can be determined whether to calculate the average value using only the top reference sample or only the left reference sample.
[0177] When the planner mode is selected, a prediction sample can be obtained using a horizontal prediction sample and a vertical prediction sample. Here, the horizontal prediction sample is obtained based on a left reference sample and a right reference sample located on the same horizontal line as the prediction sample, and the vertical prediction sample is obtained based on a top reference sample and a bottom reference sample located on the same vertical line as the prediction sample. Here, the right reference sample can be generated by duplicating a reference sample adjacent to the upper right corner of the current block, and the bottom reference sample can be generated by duplicating a reference sample adjacent to the lower left corner of the current block. The horizontal prediction sample can be obtained based on a weighted sum operation between the left reference sample and the right reference sample, and the vertical prediction sample can be obtained based on a weighted sum operation between the top reference sample and the bottom reference sample. In this case, the weight value corresponding to each reference sample can be determined according to the position of the prediction sample. The prediction sample can be obtained based on an average operation or a weighted sum operation between the horizontal prediction sample and the vertical prediction sample. When performing the weighted sum operation, the weight value to be given to the horizontal prediction sample and the vertical prediction sample can be determined based on the position of the prediction sample.
[0178] When a directional prediction mode is selected, a parameter can be determined to indicate the prediction direction (or prediction angle) of the selected directional prediction mode. Table 2 below shows the intra direction parameter intraPredAng for each intra prediction mode.
[0179] [Table 2]
[0180] Table 2 shows the intra direction parameters of each intra prediction mode having an index of 2 to 34 when 35 intra prediction modes are defined. When more than 33 directional intra prediction modes are defined, Table 2 can be further subdivided to set the intra direction parameters of each directional intra prediction mode.
[0181] After aligning the top reference sample and the left reference sample of the current block, a prediction sample can be obtained based on the value of the intra direction parameter, where if the value of the intra direction parameter is negative, the left reference sample and the top reference sample are aligned.
[0182] 11 and 12 are drawings showing examples of one-dimensional arrays in which reference samples are arranged in a row.
[0183] Fig. 11 shows an example of a vertical one-dimensional array in which reference samples are arranged along the vertical direction, and Fig. 12 shows an example of a horizontal one-dimensional array in which reference samples are arranged along the horizontal direction. The examples of Fig. 11 and Fig. 12 will be described assuming that 35 intra prediction modes are defined.
[0184] If the intra prediction mode index is any of 11 to 18, a horizontal one-dimensional array in which the top reference sample is rotated in a counterclockwise direction can be applied, and if the intra prediction mode index is any of 19 to 25, a vertical one-dimensional array in which the left reference sample is rotated in a clockwise direction can be applied. The reference samples can be aligned according to the angle of the intra prediction mode.
[0185] Based on the intra direction parameters, reference sample decision parameters can be determined, which may include a reference sample index for identifying a reference sample and a weight parameter for determining a weight applied to the reference sample.
[0186] The reference sample index iIdx and the weight parameter ifact can be obtained by the following Equations 4 and 5, respectively.
number
[0187] In Equations 4 and 5, P angdenotes an intra direction parameter. A reference sample identified according to a reference sample index iIdx corresponds to an integer pixel.
[0188] At least one reference sample can be identified to obtain the predicted sample. Specifically, the position of the reference sample used to obtain the predicted sample can be identified by considering the gradient of the prediction mode. As an example, the reference sample index iIdx can be used to identify the reference sample used to obtain the predicted sample.
[0189] In this case, if the slope of the intra prediction mode is not represented by one reference sample, a prediction sample can be generated by interpolating multiple reference samples. As an example, if the slope of the intra prediction mode is a value between the slope between the prediction sample and a first reference sample and the slope between the prediction sample and a second reference sample, the prediction sample can be obtained by interpolating the first and second reference samples. That is, if an angular line based on the intra prediction angle does not pass through a reference sample located at an integer pixel, the prediction sample can be obtained by interpolating reference samples located at adjacent positions to the left and right or above and below the position where the angular line passes.
[0190] Equation 6 below shows an example of obtaining a predicted sample based on a reference sample.
number
[0191] In Equation 6, P denotes a predicted sample, and Ref_1D denotes one of the reference samples in the one-dimensional array, where the position of the reference sample can be determined according to the position (x, y) of the predicted sample and the reference sample index iIdx.
[0192] If the slope of the intra prediction mode is represented by one reference sample, the weight parameter i factis set to 0. Therefore, Equation 6 can be simplified as shown in Equation 7 below.
number
[0193] Intra prediction for the current block may also be performed based on multiple intra prediction modes. For example, an intra prediction mode may be obtained according to a prediction sample, and the prediction sample may be obtained based on an intra prediction mode assigned to each prediction sample.
[0194] Alternatively, an intra prediction mode can be obtained according to a region, and intra prediction for each region can be performed based on the intra prediction mode assigned to each region, where the region may include at least one sample. At least one of the size or shape of the region can be adaptively determined based on at least one of the size, shape or intra prediction mode of a current block. Alternatively, at the encoder and decoder, at least one of the size or shape of the region may be predefined, independent of the size or shape of the current block.
[0195] Alternatively, intra prediction may be performed based on multiple intra predictions, and a final prediction sample may be obtained based on an average operation or a weighted sum operation of multiple prediction samples obtained through multiple intra predictions. As an example, intra prediction may be performed based on a first intra prediction mode to obtain a first prediction sample, and intra prediction may be performed based on a second intra prediction mode to obtain a second prediction sample. Then, a final prediction sample may be obtained based on an average operation or a weighted sum operation of the first prediction sample and the second prediction sample. In this case, the weights assigned to each of the first prediction sample and the second prediction sample may be determined according to at least one of whether the first intra prediction mode is a non-directional or directional prediction mode, whether the second intra prediction mode is a non-directional or directional prediction mode, or the intra prediction mode of a neighboring block.
[0196] The multiple intra-prediction modes may be a combination of non-directional intra-prediction modes and directional prediction modes, a combination of directional prediction modes, or a combination of non-directional prediction modes.
[0197] FIG. 13 is a diagram illustrating angles formed by directional intra prediction modes with a line parallel to the X-axis.
[0198] As shown in the example of Fig. 13, the directional prediction mode can exist between the lower left diagonal direction and the upper right diagonal direction. In terms of the x-axis and the angle at which the directional prediction mode is formed, the directional prediction mode can exist between 45 degrees (lower left diagonal direction) and -135 degrees (upper right diagonal direction).
[0199] If the current block is non-square, a situation may arise in which a prediction sample is obtained using a reference sample that is farther away from the prediction sample, instead of a reference sample that is closer to the prediction sample of a reference sample located on a corner line according to the intra prediction angle, according to the intra prediction mode of the current block.
[0200] FIG. 14 is a schematic diagram of how prediction samples are obtained when the current block is non-square.
[0201] As an example, assume that the current block is a non-square block with a width greater than its height, as shown in (a) of Figure 14, and the intra prediction mode of the current block is a directional intra prediction mode with an angle between 0 and 45 degrees. In this case, when obtaining a prediction sample A near the right column of the current block, a situation may occur in which, among reference samples located in an angle mode according to the angle, a left reference sample L far from the prediction sample is used instead of a top reference sample T close to the prediction sample.
[0202] As another example, assume that the current block is a non-square block with height greater than width as shown in (b) of Figure 14, and the intra prediction mode of the current block is a directional intra prediction mode between -90 degrees and -135 degrees. In this case, when obtaining a prediction sample A near the bottom row of the current block, a situation may occur in which the top reference sample T far from the prediction sample is used instead of the left reference sample L close to the prediction sample among reference samples located in the angle mode according to the angle.
[0203] To solve the above problem, if the current block is non-square, the intra prediction mode of the current block can be replaced with an intra prediction mode of the opposite direction. Therefore, for non-square blocks, a directional prediction mode having an angle larger or smaller than the directional prediction mode shown in FIG. 10 can be used. Such a directional intra prediction mode can be defined as a wide angle intra prediction mode. The wide angle intra prediction mode refers to a directional intra prediction mode that is not included in the range of 45 degrees to -135 degrees.
[0204] FIG. 15 is a diagram illustrating a wide-angle intra prediction mode.
[0205] In the example shown in FIG. 15, intra prediction modes with indexes from −1 to −14 and intra prediction modes with indexes between 67 and 80 indicate wide-angle intra prediction modes.
[0206] FIG. 15 illustrates 14 wide-angle intra prediction modes (-1 to -14) with angles greater than 45 degrees and 14 wide-angle intra prediction modes (67 to 80) with angles less than -135 degrees, however, a greater or lesser number of wide-angle intra prediction modes may be defined.
[0207] When using a wide-angle intra prediction mode, 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.
[0208] By using a wide-angle intra prediction mode, sample A shown in FIG. 14(a) can be predicted using reference sample T, and sample A shown in FIG. 14(b) can be predicted using reference sample L.
[0209] In addition to the original intra prediction modes and the N wide-angle intra prediction modes, a total of 67+N intra prediction modes can be used. As an example, Table 3 shows the intra direction parameters of the intra prediction modes when defining 20 wide-angle intra prediction modes.
[0210] [Table 3]
[0211] If the current block is non-square and the intra-prediction mode of the current block obtained in S802 belongs to a transformation range, the intra-prediction mode of the current block may be transformed to a wide-angle intra-prediction mode. The transformation range may be determined based on at least one of a size, a shape, or a ratio of the current block, where the ratio indicates a ratio between the width and the height of the current block.
[0212] If the current block is a non-square with width greater than height, the transform range may be set to the upper right diagonal intra prediction mode index (e.g., 66) through (upper right diagonal intra prediction mode index, -N), where N may be determined based on the proportion of the current block. If the intra prediction mode of the current block belongs to the transform range, the intra prediction mode may be transformed to a wide-angle intra prediction mode. The transform may be a subtraction of a predefined value from the intra prediction mode, where the predefined value may be the sum of intra prediction modes other than the wide-angle intra prediction mode (e.g., 67).
[0213] According to the above embodiment, the intra prediction modes between 66th and 53rd can be converted to wide-angle intra prediction modes between -1th and -14th, respectively.
[0214] If the current block is non-square with its height greater than its width, the transform range may be set to the bottom-left diagonal intra-prediction mode index (e.g., 2) through (bottom-left diagonal intra-prediction mode index, +M), where M may be determined based on the proportion of the current block. If the intra-prediction mode of the current block belongs to the transform range, the intra-prediction mode may be converted to a wide-angle intra-prediction mode. The conversion may be adding a predefined value to the intra-prediction mode, and the predefined value may be the sum of directional intra-prediction modes other than the wide-angle intra-prediction mode (e.g., 65).
[0215] According to the embodiment, each of the intra prediction modes between nos. 2 and 15 can be converted to a wide-angle intra prediction mode between nos. 67 and 80.
[0216] Hereinafter, the intra prediction modes belonging to the transform range are referred to as wide-angle intra alternative prediction modes.
[0217] The transform range may be determined based on the ratio of the current block. As an example, Tables 4 and 5 show the transform ranges when 35 intra prediction modes other than the wide-angle intra prediction mode are defined and when 67 intra prediction modes are defined, respectively.
[0218] [Table 4]
[0219] [Table 5]
[0220] As shown in Tables 4 and 5, the number of wide-angle intra alternative prediction modes included in the transform range may vary according to the proportion of the current block.
[0221] The ratio of the current block can be further subdivided and the conversion range can be set as shown in Table 6 below.
[0222] [Table 6]
[0223] When a non-adjacent reference sample line is determined as the reference sample line of the current block, or when a certain multi-line intra prediction coding method is selected from a plurality of reference sample lines, the wide-angle intra prediction mode may be set not to be used. That is, even if 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 to the wide-angle intra prediction mode.
[0224] Alternatively, if it is determined that the intra prediction mode of the current block is a wide-angle intra prediction mode, it is set that a non-adjacent reference sample line cannot be used as a reference sample line of the current block, or if a multi-line intra prediction coding method that selects one of multiple reference sample lines is not used, an adjacent reference sample line can be determined as the reference sample line of the current block.
[0225] When the wide-angle intra prediction mode is not used, refW and refH can 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 can include (nTbW+nTbH+offsetX[i]) top reference samples and (nTbW+nTbH+offsetY[i]) left reference samples. That is, the non-adjacent reference samples with a distance i from the current block can include (2nTbW+2nTbH+offsetX[i]+offsetY[i]+1) reference samples. For example, if the value of whRatio is greater than 1, the value of offsetX can be set to be greater than the value of offsetY. As an example, the value of offsetX can be set to 1, and the value of offsetY can be set to 0. Conversely, if the value of whRatio is less than 1, the value of offsetY can be set to be greater than the value of offsetX. As an example, the value of offsetX can be set to 0 and the value of offsetY can be set to 1.
[0226] By adding and using a wide-angle intra prediction mode to the original intra prediction mode, the resources required for encoding the wide-angle intra prediction mode are increased, and the encoding efficiency is reduced. Therefore, instead of encoding the wide-angle intra prediction mode as it is, an alternative intra prediction mode for the wide-angle intra prediction mode can be encoded to improve the encoding efficiency.
[0227] For example, when the current block is encoded using wide-angle intra prediction mode 67, the intra prediction mode of the current block may be encoded as wide-angle alternative intra prediction mode 2 of 67. Furthermore, when the current block is encoded in wide-angle intra prediction mode −1, the intra prediction mode of the current block may be encoded as wide-angle alternative intra prediction mode 66 of −1.
[0228] The decoder may decode the intra-prediction mode of the current block, and determine whether the decoded intra-prediction mode is included in a transform range. If the decoded intra-prediction mode is a wide-angle alternative intra-prediction mode, the decoder may transform the intra-prediction mode to a wide-angle intra-prediction mode.
[0229] Alternatively, if the current block is coded in a wide-angle intra-prediction mode, the wide-angle intra-prediction mode may be coded as is.
[0230] The encoding of the intra prediction mode can be realized based on the above MPM list. Specifically, if the neighboring block is encoded in a wide-angle intra prediction mode, the MPM can be set based on a wide-angle alternative intra prediction mode corresponding to the wide-angle intra prediction mode. For example, if the neighboring block is encoded in a wide-angle intra prediction mode, a variable candIntraPredModeX (X is A or B) can be set to the wide-angle intra prediction mode alternative intra prediction mode.
[0231] Alternatively, the MPM may be set based on the wide-angle intra prediction mode of the neighboring block. For example, if the neighboring block is coded in a wide-angle intra prediction mode, the variable candIntraPredModeX may be set to the wide-angle intra prediction mode.
[0232] The MPM can be obtained based on whether the reference sample line of the current block is a non-adjacent reference sample line or whether a multi-line intra prediction coding method in which one of a plurality of reference sample lines is selected is applied. As an example, if the reference sample line of the current block is a non-adjacent reference sample line and the intra prediction mode of the adjacent block adjacent to the current block is a wide-angle intra prediction mode, the default mode can be set to the MPM of the current block.
[0233] As an example, if candIntraPredModeA obtained based on the intra prediction mode of the left adjacent block is the same as candIntraPredModeB obtained based on the intra prediction mode of the upper adjacent block, and candIntraPredModeA is planner or DC, the MPM can be obtained as follows, taking into account whether the index of the reference sample line of the current block is 0 or not.
[0234] MPM[0]=(IntraLumaRefLineIdx==0)?Intra_Planar:INTRA_ANGULAR50 MPM[1]=(IntraLumaRefLineIdx==0)?Intra_DC:INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR2 That is, if the reference sample line index of the current block is 0, the planner mode and DC mode are set to MPM, and conversely, if the reference sample line index of the current block is not 0, the vertical intra prediction mode (INTRA_ANGULAR50) and the horizontal intra prediction mode (INTRA_ANGULAR18) can be set to MPM.
[0235] If the index of the reference sample line of the current block is not 0, and candIntraPredModeA is the same as candIntraPredModeB, but candIntraPredModeA is a wide-angle intra prediction mode, the MPM can be obtained as follows:
[0236] MPM[0]=INTRA_ANGULAR2 MPM[1]=INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR50 Alternatively, you can get the MPM as follows:
[0237] MPM[0]=INTRA_ANGULAR50 MPM[1]=INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR2 That is, if the reference sample line index of the current block is not 0, the wide-angle intra prediction mode does not need to be set to MPM.
[0238] If candIntraPredModeA is the same as candIntraPredModeB, and candIntraPredModeA is a directional intra prediction mode, the MPM can be obtained as follows:
[0239] MPM[0]=candIntraPredModeA MPM[1]=2+((candIntraPredModeA+61)%64) MPM[2]=2+((candIntraPredModeA-1)%64) If the index of the reference sample line of the current block is 0 and candIntraPredModeA is different from candIntraPredModeB, MPM[0] and MPM[1] can be set to candIntraPredModeA and candIntraPredModeB, respectively. MPM[2] can be set to be different from MPM[0] and MPM[1] for planner, DC and vertical modes.
[0240] If the index of the reference sample line of the current block is not 0, and one of candIntraPredModeA and candIntraPredModeB is planner and another one is DC, we can obtain the MPM as follows:
[0241] MPM[0]=INTRA_ANGULAR2 MPM[1]=INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR50 If the index of the reference sample line of the current block is not 0, and candIntraPredModeA and candIntraPredModeB are both wide-angle intra prediction modes, the MPM can be obtained as follows:
[0242] MPM[0]=INTRA_ANGULAR2 MPM[1]=INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR50 If the index of the reference sample line of the current block is not 0 and any of candIntraPredModeA and candIntraPredModeB is a wide-angle intra prediction mode, the non-wide-angle intra prediction mode of candIntraPredModeA and candIntraPredModeB can be set to MPM[0], and intra prediction modes similar to MPM[0] can be set to MPM[1] and MPM[2]. As an example, if candIntraPredModeA is a non-wide-angle intra prediction mode and candIntraPredModeB is a wide-angle intra prediction mode, the MPM can be obtained as follows:
[0243] MPM[0]=candIntraPredModeA MPM[1]=2+((candIntraPredModeA+61)%64) MPM[2]=2+((candIntraPredModeA-1)%64) Conversely, if candIntraPredModeA is a wide-angle intra prediction mode and candIntraPredModeB is a non-wide-angle intra prediction mode, the MPM can be obtained as follows:
[0244] MPM[0]=candIntraPredModeB MPM[1]=2+((candIntraPredModeB+61)%64) MPM[2]=2+((candIntraPredModeB-1)%64) If the index of the reference sample line of the current block is not 0, and one of candIntraPredModeA and candIntraPredModeB is planner or DC, and another one is a non-wide-angle intra prediction mode, the non-wide-angle intra prediction mode among candIntraPredModeA and candIntraPredModeB can be set to MPM[0], and intra prediction modes similar to MPM[0] can be set to MPM[1] and MPM[2]. As an example, if candIntraPredModeA is a non-wide-angle intra prediction mode and candIntraPredModeB is planner or DC, the MPM can be obtained as follows:
[0245] MPM[0]=candIntraPredModeA MPM[1]=2+((candIntraPredModeA+61)%64) MPM[2]=2+((candIntraPredModeA-1)%64) Conversely, if candIntraPredModeA is planner or DC and candIntraPredModeB is a non-wide-angle intra prediction mode, the MPM can be obtained as follows:
[0246] MPM[0]=candIntraPredModeB MPM[1]=2+((candIntraPredModeB+61)%64) MPM[2]=2+((candIntraPredModeB-1)%64) If the index of the reference sample line of the current block is not 0 and candIntraPredModeA and candIntraPredModeB are both non-wide-angle intra prediction modes, candIntraPredModeA and candIntraPredModeB can be set to MPM[0] and MPM[1], respectively. Any one of the vertical intra prediction mode (INTRA_ANGULAR50), horizontal intra prediction mode (INTRA_ANGULAR18) or bottom-left diagonal intra prediction mode (INTRA_ANGULAR2) that does not overlap with MPM[0] and MPM[1] can be set to MPM[2].
[0247] A coding block or a transform block can be divided into multiple sub-blocks (or sub-partitions). When a coding block or a transform block is divided into multiple sub-blocks, prediction, transformation and quantization can be performed on each sub-block. The division of a coding block or a transform block into multiple sub-blocks can be defined as a sub-partition intra-coding method.
[0248] Information indicating whether a sub-partition intra-coding method is applied may be signaled via the bitstream. The information may be a 1-bit identifier. As an example, a syntax element "intra_subpartitions_mode_flag" indicating whether a coding block or a transform block is divided into multiple sub-blocks may be signaled via the bitstream.
[0249] Alternatively, it may be determined whether or not the sub-partition intra-coding method is applied based on at least one of the size, shape, or intra-prediction mode of the coding block or transform block. As an example, if the intra-prediction mode of the coding block is a non-directional intra-prediction mode (e.g., planner or DC) or a predefined directional intra-prediction mode (e.g., horizontal intra-prediction mode, vertical intra-prediction mode, or diagonal intra-prediction mode), the sub-partition intra-coding method may not be applied. Alternatively, if the size of the coding block is smaller than a threshold, it may be set not to use the sub-partition intra-coding method.
[0250] Alternatively, when intra prediction is performed on a sub-block based on an intra prediction mode of a coding block, whether or not the sub-partition intra coding method is applied may be determined based on whether or not a reconstructed sample included in a neighboring sub-block needs to be used as a reference sample during intra prediction of the sub-block. As an example, if the intra prediction mode of a coding block is a diagonal intra prediction mode or a wide-angle intra prediction mode, and the neighboring sub-block cannot be used as a reference sample when intra prediction is performed on a sub-block based on the intra prediction mode, the sub-partition intra coding method may be set not to be used.
[0251] Alternatively, the sub-partition intra-coding method may be set not to be used if the ratio of the height and width of the coding block is equal to or greater than a threshold value or equal to or less than a threshold value. Alternatively, the sub-partition intra-coding method may not be used if at least one of the height or width of the coding block is equal to or less than a threshold value. As an example, the sub-partition intra-coding method may not be used if both the height and width of the coding block are equal to or less than a threshold value. The threshold value may have a predefined value for the encoder and the decoder. Alternatively, information for determining the threshold value may be signaled via a bitstream.
[0252] Alternatively, it may be determined whether to signal an identifier for indicating whether to apply a sub-partition intra-coding method according to at least one of the size, shape, or intra-prediction mode of a coding block or a transform block. As an example, only when both the height and width of a coding block are equal to or smaller than a threshold and / or when the size of a coding block is equal to or larger than a threshold, an identifier for indicating whether to apply a sub-partition intra-coding method may be coded and signaled. If an identifier for indicating whether to apply a sub-partition intra-coding method is not coded, the sub-partition intra-coding method may not be applied.
[0253] When applying the sub-partition intra-coding method, a partition shape of the coding block or transform block can be determined, where the partition shape indicates the partition direction of the coding block or transform block. As an example, vertical partitioning refers to partitioning the coding block or transform block using at least one vertical line, and horizontal partitioning refers to partitioning the coding block or transform block using at least one horizontal line.
[0254] FIG. 16 is a diagram showing an example of vertical partitioning and horizontal partitioning.
[0255] FIG. 16(a) shows an example in which a coding block is divided into two sub-blocks, and FIG. 16(b) shows an example in which a coding block is divided into four sub-blocks.
[0256] Information for determining the partition shape of the coding block and the transform block may be signaled via a bitstream. As an example, information indicating whether the coding block or the transform block applies vertical partitioning or horizontal partitioning may be signaled via a bitstream. The information may be a 1-bit identifier intra_subpart_type_flag. A value of the identifier of 1 indicates that the coding block or the transform block is partitioned along the horizontal direction, and a value of the identifier of 0 indicates that the coding block or the transform block is partitioned along the vertical direction.
[0257] Alternatively, the partition shape 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. As an example, the partition shape of the coding block may be determined based on the ratio between the width and height of the coding block. For example, if a whRatio value indicating the ratio between the width and height 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.
[0258] FIG. 17 is a diagram showing an example of determining a division shape of a coding block.
[0259] For convenience of explanation, the first threshold is assumed to be 2. In the example shown in (a) of FIG. 17, the whRatio of the coding block is 1, which is smaller than the first threshold. Therefore, coding of the information indicating the coding block partition shape can be skipped, and horizontal partitioning can be applied to the coding block.
[0260] In the example shown in (b) of Figure 17, the whRatio of the coding block is 2, which is the same as the first threshold. Therefore, coding of the information representing the coding block partition shape can be skipped, and vertical partitioning can be applied to the coding block.
[0261] A second threshold value opposite to the symbol of the first threshold value may also be used to determine the partition shape of the coding block. As an example, if the whRatio value is equal to or less than the second threshold value, horizontal partitioning may be applied to the coding block, otherwise vertical partitioning may be applied to the coding block. The absolute values of the first and second threshold values may be the same, and their symbols may be different. As an example, if the first threshold value is N (where N is an integer such as 1, 2, 4, etc.), the second threshold value may be -N.
[0262] FIG. 18 is a diagram showing an example of determining a division shape of a coding block.
[0263] For convenience of explanation, the second threshold is assumed to be −2. In the example shown in FIG. 18(a), the whRatio of the coding block is −1, which is greater than the second threshold. Therefore, the coding of the information indicating the coding block partition shape can be skipped, and vertical partitioning can be applied to the coding block.
[0264] In the example shown in (b) of Figure 18, the whRatio of the coding block is -2, which is the same as the second threshold value. Therefore, coding of the information indicating the coding block partition shape can be skipped, and horizontal partitioning can be applied to the coding block.
[0265] Alternatively, the partition shape of the coding block may be determined based on the first and second thresholds. For example, if the value of whRatio is equal to or greater than the first threshold, horizontal partitioning may be adopted for the coding block, and if the value of whRatio is equal to or less than the second threshold, vertical partitioning may be adopted for the coding block. If the value of whRatio is between the first and second thresholds, information may be analyzed from the bitstream to determine the partition shape of the current block.
[0266] The first and second thresholds can be predefined at the encoder and decoder, or the first and second thresholds can be defined according to a sequence, an image or a slice.
[0267] Alternatively, the partition shape can be determined based on the size of the coding block or the transform block. As an example, if the size of the coding block is N×n, vertical partitioning can be applied, and if the size of the coding block is n×N, horizontal partitioning can be applied. Here, n may be a natural number smaller than N. N and / or n may be a value predefined in the encoder and the decoder. Or, information for determining N and / or n may be signaled via the bitstream. As an example, N may be 32, 64, 128, or 256, etc. Thus, if the size of the coding block is 128×n (where n is a natural number such as 16, 32, or 64), vertical partitioning can be applied, and if the size of the coding block is n×128, horizontal partitioning can be applied.
[0268] Alternatively, the partition shape of the coding block or transform block may be determined based on the intra prediction mode of the coding block or transform block. As an example, when the intra prediction mode of the coding block is horizontal or a direction similar to the horizontal direction, vertical partitioning may be applied to the coding block. Here, the intra prediction mode of the horizontally similar direction indicates an intra prediction mode (e.g., INTRA_ANGULAR18±N) whose index difference with the horizontal intra prediction mode (e.g., INTRA_ANGULAR18 shown in (b) of FIG. 10) is equal to or less than a threshold. Conversely, when the intra prediction mode of the coding block is vertical or a direction similar to the vertical direction, horizontal partitioning may be applied to the coding block. Here, the intra prediction mode of the vertically similar direction indicates an intra prediction mode (e.g., INTRA_ANGULAR50±N) whose index difference with the vertical intra prediction mode (e.g., INTRA_ANGULAR50 shown in (b) of FIG. 10) is equal to or less than a threshold. Here, the threshold N may be a value predefined in the encoder and the decoder. Alternatively, the information for determining the threshold N can be signaled from the sequence level, the image level or the slice level.
[0269] FIG. 19 is a schematic diagram of an example of determining the partition shape of a coding block based on the intra prediction mode of the coding block.
[0270] As shown in (a) of FIG. 19, when the intra prediction mode of a coding block has a vertically similar direction, horizontal partitioning can be applied to the coding block.
[0271] Conversely, as shown in (b) of FIG. 19, when the intra prediction mode of a coding block has a horizontally similar direction, vertical partitioning can be applied to the coding block.
[0272] Unlike the illustrated example, horizontal partitioning can be applied if the intra prediction mode of the coding block is horizontal or a horizontally similar direction, and vertical partitioning can also be applied if the intra prediction mode of the coding block is vertical or a vertically similar direction.
[0273] When applying vertical partitioning or horizontal partitioning, the partition shape of the coding block or transform block can be determined based on whether at least one of the width or height of the sub-blocks generated by dividing the coding block or transform block is smaller than a threshold, where the threshold can be an integer such as 2, 4, or 8.
[0274] FIG. 20 is a schematic diagram for explaining the division shape of a coding block.
[0275] When applying horizontal partitioning to a coding block of 4×8 size shown in (a) of FIG. 20, the coding block is divided into sub-blocks of 2×8 size. In this case, the width of the sub-block is smaller than the threshold, so horizontal partitioning cannot be used for the coding block. Conversely, when applying vertical partitioning to a coding block of 4×8 size, the coding block is divided into sub-blocks of 4×4 size. Both the width and height of the sub-blocks are equal to or larger than the threshold, so vertical partitioning can be used for the coding block. Only vertical partitioning can be used for the coding block, so coding of information indicating the division shape of the coding block can be skipped, and vertical partitioning can be applied to the coding block.
[0276] When applying vertical partitioning to the 8×4 coding block shown in FIG. 20(b), the coding block is divided into 8×2 sub-blocks. In this case, the height of the sub-block is smaller than the threshold, so vertical partitioning cannot be used for the coding block. Conversely, when applying horizontal partitioning to the 8×4 coding block, the coding block is divided into 4×4 sub-blocks. Both the width and height of the sub-blocks are equal to or greater than the threshold, so horizontal partitioning can be used for the coding block. Only horizontal partitioning can be used for the coding block, so coding of information indicating the division shape of the coding block can be skipped, and vertical partitioning can be applied to the coding block.
[0277] When both vertical partitioning and horizontal partitioning are available, the partition shape of the coding block can be determined by analyzing information indicating the partition shape of the coding block.
[0278] The number of sub-blocks may be determined based on at least one of the size or shape of the coding block or transform block. As an example, if one of the width or height of the coding block is 8 and another one is 4, the coding block may be divided into two sub-blocks. Conversely, if the width and height of the coding block are both equal to or greater than 8 or one of the width or height of the coding block is greater than 8, the coding block may be divided into four sub-blocks. In short, if the coding block is 4×4 size, the coding block may not be divided into sub-blocks. If the coding block is 4×8 or 8×4 size, the coding block may be divided into two sub-blocks. In other cases, the coding block may be divided into four sub-blocks.
[0279] Alternatively, information indicating the size, shape, or number of sub-blocks of a sub-block may be signaled via a bitstream. The size or shape of the sub-block may be determined according to the information indicating the number of sub-blocks. Alternatively, the number of sub-blocks may be determined according to the information indicating the sub-block size or shape.
[0280] When applying the sub-partition intra-coding method, the sub-blocks generated by dividing the coding block or transform block can use the same intra-prediction mode. As an example, the MPM for the coding block can be obtained based on the intra-prediction mode of the neighboring block adjacent to the coding block, and the intra-prediction mode for the coding block can be determined according to the obtained MPM. When the intra-prediction mode of the coding block is determined, each sub-block can perform intra-prediction using the determined intra-prediction mode.
[0281] When the sub-partition intra-coding method is applied, one of the MPMs can be determined as the intra-prediction mode of the coding block. That is, when the sub-partition intra-coding method is applied, the MPM identifier can be considered to be true even if the MPM identifier is not signaled.
[0282] Alternatively, when applying the sub-partition intra-coding method, any of the predefined candidate intra-prediction modes may be determined as the intra-prediction mode of the coding block. As an example, any of the horizontal intra-prediction mode, the vertical intra-prediction mode, the diagonal intra-prediction mode (e.g., at least one of the upper left intra-prediction mode, the upper right intra-prediction mode, or the lower left intra-prediction mode) or the non-directional intra-prediction mode (e.g., at least one of the planner or DC) may be determined as the intra-prediction mode of the coding block. Index information identifying any of the predefined candidate intra-prediction modes may be signaled via a bitstream.
[0283] According to an embodiment of the present application, the intra prediction mode of at least one of the sub-blocks may be set to be different from that of the other sub-blocks. As an example, the intra prediction mode of the Nth sub-block may be obtained by adding or subtracting the intra prediction mode of the N-1th sub-block with an offset. The offset may be predefined in the encoder and the decoder. Alternatively, the offset may be obtained based on at least one of the size, shape, and intra prediction mode of the coding block, the size, shape, and number of sub-blocks, or the division direction of the coding block. Alternatively, information for obtaining the offset may be signaled via a bitstream.
[0284] Alternatively, if the intra prediction mode of the N-1th sub-block is a non-directional mode, the intra prediction mode of the Nth sub-block is also set to the same as the intra prediction mode of the N-1th sub-block, and if the intra prediction mode of the N-1th sub-block is an angular mode, the intra prediction mode of the N-1th sub-block can be added or subtracted from an offset to obtain an intra prediction mode that is set to the same as the intra prediction mode of the Nth sub-block.
[0285] Alternatively, a directional intra-prediction mode may be applied to some of the sub-blocks, and a non-directional intra-prediction mode may be applied to the remaining sub-blocks. A sub-block to which a non-directional intra-prediction mode is applied may be determined according to at least one of a size, a shape, a position, or a number of sub-blocks. Alternatively, a non-directional intra-prediction mode may be applied to one of the sub-blocks only if a directional intra-prediction mode applied to one of the sub-blocks is a predefined value.
[0286] Alternatively, the intra prediction mode of each subblock can be obtained from the MPM, and therefore, index information that identifies one of the MPMs can be signaled for each subblock.
[0287] Alternatively, the intra-prediction mode for each sub-block can be obtained from predefined candidate intra-prediction modes, and index information identifying one of the predefined candidate intra-prediction modes can be signaled for each sub-block.
[0288] Alternatively, information indicating whether the intra prediction mode of the sub-block is also set may be signaled via the bitstream.
[0289] The quantization parameters of the subblocks can be determined separately. Therefore, the value of the quantization parameter of each subblock can be set to be different. To determine the quantization parameter of each subblock, information indicating a difference value from the quantization parameter of the previous subblock can be coded. As an example, for the Nth subblock, a difference value between the quantization parameter of the Nth subblock and the quantization parameter of the N-1th subblock can be coded.
[0290] Intra prediction of a subblock can be performed using a reference sample. In this case, the reference sample can be obtained from a reconstructed sample of an adjacent block adjacent to the subblock. If the adjacent block adjacent to the subblock is another subblock included in the same coding block as the subblock, the reference sample of the subblock can be obtained based on the reconstructed sample of the other subblock. As an example, if a first subblock is located to the left or top of a second subblock, the reference sample of the second subblock can be obtained from the reconstructed sample of the first subblock. Therefore, parallel intra prediction does not need to be applied between subblocks. That is, encoding or decoding can be performed sequentially for subblocks included in a coding block. Therefore, after encoding or decoding of the first subblock is completed, intra prediction for the second subblock can be performed.
[0291] When the sub-partition intra-coding method is applied, the multi-line intra-prediction coding method for selecting one of a plurality of reference sample line candidates can be set not to be used. When the multi-line intra-prediction coding method is not used, the adjacent reference sample line adjacent to each sub-block can be determined as the reference sample line of each sub-block.
[0292] Alternatively, even when the sub-partition intra-coding method is applied, the multi-line intra-prediction coding method can be used. Therefore, index information for identifying a reference sample line can be signaled for each sub-block. Alternatively, index information for identifying a reference sample line can be signaled only for one of a plurality of sub-blocks, and the index information can be applied to the remaining sub-blocks as is. Alternatively, index information for identifying a reference sample line can be signaled for a coding block, and the plurality of sub-blocks included in the coding block can be set to share the index information.
[0293] Alternatively, only sub-blocks at a predefined position or including a predefined partition index among the sub-blocks may be set to use the multi-line intra-prediction coding method. As an example, index information identifying one of the reference sample line candidates may be signaled only for a sub-block having a partition index of 0 among a plurality of sub-blocks or a sub-block connected to the upper boundary or left boundary of a coding block. The multi-line intra-prediction coding method may not be applied to the residual sub-blocks. Therefore, the residual sub-blocks may perform intra-prediction using adjacent reference sample lines.
[0294] The predictive coding mode can be set differently for each sub-block. For example, intra prediction can be applied to some sub-blocks, and inter prediction, current picture reference or hybrid prediction can be applied to other sub-blocks.
[0295] FIG. 21 is a diagram showing an example in which a predictive coding mode is set differently for each sub-block.
[0296] The intra prediction mode or predictive coding mode may be set differently for each sub-block. As an example, in the example shown in FIG. 21, the drawing shows a case where intra prediction is applied to sub-block 0 and sub-block 1, and current image reference is applied to sub-block 1 and sub-block 2.
[0297] When using the current image reference, a prediction block of the subblock can be obtained from a decoded region of the current image or slice (or tile group). When applying the current image reference, a motion vector can be obtained to identify the prediction block of the subblock. A motion vector in the current image reference may also be referred to as a "block vector."
[0298] The motion vector may be obtained based on the motion vectors of neighboring blocks adjacent to the coding block or sub-block, or information for determining the motion vector may be signaled via the bitstream.
[0299] In this case, the maximum value of the motion vector of the sub-block may be determined according to the size of the sub-block or the coding block or transform block to which the sub-block belongs. As an example, the motion vector of the sub-block may be set so as not to exceed the boundary of the coding block or transform block to which the sub-block belongs. That is, the prediction block of the sub-block may be obtained from an area that is coded or decoded before the sub-block in the coding block to which the sub-block belongs.
[0300] Instead of a motion vector, index information indicating one of the decoded sub-blocks in the coding block can be coded and signaled, and the prediction block of the sub-block can be determined to be the previously decoded sub-block identified according to the index information.
[0301] As another example, the motion vectors of a sub-block may be allowed to cross the boundaries of the coding or transform block to which the sub-block belongs.
[0302] When a prediction block is generated as a result of performing intra prediction, the prediction samples can be updated based on the positions of the prediction samples included in the prediction block. Such an updating method can be called a sample position-based intra weighted prediction method (or PDPC: Position Dependent Prediction Combination).
[0303] Whether to use PDPC may be determined according to the size, shape, intra prediction mode, reference sample line of the current block, size of the current block, or chrominance component. As an example, PDPC may be used when the intra prediction mode of the current block is at least one of planner, DC, vertical, horizontal, a mode in which the index value is smaller than the vertical direction, or a mode in which the index value is larger than the horizontal direction. Alternatively, PDPC may be used only when at least one of the width or height of the current block is greater than 4. Alternatively, PDPC may be used only when the index of the reference image line of the current block is 0. Alternatively, PDPC may be used only when the index of the reference image line of the current block is equal to or greater than a preset value. Alternatively, PDPC may be used only for the luminance component. Alternatively, whether to use PDPC may be determined according to whether two or more of the above exemplified conditions are satisfied.
[0304] Alternatively, it may be determined whether or not to use PDPC depending on whether or not a sub-partition intra-coding method has been used. As an example, when a sub-partition intra-coding method is applied to a coding block or a transform block, it may be set not to use PDPC. Alternatively, when a sub-partition intra-coding method is applied to a coding block or a transform block, PDPC may be applied to at least one of a plurality of sub-blocks. In this case, the sub-block to which PDPC is applied may be determined based on at least one of the size, shape, position, intra-prediction mode, or reference sample line index of the coding block or sub-block. As an example, PDPC may be applied to a sub-block adjacent to the upper end and / or left boundary of the coding block or a sub-block adjacent to the lower end and / or right boundary of the coding block. Alternatively, it may be set to apply PDPC to all sub-blocks included in the coding block or set not to apply PDPC to all sub-blocks included in the coding block based on the size or shape of the sub-block. As another example, PDPC may be applied to all sub-blocks in the coding block.
[0305] Alternatively, whether or not to apply PDPC to each subblock may be determined according to whether or not at least one of the size, shape, intra prediction mode, or reference image index of a subblock generated by dividing a coding block or a transform block satisfies a preset condition. As an example, if at least one of the width or height of a subblock is greater than 4, PDPC may be applied to the subblock.
[0306] As another example, information indicating whether or not the PDPC is applied may be signaled via a bitstream.
[0307] Alternatively, the region to which the PDPC is applied may be determined based on at least one of the size, shape, intra prediction mode, or position of the prediction sample of the current block. As an example, if the intra prediction mode of the current block has an index larger than the vertical direction, the prediction sample having at least one of the x-axis coordinate or the y-axis coordinate larger than the threshold may not be corrected, and the correction operation may be performed only on the prediction sample having the x-axis coordinate or the y-axis coordinate equal to or smaller than the threshold. As an example, if the intra prediction mode of the current block has an index smaller than the horizontal direction, the prediction sample having at least one of the x-axis coordinate or the y-axis coordinate larger than the threshold may not be corrected, and the correction operation may be performed only on the prediction sample having the x-axis coordinate or the y-axis coordinate equal to or smaller than the threshold. 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.
[0308] When a prediction sample is obtained through an intra prediction sample, a reference sample used to correct the prediction sample can be determined based on the position of the obtained prediction sample. For convenience of explanation, in the following embodiment, the reference sample used to correct the prediction sample is referred to as a PDPC reference sample. Furthermore, a prediction sample obtained through intra prediction is referred to as a first prediction sample, and a prediction sample obtained by correcting the first prediction sample is referred to as a second prediction sample.
[0309] FIG. 22 is a schematic diagram of an application form of a PDPC.
[0310] The first predicted sample may be corrected using at least one PDPC reference sample, which 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 an upper end of the current block, or a left reference sample located to the left of the current block.
[0311] At least one of the reference samples belonging to the reference sample line of the current block may be set as the PDPC reference sample. Alternatively, regardless of the reference sample line of the current block, at least one of the reference samples belonging to the reference sample line having an index of 0 may be set as the PDPC reference sample. As an example, even if the first predicted sample is obtained using a reference sample included in a reference sample line having an index of 1 or 2, the second predicted sample may be obtained using a reference sample included in a reference sample line having an index of 0.
[0312] The number or position of the PDPC reference samples used to correct the first predicted sample may be determined according to at least one of the intra prediction mode of the current block, the size of the current block, the shape of the current block, or the position of the first predicted sample.
[0313] As an example, when the intra prediction mode of the current block is planner or DC mode, the top reference sample and the left reference sample may be used to obtain the second prediction sample, where 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).
[0314] If the intra prediction mode of the current block is a horizontal intra prediction mode, the top reference sample may be used to obtain the second prediction sample, in which case the top reference sample may be a reference sample perpendicular to the first prediction sample.
[0315] If the intra prediction mode of the current block is a vertical intra prediction mode, the left reference sample may be used to obtain a second prediction sample, in which case the left reference sample may be a reference sample horizontal to the first prediction sample.
[0316] If the intra prediction mode of the current block is a bottom left diagonal or top right diagonal intra prediction mode, the second prediction sample can be obtained based on the top left reference sample, the top reference sample, and the left reference sample. The top left reference sample may be a reference sample adjacent to the top left corner of the current block (e.g., a reference sample located at (-1,-1) position). The top reference sample may be a reference sample located diagonally to the top right of the first prediction sample, and the left reference sample may be a reference sample located diagonally to the bottom left of the first prediction sample.
[0317] In short, if the position of the first predicted sample is (x, y), R(-1,-1) can be set as the top-left reference sample, R(x+y+1,-1) or R(x,-1) can be set as the top reference sample, and R(-1,x+y+1) or R(-1,y) can be set as the left reference sample.
[0318] As another example, the position of the left reference sample or the top reference sample can be determined according to at least one of the following two: the shape of the current block or whether a wide-angle intra mode is applied.
[0319] Specifically, when the intra prediction mode of the current block is a wide-angle intra prediction mode, a reference sample located diagonally opposite the first predicted sample and offset away from the reference sample may be set as the PDPC reference sample. For example, the top reference sample R(x+y+k+1,-1) and the left reference sample R(-1,x+y-k+1) may be set as the PDPC reference sample.
[0320] In this case, the offset k can be determined based on the wide-angle intra prediction mode. Equations 8 and 9 show examples of obtaining the offset based on the wide-angle intra prediction mode.
number
[0321] The second predicted sample may be determined based on a weighted sum operation of the first predicted sample and the PDPC reference sample. As an example, the second predicted sample may be obtained based on the following 10.
number
[0322] In the above equation 10, R T indicates the left reference sample, and R TL denotes a top reference sample, and RTL denotes an upper left reference sample. pred(x,y) denotes a predicted sample at the (x,y) position. wL denotes a weighted value of the left reference sample, wT denotes a weighted value of the top reference sample, and wTL denotes a weighted value of the upper left reference sample. The weighted value of the first predicted sample can be obtained by subtracting the weighted value of the reference sample from the maximum value. For convenience of explanation, the weighted value assigned to the PDPC reference sample is referred to as the PDPC weighted value.
[0323] The weighting value assigned to each reference sample may be determined based on at least one of an intra prediction mode of the current block or a position of the first prediction sample.
[0324] For example, at least one of wL, wT, or wTL may be proportional or inversely proportional to at least one of the x-axis coordinate value or the y-axis coordinate value of the predicted sample, or at least one of wL, wT, or wTL may be proportional or inversely proportional to at least one of the width or height of the current block.
[0325] If the intra prediction mode of the current block is DC, the PDPC weighting value can be determined as shown in Equation 11 below.
number
[0326] In the above equation 11, x and y indicate the position of the first predicted sample.
[0327] In the above formula 11, the parameter shift used in the displacement calculation can be obtained based on the width or height of the current block. As an example, the parameter shift can be obtained based on the following formula 12 or 13.
number
[0328] Or, the parameter shift can be obtained according to the intra direction parameter of the current block.
[0329] The number or type of parameters used to obtain the parameter shift may vary depending on the intra prediction mode of the current block. As an example, if the intra prediction mode of the current block is planner, DC, vertical, or horizontal, the parameter shift may be obtained using the width and height of the current block as shown in Equation 12 or Equation 13. If the intra prediction mode of the current block is an intra prediction mode with an index larger than the vertical intra prediction mode, the parameter shift may be obtained using the height and intra direction parameters of the current block. If the intra prediction mode of the current block is an intra prediction mode with an index smaller than the horizontal intra prediction mode, the parameter shift may be obtained using the width and intra direction parameters of the current block.
[0330] If the intra prediction mode of the current block is planner, the value of wTL can be set to 0. wL and wT can be obtained according to Equation 14 below.
number
[0331] If the intra prediction mode of the current block is a horizontal intra prediction mode, wT may be set to 0, and wTL and wL may be set in the same manner. Conversely, if the intra prediction mode of the current block is a vertical intra prediction mode, wL may be set to 0, and wTL and wT may be set in the same manner.
[0332] If the intra prediction mode of the current block has an index larger than the vertical intra prediction mode and is an intra prediction mode pointing in the upper right direction, the PDPC weight value can be obtained as shown in Equation 15 below.
number
[0333] If the intra prediction mode of the current block has an index smaller than that of the horizontal intra prediction mode and is an intra prediction mode pointing in the bottom-left direction, the PDPC weight value can be obtained as shown in Equation 16 below.
number
[0334] As shown in the above embodiment, the PDPC weights can be determined based on the positions x and y of the predicted samples.
[0335] As another example, the weights respectively assigned to the PDPC reference samples may be determined according to a sub-block unit, and the prediction samples included in the sub-block may share the same PDPC weights.
[0336] The sub-block size used to determine the basic unit of the weighting value can be predefined in the encoder and decoder. As an example, the weighting value can be determined for a sub-block of size 2×2 or 4×4, respectively.
[0337] Alternatively, the size, shape, or number of sub-blocks may be determined according to the size or shape of the current block. For example, the coding block may be divided into 4 sub-blocks regardless of the size of the coding block. Alternatively, the coding block may be divided into 4 or 16 sub-blocks according to the size of the coding block.
[0338] Alternatively, the size, shape or number of sub-blocks can be determined based on the intra-prediction mode of the current block. As an example, if the intra-prediction mode of the current block is horizontal, N columns (or N rows) can be set as one sub-block, and conversely, if the intra-prediction mode of the current block is vertical, N rows (or N columns) can be set as one sub-block.
[0339] Equations 17 to 19 show an example of determining the PDPC weights of a 2×2 size sub-block. Equation 17 gives an example when the intra prediction mode of the current block is DC mode.
number
[0340] In the above equation 17, the value of K may be determined based on the size of the sub-block.
[0341] Equation 18 gives an example where the intra-prediction mode of the current block has a larger index than the vertical intra-prediction mode and is an intra-prediction mode pointing in the upper-right direction.
number
[0342] Equation 19 gives an example where the intra-prediction mode of the current block has a smaller index than the horizontal intra-prediction mode and is an intra-prediction mode pointing in the bottom-left direction.
number
[0343] In Equations 17 to 19, x and y indicate the position of the reference sample within the sub-block, which can be either the sample located at the top left of the sub-block, the sample located at the center of the sub-block, or the sample located at the bottom right of the sub-block.
[0344] Equations 20 to 22 show an example of determining the PDPC weights of a 4×4 size sub-block. Equation 20 gives an example when the intra prediction mode of the current block is DC mode.
number
[0345] Equation 21 illustrates a case where the intra prediction mode of the current block has an index larger than the vertical intra prediction mode and is an intra prediction mode pointing in the upper right direction.
number
[0346] Equation 22 illustrates a case where the intra prediction mode of the current block has an index smaller than the horizontal intra prediction mode and is an intra prediction mode pointing in the bottom-left direction.
number
[0347] In the above embodiment, the PDPC weighting is determined according to the position of the first predicted sample or the predicted sample included in the sub-block, but the PDPC weighting may be determined according to the shape of the current block.
[0348] As an example, in the case of DC mode, the method of obtaining the PDPC weights also differs depending on whether the current block is a non-square block with width greater than height or height greater than width.
[0349] Equation 23 is an example of obtaining a PDPC weighting value when the current block is a non-square block whose width is greater than its height, and Equation 24 is an example of obtaining a PDPC weighting value when the current block is a non-square block whose height is greater than its width.
number
number
[0350] If the current block is non-square, the current block may be predicted using a wide-angle intra prediction mode. When the wide-angle intra prediction mode is applied, the PDPC may also be applied to update the first prediction sample.
[0351] When wide-angle intra prediction is applied to the current block, the PDPC weights may be determined according to the shape of the coding block.
[0352] For example, if the current block is non-square with its width greater than its height, the top reference sample located to the upper right of the first predicted sample may be closer to the first predicted sample than the left reference sample located to the lower left of the first predicted sample, depending on the position of the first predicted sample. Therefore, in the first predicted sample compensation manner, the weight applied to the top reference sample may be set to be greater than the weight applied to the left reference sample.
[0353] Conversely, if the current block is non-square with its height greater than its width, the left reference sample located at the lower left of the first predicted sample may be closer to the first predicted sample than the top reference sample located at the upper right of the first predicted sample, depending on the position of the first predicted sample. Therefore, in the first predicted sample compensation manner, the weight applied to the left reference sample may be set to be greater than the weight applied to the top reference sample.
[0354] Equation 25 shows an example of obtaining the PDPC weighting value when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index greater than 66.
number
[0355] Equation 26 shows an example of obtaining the PDPC weighting value when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index smaller than 0.
number
[0356] The PDPC weight may also be determined based on the ratio of the current block. The ratio of the current block indicates the ratio between the width and height of the current block, and may be defined as shown in Equation 27 below.
number
[0357] A method for obtaining PDPC weights can be variably determined according to the intra prediction mode of the current block.
[0358] As an example, Equation 28 and Equation 29 show an example of obtaining PDPC weights when the intra prediction mode of the current block is DC. Specifically, Equation 28 is an example of the current block being a non-square whose width is greater than its height, and Equation 29 is an example of the current block being a non-square whose height is greater than its width.
number
[0359] Equation 30 shows an example of obtaining the PDPC weighting value when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index greater than 66.
number
[0360] Equation 31 shows an example of obtaining the PDPC weighting value when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index smaller than 0.
number
[0361] A residual image can be obtained by subtracting the predicted image from the original image. In this case, when the residual video is transformed into the frequency domain, even if the high frequency components of the frequency components are removed, the subjective quality of the video does not decrease significantly. Therefore, reducing the value of the high frequency components or setting the value of the high frequency components to 0 has the effect of improving the compression efficiency while not causing significant visual distortion. The residual image can be decomposed into two-dimensional frequency components, and the current block can be transformed to reflect the above-mentioned characteristics. The transformation can be performed using a transformation method such as DCT (Discrete Cosine Transform) or DST (Discrete Sine Transform).
[0362] DCT is to decompose (or transform) the residual video into two-dimensional frequency components using cosine transform, and DST is to decompose (or transform) the residual video into two-dimensional frequency components using cosine transform. The transformed frequency components of the residual video can be represented as image features. As an example, when performing DCT transform on an N×N sized block, weights corresponding to N2 image features can be obtained. Through the transform, weights corresponding to each image feature contained in the N×N sized block can be obtained. According to the transform method used, the weights corresponding to the image features can be referred to as DCT coefficients or DST coefficients.
[0363] The transform method DCT is mainly used for videos with a large distribution of non-zero low frequency components, while the transform method DST is mainly used for videos with a large distribution of high frequency components.
[0364] Transformations other than DCT or DST may also be used to transform the residual video.
[0365] Hereinafter, the case of converting the residual video into two-dimensional frequency components is referred to as two-dimensional image conversion. Furthermore, the weights corresponding to the image features obtained as a result of conversion are referred to as conversion coefficients. As an example, the conversion coefficients can indicate DCT coefficients or DST coefficients. When both the main conversion and the second conversion described later are applied, the conversion coefficients can indicate weights corresponding to the image features generated as a result of the second conversion.
[0366] The transformation method may be determined on a block-by-block basis. The transformation method may be determined based on at least one of the prediction coding mode of the current block, the size of the current block, or the size of the current block. As an example, if the current block is coded in an intra prediction mode and the size of the current block is smaller than N×N, the transformation method DST may be used. Conversely, if the above conditions are not met, the transformation method DCT may be used.
[0367] A 2D video transform may not be performed on some blocks of the residual video. The case where the 2D video transform is not performed may be referred to as a transform skip. When the transform skip is applied, quantization may be applied to the residual that is not transformed.
[0368] After transforming the current block using the DCT or DST, the transformed current block can be further transformed. In this case, the transform based on the DCT or DST can be defined as the primary transform, and the further transform applied to the block to which the primary transform has been applied can be defined as the secondary transform.
[0369] The main transform can be performed using any of several possible transform cores. As an example, the main transform can be performed using any of the DCT2, DCT8 or DCT7.
[0370] Different transform cores can also be used for the horizontal and vertical directions. Information indicating the combination of horizontal and vertical transform cores can be signaled via the bitstream.
[0371] The execution units of the main transform and the second transform may be different. As an example, the main transform may be performed on an 8x8 block, and the second transform may be performed on a 4x4 size sub-block of the transformed 8x8 block. In this case, the transform coefficients of other regions that do not perform the second transform may be set to 0.
[0372] Alternatively, a primary transform can be performed on the 4x4 block, and a second transform can be performed on an 8x8 sized region that contains the transformed 4x4 block.
[0373] Information indicating whether or not to perform the second transformation may be signaled via the bitstream.
[0374] Alternatively, the horizontal transform core may be the same as the vertical transform core, and therefore, whether to perform the second transform may be determined. As an example, the second transform may be performed only if the horizontal transform core is the same as the vertical transform core. Alternatively, the second transform may be performed only if the horizontal transform core is different from the vertical transform core.
[0375] Alternatively, the second transform may be allowed only if a predefined transform core is used for the horizontal transform and the vertical transform. As an example, the second transform may be allowed if a DCT2 transform core is used for the horizontal transform and the vertical transform.
[0376] Alternatively, it may be determined whether to perform the second transform according to the number of non-zero transform coefficients of the current block. For example, if the non-zero transform coefficients of the current block are less than or equal to a threshold, the second transform may be set not to be used, and if the non-zero transform coefficients of the current block are greater than the threshold, the second transform may be set to be used. It may also be set to use the second transform only if the current block is coded using intra prediction.
[0377] According to the shape of the current block, the size or shape of the sub-block on which the second transformation is to be performed can be determined.
[0378] 23 and 24 show schematic diagrams of the sub-blocks performing the second transformation.
[0379] If the current block is a square, after performing the main transform, a second transform may be performed on the upper left sub-block of the current block, which is N×N in size. For example, if the current block is an 8×8 coding block, after performing the main transform on the current block, a second transform may be performed on the upper left sub-block of the current block, which is 4×4 in size (see FIG. 23).
[0380] If the current block is a non-square block whose width is four times greater than its height, then after the primary transformation, a second transformation can be performed on the upper left sub-block of the current block, which is (kN)×(4kN). As an example, if the current block is a non-square block of 16×4 size, then a second transformation can be performed on the upper left sub-block of the current block, which is 2×8 size (see FIG. 24(a)).
[0381] If the current block is a non-square block with a height that is four times greater than the width, then after the primary transformation, a second transformation can be performed on the upper left sub-block of the current block with a size of (4kN)×(kN). As an example, if the current block is a non-square block with a size of 16×4, then a second transformation can be performed on the upper left sub-block of the current block with a size of 2×8 (see (b) of FIG. 24).
[0382] The decoder can perform an inverse transform (second inverse transform) of the second transform, and perform an inverse transform (first inverse transform) of the main transform according to the execution result of the second inverse transform. A residual signal for the current block is obtained according to the execution results of the second inverse transform and the first inverse transform.
[0383] Information indicating the transform type of the current block may be signaled via the bitstream, which may be index information tu_mts_idx of one of the combinations of horizontal transform type and vertical transform type.
[0384] According to the transform type candidate identified by the index information tu_mts_idx, the vertical transform core and the horizontal transform core can be determined. Tables 7 and 8 show the transform type combinations according to tu_mts_idx.
[0385] [Table 7]
[0386] [Table 8]
[0387] The transform type can be determined to be one of DCT2, DST7, DCT8 or transform skip. Or, other than transform skip, only the transform core can be used to configure the transform type combination candidates.
[0388] When using Table 7, if tu_mts_idx is 0, then a transform skip can be applied horizontally and vertically. If tu_mts_idx is 1, then a DCT2 can be applied horizontally and vertically. If tu_mts_idx is 3, then a DCT8 can be applied horizontally and a DCT7 can be applied vertically.
[0389] When using Table 8, if tu_mts_idx is 0, then DCT2 can be applied horizontally and vertically. If tu_mts_idx is 1, then transform skip can be applied horizontally and vertically. If tu_mts_idx is 3, then DCT8 can be applied horizontally and DCT7 can be applied vertically.
[0390] It may be determined whether to code the index information according to at least one of the size, shape, or number of non-zero coefficients of the current block. As an example, if the number of non-zero coefficients is equal to or less than a threshold, the index information may not be signaled and a default transform type may be applied to the current block. Here, the default transform type may be DST7. Alternatively, the default mode may vary depending on the size, shape, or intra prediction mode of the current block.
[0391] The threshold may be determined based on the size or shape of the current block. As an example, if the size of the current block is less than or equal to 32×32, the threshold may be set to 2, and if the current block is greater than 32×32 (e.g., if the current block is a coding block of size 32×64 or 64×32), the threshold may be set to 4.
[0392] The multiple lookup tables may be pre-stored in the encoder or the decoder. At least one of index values assigned to the transform type combination candidates of the multiple lookup tables, types of the transform type combination candidates, or the number of the transform type combination candidates may be different.
[0393] The lookup table for the current block can be selected based on at least one of the size, shape, predictive coding mode, intra prediction mode, whether to apply a second transform or whether to apply a transform skip to a neighboring block of the current block.
[0394] As an example, if the size of the current block is 4x4 or less or if the current block is coded using inter prediction, the lookup table of Table 7 can be used, and if the size of the current block is greater than 4x4 or if the current block is coded using intra prediction, the lookup table of Table 8 can be used.
[0395] Alternatively, information indicating which of multiple look-up tables to use may be signaled via the bitstream, and the decoder may select the look-up table for the current block based on the information.
[0396] As another example, the index assigned to the transform type combination candidate may be adaptively determined based on at least one of the size, shape, predictive coding mode, intra prediction mode, whether to apply a second transform, or whether to apply a transform skip to a neighboring block of the current block. As an example, the index assigned to the transform skip when the size of the current block is 4×4 may have a value smaller than the index assigned to the transform skip when the size of the current block is larger than 4×4. Specifically, when the size of the current block is 4×4, the transform skip may be assigned an index greater than 0 (e.g., index 1) when the current block is larger than 4×4 and less than or equal to 16×16. When the current block is larger than 16×16, the transform skipped index may be assigned a maximum value (e.g., 5).
[0397] Alternatively, if the current block is coded with inter prediction, the transform skip may be assigned an index of 0. If the current block is coded with intra prediction, the transform skip may be assigned an index greater than 0 (e.g., index 1).
[0398] Alternatively, if the current block is a 4×4 sized block coded with inter prediction, the transform skip may be assigned an index of 0. Conversely, if the current block is not coded with inter prediction or is larger than 4×4, the transform skip may be assigned an index whose value is greater than 0 (e.g., index 1).
[0399] It is possible to define and use transform type combination candidates different from the transform type combination candidates exemplified in Tables 7 and 8. As an example, a transform skip can be applied to either a horizontal transform or a vertical transform, and a transform type combination candidate that applies a transform core such as DCT7, DCT8, or DST2 can be used for another one. In this case, it can be determined whether to use the transform skip as a transform type candidate to be used as the horizontal or vertical direction based on at least one of the size (e.g., width and / or height), shape, predictive coding mode, or intra-prediction mode of the current block.
[0400] Alternatively, information indicating whether a specific transform type candidate can be used can be signaled via the bitstream. For example, an identifier indicating whether a transform skip can be used as a transform type candidate for the horizontal direction and the vertical direction can be signaled. According to the identifier, it can be determined whether to include a specific transform type combination candidate among multiple transform type combination candidates.
[0401] Alternatively, information on whether a particular transform type candidate is applied to the current block may be signaled via the bitstream. As an example, an identifier cu_mts_flag indicating whether DCT2 is applied in the horizontal and vertical directions may be signaled. If the value of cu_mts_flag is 1, DCT2 may be set as the transform core for the vertical and horizontal directions. If the value of cu_mts_flag is 1, DCT8 or DST7 may be set as the transform core for the vertical and horizontal directions. Alternatively, if the value of cu_mts_flag is 1, information tu_mts_idx specifying one of a plurality of transform type combination candidates may be signaled.
[0402] If the current block is a non-square block with width greater than height or height greater than width, the encoding of cu_mts_flag can be skipped and the value of cu_mts_flag is considered to be 0.
[0403] The number of available transform type combination candidates can be set differently according to the size, shape, or intra prediction mode of the current block. For example, if the current block is square, three or more transform type combination candidates can be used, and if the current block is non-square, two transform type combination candidates can be used. Or, if the current block is square, only the transform type combination candidates that are different from the transform type for only the horizontal direction and the transform type for the vertical direction can be used.
[0404] If the current block can use three or more transform type combination candidates, index information tu_mts_idx indicating one of the transform type combination candidates can be signaled. If the current block can use two transform type combination candidates, identifier mts_flag indicating one of the transform type combination candidates can be signaled. Table 9 shows a coding shape that specifies information required for transform type combination candidates according to the shape of the current block.
[0405] [Table 9]
[0406] The indices of the transformation type combination candidates may be re-sorted (or reordered) according to the shape of the current block. As an example, if the current block is square, the indices assigned to the transformation type combination candidates may be different from the indices assigned to the transformation type combination candidates if the current block is non-square. As an example, if the current block is square, the transformation type combinations may be selected based on Table 10 below, and if the current block is non-square, the transformation type combinations may be selected based on Table 11 below.
[0407] [Table 10]
[0408] [Table 11]
[0409] The transform type may be determined based on the number of horizontal non-zero coefficients or the number of vertical non-zero coefficients of the current block, where the number of horizontal non-zero coefficients indicates the number of non-zero coefficients in 1xN (where N is the width of the current block) and the number of vertical non-zero coefficients indicates the number of non-zero coefficients in Nx1 (where N is the height of the current block). If the maximum value of the horizontal non-zero coefficients is less than or equal to a threshold, the primary transform type may be applied in the horizontal direction, and if the maximum value of the horizontal non-zero coefficients is greater than the threshold, the secondary transform type may be applied in the horizontal direction. If the maximum value of the vertical non-zero coefficients is less than or equal to a threshold, the primary transform type may be applied in the vertical direction, and if the maximum value of the vertical non-zero coefficients is greater than the threshold, the secondary transform type may be applied in the vertical direction.
[0410] FIG. 25 is a diagram of an example illustrating determining the transformation type of the current block.
[0411] As an example, if the current block is coded using intra prediction and the maximum value of the horizontal non-zero coefficients of the current block is less than or equal to 2 (see (a) of Figure 25), the horizontal transform type can be determined to be DST7.
[0412] If the current block is coded by intra prediction and the maximum value of the vertical non-zero coefficients of the current block is greater than 2 (see (b) of FIG. 25), the vertical transform type can be determined to be DCT2 or DCT8.
[0413] Information indicating whether to explicitly determine the current block transform type based on information signaled from the bitstream may be signaled via the bitstream. As an example, at the sequence level, information sps_explicit_intra_mts_flag indicating whether to allow explicitly determining the transform type for a block coded by intra prediction and / or information sps_explicit_inter_mts_flag indicating whether to allow explicitly determining the permitted transform type for a block coded by inter prediction may be signaled.
[0414] If it is permitted to determine the transform type, the transform type of the current block may be determined based on the index information tu_mts_idx signaled from the bitstream. Conversely, if it is not permitted to determine the transform type, the transform type may be determined based on at least one of the size, shape, and position of the subblock that includes a transform coefficient that is non-zero or allows the subblock unit to transform the current block. As 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, if the width of the current block is smaller than 4 or larger than 16, the horizontal transform type may be determined to be DCT2. Otherwise, the horizontal transform type may be determined to be DST7. For example, if the height of the current block is smaller than 4 or larger than 16, the vertical transform type may be determined to be DCT2. Otherwise, the vertical transform type may be determined to be DST7. Here, the thresholds to be compared with the width and height to determine the horizontal transform type and the vertical transform type may be determined based on at least one of the size, shape or intra prediction mode of the current block.
[0415] Alternatively, if the current block is a square with height equal to width, the horizontal and vertical transform types can be set to be the same, while if the current block is a non-square with height different from width, the horizontal and vertical transform types can be set to be different. As an example, if the width of the current block is greater than the height, the horizontal transform type can be determined to be DST7 and the vertical transform type can be determined to be DCT2. As an example, if the height of the current block is greater than the width, the vertical transform type can be determined to be DST7 and the horizontal transform type can be determined to be DCT2.
[0416] The number and / or type of transform type candidates or the number and / or type of transform type combination candidates differ depending on whether or not it is permitted to explicitly determine the transform type. As an example, when it is permitted to explicitly determine the transform type, DCT2, DST7, and DCT8 can be used as transform type candidates. Therefore, the horizontal transform type and the vertical transform type can be set to DCT2, DST8, or DCT8, respectively. When it is not permitted to explicitly determine the transform type, only DCT2 and DST7 can be used as transform type candidates. Therefore, the horizontal transform type and the vertical transform type can be determined to be DCT2 or DST7, respectively.
[0417] A coding block or a transform block may be divided into a plurality of sub-blocks, and each of the sub-blocks may be transformed. For example, when applying the above-mentioned sub-partition intra-prediction coding method to a coding block, the coding block may be divided into a plurality of sub-blocks, and each of the sub-blocks may be transformed.
[0418] The transform types of the sub-blocks may be different from each other. For example, when a transform type for a first sub-block of a plurality of sub-blocks is determined, the transform type of the first sub-block may be applied to the remaining sub-blocks. Alternatively, a transform type to be used for a coding block may be determined, and the transform type of the coding block may be determined as the transform type of the sub-blocks.
[0419] As another example, the transform types of multiple sub-blocks can be determined separately. The transform type of each sub-block can be determined based on information signaled for each sub-block. As an example, index information tu_mts_idx can be signaled for each sub-block. The index information tu_mts_idx can identify one of multiple combinations of horizontal transform types and vertical transform types. According to the value of tu_mts_idx, the horizontal transform type and the vertical transform type can be determined to be DCT2, DST7 or DCT8. Based on the index information tu_mts_idx, it can be determined whether the horizontal transform type and the vertical transform type are the same or not.
[0420] Information indicating whether the transform type of the current sub-block uses the same transform type as the previous sub-block may be signaled. If the information indicates that the same transform type as the previous sub-block is used, coding of the index information tu_mts_idx of the current sub-block may be skipped, and the transform type of the previous sub-block may be applied to the current sub-block. Conversely, if the information indicates that a transform type different from that of the previous sub-block is used, the index information tu_mts_idx of the current sub-block may be coded. In this case, the index information of the current sub-block may indicate any of the transform type combinations other than the transform type combination indicated by the index information of the previous sub-block.
[0421] Alternatively, when a coding block is divided into multiple sub-blocks, it may be set not to allow explicit determination of the transform type. When an explicit transform type is allowed, the transform type may be determined based on the index information tu_mts_idx. Conversely, when an explicit determination of the transform type is not allowed, the transform type may be determined according to at least one of the sub-block size, shape, or sub-block position containing non-zero coefficients included.
[0422] FIG. 26 is a schematic diagram of an example of determining the transformation type of a sub-block.
[0423] FIG. 26 shows examples where the sub-block height to width ratio is 1:2 or 2:1.
[0424] The horizontal transform type and the vertical transform type can be determined based on the width and height of each sub-block. As an example, as shown in (a) and (b) of FIG. 26, if the width of the sub-block is smaller than a threshold, the primary transform type (e.g., DCT2) can be used as the horizontal transform type. Conversely, if the width of the sub-block is equal to or larger than the threshold, the secondary transform type (e.g., DST7) can be used as the horizontal transform type.
[0425] Furthermore, if the height of a subblock is less than a threshold, the primary transform type (e.g., DCT2) can be used as the vertical transform type, whereas if the width of a subblock is greater than or equal to the threshold, the secondary transform type (e.g., DST7) can be used as the vertical transform type.
[0426] Here, the threshold may be a natural number such as 2, 4, or 8. The threshold may be variably determined based on at least one of the size, shape, intra-prediction mode, or predictive coding mode of the coding block, or information for determining the threshold may be signaled via a bitstream.
[0427] In the above example, the width and height of the subblock are compared with one threshold, but the width and height of the subblock may be compared with two thresholds to determine the transformation type. As an example, if the width of the subblock is smaller than the first threshold or larger than the second threshold, the transformation type in the horizontal direction may be determined to be DCT2. Otherwise, the transformation type in the horizontal direction may be determined to be DST7. Furthermore, if the height of the subblock is smaller than the first threshold or larger than the second threshold, the transformation type in the vertical direction may be determined to be DCT2. Otherwise, the transformation type in the vertical direction may be determined to be DST7. The second threshold is a natural number larger than the first threshold, and the first threshold may be a natural number such as 2, 4, or 8, and the second threshold may be a natural number such as 8, 16, or 32.
[0428] As another example, if a subblock is square with height equal to width, the horizontal and vertical transform types can be set to be the same, while if a subblock is non-square with height different from width, the horizontal and vertical transform types can be set to be different. As an example, if the width of a subblock is greater than the height, the horizontal transform type can be determined to be DST7 and the vertical transform type can be determined to be DCT2. If the height of a subblock is greater than the width, the vertical transform type can be determined to be DST7 and the horizontal transform type can be determined to be DCT2.
[0429] A value of a residual coefficient included in at least one of the plurality of sub-blocks may be set to 0. Here, the residual coefficient refers to a transform coefficient generated by transforming, a transform skip coefficient generated by transform skipping, or a quantized coefficient generated by quantizing the transform coefficient or the transform skip coefficient. As an example, a value of a residual coefficient included in a sub-block that is at least a predetermined distance away from a boundary of a coding block may be set to 0.
[0430] FIG. 27 is a diagram illustrating an example in which the residual coefficients of a sub-block are set to zero.
[0431] In the example shown in Figure 27, a Coded Block Flag (CBF) indicates whether a sub-block has a non-zero residual coefficient. A CBF value of 0 indicates that the sub-block has no non-zero residual coefficients, and a CBF value of 1 indicates that the sub-block has a non-zero residual coefficient.
[0432] If the distance from the boundary of the coding block to the sub-block is equal to or greater than a threshold, the residual coefficients included in the sub-block may be set to 0. In this case, the distance from the boundary of the coding block to the sub-block may be obtained based on a first sample located at the boundary of the coding block and a second sample included in the sub-block. As an example, the first sample may be a sample located at the upper left corner, a sample located at the lower left corner, a sample located at the middle left, a sample located at the upper right corner, a sample located at the lower right corner, a sample located at the middle right, a sample located at the middle top, or a sample located at the middle bottom of the coding block. The second sample may be a sample located at the upper left corner, a sample located at the lower left corner, a sample located at the middle left, a sample located at the upper right corner, a sample located at the lower right corner, a sample located at the middle right, a sample located at the middle top, or a sample located at the middle bottom of the sub-block.
[0433] The threshold may be determined based on at least one of the size, shape, number of sub-blocks included in the coding block, or size of the sub-blocks, or information for determining the threshold may be signaled via the bitstream.
[0434] As an example, when applying vertical partitioning to the current block, the residual coefficients of sub-blocks whose distance to the left boundary of the coding block is equal to or greater than a threshold may be set to 0. When the coding block size is 64 and the threshold is 32, the residual coefficients of sub-blocks (Sub-CU2 and Sub-CU3) whose distance to the left boundary of the coding block is equal to or greater than 32 may be set to 0, as shown in (a) of FIG.
[0435] Alternatively, when horizontal partitioning is applied to the current block, the residual coefficients of sub-blocks whose distance to the top boundary of the coding block is equal to or greater than a threshold may be set to 0. If the size of the coding block is 64 and the threshold is 32, the residual coefficients of sub-blocks (Sub-CU2 and Sub-CU3) whose distance to the top boundary of the coding block is equal to or greater than 32 may be set to 0, as shown in (b) of FIG.
[0436] Unlike the illustrated example, residual coefficients contained in sub-blocks whose distance to the coding block boundary is less than a threshold can be set to zero.
[0437] Alternatively, the residual coefficients of the sub-blocks other than the sub-block whose position is preset among the plurality of sub-blocks may be set to 0. As an example, when vertical partitioning is applied to the coding block, the residual coefficients of the sub-blocks other than the sub-block located at the left end or right end of the plurality of sub-blocks may be set to 0. Alternatively, when horizontal partitioning is applied to the coding block, the residual coefficients of the sub-blocks other than the sub-block located at the top end or bottom end of the plurality of sub-blocks may be set to 0.
[0438] For a subblock, information indicating whether there is a non-zero coefficient, such as CBF coding, can be skipped. When CBF coding is skipped, it can be determined whether each subblock includes a non-zero residual coefficient according to the distance between the coding block boundary and the subblock or the position of the subblock. As an example, in the example shown in FIG. 27, it can be obtained that the CBF values of subblock 0 and subblock 1 (sub-CU0, sub-CU1) are 1, and the CBF values of subblock 2 and subblock 3 (sub-CU2, sub-CU3) are 0.
[0439] For sub-blocks that contain non-zero coefficients, transform and / or quantization may be performed, while for sub-blocks that do not contain non-zero coefficients, transform and quantization may be skipped.
[0440] As another example, information indicating that only a part of a region of a coding block or a transform block is transformed may be coded and signaled. The information may be a 1-bit identifier cu_sbt_flag. The identifier being 1 indicates that only a part of a plurality of sub-blocks generated by dividing a coding block or a transform block is transformed, and the identifier being 0 indicates that it is not necessary to divide a coding block or a transform block into sub-blocks for transformation.
[0441] A method of transforming only a part of a coding block is permitted only when a sub-partition intra-coding method is applied to the coding block. Therefore, cu_sbt_flagg can be coded and signaled only when a sub-partition intra-coding method is applied to the coding block. When the value of cu_sbt_flag is 1, some of the sub-blocks generated by dividing the coding block or transform block can be transformed, and the residual coefficients of the remaining sub-blocks can be set to 0. When the value of cu_sbt_flag is 1, all sub-blocks can be transformed.
[0442] Alternatively, when a sub-partition intra coding method is applied to a coding block, the coding of cu_sbt_flag may be skipped and the value of cu_sbt_flag may be set to 1.
[0443] As another example, a method of transforming a part of a coding block may be permitted only when the predictive coding mode of the coding block is inter prediction or current image reference. When the coding block is coded with inter prediction or current image reference, information indicating whether or not only a part of a coding block is transformed may be coded and signaled. When only a part of a coding block is transformed, information indicating a partition shape of the coding block may be coded and signaled. The information indicating the partition shape of the coding block may include at least one of information indicating whether the coding block is divided into four sub-blocks, information indicating a partition direction of the coding block, or information indicating the number of sub-blocks. As an example, when cu_sbt_flag is 1, an identifier cu_sbt_quadtree_flag indicating whether the coding block is divided into four sub-blocks may be signaled. When cu_sbt_quadtree_flag is 1, it indicates that the coding block is divided into four sub-blocks. As an example, three vertical lines or three horizontal lines may be used to divide the coding block into four sub-blocks, or one vertical line and one horizontal line may be used to divide the coding block into four sub-blocks. When cu_sbt_quadtree_flag is 0, it indicates that the coding block is divided into two sub-blocks. As an example, one vertical line or one horizontal line may be used to divide the coding block into two sub-blocks.
[0444] Furthermore, an identifier indicating the division direction of the coding block may be signaled via a bitstream. As an example, an identifier cu_sbt_horizontal_flag indicating whether or not horizontal partitioning is applied to the coding block may be signaled by coding. A value of 1 for cu_sbt_horizontal_flag indicates that horizontal partitioning is applied to the coding block, and a value of 0 for cu_sbt_horizontal_flag indicates that vertical partitioning is applied to the coding block.
[0445] Information indicating the locations of sub-blocks without non-zero coefficients or sub-blocks for which no transform is performed can be signaled via the bitstream, based on which it is possible to determine which sub-blocks have been transformed and / or quantized and which sub-blocks should skip transform and / or quantization.
[0446] FIG. 28 is an example of indicating the location of sub-blocks that perform transform and / or quantization via information signaled by the bitstream.
[0447] An identifier sbt_upleft_flag indicating whether there is a non-zero coefficient at a particular position or at the first sub-block can be signaled. A value of 1 for sbt_upleft_flag indicates that a sub-block located at the top or left end of a coding block has been transformed and / or quantized, and that a sub-block located at the right or bottom end of a coding block has not been transformed and / or quantized. A value of 0 for sbt_upleft_flag indicates that a sub-block located at the top or left end of a coding block has been transformed and / or quantized, and that a sub-block located at the right or bottom end of a coding block has not been transformed and / or quantized.
[0448] When a coding block is divided into four sub-blocks, sbt_upleft_flag indicates that transform and / or quantization has been performed on N sub-blocks. For example, a value of 1 for sbt_upleft_flag indicates that transform and / or quantization has been performed on the top or left two sub-blocks, and a value of 0 for sbt_upleft_flag indicates that transform and / or quantization has been performed on the right or bottom two sub-blocks.
[0449] Unlike the examples shown in the drawings, the value of N can also be set to 1 or 3.
[0450] Residual coefficients of sub-blocks that have not been transformed and / or quantized may be set to zero.
[0451] The transform type of the sub-block can be determined according to the division direction of the coding block and the position of the sub-block. For example, when the coding block is divided along the vertical direction and a sub-block located on the left side of the sub-block is transformed, the horizontal transform type and the vertical transform type can be set to be different. For example, the horizontal transform type can be set to DCT8 and the vertical transform type can be set to DST7. Conversely, when the coding block is divided along the vertical direction and a sub-block located on the right side of the sub-block is transformed, the horizontal transform type and the vertical transform type of the sub-block can be set to be the same. For example, the horizontal transform type and the vertical transform type can be set to DST7.
[0452] Alternatively, when a coding block is divided horizontally and a sub-block located at the top of the sub-block is transformed, the horizontal transform type and the vertical transform type can be set to be different. For example, the horizontal transform type can be set to DST7 and the vertical transform type can be set to DCT8. Conversely, when a coding block is divided horizontally and a sub-block located at the bottom of the sub-block is transformed, the horizontal transform type and the vertical transform type of the sub-block can be set to be the same. For example, the horizontal transform type and the vertical transform type can be set to DST7.
[0453] For a subblock, information indicating whether or not there is a non-zero coefficient, such as CBF coding, can be skipped. When CBF coding is skipped, it can be determined whether or not each subblock includes a non-zero residual coefficient according to the position of the block to be transformed. As an example, when the value of sbt_upleft_flag is 0, it can be obtained that the CBF value of the subblock located on the left or upper end is 0, and the CBF value of the subblock located on the right or lower end is 1. Alternatively, when the value of sbt_upleft_flag is 1, it can be obtained that the CBF value of the subblock located on the left or upper end is 1, and the CBF value of the subblock located on the right or lower end is 0.
[0454] The reconstructed samples of the sub-blocks to be transformed can be obtained by summing the predicted samples and the residual samples. Conversely, for the sub-blocks whose transformation is skipped, the predicted samples can be set to the reconstructed samples. The quantization is for reducing the energy of the block, and the quantization process includes dividing the transform coefficients by a certain constant value. The constant value can be obtained according to a quantization parameter, which can be defined as a value between 1 and 63.
[0455] If the encoder performs transform and quantization, the decoder can obtain a residual block through inverse quantization and inverse transform. The decoder can add the measured block to the residual block to obtain a reconstructed block for the current block.
[0456] When the reconstructed block of the current block is obtained, information loss caused in the quantization and coding process can be reduced through in-loop filtering. The loop filtering may include at least one of a deblocking filter, a sample adaptive offset filter (SAO) or an adaptive loop filter (ALF). Hereinafter, the reconstructed block before applying the loop filtering is referred to as a first reconstructed block, and the reconstructed block after applying the loop filtering is referred to as a second reconstructed block.
[0457] At least one of a deblocking filter, SAO, or ALF may be applied to the first reconstructed block to obtain a second reconstructed block, in which case the SAO or ALF may be applied after applying the deblocking filter.
[0458] The deblocking filter is used to reduce blocking artifacts at block boundaries that are generated by quantizing blocks as units. To apply the deblocking filter, a blocking strength (BS) between a first reconstruction block and an adjacent reconstruction block can be determined.
[0459] FIG. 29 is a flow chart of a process for determining block strength.
[0460] In the example shown in Figure 29, P indicates a first reconstruction block, and Q indicates an adjacent reconstruction block, where the adjacent reconstruction block may be adjacent to the right or top of the current block.
[0461] In the example shown in Figure 29, the drawing shows a case where block strength is determined according to the predictive coding modes of P and Q, whether or not the block contains non-zero transform coefficients, whether or not the block is inter-predicted using the same reference image, and whether or not the difference in motion vectors is greater than or equal to a threshold.
[0462] Based on the block strength, it can be determined whether to apply a deblocking filter. As an example, if the block strength is 0, there may be no filtering.
[0463] SAO is used to reduce ringing artifacts caused by quantization in the frequency domain. SAO can be performed through adding or subtracting an offset determined based on the pattern of the first restored video. The method of determining the offset includes edge offset (EO) or sideband offset (BO). EO indicates a method of determining a correction value for a current sample according to a pattern of adjacent pixels. BO indicates a method of applying a common correction value to a set of pixels having similar luminance values in a region. Specifically, pixel luminance can be divided into 32 equal intervals, and pixels having similar luminance values can be set as one set. As an example, adjacent four bands out of the 32 sidebands can be set as one group, and the same correction value can be applied to samples belonging to the four bands.
[0464] ALF is a method of applying a filter of a predefined size or shape to a first restored video or a restored video to which a deblocking filter has been applied to generate a second restored video. The following Equation 32 shows an application example of ALF.
number
[0465] For each image, coding tree unit, coding block, prediction block or transform block, any of the predefined filter candidates may be selected, and any of the sizes or shapes of each filter candidate may be different.
[0466] FIG. 30 shows predefined filter candidates.
[0467] As shown in FIG. 30, at least one of diamond windows of size 5×5, 7×7 or 9×9 can be selected.
[0468] For the chrominance components, only a diamond window of size 5x5 can be used.
[0469] The embodiments described with a focus on a decoding or coding process may be applied to a coding or decoding process, and still fall within the scope of the present application. The embodiments described in a given order may be changed so that the content of the description is in a different order, and still fall within the scope of the present application.
[0470] Although the above-mentioned embodiments are described based on a series of steps or sequence diagrams, this does not limit the order of the invention, and the steps may be performed simultaneously or in a different order as necessary. Furthermore, in the above-mentioned embodiments, the components (e.g., units, modules, etc.) constituting the block diagrams may each be realized by a hardware device or software, or may be combined by a plurality of components to be realized by one hardware device or software. The above-mentioned embodiments may be realized in the form of program instructions that can be executed by various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may be independent or combined with program instructions, data files, data structures, etc. Examples of computer-readable recording media include magnetic media such as hard disks, soft disks, and magnetic tapes, optical recording media such as CD-ROMs and DVDs, magneto-optical media such as floppy disks, and hardware devices that store and execute specially configured program instructions, such as ROMs, RAMs, and flash memories. The hardware devices may be configured to rotate with one or more software modules to execute the processes of the present application, and vice versa. [Industrial Applicability]
[0471] The present application can be applied to electronic devices that encode or decode images.
Claims
1. 1. A video decoding method, comprising: determining a reference sample line for a current block; determining whether there is a candidate intra-prediction mode that is the same as the intra-prediction mode of the current block; deriving an intra prediction mode for the current block based on the determined result; and performing intra prediction on the current block according to the reference sample line and the intra prediction mode, At least one of the candidate intra prediction modes is derived by adding or subtracting an offset to the maximum value of an intra prediction mode of an upper neighboring block of the current block and an intra prediction mode of a left neighboring block of the current block; determining candidate transform types for the current block, the number of candidate transform types depending on whether the current block allows explicit determination of the transform type; determining whether to divide the current block into a plurality of sub-blocks; When the current block is divided into a plurality of sub-blocks, a horizontal transformation type of the sub-block is determined according to a width of the sub-block, and a vertical transformation type of the sub-block is determined according to a height of the sub-block.
2. The plurality of sub-blocks share one intra-prediction mode. The video decoding method of claim 1.
3. Inverse transform is skipped for some of the plurality of sub-blocks. The video decoding method of claim 2.
4. 1. A video encoding method, comprising: determining a reference sample line for a current block; determining whether there is a candidate intra-prediction mode that is the same as the intra-prediction mode of the current block; deriving an intra prediction mode for the current block based on the determined result; and performing intra prediction on the current block according to the reference sample line and the intra prediction mode, At least one of the candidate intra prediction modes is derived by adding or subtracting an offset to the maximum value of an intra prediction mode of an upper neighboring block of the current block and an intra prediction mode of a left neighboring block of the current block; determining candidate transform types for the current block, the number of candidate transform types depending on whether the current block allows explicit determination of the transform type; determining whether to divide the current block into a plurality of sub-blocks; When the current block is divided into a plurality of sub-blocks, a horizontal transformation type of the sub-block is determined according to a width of the sub-block, and a vertical transformation type of the sub-block is determined according to a height of the sub-block.
5. The plurality of sub-blocks share one intra-prediction mode.
5. The video encoding method of claim 4.
6. Transformation is skipped for some of the plurality of sub-blocks.
6. The video encoding method of claim 5.
7. 1. A decoder comprising: a memory for storing instructions executable by a processor; A processor for executing instructions for performing the video decoding method according to any one of claims 1 to 3.
8. 1. An encoder comprising: a memory for storing instructions executable by a processor; A processor for executing instructions for performing the video encoding method according to any one of claims 4 to 6.
9. 1. A decoder comprising: means for determining a reference sample line of a current block; means for determining whether there exists a candidate intra-prediction mode that is the same as the intra-prediction mode of the current block; means for deriving an intra-prediction mode for the current block based on the determined result; means for performing intra prediction on the current block according to the reference sample line and the intra prediction mode, At least one of the candidate intra prediction modes is derived by adding or subtracting an offset to the maximum value of an intra prediction mode of an upper neighboring block of the current block and an intra prediction mode of a left neighboring block of the current block; means for determining candidate transform types for the current block, the number of candidate transform types differing depending on whether the current block allows explicit determination of a transform type; means for determining whether to divide the current block into a plurality of sub-blocks; When the current block is divided into a plurality of sub-blocks, the decoder determines a horizontal transformation type of the sub-block according to a width of the sub-block and determines a vertical transformation type of the sub-block according to a height of the sub-block.
10. 1. An encoder comprising: means for determining a reference sample line of a current block; means for determining whether there exists a candidate intra-prediction mode that is the same as the intra-prediction mode of the current block; means for deriving an intra-prediction mode for the current block based on the determined result; means for performing intra prediction on the current block according to the reference sample line and the intra prediction mode, At least one of the candidate intra prediction modes is derived by adding or subtracting an offset to the maximum value of an intra prediction mode of an upper neighboring block of the current block and an intra prediction mode of a left neighboring block of the current block; means for determining candidate transform types for the current block, the number of candidate transform types differing depending on whether the current block allows explicit determination of a transform type; means for determining whether to divide the current block into a plurality of sub-blocks; When the current block is divided into a plurality of sub-blocks, the encoder determines a horizontal transformation type of the sub-block according to a width of the sub-block and determines a vertical transformation type of the sub-block according to a height of the sub-block.
11. A non-transitory computer-readable medium storing instructions which, when executed by a processor, cause the processor to perform the video decoding method of any one of claims 1 to 3 or the video encoding method of any one of claims 4 to 6.
Citation Information
Patent Citations
Method and apparatus for encoding / decoding in-screen prediction mode
EP3379829A1
Method and apparatus for processing video signal
WO2017176030A1