Method and device for encoding and decoding video signal

By dividing video blocks into sub-blocks and using intra-prediction modes based on neighboring blocks, the method enhances video compression efficiency beyond HEVC limits, addressing data volume challenges in high-definition video services.

JP2026004604APending Publication Date: 2026-01-14GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2025173135
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2019-01-18
Filing Date
2025-10-14
Publication Date
2026-01-14

AI Technical Summary

Technical Problem

Existing video compression standards like HEVC are reaching their limits in handling high-definition video services, leading to inefficiencies in data volume and compression performance.

Method used

A method for encoding and decoding video signals by dividing coding or transform blocks into sub-blocks and performing intra-prediction on each sub-block, deriving candidate intra-prediction modes based on neighboring blocks, and selectively applying transforms to improve efficiency.

Benefits of technology

Improves intra prediction and encoding/decoding efficiency by utilizing sub-blocks and candidate intra-prediction modes, enhancing video compression performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026004604000001_ABST
    Figure 2026004604000001_ABST
Patent Text Reader

Abstract

Provided are a method and apparatus for deriving a candidate intra prediction mode based on an intra prediction mode of a neighboring block adjacent to a current block in encoding or decoding video signal.SOLUTION: The method includes determining a reference sample line of a current block, determining whether there is a candidate intra prediction mode that is the same as an intra prediction mode of the current block, deriving the intra prediction mode of the current block based on a result of the determining, and performing intra prediction on the current block according to the reference sample line and the intra prediction mode. Here, at least one of the candidate intra prediction modes may be derived by adding or subtracting an offset to or from the maximum value of the intra prediction mode of the top neighboring block of the current block and the intra prediction mode of the left neighboring block of the current block.SELECTED DRAWING: Figure 8
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present application relates to a method and an apparatus for encoding and decoding a video signal. [Background technology]

[0002] With the trend toward larger display panels, higher quality video services are gradually being pursued. The biggest problem with high-definition video services is the significant increase in data volume. To address this issue, active research is being conducted to improve video compression rates. 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) of 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. The standard was approved on January 25, 2013. However, with the rapid development of high-definition video services, HEVC's performance is gradually reaching its limits. Summary of the Invention [Problem to be solved by the invention]

[0003] An object of the present application is to provide a method for deriving candidate intra-prediction modes based on intra-prediction modes of neighboring blocks adjacent to a current block in encoding or decoding a video signal, and an apparatus for performing said method.

[0004] An object of the present application is to provide a method and an apparatus for performing said method in encoding or decoding a video signal, in which a coding block or a transform block is divided into a plurality of sub-blocks and intra prediction is performed for each sub-block.

[0005] The object of the present application is to provide a method and an apparatus for implementing said method in the encoding or decoding of a video signal, in which a coding block or a transform block is divided into a number of sub-blocks and a transform is performed on only some of the sub-blocks.

[0006] The technical problems that the present application aims to achieve are not limited to the technical problems mentioned above, and other technical problems not mentioned can be clearly understood by those skilled in the art from the following description. [Means for solving the problem]

[0007] A video signal decoding or encoding method of the present application includes: determining a reference sample line of a current block; determining whether a candidate intra-prediction mode that is the same as the intra-prediction mode of the current block exists; deriving an intra-prediction mode of the current block based on the determined result; and performing intra-prediction on the current block according to the reference sample line and the intra-prediction mode. In this case, at least one of the candidate intra-prediction modes may be derived by adding or subtracting an offset to the maximum value of the intra-prediction mode of an upper neighboring block of the current block and the intra-prediction mode of a left neighboring block of the current block.

[0008] In the video signal decoding or encoding method of the present application, if the difference between the intra prediction mode of the top adjacent block and the intra prediction mode of the left adjacent block is 64, at least one of the candidate intra prediction modes may be derived by adding or subtracting 2 from the maximum value.

[0009] In the video signal decoding or encoding method of the present application, the number of the candidate intra-prediction modes may vary according to the index of the reference sample line.

[0010] The video signal decoding or encoding method of the present application may further include determining whether to divide the current block into multiple sub-blocks, and if the current block is divided into multiple sub-blocks, the multiple sub-blocks may share one intra-prediction mode.

[0011] In the video signal decoding or encoding method of the present application, the inverse transform can be skipped for some of the plurality of sub-blocks.

[0012] In the video signal decoding or encoding method of the present application, the horizontal transformation type of the sub-block can be determined according to the width of the sub-block, and the vertical transformation type of the sub-block can be determined according to the height of the sub-block.

[0013] In the video signal decoding or encoding method of the present application, the horizontal transformation type and vertical transformation type of the sub-block can be determined according to the shape of the sub-block.

[0014] The features summarized above for the present application are merely exemplary embodiments in the specific description of the present application to be described later, and are not intended to limit the scope of the present application. [Effects of the Invention]

[0015] The present invention has the following technical effects.

[0016] According to the present invention, intra prediction efficiency can be improved by deriving a candidate intra prediction mode similar to the intra prediction mode of a neighboring block adjacent to the current block.

[0017] According to the present application, intra prediction efficiency can be improved by dividing a coding block or a transform block into multiple sub-blocks and performing intra prediction on each sub-block.

[0018] According to the present application, encoding or decoding efficiency can be improved by dividing a coding or transform block into multiple sub-blocks and performing transforms on only some of the sub-blocks.

[0019] The effects that can be obtained by the present application are not limited to the effects mentioned above, and other effects not mentioned will be clearly understood by those skilled in the art from the following description. [Brief explanation of the drawings]

[0020] [Figure 1] FIG. 1 is a block diagram of a video encoder according to an embodiment of the present application; [Figure 2] 1 is a block diagram of a video decoder according to an embodiment of the present application; [Figure 3] 1 illustrates a basic coding tree unit according to an embodiment of the present application. [Figure 4] 10 is a diagram showing a plurality of division shapes of a coding block; [Figure 5] FIG. 1 is a schematic diagram of a division shape of a coding tree unit. [Figure 6] 1 is a flowchart of an inter prediction method according to an embodiment of the present application; [Figure 7] 1 is a diagram showing a collocated block. [Figure 8] 1 is a flowchart of an intra prediction method according to an embodiment of the present application; [Figure 9] 1 is a diagram showing reference samples included in each reference sample line. [Figure 10] 1 is a diagram illustrating intra-prediction modes. [Figure 11] FIG. 1 is a schematic diagram of an example of a one-dimensional array in which reference samples are arranged in a row. [Figure 12] FIG. 1 is a schematic diagram of an example of a one-dimensional array in which reference samples are arranged in a row. [Figure 13] FIG. 10 is a schematic diagram of the angles formed by directional intra prediction modes with a line parallel to the X-axis. [Figure 14] FIG. 10 is a schematic diagram of how prediction samples are obtained when the current block is non-square shaped. [Figure 15] 10 is a diagram illustrating a wide-angle intra prediction mode. [Figure 16] 1 is a diagram showing an example of vertical partitioning and horizontal partitioning. [Figure 17] 10 is a diagram illustrating an example of determining a division shape of a coding block. [Figure 18] 10 is a diagram illustrating an example of determining a division shape of a coding block. [Figure 19] 10 is a diagram illustrating an example of determining a division shape of a coding block based on an intra prediction mode of the coding block. [Figure 20] 10 is a diagram illustrating a division shape of a coding block; [Figure 21] 10 is a diagram illustrating an example in which a predictive coding mode is set differently for each sub-block; [Figure 22] 1 is a diagram showing an embodiment in which a PDPC is applied. [Figure 23] 10 is a diagram showing a sub-block that performs a second transformation. [Figure 24] 10 is a diagram showing a sub-block that performs a second transformation. [Figure 25] 10 is a diagram illustrating an example in which a transformation type of a current block is determined; [Figure 26] 10 is a diagram illustrating an example of determining a transform type of a sub-block. [Figure 27] 10 is a diagram illustrating an example in which residual coefficients of a sub-block are set to 0. [Figure 28]10 illustrates an example of determining the location of sub-blocks that perform transform and / or quantization based on information signaled by the bitstream. [Figure 29] 10 is a flowchart illustrating a process for determining block strength. [Figure 30] Shows predefined filter suggestions. DETAILED DESCRIPTION OF THE INVENTION

[0021] Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.

[0022] Video encoding and decoding is performed on a block-by-block basis. For example, encoding or decoding processes such as transform, quantization, prediction, in-loop filtering, or reconstruction may be performed on coding blocks, transform blocks, or prediction blocks.

[0023] Hereinafter, the block to be coded or decoded will be referred to as a “current block.” As an example, the current block may be represented as a coding block, a transform block, or a prediction block according to a current coding or decoding process step.

[0024] Furthermore, as used herein, the term "unit" refers to a basic unit for performing a specific encoding or decoding process, and "block" can be understood to refer to a sample array of a predetermined size. Unless otherwise specified, "block" and "unit" can be used interchangeably. For example, in the embodiments described below, a coding block and a coding unit can be understood to have the same meaning.

[0025] FIG. 1 is a block diagram of a video encoder according to an embodiment of the present invention.

[0026] As shown in FIG. 1, the video encoding device 100 may include an image division unit 110, prediction units 120, 125, a transform unit 130, a quantization unit 135, a re-sorting unit 160, an entropy encoding unit 165, an inverse quantization unit 140, an inverse transform unit 145, a filter unit 150, and a memory 155.

[0027] 1 are illustrated independently to show different characteristic functions of the video encoding device, but this does not mean that each component is composed of separate hardware or a single software unit. That is, each component is listed for convenience of explanation, and at least two of the components may be combined into a single component, or one component may be divided into multiple components to perform its function. Both integrated and separated embodiments of these components are within the scope of protection of this application as long as they do not deviate from the essence of this application.

[0028] Furthermore, some components may not be essential components for performing essential functions in the present application, but may be optional components simply for improving performance. The present application may include only components that are essential for embodying the essence of the present application (i.e., the present application may not include components used solely for improving performance), and a structure including only necessary components, excluding optional components used solely for improving performance, is also included in the scope of protection of the present application.

[0029] The image division unit 110 can divide an input image into at least one processing unit. In this case, the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The image division unit 110 can divide one image into a plurality of combinations of coding units, prediction units, and transform units, and select a combination of coding units, prediction units, and transform units according to a predetermined criterion (for example, a cost function) to encode the image.

[0030] For example, an image can be divided into multiple coding units. A recursive tree structure, such as a quad tree structure, can be used to divide an image into coding units. A video or coding unit that is divided into different coding units with the largest coding unit as the root can be divided using child nodes equal to the number of divided coding units. A coding unit that is not further divided according to a predetermined restriction becomes a leaf node. In other words, assuming that only square divisions are possible for a coding unit, one coding unit can be divided into a maximum of four different coding units.

[0031] Hereinafter, in the embodiments of the present application, the coding unit may be used to mean a unit for performing coding, or may be used to mean a unit for performing decoding.

[0032] The prediction units may be divided into at least one shape of the same size, such as a square or rectangle, within a single coding unit, or may be divided into prediction units such that one of the prediction units divided within a single coding unit has a different shape and / or size from another prediction unit.

[0033] When generating a prediction unit for performing intra prediction based on a coding unit, if the coding unit is not the smallest coding unit, intra prediction can be performed without dividing a plurality of N×N prediction units.

[0034] The prediction units 120 and 125 may include an inter prediction unit 120 that performs inter prediction and an intra prediction unit 125 that performs intra prediction. The prediction unit 120 may determine whether to use inter prediction or intra prediction for a prediction unit, and may determine specific information (e.g., intra prediction mode, motion vector, reference image, etc.) based on each prediction method. In this case, the processing unit for performing prediction may be different from the processing unit for determining the prediction method and specific content. For example, the prediction method and prediction mode may be determined for each prediction unit, and prediction may also be performed for each transform unit. Residual values ​​(residual blocks) between the generated prediction block and the original block may be input to the transform unit 130. Furthermore, prediction mode information, motion vector information, etc. used for prediction may be coded by the entropy coding unit 165 along with the residual values ​​and signaled to the decoder. When a specific coding mode is used, the prediction unit 120 and 125 may directly code the original block without generating a prediction block and transmit the coded data to the decoder.

[0035] The inter prediction unit 120 can predict a prediction unit based on information of at least one image preceding or following the current image, and in some cases, can predict a prediction unit according to information of a coded partial region within the current image. The inter prediction unit 120 can include a reference image interpolation unit, a motion prediction unit, and a motion compensation unit.

[0036] The reference image interpolation unit acquires reference image information provided from the memory 155 and generates pixel information of integer pixels or less from the reference image. In the case of luminance pixels, a DCT-based 8-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 4 pixel units. In the case of color difference signals, a DCT-based 4-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 8 pixel units.

[0037] The motion prediction unit can perform motion prediction based on the reference image interpolated by the reference image interpolator. A number of methods can be used to calculate a motion vector, including a full search-based block matching algorithm (FBMA), a three-step search (TSS), and a new three-step search algorithm (NTS). The motion vector may have a motion vector value in half or quarter pixel units based on the interpolated pixel. The motion prediction unit can predict the current prediction unit using different motion prediction methods. A number of modes can be used as the motion prediction method, including a skip mode, a merge mode, an advanced motion vector prediction (AMVP) mode, and an intra block copy mode.

[0038] The intra prediction unit 125 may generate a prediction unit based on reference pixel information surrounding a current block, which is pixel information within a current image. Because neighboring blocks of the current prediction unit are blocks performing inter prediction, if the reference pixels are pixels performing inter prediction, the reference pixels included in the block performing inter prediction may be replaced with reference pixel information of a neighboring block performing intra prediction. That is, if a reference pixel is unavailable, at least one of the available reference pixels may replace the unavailable reference pixel information.

[0039] In intra prediction, the prediction mode may 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 prediction. The mode for predicting luma information may be different from the mode for predicting chroma information, and the intra prediction mode information used to predict luma information or predicted luma signal information may be used to predict chroma information.

[0040] When performing intra prediction, if the size of the prediction unit is the same as the size of the transform unit, intra prediction for the prediction unit can be performed according to the pixel to the left, the pixel to the top left, and the pixel at the top of the prediction unit. However, when performing intra prediction, if the size of the prediction unit is different from the size of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. Furthermore, intra prediction using NxN partitioning can only be used for the smallest coding unit.

[0041] The intra prediction method may generate a predicted block after applying an adaptive intra smoothing (AIS) filter to reference pixels according to a prediction mode. The type of AIS filter applied to the reference pixels may vary. To perform the intra prediction method, the intra prediction mode of a current prediction unit may be predicted from the intra prediction mode of prediction units existing around the current prediction unit. When predicting the prediction mode of the current prediction unit using mode information predicted from surrounding prediction units, if the current prediction unit has the same intra prediction mode as the surrounding prediction unit, information indicating that the current prediction unit has the same prediction mode as the surrounding prediction unit may be transmitted using predetermined identifier information. If the current prediction unit has a different prediction mode from the surrounding prediction unit, entropy coding may be performed to encode the prediction mode information of the current block.

[0042] Furthermore, a residual block including residual value information, which is the difference between the prediction unit for performing prediction based on the prediction unit generated by the prediction units 120 and 125 and the original block of the prediction unit, can be generated. The generated residual block can be input to the conversion unit 130.

[0043] The transform unit 130 transforms a residual block including an original block and residual value information of the prediction unit generated by the predictor 120, 125 using a transform method such as a discrete cosine transform (DCT), a discrete sine transform (DST), or a KLT. Whether to apply the DCT, the DST, or the KLT to transform the residual block may be determined based on intra prediction mode information of the prediction unit used to generate the residual block.

[0044] The quantization unit 135 quantizes the values ​​transformed into the frequency domain by the transform unit 130. The quantization coefficients are changed according to the importance of the block or video. The values ​​calculated by the quantization unit 135 can be provided to the inverse quantization unit 140 and the re-sorting unit 160.

[0045] The resorting unit 160 can perform a resorting of the coefficient values ​​on the quantized residual values.

[0046] The re-sorting unit 160 may convert two-dimensional block shape coefficients into one-dimensional vector shapes using a coefficient scanning method. For example, the re-sorting unit 160 may convert the two-dimensional block shape coefficients into one-dimensional vector shapes by scanning from DC coefficients to high-frequency region coefficients using a zig-zag scan method. Instead of performing zig-zag scanning according to the size of the transform unit and the intra prediction mode, vertical scanning, in which two-dimensional block shape coefficients are scanned in the column direction, or horizontal scanning, in which two-dimensional block shape coefficients are scanned in the row direction, may be used. That is, the scan method to be used may be determined from among zig-zag scanning, vertical scanning, and horizontal scanning according to the size of the transform unit and the intra prediction mode.

[0047] The entropy coding unit 165 can perform entropy coding based on the values ​​calculated by the re-sorting unit 160. The entropy coding can use a number of coding methods, such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC).

[0048] The entropy coding unit 165 can encode multiple information such as residual value coefficient information of the coding unit, block type information, prediction mode information, division unit information, prediction unit information and transmission unit information, motion vector information, reference frame information, block interpolation information, and filtering information from the re-sorting unit 160 and the prediction units 120 and 125.

[0049] The entropy coding unit 165 can perform entropy coding on the coefficient values ​​of the coding unit input from the re-sorting unit 160 .

[0050] The inverse quantization unit 140 and the inverse transform unit 145 inversely quantize the values ​​quantized by the quantization unit 135 and inversely transform the values ​​transformed by the transform unit 130. The residual values ​​generated by the inverse quantization unit 140 and the inverse transform unit 145 can be combined with prediction units predicted via the motion prediction unit, motion compensation unit, and intra prediction unit included in the prediction units 120 and 125 to generate a reconstructed block.

[0051] The filter unit 150 may include at least one of a deblocking filter, an offset correction unit, and an adaptive loop filter (ALF).

[0052] The deblocking filter can remove block artifacts caused by boundaries between blocks from the restored image. To determine whether to perform deblocking, it can be determined whether to apply the deblocking filter to the current block based on the pixels contained in several columns or rows contained in the block. When applying the deblocking filter to the block, a strong filter or a weak filter can be applied according to the required deblocking filtering strength. Furthermore, in an aspect of applying the deblocking filter, when vertical filtering and horizontal filtering are performed, horizontal filtering and vertical filtering can be processed in parallel.

[0053] The offset correction unit can correct the offset between the original video and the video to be deblocked on a pixel-by-pixel basis. To perform offset correction for a specific image, the method can divide the pixels included in the video into a predetermined number of regions, determine the region to perform offsetting, and apply the offset to the corresponding region, or can apply the offset by taking into account edge information of each pixel.

[0054] Adaptive Loop Filtering (ALF) can be performed based on a comparison between the filtered restored video and the original video. After dividing the pixels in an image into predetermined groups, a filter to be applied to the corresponding group can be determined, allowing differential filtering for each group. A luminance signal, which indicates whether or not to apply ALF, can be transmitted for each coding unit (CU), and the shape and filter coefficients of the ALF filter to be applied can be different for each block. Furthermore, an ALF filter of the same shape (fixed shape) can be used regardless of the characteristics of the block to which it is applied.

[0055] The memory 155 can store the reconstructed blocks or images calculated by the filter unit 150, and the stored reconstructed blocks or images can be provided to the prediction units 120, 125 when performing inter prediction.

[0056] FIG. 2 is a block diagram of a video decoder according to an embodiment of the present invention.

[0057] As shown in FIG. 2, the video decoder 200 may include an entropy decoding unit 210, a re-sorting unit 215, an inverse quantization unit 220, an inverse transform unit 225, prediction units 230 and 235, a filter unit 240, and a memory 245.

[0058] When a video bitstream is input to a video encoder, the input bitstream can be decoded in the opposite procedure to that of the video encoder.

[0059] The entropy decoding unit 210 may perform entropy decoding in a procedure opposite to that performed by the entropy encoding unit of the video encoder. For example, multiple methods, such as Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC), may be used in correspondence with the methods performed by the video encoder.

[0060] The entropy decoding unit 210 can decode information related to intra-prediction and inter-prediction performed in the encoder.

[0061] The re-sorting unit 215 may perform re-sorting on the bitstream entropy decoded by the entropy decoding unit 210 based on a re-sorting method used in the encoding unit. The re-sorting unit 215 may restore coefficients represented in the form of one-dimensional vectors to coefficients in the form of two-dimensional blocks and perform re-sorting. The re-sorting unit 215 may receive information related to the coefficient scan performed in the encoding unit and perform re-sorting in a reverse scanning manner based on the scan order performed in the corresponding encoding unit.

[0062] The inverse quantizer 220 may perform inverse quantization based on the quantization parameters provided by the encoder and the coefficient values ​​of the re-sorted block.

[0063] The inverse transform unit 225 can perform inverse transforms, such as inverse DCT, inverse DST, and inverse KLT, on the transforms performed by the transform unit on the quantization results performed by the video encoder, i.e., DCT, DST, and KLT. The inverse transform can be performed based on a transmission unit determined by the video encoder. The inverse transform unit 225 of the video decoder can selectively perform a transform method (e.g., DCT, DST, KLT) according to multiple information such as a prediction method, a size of the current block, and a prediction direction.

[0064] The prediction units 230 and 235 can generate prediction blocks based on information related to the generation of the prediction blocks provided by the entropy decoding unit 210 and information on previously decoded blocks or images provided by the memory 245 .

[0065] As described above, when performing intra prediction, similar to the operation of a video encoder, if the size of the prediction unit is the same as the size of the transform unit, intra prediction for the prediction unit is performed based on the pixel on the left, the pixel on the top left, and the pixel at the top. However, when performing intra prediction, if the size of the prediction unit is different from the size of the transform unit, intra prediction can be performed using reference pixels based on the transform unit. Furthermore, intra prediction using NxN division can also be performed only on the smallest coding unit.

[0066] The prediction units 230 and 235 may include a prediction unit discrimination unit, an inter prediction unit, and an intra prediction unit. The prediction unit discrimination unit receives various information, such as prediction unit information input by the entropy decoding unit 210, prediction mode information for the intra prediction method, and motion prediction-related information for the inter prediction method, to distinguish prediction units in the current coding unit and determine whether inter prediction or intra prediction is to be performed for the prediction unit. The inter prediction unit 230 may perform inter prediction for the current prediction unit based on information included in at least one image, including a previous image or a subsequent image, of the current image included in the current prediction unit, using information necessary for inter prediction of the current prediction unit provided by the video encoder. Alternatively, the inter prediction unit may perform inter prediction based on information about a reconstructed partial region in the current image including the current prediction unit.

[0067] To perform inter prediction, it is possible to determine, based on a coding unit, which of the following motion prediction methods of the prediction units included in the corresponding coding unit is skip mode, merge mode, motion vector prediction mode (AMVP mode), or intra block copy mode.

[0068] The intra prediction unit 235 may generate a prediction block based on pixel information within the current image. If the prediction unit is a prediction unit for performing intra prediction, the intra prediction may be performed based on intra prediction mode information of the prediction unit provided by the video encoder. The intra prediction unit 235 may include an adaptive intra smoothing (AIS) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter, which performs filtering on reference pixels of the current block, may determine whether to apply a filter according to the prediction mode of the current prediction unit and apply the filter. AIS filtering may be performed on reference pixels of the current block using the prediction mode of the prediction unit and AIS filter information provided by the video encoder. If the prediction mode of the current block is a mode in which AIS filtering is not performed, the AIS filter may not be applied.

[0069] The reference pixel interpolator may generate reference pixels of pixel units of less than an integer value by interpolating reference pixel values ​​when the prediction mode of the prediction unit is a prediction mode that performs intra prediction based on interpolated pixel values ​​of reference pixel values. When the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating reference pixel values, the reference pixels may not be interpolated. When the prediction mode of the current block is a DC mode, the DC filter may generate a prediction block through filtering.

[0070] The reconstructed block or image may be provided to the filter unit 240. The filter unit 240 may include a deblocking filter, an offset correction unit, and an ALF.

[0071] Information regarding whether a deblocking filter has been applied to a corresponding block or image from the video encoder, and if a deblocking filter has been applied, information regarding whether a strong or weak filter has been applied, can be obtained. The deblocking filter of the video decoder can accept the deblocking filter-related information provided by the video encoder, and the video decoder can perform deblocking filtering of the corresponding block.

[0072] The offset correction unit can perform offset correction on the restored video based on the type of offset correction applied to the video during encoding, offset value information, and the like.

[0073] The ALF can be applied to a coding unit based on information on whether to apply the ALF, ALF coefficient information, etc. provided by the encoder. Such ALF information can be provided by being included in a specific parameter set.

[0074] The memory 245 can store the reconstructed images or blocks so that they can be used as reference images or blocks, and can also provide the reconstructed images to an output.

[0075] FIG. 3 is a diagram illustrating a basic coding tree unit according to an embodiment of the present invention.

[0076] A coding block of the largest size can be defined as a coding tree block. One image is divided into multiple coding tree units (CTUs). A coding tree unit is a coding unit of the largest size and can also be called a Largest Coding Unit (LCU). Figure 3 shows an example in which one image is divided into multiple coding tree units.

[0077] The size of the coding tree unit can be defined at the picture level or the sequence level, and thus, information indicating the size of the coding tree unit can be signaled via a picture parameter set or a sequence parameter set.

[0078] For example, the coding tree unit size for all images in a sequence may be set to 128x128. Alternatively, the coding tree unit size may be determined at the image level as either 128x128 or 256x256. For example, for a first image, the coding tree unit size may be set to 128x128, and for a second image, the coding tree unit size may be set to 256x256.

[0079] A coding tree unit may be divided to generate coding blocks. A coding block indicates a basic unit for encoding or decoding processing. For example, prediction or transformation may be performed for each coding block, or a predictive coding mode may be determined for each coding block. Here, the predictive coding mode indicates a method for generating predictive video. For example, the predictive coding mode may include intra prediction (intra prediction), inter prediction (inter prediction), current picture referencing (CPR) or intra block copy (IBC), or combined prediction. A predictive block for a coding block may be generated using at least one predictive coding mode from intra prediction, inter prediction, current picture referencing, or combined prediction for the coding block.

[0080] Information indicating the predictive coding mode of the current block may be signaled via a bitstream. For example, the information may be a 1-bit identifier indicating whether the predictive coding mode is an intra-mode or an inter-mode. Only if the predictive coding mode of the current block is determined to be an inter-mode, can current image reference or hybrid prediction be used.

[0081] The current image reference is used to set the current image as a reference image and obtain a prediction block for the current block from an encoded or decoded region within the current image. Here, the current image refers to an image including the current block. Information indicating whether the current image reference is applied to the current block may be signaled via a bitstream. For example, the information may be a 1-bit identifier. If the identifier is true, the predictive coding mode of the current block may be determined to be the current image reference. If the identifier is false, the prediction mode of the current block may be determined to be inter-prediction.

[0082] Alternatively, the predictive coding mode of the current block may be determined based on the reference image index. As an example, if the reference image index points to the current image, the predictive coding mode of the current block may be determined to be current image reference. If the reference image index points to an image other than the current image, the predictive coding mode of the current block may be determined to be inter prediction. That is, current image reference is a prediction method that uses information of an encoded or decoded region within the current image, and inter prediction is a prediction method that uses information of another encoded or decoded image.

[0083] Hybrid prediction refers to a coding mode that combines two or more of intra prediction, inter prediction, and current image reference. For example, when hybrid prediction is applied, a first predicted block may be generated based on one of intra prediction, inter prediction, or current image reference, and a second predicted block may be generated based on another one. Once the first predicted block and the second predicted block are generated, a final predicted block may be generated through an average or weighted sum operation of the first predicted block and the second predicted block. Information indicating whether hybrid prediction is applied may be signaled via a bitstream. The information may be a 1-bit identifier.

[0084] FIG. 4 is a diagram showing a number of division shapes of a coding block.

[0085] A coding block may be divided into multiple coding blocks based on quad-tree, binary-tree, or triple-tree partitioning, and the divided coding block may be further divided into multiple coding blocks based on quad-tree, binary-tree, or triple-tree partitioning.

[0086] Quadtree partitioning refers to a partitioning method 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 Figure 4).

[0087] Binary tree splitting refers to a splitting method for splitting a current block into two blocks. Splitting the current block into two blocks along the vertical direction (i.e., using a vertical line across the current block) can be referred to as vertical binary tree splitting, and splitting the current block into two blocks along the horizontal direction (i.e., using a horizontal line across the current block) can be referred to as horizontal binary tree splitting. As a result of the binary tree splitting, the current block can be split into two non-square partitions. Figure 4(b) "SPLIT_BT_VER" shows the vertical binary tree split result, and Figure 4(c) "SPLIT_BT_HOR" shows the horizontal binary tree split result.

[0088] Triple tree splitting refers to a splitting method for splitting a current block into three blocks. Splitting the current block into three blocks along the vertical direction (i.e., using two vertical lines crossing the current block) can be referred to as vertical triple tree splitting, and splitting the current block into three blocks along the horizontal direction (i.e., using two horizontal lines crossing the current block) can be referred to as horizontal triple tree splitting. As a result of triple tree splitting, the current block can be split into three non-square partitions. In this case, the width or height of the partition located in the center of the current block can be twice the width or height of the other partitions. (d) "SPLIT_TT_VER" in Figure 4 indicates the vertical triple tree split result, and (e) "SPLIT_TT_HOR" in Figure 4 indicates the horizontal triple tree split result.

[0089] The number of times a coding tree unit is divided can be defined as the partitioning depth. At the sequence level or image level, the maximum partitioning depth of a coding tree unit can be determined. This allows the maximum partitioning depth of a coding tree unit to vary for each sequence or image.

[0090] Alternatively, the maximum splitting depth for each splitting method can be determined separately. As an example, the maximum splitting depth allowing quad-tree splitting can be different from the maximum splitting depth allowing binary tree splitting and / or triple tree splitting.

[0091] The encoder may be signaled by a bitstream with information indicating at least one of the partition shape or partition depth of the current block, and the decoder may determine the partition shape and partition depth of the coding tree unit based on the information parsed from the bitstream.

[0092] FIG. 5 is a diagram showing a division shape of a coding tree unit.

[0093] Partitioning a coding block using partitioning methods such as quad-tree partitioning, binary-tree partitioning, and / or triple-tree partitioning may be referred to as multi-tree partitioning.

[0094] A coding block generated by applying multi-tree partitioning to a coding block may be referred to as a lower coding block. If the partition depth of a coding block is k, the partition depth of the lower coding block is set to k+1.

[0095] Conversely, a coding block with a division depth of k can be referred to as an upper coding block relative to a coding block with a division depth of k+1.

[0096] The partition type of the current coding block may be determined based on at least one of the partition shape of the upper coding block or the partition type of the neighboring coding block. Here, the neighboring coding block may be adjacent to the current coding block and may include at least one of the top neighboring block, the left neighboring block, or the neighboring block adjacent to the upper left corner of the current coding block. Here, the partition type may include at least one of whether or not it is a quad-tree partition, whether or not it is a binary-tree partition, whether or not it is a binary-tree partition direction, whether or not it is a triple-tree partition, or whether or not it is a triple-tree partition direction.

[0097] To determine the partition shape of a coding block, information indicating whether the coding block is split can be signaled via a bitstream. The information is a 1-bit identifier "split_cu_flag", and when the identifier is true, it indicates that the coding block is split according to the quadtree partitioning method.

[0098] If split_cu_flag is true, information on whether the coding block is quad-tree partitioned can be signaled via the bitstream. The information is a 1-bit identifier split_qt_flag, and if the identifier is true, the coding block can be split into four blocks.

[0099] 5, the coding tree unit is illustrated as generating four coding blocks with a division depth of 1 through quad-tree division. Furthermore, it is illustrated that quad-tree division is again applied 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.

[0100] Furthermore, by applying quadtree partitioning again to the coding block with a partition depth of 2, a coding block with a partition depth of 3 can be generated.

[0101] If quad-tree partitioning is not applied to a coding block, it may be determined whether to perform binary tree partitioning or triple tree partitioning on the coding block, taking into account at least one of the size of the coding block, whether the coding block is located on an image boundary, the maximum partition depth, or the partition shape of neighboring blocks. If it is determined to perform binary tree partitioning or triple tree partitioning on the coding block, information indicating the partitioning direction may be signaled via a bitstream. The information may be a 1-bit identifier mtt_split_cu_vertical_flag. Based on the identifier, it may be determined whether the partitioning direction is vertical or horizontal. In addition, information indicating whether binary tree partitioning or triple tree partitioning is applied to the coding block may be signaled via a bitstream. The information may be a 1-bit identifier mtt_split_cu_binary_flag. Based on the identifier, it may be determined whether binary tree partitioning or triple tree partitioning is applied to the coding block.

[0102] As an example, in the example shown in Figure 5, vertical binary tree partitioning is applied to a coding block with a partitioning depth of 1, and vertical triple tree partitioning is applied to the left coding block of the coding blocks generated as a result of the partitioning, and vertical binary tree partitioning is applied to the right coding block.

[0103] Inter-prediction is a predictive coding mode that predicts a current block using information from a previous image. As an example, a block located at the same position as the current block in the previous image (hereinafter referred to as a collocated block) may be set as a prediction block for the current block. Hereinafter, a prediction block generated based on a block located at the same position as the current block will be referred to as a collocated prediction block.

[0104] Conversely, if an object in a previous image moves to another position in a current image, the object's motion can be used to effectively predict the current block. For example, by comparing the previous image with the current image, the object's motion direction and size can be known, and a predicted block (or predicted video) of the current block can be generated according to the object's motion information. Hereinafter, the predicted block generated by the motion information can be referred to as a motion predicted block.

[0105] The predicted block can be subtracted from the current block to generate a residual block, in which case, when an object moves, the motion predicted block is used instead of the collocated predicted block, thereby reducing the energy of the residual block and thereby improving the compression performance of the residual block.

[0106] As described above, generating a predictive block using motion information can be referred to as motion compensated prediction. In most inter predictions, a predictive block can be generated based on motion compensated prediction.

[0107] The motion information may include at least one of a motion vector, a reference image index, a prediction direction, or a bidirectional weight index. The motion vector indicates the movement direction and size of an object. The reference image index indicates the reference image of the current block among the reference images included in the reference image list. The prediction direction refers to one of unidirectional L0 prediction, unidirectional L1 prediction, or bidirectional prediction (L0 prediction and L1 prediction). According to the prediction direction of the current block, at least one of the L0 direction motion information or the L1 direction motion information can be used. The bidirectional weight index can identify the weight applied to the L0 prediction block and the weight applied to the L1 prediction block.

[0108] FIG. 6 is a flowchart of an inter prediction method according to an embodiment of the present application.

[0109] As shown in FIG. 6, the inter prediction method includes determining an inter prediction mode of a current block (S601), obtaining motion information of the current block according to the determined inter prediction mode (S602), and performing motion compensation prediction for the current block based on the obtained motion information (S603).

[0110] Here, the inter prediction mode indicates multiple methods for determining motion information of the current block, and may include an inter prediction mode using translation motion information and an inter prediction mode using affine motion information. For example, the inter prediction mode using translation motion information may include a merge mode and a motion vector prediction mode, and the inter prediction mode using affine motion information may include an affine merge mode and an affine motion vector prediction mode. Depending on the inter prediction mode, the motion information of the current block may be determined based on information analyzed from a neighboring block adjacent to the current block or a bitstream.

[0111] For example, motion information of the current block may be obtained according to motion information of a spatially neighboring block included in the same image as the current block or a collocated block included in an image different from the current block. The spatially neighboring block may include at least one of a block adjacent to the top edge of the current block, a block adjacent to the left side, a block adjacent to the upper left corner, a block adjacent to the upper right corner, or a block adjacent to the lower left corner. The collocated block may have the same position and size as the current block in the reference image. For example, FIG. 7 is a diagram illustrating a collocated block. The reference image may be determined according to the reference image indicated by the index information.

[0112] The accuracy of the motion vector of the current block may be determined as one of multiple motion vector accuracy candidates. For example, the motion vector accuracy candidates may include at least one of octo-pel, quarter-pel, half-pel, integer pel, 2-integer pel, or 4-integer pel. The number or type of motion vector accuracy candidates may be determined according to a sequence, slice, or block unit. For example, information for determining the number or type of motion vector accuracy candidates may be signaled via a bitstream. Alternatively, the number or type of model motion vector accuracy candidates may be determined based on whether the inter prediction mode or affine motion model of the current block is used. Information for identifying one of multiple motion vector accuracy candidates may also be signaled via a bitstream.

[0113] Intra prediction refers to predicting a current block using reconstructed samples that have been coded or decoded around the current block. In this case, the intra prediction of the current block can use reconstructed samples before loop filtering is applied.

[0114] Intra prediction methods include matrix-based intra prediction and normal intra prediction that takes into account the directionality of neighboring reconstructed samples. Information indicating the intra prediction method for the current block may be signaled via a bitstream. The information may be a 1-bit identifier. Alternatively, the intra prediction method for the current block may be determined based on at least one of the position, size, and shape of the current block or the intra prediction method of a neighboring block. For example, if the current block straddles an image boundary, it may be set so that matrix-based intra prediction is not applied to the current block.

[0115] Matrix-based intra prediction is a method of obtaining a prediction block for a current block based on a matrix multiplication between a matrix pre-stored in the encoder and decoder and reconstructed samples surrounding the current block. Information identifying one of multiple pre-stored matrices can be signaled via a bitstream. The decoder can determine a matrix for intra prediction of the current block based on the information and the size of the current block.

[0116] Conventional intra prediction is a method of obtaining a predicted block for a current block based on a non-directional intra prediction mode or a directional intra prediction mode. The following describes in more detail the process of performing intra prediction based on conventional intra prediction with reference to the accompanying drawings.

[0117] FIG. 8 is a flowchart of an intra prediction method according to an embodiment of the present application.

[0118] A reference sample line of a current block may be determined (S801). The reference sample line refers to a set of reference samples included in the line k-th away from the top and / or left end of the current block. The reference samples may be obtained from encoded or decoded reconstructed samples around the current block.

[0119] Index information for identifying a reference sample line of the current block among a plurality of reference sample lines may be signaled via a bitstream. For example, index information intra_luma_ref_idx for identifying a reference sample line of the current block may be signaled via a bitstream. The index information may be signaled in coding block units.

[0120] The plurality of reference sample lines may include at least one of the first, second, third, or fourth lines at the top and / or left side of the current block. A reference sample line formed by a row adjacent to the top of the current block and a column adjacent to the left side of the current block of the plurality of reference sample lines may be referred to as an adjacent reference sample line, and other reference sample lines may be referred to as non-adjacent reference sample lines.

[0121] FIG. 9 is a diagram showing the reference sample line.

[0122] FIG. 9 illustrates one adjacent reference sample line formed by rows or columns adjacent to the current block and three non-adjacent reference sample lines formed by rows or columns not adjacent to the current block.

[0123] Only some of the reference sample lines may be selected as the reference sample lines of the current block. For example, among the reference sample lines shown in FIG. 9, the remaining reference sample lines other than the second non-adjacent reference sample line may be set as candidate reference sample lines. Table 1 shows indexes assigned to each candidate reference sample line.

[0124] [Table 1]

[0125] More or fewer candidate reference sample lines than those described above may also be set. Furthermore, the number or positions of non-adjacent reference sample lines set as candidate reference sample lines is not limited to the examples described above. As an example, the first and third non-adjacent reference sample lines may be set as candidate reference sample lines, or the second and third non-adjacent reference sample lines may be set as candidate reference sample lines. Alternatively, the first, second, and third non-adjacent reference sample lines may all be set as candidate reference sample lines.

[0126] The number or type of candidate reference sample lines may be determined based on at least one of the size, shape, and position of the current block, whether it is divided into sub-blocks, and the intra-prediction mode.

[0127] The reference sample line of the current block may be determined based on at least one of the position, size, and shape of the current block or the predictive coding mode of the neighboring block. For example, if the current block borders a boundary of an image, a tile, a slice, or a coding tree unit, the neighboring reference sample line may be determined as the reference sample line of the current block.

[0128] Alternatively, if the current block is non-square, the adjacent reference sample line may be determined as the reference sample line of the current block, or if the ratio of the width and height of the current block is greater than or equal to a threshold value or less than or equal to a threshold value, the adjacent reference sample line may be determined as the reference sample line of the current block.

[0129] The reference sample line may include a top reference sample located at the top of the current block and a left reference sample located to the left of the current block. The top reference sample and the left reference sample may be obtained from reconstructed samples around the current block. The reconstructed samples may be in a state before applying a loop filter.

[0130] The number of reference samples included in a reference sample line may be determined based on the distance between the reference sample lines. For example, the number of reference samples included in a reference sample line whose distance from the current block is i may be greater than the number of reference samples included in a reference sample line whose distance from the current block is i-1. Therefore, the number of reference samples included in a non-adjacent reference sample line is greater than the number of reference samples included in an adjacent reference sample line.

[0131] The difference between the number of reference samples included in a non-adjacent reference sample line that is at a distance i from the current block and the number of reference samples included in an adjacent reference sample line may be defined as a reference sample quantity offset. In this case, the difference in the number of top reference samples located at the top of the current block may be defined as offsetX[i], and the difference in the number of left reference samples located to the left of the current block may be defined as offsetY[i]. offsetX and offsetY may be determined based on the distance between the current block and the non-adjacent reference sample line. For example, offsetX and offsetY may be set to an integer multiple of i. For example, offsetX[i] and offset[i] may be 2i.

[0132] Alternatively, the reference sample number offset can be determined based on the ratio of the width and height of the current block. Equation 1 shows an example of quantifying the ratio of the width and height of the current block.

number

[0133] Methods other than those shown in Equation 1 can also be used to quantify the width-to-height ratio of the current block.

[0134] The offsetX and offsetY values ​​can be determined based on the ratio of the width and height of the current block. For example, if the value of whRatio is greater than 1, the offsetX value can be set greater than the offsetY value. For example, the offsetX value can be set to 1 and the offsetY value can be set to 0. Conversely, if the value of whRatio is less than 1, the offsetY value can be set greater than the offsetX value. For example, the offsetX value can be set to 0 and the offsetY value can be set to 1.

[0135] In addition to the top-left reference sample having the same x-axis and y-axis coordinates, a non-adjacent reference sample line having a distance i from the current block can be configured by (refW+offsetX[i]) top reference samples and (refH+offsetY[i]) left reference samples, where refW and refH represent the lengths of the adjacent reference sample lines and can be set as shown in Equations 2 and 3 below, respectively.

number

[0136] In Equations 2 and 3, nTbW denotes the width of the coding block or transform block on which intra prediction is performed, and nTbH denotes the height of the coding block or transform block on which intra prediction is performed.

[0137] As a result, a reference sample line having a distance i from the current block can be configured by (refW+refH+offsetX[i]+offsetY[i]+1) reference samples.

[0138] According to the intra prediction mode of the current block, at least one of the reference samples belonging to the reference sample line is used to obtain a prediction sample.

[0139] Next, an intra-prediction mode of the current block may be determined (S802). At least one of a non-directional intra-prediction mode or a directional intra-prediction mode may be determined as the intra-prediction mode of the current block. The non-directional intra-prediction modes include planner and DC, and the directional intra-prediction modes include 33 or 65 modes from the bottom left diagonal to the top right diagonal.

[0140] FIG. 10 is a diagram showing intra prediction modes.

[0141] FIG. 10(a) shows 35 intra prediction modes, and FIG. 10(b) shows 67 intra prediction modes.

[0142] More or fewer intra-prediction modes than those shown in FIG. 10 may be defined.

[0143] A Most Probable Mode (MPM) may be set based on the intra-prediction modes of neighboring blocks adjacent to the current block. Here, the neighboring blocks may include a left neighboring block adjacent to the left side of the current block and a top neighboring block adjacent to the top of the current block. If the coordinates of the top-left sample of the current block are (0,0), the left neighboring block may include a sample at (-1,0), (-1,H-1), or (-1,(H-1) / 2), where H represents the height of the current block. The top neighboring block may include a sample at (0,-1), (W-1,-1), or ((W-1) / 2,-1), where W represents the width of the current block.

[0144] When the neighboring blocks are coded using normal intra prediction, the MPM can be obtained based on the intra prediction modes of the neighboring blocks. Specifically, the intra prediction mode of the left neighboring block can be set to the variable candIntraPredModeA, and the intra prediction mode of the top neighboring block can be set to the variable candIntraPredModeB.

[0145] In this case, if the neighboring block is unavailable (e.g., if the neighboring block has not been coded or decoded or if the neighboring block's position exceeds an image boundary), if the neighboring block is coded with matrix-based intra prediction, if the neighboring block is coded with inter prediction, or if the neighboring block is included in a different coding tree unit from the current block, a variable candIntraPredModeX (where X is A or B) derived based on the intra prediction mode of the neighboring block can be set to a default mode. Here, the default mode may include at least one of planner, DC, vertical mode, or horizontal mode.

[0146] Alternatively, when a neighboring block is coded using intra prediction of a matrix, an intra prediction mode corresponding to an index value for specifying one of the matrices can be set to candIntraPredModeX. Therefore, a lookup table indicating a mapping relationship between index values ​​for specifying a matrix and intra prediction modes can be stored in advance in the encoder and decoder.

[0147] The MPM can be obtained based on the variables candIntraPredModeA and candIntraPredModeB. As an example, candIntraPredModeA and candIntraPredModeB can be set as the MPM, or an intra prediction mode similar to a larger or smaller value of candIntraPredModeA or candIntraPredModeB can be set as the MPM. Here, an intra prediction mode similar to candIntraPredModeX (X is A or B) may be an intra prediction mode whose index difference value from candIntraPredModeX is ±1 or ±2.

[0148] The number of MPMs included in the MPM list can be preset in the encoder and decoder. For example, the number of MPMs can be 3, 4, 5, or 6. Alternatively, information indicating the number of MPMs can be signaled via a bitstream. Alternatively, the number of MPMs can be determined based on at least one of the predictive coding mode of a neighboring block, the size, shape, or reference sample line index of the current block. For example, if a neighboring reference sample line is determined as the reference sample line of the current block, N MPMs can be used. Conversely, if a non-neighboring reference sample line is determined as the reference sample line of the current block, M MPMs can be used. M is a natural number less than N. For example, N can be 6, and M can be 5, 4, or 3. Therefore, if the index of the reference sample line of the current block is 0 and the MPM identifier is true, the intra prediction mode of the current block can be determined to be one of the six candidate intra prediction modes; conversely, if the index of the reference sample line of the current block is greater than 0 and the MPM identifier is true, the intra prediction mode of the current block can be determined to be one of the five candidate intra prediction modes.

[0149] Alternatively, a fixed number of MPM candidates (eg, 6 or 5) can be used regardless of the index of the reference sample line of the current block.

[0150] In the following examples, it is assumed that there are six MPMs, and the six MPMs will be referred to as MPM[0], MPM[1], MPM[2], MPM[3], MPM[4], and MPM[5]. In examples with fewer than six MPMs, the system can be implemented using only some of the six MPMs described in the following examples. Alternatively, in examples with more than six MPMs, the system can be implemented using all six MPMs described in the following examples.

[0151] The initial value of the MPM can be set to candIntraPredModeA and a non-directional intra prediction mode or a directional intra prediction mode different from candIntraPredModeA. Here, the directional intra prediction modes that can be set to the MPM may include at least one of a vertical intra prediction mode, a horizontal intra prediction mode, a bottom left diagonal intra prediction mode, a top left diagonal intra prediction mode, or a top right diagonal intra prediction mode. As an example, the initial value of the MPM can be set as follows:

[0152] MPM[0]=candIntraPredModeA MPM[1]=(candIntraPredModeA==INTRA_PLANAR)?INTRA_DC:INTRA_PLANAR MPM[2]=INTRA_ANGULAR50 MPM[3]=INTRA_ANGULAR18 MPM[4]=INTRA_ANGULAR2 MPM[5]=INTRA_ANGULAR34 In the above example, ((A)?B:C) indicates a function that returns a value B if the condition described in A is true, and returns a value C if the condition described in A is false.

[0153] If candIntraPredModeA is the same as candIntraPredModeB and candIntraPredModeA is a directional intra prediction mode, MPM[0] can be set to candIntraPredModeA, and an intra prediction mode similar to candIntraPredModeA can be set to MPM. An intra prediction mode similar to candIntraPredModeA can be an intra prediction mode whose index difference value from candIntraPredModeA is ±1 or ±2. A modulus operation (%) and an offset can be used to derive an intra prediction mode similar to candIntraPredModeA. Furthermore, at least one of a non-directional intra prediction mode or an intra prediction mode whose angular difference from candIntraPredModeA is a predefined value can be set to MPM. Here, the intra prediction mode whose angular difference from candIntraPredModeA is a predefined value can be an intra prediction mode perpendicular to candIntraPredModeA or an intra prediction mode in the opposite direction to candIntraPredModeA. As an example, the MPM can be obtained as follows:

[0154] MPM[0]=candIntraPredModeA MPM[1]=INTRA_PLANAR MPM[2]=INTRA_DC MPM[3]=2+((candIntraPredModeA+62)%65) MPM[4]=2+((candIntraPredModeA-1)%65) MPM[5]=2+((candIntraPredModeA+94)%65) MPM[3] corresponds to (candIntraPredModeA-1), MPM[4] corresponds to (candIntraPredModeA+1), and MPM[5] indicates an intra prediction mode perpendicular to candIntraPredModeA.

[0155] If candIntraPredModeA is different from candIntraPredModeB, candIntraPredModeA and candIntraPredModeB can be set to MPM[0] and MPM[1], respectively. Alternatively, candIntraPredA can be compared with candIntraPredModeB, and the maximum value can be set to MPM[0] and the minimum value can be set to MPM[1]. Conversely, the minimum value can be set to MPM[0] and the maximum value can be set to MPM[1].

[0156] In this case, if candIntraPredModeA and candIntraPredModeB are both directional intra prediction modes, they can be set to the non-directional intra prediction mode MPM. As an example, planner and DC can be set to MPM[2] and MPM[3], respectively.

[0157] In addition, an intra prediction mode similar to the larger or smaller value of candIntraPredModeA or candIntraPredModeB can be set to the MPM. An intra prediction mode similar to candIntraPredModeX can be obtained by adding or subtracting an offset to candIntraPredModeX. In this case, the maximum size of the offset can be determined based on the difference between the maximum and minimum values ​​of candIntraPredModeA and candIntraPredModeB. As an example, the offset may be a natural number such as 1 or 2.

[0158] As an example, if the value obtained by subtracting MIN(candIntraPredModeA, candIntraPredModeB) from MAX(candIntraPredModeA, candIntraPredModeB) is not 64 or 1, MPM[4] and MPM[5] can be obtained using the following formula.

[0159] MPM[4]=2+((MAX(MPM[0],MPM[1])+62)%65 MPM[5]=2+((MAX(MPM[0],MPM[1])-1)%65 Here, the MAX(A,B) function is a function that returns the larger of A and B, and the MIN(A,B) function is a function that returns the smaller of A and B. MPM[4] corresponds to (MAX(MPM[0],MPM[1])-1), and MPM[5] corresponds to (MAX(MPM[0],MPM[1])+1). Conversely, if the value obtained by subtracting MIN(candIntraPredModeA,candIntraPredModeB) from MAX(candIntraPredModeA,candIntraPredModeB) is 64 or 1, MPM[4] and MPM[5] can be obtained as follows:

[0160] MPM[4]=2+((MAX(MPM[0],MPM[1])+61)%65 MPM[5]=2+(MAX(MPM[0],MPM[1])%65 MPM[4] corresponds to (MAX(MPM[0],MPM[1])-2), and MPM[5] corresponds to (MAX(MPM[0],MPM[1])+2).

[0161] If one of candIntraPredModeA and candIntraPredModeB is a directional intra prediction mode and the other is a non-directional intra prediction mode, at least one of a non-directional intra prediction mode different from MIN(candIntraPredModeA, candIntraPredModeB), a directional intra prediction mode similar to MAX(candIntraPredModeA, candIntraPredModeB), or an intra prediction mode whose angular difference from MAX(candIntraPredModeA, candIntraPredModeB) is a predefined value can be set as MPM. As an example, MPM[2] to MPM[5] can be obtained as follows.

[0162] MPM[2]=!MIN(MPM[0],MPM[1]) MPM[3]=2+((MAX(MPM[0],MPM[1])+62)%65 MPM[4]=2+((MAX(MPM[0],MPM[1])-1)%65 MPM[5]=2+((MAX(MPM[0],MPM[1])+94)%65 MPM[2] indicates a non-directional intra prediction mode different from MPM[0] or MPM[1]. For example, if MIN(MPM[0], MPM[1]) is DC, MPM[2] is set to planner, and if MIN(MPM[0], MPM[1]) is planner, MPM[2] is set to DC. MPM[3] corresponds to ((MAX(MPM[0], MPM[1])-1), and MPM[4] corresponds to (MAX(MPM[0], MPM[1])+1). MPM[5] indicates an intra prediction mode perpendicular to (MAX(MPM[0], MPM[1]). Unlike the above example, an MPM obtained by adding or subtracting 2 from (MAX(MPM[0], MPM[1]) can also be added to the MPM list.

[0163] If one of candIntraPredA and candIntraPredB is a non-directional intra mode and the other is a directional intra prediction mode, that is, if one of candIntraPredA and PredIntraPredB is less than 2 and the other is greater than or equal to 2, the maximum value of candIntraPredA and candIntraPredB can be set as MPM. Furthermore, an intra prediction mode similar to the maximum value or an intra prediction mode perpendicular to the maximum value can be set as MPM. As an example, MPM[0] to MPM[5] can be obtained as follows:

[0164] MPM[0]=MAX(candIntraPredA,candIntraPredB) MPM[1]=INTRA_PLANAR MPM[2]=INTRA_DC MPM[3]=2+((MAX(candIntraPredA,candIntraPredB)+62)%65 MPM[4]=2+((MAX(candIntraPredA,candIntraPredB])-1)%65 MPM[5]=2+((MAX(candIntraPredA,candIntraPredB)+94)%65 MPM[3] corresponds to (MAX(candIntraPredA, candIntraPredB)-1), and MPM[4] corresponds to (MAX(candIntraPredA, candIntraPredB)+1). MPM[5] indicates an intra prediction mode perpendicular to (MAX(candIntraPredA, candIntraPredB). Unlike the above example, an MPM obtained by adding or subtracting 2 from (MAX(candIntraPredA, candIntraPredB) can also be added to the MPM list.

[0165] The MPM can be obtained by considering the index of the reference sample line of the current block. In particular, if a non-adjacent reference sample line is determined to be the reference sample line of the current block, a non-directional prediction mode such as planner or DC does not need to be set as the MPM. As an example, the initial value of the MPM 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:

[0166] MPM[0]=(IntraLumaRefLineIdx==0)?candIntraPredModeA:INTRA_ANGULAR2 MPM[1]=(IntraLumaRefLineIdx==0)?(candIntraPredModeA:==INTRA_PLANAR?INTRA_DC:INTRA_PLANAR):INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR50 MPM[3]=(IntraLumaRefLineIdx==0)?INTRA_ANGULAR18:INTRA_ANGULAR34 MPM[4]=(IntraLumaRefLineIdx==0)?INTRA_ANGULAR2:INTRA_ANGULAR66 MPM[5]=(IntraLumaRefLineIdx==0)?INTRA_ANGULAR34:INTRA_ANGULAR42 If the reference sample line of the current block is a non-adjacent reference sample line and candIntraPredModeA and candIntraPredModeB are both directional intra prediction modes, the MPM can be obtained as follows:

[0167] MPM[0]=candIntraPredModeA MPM[1]=candIntraPredModeB MPM[2]=INTRA_ANGULAR2 MPM[3]=INTRA_ANGULAR18 MPM[4]=INTRA_ANGULAR50 MPM[5]=INTRA_ANGULAR34 If the reference sample line of the current block is a non-adjacent reference sample line, and one of candIntraPredModeA and candIntraPredModeB is a non-directional intra prediction mode and another one is a directional intra prediction mode, the MPM can be obtained as follows:

[0168] MPM[0]=MAX(candIntraPredModeA,candIntrapredModeB) MPM[1]=INTRA_ANGULAR2 MPM[2]=INTRA_ANGULAR18 MPM[3]=INTRA_ANGULAR50 MPM[4]=INTRA_ANGULAR34 MPM[5]=INTRA_ANGULAR66 After generating an MPM list including multiple MPMs, information indicating whether the MPM list includes the same MPM as the intra prediction mode of the current block is signaled via the bitstream. An identifier having one bit of the information may be referred to as an MPM identifier. If the MPM identifier indicates that the same MPM as the current block is included in the MPM list, index information identifying one of the MPMs may be signaled via the bitstream. For example, index information mpm_idx identifying one of the multiple MPMs may be signaled via the bitstream. The MPM identified by the index information may be set as the intra prediction mode of the current block. If the MPM identifier indicates that the same MPM as the current block is not included in the MPM list, residual mode information indicating one of the residual intra prediction modes other than the MPM may be signaled via the bitstream. When the residual mode information reallocates an index to a residual intra prediction mode other than the MPM, the index value corresponds to the intra prediction mode of the current block. The decoder may arrange the MPMs in ascending order and compare the residual mode information with the MPMs to determine the intra prediction mode of the current block. For example, if the residual mode information is equal to or less than the MPM, the decoder may add 1 to the residual mode information to obtain the intra prediction mode of the current block.

[0169] When obtaining the intra-prediction mode of the current block, comparison of some of the MPMs with the residual mode information can be skipped. As an example, an MPM used as a non-directional intra-prediction mode of the MPM can be excluded from comparison. When a non-directional intra-prediction mode is set to an MPM, it is clear that the residual mode information refers to a directional intra-prediction mode. Therefore, the intra-prediction mode of the current block can be obtained by comparing residual MPMs other than the non-directional intra-prediction mode with the residual mode information. Instead of excluding the non-directional intra-prediction mode from comparison, the number of non-directional intra-prediction modes can be added to the residual mode information, and then the resulting value can be compared with the residual MPM.

[0170] Instead of setting the default mode to an MPM, information indicating whether the intra prediction mode of the current block is the default mode may be signaled via a bitstream. The information may be a 1-bit identifier, and the identifier may be referred to as a default mode identifier. The default mode identifier may be signaled only if the MPM identifier indicates that the same MPM as that of the current block is included in the MPM list. As described above, the default mode may include at least one of planner, DC, vertical mode, or horizontal mode. As an example, if planner is set as the default mode, the default mode identifier may indicate whether the intra prediction mode of the current block is planner. If the default mode identifier indicates that the intra prediction mode of the current block is not the default mode, one of the multiple MPMs indicated by the index information may be set as the intra prediction mode of the current block.

[0171] When using a default mode identifier, the same intra prediction mode as the default mode may be set so that it is not set in the MPM. For example, if the default mode identifier indicates whether the intra prediction mode of the current block is planner, the MPM corresponding to planner among the above six MPMs may be replaced with another mode, or five MPMs other than the MPM corresponding to planner may be used to obtain the intra prediction mode of the current block.

[0172] When multiple intra prediction modes are set as a default mode, index information indicating one of the default modes may be signaled, and the intra prediction mode of the current block may be set as the default mode indicated by the index information.

[0173] If the index of the reference sample line of the current block is not 0, the default mode may be set not to be used. As an example, if it is determined that a non-adjacent reference sample line is the reference sample line of the current block, a non-directional intra prediction mode such as DC mode or planner mode may be set not to be used. Therefore, if the index of the reference sample line is not 0, the default mode identifier may not be signaled, and the value of the default mode identifier may be set to a predefined value (i.e., false).

[0174] After the intra-prediction mode of the current block is determined, a prediction sample for the current block can be obtained based on the determined intra-prediction mode (S803).

[0175] When the DC mode is selected, the predicted sample for the current block can be generated based on the average value of the reference samples. Specifically, the values ​​of all samples in the predicted block can be generated based on the average value of the reference samples. The average value can be obtained based on at least one of the top reference sample located at the top of the current block and the left reference sample located to the left of the current block.

[0176] The number or range of reference samples used to obtain the average value varies depending on the shape of the current block. For example, if the current block is a non-square block whose width is greater than its height, the average value can be calculated using only the top reference sample. Conversely, if the current block is a non-square block whose width is less than its height, the average value can be calculated using only the left reference sample. That is, if the width of the current block is different from its height, the average value can be calculated using only the reference sample 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 sample or only the left reference sample.

[0177] When the planner mode is selected, a prediction sample can be obtained using a horizontal prediction sample and a vertical prediction sample. Here, the horizontal prediction sample is obtained based on a left reference sample and a right reference sample located on the same horizontal line as the prediction sample, and the vertical prediction sample is obtained based on a top reference sample and a bottom reference sample located on the same vertical line as the prediction sample. Here, the right reference sample can be generated by duplicating a reference sample adjacent to the upper right corner of the current block, and the bottom reference sample can be generated by duplicating a reference sample adjacent to the lower left corner of the current block. The horizontal prediction sample can be obtained based on a weighted sum operation between the left reference sample and the right reference sample, and the vertical prediction sample can be obtained based on a weighted sum operation between the top reference sample and the bottom reference sample. In this case, the weight corresponding to each reference sample can be determined according to the position of the prediction sample. The prediction sample can be obtained based on an average operation or a weighted sum operation between the horizontal prediction sample and the vertical prediction sample. When performing the weighted sum operation, the weights to be assigned to the horizontal prediction sample and the vertical prediction sample can be determined based on the position of the prediction sample.

[0178] When a directional prediction mode is selected, a parameter can be determined to indicate the prediction direction (or prediction angle) of the selected directional prediction mode. Table 2 below shows the intra direction parameter intraPredAng for each intra prediction mode.

[0179] [Table 2]

[0180] Table 2 shows the intra direction parameters for each intra prediction mode 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 direction parameters for each directional intra prediction mode.

[0181] After aligning the top reference sample and the left reference sample of the current block, a predicted sample can be obtained based on the value of the intra direction parameter, where if the value of the intra direction parameter is negative, the left reference sample and the top reference sample are aligned.

[0182] 11 and 12 are diagrams showing examples of one-dimensional arrays in which reference samples are arranged in a row.

[0183] 11 shows an example of a one-dimensional vertical array in which reference samples are arranged along the vertical direction, and FIG. 12 shows an example of a one-dimensional horizontal array in which reference samples are arranged along the horizontal direction. The examples of FIG. 11 and FIG. 12 will be described assuming that 35 intra prediction modes are defined.

[0184] If the intra prediction mode index is any of 11 to 18, a horizontal one-dimensional array in which the top reference sample is rotated counterclockwise can be applied, and if the intra prediction mode index is any of 19 to 25, a vertical one-dimensional array in which the left reference sample is rotated clockwise can be applied. The reference samples can be aligned according to the angle of the intra prediction mode.

[0185] Based on the intra direction parameters, reference sample determination parameters can be determined, which may include a reference sample index for identifying the reference sample and a weight parameter for determining a weight to be applied to the reference sample.

[0186] Reference sample index iIdx and weight parameter i fact can be obtained using the following equations 4 and 5, respectively.

number

[0187] In equations 4 and 5, P angdenotes an intra direction parameter. The reference sample identified according to the reference sample index iIdx corresponds to an integer pixel (Integer pel).

[0188] At least one reference sample may be identified to obtain the predicted sample. Specifically, the position of the reference sample used to obtain the predicted sample may be identified taking into account the gradient of the prediction mode. For example, the reference sample index iIdx may be used to identify the reference sample used to obtain the predicted sample.

[0189] In this case, if the slope of the intra prediction mode is not represented by 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 a first reference sample and the slope between the prediction sample and a second reference sample, the prediction sample can be obtained by interpolating the first and second reference samples. That is, if an angular line based on the intra prediction angle does not pass through a reference sample located at an integer pixel, the prediction sample can be obtained by interpolating reference samples located at positions adjacent to the left, right, top, or bottom of the position where the angular line passes.

[0190] Equation 6 below shows an example of obtaining a predicted sample based on a reference sample.

number

[0191] In Equation 6, P denotes a predicted sample, and Ref_1D denotes one of the reference samples in the one-dimensional array, where the position of the reference sample can be determined according to the position (x, y) of the predicted sample and the reference sample index iIdx.

[0192] If the gradient of the intra prediction mode is represented by one reference sample, the weight parameter ifact is set to 0. Therefore, Equation 6 can be simplified as shown in Equation 7 below.

number

[0193] Intra prediction for the current block may also be performed based on multiple intra prediction modes. For example, the intra prediction mode may be obtained according to the prediction samples, and the prediction samples may be obtained based on the intra prediction mode assigned to each prediction sample.

[0194] Alternatively, an intra-prediction mode may be obtained according to a 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 a current block. Alternatively, at least one of the size or shape of the region may be predefined in the encoder and decoder, independent of the size or shape of the current block.

[0195] Alternatively, intra prediction may be performed based on multiple intra predictions, and a final prediction sample may be obtained based on an average or weighted sum of multiple prediction samples obtained through the multiple intra predictions. For example, intra prediction may be performed based on a first intra prediction mode to obtain a first prediction sample, and intra prediction may be performed based on a second intra prediction mode to obtain a second prediction sample. The final prediction sample may then be obtained based on an average or weighted sum of the first and second prediction samples. In this case, the weights assigned to the first and second prediction samples may be determined based on at least one of whether the first intra prediction mode is a non-directional or directional prediction mode, whether the second intra prediction mode is a non-directional or directional prediction mode, or the intra prediction mode of a neighboring block.

[0196] The multiple intra-prediction modes may be a combination of a non-directional intra-prediction mode and a directional prediction mode, a combination of a directional prediction mode, or a combination of a non-directional prediction mode.

[0197] FIG. 13 is a diagram illustrating angles formed by directional intra prediction modes with a line parallel to the X axis.

[0198] As shown in the example of Figure 13, the directional prediction mode can exist between the bottom left diagonal direction and the top right diagonal direction. In terms of the angle at which the directional prediction mode is formed relative to the x-axis, the directional prediction mode can exist between 45 degrees (bottom left diagonal direction) and -135 degrees (top right diagonal direction).

[0199] If the current block is non-square, a situation may arise in which, according to the intra prediction mode of the current block, a reference sample farther from the prediction sample is used to obtain a prediction sample instead of a reference sample closer to the prediction sample of a reference sample located on a corner line according to the intra prediction angle.

[0200] FIG. 14 is a schematic diagram of how prediction samples are obtained when the current block is non-square.

[0201] As an example, assume that the current block is a non-square block with a width greater than its height, and the intra prediction mode of the current block is a directional intra prediction mode with an angle between 0 and 45 degrees, as shown in (a) of Figure 14. In this case, when obtaining a prediction sample A near the right column of the current block, a situation may occur in which, among reference samples located in an angle mode according to the angle, a left reference sample L far from the prediction sample is used instead of an upper reference sample T close to the prediction sample.

[0202] As another example, assume that the current block is a non-square block with its height greater than its width, and the intra prediction mode of the current block is a directional intra prediction mode between -90 degrees and -135 degrees, as shown in (b) of Figure 14. In this case, when obtaining a prediction sample A near the bottom row of the current block, a situation may occur in which, among reference samples located in an angle mode according to the angle, the top reference sample T far from the prediction sample is used instead of the left reference sample L close to the prediction sample.

[0203] To solve the above problem, if the current block is non-square, the intra prediction mode of the current block can be replaced with an intra prediction mode of the opposite direction. Therefore, for non-square blocks, a directional prediction mode having an angle larger or smaller than the directional prediction mode shown in FIG. 10 can be used. Such a directional intra prediction mode can be defined as a wide-angle intra prediction mode. A wide-angle intra prediction mode refers to a directional intra prediction mode that is not within the range of 45 degrees to -135 degrees.

[0204] FIG. 15 is a diagram illustrating a wide-angle intra prediction mode.

[0205] In the example shown in FIG. 15, intra prediction modes with indexes between −1 and −14 and intra prediction modes with indexes between 67 and 80 indicate wide-angle intra prediction modes.

[0206] Figure 15 illustrates 14 wide-angle intra-prediction modes (-1 to -14) with angles greater than 45 degrees and 14 wide-angle intra-prediction modes (67 to 80) with angles less than -135 degrees, but a greater or lesser number of wide-angle intra-prediction modes may be defined.

[0207] When using a wide-angle intra prediction mode, the length of the top reference sample can be set to 2W+1, and the length of the left reference sample can be set to 2H+1.

[0208] 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.

[0209] In addition to the original intra prediction mode and the N wide-angle intra prediction modes, a total of 67+N intra prediction modes can be used. As an example, Table 3 shows the intra direction parameters of the intra prediction modes when defining 20 wide-angle intra prediction modes.

[0210] [Table 3]

[0211] If the current block is non-square and the intra prediction mode of the current block obtained in S802 belongs to a transform range, the intra prediction mode of the current block may be transformed to a wide-angle intra prediction mode. The transform range may be determined based on at least one of the size, shape, and ratio of the current block, where the ratio represents the ratio between the width and height of the current block.

[0212] If the current block is non-square, with its width greater than its height, the transform range may be set to the upper right diagonal intra-prediction mode index (e.g., 66) through (the upper right diagonal intra-prediction mode index, −N), where N may be determined based on the ratio of the current block. If the intra-prediction mode of the current block belongs to the transform range, the intra-prediction mode may be converted to a wide-angle intra-prediction mode. The conversion may be performed by subtracting a predefined value from the intra-prediction mode, where the predefined value may be the sum of the intra-prediction modes other than the wide-angle intra-prediction mode (e.g., 67).

[0213] According to the above embodiment, the intra prediction modes between 66 and 53 can be converted to wide-angle intra prediction modes between -1 and -14, respectively.

[0214] If the current block is non-square and its height is greater than its width, the transform range may be set to the bottom-left diagonal intra-prediction mode index (e.g., 2) through (bottom-left diagonal intra-prediction mode index +M), where M may be determined based on the ratio of the current block. If the intra-prediction mode of the current block belongs to the transform range, the intra-prediction mode may be converted to a wide-angle intra-prediction mode. The conversion may be performed by adding a predefined value to the intra-prediction mode, and the predefined value may be the sum of the directional intra-prediction modes other than the wide-angle intra-prediction mode (e.g., 65).

[0215] According to the above embodiment, each of the intra prediction modes between No. 2 and No. 15 can be converted into a wide-angle intra prediction mode between No. 67 and No. 80.

[0216] Hereinafter, the intra prediction modes belonging to the transform range are referred to as wide-angle intra alternative prediction modes.

[0217] The transform range can be determined based on the ratio of the current block. As an example, Tables 4 and 5 show the transform ranges when 35 intra prediction modes other than the wide-angle intra prediction mode are defined and when 67 intra prediction modes are defined, respectively.

[0218] [Table 4]

[0219] [Table 5]

[0220] As shown in Tables 4 and 5, the number of wide-angle intra alternative prediction modes included in the transform range may vary depending on the proportion of the current block.

[0221] The ratio of the current block can be further subdivided to set the conversion range as shown in Table 6 below.

[0222] [Table 6]

[0223] When a non-adjacent reference sample line is determined as the reference sample line of the current block, or when a multi-line intra prediction coding method is selected from multiple reference sample lines, the wide-angle intra prediction mode may be set not to be used. That is, even if the current block is non-square and the intra prediction mode of the current block belongs to the conversion range, the intra prediction mode of the current block may not be converted to the wide-angle intra prediction mode.

[0224] Alternatively, if the intra prediction mode of the current block is determined to be a wide-angle intra prediction mode, a non-adjacent reference sample line is set as not usable as a reference sample line of the current block, or if a multi-line intra prediction coding method that selects one of multiple reference sample lines is not used, an adjacent reference sample line can be determined as a reference sample line of the current block.

[0225] When the wide-angle intra prediction mode is not used, refW and refH may be set to the sum of nTbW and nTbH. Therefore, in addition to the top-left reference sample, non-adjacent reference samples that are 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 that are 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 may be set greater than the value of offsetY. For example, the value of offsetX may be set to 1, and the value of offsetY may be set to 0. Conversely, if the value of whRatio is less than 1, the value of offsetY may be set greater than the value of offsetX. As an example, the value of offsetX can be set to 0 and the value of offsetY can be set to 1.

[0226] When a wide-angle intra prediction mode is added to an original intra prediction mode and used, the resources required to encode the wide-angle intra prediction mode increase, resulting in a decrease in coding efficiency. Therefore, instead of directly encoding the wide-angle intra prediction mode, coding an alternative intra prediction mode for the wide-angle intra prediction mode can improve coding efficiency.

[0227] For example, when the current block is encoded using wide-angle intra prediction mode 67, the intra prediction mode of the current block may be encoded as wide-angle alternative intra prediction mode 2 of 67. Furthermore, when the current block is encoded in wide-angle intra prediction mode −1, the intra prediction mode of the current block may be encoded as wide-angle alternative intra prediction mode 66 of −1.

[0228] The decoder may decode the intra-prediction mode of the current block and determine whether the decoded intra-prediction mode is included in the transform range. If the decoded intra-prediction mode is a wide-angle alternative intra-prediction mode, the decoder may convert the intra-prediction mode to a wide-angle intra-prediction mode.

[0229] Alternatively, if the current block is coded in a wide-angle intra-prediction mode, the wide-angle intra-prediction mode may be coded as is.

[0230] The encoding of the intra prediction mode can be realized based on the above MPM list. Specifically, if a neighboring block is encoded in a wide-angle intra prediction mode, the MPM can be set based on a wide-angle alternative intra prediction mode corresponding to the wide-angle intra prediction mode. For example, if the neighboring block is encoded in a wide-angle intra prediction mode, the variable candIntraPredModeX (X is A or B) can be set as the alternative intra prediction mode for the wide-angle intra prediction mode.

[0231] Alternatively, the MPM may be set based on the wide-angle intra prediction mode of the neighboring block. For example, if the neighboring block is coded in a wide-angle intra prediction mode, the variable candIntraPredModeX may be set to the wide-angle intra prediction mode.

[0232] The MPM can be obtained based on whether the reference sample line of the current block is a non-adjacent reference sample line or whether a multi-line intra prediction coding method in which one of multiple reference sample lines is selected 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 can be set as the MPM of the current block.

[0233] As an example, if candIntraPredModeA obtained based on the intra prediction mode of the left adjacent block is the same as candIntraPredModeB obtained based on the intra prediction mode of the upper adjacent block, and candIntraPredModeA is planner or DC, the MPM can be obtained as follows, taking into account whether the index of the reference sample line of the current block is 0 or not.

[0234] MPM[0]=(IntraLumaRefLineIdx==0)?Intra_Planar:INTRA_ANGULAR50 MPM[1]=(IntraLumaRefLineIdx==0)?Intra_DC:INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR2 That is, if the reference sample line index of the current block is 0, the planner mode and DC mode are set to MPM, and conversely, if the reference sample line index of the current block is not 0, the vertical intra prediction mode (INTRA_ANGULAR50) and horizontal intra prediction mode (INTRA_ANGULAR18) can be set to MPM.

[0235] If the index of the reference sample line of the current block is not 0 and candIntraPredModeA is the same as candIntraPredModeB, but candIntraPredModeA is a wide-angle intra prediction mode, the MPM can be obtained as follows:

[0236] MPM[0]=INTRA_ANGULAR2 MPM[1]=INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR50 Alternatively, you can get the MPM as follows:

[0237] MPM[0]=INTRA_ANGULAR50 MPM[1]=INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR2 That is, if the reference sample line index of the current block is not 0, the wide-angle intra prediction mode does not need to be set to MPM.

[0238] If candIntraPredModeA is the same as candIntraPredModeB, and candIntraPredModeA is a directional intra prediction mode, the MPM can be obtained as follows:

[0239] MPM[0]=candIntraPredModeA MPM[1]=2+((candIntraPredModeA+61)%64) MPM[2]=2+((candIntraPredModeA-1)%64) If the index of the reference sample line of the current block is 0 and candIntraPredModeA is different from candIntraPredModeB, MPM[0] and MPM[1] can be set to candIntraPredModeA and candIntraPredModeB, respectively. MPM[2] can be set to be different from MPM[0] and MPM[1] for planner, DC, and vertical modes.

[0240] If the index of the reference sample line of the current block is not 0, and one of candIntraPredModeA and candIntraPredModeB is planner and another one is DC, the MPM can be obtained as follows:

[0241] MPM[0]=INTRA_ANGULAR2 MPM[1]=INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR50 If the index of the reference sample line of the current block is not 0 and candIntraPredModeA and candIntraPredModeB are both wide-angle intra prediction modes, the MPM can be obtained as follows:

[0242] MPM[0]=INTRA_ANGULAR2 MPM[1]=INTRA_ANGULAR18 MPM[2]=INTRA_ANGULAR50 If the index of the reference sample line of the current block is not 0 and one of candIntraPredModeA and candIntraPredModeB is a wide-angle intra prediction mode, MPM[0] can be set to the non-wide-angle intra prediction mode of candIntraPredModeA or candIntraPredModeB, and MPM[1] and MPM[2] can be set to intra prediction modes similar to MPM[0]. As an example, if candIntraPredModeA is a non-wide-angle intra prediction mode and candIntraPredModeB is a wide-angle intra prediction mode, MPM can be obtained as follows:

[0243] MPM[0]=candIntraPredModeA MPM[1]=2+((candIntraPredModeA+61)%64) MPM[2]=2+((candIntraPredModeA-1)%64) Conversely, if candIntraPredModeA is a wide-angle intra prediction mode and candIntraPredModeB is a non-wide-angle intra prediction mode, the MPM can be obtained as follows:

[0244] MPM[0]=candIntraPredModeB MPM[1]=2+((candIntraPredModeB+61)%64) MPM[2]=2+((candIntraPredModeB-1)%64) If the index of the reference sample line of the current block is not 0, and one of candIntraPredModeA and candIntraPredModeB is planner or DC, and the other is a non-wide-angle intra prediction mode, the non-wide-angle intra prediction mode of candIntraPredModeA and candIntraPredModeB can be set to MPM[0], and intra prediction modes similar to MPM[0] can be set to MPM[1] and MPM[2]. As an example, if candIntraPredModeA is a non-wide-angle intra prediction mode and candIntraPredModeB is planner or DC, MPM can be obtained as follows:

[0245] MPM[0]=candIntraPredModeA MPM[1]=2+((candIntraPredModeA+61)%64) MPM[2]=2+((candIntraPredModeA-1)%64) Conversely, if candIntraPredModeA is planner or DC and candIntraPredModeB is a non-wide-angle intra prediction mode, the MPM can be obtained as follows:

[0246] MPM[0]=candIntraPredModeB MPM[1]=2+((candIntraPredModeB+61)%64) MPM[2]=2+((candIntraPredModeB-1)%64) If the index of the reference sample line of the current block is not 0 and candIntraPredModeA and candIntraPredModeB are both non-wide-angle intra prediction modes, candIntraPredModeA and candIntraPredModeB can be set to MPM[0] and MPM[1], respectively. MPM[2] can be set to any one of the vertical intra prediction mode (INTRA_ANGULAR50), horizontal intra prediction mode (INTRA_ANGULAR18), or bottom-left diagonal intra prediction mode (INTRA_ANGULAR2) that does not overlap with MPM[0] and MPM[1].

[0247] A coding block or a transform block can be divided into multiple sub-blocks (or sub-partitions). When a coding block or a transform block is divided into multiple sub-blocks, prediction, transformation, and quantization can be performed on each sub-block. Dividing a coding block or a transform block into multiple sub-blocks can be defined as a sub-partition intra-coding method.

[0248] Information indicating whether a sub-partition intra-coding method is applied may be signaled via a bitstream. The information may be a 1-bit identifier. As an example, a syntax element 'intra_subpartitions_mode_flag' indicating whether a coding block or a transform block is divided into multiple sub-blocks may be signaled via a bitstream.

[0249] Alternatively, whether or not to apply the sub-partition intra-coding method may be determined based on at least one of the size, shape, or intra-prediction mode of the coding block or transform block. As an example, if the intra-prediction mode of the coding block is a non-directional intra-prediction mode (e.g., planner or DC) or a predefined directional intra-prediction mode (e.g., horizontal intra-prediction mode, vertical intra-prediction mode, or diagonal intra-prediction mode), the sub-partition intra-coding method may not be applied. Alternatively, if the size of the coding block is smaller than a threshold, the sub-partition intra-coding method may be set not to be used.

[0250] Alternatively, when intra prediction of a sub-block is performed based on the intra prediction mode of a coding block, whether or not to apply the sub-partition intra-coding method may be determined based on whether or not it is necessary to use reconstructed samples included in neighboring sub-blocks as reference samples during 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 neighboring sub-blocks cannot be used as reference samples when intra prediction of a sub-block is performed based on the intra prediction mode, it may be set not to use the sub-partition intra-coding method.

[0251] Alternatively, the sub-partition intra-coding method may be set not to be used if the ratio of the height to the width of the coding block is equal to or greater than a threshold. Alternatively, the sub-partition intra-coding method may not be used if at least one of the height or width of the coding block is equal to or less than a threshold. For example, the sub-partition intra-coding method may not be used if both the height and width of the coding block are equal to or less than a threshold. The threshold may have a predefined value for the encoder and decoder. Alternatively, information for determining the threshold may be signaled via a bitstream.

[0252] Alternatively, whether to signal an identifier indicating whether to apply a sub-partition intra-coding method may be determined according to at least one of the size, shape, and intra-prediction mode of a coding block or a transform block. As an example, only when both the height and width of a coding block are equal to or smaller than a threshold and / or when the size of a coding block is equal to or larger than a threshold, an identifier indicating whether to apply a sub-partition intra-coding method may be coded and signaled. If an identifier indicating whether to apply a sub-partition intra-coding method is not coded, the sub-partition intra-coding method may not be applied.

[0253] When applying the sub-partition intra-coding method, a partition shape of a coding block or a transform block can be determined. Here, the partition shape indicates the partition direction of the coding block or the transform block. For example, vertical partitioning refers to dividing the coding block or the transform block using at least one vertical line, and horizontal partitioning refers to dividing the coding block or the transform block using at least one horizontal line.

[0254] FIG. 16 is a diagram showing an example of vertical partitioning and horizontal partitioning.

[0255] FIG. 16(a) shows an example in which a coding block is divided into two sub-blocks, and FIG. 16(b) shows an example in which a coding block is divided into four sub-blocks.

[0256] Information for determining the partition shape of a coding block and a transform block may be signaled via a bitstream. For example, information indicating whether a coding block or a transform block is partitioned vertically or horizontally may be signaled via a bitstream. The information may be a 1-bit identifier intra_subpart_type_flag. A value of 1 in the identifier indicates that the coding block or the transform block is partitioned horizontally, and a value of 0 in the identifier indicates that the coding block or the transform block is partitioned vertically.

[0257] Alternatively, the partition shape of the coding block or transform block may be determined based on the size, shape, or intra prediction mode of the coding block or transform block. As an example, the partition shape of the coding block may be determined based on the ratio between the width and height of the coding block. For example, if a whRatio value indicating the ratio between the width and height of the coding block is equal to or greater than a first threshold, vertical partitioning may be applied to the coding block. Otherwise, horizontal partitioning may be applied to the coding block.

[0258] FIG. 17 is a diagram showing an example of determining the division shape of a coding block.

[0259] For convenience of explanation, the first threshold is assumed to be 2. In the example shown in (a) of FIG. 17, the whRatio of the coding block is 1, which is smaller than the first threshold. Therefore, coding of the information indicating the coding block partition shape can be skipped, and horizontal partitioning can be applied to the coding block.

[0260] In the example shown in (b) of Figure 17, the whRatio of the coding block is 2, which is the same as the first threshold. Therefore, coding of the information representing the coding block partition shape can be skipped, and vertical partitioning can be applied to the coding block.

[0261] A second threshold value opposite to the symbol of the first threshold value can also be used to determine the partition shape of the coding block. As an example, if the whRatio value is equal to or less than the second threshold value, horizontal partitioning can be applied to the coding block; otherwise, vertical partitioning can be applied to the coding block. The absolute values ​​of the first threshold value and the second threshold value can be the same, and their symbols can be different. As an example, if the first threshold value is N (where N is an integer such as 1, 2, 4, etc.), the second threshold value can be −N.

[0262] FIG. 18 is a diagram showing an example of determining the division shape of a coding block.

[0263] For convenience of explanation, it is assumed that the second threshold is −2. In the example shown in (a) of FIG. 18, the whRatio of the coding block is −1, which is greater than the second threshold. Therefore, coding of the information indicating the coding block partition shape can be skipped, and vertical partitioning can be applied to the coding block.

[0264] In the example shown in (b) of Figure 18, the whRatio of the coding block is -2, which is the same as the second threshold, so coding of the information indicating the coding block partition shape can be skipped and horizontal partitioning can be applied to the coding block.

[0265] Alternatively, the partition shape of the coding block may be determined based on a first threshold and a second threshold. For example, if the value of whRatio is equal to or greater than the first threshold, horizontal partitioning may be adopted for the coding block, and if the value of whRatio is equal to or less than the second threshold, vertical partitioning may be adopted for the coding block. If the value of whRatio is between the first and second thresholds, information may be analyzed from the bitstream to determine the partition shape of the current block.

[0266] The first and second thresholds can be predefined in the encoder and decoder, or the first and second thresholds can be defined according to a sequence, an image, or a slice.

[0267] Alternatively, the partition shape can be determined based on the size of the coding block or the transform block. As an example, if the size of the coding block is N×n, vertical partitioning can be applied, and if the size of the coding block is n×N, horizontal partitioning can be applied. Here, n may be a natural number smaller than N. N and / or n may be values ​​predefined in the encoder and decoder. Alternatively, information for determining N and / or n may be signaled via a bitstream. As an example, N may be 32, 64, 128, or 256, etc. Therefore, if the size of the coding block is 128×n (where n is a natural number such as 16, 32, or 64), vertical partitioning can be applied, and if the size of the coding block is n×128, horizontal partitioning can be applied.

[0268] Alternatively, the partition shape of the coding block or transform block may be determined based on the intra prediction mode of the coding block or transform block. As an example, if the intra prediction mode of the coding block is horizontal or a horizontally similar direction, vertical partitioning may be applied to the coding block. Here, the horizontally similar intra prediction mode indicates an intra prediction mode (e.g., INTRA_ANGULAR18±N) whose index difference from the horizontal intra prediction mode (e.g., INTRA_ANGULAR18 shown in (b) of FIG. 10) is equal to or less than a threshold. Conversely, if the intra prediction mode of the coding block is vertical or a vertically similar direction, horizontal partitioning may be applied to the coding block. Here, the vertically similar intra prediction mode indicates an intra prediction mode (e.g., INTRA_ANGULAR50±N) whose index difference from the vertical intra prediction mode (e.g., INTRA_ANGULAR50 shown in (b) of FIG. 10) is equal to or less than a threshold. Here, the threshold N may be a value predefined in the encoder and decoder. Alternatively, the information for determining the threshold N can be signaled from the sequence level, the image level, or the slice level.

[0269] FIG. 19 is a schematic diagram of an example of determining the partition shape of a coding block based on the intra prediction mode of the coding block.

[0270] As shown in (a) of FIG. 19, when the intra prediction mode of a coding block has a similar direction to the vertical direction, horizontal partitioning can be applied to the coding block.

[0271] Conversely, as shown in (b) of FIG. 19, when the intra prediction mode of a coding block has a similar direction to the horizontal direction, vertical partitioning can be applied to the coding block.

[0272] Unlike the illustrated example, horizontal partitioning can be applied if the intra prediction mode of the coding block is horizontal or a horizontally similar direction, and vertical partitioning can also be applied if the intra prediction mode of the coding block is vertical or a vertically similar direction.

[0273] When vertical partitioning or horizontal partitioning is applied, the partition shape of the coding block or transform block can be determined based on whether at least one of the width or height of the sub-blocks generated by dividing the coding block or transform block is smaller than a threshold, where the threshold can be an integer such as 2, 4, or 8.

[0274] FIG. 20 is a schematic diagram for explaining the division shape of a coding block.

[0275] When horizontal partitioning is applied to the 4x8 coding block shown in (a) of Figure 20, the coding block is divided into 2x8 sub-blocks. In this case, the width of the sub-blocks is smaller than the threshold, so horizontal partitioning cannot be used for the coding block. Conversely, when vertical partitioning is applied to the 4x8 coding block, the coding block is divided into 4x4 sub-blocks. Both the width and height of the sub-blocks are equal to or greater than the threshold, so vertical partitioning can be used for the coding block. Only vertical partitioning can be used for the coding block, so coding of information indicating the division shape of the coding block can be skipped and vertical partitioning can be applied to the coding block.

[0276] When vertical partitioning is applied to the 8x4 coding block shown in (b) of Figure 20, the coding block is divided into 8x2 sub-blocks. In this case, the height of the sub-blocks is smaller than the threshold, so vertical partitioning cannot be used for the coding block. Conversely, when horizontal partitioning is applied to the 8x4 coding block, the coding block is divided into 4x4 sub-blocks. Both the width and height of the sub-blocks are equal to or greater than the threshold, so horizontal partitioning can be used for the coding block. Since only horizontal partitioning can be used for the coding block, coding of information indicating the division shape of the coding block can be skipped, and vertical partitioning can be applied to the coding block.

[0277] When both vertical partitioning and horizontal partitioning are available, the partitioning shape of the coding block can be determined by analyzing information indicating the partitioning shape of the coding block.

[0278] The number of sub-blocks can be determined based on at least one of the size or shape of the coding block or transform block. As an example, if one of the width or height of the coding block is 8 and the other is 4, the coding block can be divided into two sub-blocks. Conversely, if both the width and height of the coding block are equal to or greater than 8, or if one of the width or height of the coding block is greater than 8, the coding block can be divided into four sub-blocks. In short, if the coding block is 4x4 in size, the coding block does not need to be divided into sub-blocks. If the coding block is 4x8 or 8x4 in size, the coding block can be divided into two sub-blocks. In other cases, the coding block can be divided into four sub-blocks.

[0279] Alternatively, information indicating the size, shape, or number of sub-blocks can be signaled via a bitstream. The size or shape of the sub-blocks can be determined according to the information indicating the number of sub-blocks. Alternatively, the number of sub-blocks can be determined according to the information indicating the sub-block size or shape.

[0280] When applying the sub-partition intra-coding method, sub-blocks generated by dividing a coding block or a transform block can use the same intra-prediction mode. For example, the MPM for the coding block can be obtained 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 according to the obtained MPM. After the intra-prediction mode of the coding block is determined, each sub-block can perform intra-prediction using the determined intra-prediction mode.

[0281] When the sub-partition intra-coding method is applied, any of the MPMs can be determined as the intra-prediction mode of the coding block. That is, when the sub-partition intra-coding method is applied, the MPM identifier can be considered true even if it is not signaled.

[0282] Alternatively, when a sub-partition intra-coding method is applied, one of predefined candidate intra-prediction modes may be determined as the intra-prediction mode of the coding block. For example, 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 planner or DC) may be determined as the intra-prediction mode of the coding block. Index information identifying one of the predefined candidate intra-prediction modes may be signaled via a bitstream.

[0283] According to one embodiment of the present application, the intra prediction mode of at least one of the sub-blocks may be set to be different from that of the other sub-blocks. For example, the intra prediction mode of the Nth sub-block may be obtained by adding or subtracting an offset from the intra prediction mode of the (N-1)th sub-block. The offset may be predefined in the encoder and decoder. Alternatively, the offset may be obtained based on at least one of the size, shape, or intra prediction mode of the coding block, the size, shape, or number of sub-blocks, or the division direction of the coding block. Alternatively, information for obtaining the offset may be signaled via a bitstream.

[0284] Alternatively, if the intra prediction mode of the N-1th sub-block is a non-directional mode, the intra prediction mode of the Nth sub-block is also set to the same as the intra prediction mode of the N-1th sub-block, and if the intra prediction mode of the N-1th sub-block is an angular mode, the intra prediction mode of the N-1th sub-block can be added or subtracted from an offset to obtain an intra prediction mode that is set to the same as the intra prediction mode of the Nth sub-block.

[0285] Alternatively, a directional intra-prediction mode may be applied to some of the sub-blocks, and a non-directional intra-prediction mode may be applied to the remaining sub-blocks. The sub-blocks to which the non-directional intra-prediction mode is applied may be determined according to at least one of the size, shape, position, or number of the sub-blocks. Alternatively, the non-directional intra-prediction mode may be applied to one of the sub-blocks only if the directional intra-prediction mode applied to another sub-block is a predetermined value.

[0286] Alternatively, the intra prediction mode of each sub-block can be obtained from the MPM, and therefore, index information that identifies one of the MPMs can be signaled for each sub-block.

[0287] Alternatively, the intra-prediction mode for each sub-block can be obtained from predefined candidate intra-prediction modes, and index information identifying one of the predefined candidate intra-prediction modes can be signaled for each sub-block.

[0288] Alternatively, information indicating whether the intra prediction modes of the sub-blocks are also set may be signaled via a bitstream.

[0289] The quantization parameters of the subblocks can be determined separately. Therefore, the quantization parameter values ​​of each subblock can be set to different values. To determine the quantization parameter of each subblock, information indicating the difference value from the quantization parameter of the previous subblock can be coded. As an example, for the Nth subblock, the difference value between the quantization parameter of the Nth subblock and the quantization parameter of the N-1th subblock can be coded.

[0290] Intra prediction of a sub-block can be performed using a reference sample. In this case, the reference sample can be obtained from a reconstructed sample of a neighboring block 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 sample of the sub-block can be obtained based on the reconstructed sample of the other sub-block. For example, if a first sub-block is located to the left or top of a second sub-block, the reference sample of the second sub-block can be obtained from the reconstructed sample of the first sub-block. Therefore, parallel intra prediction does not need to be applied between sub-blocks. That is, sub-blocks included in a coding block can be coded or decoded sequentially. Therefore, after coding or decoding of the first sub-block is completed, intra prediction of the second sub-block can be performed.

[0291] When the sub-partition intra-coding method is applied, the multi-line intra-prediction coding method for selecting one of multiple reference sample line candidates can be set not to be used. When the multi-line intra-prediction coding method is not used, the adjacent reference sample line adjacent to each sub-block can be determined as the reference sample line of each sub-block.

[0292] Alternatively, even when the sub-partition intra-coding method is applied, the multi-line intra-prediction coding method can be used. Therefore, index information for identifying a reference sample line can be signaled for each sub-block. Alternatively, index information for identifying a reference sample line can be signaled for only one of a plurality of sub-blocks, and the index information can be applied to the remaining sub-blocks as is. Alternatively, index information for identifying a reference sample line can be signaled for a coding block, and the plurality of sub-blocks included in the coding block can be configured to share the index information.

[0293] Alternatively, only sub-blocks at a predefined position or including a predefined partition index may be configured to use the multi-line intra-prediction coding method. As an example, index information identifying one of the reference sample line candidates may be signaled only for a sub-block having a partition index of 0 or a sub-block connected to the upper boundary or left boundary of a coding block among a plurality of sub-blocks. The multi-line intra-prediction coding method may not be applied to residual sub-blocks. Therefore, the residual sub-blocks may perform intra-prediction using neighboring reference sample lines.

[0294] The predictive coding mode can be set differently for each sub-block. For example, intra prediction can be applied to some sub-blocks, and inter prediction, current picture reference or hybrid prediction can be applied to other sub-blocks.

[0295] FIG. 21 is a diagram showing an example in which a different predictive coding mode is set for each sub-block.

[0296] The intra prediction mode or the predictive coding mode may be set differently for each sub-block. For example, in the example shown in FIG. 21, intra prediction is applied to sub-blocks 0 and 1, and current image reference is applied to sub-blocks 1 and 2.

[0297] When using the current picture reference, a prediction block of the sub-block can be obtained from a decoded region of the current picture or slice (or tile group). When applying the current picture reference, a motion vector can be obtained to identify the prediction block of the sub-block. A motion vector in the current picture reference may also be referred to as a "block vector."

[0298] The motion vector can be obtained based on the motion vectors of neighboring blocks adjacent to the coding block or sub-block, or information for determining the motion vector can be signaled via the bitstream.

[0299] In this case, the maximum value of the motion vector of the sub-block may be determined according to the size of the sub-block or the coding block or transform block to which the sub-block belongs. For example, the motion vector of the sub-block may be set so as not to exceed the boundary of the coding block or transform block to which the sub-block belongs. That is, the prediction block of the sub-block may be obtained from an area that was coded or decoded before the sub-block in the coding block to which the sub-block belongs.

[0300] Instead of a motion vector, index information indicating one of the decoded sub-blocks in the coding block can be coded and signaled, and the prediction block of the sub-block can be determined to be the previously decoded sub-block identified according to the index information.

[0301] As another example, the motion vectors of a sub-block may be allowed to cross the boundaries of the coding or transform block to which the sub-block belongs.

[0302] When a prediction block is generated as a result of performing intra prediction, the prediction samples can be updated based on the positions of the prediction samples included in the prediction block. Such an updating method can be referred to as a sample position-based intra weighted prediction method (or Position Dependent Prediction Combination (PDPC)).

[0303] Whether to use PDPC may be determined according to the size, shape, intra prediction mode, reference sample line of the current block, size of the current block, or chrominance component. For example, PDPC may be used when the intra prediction mode of the current block is at least one of planner, DC, vertical, horizontal, a mode in which the index value is smaller than the vertical direction, or a mode in which the index value is larger than the horizontal direction. Alternatively, PDPC may be used only when at least one of the width or height of the current block is greater than 4. Alternatively, PDPC may be used only when the index of the reference image line of the current block is 0. Alternatively, PDPC may be used only when the index of the reference image line of the current block is equal to or greater than a preset value. Alternatively, PDPC may be used only for the luma component. Alternatively, whether to use PDPC may be determined according to whether two or more of the above-mentioned conditions are satisfied.

[0304] Alternatively, whether to use PDPC may be determined depending on whether a sub-partition intra-coding method has been used. For example, when a sub-partition intra-coding method is applied to a coding block or a transform block, PDPC may be set not to be used. Alternatively, when a sub-partition intra-coding method is applied to a coding block or a transform block, PDPC may be applied to at least one of a plurality of sub-blocks. In this case, the sub-block to which PDPC is to be applied may be determined based on at least one of the size, shape, position, intra-prediction mode, or reference sample line index of the coding block or sub-block. For example, PDPC may be applied to a sub-block adjacent to the top and / or left boundary of the coding block or a sub-block adjacent to the bottom and / or right boundary of the coding block. Alternatively, PDPC may be set to be applied to all sub-blocks included in the coding block or not to be applied to all sub-blocks included in the coding block based on the size or shape of the sub-block. As another example, PDPC may be applied to all sub-blocks in the coding block.

[0305] Alternatively, whether to apply PDPC to each sub-block may be determined depending on whether at least one of the size, shape, intra prediction mode, or reference image index of the sub-blocks generated by dividing a coding block or a transform block satisfies a predetermined 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.

[0306] As another example, information indicating whether PDPC is applied or not can be signaled via the bitstream.

[0307] Alternatively, the region to which PDPC is applied may be determined based on at least one of the size, shape, intra-prediction mode, or position of the predicted sample of the current block. As an example, if the intra-prediction mode of the current block has an index greater than the vertical direction, predicted samples whose x-axis coordinate or y-axis coordinate is greater than a threshold may not be corrected, and the correction operation may be performed only on predicted samples whose x-axis coordinate or y-axis coordinate is equal to or less than the threshold. As an example, if the intra-prediction mode of the current block has an index smaller than the horizontal direction, predicted samples whose x-axis coordinate or y-axis coordinate is greater than a threshold may not be corrected, and the correction operation may be performed only on predicted samples whose x-axis coordinate or y-axis coordinate is equal to or less than the threshold. In this case, the threshold may be determined based on at least one of the size, shape, or intra-prediction mode of the current block.

[0308] When a prediction sample is obtained through intra-prediction samples, a reference sample used to correct the prediction sample can be determined based on the position of the obtained prediction sample. For convenience of explanation, in the following embodiments, the reference sample used to correct the prediction sample is referred to as a PDPC reference sample. Furthermore, a prediction sample obtained through intra-prediction is referred to as a first prediction sample, and a prediction sample obtained by correcting the first prediction sample is referred to as a second prediction sample.

[0309] FIG. 22 is a schematic diagram of an application form of PDPC.

[0310] The first predicted sample may be corrected using at least one PDPC reference sample, which may include at least one of a reference sample adjacent to the upper left corner of the current block, a top reference sample located at the top edge of the current block, or a left reference sample located to the left of the current block.

[0311] At least one of the reference samples belonging to the reference sample line of the current block may be set as the PDPC reference sample. Alternatively, regardless of the reference sample line of the current block, at least one of the reference samples belonging to the reference sample line having an index of 0 may be set as the PDPC reference sample. For example, even if the first predicted sample is obtained using the reference sample included in the reference sample line having an index of 1 or 2, the second predicted sample may be obtained using the reference sample included in the reference sample line having an index of 0.

[0312] The number or position of the PDPC reference samples used to correct the first predicted sample may be determined according to at least one of the intra prediction mode of the current block, the size of the current block, the shape of the current block, or the position of the first predicted sample.

[0313] For example, if the intra prediction mode of the current block is planner or DC mode, a top reference sample and a left reference sample may be used to obtain a second predicted sample. In this case, the top reference sample may be a reference sample that is vertical to the first predicted sample (e.g., a reference sample that has the same x-coordinate), and the left reference sample may be a reference sample that is horizontal to the first predicted sample (e.g., a reference sample that has the same y-coordinate).

[0314] If the intra prediction mode of the current block is a horizontal intra prediction mode, the top reference sample may be used to obtain the second prediction sample, in which case the top reference sample may be a reference sample perpendicular to the first prediction sample.

[0315] If the intra prediction mode of the current block is a vertical intra prediction mode, the second prediction sample may be obtained using a left reference sample, in which case the left reference sample may be a reference sample horizontal to the first prediction sample.

[0316] If the intra prediction mode of the current block is the bottom-left diagonal or top-right diagonal intra prediction mode, the second predicted sample can be obtained based on the top-left reference sample, the top reference sample, and the left reference sample. The top-left reference sample may be a reference sample adjacent to the top-left corner of the current block (e.g., a reference sample located at (-1, -1)). The top reference sample may be a reference sample located diagonally above and to the right of the first predicted sample, and the left reference sample may be a reference sample located diagonally below and to the left of the first predicted sample.

[0317] In other words, if the position of the first predicted sample is (x, y), R(-1, -1) can be 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. Furthermore, R(-1, x+y+1) or R(-1, y) can be set as the left reference sample.

[0318] As another example, the position of the left reference sample or the top reference sample can be determined according to at least one of the two: the shape of the current block; or whether a wide-angle intra mode is applied.

[0319] Specifically, when the intra prediction mode of the current block is a wide-angle intra prediction mode, reference samples that are offset from reference samples diagonally opposite the first predicted sample may be set as PDPC reference samples. For example, the top reference sample R(x+y+k+1,-1) and the left reference sample R(-1,x+y-k+1) may be set as PDPC reference samples.

[0320] In this case, the offset k can be determined based on the wide-angle intra prediction mode. Equations 8 and 9 show examples of obtaining the offset based on the wide-angle intra prediction mode.

number

[0321] The second predicted sample may be determined based on a weighted sum of the first predicted sample and the PDPC reference sample. For example, the second predicted sample may be obtained based on the following 10:

number

[0322] In Equation 10 above, R T indicates the left reference sample, and R TL indicates the upper reference sample, and R TL indicates the top left reference sample. pred(x,y) indicates the predicted sample at the (x,y) position. wL indicates the weight of the left reference sample, wT indicates the weight of the top reference sample, and wTL indicates the weight of the top left reference sample. The weight of the first predicted sample can be obtained by subtracting the weight of the reference sample from the maximum value. For convenience of explanation, the weight assigned to the PDPC reference sample is referred to as the PDPC weight.

[0323] The weight assigned to each reference sample may be determined based on at least one of the intra prediction mode of the current block or the position of the first prediction sample.

[0324] For example, at least one of wL, wT, or wTL may be proportional or inversely proportional to at least one of the x-axis coordinate value or the y-axis coordinate value of the predicted sample, or at least one of wL, wT, or wTL may be proportional or inversely proportional to at least one of the width or height of the current block.

[0325] If the intra prediction mode of the current block is DC, the PDPC weighting value can be determined as shown in Equation 11 below.

number

[0326] In the above equation 11, x and y indicate the position of the first predicted sample.

[0327] In the above equation 11, the parameter "shift" used in the displacement calculation can be obtained based on the width or height of the current block. As an example, the parameter "shift" can be obtained based on the following equation 12 or 13.

number

[0328] Alternatively, the parameter shift can be obtained according to the intra direction parameter of the current block.

[0329] The number or type of parameters used to obtain the parameter "shift" may vary depending on the intra prediction mode of the current block. For example, if the intra prediction mode of the current block is planner, DC, vertical, or horizontal, the parameter "shift" may be obtained using the width and height of the current block, as shown in Equation 12 or 13. If the intra prediction mode of the current block is an intra prediction mode with a larger index than the vertical intra prediction mode, the parameter "shift" may be obtained using the height and intra direction parameters of the current block. If the intra prediction mode of the current block is an intra prediction mode with a smaller index than the horizontal intra prediction mode, the parameter "shift" may be obtained using the width and intra direction parameters of the current block.

[0330] If the intra prediction mode of the current block is planner, the value of wTL can be set to 0. wL and wT can be obtained according to Equation 14 below.

number

[0331] If the intra prediction mode of the current block is a horizontal intra prediction mode, wT can be set to 0, and wTL and wL can be set in the same manner. Conversely, 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 in the same manner.

[0332] If the intra prediction mode of the current block has a larger index than the vertical intra prediction mode and is an intra prediction mode pointing in the upper right direction, the PDPC weight value can be obtained as shown in Equation 15 below.

number

[0333] If the intra prediction mode of the current block has an index smaller than that of the horizontal intra prediction mode and is an intra prediction mode pointing in the bottom-left direction, the PDPC weight value can be obtained as shown in Equation 16 below.

number

[0334] As shown in the above embodiment, the PDPC weights can be determined based on the positions x and y of the predicted samples.

[0335] As another example, the weights assigned to the PDPC reference samples may be determined in sub-block units, and the prediction samples included in the sub-blocks may share the same PDPC weights.

[0336] The sub-block size used to determine the basic unit of weights can be predefined in the encoder and decoder. For example, weights can be determined for 2x2 or 4x4 sub-blocks, respectively.

[0337] Alternatively, the size, shape, or number of sub-blocks may be determined according to the size or shape of the current block. For example, a coding block may be divided into four sub-blocks regardless of the size of the coding block. Alternatively, a coding block may be divided into four or sixteen sub-blocks according to the size of the coding block.

[0338] 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; conversely, if the intra-prediction mode of the current block is vertical, N rows (or N columns) may be set as one sub-block.

[0339] Equations 17 to 19 show an example of determining the PDPC weights of a 2x2 size sub-block. Equation 17 provides an example when the intra prediction mode of the current block is DC mode.

number

[0340] In the above equation 17, the value of K can be determined based on the size of the sub-block.

[0341] Equation 18 gives an example where the intra prediction mode of the current block has a larger index than the vertical intra prediction mode and is an intra prediction mode pointing in the upper right direction.

number

[0342] Equation 19 gives an example where the intra prediction mode of the current block has a smaller index than the horizontal intra prediction mode and is an intra prediction mode pointing in the bottom-left direction.

number

[0343] In Equations 17 to 19, x and y indicate the position of the reference sample within the sub-block, which can be the sample located at the top left, center, or bottom right of the sub-block.

[0344] Equations 20 to 22 show an example of determining the PDPC weights of a 4x4 size sub-block. Equation 20 provides an example when the intra prediction mode of the current block is DC mode.

number

[0345] Equation 21 illustrates a case where the intra prediction mode of the current block has an index greater than the vertical intra prediction mode and is an intra prediction mode pointing in the upper right direction.

number

[0346] Equation 22 illustrates a case where the intra prediction mode of the current block has a smaller index than the horizontal intra prediction mode and is an intra prediction mode pointing in the bottom-left direction.

number

[0347] In the above embodiment, the PDPC weights are determined according to the positions of the first predicted sample or the predicted samples included in the sub-block. The PDPC weights may also be determined according to the shape of the current block.

[0348] For example, in DC mode, the method of obtaining the PDPC weights differs depending on whether the current block is a non-square block with its width greater than its height or its height greater than its width.

[0349] Equation 23 is an example of obtaining a PDPC weight when the current block is a non-square block whose width is greater than its height, and Equation 24 is an example of obtaining a PDPC weight when the current block is a non-square block whose height is greater than its width.

number

number

[0350] If the current block is non-square, the current block can be predicted using a wide-angle intra prediction mode. When the wide-angle intra prediction mode is applied, the first predicted sample can also be updated using PDPC.

[0351] When wide-angle intra prediction is applied to the current block, the PDPC weights may be determined according to the shape of the coding block.

[0352] For example, if the current block is non-square, with its width greater than its height, the top reference sample located to the upper right of the first predicted sample may be closer to the first predicted sample than the left reference sample located to the lower left of the first predicted sample, depending on the position of the first predicted sample. Therefore, in the first predicted sample correction mode, the weight applied to the top reference sample may be set to be greater than the weight applied to the left reference sample.

[0353] Conversely, if the current block is non-square, i.e., the height is greater than the width, the left reference sample located at the lower left of the first predicted sample may be closer to the first predicted sample than the top reference sample located at the upper right of the first predicted sample, depending on the position of the first predicted sample. Therefore, in the first predicted sample compensation mode, the weight applied to the left reference sample may be set to be greater than the weight applied to the top reference sample.

[0354] Equation 25 shows an example of obtaining the PDPC weight value when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index greater than 66.

number

[0355] Equation 26 shows an example of obtaining the PDPC weight value when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index smaller than 0.

number

[0356] The PDPC weight may also be determined based on the ratio of the current block. The ratio of the current block indicates the ratio of the width to the height of the current block and may be defined as shown in Equation 27 below.

number

[0357] The method for obtaining the PDPC weights can be variably determined according to the intra prediction mode of the current block.

[0358] For example, Equation 28 and Equation 29 show an example of obtaining PDPC weights when the intra prediction mode of the current block is DC. Specifically, Equation 28 is an example of the current block being a non-square block whose width is greater than its height, and Equation 29 is an example of the current block being a non-square block whose height is greater than its width.

number

[0359] Equation 30 shows an example of obtaining the PDPC weight value when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index greater than 66.

number

[0360] Equation 31 shows an example of obtaining the PDPC weight value when the intra prediction mode of the current block is a wide-angle intra prediction mode with an index smaller than 0.

number

[0361] A residual image can be obtained by subtracting the original image from the predicted image. In this case, when converting the residual video to the frequency domain, removing high-frequency components does not significantly degrade the subjective quality of the video. Therefore, reducing the values ​​of high-frequency components or setting them to zero has the effect of improving compression efficiency without significantly generating visual distortion. The residual image can be decomposed into two-dimensional frequency components, and the current block can be transformed to reflect the above-mentioned characteristics. The transformation can be performed using a transform method such as DCT (Discrete Cosine Transform) or DST (Discrete Sine Transform).

[0362] DCT is a method of decomposing (or transforming) residual video into two-dimensional frequency components using a cosine transform, while DST is a method of decomposing (or transforming) residual video into two-dimensional frequency components using a cosine transform. The transformed frequency components of the residual video can be represented as image features. For example, when performing a DCT transform on an N×N block, weights corresponding to N image features can be obtained. The transform can obtain weights corresponding to each image feature included in the N×N block. Depending on the transform method used, the weights corresponding to the image features can be referred to as DCT coefficients or DST coefficients.

[0363] The DCT transform method is mainly used for videos with a large distribution of non-zero low frequency components, while the DST transform method is mainly used for videos with a large distribution of high frequency components.

[0364] Transformations other than DCT or DST may also be used to transform the residual video.

[0365] Hereinafter, the case where the residual video is transformed into two-dimensional frequency components is referred to as two-dimensional image transformation. Furthermore, weights corresponding to the image features obtained as a result of the transformation are referred to as transformation coefficients. For example, the transformation coefficients may represent DCT coefficients or DST coefficients. When both a primary transformation and a secondary transformation (to be described later) are applied, the transformation coefficients may represent weights corresponding to the image features generated as a result of the secondary transformation.

[0366] The transform method may be determined for each block. The transform method may be determined based on at least one of the predictive coding mode of the current block, the size of the current block, or the size of the current block. For example, if the current block is coded in intra prediction mode and the size of the current block is smaller than NxN, the transform method DST may be used. Conversely, if the above conditions are not met, the transform method DCT may be used.

[0367] A 2D video transform may not be performed on some blocks of the residual video. The case where the 2D video transform is not performed may be referred to as a transform skip. When the transform skip is applied, quantization may be applied to the residual that is not subjected to the transform.

[0368] After transforming the current block using the DCT or DST, the transformed current block can be further transformed. In this case, the DCT or DST-based transformation can be defined as the primary transformation, and the further transformation of the block to which the primary transformation has been applied can be defined as the secondary transformation.

[0369] The main transform can be performed using any of several possible transform cores. As an example, the main transform can be performed using any of the DCT2, DCT8 or DCT7.

[0370] Different transform cores may be used for the horizontal and vertical directions. Information indicating the combination of horizontal and vertical transform cores may be signaled via the bitstream.

[0371] The execution units of the primary transform and the secondary transform may be different. For example, the primary transform may be performed on an 8x8 block, and the secondary transform may be performed on a 4x4 sub-block of the transformed 8x8 block. In this case, the transform coefficients of other regions that do not undergo the secondary transform may be set to 0.

[0372] Alternatively, a primary transform can be performed on a 4x4 block, and a secondary transform can be performed on an 8x8 sized region containing the transformed 4x4 block.

[0373] Information indicating whether to perform the second transformation can be signaled via the bitstream.

[0374] Alternatively, whether to perform the second transform can be determined based on whether the horizontal transform core is the same as the vertical transform core. For example, the second transform can be performed only if the horizontal transform core is the same as the vertical transform core. Alternatively, the second transform can be performed only if the horizontal transform core is different from the vertical transform core.

[0375] Alternatively, the second transform may be allowed only if a predefined transform core is used for the horizontal and vertical transforms. As an example, the second transform may be allowed if a DCT2 transform core is used for the horizontal and vertical transforms.

[0376] Alternatively, whether to perform the second transform may be determined according to the number of non-zero transform coefficients of the current block. For example, if the non-zero transform coefficients of the current block are less than or equal to a threshold, the second transform may be set not to be used, and if the non-zero transform coefficients of the current block are greater than the threshold, the second transform may be set to be used. The second transform may also be set to be used only when the current block is coded using intra prediction.

[0377] According to the shape of the current block, the size or shape of the sub-block on which the second transformation is to be performed can be determined.

[0378] 23 and 24 show schematic diagrams of the sub-blocks that perform the second transformation.

[0379] If the current block is a square, after the main transform is performed, a second transform can be performed on the NxN sub-block at the top left of the current block. For example, if the current block is an 8x8 coding block, after the main transform is performed on the current block, a second transform can be performed on the 4x4 sub-block at the top left of the current block (see FIG. 23).

[0380] If the current block is non-square and its width is four or more times greater than its height, a primary transform may be performed, followed by a secondary transform on a (kN) x (4kN) sub-block to the upper left of the current block. For example, if the current block is non-square and 16x4, a primary transform may be performed on the current block, followed by a secondary transform on a 2x8 sub-block to the upper left of the current block (see (a) of Figure 24).

[0381] If the current block is non-square and its height is four times greater than its width, a second transformation can be performed on a (4kN) x (kN) sub-block to the upper left of the current block after the primary transformation. For example, if the current block is non-square and 16x4, a second transformation can be performed on a 2x8 sub-block to the upper left of the current block after the primary transformation (see (b) of Figure 24).

[0382] The decoder can perform an inverse transform (second inverse transform) of the second transform, and then perform an inverse transform (first inverse transform) of the main transform according to the result of the second inverse transform. A residual signal for the current block is obtained according to the result of the second inverse transform and the first inverse transform.

[0383] Information indicating the transform type of the current block may be signaled via the bitstream, and may be index information tu_mts_idx of one of a combination of horizontal and vertical transform types.

[0384] The vertical transform core and the horizontal transform core can be determined according to the transform type candidate identified by the index information tu_mts_idx. Tables 7 and 8 show the transform type combinations according to tu_mts_idx.

[0385] [Table 7]

[0386] [Table 8]

[0387] The transform type can be determined to be one of DCT2, DST7, DCT8, or transform skip. Alternatively, other than transform skip, only the transform core can be used to configure the transform type combination candidates.

[0388] When using Table 7, if tu_mts_idx is 0, then a transform skip can be applied horizontally and vertically. If tu_mts_idx is 1, then a DCT2 can be applied horizontally and vertically. If tu_mts_idx is 3, then a DCT8 can be applied horizontally and a DCT7 can be applied vertically.

[0389] When using Table 8, if tu_mts_idx is 0, DCT2 can be applied horizontally and vertically. If tu_mts_idx is 1, transform skip can be applied horizontally and vertically. If tu_mts_idx is 3, DCT8 can be applied horizontally and DCT7 can be applied vertically.

[0390] Whether to encode index information may be determined according to 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 less than a threshold, index information may not be signaled and a default transform type may be applied to the current block. Here, the default transform type may be DST7. Alternatively, the default mode may differ depending on the size, shape, or intra-prediction mode of the current block.

[0391] The threshold may be determined based on the size or shape of the current block. For example, if the size of the current block is less than or equal to 32x32, the threshold may be set to 2, and if the current block is greater than 32x32 (e.g., if the current block is a coding block of 32x64 or 64x32 size), the threshold may be set to 4.

[0392] The plurality of lookup tables may be pre-stored in the encoder or decoder, and at least one of index values ​​assigned to the transform type combination candidates of the plurality of lookup tables, types of the transform type combination candidates, or the number of the transform type combination candidates may be different.

[0393] The lookup table for the current block can be selected based on at least one of the size, shape, predictive coding mode, intra prediction mode of the current block, whether to apply a second transform or whether to apply a transform skip to the neighboring block.

[0394] As an example, if the size of the current block is 4x4 or less or if the current block is coded using inter prediction, the lookup table in Table 7 can be used, and if the size of the current block is greater than 4x4 or if the current block is coded using intra prediction, the lookup table in Table 8 can be used.

[0395] Alternatively, information indicating which of multiple lookup tables to use can be signaled via the bitstream, and the decoder can select the lookup table for the current block based on that information.

[0396] As another example, the index assigned to the transform type combination candidate may be adaptively determined based on at least one of the size, shape, predictive coding mode, intra prediction mode, whether to apply a second transform, or whether to apply a transform skip to a neighboring block of the current block. As an example, when the size of the current block is 4x4, the index assigned to the transform skip may have a smaller value than the index assigned to the transform skip when the current block size is larger than 4x4. Specifically, when the size of the current block is 4x4, the transform skip may be assigned an index of 0, and when the current block is larger than 4x4 and smaller than or equal to 16x16, the transform skip may be assigned an index greater than 0 (e.g., index 1). When the current block is larger than 16x16, the transform skipped index may be assigned a maximum value (e.g., 5).

[0397] Alternatively, if the current block is coded using inter prediction, the transform skip may be assigned an index of 0. If the current block is coded using intra prediction, the transform skip may be assigned an index greater than 0 (e.g., index 1).

[0398] Alternatively, if the current block is a 4x4 sized block coded with inter prediction, the transform skip may be assigned an index of 0. Conversely, if the current block is not coded with inter prediction or is larger than 4x4, the transform skip may be assigned an index with a value greater than 0 (e.g., index 1).

[0399] It is possible to define and use transform type combination candidates different from the transform type combination candidates exemplified in Tables 7 and 8. As an example, a transform skip can be applied to either a horizontal transform or a vertical transform, and a transform type combination candidate that applies a transform core such as DCT7, DCT8, or DST2 can be used for the other one. In this case, it is possible to determine whether to use a transform skip as a transform type candidate to be used in the horizontal or vertical direction based on at least one of the size (e.g., width and / or height), shape, predictive coding mode, or intra-prediction mode of the current block.

[0400] Alternatively, information indicating whether a specific transform type candidate can be used can be signaled via the bitstream. For example, an identifier indicating whether a transform skip can be used as a transform type candidate for the horizontal and vertical directions can be signaled. Depending on the identifier, it can be determined whether to include a specific transform type combination candidate among multiple transform type combination candidates.

[0401] Alternatively, information on whether a specific transform type candidate is applied to the current block may be signaled via the bitstream. As an example, an identifier cu_mts_flag indicating whether DCT2 is applied in the horizontal and vertical directions may be signaled. If the value of cu_mts_flag is 1, DCT2 may be set as the transform core for the vertical and horizontal directions. If the value of cu_mts_flag is 1, DCT8 or DST7 may be set as the transform core for the vertical and horizontal directions. Alternatively, if the value of cu_mts_flag is 1, information tu_mts_idx specifying one of multiple transform type combination candidates may be signaled.

[0402] If the current block is a non-square with width greater than height or height greater than width, the encoding of cu_mts_flag can be skipped and the value of cu_mts_flag is considered to be 0.

[0403] The number of available transform type combination candidates can be set differently depending on the size, shape, or intra-prediction mode of the current block. For example, if the current block is square, three or more transform type combination candidates can be used, and if the current block is non-square, two transform type combination candidates can be used. Alternatively, if the current block is square, only transform type combination candidates that are different from the transform type for only the horizontal direction and the transform type for only the vertical direction can be used.

[0404] If there are three or more transform type combination candidates that the current block can use, index information tu_mts_idx indicating one of the transform type combination candidates can be signaled. If there are two transform type combination candidates that the current block can use, identifier mts_flag indicating one of the transform type combination candidates can be signaled. Table 9 shows the coding shape that specifies the information required for the transform type combination candidates according to the shape of the current block.

[0405] [Table 9]

[0406] The indexes of the candidate transform type combinations may be re-sorted (or reordered) according to the shape of the current block. As an example, if the current block is square, the indexes assigned to the candidate transform type combinations may be different from the indexes assigned to the candidate transform type combinations if the current block is non-square. As an example, if the current block is square, the transform type combinations may be selected based on Table 10 below, and if the current block is non-square, the transform type combinations may be selected based on Table 11 below.

[0407] [Table 10]

[0408] [Table 11]

[0409] The transform 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, where the number of horizontal non-zero coefficients indicates the number of non-zero coefficients contained in 1xN (where N is the width of the current block), and the number of vertical non-zero coefficients indicates the number of non-zero coefficients contained in Nx1 (where N is the height of the current block). If the maximum value of horizontal non-zero coefficients is less than or equal to a threshold, the primary transform type can be applied horizontally, and if the maximum value of horizontal non-zero coefficients is greater than the threshold, the secondary transform type can be applied horizontally. If the maximum value of vertical non-zero coefficients is less than or equal to the threshold, the primary transform type can be applied vertically, and if the maximum value of vertical non-zero coefficients is greater than the threshold, the secondary transform type can be applied vertically.

[0410] FIG. 25 is a diagram of an example illustrating determining the transformation type of the current block.

[0411] As an example, if the current block is coded using intra prediction and the maximum value of the horizontal non-zero coefficients of the current block is 2 or less (see (a) of Figure 25), the horizontal transform type can be determined to be DST7.

[0412] If the current block is coded using intra prediction and the maximum value of the vertical non-zero coefficients of the current block is greater than 2 (see (b) of FIG. 25), the vertical transform type can be determined to be DCT2 or DCT8.

[0413] Information indicating whether to explicitly determine the current block transform type based on information signaled from the bitstream can be signaled via the bitstream. As an example, at the sequence level, information sps_explicit_intra_mts_flag indicating whether to allow explicit determination of the transform type for a block coded using intra prediction and / or information sps_explicit_inter_mts_flag indicating whether to allow explicit determination of the permitted transform type for a block coded using inter prediction can be signaled.

[0414] If determining the transform type is allowed, the transform type of the current block can be determined based on the index information tu_mts_idx signaled from the bitstream. Conversely, if determining the transform type is not allowed, the transform type can be determined based on at least one of the size, shape, and whether the sub-block unit allows transform or the position of a sub-block containing non-zero or non-zero transform coefficients of the current block. As an example, the horizontal transform type of the current block can be determined based on the width of the current block, and the vertical transform type of the current block can be determined based on the height of the current block. For example, if the width of the current block is less than 4 or greater than 16, the horizontal transform type can be determined to be DCT2. Otherwise, the horizontal transform type can be determined to be DST7. For example, if the height of the current block is less than 4 or greater than 16, the vertical transform type can be determined to be DCT2. Otherwise, the vertical transform type can be determined to be DST7. Here, the thresholds to be compared with the width and height to determine the horizontal transformation type and the vertical transformation type can be determined based on at least one of the size, shape, or intra prediction mode of the current block.

[0415] Alternatively, if the current block is square, with its height being the same as its width, the horizontal and vertical transform types can be set to be the same; whereas, if the current block is non-square, with its height being different from its width, the horizontal and vertical transform types can be set to be different. For example, if the width of the current block is greater than its height, the horizontal transform type can be determined to be DST7 and the vertical transform type can be determined to be DCT2. For example, if the height of the current block is greater than its width, the vertical transform type can be determined to be DST7 and the horizontal transform type can be determined to be DCT2.

[0416] The number and / or types of candidate transform types or candidate transform type combinations differ depending on whether or not explicit determination of the transform type is permitted. As an example, if explicit determination of the transform type is permitted, DCT2, DST7, and DCT8 can be used as candidate transform types. Therefore, the horizontal transform type and the vertical transform type can be set to DCT2, DST8, or DCT8, respectively. If explicit determination of the transform type is not permitted, only DCT2 and DST7 can be used as candidate transform types. Therefore, the horizontal transform type and the vertical transform type can be set to DCT2 or DST7, respectively.

[0417] A coding block or a transform block may be divided into a plurality of sub-blocks, and each of the sub-blocks may be transformed. For example, when the sub-partition intra-prediction coding method described above is applied to a coding block, the coding block may be divided into a plurality of sub-blocks, and each of the sub-blocks may be transformed.

[0418] The transform types of the respective sub-blocks may be different from each other. For example, when a transform type for a first sub-block of a plurality of sub-blocks is determined, the transform type of the first sub-block may be applied to the remaining sub-blocks. Alternatively, the transform type to be used for a coding block may be determined, and the transform type of the coding block may be determined as the transform type of the sub-blocks.

[0419] As another example, the transform types of multiple sub-blocks can be determined separately. The transform type of each sub-block can be determined based on information signaled for each sub-block. As an example, index information tu_mts_idx can be signaled for each sub-block. The index information tu_mts_idx can identify one of multiple combinations of horizontal and vertical transform types. According to the value of tu_mts_idx, the horizontal and vertical transform types can be determined to be DCT2, DST7, or DCT8. Based on the index information tu_mts_idx, it can be determined whether the horizontal and vertical transform types are the same.

[0420] Information indicating whether the transform type of the current sub-block uses the same transform type as the previous sub-block can be signaled. If the information indicates that the same transform type as the previous sub-block is used, coding of the index information tu_mts_idx of the current sub-block can be skipped, and the transform type of the previous sub-block can be applied to the current sub-block. Conversely, if the information indicates that a transform type different from that of the previous sub-block is used, the index information tu_mts_idx of the current sub-block can be coded. In this case, the index information of the current sub-block can indicate one of the transform type combinations other than the transform type combination indicated by the index information of the previous sub-block.

[0421] Alternatively, if a coding block is divided into multiple sub-blocks, it may be configured not to allow explicit determination of the transform type. If explicit determination of the transform type is allowed, the transform type may be determined based on the index information tu_mts_idx. Conversely, if explicit determination of the transform type is not allowed, the transform type may be determined according to at least one of the sub-block size, shape, or sub-block position containing non-zero coefficients.

[0422] FIG. 26 is a schematic diagram of an example of determining the transform type of a sub-block.

[0423] FIG. 26 shows an example where the ratio of height to width of a sub-block is 1:2 or 2:1.

[0424] The horizontal and vertical transform types can be determined based on the width and height of each sub-block. For example, as shown in (a) and (b) of Figure 26, if the width of a sub-block is smaller than a threshold, the primary transform type (e.g., DCT2) can be used as the horizontal transform type. Conversely, if the width of a sub-block is equal to or greater than the threshold, the secondary transform type (e.g., DST7) can be used as the horizontal transform type.

[0425] Furthermore, if the height of the sub-block is less than a threshold, the primary transform type (e.g., DCT2) can be used as the vertical transform type. Conversely, if the width of the sub-block is greater than or equal to a threshold, the secondary transform type (e.g., DST7) can be used as the vertical transform type.

[0426] Here, the threshold may be a natural number such as 2, 4, or 8. The threshold may be variably determined based on at least one of the size, shape, intra-prediction mode, or predictive coding mode of the coding block. Alternatively, information for determining the threshold may be signaled via a bitstream.

[0427] In the above example, the width and height of a subblock are compared with one threshold. However, the width and height of a subblock may also be compared with two thresholds to determine the transformation type. For example, if the width of a subblock is smaller than the first threshold or larger than the second threshold, the horizontal transformation type may be determined to be DCT2. Otherwise, the horizontal transformation type may be determined to be DST7. Furthermore, if the height of a subblock is smaller than the first threshold or larger than the second threshold, the vertical transformation type may be determined to be DCT2. Otherwise, the vertical transformation type may be determined to be DST7. The second threshold is a natural number larger than the first threshold. The first threshold may be a natural number such as 2, 4, or 8, and the second threshold may be a natural number such as 8, 16, or 32.

[0428] As another example, if a subblock is square, with its height being the same as its width, the horizontal and vertical transform types can be set to be the same, while if a subblock is non-square, with its height different from its width, the horizontal and vertical transform types can be set to be different. As an example, if the width of a subblock is greater than its height, the horizontal transform type can be determined to be DST7 and the vertical transform type can be determined to be DCT2. If the height of a subblock is greater than its width, the vertical transform type can be determined to be DST7 and the horizontal transform type can be determined to be DCT2.

[0429] The value of a residual coefficient included in at least one of the plurality of sub-blocks may be set to 0. Here, the residual coefficient refers to a transform coefficient generated by transforming, a transform skip coefficient generated by transform skipping, or a quantized coefficient generated by quantizing the transform coefficient or the transform skip coefficient. For example, the value of a residual coefficient included in a sub-block that is more than a predetermined distance away from a boundary of a coding block may be set to 0.

[0430] FIG. 27 is a diagram illustrating an example in which the residual coefficients of a sub-block are set to zero.

[0431] In the example shown in Figure 27, a CBF (Coded Block Flag) indicates whether a sub-block has a non-zero residual coefficient. A CBF value of 0 indicates that the sub-block has no non-zero residual coefficients, and a CBF value of 1 indicates that the sub-block has a non-zero residual coefficient.

[0432] If the distance from the coding block boundary to the sub-block is equal to or greater than a threshold, the residual coefficients included in the sub-block may be set to 0. In this case, the distance from the coding block boundary to the sub-block may be obtained based on a first sample located at the coding block boundary and a second sample included in the sub-block. For example, the first sample may be a sample located at the upper left corner, a sample located at the lower left corner, a sample located at the center left, a sample located at the upper right corner, a sample located at the lower right corner, a sample located at the center right, a sample located at the upper center, or a sample located at the lower center of the coding block. The second sample may be a sample located at the upper left corner, a sample located at the lower left corner, a sample located at the center left, a sample located at the upper right corner, a sample located at the lower right corner, a sample located at the center right, a sample located at the upper center, or a sample located at the lower center of the sub-block.

[0433] The threshold may be determined based on at least one of the size, shape, number of sub-blocks included in the coding block, or size of the sub-blocks, or information for determining the threshold may be signaled via the bitstream.

[0434] As an example, when 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 equal to or greater than a threshold can be set to 0. If the coding block size is 64 and the threshold is 32, as shown in (a) of Figure 27, the residual coefficients of sub-blocks (Sub-CU2 and Sub-CU3) whose distance from the left boundary of the coding block is equal to or greater than 32 can be set to 0.

[0435] Alternatively, when 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 equal to or greater than a threshold can be set to 0. If the size of the coding block is 64 and the threshold is 32, the residual coefficients of sub-blocks (Sub-CU2 and Sub-CU3) whose distance from the top boundary of the coding block is equal to or greater than 32 can be set to 0, as shown in (b) of Figure 27.

[0436] Unlike the example shown, residual coefficients contained in sub-blocks whose distance to the coding block boundary is less than a threshold can be set to zero.

[0437] Alternatively, residual coefficients of sub-blocks other than the sub-block whose position is preset among the plurality of sub-blocks may be set to 0. For example, when vertical partitioning is applied to a coding block, residual coefficients of sub-blocks other than the sub-block located at the left end or right end of the plurality of sub-blocks may be set to 0. Alternatively, when horizontal partitioning is applied to a coding block, residual coefficients of sub-blocks other than the sub-block located at the top end or bottom end of the plurality of sub-blocks may be set to 0.

[0438] For a sub-block, information indicating whether or not there are non-zero coefficients, such as CBF coding, can be skipped. When CBF coding is skipped, whether or not each sub-block includes a non-zero residual coefficient can be determined according to the distance between the coding block boundary and the sub-block or the position of the sub-block. As an example, in the example shown in FIG. 27, it can be obtained that the CBF values ​​of sub-block 0 and sub-block 1 (sub-CU0, sub-CU1) are 1, and the CBF values ​​of sub-block 2 and sub-block 3 (sub-CU2, sub-CU3) are 0.

[0439] Transformation and / or quantization may be performed on sub-blocks containing non-zero coefficients, while transformation and quantization may be skipped for sub-blocks that do not contain non-zero coefficients.

[0440] As another example, information indicating that only a portion of a coding block or a transform block is to be transformed can be coded and signaled. The information may be a 1-bit identifier cu_sbt_flag. A value of 1 indicates that only a portion of a plurality of sub-blocks generated by dividing the coding block or the transform block is to be transformed, and a value of 0 indicates that the coding block or the transform block does not need to be divided into sub-blocks for transformation.

[0441] A method of transforming only a portion of a coding block is permitted only when a sub-partition intra-coding method is applied to the coding block. Therefore, cu_sbt_flagg can be coded and signaled only when a sub-partition intra-coding method is applied to the coding block. When the value of cu_sbt_flag is 1, some of the sub-blocks generated by dividing the coding block or transform block can be transformed, and the residual coefficients of the remaining sub-blocks can be set to 0. When the value of cu_sbt_flag is 1, all sub-blocks can be transformed.

[0442] Alternatively, when a sub-partition intra-coding method is applied to a coding block, the coding of cu_sbt_flag may be skipped and the value of cu_sbt_flag may be set to 1.

[0443] As another example, a transform method may be permitted for some regions of a coding block only when the predictive coding mode of the coding block is inter prediction or current picture reference. When a coding block is coded using inter prediction or current picture reference, information indicating whether or not only some regions of the coding block are transformed may be coded and signaled. When only some regions of the coding block are transformed, information indicating the partition shape of the coding block may be coded and signaled. The information indicating the partition shape of the coding block may include at least one of information indicating whether the coding block is divided into four sub-blocks, information indicating the division direction of the coding block, or information indicating the number of sub-blocks. As an example, when cu_sbt_flag is 1, an identifier cu_sbt_quadtree_flag indicating whether the coding block is divided into four sub-blocks may be signaled. When cu_sbt_quadtree_flag is 1, it indicates that the coding block is divided into four sub-blocks. For example, three vertical lines or three horizontal lines may be used to divide a coding block into four sub-blocks, or one vertical line and one horizontal line may be used to divide a coding block into four sub-blocks. cu_sbt_quadtree_flag equals 0, indicating that the coding block is divided into two sub-blocks. For example, one vertical line or one horizontal line may be used to divide a coding block into two sub-blocks.

[0444] Furthermore, an identifier indicating the division direction of the coding block may be signaled via the bitstream. As an example, an identifier cu_sbt_horizontal_flag indicating whether horizontal partitioning is applied to the coding block may be coded and signaled. A value of 1 for cu_sbt_horizontal_flag indicates that horizontal partitioning is applied to the coding block, and a value of 0 for cu_sbt_horizontal_flag indicates that vertical partitioning is applied to the coding block.

[0445] Information indicating the locations of sub-blocks without non-zero coefficients or sub-blocks for which no transform is performed can be signaled via the bitstream, and based on this information, it is possible to determine which sub-blocks are transformed and / or quantized and which sub-blocks are skipped from transform and / or quantization.

[0446] FIG. 28 is an example of indicating the location of sub-blocks that perform transform and / or quantization via information signaled by the bitstream.

[0447] An identifier sbt_upleft_flag indicating whether there is a non-zero coefficient at a particular position or in the first sub-block can be signaled. A value of 1 for sbt_upleft_flag indicates that a sub-block located at the top or left end of a coding block has been transformed and / or quantized, and that a sub-block located at the right or bottom end of a coding block has not been transformed and / or quantized. A value of 0 for sbt_upleft_flag indicates that a sub-block located at the top or left end of a coding block has been transformed and / or quantized, and that a sub-block located at the right or bottom end of a coding block has not been transformed and / or quantized.

[0448] When a coding block is divided into four sub-blocks, sbt_upleft_flag indicates that transform and / or quantization has been performed on N sub-blocks. For example, a value of 1 for sbt_upleft_flag indicates that transform and / or quantization has been performed on the top or left two sub-blocks, and a value of 0 for sbt_upleft_flag indicates that transform and / or quantization has been performed on the right or bottom two sub-blocks.

[0449] Unlike the example shown in the drawing, the value of N can also be set to 1 or 3.

[0450] Residual coefficients of sub-blocks that have not been transformed and / or quantized may be set to zero.

[0451] The transform type of the sub-block can be determined according to the division direction of the coding block and the position of the sub-block. For example, if the coding block is divided vertically and a sub-block located to the left of the sub-block is to be transformed, the horizontal transform type and the vertical transform type can be set to different values. For example, the horizontal transform type can be set to DCT8, and the vertical transform type can be set to DST7. Conversely, if the coding block is divided vertically and a sub-block located to the right of the sub-block is to be transformed, the horizontal transform type and the vertical transform type of the sub-block can be set to the same value. For example, the horizontal transform type and the vertical transform type can be set to DST7.

[0452] Alternatively, when a coding block is divided horizontally and a sub-block located at the top of the sub-blocks is to be transformed, the horizontal transform type and the vertical transform type can be set to different values. For example, the horizontal transform type can be set to DST7, and the vertical transform type can be set to DCT8. Conversely, when a coding block is divided horizontally and a sub-block located at the bottom of the sub-blocks is to be transformed, the horizontal transform type and the vertical transform type of the sub-block can be set to the same value. For example, the horizontal transform type and the vertical transform type can be set to DST7.

[0453] For a sub-block, information indicating whether or not there are non-zero coefficients, such as CBF coding, can be skipped. When CBF coding is skipped, it can be determined whether or not each sub-block includes a non-zero residual coefficient according to the position of the block to be transformed. For example, when the value of sbt_upleft_flag is 0, the CBF value of the sub-block located on the left or top end can be obtained as 0, and the CBF value of the sub-block located on the right or bottom end can be obtained as 1. Alternatively, when the value of sbt_upleft_flag is 1, the CBF value of the sub-block located on the left or top end can be obtained as 1, and the CBF value of the sub-block located on the right or bottom end can be obtained as 0.

[0454] The reconstructed samples of a sub-block to be transformed can be obtained by adding the predicted samples and the residual samples. Conversely, for a sub-block where the transform is skipped, the predicted samples can be set to the reconstructed samples. Quantization is used to reduce the energy of the block. The quantization process involves dividing the transform coefficients by a specific constant value. The constant value can be obtained according to a quantization parameter, which can be defined as a value between 1 and 63.

[0455] If the encoder performs transform and quantization, the decoder can obtain a residual block through inverse quantization and inverse transform. The decoder can add the measured block to the residual block to obtain a reconstructed block for the current block.

[0456] Once a reconstructed block for the current block is obtained, information loss caused by the quantization and coding processes can be reduced through in-loop filtering. The loop filtering may include at least one of a deblocking filter, a sample adaptive offset filter (SAO), or an adaptive loop filter (ALF). Hereinafter, the reconstructed block before applying loop filtering is referred to as a first reconstructed block, and the reconstructed block after applying loop filtering is referred to as a second reconstructed block.

[0457] A second reconstructed block may be obtained by applying at least one of a deblocking filter, SAO, or ALF to the first reconstructed block, where SAO or ALF may be applied after applying the deblocking filter.

[0458] The deblocking filter is used to reduce blocking artifacts at block boundaries that occur when blocks are quantized as units. To apply the deblocking filter, the blocking strength (BS) between a first reconstruction block and an adjacent reconstruction block can be determined.

[0459] FIG. 29 is a flow chart of the process for determining block strength.

[0460] In the example shown in Figure 29, P indicates the first reconstruction block, and Q indicates the adjacent reconstruction block, where the adjacent reconstruction block can be adjacent to the right or top of the current block.

[0461] In the example shown in Figure 29, the block strength is determined according to the predictive coding modes of P and Q, whether or not the block contains non-zero transform coefficients, whether or not the block is inter-predicted using the same reference image, and whether or not the difference in motion vectors is greater than or equal to a threshold.

[0462] Whether to apply a deblocking filter can be determined based on the block strength. For example, if the block strength is 0, no filtering may be performed.

[0463] SAO is used to reduce ringing artifacts caused by quantization in the frequency domain. SAO can be performed by adding or subtracting an offset determined based on the pattern of the first restored video. Methods for determining the offset include edge offset (EO) and sideband offset (BO). EO refers to a method of determining a correction value for a current sample according to the pattern of neighboring pixels. BO refers to a method of applying a common correction value to a set of pixels with similar luminance values ​​within a region. Specifically, pixel luminance can be divided into 32 equal intervals, and pixels with similar luminance values ​​can be grouped together. As an example, four adjacent bands out of the 32 sidebands can be grouped together, and the same correction value can be applied to samples belonging to the four bands.

[0464] ALF is a method of generating a second restored video by applying a filter of a predefined size or shape to a first restored video or a restored video to which a deblocking filter has been applied. The following Equation 32 shows an example of application of ALF.

number

[0465] One of the predefined filter candidates can be selected for each image, coding tree unit, coding block, prediction block, or transform block, and each filter candidate may have a different size or shape.

[0466] FIG. 30 shows predefined filter candidates.

[0467] As shown in FIG. 30, at least one of diamond windows of size 5×5, 7×7 or 9×9 can be selected.

[0468] Only a diamond window of size 5x5 can be used for the chrominance components.

[0469] Examples that are described with a focus on a decoding or coding process may be applied to a coding or decoding process, and this also falls within the scope of this application. Examples that are described in a given order may be changed to a different order of the explanatory content, and this also falls within the scope of this application.

[0470] Although the above-described embodiments are described based on a series of steps or flow diagrams, this does not limit the order of the invention, and steps may be executed simultaneously or in a different order as needed. Furthermore, in the above-described embodiments, the components (e.g., units, modules, etc.) constituting the block diagrams may each be implemented as hardware or software, or may be combined by multiple components to be implemented as a single hardware or software device. The above-described embodiments may be implemented in the form of program instructions executable by various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include, independently or in combination, program instructions, data files, data structures, etc. Examples of computer-readable recording media include magnetic media such as hard disks, soft disks, and magnetic tapes, optical media such as CD-ROMs and DVDs, magneto-optical media such as floppy disks, and hardware devices that store and execute specially configured program instructions, such as ROM, RAM, and flash memory. The hardware device may be configured to run one or more software modules to execute the processes of the present application, or vice versa. [Industrial Applicability]

[0471] The present application can be applied to electronic devices that encode or decode images.

Claims

1. 1. A video decoding method comprising: determining a reference sample line for the current block; deriving an intra-prediction mode for the current block based on whether a candidate intra-prediction mode is the same as an intra-prediction mode for the current block; performing intra prediction on the current block according to the reference sample line and the intra prediction mode; determining candidate transform types for the current block, the number of candidate transform types differing depending on whether the current block allows explicit determination of its transform type.

2. The video decoding method further includes determining whether to divide the current block into a plurality of sub-blocks; When the current block is divided into a plurality of sub-blocks, the plurality of sub-blocks share one intra prediction mode.

10. The video decoding method of claim 1.

3. The video decoding method further includes determining whether to divide the current block into a plurality of sub-blocks; When the current block is divided into a plurality of sub-blocks, inverse transform is skipped for some of the plurality of sub-blocks.

10. The video decoding method of claim 1.

4. 1. A video encoding method comprising: determining a reference sample line for the current block; deriving an intra-prediction mode for the current block based on whether a candidate intra-prediction mode is the same as an intra-prediction mode for the current block; performing intra prediction on the current block according to the reference sample line and the intra prediction mode; determining candidate transform types for the current block, the number of candidate transform types differing depending on whether the current block allows explicit determination of its transform type.

5. The video encoding method further includes determining whether to divide the current block into a plurality of sub-blocks; When the current block is divided into a plurality of sub-blocks, the plurality of sub-blocks share one intra prediction mode.

5. The video encoding method of claim 4.

6. The video encoding method further includes determining whether to divide the current block into a plurality of sub-blocks; When the current block is divided into a plurality of sub-blocks, transformation is skipped for some of the plurality of sub-blocks.

5. The video encoding method of claim 4.

7. 1. A decoder comprising: a memory for storing instructions executable by a processor; A processor for executing instructions for performing the video decoding method of any one of claims 1 to 3.

8. 1. An encoder comprising: a memory for storing instructions executable by a processor; A processor for executing instructions for performing the video encoding method of any one of claims 4 to 6.

9. 1. A decoder comprising: means for determining a reference sample line for the current block; means for deriving an intra-prediction mode of the current block based on whether a candidate intra-prediction mode is the same as the intra-prediction mode of the current block; means for performing intra prediction on the current block according to the reference sample line and the intra prediction mode; and means for determining candidate transform types for the current block, the number of candidate transform types differing depending on whether the current block allows explicit determination of the transform type.

10. 1. An encoder comprising: means for determining a reference sample line for the current block; means for deriving an intra-prediction mode of the current block based on whether a candidate intra-prediction mode is the same as the intra-prediction mode of the current block; means for performing intra prediction on the current block according to the reference sample line and the intra prediction mode; and means for determining candidate transform types for the current block, the number of candidate transform types differing depending on whether the current block allows explicit determination of its transform type.

11. 4. A computer readable storage medium storing a computer program / instructions and a bitstream, the computer program / instructions causing a processor to perform the decoding method of claims 1 to 3 to decode the bitstream to generate a video or image.

12. 7. A computer readable storage medium storing a computer program / instructions and a bitstream, the computer program / instructions causing a processor to perform the encoding method of claims 4 to 6 to generate a bitstream.

Citation Information

Patent Citations

  • Method and apparatus for encoding / decoding in-screen prediction mode

    EP3379829A1

  • Non-separable secondary transform for video coding

    WO2017058614A1

  • Method and apparatus for processing video signal

    WO2017176030A1