Method for encoding / decoding image signal and device for same
Patent Information
- Application Number
- IL325030
- Authority / Receiving Office
- IL · IL
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2019-01-18
- Filing Date
- 2019-10-11
- Publication Date
- 2026-08-01
AI Technical Summary
High-definition video services face significant data volume increases due to inefficient video compression, with existing standards like HEVC revealing limitations in performance as display panels grow larger.
A method is introduced to improve video signal encoding/decoding efficiency by deriving candidate intra prediction modes based on neighboring blocks and dividing coding or transform blocks into sub-blocks for selective processing, including intra prediction and transformation.
This approach enhances intra prediction and coding/decoding efficiency by leveraging neighboring block modes and adaptive block division, effectively addressing the limitations of current compression standards and reducing data volume.
Smart Images

Figure 00000072_0000 
Figure 00000073_0000 
Figure 00000074_0000
Abstract
Description
Video signal encoding / decoding method and apparatus for the same
[0001] The present invention relates to a video signal encoding / decoding method and an apparatus for the same.
[0002] With the trend of display panels becoming increasingly larger, there is a growing demand for video services with higher image quality. The biggest challenge with high-definition video services is the significant increase in data volume, and to address this, research to improve video compression ratios is actively underway. A representative example is the formation of the Joint Collaborative Team on Video Coding (JCT-VC) in 2009 by the Motion Picture Experts Group (MPEG) and the Video Coding Experts Group (VCEG) under the International Telecommunication Union-Telecommunication (ITU-T). JCT-VC proposed High Efficiency Video Coding (HEVC), a video compression standard with approximately twice the compression performance of H.264 / AVC, and it was approved as a standard on January 25, 2013. However, with the rapid advancement of high-definition video services, the performance of HEVC is gradually revealing its limitations.
[0003] The present invention aims to provide a method for deriving a candidate intra prediction mode based on an intra prediction mode of a neighbor block adjacent to a current block in encoding / decoding a video signal, and an apparatus for performing said method.
[0004] The present invention aims to provide a method for encoding / decoding a video signal, wherein a coding block or a conversion block is divided into a plurality of sub-blocks and intra prediction is performed for each of the sub-blocks, and an apparatus for performing said method.
[0005] The present invention aims to provide a method for encoding / decoding a video signal, wherein a coding block or a conversion block is divided into a plurality of sub-blocks and a conversion is performed only on some of the sub-blocks, and an apparatus for performing said method.
[0006] The technical problems to be solved by the present invention are not limited to those mentioned above, and other technical problems not mentioned will be clearly understood by those skilled in the art to which the present invention belongs from the description below.
[0007] A video signal decoding / encoding method according to the present invention comprises the steps of determining a reference sample line of a current block, determining whether there exists a candidate intra prediction mode identical to the intra prediction mode of the current block, deriving the intra prediction mode of the current block based on the determination, and performing an intra prediction for the current block based on 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 from the maximum value among the intra prediction mode of the upper neighbor block of the current block and the intra prediction mode of the left neighbor block of the current block.
[0008] In the video signal decoding / encoding method according to the present invention, when the difference between the intra prediction mode of the upper neighbor block and the intra prediction mode of the left neighbor block is 64, at least one of the candidate intra prediction modes can be derived by adding or subtracting 2 to the maximum value.
[0009] In the video signal decoding / encoding method according to the present invention, the number of candidate intra prediction modes may vary depending on the index of the reference sample line.
[0010] A video signal decoding / encoding method according to the present invention further includes a step of determining whether to divide the current block into a plurality of sub-blocks, and when the current block is divided into a plurality of sub-blocks, the plurality of sub-blocks may share a single intra-prediction mode.
[0011] In the video signal decoding / encoding method according to the present invention, inverse conversion may be omitted for some of the plurality of sub-blocks.
[0012] In the video signal decoding / encoding method according to the present invention, the horizontal direction transformation type of the sub-block is determined based on the width of the sub-block, and the vertical direction transformation type of the sub-block can be determined based on the height of the sub-block.
[0013] In the video signal decoding / encoding method according to the present invention, the horizontal direction conversion type and the vertical direction conversion type of the sub-block can be determined based on the shape of the sub-block.
[0014] The features briefly summarized above regarding the present invention are merely exemplary aspects of the detailed description of the present invention that follows and do not limit the scope of the present invention.
[0015] According to the present invention, intra prediction efficiency can be improved by inducing a candidate intra prediction mode similar to the intra prediction mode of a neighboring block adjacent to the current block.
[0016] According to the present invention, by dividing a coding block or a conversion block into a plurality of sub-blocks and performing intra prediction for each of the sub-blocks, the intra prediction efficiency can be improved.
[0017] According to the present invention, encoding / decoding efficiency can be improved by dividing a coding block or a conversion block into a plurality of sub-blocks and performing conversion on only some of the sub-blocks.
[0018] The effects obtainable from the present invention are not limited to those mentioned above, and other unmentioned effects will be clearly understood by those skilled in the art from the description below.
[0019] FIG. 1 is a block diagram of an image encoder (encoder) according to one embodiment of the present invention.
[0020] FIG. 2 is a block diagram of an image decoder (decoder) according to one embodiment of the present invention.
[0021] FIG. 3 is a drawing illustrating a basic coding tree unit according to one embodiment of the present invention.
[0022] Figure 4 is a diagram showing various division forms of a coding block.
[0023] Figure 5 is a diagram illustrating the division pattern of a coding tree unit.
[0024] FIG. 6 is a flowchart of an inter prediction method according to one embodiment of the present invention.
[0025] Figure 7 is a diagram showing a collocated block.
[0026] FIG. 8 is a flowchart of an intra-prediction method according to one embodiment of the present invention.
[0027] Figure 9 is a diagram showing the reference samples included in each reference sample line.
[0028] Figure 10 is a diagram showing intra prediction modes.
[0029] Figures 11 and 12 are diagrams showing examples of one-dimensional arrays that arrange reference samples in a row.
[0030] Figure 13 is a diagram illustrating the angle formed by directional intra-prediction modes with a straight line parallel to the x-axis.
[0031] Figure 14 is a diagram showing the pattern of obtaining a prediction sample when the current block is in a non-square shape.
[0032] Figure 15 is a diagram showing wide-angle intra prediction modes.
[0033] Figure 16 is a diagram showing an example of vertical partitioning and horizontal partitioning.
[0034] Figure 17 is a diagram showing an example of determining the division shape of a coding block.
[0035] Figure 18 is a diagram showing an example of determining the division shape of a coding block.
[0036] FIG. 19 is a diagram showing an example in which the segmentation form of a coding block is determined based on the intra-prediction mode of the coding block.
[0037] Figure 20 is a diagram illustrating the division of a coding block.
[0038] Figure 21 is a diagram showing an example where the prediction encoding mode is set differently for each sub-block.
[0039] Figure 22 is a diagram showing the application aspect of PDPC.
[0040] FIGS. 23 and FIGS. 24 are drawings showing the sub-blocks on which the second transformation will be performed.
[0041] FIG. 25 is a diagram illustrating an example of how the conversion type of the current block is determined.
[0042] Figure 26 is a diagram showing an example of determining the conversion type of a sub-block.
[0043] FIG. 27 is a diagram illustrating an example in which the residual coefficients of the sub-blocks are set to 0.
[0044] FIG. 28 shows an example in which the location of a sub-block that has been converted and / or quantized is determined based on information signaled through a bitstream.
[0045] Figure 29 is a flowchart illustrating the process of determining block strength.
[0046] Figure 30 shows previously defined filter candidates.
[0047] Embodiments of the present invention will be described in detail below with reference to the drawings.
[0048] Encoding and decoding of the image are performed in block units. For example, encoding / decoding processes such as transformation, quantization, prediction, in-loop filtering, or restoration may be performed on a coding block, a transform block, or a prediction block.
[0049] Hereinafter, the block subject to encoding / decoding will be referred to as the 'current block'. For example, the current block may represent a coding block, a transformation block, or a prediction block depending on the current encoding / decoding processing stage.
[0050] Furthermore, as used in this specification, the term 'unit' may be understood to represent a basic unit for performing a specific encoding / decoding process, and 'block' may be understood to represent a sample array of a predetermined size. Unless otherwise noted, 'block' and 'unit' may be used interchangeably. For example, in the embodiments described below, a coding block and a coding unit may be understood to have mutually equivalent meanings.
[0051] FIG. 1 is a block diagram of an image encoder (encoder) according to one embodiment of the present invention.
[0052] Referring to FIG. 1, the image encoding device (100) may include a picture splitting unit (110), a prediction unit (120, 125), a conversion unit (130), a quantization unit (135), a reordering unit (160), an entropy encoding unit (165), an inverse quantization unit (140), an inverse conversion unit (145), a filter unit (150), and a memory (155).
[0053] Each component shown in FIG. 1 is depicted independently to represent different characteristic functions of the image encoding device and does not imply that each component consists of separate hardware or a single software unit. That is, each component is listed and included as a separate component for the convenience of explanation, but at least two of the components may be combined to form a single component, or a single component may be divided into multiple components to perform functions, and such integrated and separated embodiments of each component are included within the scope of the present invention as long as they do not deviate from the essence of the present invention.
[0054] Furthermore, some components may not be essential components performing an essential function in the present invention, but merely optional components for enhancing performance. The present invention may be implemented by including only the components essential for realizing the essence of the present invention, excluding components used solely for performance enhancement, and a structure including only the essential components, excluding optional components used solely for performance enhancement, is also included within the scope of the rights of the present invention.
[0055] The picture segmentation unit (110) can divide an input picture into at least one processing unit. At this time, the processing unit may be a Prediction Unit (PU), a Transform Unit (TU), or a Coding Unit (CU). The picture segmentation unit (110) can divide a picture into a combination of multiple coding units, prediction units, and transformation units, and can encode the picture by selecting one combination of coding units, prediction units, and transformation units based on a predetermined criterion (e.g., a cost function).
[0056] For example, a single picture can be divided into multiple coding units. To divide coding units within a picture, a recursive tree structure such as a Quad Tree Structure can be used. A coding unit divided into other coding units, with a single image or the largest coding unit as the root, can have as many child nodes as there are divided coding units. A coding unit that can no longer be divided according to certain limits becomes a leaf node. That is, assuming that only square division is possible for a single coding unit, a single coding unit can be divided into up to four different coding units.
[0057] In the following embodiments of the present invention, the encoding unit may be used to mean a unit that performs encoding, or a unit that performs decoding.
[0058] A prediction unit may be divided into at least one shape, such as a square or rectangle, of the same size within a single encoding unit, or one of the prediction units divided within a single encoding unit may be divided such that any one prediction unit has a different shape and / or size from another prediction unit.
[0059] When generating a prediction unit that performs intra prediction based on a coding unit, if it is not the minimum coding unit, intra prediction can be performed without dividing it into multiple prediction units NxN.
[0060] The prediction unit (120, 125) may include an inter prediction unit (120) that performs inter prediction and an intra prediction unit (125) that performs intra prediction. It may determine whether to use inter prediction or perform intra prediction for a prediction unit, and determine specific information (e.g., intra prediction mode, motion vector, reference picture, etc.) according to each prediction method. At this time, the processing unit in which the prediction is performed and the processing unit in which the prediction method and specific details are determined may be different. For example, the prediction method and prediction mode, etc. may be determined in the prediction unit, and the prediction may be performed in the transformation unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transformation unit (130). In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded together with the residual value in the entropy encoding unit (165) and transmitted to the decoder. When using a specific encoding mode, it is also possible to encode the original block as is and transmit it to the decoding unit without generating a prediction block through the prediction unit (120, 125).
[0061] The inter prediction unit (120) may predict a prediction unit based on information of at least one picture among the previous picture or the subsequent picture of the current picture, and in some cases, may predict a prediction unit based on information of a partially encoded area within the current picture. The inter prediction unit (120) may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.
[0062] In the reference picture interpolation unit, reference picture information is received from memory (155), and pixel information of integer pixels or less can be generated from the reference picture. 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 chrominance 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.
[0063] The motion prediction unit can perform motion prediction based on a reference picture interpolated by the reference picture interpolation unit. Various methods such as FBMA (Full search-based Block Matching Algorithm), TSS (Three Step Search), and NTS (New Three-Step Search Algorithm) can be used to calculate motion vectors. Based on the interpolated pixels, the motion vector can have motion vector values in units of 1 / 2 or 1 / 4 pixels. The motion prediction unit can predict the current prediction unit by using different motion prediction methods. Various motion prediction methods such as the Skip method, Merge method, AMVP (Advanced Motion Vector Prediction) method, and Intra Block Copy method can be used.
[0064] The intra prediction unit (125) can generate a prediction unit based on reference pixel information around the current block, which is pixel information within the current picture. If the surrounding block of the current prediction unit is a block that has performed inter prediction, and the reference pixel is a pixel that has performed inter prediction, the reference pixel included in the block that has performed inter prediction can be replaced with the reference pixel information of the surrounding intra prediction block. That is, if the reference pixel is not available, the unavailable reference pixel information can be replaced with at least one of the available reference pixels.
[0065] In intra-prediction, the prediction mode may include 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 the prediction. The mode for predicting luminance information and the mode for predicting chrominance information may be different, and the intra-prediction mode information used to predict luminance information or the predicted luminance signal information may be utilized to predict chrominance information.
[0066] When performing intra prediction, if the size of the prediction unit and the size of the transform unit are the same, intra prediction for the prediction unit can be performed based on the pixels to the left, the pixels at the top left, and the pixels at the top of the prediction unit. However, when performing intra prediction, if the size of the prediction unit and the size of the transform unit are different, intra prediction can be performed using reference pixels based on the transform unit. Additionally, intra prediction using NxN partitioning can be used only for the minimum encoding unit.
[0067] The intra prediction method can generate a prediction block after applying an Adaptive Intra Smoothing (AIS) filter to a reference pixel according to the prediction mode. The type of AIS filter applied to the reference pixel may vary. To perform the intra prediction method, the intra prediction mode of the current prediction unit can be predicted from the intra prediction modes of prediction units existing in the vicinity of the current prediction unit. When predicting the prediction mode of the current prediction unit using mode information predicted from neighboring prediction units, if the intra prediction modes of the current prediction unit and the neighboring prediction units are the same, information indicating that the prediction modes of the current prediction unit and the neighboring prediction units are the same can be transmitted using predetermined flag information; if the prediction modes of the current prediction unit and the neighboring prediction units are different, entropy coding can be performed to encode the prediction mode information of the current block.
[0068] Additionally, a residual block can be generated that includes residual value information, which is the difference between the prediction unit that performed the prediction based on the prediction unit generated in the prediction unit (120, 125) and the original block of the prediction unit. The generated residual block can be input to the conversion unit (130).
[0069] In the transformation unit (130), the residual block containing residual value information of the prediction unit generated through the original block and the prediction unit (120, 125) can be transformed using a transformation method such as DCT (Discrete Cosine Transform), DST (Discrete Sine Transform), or KLT. Whether to apply DCT, DST, or KLT to transform the residual block can be determined based on the intra-prediction mode information of the prediction unit used to generate the residual block.
[0070] The quantization unit (135) can quantize the values converted into the frequency domain in the conversion unit (130). The quantization coefficient may vary depending on the block or the importance of the image. The values produced by the quantization unit (135) may be provided to the inverse quantization unit (140) and the reordering unit (160).
[0071] The reordering unit (160) can perform reordering of coefficient values for quantized residual values.
[0072] The reordering unit (160) can convert two-dimensional block-shaped coefficients into one-dimensional vector forms through a coefficient scanning method. For example, the reordering unit (160) can convert the coefficients from DC to high-frequency range coefficients into one-dimensional vector forms by scanning using a Zig-Zag Scan method. Depending on the size of the conversion unit and the intra-prediction mode, a vertical scan that scans two-dimensional block-shaped coefficients in the column direction or a horizontal scan that scans two-dimensional block-shaped coefficients in the row direction may be used instead of the Zig-Zag Scan. That is, depending on the size of the conversion unit and the intra-prediction mode, it can be determined whether to use a Zig-Zag Scan, a vertical scan, or a horizontal scan.
[0073] The entropy encoding unit (165) can perform entropy encoding based on the values calculated by the reordering unit (160). Entropy encoding can use various encoding methods, such as, for example, Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC).
[0074] The entropy encoding unit (165) can encode various information from the reordering unit (160) and the prediction unit (120, 125), such as residual value coefficient information of the encoding 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.
[0075] The entropy encoding unit (165) can entropy-encode the coefficient value of the encoding unit input from the rearrangement unit (160).
[0076] In the inverse quantization unit (140) and inverse transformation unit (145), the values quantized in the quantization unit (135) are inverse quantized, and the values transformed in the transformation unit (130) are inverse transformed. The residual value generated in the inverse quantization unit (140) and inverse transformation unit (145) can be combined with the prediction unit predicted through the motion estimation unit, motion compensation unit, and intra prediction unit included in the prediction unit (120, 125) to generate a reconstructed block.
[0077] The filter section (150) may include at least one of a deblocking filter, an offset correction section, and an ALF (Adaptive Loop Filter).
[0078] The deblocking filter can remove block distortion caused by boundaries between blocks in the restored picture. To determine whether to perform deblocking, the decision to apply the deblocking filter to the current block can be made based on the pixels contained in a certain number of columns or rows within the block. When applying the deblocking filter to a block, a Strong Filter or a Weak Filter can be applied depending on the required deblocking filtering strength. Additionally, when applying the deblocking filter, horizontal and vertical filtering can be processed in parallel.
[0079] The offset correction unit can correct the offset from the original image on a pixel-by-pixel basis for the image that has undergone deblocking. To perform offset correction for a specific picture, a method can be used in which pixels included in the image are divided into a certain number of regions, the region to be offset is determined, and the offset is applied to that region, or a method can be used in which the offset is applied by considering the edge information of each pixel.
[0080] Adaptive Loop Filtering (ALF) can be performed based on a comparison between the filtered restored image and the original image. After dividing the pixels included in the image into predetermined groups, a single filter to be applied to each group can be determined, allowing for differential filtering for each group. Information regarding whether to apply ALF can be transmitted per coding unit (CU), and the shape and filter coefficients of the ALF filter to be applied may vary depending on each block. Additionally, an ALF filter of the same form (fixed form) may be applied regardless of the characteristics of the block to be applied.
[0081] The memory (155) can store a restored block or picture produced through the filter unit (150), and the stored restored block or picture can be provided to the prediction unit (120, 125) when performing inter-prediction.
[0082] FIG. 2 is a block diagram of an image decoder (decoder) according to one embodiment of the present invention.
[0083] Referring to FIG. 2, the image decoder (200) may include an entropy decoder (210), a reordering unit (215), an inverse quantization unit (220), an inverse transformation unit (225), a prediction unit (230, 235), a filter unit (240), and a memory (245).
[0084] When a video bitstream is input to a video encoder, the input bitstream can be decoded using the reverse procedure of the video encoder.
[0085] The entropy decoding unit (210) can perform entropy decoding in the opposite procedure to that which the entropy encoding unit of the image encoder performed. For example, various methods such as Exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding) can be applied in correspondence with the method performed in the image encoder.
[0086] The entropy decoding unit (210) can decode information related to intra-prediction and inter-prediction performed in the encoder.
[0087] The reordering unit (215) can perform reordering based on the method of reordering the entropy-decoded bitstream in the encoding unit in the entropy decoding unit (210). It can reorder by restoring the coefficients expressed in the form of a one-dimensional vector back into coefficients in the form of a two-dimensional block. The reordering unit (215) can perform reordering by receiving information related to the coefficient scanning performed in the encoding unit and scanning in reverse based on the scanning order performed in the encoding unit.
[0088] The inverse quantization unit (220) can perform inverse quantization based on the coefficient values of the rearranged block and the quantization parameters provided by the encoder.
[0089] The inverse transform unit (225) can perform inverse transforms, i.e., inverse DCT, inverse DST, and inverse KLT, on the transforms, i.e., DCT, DST, and KLT, performed by the transform unit on the quantization result performed by the image encoder. The inverse transform can be performed based on the transmission unit determined by the image encoder. In the inverse transform unit (225) of the image decoder, a transformation technique (e.g., DCT, DST, KLT) can be selectively performed according to multiple pieces of information such as a prediction method, the size of the current block, and the prediction direction.
[0090] The prediction unit (230, 235) can generate a prediction block based on the prediction block generation information provided by the entropy decoding unit (210) and the previously decoded block or picture information provided by the memory (245).
[0091] As described above, when performing intra prediction identical to the operation in the video encoder, if the size of the prediction unit and the size of the transform unit are the same, intra prediction for the prediction unit is performed based on the pixels to the left, the pixels to the top left, and the pixels to the top of the prediction unit; however, if the size of the prediction unit and the size of the transform unit are different when performing intra prediction, intra prediction can be performed using reference pixels based on the transform unit. Additionally, intra prediction using NxN partitioning only for the minimum encoding unit may also be used.
[0092] The prediction unit (230, 235) may include a prediction unit determination unit, an inter prediction unit, and an intra prediction unit. The prediction unit determination unit receives various information, such as prediction unit information input from the entropy decoding unit (210), prediction mode information of the intra prediction method, and motion prediction related information of the inter prediction method, distinguishes the prediction unit from the current encoding unit, and determines whether the prediction unit performs inter prediction or intra prediction. The inter prediction unit (230) may perform inter prediction for the current prediction unit based on information included in at least one picture, either the previous picture or the subsequent picture, of the current picture containing the current prediction unit, using information required for inter prediction of the current prediction unit provided by the video encoder. Alternatively, it may perform inter prediction based on information of a partially restored area within the current picture containing the current prediction unit.
[0093] To perform inter-prediction, based on the encoding unit, it is possible to determine whether the motion prediction method of the prediction unit included in the corresponding encoding unit is Skip Mode, Merge Mode, Motion Vector Prediction Mode (AMVP Mode), or Intra-Block Copy Mode.
[0094] The intra prediction unit (235) can generate a prediction block based on pixel information within the current picture. If the prediction unit is a prediction unit that has performed intra prediction, it can perform intra prediction based on the intra prediction mode information of the prediction unit provided by the image encoder. The intra prediction unit (235) may include an Adaptive Intra Smoothing (AIS) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter is a part that performs filtering on the reference pixel of the current block, and can determine whether to apply the filter based on the prediction mode of the current prediction unit. AIS filtering can be performed on the reference pixel of the current block using the prediction mode of the prediction unit and the AIS filter information provided by the image encoder. If the prediction mode of the current block is a mode that does not perform AIS filtering, the AIS filter may not be applied.
[0095] The reference pixel interpolation unit can generate a reference pixel of an integer value or less by interpolating the reference pixel when the prediction mode of the prediction unit is a prediction unit that performs intra-prediction based on the pixel value interpolated from the reference pixel. If the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating the reference pixel, the reference pixel may not be interpolated. The DC filter can generate a prediction block through filtering when the prediction mode of the current block is DC mode.
[0096] The restored block or picture may be provided to a filter unit (240). The filter unit (240) may include a deblocking filter, an offset correction unit, and an ALF.
[0097] Information regarding whether a deblocking filter has been applied to the corresponding block or picture can be received from the video encoder, and if a deblocking filter has been applied, information regarding whether a strong filter or a weak filter has been applied. The deblocking filter of the video decoder receives information related to the deblocking filter provided by the video encoder and can perform deblocking filtering on the corresponding block.
[0098] The offset correction unit can perform offset correction on the restored image based on the type of offset correction and offset value information applied to the image during encoding.
[0099] ALF can be applied to the encoding unit based on information on whether to apply ALF, ALF coefficient information, etc., provided by the encoder. This ALF information can be provided included in a specific parameter set.
[0100] The memory (245) can store the restored picture or block so that it can be used as a reference picture or reference block, and can also provide the restored picture to the output unit.
[0101]
[0102] FIG. 3 is a drawing illustrating a basic coding tree unit according to one embodiment of the present invention.
[0103] A coding block of maximum size can be defined as a coding tree block. A picture is divided into multiple coding tree units (CTUs). A coding tree unit is a coding unit of maximum size and may also be referred to as an LCU (Largest Coding Unit). FIG. 3 shows an example in which a picture is divided into multiple coding tree units.
[0104] The size of a coding tree unit can be defined at the picture level or the sequence level. To this end, information indicating the size of the coding tree unit can be signaled through a set of picture parameters or a set of sequence parameters.
[0105] For example, the size of the coding tree unit for the entire picture in the sequence may be set to 128x128. Alternatively, the size of the coding tree unit may be determined at the picture level to be either 128x128 or 256x256. For example, the size of the coding tree unit in the first picture may be set to 128x128, and the size of the coding tree unit in the second picture may be set to 256x256.
[0106] Coding blocks can be generated by dividing a coding tree unit. A coding block represents a basic unit for encoding / decoding processing. For example, prediction or transformation may be performed per coding block, or a prediction encoding mode may be determined per coding block. Here, the prediction encoding mode represents a method for generating a prediction image. For example, the prediction encoding mode may include intra-prediction, inter-prediction, current picture referencing (CPR, or intra block copy (IBC)), or combined prediction. For a coding block, a prediction block for the coding block can be generated using at least one prediction encoding mode among intra-prediction, inter-prediction, current picture referencing, or combined prediction.
[0107] Information indicating the predictive encoding mode of the current block may be signaled through a bitstream. For example, the information may be a 1-bit flag indicating whether the predictive encoding mode is intra mode or inter mode. Only when the predictive encoding mode of the current block is determined to be inter mode may current picture reference or composite prediction be available.
[0108] The current picture reference is intended to set the current picture as the reference picture and to obtain the prediction block of the current block from an area within the current picture that has already been encoded / decoded. Here, the current picture refers to the picture containing the current block. Information indicating whether the current picture reference is applied to the current block may be signaled via a bitstream. For example, the information may be a 1-bit flag. If the flag is true, the prediction encoding mode of the current block is determined to be the current picture reference, and if the flag is false, the prediction mode of the current block may be determined to be inter-prediction.
[0109] Alternatively, the predictive coding mode of the current block can be determined based on the reference picture index. For example, if the reference picture index points to the current picture, the predictive coding mode of the current block can be determined as the current picture reference. If the reference picture index points to a picture other than the current picture, the predictive coding mode of the current block can be determined as inter-prediction. That is, the current picture reference is a prediction method that utilizes information from the region within the current picture where encoding / decoding is complete, while inter-prediction is a prediction method that utilizes information from another picture where encoding / decoding is complete.
[0110] Composite prediction represents a encoding mode that combines two or more of intra prediction, inter prediction, and current picture reference. For example, when composite prediction is applied, a first prediction block may be generated based on any one of intra prediction, inter prediction, or current picture reference, and a second prediction block may be generated based on the other. When 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 composite prediction is applied may be signaled through a bitstream. The information may be a 1-bit flag.
[0111] Figure 4 is a diagram showing various division forms of a coding block.
[0112] A coding block can be divided into multiple coding blocks based on quad tree splitting, binary tree splitting, or triple tree splitting. The divided coding blocks can also be further divided into multiple coding blocks based on quad tree splitting, binary tree splitting, or triple tree splitting.
[0113] Quadtree partitioning represents a partitioning technique that divides the current block into four blocks. As a result of quadtree partitioning, the current block can be divided into four square partitions (see 'SPLIT_QT' in (a) of Fig. 4).
[0114] Binary tree splitting refers to a splitting technique that divides the current block into two blocks. Splitting the current block into two blocks along the vertical direction (i.e., using a vertical line crossing the current block) can be called vertical binary tree splitting, and splitting the current block into two blocks along the horizontal direction (i.e., using a horizontal line crossing the current block) can be called horizontal binary tree splitting. As a result of binary tree splitting, the current block can be divided into two non-square partitions. Figure 4 (b) 'SPLIT_BT_VER' represents the result of vertical binary tree splitting, and Figure 4 (c) 'SPLIT_BT_HOR' represents the result of horizontal binary tree splitting.
[0115] Triple tree partitioning represents a partitioning technique that divides the current block into three blocks. Dividing 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 partitioning, and dividing 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 partitioning. As a result of triple tree partitioning, the current block can be divided into three non-square partitions. In this case, the width / height of the partition located in the center of the current block can be twice the width / height of the other partitions. Figure 4 (d) 'SPLIT_TT_VER' represents the result of vertical triple tree partitioning, and Figure 4 (e) 'SPLIT_TT_HOR' represents the result of horizontal triple tree partitioning.
[0116] The number of divisions of a coding tree unit can be defined as the partitioning depth. The maximum partitioning depth of a coding tree unit can be determined at the sequence or picture level. Accordingly, the maximum partitioning depth of a coding tree unit may vary depending on the sequence or picture.
[0117] Alternatively, the maximum split depth for each of the splitting techniques can be determined individually. For example, the maximum split depth allowed for quadtree splitting may differ from the maximum split depth allowed for binary tree splitting and / or tripletree splitting.
[0118] The encoder can signal information indicating at least one of the partition type or partition depth of the current block through a bitstream. The decoder can determine the partition type and partition depth of the coding tree unit based on the information parsed from the bitstream.
[0119] Figure 5 is a diagram illustrating the division pattern of a coding tree unit.
[0120] Dividing coding blocks using partitioning techniques such as quad tree partitioning, binary tree partitioning, and / or triple tree partitioning can be referred to as multi-tree partitioning.
[0121] Coding blocks generated by applying multi-tree splitting to a coding block can be referred to as sub-coding blocks. If the splitting depth of a coding block is k, the splitting depth of the sub-coding blocks is set to k+1.
[0122] Conversely, for coding blocks with a partition depth of k+1, the coding block with a partition depth of k can be referred to as the parent coding block.
[0123] The split type of the current coding block may be determined based on at least one of the split form of the parent coding block or the split type of the neighboring coding block. Here, the neighboring coding block is 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 split type may include at least one of whether to split into a quad tree, whether to split into a binary tree, the direction of the binary tree split, whether to split into a triple tree, or the direction of the triple tree split.
[0124] To determine the splitting form of a coding block, information indicating whether the coding block is split can be signaled through a bitstream. The information is a 1-bit flag 'split_cu_flag', and if the flag is true, it indicates that the coding block is split by a head tree splitting technique.
[0125] If split_cu_flag is true, information indicating whether the coding block is split into a quad tree can be signaled through a bitstream. The information is a 1-bit flag split_qt_flag, and if the flag is true, the coding block can be split into four blocks.
[0126] For example, in the example illustrated in FIG. 5, it is shown that as the coding tree unit is divided into a quad tree, four coding blocks with a division depth of 1 are generated. Additionally, it is shown that quad tree division is applied again to the first and fourth coding blocks 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.
[0127] In addition, by applying quad tree partitioning again to a coding block with a partition depth of 2, a coding block with a partition depth of 3 can be generated.
[0128] If quad tree splitting is not applied to the coding block, it may be determined whether to perform binary tree splitting or triple tree splitting on the coding block by considering at least one of the size of the coding block, whether the coding block is located at a picture boundary, the maximum splitting depth, or the splitting type of neighboring blocks. If it is determined that binary tree splitting or triple tree splitting is performed on the coding block, information indicating the splitting direction may be signaled via a bitstream. The information may be a 1-bit flag mtt_split_cu_vertical_flag. Based on the flag, it may be determined whether the splitting direction is vertical or horizontal. Additionally, information indicating whether binary tree splitting or triple tree splitting is applied to the coding block may be signaled via a bitstream. The information may be a 1-bit flag mtt_split_cu_binary_flag. Based on the flag, it may be determined whether binary tree splitting or triple tree splitting is applied to the coding block.
[0129] For example, in the example illustrated in FIG. 5, a vertical binary tree split is applied to a coding block with a split depth of 1, and among the coding blocks generated as a result of the split, a vertical triple tree split is applied to the left coding block and a vertical binary tree split is applied to the right coding block.
[0130]
[0131] Inter-prediction is a prediction coding mode that predicts the current block using information from the previous picture. For example, a block at the same location as the current block within the previous picture (hereinafter referred to as the "collocated block") can be set as the prediction block for the current block. Hereinafter, a prediction block generated based on the block at the same location as the current block will be referred to as the "Collocated Prediction Block."
[0132] On the other hand, if an object present in the previous picture has moved to a different location in the current picture, the current block can be effectively predicted using the object's movement. For example, if the direction and size of the object's movement can be determined by comparing the previous picture and the current picture, a predicted block (or predicted image) of the current block can be generated by considering the object's movement information. Hereinafter, the predicted block generated using movement information may be referred to as a motion prediction block.
[0133] A residual block can be generated by differencing the prediction block from the current block. In this case, if object movement exists, using a motion prediction block instead of a collocated prediction block can reduce the energy of the residual block and, consequently, improve the compression performance of the residual block.
[0134] As described above, generating prediction blocks using motion information can be referred to as motion-compensated prediction. In most inter-predictions, prediction blocks can be generated based on motion-compensated prediction.
[0135] Motion information may include at least one of a motion vector, a reference picture index, a prediction direction, or a bidirectional weight index. The motion vector indicates the direction and magnitude of the object's movement. The reference picture index specifies the reference picture of the current block among the reference pictures included in the reference picture list. The prediction direction indicates any one of unidirectional L0 prediction, unidirectional L1 prediction, or bidirectional prediction (L0 prediction and L1 prediction). Depending on the prediction direction of the current block, at least one of the movement information in the L0 direction or the movement information in the L1 direction may be used. The bidirectional weight index specifies the weight applied to the L0 prediction block and the weight applied to the L1 prediction block.
[0136] FIG. 6 is a flowchart of an inter prediction method according to one embodiment of the present invention.
[0137] Referring to FIG. 6, the inter prediction method includes the step of determining an inter prediction mode of the current block (S601), the step of obtaining movement information of the current block according to the determined inter prediction mode (S602), and the step of performing a movement compensation prediction for the current block based on the obtained movement information (S603).
[0138] Here, the inter prediction mode represents various techniques for determining motion information of the current block, and may include an inter prediction mode using translational motion information and an inter prediction mode using affine motion information. For example, an inter prediction mode using translational motion information may include a merge mode and a motion vector prediction mode, and an inter prediction mode using affine motion information may include an affine merge mode and an affine motion vector prediction mode. Depending on the inter prediction mode, the motion information of the current block may be determined based on information parsed from neighboring blocks or bitstreams adjacent to the current block.
[0139] For example, the motion information of the current block may be derived based on the motion information of a spatial neighbor block included in the same picture as the current block or a collocated block included in a different picture from the current block. The spatial neighbor block includes at least one of a neighbor block adjacent to the top of the current block, a neighbor block adjacent to the left, a neighbor block adjacent to the top-left corner, a neighbor block adjacent to the top-right corner, or a neighbor block adjacent to the bottom-left corner. The collocated block may have the same location and size as the current block within the call picture. For example, FIG. 7 is a diagram showing a collocated block. The call picture may be identified by index information pointing to any one of the reference pictures.
[0140] The precision of the motion vector of the current block can be determined as one of a plurality of motion vector precision candidates. For example, the motion vector precision candidates may include at least one of octoffel, quarterfel, halffel, integerfel, two integerfel, or four integerfel. The number or type of motion vector precision candidates may be determined on a sequence, slice, or block basis. For example, information for determining the number or type of motion vector precision candidates may be signaled via a bitstream. Alternatively, the number or type of motion vector precision candidates may be determined based on whether the current block uses an inter-prediction mode or an affine motion model. Information for specifying any one of the plurality of motion vector precision candidates may also be signaled via a bitstream.
[0141] Intra prediction is the prediction of the current block using reconstructed samples that have completed encoding / decoding around the current block. In this case, for the intra prediction of the current block, reconstructed samples prior to the application of the in-loop filter may be used.
[0142] Intra prediction techniques include matrix-based intra prediction and general intra prediction considering the directionality with surrounding reconstructed samples. Information indicating the intra prediction technique of the current block may be signaled via a bitstream. The information may be a 1-bit flag. Alternatively, the intra prediction technique of the current block may be determined based on at least one of the position, size, shape of the current block or the intra prediction technique of neighboring blocks. For example, if the current block exists across a picture boundary, matrix-based intra prediction may not be applied to the current block.
[0143] Matrix-based intra prediction is a method for obtaining a predicted block of the current block based on matrix multiplication between a matrix previously stored in an encoder and a decoder and a reconstructed sample surrounding the current block. Information for specifying one of a plurality of previously stored matrices may be signaled via a bitstream. The decoder may determine a matrix for intra prediction of the current block based on the said information and the size of the current block.
[0144] General intra prediction is a method for acquiring a prediction block for the current block based on a non-directional intra prediction mode or a directional intra prediction mode. Below, with reference to the drawings, we will examine in more detail the process of performing intra prediction based on general intra prediction.
[0145] FIG. 8 is a flowchart of an intra-prediction method according to one embodiment of the present invention.
[0146] A reference sample line of the current block can be determined (S801). The reference sample line refers to a set of reference samples contained in the k-th line from the top and / or left of the current block. The reference samples can be derived from the reconstructed samples that have been encoded / decoded around the current block.
[0147] Index information identifying the reference sample line of the current block among multiple reference sample lines can be signaled via a bitstream. For example, index information intra_luma_ref_idx for specifying the reference sample line of the current block can be signaled via a bitstream. The index information can be signaled on a coding block basis.
[0148] A plurality of reference sample lines may include at least one of the first, second, third, or fourth line at the top and / or left of the current block. Among the plurality of reference sample lines, a reference sample line consisting of a row adjacent to the top of the current block and a column adjacent to the left of the current block 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.
[0149] Figure 9 is a diagram showing reference sample lines.
[0150] Figure 9 illustrates one adjacent reference sample line consisting of rows / columns adjacent to the current block and three non-adjacent reference sample lines consisting of rows / columns not adjacent to the current block.
[0151] Only some of the multiple reference sample lines may be selected as the reference sample lines of the current block. For example, the remaining reference sample lines, excluding 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 the index assigned to each of the candidate reference sample lines.
[0152] Index (intra_luma_ref_idx) Reference Sample Line 0 Adjacent Reference Sample Line 1 1st Non-adjacent Reference Sample Line 2 2nd Non-adjacent Reference Sample Line
[0153] A larger number of candidate reference sample lines or a smaller number of candidate reference sample lines may be set than described. Additionally, the number or location of non-adjacent reference sample lines set as candidate reference sample lines is not limited to the examples described. For example, the first non-adjacent reference sample line and the third non-adjacent reference sample line may be set as candidate reference sample lines, or the second non-adjacent reference sample line and the third non-adjacent reference sample line may be set as candidate reference sample lines. 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 candidate reference sample lines.
[0154] The number or type of candidate reference sample lines can be determined based on at least one of the size, shape, location, whether to divide into sub-blocks, or intra-prediction mode of the current block.
[0155] A reference sample line of the current block may also be determined based on at least one of the location, size, shape, or predictive coding mode of a neighboring block. For example, if the current block touches the boundary of a picture, tile, slice, or coding tree unit, an adjacent reference sample line may be determined as the reference sample line of the current block.
[0156] Alternatively, if the current block is non-square, the adjacent reference sample line can be determined as the reference sample line of the current block. Alternatively, if the width and height ratio of the current block is greater than or less than a threshold value, the adjacent reference sample line can be determined as the reference sample line of the current block.
[0157] The reference sample line may include top reference samples located at the top of the current block and left reference samples located to the left of the current block. The top reference samples and left reference samples may be derived from restoration samples around the current block. The restoration samples may be in a state prior to the application of the in-loop filter.
[0158] The number of reference samples included in a reference sample line can be determined based on the distance between reference sample lines. For example, the number of reference samples included in a reference sample line at a distance of i from the current block may be greater than the number of reference samples included in a reference sample line at a distance of i-1 from the current block. Accordingly, the number of reference samples included in a non-adjacent reference sample line may be greater than the number of reference samples included in an adjacent reference sample line.
[0159] The difference between the number of reference samples included in a non-adjacent reference sample line at a distance of i from the current block and the number of reference samples included in an adjacent reference sample line can be defined as the reference sample count offset. In this case, the difference in the number of top reference samples located at the top of the current block can be defined as offsetX[i], and the difference in the number of left reference samples located to the left of the current block can be defined as offsetY[i]. offsetX and offsetY can be determined based on the distance between the current block and the non-adjacent reference sample line. For example, offsetX and offsetY can be set as integer multiples of i. For example, offsetX[i] and offset[i] can be 2i.
[0160] Alternatively, the reference sample count offset may be determined based on the width and height ratio of the current block. Equation 1 shows an example of quantifying the width and height ratio of the current block.
[0161]
[0162] It is also possible to quantify the width and height ratio of the current block in a way different from that expressed in mathematical formula 1.
[0163] The values of offsetX and offsetY can be determined based on the width and height ratio of the current block. For example, if the value of whRatio is greater than 1, the value of offsetX can be set larger than the value of offsetY. For instance, 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 larger than the value of offsetX. For instance, the value of offsetX can be set to 0 and the value of offsetY can be set to 1.
[0164] Excluding the top-left reference sample with identical x-axis and y-axis coordinates, the non-adjacent reference sample line with a distance of i from the current block may consist of (refW + offsetX[i]) top reference samples and (refH + offsetY[i]) left reference samples. Here, refW and refH represent the lengths of the adjacent reference sample line and can be set as shown in the following Equations 2 and 3, respectively.
[0165]
[0166]
[0167] In mathematical formulas 2 and 3, nTbW represents the width of the coding block or transform block where intra-prediction is performed, and nTbH represents the height of the coding block or transform block where intra-prediction is performed.
[0168] Consequently, a reference sample line with a distance of i from the current block can be composed of (refW + refH + offsetX[i] + offsetY[i] + 1) reference samples.
[0169] Depending on the intra-prediction mode of the current block, a prediction sample can be obtained by using at least one of the reference samples belonging to the reference sample line.
[0170] Next, the intra prediction mode of the current block can be determined (S802). The intra prediction mode of the current block may be determined as at least one of a non-directional intra prediction mode or a directional intra prediction mode. The non-directional intra prediction mode includes a planner and a DC, and the directional intra prediction mode includes 33 or 65 modes from the lower left diagonal direction to the upper right diagonal direction.
[0171] Figure 10 is a diagram showing intra prediction modes.
[0172] Figure 10 (a) shows 35 intra prediction modes, and Figure 10 (b) shows 67 intra prediction modes.
[0173] More or fewer intra-prediction modes may be defined than those shown in Fig. 10.
[0174] The Most Probable Mode (MPM) can be set based on the intra-probable mode of neighbor blocks adjacent to the current block. Here, neighbor blocks may include left neighbor blocks adjacent to the left of the current block and top neighbor blocks adjacent to the top of the current block. When the coordinates of the top-left sample of the current block are set to (0, 0), the left neighbor block may include samples at the positions (-1, 0), (-1, H-1), or (-1, (H-1) / 2). Here, H represents the height of the current block. The top neighbor block may include samples at the positions (0, -1), (W-1, -1), or ((W-1) / 2, -1). Here, W represents the width of the current block.
[0175] When neighbor blocks are encoded with general intra-prediction, an MPM can be derived based on the intra-prediction mode of the neighbor blocks. Specifically, the intra-prediction mode of the left neighbor block can be set to the variable candIntraPredModeA, and the intra-prediction mode of the top neighbor block can be set to the variable candIntraPredModeB.
[0176] At this time, when a neighbor block is unavailable (e.g., when a neighbor block has not yet been encoded / decoded or when the location of a neighbor block is outside the picture boundary), when a neighbor block is encoded by matrix-based intra-prediction, when a neighbor block is encoded by inter-prediction, or when a neighbor block is included in a coding tree unit different from the current block, a variable candIntraPredModeX (where X is A or B) derived based on the intra-prediction mode of the neighbor block can be set as the default mode. Here, the default mode may include at least one of a planar, DC, vertical direction mode, or horizontal direction mode.
[0177] Alternatively, if neighboring blocks are encoded with matrix-based intra-prediction, an intra-prediction mode corresponding to an index value for specifying any one of the matrices can be set to candIntraPredModeX. To this end, a lookup table representing the mapping relationship between index values for specifying matrices and intra-prediction modes may be stored in the encoder and decoder.
[0178] MPMs can be derived based on variables candIntraPredModeA and candIntraPredModeB. For example, candIntraPredModeA and candIntraPredModeB can be set as MPMs, or an intra-prediction mode similar to the larger or smaller value between candIntraPredModeA or candIntraPredModeB can be set as an MPM. Here, an intra-prediction mode similar to candIntraPredModeX (where X is A or B) may be an intra-prediction mode with an index difference of ±1 or ±2 from candIntraPredModeX.
[0179] The number of MPMs included in the MPM list can be pre-set in the encoder and decoder. For example, the number of MPMs may be 3, 4, 5, or 6. Alternatively, information indicating the number of MPMs may be signaled through a bitstream. Alternatively, the number of MPMs may be determined based on at least one of the predictive encoding mode of a neighboring block, the size, shape, or reference sample line index of the current block. For example, N MPMs may be used when an adjacent reference sample line is determined to be the reference sample line of the current block, whereas M MPMs may be used when a non-adjacent reference sample line is determined to be the reference sample line of the current block. M is a natural number smaller than N, for example, N is 6, and M may be 5, 4, or 3. Accordingly, if the index of the reference sample line of the current block is 0 and the MPM flag is true, the intra prediction mode of the current block is determined to be any one of six candidate intra prediction modes, whereas if the index of the reference sample line of the current block is greater than 0 and the MPM flag is true, the intra prediction mode of the current block can be determined to be any one of five candidate intra prediction modes.
[0180] Alternatively, a fixed number of MPM candidates (e.g., 6 or 5) may be used regardless of the index of the reference sample line of the current block.
[0181] In the embodiments described below, it is assumed that the number of MPMs is 6, and the 6 MPMs are referred to as MPM[0], MPM[1], MPM[2], MPM[3], MPM[4], and MPM[5]. An embodiment with fewer than 6 MPMs may be implemented using only some of the 6 MPMs described in the embodiments described below. Alternatively, an embodiment with more than 6 MPMs may be implemented including the 6 MPMs described in the embodiments described below.
[0182] The initial values of the MPMs can be set to candIntraPredModeA and a non-directional intra-prediction mode or a directional intra-prediction mode that is different from candIntraPredModeA. Here, the directional intra-prediction mode that can be set as an 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 values of the MPMs can be set as follows.
[0183] MPM[0] = candIntraPredModeA
[0184] MPM[1] = (candIntraPredModeA == INTRA_PLANAR) ? INTRA_DC : INTRA_PLANAR
[0185] MPM[2] = INTRA_ANGULAR50
[0186] MPM[3] = INTRA_ANGULAR18
[0187] MPM[4] = INTRA_ANGULAR2
[0188] MPM[5] = INTRA_ANGULAR34
[0189] In the example above, ((A) ? B : C) represents a function that returns the value of B if the condition disclosed in A is true, and returns the value of C if the condition disclosed in A is false.
[0190] If candIntraPredModeA and candIntraPredModeB are identical and candIntraPredModeA is a directional intra-prediction mode, MPM[0] can be set to candIntraPredModeA, and intra-prediction modes similar to candIntraPredModeA can be set as MPMs. An intra-prediction mode similar to candIntraPredModeA may be an intra-prediction mode with an index difference of ±1 or ±2 from candIntraPredModeA. Modulo operations (%) and offsets may be used to derive an intra-prediction mode similar to candIntraPredModeA. Additionally, at least one of a non-directional intra-prediction mode or an intra-prediction mode where the angle difference from candIntraPredModeA is a predefined value can be set as an MPM. Here, an intra-prediction mode whose angle difference with 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, MPMs can be derived as follows.
[0191] MPM[0] = candIntraPredModeA
[0192] MPM[1] = INTRA_PLANAR
[0193] MPM[2] = INTRA_DC
[0194] MPM[3] = 2 + ((candIntraPredModeA + 62) % 65)
[0195] MPM[4] = 2 + ((candIntraPredModeA - 1) % 65)
[0196] MPM[5] = 2 + ((candIntraPredModeA + 94) % 65)
[0197] MPM[3] corresponds to (candIntraPredModeA - 1), and MPM[4] corresponds to (candIntraPredModeA + 1). MPM[5] represents an intra-prediction mode perpendicular to candIntraPredModeA.
[0198] If candIntraPredModeA and candIntraPredModeB are different, candIntraPredModeA and candIntraPredModeB can be set to MPM[0] and MPM[1], respectively. Alternatively, by comparing candIntraPredA and candIntraPredModeB, the maximum value can be set to MPM[0] and the minimum value to MPM[1]. Conversely, it is also possible to set the minimum value to MPM[0] and the maximum value to MPM[1].
[0199] In this case, if both candIntraPredModeA and candIntraPredModeB are directional intra-prediction modes, the non-directional intra-prediction mode can be set to MPM. For example, the planner and DC can be set to MPM[2] and MPM[3], respectively.
[0200] Additionally, an intra-prediction mode similar to the larger or smaller value between candIntraPredModeA and candIntraPredModeB can be set as the MPM. An intra-prediction mode similar to candIntraPredModeX can be derived by adding or subtracting an offset from candIntraPredModeX. In this case, the maximum size of the offset can be determined based on the difference between the maximum and minimum values between candIntraPredModeA and candIntraPredModeB. For example, the offset can be a natural number such as 1 or 2.
[0201] For example, if the difference between MAX(candIntraPredModeA, candIntraPredModeB) and MIN(candIntraPredModeA, candIntraPredModeB) is not 64 or 1, MPM[4] and MPM[5] can be derived as follows.
[0202] MPM[4] = 2 + ((MAX(MPM[0], MPM[1]) + 62) % 65
[0203] MPM[5] = 2 + ((MAX(MPM[0], MPM[1]) - 1) % 65
[0204] Here, the MAX(A, B) function returns the larger value between A and B, and the MIN(A, B) function returns the smaller value between A and B. MPM[4] corresponds to (MAX(MPM[0], MPM[1]) - 1), and MPM[5] corresponds to (MAX(MPM[0], MPM[1]) + 1). On the other hand, if the difference between MAX(candIntraPredModeA, candIntraPredModeB) and MIN(candIntraPredModeA, candIntraPredModeB) is 64 or 1, MPM[4] and MPM[5] can be derived as follows.
[0205] MPM[4] = 2 + ((MAX(MPM[0], MPM[1]) + 61) % 65
[0206] MPM[5] = 2 + (MAX(MPM[0], MPM[1]) % 65
[0207] MPM[4] corresponds to (MAX(MPM[0], MPM[1]) - 2), and MPM[5] corresponds to (MAX(MPM[0], MPM[1]) + 2).
[0208] If either candIntraPredModeA or candIntraPredModeB is a directional intra-prediction mode while the other is a non-directional intra-prediction mode, at least one of the following may be set as an MPM: a non-directional intra-prediction mode that is not identical to MIN(candIntraPredModeA, candIntraPredModeB), a directional intra-prediction mode similar to MAX(candIntraPredModeA, candIntraPredModeB), or an intra-prediction mode in which the angle difference from MAX(candIntraPredModeA, candIntraPredModeB) is a predefined value. For example, MPM[2] to MPM[5] can be derived as follows.
[0209] MPM[2] = ! MIN(MPM[0], MPM[1])
[0210] MPM[3] = 2 + ((MAX(MPM[0], MPM[1]) + 62) % 65
[0211] MPM[4] = 2 + ((MAX(MPM[0], MPM[1]) - 1) % 65
[0212] MPM[5] = 2 + ((MAX(MPM[0], MPM[1]) + 94) % 65
[0213] MPM[2] represents a non-directional intra-prediction mode that is not the same as MPM[0] or MPM[1]. For example, if MIN(MPM[0], MPM[1]) is DC, MPM[2] is set as a planner, and if MIN(MPM[0], MPM[1]) is a planner, MPM[2] is set as DC. MPM[3] corresponds to ((MAX(MPM[0], MPM[1]) - 1), and MPM[4] corresponds to (MAX(MPM[0], MPM[1]) + 1). MPM[5] represents an intra-prediction mode perpendicular to (MAX(MPM[0], MPM[1]). Unlike the examples listed above, an MPM derived by adding or subtracting 2 to (MAX(MPM[0], MPM[1]) may also be added to the MPM list.
[0214] If either candIntraPredA or candIntraPredB is a non-directional intra mode and the other is a directional intra prediction mode, that is, if either candIntraPredA or PredIntraPredB is less than 2 and the other is equal to or greater than 2, the maximum value among candIntraPredA and candIntraPredB can be set as MPM. Additionally, 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 derived as follows.
[0215] MPM[0] = MAX(candIntraPredA, candIntraPredB)
[0216] MPM[1] = INTRA_PLANAR
[0217] MPM[2] = INTRA_DC
[0218] MPM[3] = 2 + ((MAX(candIntraPredA, candIntraPredB) + 62) % 65
[0219] MPM[4] = 2 + ((MAX(candIntraPredA, candIntraPredB]) - 1) % 65
[0220] MPM[5] = 2 + ((MAX(candIntraPredA, candIntraPredB) + 94) % 65
[0221] MPM[3] corresponds to ((MAX(candIntraPredA, candIntraPredB) - 1), and MPM[4] corresponds to (MAX(candIntraPredA, candIntraPredB) + 1). MPM[5] represents an intra-prediction mode perpendicular to (MAX(candIntraPredA, candIntraPredB). Unlike the examples listed above, MPMs derived by adding or subtracting 2 to (MAX(candIntraPredA, candIntraPredB) may also be added to the MPM list.
[0222] MPMs can be derived by considering the index of the reference sample line of the current block. In particular, if a non-adjacent reference sample line is determined to be the reference sample line of the current block, an undirected prediction mode such as Planner or DC may not be set as an MPM. For example, the initial values of the MPMs can be set as follows depending on whether an adjacent reference sample line is determined to be the reference sample line of the current block.
[0223] MPM[0] = (IntraLumaRefLineIdx == 0) ? candIntraPredModeA : INTRA_ANGULAR2
[0224] MPM[1] = (IntraLumaRefLineIdx == 0) ? (candIntraPredModeA : == INTRA_PLANAR ? INTRA_DC : INTRA_PLANAR) : INTRA_ANGULAR18
[0225] MPM[2] = INTRA_ANGULAR50
[0226] MPM[3] = (IntraLumaRefLineIdx == 0) ? INTRA_ANGULAR18 : INTRA_ANGULAR34
[0227] MPM[4] = (IntraLumaRefLineIdx == 0) ? INTRA_ANGULAR2 : INTRA_ANGULAR66
[0228] MPM[5] = (IntraLumaRefLineIdx == 0) ? INTRA_ANGULAR34 : INTRA_ANGULAR42
[0229] If the reference sample line of the current block is a non-adjacent reference sample line and both candIntraPredModeA and candIntraPredModeB are directional intra-prediction modes, the MPMs can be derived as follows.
[0230] MPM[0] = candIntraPredModeA
[0231] MPM[1] = candIntraPredModeB
[0232] MPM[2] = INTRA_ANGULAR2
[0233] MPM[3] = INTRA_ANGULAR18
[0234] MPM[4] = INTRA_ANGULAR50
[0235] MPM[5] = INTRA_ANGULAR34
[0236] If the reference sample line of the current block is a non-adjacent reference sample line, and either candIntraPredModeA or candIntraPredModeB is a non-directional intra-prediction mode and the other is a directional intra-prediction mode, then the MPMs can be derived as follows.
[0237] MPM[0] = MAX(candIntraPredModeA, candIntraPredModeB)
[0238] MPM[1] = INTRA_ANGULAR2
[0239] MPM[2] = INTRA_ANGULAR18
[0240] MPM[3] = INTRA_ANGULAR50
[0241] MPM[4] = INTRA_ANGULAR34
[0242] MPM[5] = INTRA_ANGULAR66
[0243] An MPM list containing multiple MPMs can be generated, and information indicating whether an MPM identical to the current block's intra prediction mode is included in the MPM list can be signaled via a bitstream. This information may be referred to as an MPM flag, which is a 1-bit flag. If the MPM flag indicates that an MPM identical to the current block is included in the MPM list, index information identifying one of the MPMs can be signaled via a bitstream. For example, index information mpm_idx specifying one of the multiple MPMs can be signaled via a bitstream. The MPM specified by the index information can be set as the current block's intra prediction mode. If the MPM flag indicates that an MPM identical to the current block is not included in the MPM list, residual mode information indicating one of the remaining intra prediction modes excluding the MPMs can be signaled via a bitstream. The remaining mode information points to the index value corresponding to the intra prediction mode of the current block when indices are reallocated to the remaining intra prediction modes excluding the MPMs. The decoder can sort the MPMs in ascending order and determine the intra prediction mode of the current block by comparing the remaining mode information with the MPMs. For example, if the remaining mode information is equal to or smaller than the MPM, the intra prediction mode of the current block can be derived by adding 1 to the remaining mode information.
[0244] When deriving the intra prediction mode of the current block, the comparison between some of the MPMs and the residual mode information may be omitted. For example, among the MPMs, those that are non-directional intra prediction modes may be excluded from the comparison. If non-directional intra prediction modes are set as MPMs, it is clear that the residual mode information refers to the directional intra prediction mode; therefore, the intra prediction mode of the current block can be derived by comparing the residual mode information with the residual MPMs excluding the non-directional intra prediction modes. Instead of excluding non-directional intra prediction modes from the comparison, the number of non-directional intra prediction modes can be added to the residual mode information, and the resulting value can be compared with the residual MPMs.
[0245] Instead of setting the default mode to MPM, information indicating whether the intra-predicted mode of the current block is the default mode can be signaled via a bitstream. This information is a 1-bit flag, and this flag may be referred to as the default mode flag. The default mode flag may be signaled only when the MPM flag indicates that the MPM identical to the current block is included in the MPM list. As described above, the default mode may include at least one of a planner, DC, vertical mode, or horizontal mode. For example, if the planner is set as the default mode, the default mode flag may indicate whether the intra-predicted mode of the current block is the planner. If the default mode flag indicates that the intra-predicted mode of the current block is not the default mode, one of the MPMs indicated by the index information may be set as the intra-predicted mode of the current block.
[0246] When the default mode flag is used, an intra prediction mode identical to the default mode may be configured not to be set as an MPM. For example, if the default mode flag indicates whether the intra prediction mode of the current block is a planner, the MPM corresponding to the planner among the six MPMs mentioned above may be replaced with another mode, or the intra prediction mode of the current block may be derived by using the five MPMs excluding the MPM corresponding to the planner.
[0247] When multiple intra prediction modes are set as default modes, index information indicating one of the default modes may be further signaled. The intra prediction mode of the current block may be set to the default mode indicated by the index information.
[0248] It is possible to configure the default mode so that it is not used when the index of the reference sample line of the current block is not zero. For example, if a non-adjacent reference sample line is determined to be the reference sample line of the current block, it is possible to configure the non-directed intra-prediction mode, such as DC mode or planner mode, not to use. Accordingly, when the index of the reference sample line is not zero, the default mode flag is not signaled, and the value of the default mode flag can be set to a predefined value (i.e., false).
[0249] When the intra prediction mode of the current block is determined, prediction samples for the current block can be obtained based on the determined intra prediction mode (S803).
[0250] When DC mode is selected, prediction samples for the current block are generated based on the average value of the reference samples. Specifically, the values of all samples within the prediction block can be generated based on the average value of the reference samples. The average value can be derived using at least one of the top reference samples located at the top of the current block and the left reference samples located to the left of the current block.
[0251] Depending on the shape of the current block, the number or range of reference samples used to derive the average value may vary. For example, if the current block is a non-square block where the width is greater than the height, the average value can be calculated using only the top reference samples. On the other hand, if the current block is a non-square block where the width is smaller than the height, the average value can be calculated using only the left reference samples. That is, if the width and height of the current block are different, the average value can be calculated using only the reference samples adjacent to 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 samples or only the left reference samples.
[0252] When 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 an upper reference sample and a lower reference sample located on the same vertical line as the prediction sample. Here, the right reference sample can be generated by copying a reference sample adjacent to the upper right corner of the current block, and the lower reference sample can be generated by copying a reference sample adjacent to the lower left corner of the current block. The horizontal prediction sample is obtained based on a weighted sum operation of the left reference sample and the right reference sample, and the vertical prediction sample can be obtained based on a weighted sum operation of the upper reference sample and the lower reference sample. At this time, the weight assigned 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 of the horizontal prediction sample and the vertical prediction sample. When a weighted sum operation is performed, the weights assigned to the horizontal and vertical prediction samples can be determined based on the positions of the prediction samples.
[0253] When a directional prediction mode is selected, a parameter representing the prediction direction (or prediction angle) of the selected directional prediction mode can be determined. Table 2 below shows the intra-direction parameter intraPredAng for each intra-prediction mode.
[0254] PredModeIntraIntraPredAng1-23232642151761379PredModeIntraIntraPredAng859210011-212-513-914-13PredModeIntraIntraPredAng15-1716- 2117-2618-3219-2620-2121-17PredModeIntraIntraPredAng22-1323-924-525-2260272285PredModeIntraIntraPredAng29930133117322133263432
[0255] Table 2 shows the intra-directional parameters for each of the intra-prediction modes with 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-directional parameters for each directional intra-prediction mode.
[0256] After arranging the top reference samples and left reference samples of the current block in a line, a predicted sample can be obtained based on the value of the intra-direction parameter. In this case, if the value of the intra-direction parameter is negative, the left reference samples and the top reference samples can be arranged in a line.
[0257] Figures 11 and 12 are diagrams showing examples of one-dimensional arrays that arrange reference samples in a row.
[0258] FIG. 11 illustrates an example of a vertical one-dimensional array in which reference samples are arranged in a vertical direction, and FIG. 12 illustrates an example of a horizontal one-dimensional array in which reference samples are arranged in a horizontal direction. The embodiments of FIG. 11 and FIG. 12 are described assuming a case where 35 intra-prediction modes are defined.
[0259] If the intra prediction mode index is any one of 11 to 18, a horizontal one-dimensional array of the top reference samples rotated counterclockwise can be applied, and if the intra prediction mode index is any one of 19 to 25, a vertical one-dimensional array of the left reference samples rotated clockwise can be applied. When arranging the reference samples in a line, the intra prediction mode angle can be considered.
[0260] Based on intra-direction parameters, reference sample determination parameters can be determined. The reference sample determination parameters may include a reference sample index for specifying a reference sample and a weight parameter for determining the weight applied to the reference sample.
[0261] The reference sample index iIdx and weight parameter ifact can be obtained through the following mathematical formulas 4 and 5, respectively.
[0262]
[0263]
[0264] P in mathematical equations 4 and 5 ang represents an intra-direction parameter. The reference sample specified by the reference sample index iIdx corresponds to an integer pel.
[0265] To derive a prediction sample, at least one reference sample can be specified. Specifically, the location of the reference sample used to derive the prediction sample can be specified by considering the gradient of the prediction mode. For example, the reference sample used to derive the prediction sample can be specified using the reference sample index iIdx.
[0266] In this case, if the slope of the intra prediction mode cannot be expressed by a single reference sample, a prediction sample can be generated by interpolating multiple reference samples. For example, if the slope of the intra prediction mode is a value between the slope between the prediction sample and the first reference sample and the slope between the prediction sample and the second reference sample, a prediction sample can be obtained by interpolating the first reference sample and the second reference sample. That is, if the angular line following the intra prediction angle does not pass through a reference sample located at an integer, a prediction sample can be obtained by interpolating reference samples located adjacent to the left, right, or up and down of the position where the angular line passes.
[0267] The following mathematical formula 6 represents an example of obtaining predicted samples based on reference samples.
[0268]
[0269] In Equation 6, P represents a predicted sample, and Ref_1D represents one of the one-dimensional arrayed reference samples. Here, the position of the reference sample can be determined by the position (x, y) of the predicted sample and the reference sample index iIdx.
[0270] If the gradient of the intra prediction mode can be expressed by a single reference sample, the weight parameter i fact is set to 0. Accordingly, Equation 6 can be simplified as shown in Equation 7 below.
[0271]
[0272] Intra prediction for the current block may also be performed based on multiple intra prediction modes. For example, an intra prediction mode may be derived for each prediction sample, and a prediction sample may be derived based on the intra prediction mode assigned to each prediction sample.
[0273] Alternatively, an intra prediction mode may be derived for each region, and intra prediction for each region may be performed based on the intra prediction mode assigned to each region. Here, the region may include at least one sample. At least one of the size or shape of the region may be adaptively determined based on at least one of the size, shape, or intra prediction mode of the current block. Alternatively, at least one of the size or shape of the region may be predefined in the encoder and decoder independently of the size or shape of the current block.
[0274] Alternatively, an intra prediction may be performed based on each of a plurality of intra predictions, and a final prediction sample may be derived based on an average operation or a weighted sum operation of a plurality of prediction samples obtained through multiple intra predictions. For example, an intra prediction may be performed based on a first intra prediction mode to obtain a first prediction sample, and an intra prediction may be performed based on a second intra prediction mode to obtain a second prediction sample. Subsequently, a final prediction sample may be obtained based on an average operation or a weighted sum operation between the first prediction sample and the second prediction sample. At this time, the weights assigned to each of the first prediction sample and the second prediction sample may be determined by considering at least one of whether the first intra prediction mode is a non-directional / directional prediction mode, whether the second intra prediction mode is a non-directional / directional prediction mode, or the intra prediction mode of a neighboring block.
[0275] 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.
[0276] Figure 13 is a diagram illustrating the angle formed by directional intra-prediction modes with a straight line parallel to the x-axis.
[0277] As shown in the example in Fig. 13, directional prediction modes may exist between the lower left diagonal and the upper right diagonal. In terms of the angle formed by the x-axis and the directional prediction modes, the directional prediction modes may exist between 45 degrees (lower left diagonal) and -135 degrees (upper right diagonal).
[0278] In the case where the current block is non-square, depending on the intra prediction mode of the current block, there may be cases where the prediction sample is derived by using a reference sample that is further from the prediction sample instead of a reference sample that is closer to the prediction sample among the reference samples located on the angular line following the intra prediction angle.
[0279] Figure 14 is a diagram showing the pattern of obtaining a prediction sample when the current block is in a non-square shape.
[0280] For example, as in the example illustrated in FIG. 14 (a), it is assumed that the current block is non-square, with the width being greater than the height, and that the intra prediction mode of the current block is a directional intra prediction mode with an angle between 0 and 45 degrees. In the above case, when deriving a prediction sample A near the right column of the current block, a case may occur in which a left reference sample L, which is far from the prediction sample, is used instead of an upper reference sample T, which is close to the prediction sample, among the reference samples located on the angular mode following the angle.
[0281] As another example, as shown in the example illustrated in FIG. 14 (b), it is assumed that the current block is non-square, with the height being greater than the width, and that the intra prediction mode of the current block is a directional intra prediction mode between -90 degrees and -135 degrees. In the above case, when deriving prediction sample A near the bottom row of the current block, a case may occur in which the top reference sample T, which is far from the prediction sample, is used instead of the left reference sample L, which is close to the prediction sample, among the reference samples located on the angular mode following the angle.
[0282] To resolve 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 in the opposite direction. Accordingly, for non-square blocks, directional prediction modes having angles larger or smaller than those shown in FIG. 10 can be used. Such a directional intra prediction mode can be defined as a wide-angle intra prediction mode. A wide-angle intra prediction mode represents a directional intra prediction mode that does not fall within the range of 45 degrees to -135 degrees.
[0283] Figure 15 is a diagram showing wide-angle intra prediction modes.
[0284] In the example illustrated in Fig. 15, intra prediction modes with indices from -1 to -14 and intra prediction modes with indices from 67 to 80 represent wide-angle intra prediction modes.
[0285] In FIG. 15, 14 wide-angle intra-prediction modes with angles greater than 45 degrees (-1 to -14) and 14 wide-angle intra-prediction modes with angles less than -135 degrees (67 to 80) are exemplified, but a greater or smaller number of wide-angle intra-prediction modes may be defined.
[0286] When the wide angle intra prediction mode is used, the length of the upper reference samples can be set to 2W+1, and the length of the left reference samples can be set to 2H+1.
[0287] By using the 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.
[0288] By adding the existing intra prediction modes and N wide-angle intra prediction modes, a total of 67 + N intra prediction modes can be used. For example, Table 3 shows the intra direction parameters of the intra prediction modes when 20 wide-angle intra prediction modes are defined.
[0289] PredModeIntra-10-9-8-7-6-5-4-3-2intraPredAngle1149379686054494539PredModeIntra-123456789intraPredAngle353229262321191715PredModeIntra101112131415161718i ntraPredAngle13119753210PredModeIntra192021222324252627intraPredAngle-1-2-3-5-7-9-11-13-15PredModeIntra282930313233343536intraPredAngle-17-19-21-23-26-29 -32-29-26PredModeIntra373839404142434445intraPredAngle-23-21-19-17-15-13-11-9-7PredModeIntra464748495051525354intraPredAngle-5-3-2-101235PredModeIntra55 5657585960616263intraPredAngle7911131517192123PredModeIntra646566676869707172intraPredAngle262932353945495460PredModeIntra73747576intraPredAngle687993114
[0290] If the current block is non-square and the intra prediction mode of the current block obtained in step S802 falls within the transformation range, the intra prediction mode of the current block can be transformed into a wide-angle intra prediction mode. The transformation range may be determined based on at least one of the size, shape, or ratio of the current block. Here, the ratio may represent the ratio between the width and height of the current block.
[0291] If the current block is non-square where the width is greater than the height, the transformation range can be set from the upper right diagonal intra prediction mode index (e.g., 66) to (index of the upper right diagonal intra prediction mode - N). Here, N can be determined based on the ratio of the current block. If the intra prediction mode of the current block falls within the transformation range, the intra prediction mode can be transformed into a wide-angle intra prediction mode. The transformation may involve subtracting a predefined value from the intra prediction mode, and the predefined value may be the total number of intra prediction modes excluding the wide-angle intra prediction modes (e.g., 67).
[0292] According to the above embodiment, the intra prediction modes between 66 and 53 can each be converted into wide-angle intra prediction modes between -1 and -14.
[0293] If the current block is non-square where the height is greater than the width, the transformation range can be set from the index of the intra prediction mode in the lower left diagonal direction (e.g., 2) to (index of the intra prediction mode in the lower left diagonal direction + M). Here, M can be determined based on the ratio of the current block. If the intra prediction mode of the current block falls within the transformation range, the intra prediction mode can be transformed into a wide-angle intra prediction mode. The transformation may involve adding a predefined value to the intra prediction mode, and the predefined value may be the total number of directional intra prediction modes excluding wide-angle intra prediction modes (e.g., 65).
[0294] According to the above embodiment, each of the intra prediction modes between 2 and 15 can be converted into wide-angle intra prediction modes between 67 and 80.
[0295] Hereinafter, intra prediction modes belonging to the transformation range will be referred to as wide-angle intra alternative prediction modes.
[0296] The transformation range can be determined based on the ratio of the current block. For example, Tables 4 and 5 show the transformation range when 35 intra prediction modes are defined and 67 intra prediction modes are defined, respectively, excluding the wide-angle intra prediction mode.
[0297] ConditionReplaced Intra Prediction ModesW / H = 2Modes 2, 3, 4W / H > 2Modes 2, 3, 4, 5, 6W / H = 1NoneH / W = 1 / 2Modes 32, 33, 34H / W < 1 / 2Modes 30, 31, 32, 33, 34
[0298] ConditionReplaced Intra Prediction ModesW / H = 2Modes 2, 3, 4, 5, 6, 7W / H > 2Modes 2, 3, 4, 5, 6, 7, 8, 9, 10, 11W / H = 1NoneH / W = 1 / 2Modes 61, 62, 63, 64, 65, 66H / W < 1 / 2Modes 57, 58, 59, 60, 61, 62, 63, 64, 65, 66
[0299] As shown in the examples in Tables 4 and 5, the number of wide-angle intra-alternative prediction modes included in the transformation range may vary depending on the ratio of the current block.
[0300] The ratio of the current block can be further subdivided to set the conversion range as shown in Table 6 below.
[0301] ConditionReplaced Intra Prediction ModesW / H = 16Modes 12, 13, 14, 15W / H = 8Modes 12, 13W / H = 4Modes 2, 3, 4, 5, 6, 7, 8, 9, 10, 11H / W = 2Modes 2, 3, 4, 5, 6, 7H / W = 1NoneW / H = 1 / 2Modes 61, 62, 63, 64, 65, 66W / H = 1 / 4Modes 57, 58, 59, 60, 61, 62, 63, 64, 65, 66W / H = 1 / 8Modes 55, 56H / W = 1 / 16Modes 53, 54, 55, 56
[0302] When a non-adjacent reference sample line is determined as the reference sample line of the current block, or when a multi-line intra-prediction coding method is used to select one of 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 falls within the conversion range, the intra-prediction mode of the current block may not be converted to a wide-angle intra-prediction mode.
[0303] Alternatively, if the intra prediction mode of the current block is determined to be a wide-angle intra prediction mode, non-adjacent reference sample lines may be set not to be available as reference sample lines of the current block, or a multi-line intra prediction coding method that selects one of multiple reference sample lines may not be used. If the multi-line intra prediction coding method is not used, an adjacent reference sample line may be determined as the reference sample line of the current block.
[0304] If the wide-angle intra prediction mode is not used, refW and refH can be set as the sum of nTbW and nTbH. Accordingly, excluding the top-left reference sample, non-adjacent reference samples at a distance i from the current block may include (nTbW + nTbH + offsetX[i]) top reference samples and (nTbW + nTbH + offsetY[i]) left reference samples. That is, non-adjacent reference samples at a distance i from the current block may include (2nTbW + 2nTbH + offsetX[i] + offsetY[i] + 1) reference samples. For example, if the value of whRatio is greater than 1, the value of offsetX can be set larger than the value of offsetY. For instance, 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 larger than the value of offsetX. For example, the value of offsetX can be set to 0 and the value of offsetY can be set to 1.
[0305] As wide-angle intra prediction modes are used in addition to existing intra prediction modes, the resources required to encode wide-angle intra prediction modes increase, which may lower coding efficiency. Accordingly, instead of encoding wide-angle intra prediction modes as they are, alternative intra prediction modes for wide-angle intra prediction modes can be encoded to improve coding efficiency.
[0306] For example, if the current block is encoded using wide-angle intra prediction mode 67, then wide-angle alternative intra prediction mode 2, which is 67, can be encoded as the intra prediction mode of the current block. Also, if the current block is encoded using wide-angle intra prediction mode -1, then wide-angle alternative intra prediction mode 66, which is -1, can be encoded as the intra prediction mode of the current block.
[0307] The decoder can decode the intra prediction mode of the current block and determine whether the decoded intra prediction mode is included in the conversion range. If the decoded intra prediction mode is a wide-angle replacement intra prediction mode, the intra prediction mode can be converted to a wide-angle intra prediction mode.
[0308] Alternatively, if the current block is encoded in wide-angle intra-prediction mode, the wide-angle intra-prediction mode may be encoded as is.
[0309] Encoding of the intra-prediction mode can be performed based on the MPM list described above. Specifically, if a neighbor block is encoded in the wide-angle intra-prediction mode, the MPM can be set based on the wide-angle alternative intra-prediction mode corresponding to the wide-angle intra-prediction mode. For example, if a neighbor block is encoded in the wide-angle intra-prediction mode, the variable candIntraPredModeX (where X is A or B) can be set to the wide-angle alternative intra-prediction mode.
[0310] Alternatively, the MPM can be set based on the wide-angle intra-pred mode of a neighboring block. For example, if a neighboring block is encoded in wide-angle intra-pred mode, the variable candIntraPredModeX can be set to wide-angle intra-pred mode.
[0311] An MPM may be derived 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 that selects one of multiple reference sample lines is applied. For example, if the reference sample line of the current block is a non-adjacent reference sample line and the intra-prediction mode of the neighboring block adjacent to the current block is a wide-angle intra-prediction mode, the default mode may be set to the MPM of the current block.
[0312] For example, if candIntraPredModeA derived based on the intra-prediction mode of the left neighbor block and candIntraPredModeB derived based on the intra-prediction mode of the top neighbor block are identical, and candIntraPredModeA is a planner or DC, MPMs can be derived as follows by considering whether the index of the reference sample line of the current block is 0.
[0313] MPM[0] = (IntraLumaRefLineIdx == 0) ? Intra_Planar : INTRA_ANGULAR 50
[0314] MPM[1] = (IntraLumaRefLineIdx == 0) ? Intra_DC : INTRA_ANGULAR 18
[0315] MPM[2] = INTRA_ANGULAR 2
[0316] That is, when the index of the reference sample line of the current block is 0, the planner mode and DC mode are set as MPMs, whereas when the index of the reference sample line of the current block is not 0, the vertical intra prediction mode (INTRA_ANGULAR 50) and the horizontal intra prediction mode (INTRA_ANGULAR 18) can be set as MPMs.
[0317] If the index of the reference sample line of the current block is not 0, and candIntraPredModeA and candIntraPredModeB are identical but candIntraPredModeA is a wide-angle intra-prediction mode, then MPMs can be derived as follows.
[0318] MPM[0] = INTRA_ANGULAR2
[0319] MPM[1] = INTRA_ANGULAR18
[0320] MPM[2] = INTRA_ANGULAR50
[0321] Alternatively, MPMs can be derived as follows.
[0322] MPM[0] = INTRA_ANGULAR50
[0323] MPM[1] = INTRA_ANGULAR18
[0324] MPM[2] = INTRA_ANGULAR2
[0325] That is, if the reference sample line index of the current block is not 0, the wide angle intra prediction mode may not be set to MPM.
[0326] If candIntraPredModeA and candIntraPredModeB are identical and candIntraPredModeA is a directional intra-prediction mode, MPMs can be derived as follows.
[0327] MPM[0] = candIntraPredModeA
[0328] MPM[1] = 2 + ((candIntraPredModeA + 61) % 64)
[0329] MPM[2] = 2 + ((candIntraPredModeA - 1) % 64)
[0330] If the index of the reference sample line of the current block is 0 and candIntraPredModeA and candIntraPredModeB are different, MPM[0] and MPM[1] can be set to candIntraPredModeA and candIntraPredModeB, respectively. MPM[2] can be set to a planar, DC, or vertical mode that is not the same as MPM[0] and MPM[1].
[0331] If the index of the reference sample line of the current block is not 0, and either candIntraPredModeA or candIntraPredModeB is a planner and the other is a DC, then the MPMs can be derived as follows.
[0332] MPM[0] = INTRA_ANGULAR2
[0333] MPM[1] = INTRA_ANGULAR18
[0334] MPM[2] = INTRA_ANGULAR50
[0335] If the index of the reference sample line of the current block is not 0 and both candIntraPredModeA and candIntraPredModeB are wide-angle intra-prediction modes, the MPMs can be derived as follows.
[0336] MPM[0] = INTRA_ANGULAR2
[0337] MPM[1] = INTRA_ANGULAR18
[0338] MPM[2] = INTRA_ANGULAR50
[0339] If the index of the reference sample line of the current block is not 0 and either candIntraPredModeA or candIntraPredModeB is a wide-angle intra-prediction mode, the non-wide-angle intra-prediction mode among candIntraPredModeA and candIntraPredModeB can be set as MPM[0], and intra-prediction modes similar to MPM[0] can be set as MPM[1] and MPM[2]. For example, if candIntraPredModeA is a non-wide-angle intra-prediction mode and candIntraPredModeB is a wide-angle intra-prediction mode, the MPMs can be generated as follows.
[0340] MPM[0] = candIntraPredModeA
[0341] MPM[1] = 2 + ((candIntraPredModeA + 61) % 64)
[0342] MPM[2] = 2 + ((candIntraPredModeA - 1) % 64)
[0343] On the other hand, if candIntraPredModeA is a wide-angle intra-prediction mode and candIntraPredModeB is a non-wide-angle intra-prediction mode, the MPMs can be derived as follows.
[0344] MPM[0] = candIntraPredModeB
[0345] MPM[1] = 2 + ((candIntraPredModeB + 61) % 64)
[0346] MPM[2] = 2 + ((candIntraPredModeB - 1) % 64)
[0347] If the index of the reference sample line of the current block is not 0, and either candIntraPredModeA or candIntraPredModeB is a planner or DC and the other is a non-wide-angle intra-prediction mode, the non-wide-angle intra-prediction mode among candIntraPredModeA and candIntraPredModeB can be set as MPM[0], and intra-prediction modes similar to MPM[0] can be set as MPM[1] and MPM[2]. For example, if candIntraPredModeA is a non-wide-angle intra-prediction mode and candIntraPredModeB is a planner or DC, the MPMs can be derived as follows.
[0348] MPM[0] = candIntraPredModeA
[0349] MPM[1] = 2 + ((candIntraPredModeA + 61) % 64)
[0350] MPM[2] = 2 + ((candIntraPredModeA - 1) % 64)
[0351] On the other hand, if candIntraPredModeA is a planar or DC and candIntraPredModeB is a non-wide angle intra-prediction mode, the MPMs can be derived as follows.
[0352] MPM[0] = candIntraPredModeB
[0353] MPM[1] = 2 + ((candIntraPredModeB + 61) % 64)
[0354] MPM[2] = 2 + ((candIntraPredModeB - 1) % 64)
[0355] If the index of the reference sample line of the current block is not 0 and both candIntraPredModeA and candIntraPredModeB are non-wide angle intra-pred mode, candIntraPredModeA and candIntraPredModeB can be set as MPM[0] and MPM[1], respectively. Any one of the vertical direction intra-pred mode (INTRA_ANGULAR50), horizontal direction intra-pred mode (INTRA_ANGULAR18), or left-bottom diagonal direction intra-pred mode (INTRA_ANGULAR2) that does not overlap with MPM[0] and MPM[1] can be set as MPM[2].
[0356] A coding block or a transformation block can be divided into multiple sub-blocks (or sub-partitions). When a coding block or a transformation block is divided into multiple sub-blocks, prediction, transformation, and quantization can be performed for each sub-block. Dividing a coding block or a transformation block into multiple sub-blocks can be defined as a sub-partition intra-coding method.
[0357] Information indicating whether a subpartition intra-coding method is applied may be signaled through a bitstream. The information may be a 1-bit flag. For example, a syntax element 'intra_subpartitions_mode_flag' indicating whether a coding block or a translation block is divided into multiple sub-blocks may be signaled through a bitstream.
[0358] Alternatively, whether a sub-partition intra-coding method is applied can be determined based on at least one of the size, shape, or intra-prediction mode of a coding block or a transformation block. For example, if the intra-prediction mode of a coding block is a non-directional intra-prediction mode (e.g., planar 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 a coding block is smaller than a threshold value, the sub-partition intra-coding method may be configured not to be used.
[0359] Alternatively, when performing intra prediction for a sub-block based on the intra prediction mode of a coding block, the application of the sub-partition intra-coding method can be determined based on whether a reconstructed sample included in an adjacent sub-block must be used as a reference sample during the intra prediction of the sub-block. For example, if the intra prediction mode of a coding block is a diagonal intra prediction mode or a wide-angle intra prediction mode, and when performing intra prediction for a sub-block based on the intra prediction mode, an adjacent sub-block cannot be utilized as a reference sample, the sub-partition intra-coding method may be configured not to be used.
[0360] Alternatively, if the height and width ratio of a coding block is greater than or less than a threshold value, the sub-partition intra-coding method may be configured not to be used. Alternatively, if at least one of the height or width of a coding block is less than or equal to a threshold value, the sub-partition intra-coding method may not be used. For example, if both the height and width of a coding block are less than or equal to a threshold value, the sub-partition intra-coding method may not be used. The threshold value may have a value predefined in the encoder and decoder. Alternatively, information for determining the threshold value may be signaled via a bitstream.
[0361] Alternatively, based on at least one of the size, shape, or intra prediction mode of a coding block or a transformation block, the signaling of a flag indicating whether the subpartition intra coding method is applied can be determined. For example, a flag indicating whether the subpartition intra coding method is applied may be encoded and signaled only when both the height and width of the coding block are below a threshold value and / or the size of the coding block is above a threshold value. If the flag indicating whether the subpartition intra coding method is applied is not encoded, the subpartition intra coding method may not be applied.
[0362] When a sub-partition intra-coding method is applied, the partitioning form of a coding block or a transformation block can be determined. Here, the partitioning form indicates the direction of partitioning of the coding block or the transformation block. For example, vertical partitioning means partitioning the coding block or the transformation block using at least one vertical line, and horizontal partitioning may mean partitioning the coding block or the transformation block using at least one horizontal line.
[0363] Figure 16 is a diagram showing an example of vertical partitioning and horizontal partitioning.
[0364] Figure 16 (a) shows an example where a coding block is divided into two sub-blocks, and Figure 16 (b) shows an example where a coding block is divided into four sub-blocks.
[0365] Information for determining the partitioning form of a coding block or a transformation block may be signaled via a bitstream. For example, information indicating whether vertical partitioning or horizontal partitioning is applied to the coding block or the transformation block may be signaled. The information may be a 1-bit flag intra_subpart_type_flag. A value of 1 for the flag indicates that the coding block or the transformation block is partitioned horizontally, and a value of 0 for the flag indicates that the coding block or the transformation block is partitioned vertically.
[0366] Alternatively, the partitioning form of a coding block or a transformation block can be determined based on the size, shape, or intra-prediction mode of the coding block or transformation block. For example, the partitioning form of a coding block can be determined based on the width-to-height ratio of the coding block. For instance, if the value of whRatio, which represents the height-to-width ratio of the coding block, is greater than or equal to a first threshold value, vertical partitioning can be applied to the coding block. Otherwise, horizontal partitioning can be applied to the coding block.
[0367] Figure 17 is a diagram showing an example of determining the division shape of a coding block.
[0368] For convenience of explanation, the first threshold value is assumed to be 2. In the example illustrated in FIG. 17 (a), the whRatio of the coding block is 1, which is smaller than the first threshold value. Accordingly, the encoding of information indicating the partitioning shape of the coding block can be omitted, and horizontal partitioning can be applied to the coding block.
[0369] In the example illustrated in FIG. 17 (b), the whRatio of the coding block is 2, which is equal to the first threshold value. Accordingly, the encoding of information indicating the partitioning shape of the coding block can be omitted, and vertical partitioning can be applied to the coding block.
[0370] The partitioning shape of a coding block may also be determined by using a second threshold value that has a sign opposite to that of a first threshold value. For example, if the value of whRatio is less than or equal to the second threshold value, horizontal partitioning may be applied to the coding block, and if not, vertical partitioning may be applied to the coding block. The absolute values of the first threshold value and the second threshold value may be the same, and their signs may be different. For 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.
[0371] Figure 18 is a diagram showing an example of determining the division shape of a coding block.
[0372] For convenience of explanation, the second threshold value is assumed to be -2. In the example illustrated in FIG. 18 (a), the whRatio of the coding block is -1, which is greater than the second threshold value. Accordingly, the encoding of information indicating the partitioning shape of the coding block can be omitted, and vertical partitioning can be applied to the coding block.
[0373] In the example illustrated in FIG. 18 (b), the whRatio of the coding block is -2, which is equal to the second threshold value. Accordingly, the encoding of information indicating the partitioning shape of the coding block can be omitted, and horizontal partitioning can be applied to the coding block.
[0374] Alternatively, the partitioning form of the coding block may be determined based on a first threshold value and a second threshold value. For example, if the value of whRatio is greater than or equal to the first threshold value, horizontal partitioning may be applied to the coding block, and if the value of whRatio is less than or equal to the second threshold value, vertical partitioning may be applied to the coding block. If the value of whRatio exists between the first threshold value and the second threshold value, information may be parsed from the bitstream to determine the partitioning form of the current block.
[0375] The first threshold and the second threshold may be predefined in the encoder and decoder. Alternatively, the first threshold and the second threshold may be defined per sequence, picture, or slice.
[0376] Alternatively, the partitioning form can be determined based on the size of the coding block or the conversion block. For example, if the size of the coding block is Nxn, vertical partitioning can be applied, and if the size of the coding block is nxN, horizontal partitioning can be applied. Here, n can be a natural number smaller than N. N and / or n can be values predefined in the encoder and decoder. Alternatively, information for determining N and / or n can be signaled through a bitstream. For example, N can be 32, 64, 128, or 256, etc. Accordingly, if the size of the coding block is 128xn (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 nx128, horizontal partitioning can be applied.
[0377] Alternatively, the partitioning form of a coding block or a transformation block can be determined based on the intra-prediction mode of the coding block or the transformation block. For example, if the intra-prediction mode of the coding block is in a horizontal direction or a direction similar to the horizontal direction, vertical partitioning can be applied to the coding block. Here, the intra-prediction mode in a direction similar to the horizontal direction represents an intra-prediction mode (e.g., INTRA_ANGULAR18 ± N) in which the index difference value with the intra-prediction mode in the horizontal direction (e.g., INTRA_ANGULAR18 shown in Fig. 10 (b)) is less than or equal to a threshold value. On the other hand, if the intra-prediction mode of the coding block is in a vertical direction or a direction similar to the vertical direction, horizontal partitioning can be applied to the coding block. Here, an intra-prediction mode in a direction similar to the vertical direction represents an intra-prediction mode (e.g., INTRA_ANGULAR50 ± N) in which the index difference value with respect to the intra-prediction mode in the vertical direction (e.g., INTRA_ANGULAR50 shown in Fig. 10 (b)) is less than or equal to a threshold value. Here, the threshold value N may be a value predefined in the encoder and decoder. Alternatively, information for determining the threshold value N may be signaled at the sequence, picture, or slice level.
[0378] FIG. 19 is a diagram showing an example in which the segmentation form of a coding block is determined based on the intra-prediction mode of the coding block.
[0379] As shown in the example illustrated in Fig. 19 (a), if the intra-prediction mode of the coding block is a direction similar to the vertical direction, horizontal partitioning can be applied to the coding block.
[0380] On the other hand, as in the example shown in Fig. 19 (b), if the intra-prediction mode of the coding block is a direction similar to the horizontal direction, vertical partitioning can be applied to the coding block.
[0381] Contrary to the illustrated example, horizontal partitioning may be applied when the intra-prediction mode of a coding block is in a horizontal direction or a direction similar to a horizontal direction, and vertical partitioning may be applied when the intra-prediction mode of a coding block is in a vertical direction or a direction similar to a vertical direction.
[0382] When applying vertical partitioning or horizontal partitioning, the partitioning form of the coding block or transformation block can be determined based on whether at least one of the width or height of the sub-block created by partitioning the coding block or transformation block is smaller than a threshold value. Here, the threshold value may be an integer such as 2, 4, or 8.
[0383] Figure 20 is a diagram illustrating the division of a coding block.
[0384] When horizontal partitioning is applied to a 4x8 coding block shown in FIG. 20 (a), the coding block is divided into 2x8 sub-blocks. In this case, since the width of the sub-blocks is smaller than the threshold value, horizontal partitioning may not be available for the coding block. On the other hand, when vertical partitioning is applied to a 4x8 coding block, the coding block is divided into 4x4 sub-blocks. Since both the width and height of the sub-blocks are greater than or equal to the threshold value, vertical partitioning may be available for the coding block. Since only vertical partitioning is available for the coding block, the encoding of information indicating the partitioning form for the coding block can be omitted, and vertical partitioning can be applied to the coding block.
[0385] When vertical partitioning is applied to an 8x4 coding block shown in FIG. 20(b), the coding block is divided into 8x2 sub-blocks. In this case, since the height of the sub-blocks is smaller than the threshold value, vertical partitioning may not be available for the coding block. On the other hand, when horizontal partitioning is applied to an 8x4 coding block, the coding block is divided into 4x4 sub-blocks. Since both the width and height of the sub-blocks are greater than or equal to the threshold value, horizontal partitioning may be available for the coding block. Since only horizontal partitioning is available for the coding block, the encoding of information indicating the partitioning form for the coding block can be omitted, and vertical partitioning can be applied to the coding block.
[0386] When both vertical partitioning and horizontal partitioning are available, the partitioning form of the coding block can be determined by parsing information indicating the partitioning form of the coding block.
[0387] The number of sub-blocks may be determined based on at least one of the size or shape of the coding block or the transformation block. For example, if either the width or the height of the coding block is 8 and the other is 4, the coding block may be divided into 2 sub-blocks. On the other hand, if both the width and the height of the coding block are 8 or greater, or if either the width or the height of the coding block is greater than 8, the coding block may be divided into 4 sub-blocks. In summary, if the coding block is 4x4 in size, the coding block may not be divided into sub-blocks. If the coding block is 4x8 or 8x4 in size, the coding block may be divided into 2 sub-blocks. In other cases, the coding block may be divided into 4 sub-blocks.
[0388] Alternatively, information indicating the size, shape, or number of sub-blocks may be signaled via a bitstream. The size or shape of the sub-blocks may be determined by the information indicating the number of sub-blocks. Alternatively, the number of sub-blocks may be determined by the information indicating the size or shape of the sub-blocks.
[0389] When a sub-partition intra-coding method is applied, sub-blocks generated by partitioning a coding block or a transformation block may use the same intra-prediction mode. For example, MPMs for a coding block can be derived based on the intra-prediction modes of neighboring blocks adjacent to the coding block, and the intra-prediction mode for the coding block can be determined based on the derived MPMs. Once the intra-prediction mode of the coding block is determined, each sub-block can perform intra-prediction using the determined intra-prediction mode.
[0390] When the subpartition intra-coding method is applied, any one of the MPMs can be determined as the intra-prediction mode of the coding block. That is, when the subpartition intra-coding method is applied, the MPM flag can be considered true even if it is not signaled.
[0391] Alternatively, when a sub-partition intra-coding method is applied, any one of the previously defined candidate intra-prediction modes may be determined as the intra-prediction mode of the coding block. For example, any one of a horizontal intra-prediction mode, a vertical intra-prediction mode, a diagonal intra-prediction mode (e.g., at least one of a top-left intra-prediction mode, a top-right intra-prediction mode, or a bottom-left intra-prediction mode), or a non-directional intra-prediction mode (e.g., at least one of a planer or a DC) may be determined as the intra-prediction mode of the coding block. Index information specifying any one of the previously defined candidate intra-prediction modes may be signaled through a bitstream.
[0392] According to one embodiment of the present invention, at least one intra prediction mode among the sub-blocks may be set differently from other sub-blocks. For example, the intra prediction mode of the Nth sub-block may be derived by adding or subtracting an offset from the intra prediction mode of the N-1th sub-block. The offset may be predefined in the encoder and decoder. Alternatively, the offset may be derived based on at least one of the size, shape, and intra prediction mode of the coding block, the size and shape of the sub-block, the number of sub-blocks, or the division direction of the coding block. Alternatively, information for deriving the offset may be signaled through a bitstream.
[0393] 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 set to be 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 a directional mode, the intra prediction mode derived by adding or subtracting an offset from the intra prediction mode of the N-1th sub-block can be set to be the same as the intra prediction mode of the Nth sub-block.
[0394] Alternatively, a directional intra prediction mode may be applied to some of the multiple sub-blocks, and a non-directional intra prediction mode may be applied to the remainder. The sub-blocks to which the non-directional intra prediction mode is applied may be determined by considering at least one of the size, shape, location, or number of sub-blocks. Alternatively, a non-directional intra prediction mode may be applied to another sub-block only if the directional intra prediction mode applied to any one of the multiple sub-blocks is a predefined value.
[0395] Alternatively, an intra-prediction mode for each sub-block can be derived from the MPMs. To this end, index information specifying one of the MPMs for each sub-block can be signaled.
[0396] Alternatively, the intra prediction mode of each sub-block can be derived from predefined candidate intra prediction modes. To this end, index information specifying any one of the predefined candidate intra prediction modes for each sub-block can be signaled.
[0397] Alternatively, information indicating whether the intra prediction modes of the sub-blocks are set identically can be signaled via a bitstream.
[0398] The quantization parameters of the sub-blocks can be determined individually. Accordingly, the values of the quantization parameters of each sub-block can be set differently. To determine the quantization parameters of each sub-block, information representing the difference value with respect to the quantization parameter of the previous sub-block can be encoded. For example, for the Nth sub-block, the difference value between the quantization parameter of the Nth sub-block and the quantization parameter of the N-1th sub-block can be encoded.
[0399] Intra prediction of a sub-block can be performed using reference samples. In this case, the reference samples may be derived from the reconstructed samples of neighboring blocks adjacent to the sub-block. If the neighboring block adjacent to the sub-block is another sub-block included in the same coding block as the sub-block, the reference samples of the sub-block can be derived based on the reconstructed samples of the other sub-block. For example, if the first sub-block is located to the left or above the second sub-block, the reference samples of the second sub-block can be derived from the reconstructed samples of the first sub-block. To this end, parallel intra prediction may not be applied between sub-blocks. That is, encoding / decoding may proceed sequentially for the sub-blocks included in the coding block. Accordingly, intra prediction for the second sub-block can be performed after the encoding / decoding of the first sub-block is completed.
[0400] When a sub-partition intra-coding method is applied, the multi-line intra-predictive coding method, which selects one of multiple reference sample line candidates, can be configured not to be used. When the multi-line intra-predictive coding method is not used, an adjacent reference sample line adjacent to each sub-block can be determined as the reference sample line of each sub-block.
[0401] Alternatively, even when a sub-partition intra-coding method is applied, a multi-line intra-predictive coding method may be used. To this end, index information for specifying a reference sample line may be signaled for each sub-block. Alternatively, index information for specifying a reference sample line may be signaled for only one of the multiple sub-blocks, and the index information may be applied as is to the remaining sub-blocks. Alternatively, index information for specifying a reference sample line may be signaled for a coding block, and multiple sub-blocks included in the coding block may be configured to share the index information.
[0402] Alternatively, it may be configured so that only sub-blocks having a predefined location or a predefined partition index among the sub-blocks utilize the multi-line intra-prediction coding method. For example, among a plurality of sub-blocks, index information specifying one of the reference sample line candidates may be signaled only for the sub-block with a partition index of 0 or the sub-block adjacent to the top or left boundary of the coding block. The multi-line intra-prediction coding method may not be applied to the remaining sub-blocks. Accordingly, the remaining sub-blocks may perform intra-prediction using adjacent reference sample lines.
[0403] The prediction coding mode can be set differently for each sub-block. For example, intra-frame prediction can be applied to some sub-blocks, while cross-frame prediction, current picture reference, or composite prediction can be applied to other sub-blocks.
[0404] Figure 21 is a diagram showing an example where the prediction encoding mode is set differently for each sub-block.
[0405] Intra-prediction mode can be set differently for each sub-block, or prediction encoding mode can be set differently. For example, in the example illustrated in FIG. 21, intra-frame prediction is applied to sub-block 0 and sub-block 1, and current picture reference is applied to sub-block 1 and sub-block 2.
[0406] When a current picture reference is used, a predicted block of a sub-block can be derived from an already decoded region of the current picture or slice (or tile group). When a current picture reference is applied, a motion vector can be derived to specify the predicted block of a sub-block. The motion vector under the current picture reference may also be referred to as a 'block vector'.
[0407] Motion vectors can be derived based on the motion vectors of neighboring blocks adjacent to a coding block or sub-block. Alternatively, information for determining motion vectors may be signaled via a bitstream.
[0408] In this case, the maximum value of the motion vector of the sub-block can be determined according to the size of the sub-block or the coding block or transformation block to which the sub-block belongs. For example, the motion vector of the sub-block can be set so as not to extend beyond the boundary of the coding block or transformation block to which the sub-block belongs. That is, the prediction block of the sub-block can be derived from an area encoded / decoded prior to the sub-block within the coding block to which the sub-block belongs.
[0409] Instead of a motion vector, signaling can be performed by encoding index information representing any one of the previously decoded sub-blocks within the coding block. The prediction block of the sub-block can be determined by the previously decoded sub-block specified by the index information.
[0410] As another example, the motion vector of a sub-block may be allowed to extend beyond the boundaries of the coding block or transformation block to which the sub-block belongs.
[0411] When a prediction block is generated as a result of performing intra-prediction, the prediction samples can be updated based on the position of each prediction sample included in the prediction block. This update method can be referred to as a sample position-based intra-weighted prediction method (or Position Dependent Prediction Combination, PDPC).
[0412] Whether to use PDPC may be determined by considering the size, shape, intra prediction mode, reference sample line of the current block, size of the current block, or color component. For example, PDPC may be used if the intra prediction mode of the current block is at least one of planar, DC, vertical direction, horizontal direction, a mode with an index value smaller than the vertical direction, or a mode with an index value larger than the horizontal direction. Alternatively, PDPC may be used only if at least one of the width or height of the current block is greater than 4. Alternatively, PDPC may be used only if the index of the reference picture line of the current block is 0. Alternatively, PDPC may be used only if the index of the reference picture line of the current block is greater than or equal to a predefined value. Alternatively, PDPC may be used only for the luminance component. Alternatively, the use of PDPC may be determined based on whether two or more of the conditions listed above are satisfied.
[0413] Alternatively, the use of PDPC may be determined based on whether a sub-partition intra-coding method is utilized. For example, if a sub-partition intra-coding method is applied to a coding block or a transformation block, PDPC may be configured not to be used. Alternatively, if a sub-partition intra-coding method is applied to a coding block or a transformation block, PDPC may be applied to at least one of multiple 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, location, intra-prediction mode, or reference sample line index of the coding block or sub-block. For example, PDPC may be applied to a sub-block adjacent to the top and / or left boundary of the coding block, or to a sub-block adjacent to the bottom and / or right boundary of the coding block. Alternatively, based on the size or shape of the sub-block, PDPC may be applied to all sub-blocks included in the coding block, or configured not to apply PDPC to all sub-blocks included in the coding block. As another example, PDPC may be applied to all sub-blocks within the coding block.
[0414] Alternatively, PDPC may be applied to each sub-block depending on whether at least one of the size, shape, intra-prediction mode, or reference picture index of the sub-blocks created by splitting a coding block or a transformation block satisfies a pre-set condition. For example, if at least one of the width or height of a sub-block is greater than 4, PDPC may be applied to the sub-block.
[0415] As another example, information indicating whether PDPC is applied can be signaled via a bitstream.
[0416] Alternatively, the area to which PDPC is applied can be determined based on at least one of the current block's size, shape, intra prediction mode, or the location of the prediction sample. For example, if the current block's intra prediction mode has an index greater than the vertical direction, prediction samples in which at least one of the x-axis coordinate or y-axis coordinate is greater than the threshold value are not corrected, and correction may be performed only on prediction samples in which the x-axis coordinate or y-axis coordinate is less than or equal to the threshold value. Alternatively, if the current block's intra prediction mode has an index smaller than the horizontal direction, prediction samples in which at least one of the x-axis coordinate or y-axis coordinate is greater than the threshold value are not corrected, and correction may be performed only on prediction samples in which the x-axis coordinate or y-axis coordinate is less than or equal to the threshold value. In this case, the threshold value may be determined based on at least one of the current block's size, shape, or intra prediction mode.
[0417] 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 location of the obtained prediction sample. For convenience of explanation, in the embodiments described below, the reference sample used to correct the prediction sample will be referred to as the PDPC reference sample. Additionally, the prediction sample obtained through intra-prediction will be referred to as the first prediction sample, and the prediction sample obtained by correcting the first prediction sample will be referred to as the second prediction sample.
[0418] Figure 22 is a diagram showing the application aspect of PDPC.
[0419] A first prediction sample can be corrected using at least one PDPC reference sample. The PDPC reference sample may include at least one of a reference sample adjacent to a corner at the top left of the current block, a top reference sample located at the top of the current block, or a left reference sample located at the left of the current block.
[0420] At least one of the reference samples belonging to the reference sample line of the current block can be set as a 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 of index 0 can be set as a PDPC reference sample. For example, even if the first prediction sample is obtained using a reference sample included in the reference sample line of index 1 or index 2, the second prediction sample can be obtained using a reference sample included in the reference sample line of index 0.
[0421] The number or location of PDPC reference samples used to correct the first prediction sample can be determined by considering 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 location of the first prediction sample.
[0422] For example, if the intra prediction mode of the current block is planar or DC mode, a second prediction sample can be obtained using an upper reference sample and a left reference sample. In this case, the upper reference sample may be a reference sample perpendicular to the first prediction sample (e.g., a reference sample with the same x-coordinate), and the left reference sample may be a reference sample horizontal to the first prediction sample (e.g., a reference sample with the same y-coordinate).
[0423] If the intra prediction mode of the current block is a horizontal intra prediction mode, a second prediction sample can be obtained using an upper reference sample. In this case, the upper reference sample may be a reference sample perpendicular to the first prediction sample.
[0424] If the intra prediction mode of the current block is a vertical intra prediction mode, a second prediction sample can be obtained using a left reference sample. In this case, the left reference sample may be a reference sample horizontal to the first prediction sample.
[0425] If the intra prediction mode of the current block is a bottom-left diagonal or top-right diagonal intra prediction mode, a second prediction sample can be obtained based on a top-left reference sample, a top reference sample, and a 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 at position (-1, -1)). The top reference sample may be a reference sample located in the top-right diagonal direction of the first prediction sample, and the left reference sample may be a reference sample located in the bottom-left diagonal direction of the first prediction sample.
[0426] In summary, when the position of the first predicted sample is (x, y), R(-1, -1) is set as the top-left reference sample, and R(x+y+1, -1) or R(x, -1) can be set as the top reference sample. Additionally, R(-1, x+y+1) or R(-1, y) can be set as the left reference sample.
[0427] As another example, the location of the left reference sample or the top reference sample can be determined by considering at least one of the current block shape or whether a wide angle intra mode is applied.
[0428] Specifically, if the intra prediction mode of the current block is a wide-angle intra prediction mode, a reference sample located diagonally opposite to the first prediction sample and offset from the reference sample can be set as a 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) can be set as PDPC reference samples.
[0429] At this time, the offset k can be determined based on the wide-angle intra prediction mode. Equations 8 and 9 represent examples of deriving the offset based on the wide-angle intra prediction mode.
[0430]
[0431]
[0432] The second prediction sample can be determined based on a weighted sum operation between the first prediction sample and the PDPC reference samples. For example, the second prediction sample can be obtained based on the following mathematical formula 10.
[0433]
[0434] In the above mathematical formula 10, R L represents the left reference sample, and R T represents the top reference sample, and R TL represents the top-left reference sample. pred(x,y) represents the predicted sample at position (x,y). wL represents the weight assigned to the left reference sample, wT represents the weight assigned to the top reference sample, and wTL represents the weight assigned to the top-left reference sample. The weight assigned to the first predicted sample can be derived by subtracting the weights assigned to the reference samples from the maximum value. For convenience of explanation, the weight assigned to the PDPC reference sample will be referred to as the PDPC weight.
[0435] The weight assigned to each reference sample can be determined based on at least one of the intra-prediction mode of the current block or the position of the first prediction sample.
[0436] For example, at least one of wL, wT, or wTL may be in a proportional or inversely proportional relationship with at least one of the x-axis coordinate value or y-axis coordinate value of the prediction sample. Alternatively, at least one of wL, wT, or wTL may be in a proportional or inversely proportional relationship with at least one of the width or height of the current block.
[0437] If the intra prediction mode of the current block is DC, the PDPC weights can be determined as shown in the following mathematical formula 11.
[0438]
[0439] In the above mathematical formula 11, x and y represent the positions of the first predicted sample.
[0440] In the above mathematical formula 11, the variable shift used for the bit shift operation can be derived based on the width or height of the current block. For example, the variable shift can be derived based on the following mathematical formula 12 or mathematical formula 13.
[0441]
[0442]
[0443] Alternatively, a variable shift can be derived by considering the intra-direction parameters of the current block.
[0444] The number or type of parameters used to induce a variable shift may be determined differently depending on the intra-prediction mode of the current block. For example, if the intra-prediction mode of the current block is planar, DC, vertical, or horizontal, a variable shift can be induced using the width and height of the current block, as shown in the example 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 that of the vertical intra-prediction mode, a variable shift can be induced using the height of the current block and the intra-direction parameter. If the intra-prediction mode of the current block is an intra-prediction mode with an index smaller than that of the horizontal intra-prediction mode, a variable shift can be induced using the width of the current block and the intra-direction parameter.
[0445] 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 derived based on the following mathematical equation 14.
[0446]
[0447] If the intra prediction mode of the current block is a horizontal intra prediction mode, wT can be set to 0 and wTL and wL can be set to the same value. On the other hand, if the intra prediction mode of the current block is a vertical intra prediction mode, wL can be set to 0 and wTL and wT can be set to the same value.
[0448] If the intra prediction mode of the current block is an intra prediction mode facing the upper right direction with an index value greater than that of the vertical intra prediction mode, PDPC weights can be derived as shown in the following mathematical formula 15.
[0449]
[0450] On the other hand, if the intra prediction mode of the current block is an intra prediction mode facing the bottom-left direction with an index value smaller than the horizontal intra prediction mode, PDPC weights can be derived as shown in the following mathematical formula 16.
[0451]
[0452] As in the above-described embodiment, PDPC weights can be determined based on the positions x and y of the predicted samples.
[0453] As another example, the weights assigned to each PDPC reference sample can be determined on a sub-block basis. Predicted samples included in a sub-block can share the same PDPC weights.
[0454] The size of the sub-block, which is the basic unit for determining weights, may be predefined in the encoder and decoder. For example, weights can be determined for each of the 2x2 or 4x4 size sub-blocks.
[0455] Alternatively, the size, shape, or number of sub-blocks can be determined based on the size or shape of the current block. For example, a coding block can be divided into 4 sub-blocks regardless of the size of the coding block. Alternatively, depending on the size of the coding block, the coding block can be divided into 4 or 16 sub-blocks.
[0456] Alternatively, the size, shape, or number of sub-blocks may be determined based on the intra-prediction mode of the current block. For example, if the intra-prediction mode of the current block is horizontal, N columns (or N rows) may be set as one sub-block, whereas if the intra-prediction mode of the current block is vertical, N rows (or N columns) may be set as one sub-block.
[0457] Equations 17 through 19 represent examples of determining PDPC weights for sub-blocks of size 2x2. Equation 17 illustrates the case where the intra-prediction mode of the current block is DC mode.
[0458]
[0459] In the above mathematical formula 17, K can be determined based on the size of the sub-block.
[0460] Mathematical formula 18 illustrates the case where the intra prediction mode of the current block is an intra prediction mode facing the upper right direction, which has an index value greater than that of the vertical intra prediction mode.
[0461]
[0462] Mathematical formula 19 illustrates the case where the intra prediction mode of the current block is an intra prediction mode facing the bottom-left direction, having an index value smaller than the horizontal intra prediction mode.
[0463]
[0464] In the above mathematical formulas 17 to 19, x and y represent the positions of reference samples within the sub-block. The reference sample may be any one of a sample located at the top left of the sub-block, a sample located at the center of the sub-block, or a sample located at the bottom right of the sub-block.
[0465] Equations 20 to 22 represent examples of determining PDPC weights for a 4x4 sub-block. Equation 20 illustrates the case where the intra-prediction mode of the current block is DC mode.
[0466]
[0467] Mathematical formula 21 illustrates the case where the intra prediction mode of the current block is an intra prediction mode facing the upper right direction, which has an index value greater than that of the vertical intra prediction mode.
[0468]
[0469] Mathematical formula 22 illustrates the case where the intra prediction mode of the current block is an intra prediction mode facing the bottom-left direction, having an index value smaller than the horizontal intra prediction mode.
[0470]
[0471] In the embodiments described above, PDPC weights were explained as being determined by considering the positions of the prediction samples included in the first prediction sample or sub-block. PDPC weights may also be determined by further considering the shape of the current block.
[0472] For example, in DC mode, the derivation method of PDPC weights may differ depending on whether the current block is non-square with a width greater than its height or a height greater than its width.
[0473] Equation 23 shows an example of deriving PDPC weights when the current block is non-square where the width is greater than the height, and Equation 24 shows an example of deriving PDPC weights when the current block is non-square where the height is greater than the width.
[0474]
[0475]
[0476] If the current block is non-square, the current block can be predicted using a wide-angle intra prediction mode. In this way, even when the wide-angle intra prediction mode is applied, the first prediction sample can be updated by applying PDPC.
[0477] When wide-angle intra prediction is applied to the current block, PDPC weights can be determined by considering the shape of the coding block.
[0478] For example, if the current block is non-square where the width is greater than the height, depending on the position of the first prediction sample, the top reference sample located at the top right of the first prediction sample may be closer to the first prediction sample than the left reference sample located at the bottom left of the first prediction sample. Accordingly, when correcting the first prediction sample, the weight applied to the top reference sample can be set to have a greater value than the weight applied to the left reference sample.
[0479] On the other hand, if the current block is non-square where the height is greater than the width, depending on the position of the first prediction sample, a case may occur where the left reference sample located at the bottom left of the first prediction sample is closer to the first prediction sample than the top reference sample located at the top right of the first prediction sample. Accordingly, when correcting the first prediction sample, the weight applied to the left reference sample can be set to have a greater value than the weight applied to the top reference sample.
[0480] Equation 25 shows an example of deriving PDPC weights when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index greater than 66.
[0481]
[0482] Equation 26 shows an example of deriving PDPC weights when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index less than 0.
[0483]
[0484] PDPC weights can also be determined based on the ratio of the current block. The ratio of the current block represents the ratio of the width to the height of the current block and can be defined as shown in the following mathematical formula 27.
[0485]
[0486] Depending on the intra-prediction mode of the current block, the method for deriving PDPC weights can be variably determined.
[0487] For example, Equations 28 and 29 represent examples of deriving PDPC weights when the intra-prediction mode of the current block is DC. Specifically, Equation 28 is an example where the current block is non-square with a width greater than its height, and Equation 29 is an example where the current block is non-square with a height greater than its width.
[0488]
[0489]
[0490] Equation 30 shows an example of deriving PDPC weights when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index greater than 66.
[0491]
[0492] Equation 31 shows an example of deriving PDPC weights when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index less than 0.
[0493]
[0494] A residual image can be derived by differencing the predicted image from the original image. In this case, when the residual image is converted to the frequency domain, the subjective image quality does not significantly degrade even if high-frequency components among the frequency components are removed. Accordingly, if the values of high-frequency components are transformed to be small or set to zero, it is possible to increase compression efficiency without significant visual distortion. Reflecting these characteristics, the current block can be transformed to decompose the residual image into two-dimensional frequency components. This transformation can be performed using transformation techniques such as the Discrete Cosine Transform (DCT) or the Discrete Sine Transform (DST).
[0495] DCT uses a cosine transform to decompose (or transform) a residual image into two-dimensional frequency components, while DST uses a sine transform to decompose (or transform) a residual image into two-dimensional frequency components. As a result of the transformation of the residual image, the frequency components can be represented as a basis image. For example, when performing a DCT transformation on an NxN block, N 2 N basic pattern components can be obtained. Through transformation, the size of each basic pattern component contained in an NxN block can be obtained. Depending on the transformation technique used, the size of the basic pattern component can be referred to as the DCT coefficient or the DST coefficient.
[0496] The transformation technique DCT is primarily used to transform images with a high distribution of non-zero low-frequency components. The transformation technique DST is primarily used for images with a high distribution of high-frequency components.
[0497] Residual images can also be transformed using transformation techniques other than DCT or DST.
[0498] Hereinafter, the process of converting a residual image into two-dimensional frequency components will be referred to as two-dimensional image transformation. Additionally, the magnitudes of the basic pattern components obtained as a result of the transformation will be referred to as transformation coefficients. For example, the transformation coefficients may refer to DCT coefficients or DST coefficients. When both the first transformation and the second transformation described below are applied, the transformation coefficients may refer to the magnitudes of the basic pattern components generated as a result of the second transformation.
[0499] The transformation technique can be determined on a block-by-block basis. The transformation technique can be determined based on at least one of the current block's predictive encoding mode, the current block's size, or the current block's size. For example, if the current block is encoded in an intra-predictive mode and the current block's size is smaller than NxN, the transformation can be performed using the transformation technique DST. On the other hand, if the above conditions are not satisfied, the transformation can be performed using the transformation technique DCT.
[0500] For some blocks of the residual image, 2D image transformation may not be performed. Not performing 2D image transformation can be referred to as a transform skip. When a transform skip is applied, quantization may be applied to the residual values for which no transformation is performed.
[0501] After transforming the current block using DCT or DST, the transformed current block can be transformed again. In this case, the transformation based on DCT or DST can be defined as the first transformation, and the transformation of the block to which the first transformation has been applied can be defined as the second transformation.
[0502] The first transformation can be performed using any one of a plurality of transformation core candidates. For example, the first transformation can be performed using any one of DCT2, DCT8, or DCT7.
[0503] Different conversion cores may be used for the horizontal and vertical directions. Information indicating the combination of the horizontal and vertical conversion cores may also be signaled via a bitstream.
[0504] The units of execution for the first transformation and the second transformation may be different. For example, the first transformation may be performed on an 8x8 block, and the second transformation may be performed on a 4x4 sub-block among the transformed 8x8 blocks. In this case, the transformation coefficients of the remaining regions where the second transformation is not performed may be set to 0.
[0505] Alternatively, a first transformation may be performed on a 4x4 block, and a second transformation may be performed on an 8x8 area containing the transformed 4x4 block.
[0506] Information indicating whether the second conversion is performed can be signaled through a bitstream.
[0507] Alternatively, whether to perform the second transformation may be determined based on whether the horizontal transformation core and the vertical transformation core are identical. For example, the second transformation may be performed only when the horizontal transformation core and the vertical transformation core are identical. Alternatively, the second transformation may be performed only when the horizontal transformation core and the vertical transformation core are different.
[0508] Alternatively, a second transformation may be permitted only when a predefined transformation core is used for the horizontal transformation and the vertical transformation. For example, a second transformation may be permitted when a DCT2 transformation core is used for the horizontal transformation and the vertical transformation.
[0509] Alternatively, whether to perform the second transformation can be determined based on the number of non-zero transformation coefficients of the current block. For example, if the non-zero transformation coefficients of the current block are less than or equal to a threshold value, the second transformation may be disabled, and if the non-zero transformation coefficients of the current block are greater than the threshold value, the second transformation may be enabled. The second transformation may also be enabled only if the current block is encoded using intra-prediction.
[0510] Based on the shape of the current block, the size or shape of the sub-block on which the second transformation will be performed can be determined.
[0511] FIGS. 23 and FIGS. 24 are drawings showing the sub-blocks on which the second transformation will be performed.
[0512] If the current block is square, after the first transformation is performed, a second transformation may be performed on an NxN sub-block at the top left of the current block. For example, if the current block is an 8x8 coding block, after performing the first transformation on the current block, a second transformation may be performed on a 4x4 sub-block at the top left of the current block (see FIG. 23).
[0513] If the current block is non-square where the width is more than four times greater than the height, after the first transformation is performed, a second transformation may be performed on a sub-block of size (kN)x(4kN) at the top left of the current block. For example, if the current block is non-square with a size of 16x4, after performing the first transformation on the current block, a second transformation may be performed on a sub-block of size 2x8 at the top left of the current block (see FIG. 24(a)).
[0514] If the current block is non-square where the height is more than four times greater than the width, a second transformation may be performed on a sub-block of size (4kN)x(kN) at the top left of the current block after the first transformation is performed. For example, if the current block is non-square with a size of 16x4, a second transformation may be performed on a sub-block of size 2x8 at the top left of the current block after the first transformation is performed on the current block (see FIG. 24(b)).
[0515] In the decoder, the inverse of the second transformation (second inverse transformation) is performed, and the inverse of the first transformation (first inverse transformation) can be performed on the result thereof. As a result of performing the second inverse transformation and the first inverse transformation, residual signals for the current block can be obtained.
[0516]
[0517] Information indicating the transformation type of the current block can be signaled via a bitstream. The information may be index information tu_mts_idx representing one of the combinations of the transformation type for the horizontal direction and the transformation type for the vertical direction.
[0518] Based on the transformation type candidates specified by the index information tu_mts_idx, the transformation core for the vertical direction and the transformation core for the horizontal direction can be determined. Tables 7 and 8 show the transformation type combinations according to tu_mts_idx.
[0519] tu_mts_idxtransform typehorizontalvertical0SKIPSKIP1DCT-IIDCT-II2DST-VIIDST-VII3DCT-VIIIDST-VII4DST-VIIDCT-VIII5DCT-VIIIDCT-VIII
[0520] tu_mts_idxtransform typehorizontalvertical0DCT-IIDCT-II1SKIPSKIP2DST-VIIDST-VII3DCT-VIIIDST-VII4DST-VIIDCT-VIII5DCT-VIIIDCT-VIII
[0521] The transformation type can be determined as any one of DCT2, DST7, DCT8, or a transformation skip. Alternatively, candidate transformation type combinations may be constructed using only transformation cores, excluding transformation skips.
[0522] When Table 7 is used, if tu_mts_idx is 0, transform skips may be applied to the horizontal and vertical directions. If tu_mts_idx is 1, DCT2 may be applied to the horizontal and vertical directions. If tu_mts_idx is 3, DCT8 may be applied to the horizontal direction and DCT7 may be applied to the vertical direction.
[0523] When Table 8 is used, if tu_mts_idx is 0, DCT2 can be applied to the horizontal and vertical directions. If tu_mts_idx is 1, transform skips can be applied to the horizontal and vertical directions. If tu_mts_idx is 3, DCT8 can be applied to the horizontal direction and DCT7 can be applied to the vertical direction.
[0524] Whether to encode index information can be determined based on at least one of the size, shape, or number of non-zero coefficients of the current block. For example, if the number of non-zero coefficients is equal to or smaller than a threshold value, index information may not be signaled, and a default transformation type may be applied to the current block. Here, the default transformation type may be DST7. Alternatively, the default mode may differ depending on the size, shape, or intra-prediction mode of the current block.
[0525] The threshold value can be determined based on the size or shape of the current block. For example, if the size of the current block is less than or equal to 32x32, the threshold value can be set to 2, and if the current block is larger than 32x32 (e.g., if the current block is a coding block of size 32x64 or 64x32), the threshold value can be set to 4.
[0526] Multiple lookup tables may be stored in the encoder / decoder. At least one of the index values assigned to conversion type combination candidates, the types of conversion type combination candidates, or the number of conversion type combination candidates may differ among the multiple lookup tables.
[0527] A lookup table for the current block can be selected based on at least one of the size, shape, predictive encoding mode, intra-prediction mode of the current block, whether a second transformation is applied, or whether a transformation skip is applied to a neighboring block.
[0528] For example, if the current block size is 4x4 or less or if the current block is encoded by inter-prediction, the lookup table of Table 7 can be used, and if the current block size is greater than 4x4 or if the current block is encoded by intra-prediction, the lookup table of Table 8 can be used.
[0529] Alternatively, information pointing to any one of a plurality of lookup tables may be signaled through a bitstream. The decoder may select a lookup table for the current block based on the information.
[0530] As another example, an index assigned to a candidate transformation type combination may be adaptively determined based on at least one of the current block size, shape, predictive encoding mode, intra-prediction mode, whether a second transformation is applied, or whether a transformation skip is applied to a neighboring block. For example, when the current block size is 4x4, the index assigned to the transformation skip may have a smaller value than the index assigned to the transformation skip when the current block size is greater than 4x4. Specifically, when the current block size is 4x4, index 0 may be assigned to the transformation skip, and when the current block is greater than 4x4 and 16x16 or less, an index greater than 0 (e.g., index 1) may be assigned to the transformation skip. When the current block is greater than 16x16, a maximum value (e.g., 5) may be assigned to the index of the transformation skip.
[0531] Alternatively, if the current block is encoded with inter-predict, index 0 may be assigned to the transform skip. If the current block is encoded with intra-predict, an index greater than 0 (e.g., index 1) may be assigned to the transform skip.
[0532] Alternatively, if the current block is a 4x4 block encoded with inter-predict, index 0 may be assigned to the transform skip. On the other hand, if the current block is not encoded with inter-predict or if the current block is larger than 4x4, an index greater than 0 (e.g., index 1) may be assigned to the transform skip.
[0533] Candidates for transformation type combinations different from those listed in Tables 7 and 8 may be defined and used. For example, a candidate for transformation type combination may be used in which a transformation skip is applied to either the horizontal or vertical transformation, and a transformation core such as DCT7, DCT8, or DST2 is applied to the other. In this case, whether to use a transformation skip as a candidate for transformation type for the horizontal or vertical direction may be determined based on at least one of the size of the current block (e.g., width and / or height), shape, predictive coding mode, or intra-prediction mode.
[0534] Alternatively, information indicating whether a specific transformation type candidate is available may be signaled via a bitstream. For example, a flag indicating whether a transformation skip can be used as a transformation type candidate for the horizontal and vertical directions may be signaled. Based on the flag, it may be determined whether a specific transformation type combination candidate is included among a plurality of transformation type combination candidates.
[0535] Alternatively, whether a specific transformation type candidate is applied to the current block can be signaled via the bitstream. For example, a flag cu_mts_flag indicating whether to apply DCT2 for the horizontal and vertical directions can be signaled. If the value of cu_mts_flag is 1, DCT2 can be set as the transformation core for the vertical and horizontal directions. If the value of cu_mts_flag is 0, DCT8 or DST7 can be set as the transformation core for the vertical and horizontal directions. Alternatively, if the value of cu_mts_flag is 0, information tu_mts_idx specifying one of multiple transformation type combination candidates can be signaled.
[0536] If the current block is non-square where the width is greater than the height or the height is greater than the width, the encoding of cu_mts_flag may be omitted and the value of cu_mts_flag may be considered to be 0.
[0537] Depending on the size, shape, or intra-prediction mode of the current block, the number of available transformation type combination candidates can be set differently. For example, if the current block is square, three or more transformation type combination candidates may be used, and if the current block is non-square, two transformation type combination candidates may be used. Alternatively, if the current block is square, only transformation type combination candidates in which the transformation type for the horizontal direction and the transformation type for the vertical direction are different may be used.
[0538] If there are three or more candidates for transformation type combinations available to the current block, index information tu_mts_idx indicating one of the candidates for transformation type combinations can be signaled. On the other hand, if there are two candidates for transformation type combinations available to the current block, a flag mts_flag indicating one of the candidates for transformation type combinations can be signaled. Table 9 below shows the encoding patterns of information for specifying candidates for transformation type combinations according to the form of the current block.
[0539] residual_coding( x0, y0, log2TbWidth, log2TbHeight, cIdx ) {Descriptor...if( cu_mts_flag[ && numSigCoeff > 2 ) | ( CuPredMode[ x0 ][ y0 ] = = MODE_INTER ) ) ) {if (cbHeight == cbWidth) {mts_idx[ x0 ][ y0 ]u(1)}}
[0540] Depending on the shape of the current block, the indexes of the candidate transformation type combinations may be reordered. For example, when the current block is square, the indexes assigned to the candidate transformation type combinations may differ from the indexes assigned to the candidate transformation type combinations when the current block is non-square. For example, when the current block is square, a transformation type combination may be selected based on Table 10 below, and when the current block is non-square, a transformation type combination may be selected based on Table 11 below.
[0541] mts_idxINTRAINTER Horizontal Conversion Core Vertical Conversion Core Horizontal Conversion Core Vertical Conversion Core 0DST7DST7DCT8DCT81DCT8DST7DST7DCT82DST7DCT8DCT8DST73DCT8DCT8DST7DST7
[0542] mts_idxINTRAINTER Horizontal Direction Transformation Core Vertical Direction Transformation Core Horizontal Direction Transformation Core Vertical Direction Transformation Core 0DCT8DST7DST7DCT8DCT8DST72DST7DST7DST7DST73DCT8DCT8DST7DST7
[0543] A transformation type can be determined based on the number of horizontal non-zero coefficients or the number of vertical non-zero coefficients of the current block. Here, the number of horizontal non-zero coefficients represents the number of non-zero coefficients included in 1xN (where N is the width of the current block), and the number of vertical non-zero coefficients represents the number of non-zero coefficients included in Nx1 (where N is the height of the current block). If the maximum value of the horizontal non-zero coefficient is less than or equal to the threshold value, a first transformation type can be applied to the horizontal direction, and if the maximum value of the horizontal non-zero coefficient is greater than the threshold value, a second transformation type can be applied to the horizontal direction. If the maximum value of the vertical non-zero coefficient is less than or equal to the threshold value, a first transformation type can be applied to the vertical direction, and if the maximum value of the vertical non-zero coefficient is greater than the threshold value, a second transformation type can be applied to the vertical direction.
[0544] FIG. 25 is a diagram illustrating an example of how the conversion type of the current block is determined.
[0545] For example, if the current block is encoded with intra-prediction and the maximum value of the horizontal non-zero coefficient of the current block is 2 or less (see Fig. 25 (a)), the horizontal transformation type can be determined as DST7.
[0546] If the current block is encoded with intra-prediction and the maximum value of the vertical non-zero coefficient of the current block is greater than 2 (see Fig. 25 (b)), DCT2 or DCT8 can be determined as the vertical transformation type.
[0547]
[0548] Information indicating whether to explicitly determine the transformation type of the current block based on information signaled from the bitstream may be signaled through the bitstream. For example, at the sequence level, information sps_explicit_intra_mts_flag indicating whether explicit transformation type determination is allowed for blocks encoded with intra-prediction and / or information sps_explicit_inter_mts_flag indicating whether explicit transformation type determination is allowed for blocks encoded with inter-prediction may be signaled.
[0549] If explicit determination of the transformation type is permitted, the transformation type of the current block may be determined based on index information tu_mts_idx signaled from the bitstream. On the other hand, if explicit determination of the transformation type is not permitted, the transformation type may be determined based on at least one of the size and shape of the current block, whether sub-block unit transformation is permitted, or the location of a sub-block containing a non-zero transformation factor. For example, the horizontal transformation type of the current block may be determined based on the width of the current block, and the vertical transformation type of the current block may be determined based on the height of the current block. For instance, if the width of the current block is less than 4 or greater than 16, the horizontal transformation type may be determined as DCT2. Otherwise, the horizontal transformation type may be determined as DST7. If the height of the current block is less than 4 or greater than 16, the vertical transformation type may be determined as DCT2. Otherwise, the vertical transformation type may be determined as DST7. Here, to determine the horizontal transformation type and the vertical transformation type, the threshold value compared with the width and height can be determined based on at least one of the current block's size, shape, or intra-prediction mode.
[0550] Alternatively, if the current block is a square with equal height and width, the horizontal and vertical transformation types can be set identically, whereas if the current block is a non-square with different height and width, the horizontal and vertical transformation types can be set differently. For example, if the width of the current block is greater than its height, the horizontal transformation type can be determined as DST7 and the vertical transformation type as DCT2. If the height of the current block is greater than its width, the vertical transformation type can be determined as DST7 and the horizontal transformation type as DCT2.
[0551] The number and / or types of conversion type candidates or the number and / or types of conversion type combination candidates may vary depending on whether explicit conversion type determination is permitted. For example, if explicit conversion type determination is permitted, DCT2, DST7, and DCT8 may be used as conversion type candidates. Accordingly, the horizontal conversion type and the vertical conversion type may each be set to DCT2, DST8, or DCT8. If explicit conversion type determination is not permitted, only DCT2 and DST7 may be used as conversion type candidates. Accordingly, the horizontal conversion type and the vertical conversion type may each be determined to DCT2 or DST7.
[0552] A coding block or a transformation block can be divided into multiple sub-blocks, and a transformation can be performed on each of the multiple sub-blocks. For example, when the sub-partition intra-predictive coding method described above is applied to a coding block, the coding block can be divided into multiple sub-blocks, and a transformation can be performed on each of the multiple sub-blocks.
[0553] The transformation types of each sub-block may be the same. For example, if a transformation type for a first sub-block among a plurality of sub-blocks is determined, the transformation type of the first sub-block can be applied to the remaining sub-blocks. Alternatively, a transformation type for a coding block can be determined, and the transformation type of the coding block can be determined as the transformation type of the sub-blocks.
[0554] As another example, the transformation types of multiple sub-blocks can be determined individually. The transformation type of each sub-block can be determined based on information signaled for each sub-block. For example, index information tu_mts_idx can be signaled for each sub-block. The index information tu_mts_idx can specify any one of a combination of transformation types for multiple horizontal directions and transformation types for vertical directions. Depending on the value of tu_mts_idx, the transformation type for the horizontal direction and the transformation type for the vertical direction can be determined as DCT2, DST7, or DCT8. Based on the index information tu_mts_idx, it can be determined whether the transformation type for the horizontal direction and the transformation type for the vertical direction are the same.
[0555] Information indicating whether the current sub-block uses the same transformation type as the previous sub-block can be signaled. If the information indicates that the same transformation type as the previous sub-block is used, the encoding of the index information tu_mts_idx for the current sub-block can be omitted, and the transformation type of the previous sub-block can be applied to the current sub-block. On the other hand, if the information indicates that a different transformation type is used, the index information tu_mts_idx for the current sub-block can be encoded. In this case, the index information of the current sub-block may point to any one of the remaining transformation type combinations, excluding the transformation type combination indicated by the index information of the previous sub-block.
[0556] Alternatively, if the coding block is divided into multiple sub-blocks, the system may be configured so that explicit conversion type determination is not allowed. If explicit conversion type determination is allowed, the conversion type may be determined based on the index information tu_mts_idx. On the other hand, if explicit conversion type determination is not allowed, the conversion type may be determined by considering at least one of the size, shape, or location of the sub-block including the non-zero coefficient of the sub-block.
[0557] Figure 26 is a diagram showing an example of determining the conversion type of a sub-block.
[0558] In FIG. 26, an example is shown in which the height and width ratio of the sub-block is 1:2 or 2:1.
[0559] The horizontal direction conversion type and the vertical direction conversion type can each be determined based on the width and height of the sub-block. For example, as shown in the examples illustrated in FIG. 26 (a) and (b), when the width of the sub-block is smaller than a threshold value, a first conversion type (e.g., DCT2) can be used as the horizontal direction conversion type. On the other hand, when the width of the sub-block is greater than or equal to the threshold value, a second conversion type (e.g., DST7) can be used as the horizontal direction conversion type.
[0560] Additionally, if the height of the sub-block is smaller than the threshold value, the first transformation type (e.g., DCT2) can be used as the vertical transformation type. On the other hand, if the width of the sub-block is greater than or equal to the threshold value, the second transformation type (e.g., DST7) can be used as the vertical transformation type.
[0561] Here, the threshold value may be a natural number such as 2, 4, or 8. The threshold value may be variably determined based on at least one of the size, shape, intra-prediction mode, or prediction coding mode of the coding block. Alternatively, information for determining the threshold value may be signaled through a bitstream.
[0562] In the example described above, the width and height of the sub-block are compared with a single threshold value, but the transformation type may also be determined by comparing the width and height of the sub-block with two threshold values. For example, if the width of the sub-block is smaller than the first threshold value or larger than the second threshold value, the horizontal transformation type may be determined as DCT2. Otherwise, the horizontal transformation type may be determined as DST7. Additionally, if the height of the sub-block is smaller than the first threshold value or larger than the second threshold value, the vertical transformation type may be determined as DCT2. Otherwise, the vertical transformation type may be determined as DST7. The second threshold value is a natural number greater than the first threshold value, the first threshold value may be a natural number such as 2, 4, or 8, and the second threshold value may be a natural number such as 8, 16, or 32.
[0563] As another example, if the sub-block is a square with equal height and width, the horizontal and vertical transformation types can be set identically; however, if the sub-block is a non-square with different height and width, the horizontal and vertical transformation types can be set differently. For example, if the width of the sub-block is greater than its height, the horizontal transformation type can be determined as DST7 and the vertical transformation type as DCT2. If the height of the sub-block is greater than its width, the vertical transformation type can be determined as DST7 and the horizontal transformation type as DCT2.
[0564] The values of residual coefficients included in at least one of a plurality of sub-blocks can be set to 0. Here, the residual coefficient refers to a transformation coefficient generated through a transformation, a transformation skip coefficient generated through a transformation skip, or a quantized coefficient generated by quantizing the transformation coefficient or coefficient. For example, the values of residual coefficients included in a sub-block spaced apart from the boundary of a coding block by a predetermined distance or more can be set to 0.
[0565] FIG. 27 is a diagram illustrating an example in which the residual coefficients of the sub-blocks are set to 0.
[0566] In the example illustrated in FIG. 27, the CBF (Coded Block Flag) indicates whether there is a non-zero residual coefficient within the sub-block. A value of 0 for the CBF indicates that there is no non-zero residual coefficient within the sub-block, and a value of 1 for the CBF indicates that there is a non-zero residual coefficient within the sub-block.
[0567] If the distance from the boundary of the coding block to the sub-block is greater than or equal to a threshold value, 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. For example, the first sample may be a sample located at the top-left corner, a sample located at the bottom-left corner, a sample located at the middle-left corner, a sample located at the top-right corner, a sample located at the bottom-right corner, a sample located at the middle-right corner, a sample located at the upper-middle corner, or a sample located at the lower-middle corner of the coding block. The second sample may be a sample located at the top-left corner, a sample located at the bottom-left corner, a sample located at the middle-left corner, a sample located at the top-right corner, a sample located at the bottom-right corner, a sample located at the middle-right corner, a sample located at the upper-middle corner, or a sample located at the lower-middle corner of the sub-block.
[0568] The threshold value may be determined based on at least one of the size and shape of the coding block, the number of sub-blocks included in the coding block, or the size of the sub-blocks. Alternatively, information for determining the threshold value may be signaled through a bitstream.
[0569] For example, if vertical partitioning is applied to the current block, the residual coefficients of sub-blocks whose distance from the left boundary of the coding block is greater than or equal to a threshold value may be set to 0. When the size of the coding block is 64 and the threshold value is 32, as in the example shown in FIG. 27 (a), the residual coefficients of sub-blocks (Sub-CU2 and Sub-CU3) whose distance from the left boundary of the coding block is 32 or greater may be set to 0.
[0570] Alternatively, if horizontal partitioning is applied to the current block, the residual coefficients of sub-blocks whose distance from the top boundary of the coding block is greater than or equal to the threshold value may be set to 0. When the size of the coding block is 64 and the threshold value is 32, the residual coefficients of sub-blocks (Sub-CU2 and Sub-CU3) whose distance from the top boundary of the coding block is 32 or greater may be set to 0, as in the example illustrated in FIG. 27 (b).
[0571] Contrary to the illustrated example, it is also possible to set the residual coefficients included in sub-blocks where the distance from the boundary of the coding block is smaller than the threshold value to zero.
[0572] Alternatively, the residual coefficients of the remaining sub-blocks, excluding the sub-block located at a pre-set position among the plurality of sub-blocks, may be set to 0. For example, when vertical partitioning is applied to a coding block, the residual coefficients of the remaining sub-blocks, excluding the sub-block located at the far left or far right among the plurality of sub-blocks, may be set to 0. Alternatively, when horizontal partitioning is applied to a coding block, the residual coefficients of the remaining sub-blocks, excluding the sub-block located at the top or bottom among the plurality of sub-blocks, may be set to 0.
[0573] For sub-blocks, information indicating whether a non-zero coefficient exists, such as the encoding of a CBF, may be omitted. When the encoding of a CBF is omitted, whether each sub-block contains a non-zero residual coefficient can be determined by considering the distance between the boundary of the coding block and the sub-block or the location of the sub-block. For example, in the example illustrated in FIG. 27, the CBF values of sub-block 0 and sub-block 1 (sub-CU0, sub-CU1) may be derived as 1, and the CBF values of sub-block 2 and sub-block 3 (sub-CU2, sub-CU3) may be derived as 0.
[0574] For subblocks containing non-zero coefficients, transformation and / or quantization are performed, whereas for subblocks not containing non-zero coefficients, transformation and quantization may be omitted.
[0575] As another example, information indicating that a transformation is performed only on a portion of a coding block or a transformation block may be encoded and signaled. This information may be a 1-bit flag cu_sbt_flag. A flag of 1 indicates that a transformation is performed only on some of the multiple sub-blocks created by dividing the coding block or the transformation block, and a flag of 0 indicates that a transformation is performed without dividing the coding block or the transformation block into sub-blocks.
[0576] A technique for performing transformation on only a portion of a coding block may be permitted only when a sub-partition intra-coding method is applied to the coding block. Accordingly, cu_sbt_flag may be encoded 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, transformation may be performed on only some of the multiple sub-blocks generated by splitting the coding block or transformation block, and the residual coefficients of the remaining sub-blocks may be set to 0. When the value of cu_sbt_flag is 1, transformation may be performed on all sub-blocks.
[0577] Alternatively, if the sub-partition intra-coding method is applied to the coding block, the encoding of cu_sbt_flag can be omitted and the value of cu_sbt_flag can be set to 1.
[0578] As another example, a technique for performing transformations on only a portion of a coding block may be permitted, provided that the predictive encoding mode of the coding block is inter-frame predictive or current picture reference. When the coding block is encoded as inter-frame predictive or current picture reference, information indicating whether transformations are performed only on a portion of the coding block may be encoded and signaled. When transformations are performed only on a portion of the coding block, information indicating the partitioning pattern of the coding block may be encoded and signaled. The information indicating the partitioning pattern of the coding block may include at least one of information indicating whether the coding block is partitioned into four sub-blocks, information indicating the direction of partitioning of the coding block, or information indicating the number of sub-blocks. For example, when cu_sbt_flag is 1, a flag cu_sbt_quadtree_flag indicating whether the coding block is partitioned into four sub-blocks may be signaled. cu_sbt_quadtree_flag being 1 indicates that the coding block is partitioned into four sub-blocks. For example, a coding block can be divided into 4 sub-blocks using 3 vertical lines or 3 horizontal lines, or into 4 sub-blocks using 1 vertical line and 1 horizontal line. A cu_sbt_quadtree_flag of 0 indicates that the coding block is divided into 2 sub-blocks. For example, a coding block can be divided into 2 sub-blocks using 1 vertical line or 1 horizontal line.
[0579] Additionally, a flag indicating the partitioning direction of the coding block can be signaled via the bitstream. For example, a flag cu_sbt_horizontal_flag indicating whether horizontal partitioning is applied to the coding block can be encoded and signaled. A value of cu_sbt_horizontal_flag of 1 indicates that horizontal partitioning is applied to the coding block, and a value of cu_sbt_horizontal_flag of 0 indicates that vertical partitioning is applied to the coding block.
[0580] Information indicating the location of a sub-block where no coefficients exist or where no transformation is performed can be signaled via a bitstream. Based on the above information, sub-blocks where transformation and / or quantization is performed and sub-blocks where the performance of transformation and / or quantization is omitted can be determined.
[0581] FIG. 28 shows an example in which the location of a sub-block that has been converted and / or quantized is determined based on information signaled through a bitstream.
[0582] A flag sbt_upleft_flag may be signaled to indicate whether a coefficient exists non-zero at a specific location or the first sub-block. A value of 1 for sbt_upleft_flag indicates that a transformation and / or quantization has been performed on the sub-block located at the top or left of the coding block, and that a transformation and / or quantization has not been performed on the sub-block located at the right or bottom of the coding block. A value of 0 for sbt_upleft_flag indicates that a transformation and / or quantization has been performed on the sub-block located at the top or left of the coding block, and that a transformation and / or quantization has not been performed on the sub-block located at the right or bottom of the coding block.
[0583] If the coding block is divided into 4 sub-blocks, sbt_upleft_flag may indicate that transformation and / or quantization has been performed on N sub-blocks. For example, a value of 1 for sbt_upleft_flag indicates that transformation and / or quantization has been performed on the top or left 2 sub-blocks, and a value of 0 for sbt_upleft_flag indicates that transformation and / or quantization has been performed on the right or bottom 2 sub-blocks.
[0584] Unlike the illustrated example, the value of N can also be set to 1 or 3.
[0585] Residual coefficients of sub-blocks that have not undergone transformation and / or quantization can be set to 0.
[0586] The transformation type of a sub-block can be determined by considering the division direction of the coding block and the position of the sub-block. For example, if the coding block is divided vertically and a transformation is performed on the sub-block located on the left among the sub-blocks, the horizontal transformation type and the vertical transformation type can be set differently. For example, the horizontal transformation type can be set to DCT8 and the vertical transformation type can be set to DST7. On the other hand, if the coding block is divided vertically and a transformation is performed on the sub-block located on the right among the sub-blocks, the horizontal transformation type and the vertical transformation type of the sub-block can be set identically. For example, the horizontal transformation type and the vertical transformation type can be set to DST7.
[0587] Alternatively, if the coding block is divided horizontally and a transformation is performed on the upper sub-block, the horizontal transformation type and the vertical transformation type can be set differently. For example, the horizontal transformation type can be set to DST7 and the vertical transformation type to DCT8. On the other hand, if the coding block is divided horizontally and a transformation is performed on the lower sub-block, the horizontal transformation type and the vertical transformation type of the sub-block can be set identically. For example, the horizontal transformation type and the vertical transformation type can be set to DST7.
[0588] For sub-blocks, information indicating whether a coefficient exists non-zero, such as the encoding of the CBF, may be omitted. If the encoding of the CBF is omitted, it may be determined whether each sub-block contains a non-zero residual coefficient by considering the position of the block where the transformation is performed. For example, if the value of sbt_upleft_flag is 0, the CBF values of sub-blocks located to the left or top may be 0, and the CBF values of sub-blocks located to the right or bottom may be 1. Alternatively, if the value of sbt_upleft_flag is 1, the CBF values of sub-blocks located to the left or top may be 1, and the CBF values of sub-blocks located to the right or bottom may be 0.
[0589] The reconstructed sample of a sub-block where the transformation is performed can be derived from the sum of the predicted sample and the residual sample. On the other hand, in a sub-block where the transformation is omitted, the predicted sample can be set as the reconstructed sample. Quantization is intended to reduce the energy of the block, and the quantization process includes the process of dividing the transformation coefficient by a specific constant value. The constant value can be derived by a quantization parameter, and the quantization parameter can be defined as a value between 1 and 63.
[0590] When the encoder performs transform and quantization, the decoder can obtain a residual block through inverse quantization and inverse transform. The decoder can obtain a reconstructed block for the current block by adding the prediction block and the residual block.
[0591]
[0592] When the reconstructed block of the current block is obtained, the loss of information occurring during the quantization and encoding processes can be reduced through in-loop filtering. The in-loop filter may include at least one of a deblocking filter, a Sample Adaptive Offset filter (SAO), or an Adaptive Loop Filter (ALF). Hereinafter, the reconstructed block before the application of the in-loop filter will be referred to as the first reconstructed block, and the reconstructed block after the application of the in-loop filter will be referred to as the second reconstructed block.
[0593] A second restored block can be obtained by applying at least one of a deblocking filter, SAO, or ALF to the first restored block. In this case, the SAO or ALF may be applied after the deblocking filter has been applied.
[0594] The deblocking filter is intended to mitigate blocking artifacts at the boundaries of blocks that occur as a result of performing quantization in blocks. To apply the deblocking filter, the blocking strength (BS) between the first reconstructed block and neighboring reconstructed blocks can be determined.
[0595] Figure 29 is a flowchart illustrating the process of determining block strength.
[0596] In the example illustrated in FIG. 29, P represents the first restoration block and Q represents the neighbor restoration block. Here, the neighbor restoration block may be adjacent to the left or top of the current block.
[0597] In the example illustrated in FIG. 29, the block strength is determined by considering the prediction encoding mode of P and Q, whether non-zero transformation coefficients are included, whether inter-predicted using the same reference picture, or whether the difference value of the motion vectors is greater than or equal to a threshold value.
[0598] Based on the block strength, it can be determined whether to apply a deblocking filter. For example, if the block strength is 0, filtering may not be performed.
[0599] SAO is intended to mitigate ringing artifacts that occur as a result of performing quantization in the frequency domain. SAO can be performed by adding or subtracting an offset determined by considering the pattern of the first reconstructed image. The method for determining the offset includes edge offset (EO) or band offset. EO represents a method for determining the offset of the current sample based on the pattern of surrounding pixels. BO represents a method for applying a common offset to a set of pixels having similar brightness values within a region. Specifically, pixel brightness can be divided into 32 equal intervals, and pixels with similar brightness values can be set as a single set. For example, four adjacent bands among the 32 bands can be set as a single group, and the same offset value can be applied to samples belonging to those four bands.
[0600] ALF is a method for generating a second reconstructed image by applying a filter of a predefined size / shape to a first reconstructed image or a reconstructed image to which a deblocking filter has been applied. Equation 32 below represents an example of the application of ALF.
[0601]
[0602] You can select any one of the predefined filter candidates at the level of a picture, coding tree unit, coding block, prediction block, or transformation block. Each filter candidate may differ in either size or shape.
[0603] Figure 30 shows previously defined filter candidates.
[0604] As shown in the example illustrated in FIG. 30, at least one of diamond shapes of 5x5, 7x7, or 9x9 sizes can be selected.
[0605] For the chroma component, only a 5x5 diamond shape can be used.
[0606]
[0607] Applying the embodiments described with reference to the decoding process or the encoding process to the encoding process or the decoding process is included within the scope of the present invention. Changing the embodiments described in a predetermined order to a different order from that described is also included within the scope of the present invention.
[0608] The above-described embodiments are described based on a series of steps or flowcharts, but this does not limit the chronological order of the invention and may be performed simultaneously or in a different order as necessary. Additionally, each component constituting the block diagram in the above-described embodiments (e.g., units, modules, etc.) may be implemented as a hardware device or software, or a plurality of components may be combined to be implemented as a single hardware device or software. The above-described embodiments may be implemented in the form of program instructions that can be executed through various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program instructions, data files, data structures, etc., either individually or in combination. Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes; optical recording media such as CD-ROMs and DVDs; magneto-optical media such as floptical disks; and hardware devices specifically configured to store and execute program instructions, such as ROM, RAM, and flash memory. The above hardware device may be configured to operate as one or more software modules to perform processing according to the present invention, and vice versa.
[0609] The present invention can be applied to an electronic device that encodes / decodes images.
Claims
1. Step of determining the reference sample line of the current block; A step of determining whether there is a candidate intra prediction mode that is identical to the intra prediction mode of the current block; Based on the above decision, a step of deriving an intra prediction mode of the current block; and A step of performing intra prediction for the current block based on the above reference sample line and the above intra prediction mode, A video decoding method, characterized in that at least one of the candidate intra prediction modes is derived by adding or subtracting an offset to the maximum value among the intra prediction mode of the upper neighboring block of the current block and the intra prediction mode of the left neighboring block of the current block.
2. In paragraph 1, An image decoding method, characterized in that when the difference between the intra prediction mode of the upper neighboring block and the intra prediction mode of the left neighboring block is 64, at least one of the candidate intra prediction modes is derived by adding or subtracting 2 to the maximum value.
3. In paragraph 1, A video decoding method, characterized in that the number of candidate intra prediction modes is different depending on the index of the reference sample line.
4. In paragraph 1, Further comprising a step of determining whether to divide the current block into a plurality of sub-blocks, An image decoding method, characterized in that when the current block is divided into a plurality of sub-blocks, the plurality of sub-blocks share one intra prediction mode.
5. In paragraph 4, An image decoding method, characterized in that inverse transformation is omitted for some of the plurality of sub-blocks.
6. In paragraph 4, An image decoding method, characterized in that the horizontal transformation type of a sub-block is determined based on the width of the sub-block, and the vertical transformation type of the sub-block is determined based on the height of the sub-block.
7. In paragraph 4, An image decoding method, characterized in that the horizontal direction transformation type and the vertical direction transformation type of a sub-block are determined based on the shape of the sub-block.
8. Step of determining the reference sample line of the current block; A step of determining whether there is a candidate intra prediction mode that is identical to the intra prediction mode of the current block; Based on the above decision, a step of deriving an intra prediction mode of the current block; and A step of performing intra prediction for the current block based on the above reference sample line and the above intra prediction mode, A video encoding method, characterized in that at least one of the candidate intra prediction modes is derived by adding or subtracting an offset to the maximum value among the intra prediction mode of the upper neighboring block of the current block and the intra prediction mode of the left neighboring block of the current block.
9. In paragraph 8, A video encoding method, characterized in that when the difference between the intra prediction mode of the upper neighboring block and the intra prediction mode of the left neighboring block is 64, at least one of the candidate intra prediction modes is derived by adding or subtracting 2 to the maximum value.
10. In paragraph 8, A video encoding method, characterized in that the number of candidate intra prediction modes is different depending on the index of the reference sample line.
11. In paragraph 8, Further comprising a step of determining whether to divide the current block into a plurality of sub-blocks, A video encoding method, characterized in that when the current block is divided into a plurality of sub-blocks, the plurality of sub-blocks share one intra prediction mode.
12. In paragraph 11, A video encoding method, characterized in that transformation is omitted for some of the plurality of sub-blocks.
13. In paragraph 11, A video encoding method, characterized in that the horizontal transformation type of a sub-block is determined based on the width of the sub-block, and the vertical transformation type of the sub-block is determined based on the height of the sub-block.
14. In paragraph 11, A video encoding method, characterized in that the horizontal direction transformation type and the vertical direction transformation type of a sub-block are determined based on the shape of the sub-block.