Method for processing video signal and device therefor

The integration of reference lines and intra prediction modes with weighted averaging in video signal processing addresses inefficiencies in existing methods, resulting in improved coding efficiency and quality.

WO2024215185A1PCT designated stage expired Publication Date: 2024-10-17WILUS INSTITUTE OF STANDARDS & TECHNOLOGY INC
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/KR2024/095711
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-01-25
Filing Date
2024-04-15
Publication Date
2024-10-17

AI Technical Summary

Technical Problem

Current video signal processing methods are inefficient in encoding and decoding due to limitations in handling spatial, temporal, and probabilistic correlations, necessitating more advanced techniques to enhance coding efficiency.

Method used

A method and device for video signal processing that utilize a processor to integrate pairs of reference lines and intra prediction modes, perform weighted averaging of prediction blocks, and restore current blocks based on these integrated pairs, sorted by cost, to improve coding efficiency.

Benefits of technology

This approach enhances video signal processing efficiency by effectively integrating multiple prediction methods, leading to improved coding efficiency and quality in video encoding and decoding processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure KR2024095711_17102024_PF_FP_ABST
    Figure KR2024095711_17102024_PF_FP_ABST
Patent Text Reader

Abstract

This video signal decoding device comprises a processor, wherein the processor can: obtain a plurality of pairs consisting of one reference line and one intra prediction mode, the plurality of pairs including a first pair and a second pair; obtain a list consisting of a plurality of combined pairs including a first combined pair in which the first pair and the second pair have been combined; and restore a current block on the basis of one combined pair in the list.
Need to check novelty before this filing date? Find Prior Art

Description

Video signal processing method and device therefor

[0001] The present invention relates to a method and device for processing a video signal, and more particularly, to a method and device for processing a video signal for encoding or decoding a video signal.

[0002] Compression coding refers to a series of signal processing techniques for transmitting digitized information over communication lines or storing it in a format suitable for storage media. Objects subject to compression coding include audio, video, and text, and the technology that performs compression coding on video in particular is called video compression. Compression coding of video signals is achieved by removing redundant information by considering spatial, temporal, and probabilistic correlations. However, with the recent advancements in various media and data transmission media, there is a growing demand for more efficient video signal processing methods and devices.

[0003] The purpose of this specification is to provide a video signal processing method and a device therefor to improve the coding efficiency of a video signal.

[0004] The present specification provides a video signal processing method and a device therefor.

[0005] In the present specification, a video signal decoding device includes a processor, wherein the processor obtains a plurality of pairs each composed of one reference line and one intra prediction mode, the plurality of pairs including a first pair and a second pair, and obtains a list composed of a plurality of integrated pairs including a first integrated pair that combines the first pair and the second pair, and can reconstruct a current block based on one integrated pair in the list. In addition, the processor obtains a first prediction block based on a first reference line and a first intra prediction mode of the first pair, obtains a second prediction block based on a second reference line and a second intra prediction mode of the second pair, obtains a final prediction block by performing a weighted average of the first prediction block and the second prediction block, and can reconstruct the current block based on the final prediction block.

[0006] In the present specification, a video signal encoding device includes a processor, and the processor can obtain a bitstream to be decoded by a decoding method.

[0007] In the present specification, a computer-readable non-transitory storage medium can store a bitstream decoded by a decoding method.

[0008] In the present specification, a decoding method may include the steps of: obtaining a plurality of pairs each composed of one reference line and one intra prediction mode; obtaining a list composed of a plurality of integrated pairs, wherein the plurality of pairs include a first pair and a second pair, and the list includes a first integrated pair that integrates the first pair and the second pair; and reconstructing a current block based on one integrated pair in the list. In addition, the decoding method may further include the steps of: obtaining a first prediction block based on a first reference line and a first intra prediction mode of the first pair; obtaining a second prediction block based on a second reference line and a second intra prediction mode of the second pair; obtaining a final prediction block by performing a weighted average of the first prediction block and the second prediction block; and reconstructing the current block based on the final prediction block.

[0009] In the present specification, each of the plurality of pairs may be composed of a combination of different reference lines and intra prediction modes.

[0010] In the present specification, the one integrated pair in the list can be indicated based on a syntax element included in the bitstream.

[0011] In the present specification, the plurality of integrated pairs constituting the list can be sorted based on the cost of each of the plurality of integrated pairs.

[0012] In this specification, the plurality of integrated pairs may be sorted in order of their corresponding costs.

[0013] This specification provides a method for efficiently processing a video signal.

[0014] The effects that can be obtained from this specification are not limited to the effects mentioned above, and other effects that are not mentioned can be clearly understood by those skilled in the art to which the present invention pertains from the description below.

[0015] FIG. 1 is a schematic block diagram of a video signal encoding device according to one embodiment of the present invention.

[0016] FIG. 2 is a schematic block diagram of a video signal decoding device according to one embodiment of the present invention.

[0017] Figure 3 illustrates an embodiment in which a coding tree unit within a picture is divided into coding units.

[0018] Figure 4 illustrates one embodiment of a method for signaling the splitting of a quad tree and a multi-type tree.

[0019] Figures 5 and 6 illustrate the intra prediction method according to an embodiment of the present invention in more detail.

[0020] Figure 7 is a diagram showing the locations of surrounding blocks used to construct a motion candidate list in inter prediction.

[0021] FIG. 8 is a diagram illustrating a process of generating a prediction block using DIMD according to one embodiment of the present invention.

[0022] FIG. 9 is a diagram showing the locations of surrounding pixels used to derive directional information according to one embodiment of the present invention.

[0023] FIG. 10 is a diagram illustrating a method for mapping a directional mode according to one embodiment of the present invention.

[0024] FIG. 11 is a diagram showing a histogram for deriving an intra prediction directional mode according to one embodiment of the present invention.

[0025] FIG. 12 is a diagram illustrating a method for signaling a DIMD mode according to one embodiment of the present invention.

[0026] FIG. 13 is a diagram illustrating a method for signaling syntax elements related to an intra prediction mode depending on whether a DIMD mode is used according to one embodiment of the present invention.

[0027] FIG. 14 is a diagram illustrating a method for generating a prediction sample for restoring a current block according to one embodiment of the present invention.

[0028] FIG. 15 is a diagram illustrating a method for determining an intra prediction mode according to one embodiment of the present invention.

[0029] FIG. 16 illustrates a syntax structure including syntax elements related to DIMD according to one embodiment of the present invention.

[0030] FIG. 17 is a diagram showing intra prediction directional mode and weight information for neighboring blocks of a current block according to one embodiment of the present invention.

[0031] FIG. 18 is a diagram illustrating a method for determining DIMD combination information according to one embodiment of the present invention.

[0032] FIG. 19 is a diagram illustrating a method for generating a prediction sample using intra prediction directional mode information and weights according to one embodiment of the present invention.

[0033] FIG. 20 and FIG. 21 are diagrams showing pixel values ​​of surrounding blocks used when deriving an intra prediction directional mode according to one embodiment of the present invention.

[0034] FIG. 22 is a diagram illustrating a method for constructing an MPM list including an intra prediction directional mode of a current block according to one embodiment of the present invention.

[0035] FIG. 23 and FIG. 24 are diagrams showing templates used to derive an intra prediction mode of a current block according to one embodiment of the present invention.

[0036] FIGS. 25 to 28 are diagrams illustrating a method for generating prediction samples (pixels) based on a plurality of reference pixel lines according to one embodiment of the present invention.

[0037] FIG. 29 illustrates a method for predicting a sample using a plurality of reference pixel lines according to one embodiment of the present invention.

[0038] FIG. 30 illustrates a method for determining a reference pixel line based on a template according to one embodiment of the present invention.

[0039] FIG. 31 illustrates a method for setting a template for testing a reference pixel line adjacent to a current block according to one embodiment of the present invention.

[0040] FIG. 32 is a structural diagram illustrating a method for determining an optimal reference pixel line using a plurality of reference pixel lines based on a template according to one embodiment of the present invention.

[0041] FIG. 33 illustrates a method for generating prediction samples using a planar mode according to one embodiment of the present invention.

[0042] Figure 34 shows a transformation set table for LFNST and NSPT transformations according to one embodiment of the present invention.

[0043] Figure 35 shows a low frequency region of a current block according to one embodiment of the present invention.

[0044] Figure 36 illustrates a method for deriving a multi-transform set and an LFNST / NSPT set according to one embodiment of the present invention.

[0045] FIG. 37 illustrates a method for deriving a multi-transform set and an LFNST set for a vertical direction planar mode or a horizontal direction planar mode according to one embodiment of the present invention.

[0046] Figure 38 shows a mapping table according to one embodiment of the present invention.

[0047] Figure 39 shows a conversion type set table according to one embodiment of the present invention.

[0048] Figure 40 shows a conversion type combination table according to one embodiment of the present invention.

[0049] Figure 41 shows a threshold value table for an IDT conversion type according to one embodiment of the present invention.

[0050] Figure 42 shows block boundaries and samples around the boundaries in a deblocking filtering process according to one embodiment of the present invention.

[0051] FIG. 43 illustrates a method for a video signal processing device according to one embodiment of the present invention to derive a first or second transformation matrix.

[0052] Figure 44 illustrates a DC prediction method for vertical or horizontal line units according to one embodiment of the present invention.

[0053] Figure 45 illustrates a method for predicting a plane in units of vertical or horizontal lines according to one embodiment of the present invention.

[0054] Figure 46 illustrates a sub-block unit prediction method using a planar mode according to one embodiment of the present invention.

[0055] Figure 47 illustrates an intra prediction method based on bidirectional prediction according to one embodiment of the present invention.

[0056] Figure 48 illustrates types of transform kernels that can be used in video coding according to one embodiment of the present invention.

[0057] Figures 49 and 50 illustrate a portion of a sequence parameter set according to one embodiment of the present invention.

[0058] Figure 51 illustrates a portion of the general_constraint_info() syntax structure according to one embodiment of the present invention.

[0059] FIG. 52 illustrates a method for constructing an MPM list using a multi-prediction mode according to one embodiment of the present invention.

[0060] FIG. 53 shows the locations of reference pixels used when a prediction block is generated using a multi-prediction mode according to one embodiment of the present invention.

[0061] FIG. 54 illustrates a method for a video signal processing device according to an embodiment of the present invention to parse planar mode selection information and DC mode selection information from a bitstream.

[0062] FIG. 55 illustrates binarization or bin strings for planar mode selection information and DC mode selection information according to one embodiment of the present invention.

[0063] FIG. 56 illustrates a method for generating a prediction block for a current block according to a DC prediction mode according to one embodiment of the present invention.

[0064] Figure 57 illustrates a method for determining DC mode selection information according to one embodiment of the present invention.

[0065] FIG. 58 illustrates a method for generating a prediction block for a current block according to DC mode selection information according to one embodiment of the present invention.

[0066] FIG. 59 illustrates a method for generating a prediction block for a current block according to an integrated direction mode according to one embodiment of the present invention.

[0067] FIG. 60 illustrates a binarization or empty string for an integrated direction mode according to one embodiment of the present invention.

[0068] FIG. 61 illustrates reference pixels for generating a prediction block for a current block according to one embodiment of the present invention.

[0069] FIG. 62 illustrates a method for a video signal processing device according to an embodiment of the present invention to configure a reference pixel line list.

[0070] Figure 63 illustrates a method for constructing an integrated list according to one embodiment of the present invention.

[0071] Figure 64 illustrates a method for combining new candidates according to one embodiment of the present invention.

[0072] Figure 65 shows a combination table for reference pixel lines and intra prediction modes according to one embodiment of the present invention.

[0073] Figure 66 illustrates a method of using a candidate list based on a multi-prediction mode according to one embodiment of the present invention.

[0074] FIG. 67 is a diagram showing a block vector related to an IBC encoding method according to one embodiment of the present invention.

[0075] Figure 68 is a diagram illustrating a method for predicting the current block using RRIBC in the horizontal direction.

[0076] Figure 69 is a diagram illustrating a method for predicting the current block using RRIBC in the vertical direction.

[0077] Figure 70 shows a block vector of a block encoded in Intra TMP mode according to one embodiment of the present invention.

[0078] Figure 71 illustrates a case where a current block is divided by GPM mode according to one embodiment of the present invention and the divided area is encoded in IBC mode.

[0079] Figure 72 illustrates how a current block is encoded in IBC-CIIP mode according to one embodiment of the present invention.

[0080] FIG. 73 shows an example of a reference region and filter shape used to derive CCCM parameters according to one embodiment of the present invention.

[0081] Figure 74 illustrates a method for constructing an integrated list according to one embodiment of the present invention.

[0082] The terms used in this specification have been selected from widely used and current terms, taking into account the functions of the present invention. However, these terms may vary depending on the intentions of those skilled in the art, customs, or the emergence of new technologies. Furthermore, in certain cases, the applicant may arbitrarily select terms, in which case their meanings will be described in the description of the relevant invention. Therefore, it should be noted that the terms used in this specification should be interpreted based on their substantive meaning and the overall content of this specification, rather than simply their names.

[0083] In this specification, 'A and / or B' may be interpreted to mean 'comprising at least one of A or B'.

[0084] In this specification, some terms may be interpreted as follows. Coding may be interpreted as encoding or decoding, depending on the case. In this specification, a device that encodes a video signal to generate a video signal bitstream is referred to as an encoding device or encoder, and a device that decodes a video signal bitstream to restore a video signal is referred to as a decoding device or decoder. In addition, in this specification, a video signal processing device is used as a term that includes both an encoder and a decoder. Information is a term that includes values, parameters, coefficients, elements, etc., and since the meaning may be interpreted differently depending on the case, the present invention is not limited thereto. 'Unit' is used to mean a basic unit of image processing or a specific location of a picture, and refers to an image area that includes at least one of a luminance component and a chroma component. In addition, 'block' refers to an image area including specific components among luminance components and chrominance components (i.e., Cb and Cr). However, depending on the embodiment, terms such as 'unit', 'block', 'partition', 'signal', and 'region' may be used interchangeably. In addition, in this specification, 'current block' means a block that is currently scheduled to be encoded, and 'reference block' means a block that has already been encoded or decoded and is used as a reference in the current block. In addition, in this specification, terms such as 'luma', 'luminance', and 'Y' may be used interchangeably. In addition, in this specification, terms such as 'chroma', 'chroma', 'color difference', and 'Cb or Cr' may be used interchangeably, and since chrominance components are divided into two, Cb and Cr, each chrominance component may be used separately. In addition, in this specification, a unit may be used as a concept including all of a coding unit, a prediction unit, and a transformation unit.A picture refers to a field or a frame, and depending on the embodiment, the terms may be used interchangeably. Specifically, if the captured image is an interlace image, one frame is divided into an odd (or odd, top) field and an even (or even, bottom) field, and each field is configured as one picture unit and can be encoded or decoded. If the captured image is a progressive image, one frame is configured as a picture and can be encoded or decoded. In addition, in this specification, the terms 'error signal', 'residual signal', 'residual signal', 'residual signal', and 'differential signal' may be used interchangeably. In addition, in this specification, the terms 'intra prediction mode', 'intra prediction directional mode', 'intra-screen prediction mode', and 'intra-screen prediction directional mode' may be used interchangeably. In addition, in this specification, the terms 'motion', 'movement', and the like may be used interchangeably. In addition, in this specification, 'left', 'upper left', 'upper left', 'upper right', 'right', 'lower right', 'lower left', and 'lower left' can be used interchangeably with 'left', 'upper left', 'top', 'upper right', 'right', 'lower right', 'bottom', and 'lower left'. In addition, element and member can be used interchangeably with each other. POC (Picture Order Count) indicates the temporal position information of a picture (or frame), can be the playback order displayed on the screen, and can have a unique POC for each picture.

[0085] FIG. 1 is a schematic block diagram of a video signal encoding device (100) according to one embodiment of the present invention. Referring to FIG. 1, the encoding device (100) of the present invention includes a transformation unit (110), a quantization unit (115), an inverse quantization unit (120), an inverse transformation unit (125), a filtering unit (130), a prediction unit (150), and an entropy coding unit (160).

[0086] The transform unit (110) obtains a transform coefficient value by transforming the residual signal, which is the difference between the input video signal and the prediction signal generated by the prediction unit (150). For example, a discrete cosine transform (DCT), a discrete sine transform (DST), or a wavelet transform may be used. The discrete cosine transform and the discrete sine transform divide the input picture signal into blocks and perform the transformation. The coding efficiency may vary depending on the distribution and characteristics of the values ​​within the transform domain during the transformation. The transform kernel used for the transformation on the residual block may be a transform kernel having separable characteristics of vertical transformation and horizontal transformation. In this case, the transformation on the residual block may be performed separately as vertical transformation and horizontal transformation. For example, the encoder may perform vertical transformation by applying the transform kernel in the vertical direction of the residual block. Additionally, the encoder can perform horizontal transformation by applying a transformation kernel in the horizontal direction of the residual block. In the present disclosure, the transformation kernel may be used as a term referring to a set of parameters used for transformation of the residual signal, such as a transformation matrix, a transformation array, a transformation function, or a transformation. For example, the transformation kernel may be any one of a plurality of available kernels. Additionally, transformation kernels based on different transformation types may be used for each of the vertical transformation and the horizontal transformation.

[0087] The transformation coefficients are distributed in a way that increases toward the upper left corner of the block, and decreases toward 0 toward the lower right corner. As the current block size increases, there is a high probability of a significant number of 0 coefficients in the lower right corner. To reduce the transformation complexity of large blocks, the remaining regions can be reset to 0, leaving only the upper left corner as an arbitrary region.

[0088] Additionally, error signals may exist only in some regions of a coding block. In this case, the conversion process may be performed only on some arbitrary regions. For example, in a block of size 2Nx2N, an error signal may exist only in the first 2NxN block, and the conversion process may be performed only on the first 2NxN block, but the conversion process may not be performed on the second 2NxN block and may not be encoded or decoded. Here, N can be any positive integer.

[0089] The encoder may perform an additional transform before the transform coefficients are quantized. The aforementioned transform method may be referred to as a primary transform, and the additional transform may be referred to as a secondary transform. The secondary transform may be optional for each residual block. In one embodiment, the encoder may improve coding efficiency by performing the secondary transform on areas where it is difficult to concentrate energy in the low-frequency region using only the primary transform. For example, the secondary transform may be additionally performed on blocks where residual values ​​appear large in directions other than the horizontal or vertical direction of the residual block. Unlike the primary transform, the secondary transform may not be performed separately into a vertical transform and a horizontal transform. Such a secondary transform may be referred to as a Low Frequency Non-Separable Transform (LFNST).

[0090] The quantization unit (115) quantizes the transformation coefficient value output from the transformation unit (110).

[0091] In order to increase coding efficiency, rather than coding the picture signal as it is, a method is used to predict a picture using an already coded area through a prediction unit (150), and to obtain a restored picture by adding the residual value between the original picture and the predicted picture to the predicted picture. In order to prevent mismatches from occurring in the encoder and decoder, when the encoder performs prediction, information that is also available to the decoder must be used. To this end, the encoder performs a process of restoring the encoded current block. The inverse quantization unit (120) inversely quantizes the transform coefficient value, and the inverse transform unit (125) restores the residual value using the inverse quantized transform coefficient value. Meanwhile, the filtering unit (130) performs a filtering operation to improve the quality of the restored picture and enhance the coding efficiency. For example, a deblocking filter, a sample adaptive offset (SAO), and an adaptive loop filter may be included. The filtered picture is stored in the Decoded Picture Buffer (DPB, 156) to be output or used as a reference picture.

[0092] A deblocking filter is a filter that removes distortion within blocks generated at the boundaries between blocks in a reconstructed picture. The encoder can determine whether to apply a deblocking filter to a certain boundary based on the distribution of pixels in several columns or rows based on an arbitrary boundary (edge) within the block. When applying a deblocking filter to a block, the encoder can apply a long filter, a strong filter, or a weak filter depending on the deblocking filtering strength. Additionally, horizontal and vertical filtering can be processed in parallel. Sample adaptive offset (SAO) can be used to correct the offset from the original image on a pixel-by-pixel basis for the residual block to which the deblocking filter has been applied. To correct the offset for a specific picture, the encoder can divide the pixels contained in the image into a certain number of regions, determine the regions to perform offset correction, and apply the offset to those regions (Band Offset). Alternatively, the encoder can use a method (Edge Offset) that applies an offset by considering the edge information of each pixel. An adaptive loop filter (ALF) is a method that divides pixels included in an image into a predetermined group, determines a filter to be applied to each group, and performs filtering differently for each group. Information regarding whether to apply ALF can be signaled on a coding unit basis, and the shape and filter coefficients of the ALF filter to be applied can vary depending on each block. In addition, an ALF filter of the same shape (fixed shape) can be applied regardless of the characteristics of the target block to which it is applied.

[0093] The prediction unit (150) includes an intra prediction unit (152) and an inter prediction unit (154). The intra prediction unit (152) performs intra prediction within a current picture, and the inter prediction unit (154) performs inter prediction to predict the current picture using a reference picture stored in a decoded picture buffer (156). The intra prediction unit (152) performs intra prediction from reconstructed regions within the current picture and transfers intra encoding information to the entropy coding unit (160). The intra encoding information may include at least one of an intra prediction mode, an MPM (Most Probable Mode) flag, an MPM index, and information about a reference sample. The inter prediction unit (154) may be configured to include a motion estimation unit (154a) and a motion compensation unit (154b). The motion estimation unit (154a) refers to a specific area of ​​the restored reference picture to find the part most similar to the current area and obtains a motion vector value, which is the distance between the areas. The motion information (reference direction indication information (L0 prediction, L1 prediction, bidirectional prediction), reference picture index, motion vector information, etc.) for the reference area obtained by the motion estimation unit (154a) is transferred to the entropy coding unit (160) so that it can be included in the bitstream. Using the motion information transferred from the motion estimation unit (154a), the motion compensation unit (154b) performs inter-motion compensation to generate a prediction block for the current block. The inter-prediction unit (154) transfers inter-encoding information including motion information for the reference area to the entropy coding unit (160).

[0094] According to an additional embodiment, the prediction unit (150) may include an intra block copy (IBC) prediction unit (not shown). The IBC prediction unit performs IBC prediction on reconstructed samples in the current picture and transfers IBC encoding information to the entropy coding unit (160). The IBC prediction unit obtains a block vector value indicating a reference region used for prediction of the current region by referring to a specific region in the current picture. The IBC prediction unit may perform IBC prediction using the obtained block vector value. The IBC prediction unit transfers the IBC encoding information to the entropy coding unit (160). The IBC encoding information may include at least one of size information of the reference region, block vector information (index information for block vector prediction of the current block within a motion candidate list, and block vector difference information).

[0095] When the picture prediction as above is performed, the transformation unit (110) obtains a transformation coefficient value by transforming the residual value between the original picture and the predicted picture. At this time, the transformation can be performed in units of specific blocks within the picture, and the size of the specific block can be varied within a preset range. The quantization unit (115) quantizes the transformation coefficient value generated by the transformation unit (110) and transfers the quantized transformation coefficient to the entropy coding unit (160).

[0096] The quantized transform coefficients in the form of a two-dimensional array can be rearranged into a one-dimensional array for entropy coding. The method of scanning the quantized transform coefficients can be determined by which scanning method is used depending on the size of the transform block and the prediction mode within the screen. For example, diagonal, vertical, and horizontal scanning can be applied. This scanning information can be signaled on a block-by-block basis and can be derived according to predetermined rules.

[0097] The entropy coding unit (160) entropy-codes information representing quantized transform coefficients, intra-coding information, inter-coding information, etc. to generate a video signal bitstream. The entropy coding unit (160) may use a variable length coding (VLC) method and an arithmetic coding method. The variable length coding (VLC) method converts input symbols into continuous codewords, and the length of the codewords may be variable. For example, frequently occurring symbols are expressed as short codewords, and infrequently occurring symbols are expressed as long codewords. A context-based adaptive variable length coding (CAVLC) method may be used as a variable length coding method. Arithmetic coding converts continuous data symbols into a single prime number by using the probability distribution of each data symbol, and arithmetic coding can obtain the optimal prime number bits required to express each symbol. Context-based Adaptive Binary Arithmetic Code (CABAC) can be used as an arithmetic coding.

[0098] CABAC is a binary arithmetic coding method that uses multiple context models generated based on experimentally obtained probabilities. The context models can also be referred to as context models. First, if the symbols are not in binary form, the encoder binarizes each symbol using exp-Golomb, etc. The binarized 0 or 1 can be described as a bin. The CABAC initialization process is divided into context initialization and arithmetic coding initialization. Context initialization is the process of initializing the occurrence probability of each symbol, and is determined by the symbol type, quantization parameter (QP), and slice type (I, P, B). A context model with this initialization information can use probability-based values ​​obtained through experiments. The context model provides the occurrence probability of the Least Probable Symbol (LPS) or Most Probable Symbol (MPS) for the symbol to be currently encoded, as well as information (valMPS) on which bin value corresponds to the MPS between 0 and 1. One of several context models is selected through the context index (ctxIdx), and the context index can be derived from information about the current block to be encoded or information about the surrounding blocks. Initialization for binary arithmetic coding is performed based on the probability model selected from the context model. Binary arithmetic coding is performed by dividing the data into probability intervals based on the occurrence probabilities of 0 and 1, and then encoding is performed through a process in which the probability interval corresponding to the bin to be processed becomes the entire probability interval for the bin to be processed next. The location information within the probability interval in which the last bin has been processed is output. However, since the probability interval cannot be divided infinitely, if it is reduced to a certain size, a renormalization process is performed to expand the probability interval and output the corresponding location information. In addition, after each bin is processed, a probability update process can be performed in which the probability for the next bin to be processed is newly set based on the information of the processed bin.

[0099] The above generated bitstream is encapsulated into NAL (Network Abstraction Layer) units as basic units. NAL units are divided into VCL (Video Coding Layer) NAL units containing video data and non-VCL NAL units containing parameter information for decoding video data, and there are various types of VCL or non-VCL NAL units. A NAL unit consists of NAL header information and RBSP (Raw Byte Sequence Payload) data, and the NAL header information includes summary information about the RBSP. The RBSP of a VCL NAL unit includes an integer number of encoded coding tree units. In order to decode a bitstream in a video decoder, the bitstream must first be divided into NAL unit units, and then each divided NAL unit must be decoded. Meanwhile, information required for decoding a video signal bitstream can be transmitted as included in a Video Parameter Set (VPS), a Sequence Parameter Set (SPS), a Picture Parameter Set (PPS), an Adaptation Parameter Set (APS), etc. An RBSP of a VCL NAL unit can include an integer number of coding tree units. A VPS is a parameter set configured with a common syntax by extracting duplicate parameters from an SPS parameter set signaled for each layer in a bitstream that supports image quality, resolution, and frame rate scalability or a bitstream that supports multi-view.SPS is a parameter set that includes at least one of the following: Profile, which contains information about acceptable coding tools (or algorithms) and video formats; Level, which contains information about the decoder's processing capabilities, such as the resolution and frame rate of processable video and the allowable memory size; Tier, which contains information about the maximum bit rate that can be processed; and information about the resolution, bit depth, and whether or not a function can be enabled. PPS is a parameter set that includes at least one of the following: resolution of the video, tile division information, whether or not to enable weight prediction, quantization parameters, and filtering-related information. APS is a parameter set that includes one of the following: ALF filter coefficient information, LMCS-related parameters, and quantization scale parameters, depending on the APS type. APS is divided into prefix APS, which is signaled before the VCL NAL unit, and suffix APS, which is signaled after the VCL NAL unit. In the case of ALF APS, it is efficient to apply the ALF filter coefficients derived from the previous picture to the next picture, so it can be signaled as suffix APS.

[0100] Meanwhile, the block diagram of FIG. 1 illustrates an encoding device (100) according to one embodiment of the present invention, and the blocks shown separately logically distinguish elements of the encoding device (100). Accordingly, the elements of the encoding device (100) described above may be mounted as one chip or as multiple chips depending on the design of the device. According to one embodiment, the operations of each element of the encoding device (100) described above may be performed by a processor (not shown).

[0101] Fig. 2 is a schematic block diagram of a video signal decoding device (200) according to one embodiment of the present invention. Referring to Fig. 2, the decoding device (200) of the present invention includes an entropy decoding unit (210), an inverse quantization unit (220), an inverse transformation unit (225), a filtering unit (230), and a prediction unit (250).

[0102] The entropy decoding unit (210) entropy decodes the video signal bitstream to extract transform coefficient information, intra-coding information, inter-coding information, etc. for each region. For example, the entropy decoding unit (210) can obtain a binarization code for transform coefficient information of a specific region from the video signal bitstream. In addition, the entropy decoding unit (210) inversely binarizes the binarization code to obtain a quantized transform coefficient. The inverse quantization unit (220) inversely quantizes the quantized transform coefficient, and the inverse transform unit (225) restores the residual value using the inverse quantized transform coefficient. The video signal processing device (200) restores the original pixel value by adding the residual value obtained by the inverse transform unit (225) and the prediction value obtained by the prediction unit (250).

[0103] Meanwhile, the filtering unit (230) performs filtering on the picture to improve the image quality. This may include a deblocking filter to reduce block distortion and / or an adaptive loop filter to remove distortion from the entire picture. The filtered picture is output or stored in the decoded picture buffer (DPB, 256) to be used as a reference picture for the next picture.

[0104] The prediction unit (250) includes an intra prediction unit (252) and an inter prediction unit (254). The prediction unit (250) generates a prediction picture by utilizing the encoding type decoded through the entropy decoding unit (210) described above, the transform coefficients for each region, intra / inter encoding information, etc. In order to restore the current block on which decoding is performed, the decoded region of the current picture or other pictures including the current block may be used. A picture (or tile / slice) that uses only the current picture for restoration, i.e., performs intra prediction or intra BC prediction, is called an intra picture or I picture (or tile / slice), and a picture (or tile / slice) that can perform all of intra prediction, inter prediction, and intra BC prediction is called an inter picture (or tile / slice). A picture (or tile / slice) that uses at most one motion vector and reference picture index to predict sample values ​​of each block among inter-pictures (or tiles / slices) is called a predictive picture or P-picture (or tile / slice), and a picture (or tile / slice) that uses at most two motion vectors and reference picture indices is called a bi-predictive picture or B-picture (or tile / slice). In other words, a P-picture (or tile / slice) uses at most one motion information set to predict each block, and a B-picture (or tile / slice) uses at most two motion information sets to predict each block. Here, a motion information set includes one or more motion vectors and one reference picture index.

[0105] The intra prediction unit (252) generates a prediction block using intra encoding information and reconstructed samples within the current picture. As described above, the intra encoding information may include at least one of an intra prediction mode, a Most Probable Mode (MPM) flag, and an MPM index. The intra prediction unit (252) predicts sample values ​​of the current block using reconstructed samples located on the left and / or above the current block as reference samples. In the present disclosure, the reconstructed samples, the reference samples, and the samples of the current block may represent pixels. Additionally, the sample values ​​may represent pixel values.

[0106] According to one embodiment, the reference samples may be samples included in a neighboring block of the current block. For example, the reference samples may be samples adjacent to a left boundary of the current block and / or samples adjacent to an upper boundary. In addition, the reference samples may be samples located on a line within a preset distance from a left boundary of the current block and / or samples located on a line within a preset distance from an upper boundary of the current block among samples of neighboring blocks of the current block. In this case, the neighboring blocks of the current block may include at least one of a left (L) block, an upper (A) block, a lower left (BL) block, an above right (AR) block, or an above left (AL) block adjacent to the current block.

[0107] The inter prediction unit (254) generates a prediction block using the reference picture and inter encoding information stored in the decoded picture buffer (256). The inter encoding information may include a set of motion information (reference picture index, motion vector information, etc.) of the current block with respect to the reference block. Inter prediction may include L0 prediction, L1 prediction, and bi-prediction. L0 prediction is prediction using one reference picture included in the L0 picture list, and L1 prediction means prediction using one reference picture included in the L1 picture list. For this, one set of motion information (e.g., motion vector and reference picture index) may be required. In the bi-prediction method, up to two reference areas can be used, and these two reference areas may exist in the same reference picture or may exist in different pictures, respectively. That is, in the bi-prediction method, up to two sets of motion information (e.g., motion vectors and reference picture indices) can be used, and the two motion vectors may correspond to the same reference picture index or may correspond to different reference picture indices. At this time, the reference pictures are pictures that are located temporally before or after the current picture, and may be completed pictures that have already been restored. According to one embodiment, the two reference areas used in the bi-prediction method may be areas selected from each of the L0 picture list and the L1 picture list. In addition, a prediction method that uses only reference pictures having a POC smaller than the POC of the current picture or uses only reference pictures having a POC larger than the POC of the current picture based on the POC (picture order count) indicating the display order of the current picture can be called uni-directional prediction.Also, a prediction method that uses both a reference picture with a POC (picture order count) smaller than that of the current picture and a reference picture with a POC larger than that of the current picture based on the POC indicating the display order of the current picture can be called bi-directional prediction. A prediction method that uses only one reference picture in uni-directional prediction can be called uni-prediction, and a prediction method that uses two reference pictures in uni-directional prediction can be called bi-prediction or bi-prediction.

[0108] The inter prediction unit (254) can obtain a reference block of the current block using a motion vector and a reference picture index. The reference block exists in a reference picture corresponding to the reference picture index. In addition, a sample value of a block specified by the motion vector or an interpolated value thereof can be used as a predictor of the current block. For motion prediction with sub-pel unit pixel accuracy, for example, an 8-tap interpolation filter can be used for a luminance signal and a 4-tap interpolation filter can be used for a chrominance signal. However, the interpolation filter for sub-pel unit motion prediction is not limited thereto. In this way, the inter prediction unit (254) performs motion compensation to predict the texture of the current unit from a previously restored picture. At this time, the inter prediction unit can use a motion information set.

[0109] According to an additional embodiment, the prediction unit (250) may include an IBC prediction unit (not shown). The IBC prediction unit may reconstruct the current region by referring to a specific region including reconstructed samples within the current picture. The IBC prediction unit may perform IBC prediction using IBC encoding information obtained from the entropy decoding unit (210). The IBC encoding information may include block vector information.

[0110] A restored video picture is generated by adding the predicted value output from the intra prediction unit (252) or inter prediction unit (254) and the residual value output from the inverse transformation unit (225). That is, the video signal decoding device (200) restores the current block using the predicted block generated from the prediction unit (250) and the residual obtained from the inverse transformation unit (225).

[0111] Meanwhile, the block diagram of FIG. 2 illustrates a decoding device (200) according to one embodiment of the present invention, and the blocks shown separately logically distinguish the elements of the decoding device (200). Accordingly, the elements of the aforementioned decoding device (200) may be mounted as one chip or as multiple chips depending on the design of the device. According to one embodiment, the operations of each element of the aforementioned decoding device (200) may be performed by a processor (not shown).

[0112] Meanwhile, the technology proposed in this specification is applicable to both the methods and devices of the encoder and decoder, and the parts described as signaling and parsing may be described for convenience of explanation. In general, signaling can be described as encoding each syntax from the encoder's perspective, and parsing can be described as interpreting each syntax from the decoder's perspective. That is, each syntax can be included in the bitstream from the encoder and signaled, and the decoder can parse the syntax and use it in the restoration process. At this time, the sequence of bits for each syntax listed in the prescribed hierarchical structure can be referred to as a bitstream.

[0113] A picture can be encoded by dividing it into sub-pictures, slices, tiles, etc. A sub-picture can include one or more slices or tiles. When a picture is encoded by dividing it into multiple slices or tiles, all slices or tiles within the picture must be decoded before it can be displayed on the screen. On the other hand, when a picture is encoded into multiple sub-pictures, only any sub-picture can be decoded and displayed on the screen. A slice can include multiple tiles or sub-pictures, or a tile can include multiple sub-pictures or slices. Sub-pictures, slices, and tiles can be encoded or decoded independently, which is effective for parallel processing and improving processing speed. However, there is a disadvantage in that the amount of bits increases because the encoded information of adjacent sub-pictures, slices, and tiles cannot be used. Sub-pictures, slices, and tiles can be encoded by dividing them into multiple coding tree units (CTUs).

[0114] FIG. 3 illustrates an embodiment in which a Coding Tree Unit (CTU) within a picture is divided into Coding Units (CUs). In the process of coding a video signal, a picture may be divided into a sequence of Coding Tree Units (CTUs). A Coding Tree Unit may be composed of a luminance (luma) Coding Tree Block (CTB), two chroma (chroma) Coding Tree Blocks, and their encoded syntax information. One Coding Tree Unit may be composed of one Coding Unit, or one Coding Tree Unit may be split into multiple Coding Units. One Coding Unit may be composed of a luminance Coding Block (CB), two chroma Coding Blocks, and their encoded syntax information. One Coding Block may be split into multiple Sub-Coding Blocks. One Coding Unit may be composed of one Transform Unit (TU), or one Coding Unit may be split into multiple Transform Units. A single transform unit may consist of a luminance transform block (TB), two chrominance transform blocks, and their encoded syntax information. A coding tree unit may be divided into multiple coding units. A coding tree unit may not be divided and may also be a leaf node. In this case, the coding tree unit itself may be a coding unit.

[0115] A coding unit refers to a basic unit for processing a picture in the video signal processing described above, such as intra / inter prediction, transformation, quantization, and / or entropy coding. The size and shape of a coding unit within a picture may not be constant. A coding unit may have a square or rectangular shape. A rectangular coding unit (or rectangular block) includes a vertical coding unit (or vertical block) and a horizontal coding unit (or horizontal block). In the present specification, a vertical block is a block whose height is greater than its width, and a horizontal block is a block whose width is greater than its height. In addition, a non-square block in the present specification may refer to a rectangular block, but the present invention is not limited thereto.

[0116] Referring to Fig. 3, the coding tree unit is first partitioned into a Quad Tree (QT) structure. That is, in the Quad Tree structure, one node with a size of 2NX2N can be partitioned into four nodes with a size of NXN. In this specification, the Quad Tree may also be referred to as a quaternary tree. The Quad Tree partitioning can be performed recursively, and not all nodes need to be partitioned to the same depth.

[0117] Meanwhile, the leaf node of the aforementioned quad tree can be further split into a multi-type tree (MTT) structure. According to an embodiment of the present invention, in the multi-type tree structure, one node can be split into a binary or ternary tree structure of horizontal or vertical split. That is, the multi-type tree structure has four split structures: vertical binary split, horizontal binary split, vertical ternary split, and horizontal ternary split. According to an embodiment of the present invention, in each of the above tree structures, the width and height of the node can both have a power of 2 value. For example, in the binary tree (BT) structure, a node of size 2NX2N can be split into two NX2N nodes by vertical binary split, and can be split into two 2NXN nodes by horizontal binary split. Also, in a Ternary Tree (TT) structure, a node of size 2NX2N can be split into nodes of size (N / 2)X2N, NX2N, and (N / 2)X2N by vertical ternary splitting, and into nodes of size 2NX(N / 2), 2NXN, and 2NX(N / 2) by horizontal ternary splitting. This multi-type tree splitting can be performed recursively.

[0118] A leaf node of a multi-type tree can be a coding unit. If the coding unit is not larger than the maximum transformation length, the coding unit can be used as a unit of prediction and / or transformation without further splitting. In one embodiment, if the width or height of the current coding unit is larger than the maximum transformation length, the current coding unit can be split into multiple transformation units without explicit signaling regarding the splitting. Meanwhile, in the quad tree and multi-type tree described above, at least one of the following parameters can be predefined or transmitted through an RBSP of a higher-level set, such as a PPS, an SPS, or a VPS. 1) CTU size: The size of the root node of the quad tree, 2) MinQtSize: The minimum allowed QT leaf node size, 3) MaxBtSize: The maximum allowed BT root node size, 4) MaxTT size (MaxTtSize): The maximum allowed TT root node size, 5) MaxMttDepth: The maximum allowed depth of an MTT split from a leaf node of a QT, 6) MinBT size (MinBtSize): The minimum allowed BT leaf node size, 7) MinTT size (MinTtSize): The minimum allowed TT leaf node size.

[0119] Fig. 4 illustrates one embodiment of a method for signaling splitting of a quad tree and a multi-type tree. Pre-configured flags may be used to signal splitting of the quad tree and the multi-type tree described above. Referring to Fig. 4, at least one of a flag 'split_cu_flag' indicating whether a node is split, a flag 'split_qt_flag' indicating whether a quad tree node is split, a flag 'mtt_split_cu_vertical_flag' indicating a splitting direction of a multi-type tree node, or a flag 'mtt_split_cu_binary_flag' indicating a splitting shape of a multi-type tree node may be used.

[0120] According to an embodiment of the present invention, a flag 'split_cu_flag' indicating whether a current node is split may be signaled first. If the value of 'split_cu_flag' is 0, it indicates that the current node is not split, and the current node becomes a coding unit. If the current node is a coding tree unit, the coding tree unit includes one coding unit that is not split. If the current node is a quad tree node 'QT node', the current node is a leaf node 'QT leaf node' of the quad tree and becomes a coding unit. If the current node is a multi-type tree node 'MTT node', the current node is a leaf node 'MTT leaf node' of the multi-type tree and becomes a coding unit.

[0121] When the value of 'split_cu_flag' is 1, the current node can be split into nodes of a quad tree or a multi-type tree depending on the value of 'split_qt_flag'. The coding tree unit is the root node of the quad tree and can be first split into a quad tree structure. In the quad tree structure, 'split_qt_flag' is signaled for each node 'QT node'. When the value of 'split_qt_flag' is 1, the node is split into four square nodes, and when the value of 'split_qt_flag' is 0, the node becomes a leaf node 'QT leaf node' of the quad tree, and the node is split into multi-type nodes. According to an embodiment of the present invention, quad tree splitting can be limited depending on the type of the current node. Quad tree splitting may be allowed if the current node is a coding tree unit (root node of a quad tree) or a quad tree node, and quad tree splitting may not be allowed if the current node is a multi-type tree node. Each quad tree leaf node 'QT leaf node' may be further split into a multi-type tree structure. As described above, if 'split_qt_flag' is 0, the current node may be split into multi-type nodes. To indicate the splitting direction and splitting shape, 'mtt_split_cu_vertical_flag' and 'mtt_split_cu_binary_flag' may be signaled. If the value of 'mtt_split_cu_vertical_flag' is 1, a vertical split of the node 'MTT node' is indicated, and if the value of 'mtt_split_cu_vertical_flag' is 0, a horizontal split of the node 'MTT node' is indicated.Additionally, if the value of 'mtt_split_cu_binary_flag' is 1, the node 'MTT node' is split into two rectangular nodes, and if the value of 'mtt_split_cu_binary_flag' is 0, the node 'MTT node' is split into three rectangular nodes.

[0122] The tree partitioning structure allows luminance blocks and chrominance blocks to be partitioned in the same manner. That is, the chrominance blocks can be partitioned by referring to the partitioning form of the luminance blocks. If the current chrominance block is smaller than a predetermined size, the chrominance block may not be partitioned even if the luminance block is partitioned.

[0123] The tree partitioning structure may have different forms for luminance blocks and chrominance blocks. In this case, partitioning information for the luminance block and partitioning information for the chrominance block may be signaled separately. Furthermore, not only the partitioning information but also the encoding information for the luminance block and chrominance block may differ. For example, at least one of the intra-coding modes of the luminance block and the chrominance block, and the encoding information for motion information, may differ.

[0124] A node to be divided into the smallest unit can be processed as a single coding block. If the current block is a coding block, the coding block can be divided into multiple sub-blocks (sub-coding blocks), and the prediction information of each sub-block can be the same or different. For example, if the coding unit is an intra mode, the intra prediction modes of each sub-block can be the same or different. Furthermore, if the coding unit is an inter mode, the motion information of each sub-block can be the same or different. Furthermore, each sub-block can be encoded or decoded independently. Each sub-block can be distinguished by a sub-block index (sbIdx). Furthermore, when a coding unit is divided into sub-blocks, it can be divided horizontally, vertically, or diagonally. In intra mode, the mode that divides the current coding unit into two or four sub-blocks horizontally or vertically is called ISP (Intra Sub-Partitions). In inter mode, the mode that divides the current coding block diagonally is called GPM (Geometric partitioning mode). In GPM mode, the position and direction of the diagonal line are derived using a predefined angle table, and the index information of the angle table is signaled.

[0125] The motion information may include one or more of reference direction indication information, reference picture information, motion vector, motion resolution, affine model, CPMV (control point motion vector), block vector, block vector resolution, MHP information, LIC information, filtering information, BCW information, and RRIBC information.

[0126] The reference direction indication information is composed of L0 prediction, L1 prediction, L0 and L1 prediction, and L0 prediction and L1 prediction are uni-prediction and unidirectional prediction, and L0 and L1 prediction are bi-prediction. And L0 and L1 prediction can be uni-prediction or bi-directional prediction. Here, L0 prediction is predicted using reference pictures in the L0 reference picture list, and L1 prediction can be predicted using reference pictures in the L1 reference picture list. In the L0 reference picture list, a reference picture with a POC smaller than the POC of the current picture can be added to the reference picture list based on the POC of the current picture. In addition, the L0 reference picture list can be composed in order from a reference picture with a POC closer to the POC of the current picture to a reference picture with a POC farther from the POC. In the L1 reference picture list, a reference picture with a POC larger than the POC of the current picture can be added to the reference picture list based on the POC of the current picture. Additionally, the L1 reference picture list can be organized in the order of reference pictures with a POC closer to the POC of the current picture to reference pictures with a POC farther away. The L0 and L1 reference picture lists can vary for each slice, subpicture, and picture. Additionally, the L0 reference picture list can include reference pictures of the L1 reference picture list. And the L1 reference picture list can include reference pictures of the L0 reference picture list.

[0127] Reference picture information may vary for each block and may be index information indicating which reference picture in the L0 reference picture list and / or the L1 reference picture list is used to predict the current block. The reference picture information may include one or more of L0 reference picture information and L1 reference picture information.

[0128] A motion vector is information that indicates the block that best matches the current block in a reference picture. It is a value that represents the distance to the reference block in horizontal and vertical coordinates based on the upper left position of the current block in the picture.

[0129] Motion resolution represents the resolution of the motion vector, and motion resolution can be expressed in units of 4 pixels, 1 pixel (integer pixel), 1 / 2 pixel, 1 / 4 pixel, 1 / 8 pixel, 1 / 16 pixel, etc.

[0130] A block vector is information indicating the block that best matches the current block in the already restored area within the current picture. It is a value that represents the distance to the reference block in horizontal and vertical coordinates based on the upper left position of the current block within the picture.

[0131] Block vector resolution can be expressed in units of 4 pixels, 1 pixel (integer pixel), 1 / 2 pixel, 1 / 4 pixel, 1 / 8 pixel, 1 / 16 pixel, etc.

[0132] MHP information may include whether additional motion information is applied and additional motion information.

[0133] LIC information may include whether LIC applies to the current block.

[0134] Filtering information may include filtering type and coefficient information applied according to the motion resolution of the current block.

[0135] CW information may include whether BCW is applied to the current block.

[0136] RRIBC information may include information about whether RRIBC is applied and the RRIBC type if the current block is encoded in IBC mode.

[0137] Picture prediction (motion compensation) for coding is performed on coding units that are no longer divisible (i.e., leaf nodes of a coding tree unit). The basic unit performing this prediction is referred to below as a prediction unit or prediction block.

[0138] Hereinafter, the term "unit" used in this specification may be used as a replacement for the prediction unit, which is the basic unit for performing prediction. However, the present invention is not limited thereto, and can be understood more broadly as a concept that includes the coding unit.

[0139] Figures 5 and 6 illustrate an intra prediction method according to an embodiment of the present invention in more detail. As described above, the intra prediction unit predicts sample values ​​of the current block using restored samples located to the left and / or above the current block as reference samples.

[0140] First, FIG. 5 illustrates an embodiment of reference samples used for prediction of a current block in an intra prediction mode. According to an embodiment, the reference samples may be samples adjacent to a left boundary of the current block and / or samples adjacent to an upper boundary. As illustrated in FIG. 5, when the size of the current block is WXH and samples of a single reference line adjacent to the current block are used for intra prediction, reference samples may be set using at most 2W+2H+1 surrounding samples located on the left and / or upper sides of the current block.

[0141] Meanwhile, pixels of multiple reference lines may be used for intra prediction of the current block. The multiple reference lines may be composed of n lines located within a preset range from the current block. According to one embodiment, when pixels of multiple reference lines are used for intra prediction, separate index information indicating the lines to be set as reference pixels may be signaled, and this may be referred to as a reference line index.

[0142] In addition, if at least some of the samples to be used as reference samples have not yet been restored, the intra prediction unit may perform a reference sample padding process to obtain a reference sample. In addition, the intra prediction unit may perform a reference sample filtering process to reduce an error in intra prediction. That is, filtering may be performed on the surrounding samples and / or the reference samples obtained by the reference sample padding process to obtain filtered reference samples. The intra prediction unit predicts samples of the current block using the reference samples obtained in this manner. The intra prediction unit predicts samples of the current block using unfiltered reference samples or filtered reference samples. In the present disclosure, the surrounding samples may include samples on at least one reference line. For example, the surrounding samples may include adjacent samples on a line adjacent to a boundary of the current block.

[0143] Next, FIG. 6 illustrates an embodiment of prediction modes used for intra prediction. For intra prediction, intra prediction mode information indicating an intra prediction direction may be signaled. The intra prediction mode information indicates any one of a plurality of intra prediction modes constituting an intra prediction mode set. If the current block is an intra prediction block, the decoder receives intra prediction mode information of the current block from the bitstream. The intra prediction unit of the decoder performs intra prediction on the current block based on the extracted intra prediction mode information.

[0144] According to an embodiment of the present invention, an intra prediction mode set may include all intra prediction modes used for intra prediction (e.g., a total of 67 intra prediction modes). More specifically, the intra prediction mode set may include a planar mode, a DC mode, and a plurality of (e.g., 65) angular modes (i.e., directional modes). Each intra prediction mode may be indicated by a preset index (i.e., an intra prediction mode index). For example, as illustrated in FIG. 6, an intra prediction mode index 0 indicates a planar mode, and an intra prediction mode index 1 indicates a DC mode. In addition, intra prediction mode indices 2 to 66 may each indicate different angular modes. The angular modes each indicate different angles within a preset angular range. For example, an angular mode may indicate an angle within an angular range from 45 degrees to -135 degrees clockwise (i.e., a first angular range). The angular mode may be defined based on the 12 o'clock direction. At this time, intra prediction mode index 2 indicates horizontal diagonal (HDIA) mode, intra prediction mode index 18 indicates horizontal (HOR) mode, intra prediction mode index 34 indicates diagonal (DIA) mode, intra prediction mode index 50 indicates vertical (VER) mode, and intra prediction mode index 66 indicates vertical diagonal (VDIA) mode.

[0145] Meanwhile, the preset angle range may be set differently depending on the shape of the current block. For example, if the current block is a rectangular block, a wide-angle mode indicating an angle exceeding 45 degrees or less than -135 degrees in a clockwise direction may be additionally used. If the current block is a horizontal block, the angle mode may indicate an angle within an angle range (i.e., a second angle range) between (45+offset1) degrees and (-135+offset1) degrees in a clockwise direction. At this time, angle modes 67 to 76 that are outside the first angle range may be additionally used. In addition, if the current block is a vertical block, the angle mode may indicate an angle within an angle range (i.e., a third angle range) between (45-offset2) degrees and (-135-offset2) degrees in a clockwise direction. At this time, angle modes -10 to -1 that are outside the first angle range may be additionally used. According to an embodiment of the present invention, the values ​​of offset1 and offset2 may be determined differently depending on the ratio between the width and height of the rectangular block. Also, offset1 and offset2 can be positive.

[0146] According to an additional embodiment of the present invention, the plurality of angular modes constituting the intra prediction mode set may include a basic angular mode and an extended angular mode. In this case, the extended angular mode may be determined based on the basic angular mode.

[0147] According to one embodiment, the basic angle mode may be a mode corresponding to an angle used in intra prediction of the existing HEVC (High Efficiency Video Coding) standard, and the extended angle mode may be a mode corresponding to an angle newly added in intra prediction of the next-generation video codec standard. More specifically, the basic angle mode may be an angle mode corresponding to any one of the intra prediction modes {2, 4, 6, … , 66}, and the extended angle mode may be an angle mode corresponding to any one of the intra prediction modes {3, 5, 7, … , 65}. That is, the extended angle mode may be an angle mode between the basic angle modes within the first angle range. Therefore, the angle indicated by the extended angle mode may be determined based on the angle indicated by the basic angle mode.

[0148] According to another embodiment, the basic angle mode may be a mode corresponding to an angle within a preset first angle range, and the extended angle mode may be a wide-angle mode outside the first angle range. That is, the basic angle mode may be an angle mode corresponding to any one of the intra prediction modes {2, 3, 4, … , 66}, and the extended angle mode may be an angle mode corresponding to any one of the intra prediction modes {-14, –13, –12, … , –1} and {67, 68, … , 80}. The angle indicated by the extended angle mode may be determined as an opposite angle to the angle indicated by the corresponding basic angle mode. Accordingly, the angle indicated by the extended angle mode may be determined based on the angle indicated by the basic angle mode. Meanwhile, the number of extended angle modes is not limited thereto, and additional extended angles may be defined according to the size and / or shape of the current block. Meanwhile, the total number of intra prediction modes included in the intra prediction mode set may vary depending on the configuration of the basic angle mode and the extended angle mode described above.

[0149] In the above embodiment, the spacing between the extended angular modes may be set based on the spacing between the corresponding basic angular modes. For example, the spacing between the extended angular modes {3, 5, 7, … , 65} may be determined based on the spacing between the corresponding basic angular modes {2, 4, 6, … , 66}. In addition, the spacing between the extended angular modes {-14, -13, … , -1} may be determined based on the spacing between the corresponding opposite basic angular modes {53, 53, … , 66}, and the spacing between the extended angular modes {67, 68, … , 80} may be determined based on the spacing between the corresponding opposite basic angular modes {2, 3, 4, … , 15}. The angular spacing between the extended angular modes may be set to be equal to the angular spacing between the corresponding basic angular modes. In addition, the number of the extended angular modes in the intra prediction mode set may be set to be less than or equal to the number of the basic angular modes.

[0150] According to an embodiment of the present invention, an extended angular mode may be signaled based on a base angular mode. For example, a wide-angle mode (i.e., an extended angular mode) may replace at least one angular mode (i.e., a base angular mode) within a first angular range. The replaced base angular mode may be an angular mode corresponding to an opposite side of the wide-angle mode. That is, the replaced base angular mode is an angular mode corresponding to an angle in an opposite direction to an angle indicated by the wide-angle mode or an angle that is different from the angle in the opposite direction by a preset offset index. According to an embodiment of the present invention, the preset offset index is 1. An intra prediction mode index corresponding to the replaced base angular mode may be remapped to the wide-angle mode to signal the corresponding wide-angle mode. For example, the wide-angle modes {-14, -13, … , -1} may be signaled by intra prediction mode indices {52, 53, … , 66}, and the wide-angle modes {67, 68, … , 69} may be signaled by intra prediction mode indices {52, 53, … , 66}, respectively. , 80} can be signaled by intra prediction mode indices {2, 3, … , 15}, respectively. By having the intra prediction mode index for the basic angular mode signal the extended angular mode in this way, even if the configurations of the angular modes used for intra prediction of each block are different, the same set of intra prediction mode indices can be used to signal the intra prediction mode. Therefore, the signaling overhead due to changes in the intra prediction mode configuration can be minimized.

[0151] Meanwhile, whether to use the extended angle mode may be determined based on at least one of the shape and size of the current block. In one embodiment, if the size of the current block is larger than a preset size, the extended angle mode may be used for intra prediction of the current block, and otherwise, only the default angle mode may be used for intra prediction of the current block. In another embodiment, if the current block is a non-square block, the extended angle mode may be used for intra prediction of the current block, and if the current block is a square block, only the default angle mode may be used for intra prediction of the current block.

[0152] The intra prediction unit determines reference samples and / or interpolated reference samples to be used for intra prediction of the current block based on intra prediction mode information of the current block. If the intra prediction mode index indicates a specific angular mode, the reference sample or interpolated reference sample corresponding to the specific angle from the current sample of the current block is used for prediction of the current pixel. Therefore, different sets of reference samples and / or interpolated reference samples can be used for intra prediction depending on the intra prediction mode. After intra prediction of the current block is performed using the reference samples and intra prediction mode information, the decoder restores the sample values ​​of the current block by adding the residual signal of the current block obtained from the inverse transform unit to the intra prediction value of the current block.

[0153] Motion information used for inter prediction may include reference direction indication information (inter_pred_idc), reference picture indexes (ref_idx_l0, ref_idx_l1), and motion vectors (mvL0, mvL1). Reference picture list utilization information (predFlagL0, predFlagL1) may be set according to the reference direction indication information. As an example, in case of unidirectional prediction using an L0 reference picture, predFlagL0=1, predFlagL1=0 may be set. In case of unidirectional prediction using an L1 reference picture, predFlagL0=0, predFlagL1=1 may be set. In case of bidirectional prediction using both L0 and L1 reference pictures, predFlagL0=1, predFlagL1=1 may be set.

[0154] If the current block is a coding unit, the coding unit can be divided into multiple sub-blocks, and the prediction information of each sub-block can be the same or different. For example, if the coding unit is an intra mode, the intra prediction modes of each sub-block can be the same or different. In addition, if the coding unit is an inter mode, the motion information of each sub-block can be the same or different. In addition, each sub-block can be encoded or decoded independently. Each sub-block can be distinguished through a sub-block index (sbIdx).

[0155] The motion vector of the current block is likely to be similar to that of the surrounding blocks. Therefore, the motion vectors of the surrounding blocks can be used as motion vector predictors (mvp), and the motion vector of the current block can be derived using the motion vectors of the surrounding blocks. Furthermore, to improve the accuracy of the motion vector, the difference in motion vectors (mvd) between the optimal motion vector of the current block, found from the original image by the encoder, and the motion predictor can be signaled.

[0156] Motion vectors can have various resolutions, and the resolution of motion vectors can vary on a block-by-block basis. Motion vector resolution can be expressed in integer units, half-pixel units, quarter-pixel units, sixteenth-pixel units, and integer-4 pixel units. Since images such as screen content are in simple graphical forms such as characters, interpolation filters do not need to be applied, integer units and integer-4 pixel units can be selectively applied on a block-by-block basis. Blocks encoded in affine mode, which can express rotation and scale, have significant shape changes, so integer units, quarter-pixel units, and sixteenth-pixel units can be selectively applied on a block-by-block basis. Information on whether to selectively apply motion vector resolution on a block-by-block basis is signaled with amvr_flag. If applicable, which motion vector resolution to apply to the current block is signaled with amvr_precision_idx.

[0157] For blocks to which bidirectional prediction is applied, the weights between the two prediction blocks can be applied equally or differently when applying weighted average, and information about the weights is signaled through bcw_idx.

[0158] To improve the accuracy of the motion prediction value, Merge or advanced motion vector prediction (AMVP) methods can be selectively used on a block-by-block basis. The Merge method configures the motion information of the current block to be identical to the motion information of the adjacent blocks to the current block, and has the advantage of increasing the encoding efficiency of the motion information by spatially propagating the motion information without change in the homogeneous motion region. On the other hand, the AMVP method predicts motion information in the L0 and L1 prediction directions respectively to express accurate motion information and signals the most optimal motion information. After the decoder derives the motion information for the current block through the AMVP or Merge method, it uses the reference block located in the motion information derived from the reference picture as the prediction block for the current block.

[0159] A method for deriving motion information in Merge or AMVP may be to construct a motion candidate list using motion prediction values ​​derived from neighboring blocks of the current block, and then signal the index information for the optimal motion candidate. In the case of AMVP, since motion candidate lists are derived for each of L0 and L1, the optimal motion candidate indices (mvp_l0_flag, mvp_l1_flag) for each of L0 and L1 are signaled. In the case of Merge, since one motion candidate list is derived, one merge index (merge_idx) is signaled. The motion candidate lists derived from one coding unit may vary, and a motion candidate index or merge index may be signaled for each motion candidate list. In this case, a mode in which there is no information about the remaining blocks in a block encoded in Merge mode can be referred to as MergeSkip mode.

[0160] Bidirectional motion information for the current block can be derived using a combination of AMVP and Merge modes. For example, motion information in the L0 direction can be derived using AMVP, while motion information in the L1 direction can be derived using Merge. Conversely, Merge can be applied to L0, while AMVP can be applied to L1. This encoding mode can be referred to as AMVP-merge mode.

[0161] The motion candidates and motion information candidates in this specification may have the same meaning. Furthermore, the motion candidate list and motion information candidate list in this specification may have the same meaning.

[0162] SMVD (Symmetric MVD) is a method for reducing the bit volume of transmitted motion information by ensuring that the MVD (Motion Vector Difference) values ​​in the L0 and L1 directions are symmetrical in the case of bidirectional prediction. The MVD information in the L1 direction, which is symmetrical to the L0 direction, is not transmitted, and reference picture information in the L0 and L1 directions is also not transmitted and can be derived during the decoding process.

[0163] OBMC (Overlapped Block Motion Compensation) is a method that generates prediction blocks for the current block using motion information from surrounding blocks when the motion information between blocks differs. It then weights and averages these prediction blocks to generate a final prediction block for the current block. This method effectively reduces blocking artifacts that occur at block boundaries in motion-compensated images.

[0164] Typically, merge motion candidates have low motion accuracy. To improve the accuracy of these merge motion candidates, the MMVD (Merge mode with MVD) method can be used. The MMVD method is a method of compensating motion information using one candidate selected from several motion difference value candidates. Information about the compensation value of the motion information obtained through the MMVD method (e.g., an index indicating one candidate selected from among the motion difference value candidates) can be included in the bitstream and transmitted to the decoder. Compared to the conventional method of including the motion information difference value in the bitstream, the inclusion of information about the compensation value of the motion information in the bitstream can save bits.

[0165] The TM (Template Matching) method constructs a template using the surrounding pixels of the current block, finds the matching area with the highest similarity to the template, and then compensates for motion information. TM (Template Matching) is a method that performs motion prediction in the decoder without including motion information in the bitstream to reduce the size of the encoded bitstream. Since the decoder does not have the original image, it can roughly derive motion information for the current block using already reconstructed surrounding blocks.

[0166] The DMVR (Decoder-side Motion Vector Refinement) method is a method of compensating motion information through the correlation of already restored reference images to find slightly more accurate motion information. It is a method of using the bidirectional motion information of the current block to use the best matching point between reference blocks within an arbitrary set area of ​​two reference pictures as a new bidirectional motion. When this DMVR is performed, the encoder performs DMVR on a block basis to compensate for the motion information, and then divides the block into sub-blocks and performs DMVR on each sub-block basis to compensate for the motion information of the sub-block again. This can be called MP-DMVR (Multi-pass DMVR).

[0167] The LIC (Local Illumination Compensation) method is a method of compensating for luminance changes between blocks. It is a method of deriving a linear model using neighboring pixels adjacent to the current block, and then compensating the luminance information of the current block through the linear model.

[0168] Existing video encoding methods perform motion compensation that only considers parallel translation in all directions, which reduces encoding efficiency when encoding videos containing motions commonly encountered in the real world, such as zooming in, zooming out, and rotation. To express such motions, an affine model-based motion prediction technique utilizing a four-parameter (rotation) or six-parameter (zoom in, zoom out, rotation) model can be applied.

[0169] Bi-Directional Optical Flow (BDOF) is used to compensate for predicted blocks by estimating pixel changes based on optical flow from a reference block of a block composed of bidirectional motion. The motion information derived from BDOF in VVC can be used to compensate for the motion of the current block.

[0170] PROF (Prediction Refinement with Optical Flow) is a technique for improving the accuracy of sub-block-level affine motion prediction to be similar to that of pixel-level motion prediction. Similar to BDOF, PROF calculates a correction value on a pixel-by-pixel basis for affine motion-compensated pixel values ​​on a sub-block-by-subblock basis based on optical flow to obtain a final prediction signal.

[0171] The CIIP (Combined Inter- / Intra-picture Prediction) method is a method of generating a final prediction block by weighting and averaging prediction blocks generated by the intra-picture prediction method and prediction blocks generated by the inter-picture prediction method when generating a prediction block for the current block.

[0172] The Intra Block Copy (IBC) method finds the most similar part to the current block in a previously restored area within the current picture and uses that reference block as a prediction block for the current block. At this time, information related to the block vector, which represents the distance between the current block and the reference block, can be included in the bitstream. The decoder can parse the block vector information contained in the BeastStream to calculate or set the block vector for the current block.

[0173] The BCW (Bi-prediction with CU-level Weights) method is a method that performs a weighted average on two motion-compensated prediction blocks by adaptively applying weights on a block-by-block basis, rather than generating a prediction block by averaging two motion-compensated prediction blocks from different reference pictures.

[0174] The Intra TMP (Template Matching Prediction) method is a method in which a video signal processing device constructs a reference template using pixel values ​​of neighboring blocks adjacent to the current block, finds the part most similar to the constructed reference template in an already restored area within the current picture, and then uses the reference block (the part found in the already restored area) as a prediction block for the current block.

[0175] The MHP (Multi-hypothesis prediction) method is a method of performing weight prediction using various prediction signals by transmitting additional motion information to unidirectional and bidirectional motion information during inter-screen prediction.

[0176] CCLM (Cross-component linear model) is a method that constructs a linear model using the high correlation between a luminance signal and a chrominance signal located at the same location as the luminance signal, and then predicts the chrominance signal using the linear model. A template is constructed using blocks adjacent to the current block that have been reconstructed, and the parameters for the linear model are derived from the template. Next, the current luminance block, which has been reconstructed to fit the size of the chrominance block, is optionally downsampled depending on the image format. Finally, the chrominance block of the current block is predicted using the downsampled luminance block and the linear model. In this case, the method of using two or more linear models is called MMLM (Multi-model Linear mode).

[0177] GLM (Gradient Linear Model) is a method of predicting a color difference signal through a linear model such as CCLM, which constructs a model by additionally reflecting the gradient between the luminance sample corresponding to the color difference sample and the surrounding luminance samples adjacent to that luminance sample.

[0178] In independent scalar quantization, the input coefficient t k Restored coefficients t' for k is the associated quantization index q k depends only on t'. That is, the quantization index for any restored coefficient has a different value from the quantization indices for other restored coefficients. In this case, t' k is t k may be a value that includes quantization error, and may be different or the same depending on the quantization parameter. Here, t' k can be named restored transform coefficients or inverse quantized transform coefficients, and the quantization indices can also be named quantized transform coefficients.

[0179] In Uniform Reconstruction Quantizers (URQ), the reconstructed coefficients are spaced at equal intervals. The distance between two adjacent reconstructed values ​​is referred to as the quantization step size. Reconstructed values ​​can include zeros, and the entire set of available reconstructed values ​​can be uniquely defined by the quantization step size. The quantization step size can vary depending on the quantization parameter.

[0180] In conventional methods, quantization reduces the set of acceptable reconstructed transform coefficients, and the number of elements in this set can be finite. This limits the ability to minimize the average error between the original and reconstructed images. Vector quantization can be used as a method to minimize this average error.

[0181] A simple form of vector quantization used in video encoding is sign data hiding. This is a method in which the encoder does not encode the sign of a non-zero coefficient, and the decoder determines the sign of the coefficient based on whether the sum of the absolute values ​​of all coefficients is even or odd. To achieve this, the encoder may increase or decrease the value of at least one coefficient, and at least one coefficient may be selected and adjusted to be optimal in terms of rate-distortion cost. In one implementation, a coefficient having a value close to the boundary of the quantization interval may be selected.

[0182] Another vector quantization method is trellis-coded quantization, which is used in video coding as an optimal path search technique to obtain optimized quantization values ​​in dependent quantization. Block-wise, quantization candidates for all coefficients in the block are arranged in a trellis graph, and the optimal trellis path between the optimized quantization candidates is searched for by considering the cost for rate-distortion. Specifically, dependent quantization applied to video coding can be designed so that the set of allowable reconstructed transform coefficients for a transform coefficient depends on the value of the transform coefficient preceding the current transform coefficient in the restoration order. At this time, by selectively using multiple quantizers according to the transform coefficients, the average error between the original image and the reconstructed image can be minimized, thereby increasing the encoding efficiency.

[0183] Among intra prediction encoding techniques, the MIP (Matrix Intra Prediction) method is a matrix-based intra prediction method. Unlike the prediction method that has directionality from the pixels of the surrounding blocks adjacent to the current block, it is a method of obtaining a prediction signal using a predefined matrix and offset values ​​for the pixels on the left and top of the surrounding blocks.

[0184] To derive the intra-prediction mode of the current block, a template, which is a random region adjacent to the current block and reconstructed, is used. The intra-prediction mode derived from the template's surrounding pixels can be used to reconstruct the current block. First, the decoder generates a prediction template for the template using the surrounding pixels (reference) adjacent to the template. The intra-prediction mode that generates the prediction template most similar to the already reconstructed template can then be used to reconstruct the current block. This method is called TIMD (Template intra-mode derivation).

[0185] Typically, an encoder can determine a prediction mode for generating a prediction block and generate a bitstream containing information about the determined prediction mode. A decoder can parse the received bitstream to set an intra-prediction mode. At this time, the bit amount of information about the prediction mode may be about 10% of the total bitstream size. To reduce the bit amount of information about the prediction mode, the encoder may not include information about the intra-prediction mode in the bitstream. Accordingly, the decoder can derive (determine) an intra-prediction mode for restoring the current block using the characteristics of the surrounding blocks, and can restore the current block using the derived intra-prediction mode. At this time, the decoder can use a method of applying a Sobel filter in the horizontal and vertical directions to each neighboring pixel (pixel) of the current block to infer directional information, and then mapping the directional information to the intra-prediction mode to derive the intra-prediction mode. The method by which the decoder derives the intra prediction mode using surrounding blocks can be described as Decoder side intra mode derivation (DIMD).

[0186] Figure 7 is a diagram showing the locations of surrounding blocks used to construct a motion candidate list in inter prediction.

[0187] The neighboring blocks can be blocks of spatial position or blocks of temporal position. The neighboring block spatially adjacent to the current block can be at least one of a left (A1) block, a left below (A0) block, an above (B1) block, an above right (B0) block, and an above left (B2) block. The neighboring block temporally adjacent to the current block can be a block that includes an upper left pixel position of a bottom right (BR) block of the current block in a corresponding picture (Collocated picture). If the neighboring block temporally adjacent to the current block is encoded in intra mode or the neighboring block temporally adjacent to the current block exists in an unusable position, a block that includes a horizontal and vertical center (Center, Ctr) pixel position of the current block in the picture corresponding to the current picture (Collocated picture) can be used as the temporal neighboring block. Motion candidate information derived from corresponding pictures can be referred to as a Temporal Motion Vector Predictor (TMVP). Only one TMVP can be derived from a single block, or a block can be divided into multiple sub-blocks, and then a separate TMVP candidate can be derived for each sub-block. The method for deriving TMVPs at the sub-block level can be referred to as a sub-block Temporal Motion Vector Predictor (sbTMVP).

[0188] Whether the methods described in this specification are applied can be determined based on at least one of information about the slice type (e.g., whether it is an I slice, a P slice, or a B slice), whether it is a tile, whether it is a subpicture, the size of the current block, the depth of the coding unit, whether the current block is a luminance block or a chrominance block, whether it is a reference frame or a non-reference frame, the temporal hierarchy according to the reference order and layer, etc. The information used to determine whether the methods described in this specification are applied can be information agreed upon in advance between the decoder and the encoder. In addition, such information can be determined according to a profile and a level. Such information can be expressed as a variable value, and information about the variable value can be included in the bitstream. That is, the decoder can determine whether the above-described methods are applied by parsing information about the variable value included in the bitstream. For example, whether the above-described methods are applied can be determined based on the horizontal length or the vertical length of the coding unit. The above-described methods can be applied if the horizontal or vertical length is 32 or more (e.g., 32, 64, 128, etc.). In addition, the above-described methods can be applied if the horizontal or vertical length is less than 32 (e.g., 2, 4, 8, 16). In addition, the above-described methods can be applied if the horizontal or vertical length is 4 or 8.

[0189] FIG. 8 is a diagram illustrating a process of generating a prediction block using DIMD according to one embodiment of the present invention.

[0190] Referring to Figure 8, the decoder can derive a predicted block using surrounding samples (blocks, pixels). At this time, the surrounding samples may be blocks (pixels) surrounding the current block. Specifically, the decoder can determine intra-prediction modes and weight information for restoring the current block through a histogram of directional information (angle information) using the surrounding samples as input.

[0191] FIG. 9 is a diagram showing the locations of surrounding pixels used to derive directional information according to one embodiment of the present invention.

[0192] Fig. 9(a) shows when all neighboring blocks of the current block are available for deriving directional information, Fig. 9(b) shows when the upper boundary of the current block is a sub-picture, slice, tile, or CTU boundary, and Fig. 9(c) shows when the left boundary of the current block is a sub-picture, slice, tile, or CTU boundary. Meanwhile, if the neighboring blocks and the current block do not belong to the same sub-picture, slice, tile, or CTU, the neighboring blocks may not be used for deriving directional information. The gray dots in Fig. 9 indicate the positions of pixels used to actually derive directional information, and the dotted lines indicate sub-picture, slice, tile, and CTU boundaries. In addition, referring to Figs. 9(d) to (f), pixels located at the boundary may be padded by one pixel outside the boundary to derive directional information. This padding may allow for more accurate directional information to be derived.

[0193] In order to derive direction information for a pixel at a specific location, a 3x3 Sobel filter of Equation 1 can be applied in the horizontal and vertical directions, respectively. A in Equation 1 can denote pixel information (values) of the reconstructed neighboring blocks of the current block of 3x3 size. And the direction information (θ) can be determined using Equation 2. In order to reduce the computational complexity for deriving direction information, the decoder can derive the direction information (θ) only by calculating Gy / Gx of Equation 1 without calculating the atan function of Equation 2.

[0194]

[0195]

[0196] Referring to FIG. 9, directional information can be calculated for each gray dot shown in FIG. 9, and the directional information can be mapped to an angle of an intra prediction mode. The intra prediction mode set can include a planar mode, a DC mode, and a plurality of (e.g., 65) angular modes (i.e., directional modes). The intra prediction modes can be 67 modes, and the directional information (angle, θ) calculated through mathematical expression 2 can be a value in real units. Therefore, a process of mapping directional information to a specific intra prediction directional mode is required. The directional mode described herein can be the same as the angular mode.

[0197] FIG. 10 is a diagram illustrating a method for mapping a directional mode according to one embodiment of the present invention.

[0198] Referring to FIG. 10, the intra prediction directional mode can be divided into four sections based on 0 degrees (index 18), 45 degrees (index 34), 90 degrees (index 50), and 135 degrees (index 66) (see FIG. 6). Referring to FIG. 10, the sections for determining the intra prediction directional mode can be divided into four sections from section 0 to section 3. Section 0 can be from -45 degrees to 0 degrees, section 1 can be from 0 degrees to 45 degrees, section 2 can be from 45 degrees to 90 degrees, and section 3 can be from 90 degrees to 135 degrees. In this case, each section can include 16 intra prediction directional modes. The directional mode can be determined as one of the four sections by comparing the signs and magnitudes of Gx and Gy calculated through mathematical expression 1. For example, if Gx and Gy are positive and the absolute value of Gx is greater than the absolute value of Gy, interval 1 can be selected. The intra prediction directional mode mapped to each interval can be determined through the directional information (θ) calculated from mathematical expression 2. Specifically, the decoder extends the value by multiplying the directional information (θ) by 2^16. Then, the decoder can compare the extended value with the numbers in the predefined table to find the value closest to the extended value and determine the intra prediction directional mode based on the closest value. At this time, there can be 17 values ​​in the predefined table. Specifically, the values ​​of the predefined table can be {0, 2048, 4096, 6144, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 47104, 53248, 59392, 65536}. At this time, the difference between the predefined table values ​​can be set differently depending on the difference between the angles of the intra prediction directional mode.

[0199] Meanwhile, if the directional angle is obtained using only Gy / Gx without performing atan calculation to reduce the computational complexity, the difference between the predefined table values ​​may not match the distance between the angles of the intra prediction directional mode. atan has a characteristic that the slope gradually decreases as the input value increases. Therefore, the above-defined table should also be set in numerical value by considering not only the difference between the angles of the intra prediction directional mode but also the nonlinear characteristic of atan. For example, the difference between the above-defined table values ​​may be set to gradually decrease. Conversely, the difference between the above-defined table values ​​may be set to gradually increase.

[0200] If the width and height of the current block are different, the available intra prediction directional modes may vary. That is, if the width and height of the current block are different, the interval for deriving the intra prediction directional mode may vary. In other words, the interval for deriving the intra prediction directional mode may change based on the width and height of the current block (e.g., the ratio of the width and height). For example, if the width of the current block is longer than the height, the intra prediction mode may be remapped to 67 to 80, and the intra prediction mode in the opposite direction may be excluded to 2 to 15. For example, if the width of the current block is n (an integer) times longer than the height (e.g., 2), the intra prediction modes {3, 4, 5, 6, 7, 8} may be remapped (mapped) to {67, 68, 69, 70, 71, 72}, respectively. Additionally, if the horizontal length of the current block is longer than the vertical length, the intra prediction mode may be reset to a value obtained by adding '65' to the intra prediction mode. On the other hand, if the horizontal length of the current block is shorter than the vertical length, the intra prediction mode may be reset to a value obtained by subtracting '67' from the intra prediction mode.

[0201] A histogram can be used to derive an intra-prediction directional mode for restoring the current block. If, after obtaining directional information for surrounding blocks, there are more non-directional blocks than directional blocks, the prediction mode for the non-directional block may have the highest cumulative value in the histogram. However, since a directional mode must be derived for restoring the current block, the prediction mode for the non-directional block may be excluded even if it has the highest cumulative value in the histogram. That is, a smooth region with no gradient or directionality between surrounding pixels may not be used to derive an intra-prediction directional mode. For example, the prediction mode for a block without directional information may be planar or DC. If the left neighboring block is planar or DC, the left neighboring block may not be used to derive directional information, and directional information may be derived using only the upper neighboring block. When the surrounding blocks of the current block contain a mixture of smooth regions and directional regions, the decoder can generate a histogram using the G value calculated as in Equation 3 to emphasize the directionality. In this case, the histogram may be a cumulative value in which the calculated G value is added to each generated intra prediction directional mode, rather than a frequency-based one in which '1' is added to each generated intra prediction directional mode.

[0202]

[0203] FIG. 11 is a diagram showing a histogram for deriving an intra prediction directional mode according to one embodiment of the present invention.

[0204] The X-axis of Fig. 11 represents an intra prediction directional mode, and the Y-axis represents the accumulated value of G values. The decoder can select an intra prediction directional mode having the largest accumulated value of G values ​​among the intra prediction directional modes. In other words, the decoder can select an intra prediction directional mode for the current block based on the accumulated value. Referring to Fig. 11, modeA having the largest accumulated value and modeB having the second largest accumulated value can be selected as the intra prediction directional modes. The decoder can generate a final prediction block by weighting the prediction block generated with modeA, the prediction block generated with modeB, and finally the prediction block generated with the planar mode to generate a prediction block for the current block. At this time, the weight of each prediction block can be determined using the accumulated value of modeA and modeB. For example, the weight for the prediction block generated with the planar mode can be set to 1 / 3 of the total weight. The weight for the prediction block generated by modeA can be set to a weight corresponding to the value obtained by dividing the modeA accumulated value by the sum of the accumulated values ​​of modeA and modeB. The weight for the prediction block generated by modeB can be determined as a difference value between the modeA weight and 1 / 3 of the total weight. To make the calculation of the weight more accurate, the decoder can expand the range of the weight by multiplying the weight for the prediction block generated by modeA by an arbitrary value. The weight for the prediction block generated by modeB and the weight for the prediction block generated in the planar mode can also be expanded in the same way.

[0205] FIG. 12 is a diagram illustrating a method for signaling a DIMD mode according to one embodiment of the present invention.

[0206] Specifically, FIG. 12 illustrates a signaling method used to store a syntax element for whether the DIMD mode is applied in a bitstream and transmit it to a decoder. Referring to FIG. 12, a syntax element (cu_dimd_flag) for whether the DIMD mode is used to generate a prediction block for a current block can be parsed when the coding mode of the current block is an intra mode and a syntax element (sps_dimd_enabled_flag) for whether the DIMD mode set in the SPS is enabled indicates that the DIMD mode is enabled (e.g., when the value of sps_dimd_enabled_flag is 1), and the coding mode of the current block is not a SKIP mode, the current block is a luminance block, and the current block is not an inter coding mode. At this time, if cu_dimd_flag is '1', it can indicate that the current block is decrypted in DIMD mode, and if cu_dimd_flag is '0', it can indicate that the current block is not decrypted in DIMD mode. Meanwhile, if cu_dimd_flag is not parsed, the value of cu_dimd_flag can be set to '0'. sps_dimd_enabled_flag can be controlled by syntax elements included in profile, tier and level syntax. For example, sps_dimd_enabled_flag can be controlled by gci_no_dimd_constraint_flag, a syntax element included in general_conatraints_info() syntax. It can be defined to perform the following actions. If the value of gci_no_dimd_constraint_flag is 1, the value of sps_dimd_enabled_flag for all pictures in OlsinScope can be 0.If the value of gci_no_dimd_constraint_flag is 0, there may be no separate constraint (gci_no_dimd_constraint_flag equal to 1 specifies that sps_dimd_enabled_flag for all pictures in OlsInScope shall be equal to 0. gci_no_dimd_constraint_flag equal to 0 does not impose such a constraint.).

[0207] FIG. 13 is a diagram illustrating a method for signaling syntax elements related to an intra prediction mode depending on whether a DIMD mode is used according to one embodiment of the present invention.

[0208] If the current block is decoded in DIMD mode, additional information (syntax elements) related to the encoding mode may not be parsed. Referring to FIG. 13, if the value of cu_dimd_flag is 1, additional information related to the encoding mode of the current block (e.g., intra_mip_flag, intra_subpartitions_mode_flag, intra_luma_mpm_flag, intra_luma_not_planar_flag, intra_luma_mpm_idx, intra_luma_mpm_remainder, etc.) may not be parsed. If a residual signal exists thereafter, whether a transform coefficient for the residual signal exists and syntax elements related to the residual signal may be parsed.

[0209] FIG. 14 is a diagram illustrating a method for generating a prediction sample for restoring a current block according to one embodiment of the present invention.

[0210] Specifically, FIG. 14 is a structural diagram showing a process of generating a prediction sample using the derived intra prediction mode by more effectively deriving an intra prediction mode to improve encoding performance.

[0211] Referring to Fig. 14, in the 'prediction mode generator' process, the decoder can derive an intra-prediction directional mode for the current block using neighboring samples of neighboring blocks adjacent to the current block. At this time, the decoder can derive at least one intra-prediction directional mode and derive a weight for each mode. For example, to derive the intra-prediction directional mode, the decoder can use a histogram-based method that derives directional information of neighboring block samples through an arbitrary filter and determines frequently occurring directional information as the intra-prediction directional mode. In addition, as a method for deriving the intra-prediction directional mode, a method may be used that generates an intra-prediction pixel for a left pixel adjacent to the current block using only the upper pixels adjacent to the current block and determines the intra-prediction mode with the least distortion as the intra-prediction directional mode for the current block.

[0212] Referring to Fig. 14, in the 'intra prediction' process, prediction blocks for the current block can be generated using the intra prediction directional modes and weights derived from the 'prediction mode generator' process. The number of prediction blocks can be determined according to the number of intra prediction directional modes derived from the prediction mode generator process. For example, if the number of derived intra prediction directional modes is 2, there can be 2 prediction blocks for the current block. The prediction blocks generated in the 'intra prediction' process can be subjected to PDPC (Position dependent intra prediction combination) filtering using the method described below.

[0213] Position dependent intra prediction combination (PDPC) filtering can be applied to each prediction block generated during the 'intra prediction' process. Since applying PDPC filtering to each prediction block can increase decoder complexity, if the prediction block is predicted in DIMD mode, PDPC filtering may not be applied to the prediction block. Furthermore, PDPC filtering may be applied only to either modeA, which has the largest cumulative value, or modeB, which has the second largest cumulative value. For example, PDPC filtering may be applied only to modeA. Furthermore, whether PDPC filtering is applied may be determined based on the weight of each directional mode. For example, whether PDPC is applied to all or part of modeA and modeB may be determined based on the difference between the weight for modeA and the weight for modeB. For example, if the difference between the weight for modeA and the weight for modeB is less than a specific value, PDPC filtering may be applied to both modeA and modeB. In addition, whether PDPC filtering is applied to modeA and modeB can be determined by comparing the weight for modeA and the weight for modeB with a specific value, respectively. If the weight is greater than a specific value, PDPC filtering can be applied to the directional mode of the corresponding weight. For example, if the weight for modeA is greater than a specific value and the weight for modeB is less than a specific value, PDPC filtering can be applied to modeA and PDPC filtering may not be applied to modeB. In addition, regardless of the directional mode, a preset form of PDPC filtering can be applied only to the final prediction block to which the weighted average is applied through the weighted prediction process (see Fig. 14).Additionally, PDPC filtering can be applied using modeA to the final prediction block to which the weighted average is applied during the 'weighted prediction' process. PDPC filtering can be applied using modeB to the final prediction block to which the weighted average is applied during the 'weighted prediction' process.

[0214] Referring to FIG. 14, in the 'other prediction' process, the decoder can additionally generate a prediction block for the current block. For example, the decoder can generate an intra prediction block using at least one of a planar mode, a DC mode, and a Matrix Intra Prediction (MIP). Whether the 'other prediction' process is performed can be determined using at least one of the intra prediction directional modes induced in the 'prediction mode generator' process and weight information for each prediction direction, quantization parameter information of the current block, the horizontal or vertical length of the current block, information on whether the current block is luminance or chrominance, intra prediction modes around the current block, and information on the presence or absence of transform coefficients around the current block (which may correspond to Additional information A, B, and C of FIG. 14). A method for determining whether the 'other prediction' process is performed will be described below.

[0215] In the 'other prediction' process, the information about which mode (e.g., planar, DC, MIP mode, etc.) the decoder will use can be agreed upon in advance or signaled via SPS. For example, the decoder can determine the mode based on the syntax element (sps_dimd_default_mode) indicating which mode to use. The decoder can determine which mode to use among planar, DC, and MIP modes depending on the value of sps_dimd_default_mode. For example, if the value of sps_dimd_default_mode is '0', it can be instructed to use planar mode, if the value of sps_dimd_default_mode is '1', it can be instructed to use DC mode, and if the value of sps_dimd_default_mode is a value other than 0 and 1, it can be instructed to use MIP mode. In addition, if the current block is a luminance block and the transform coefficients of the neighboring blocks exist, the decoder can generate a prediction block using at least one of planar, DC, and MIP modes. If the current block is a chrominance block and there are no transform coefficients of surrounding blocks, a prediction block can be generated using at least one of a planar mode, a DC mode, and a MIP mode. In addition, if the weights of the intra-prediction directional modes derived in the 'prediction mode generator' process are similar to each other (for example, if the difference between the weights of each directional mode is smaller than a specific threshold value), the 'other prediction' process may not be performed. If the weights of the intra-prediction directional modes derived in the 'prediction mode generator' process are similar to each other, the decoder can generate a prediction block using at least one of a planar mode, a DC mode, and a MIP mode (i.e., the 'other prediction' process is performed).If the difference between the weights of the intra prediction directional modes derived in the 'prediction mode generator' process is large (for example, if the difference between the weights of each directional mode is larger than a specific threshold), it means that there is a lot of variation between pixels in the surrounding blocks, and therefore the decoder can generate a prediction block using at least one of the planar mode, the DC mode, and the MIP mode. In addition, if the width and height of the current block are different from each other, the decoder can generate a prediction block using at least one of the planar mode, the DC mode, and the MIP mode. Conversely, if the width and height of the current block are the same, the decoder can generate a prediction block using at least one of the planar mode, the DC mode, and the MIP mode.

[0216] In the 'weighted prediction' process, the decoder can generate a single prediction sample by weighting and averaging multiple intra prediction blocks generated in the 'intra prediction' and 'other prediction' processes. The weight for each intra prediction block can be determined based on at least one of the intra prediction directional mode and weight information derived in the 'prediction mode generator' process, quantization parameter information of the current block, the horizontal or vertical length of the current block, information on whether the current block is luminance or chrominance, intra prediction modes around the current block, and information on the presence or absence of transform coefficients around the current block.

[0217] FIG. 15 is a diagram illustrating a method for determining an intra prediction mode according to one embodiment of the present invention.

[0218] Fig. 15 illustrates the 'prediction mode generator' process of Fig. 14 in more detail. Referring to Fig. 15, the 'prediction mode generator' process of Fig. 14 can derive intra prediction directionality through histogram analysis. Specifically, in the 'histogram analysis' process of Fig. 15, the decoder can derive intra prediction directionality by analyzing a histogram obtained using neighboring samples adjacent to the current block. At this time, the decoder can derive the intra prediction directional mode and weight for the current block using at least one of the horizontal length and vertical length of the current block, quantization parameter information, possible intra prediction directional mode information among neighboring blocks of the current block, information on whether a residual signal exists in neighboring blocks of the current block, and information on whether the current block is a luminance block or a chrominance block. A method for deriving the intra prediction directional mode and weight for the current block will be described below.

[0219] The intra prediction directional mode can be set based on frequency. The decoder can obtain a histogram of intra prediction directional modes for neighboring blocks, analyze the histogram, and select a frequently occurring intra prediction directional mode and a second most frequently occurring mode as the prediction directional mode. In addition, the intra prediction directional mode can be set based on an accumulated value (e.g., the G value in FIG. 11). The decoder can analyze a histogram obtained by adding the G value to each intra prediction directional mode, and select an intra prediction directional mode with the highest weight and a mode with the second most weight as the prediction directional mode. In addition, the decoder can select an intra prediction directional mode based on the distance between intra prediction directional modes of neighboring blocks and the accumulated value added with the G value. The distance between directional modes can mean the difference in indexes of the directional modes. For example, the difference in distance between a directional mode at index 66 and a directional mode at index 2 can be 64. Or, since the index of the directional mode is 66, the distance difference between the directional mode at index 66 and the directional mode at index 2 may be 2. The decoder can obtain a histogram with the cumulative value obtained by adding the G value to each of the intra prediction directional modes for the surrounding blocks, analyze the histogram, and first select the intra prediction directional mode with the highest cumulative value. Next, the decoder can use the mode with the smallest distance between the mode with the highest cumulative value and the directional mode (the closest mode) among the modes corresponding to the remaining cumulative values ​​except for the highest cumulative value (for example, the mode with the second highest cumulative value, the mode with the third highest cumulative value, the mode with the fourth highest cumulative value, etc.).Meanwhile, the decoder may first select the intra prediction directional mode having the highest accumulated value, and the decoder may use the mode having the highest accumulated value and the directional mode having the largest distance (the farthest distance) among the modes corresponding to the remaining accumulated values ​​except for the highest accumulated value (for example, the mode having the second highest accumulated value, the mode having the third highest accumulated value, the mode having the fourth highest accumulated value, etc.). The accumulated value for each of the intra prediction directional modes may be used when determining weights for the intra prediction directional modes finally determined in the 'Histogram analysis' process.

[0220] The decoder of Fig. 15 may have two or more intra prediction directional modes for the current block derived from the 'Histogram analysis' process. When there are two or more intra prediction directional modes derived from the 'Histogram analysis' process, the distances between the intra prediction directional modes may be similar or different. In addition, the accumulated values ​​between the intra prediction directional modes may also be similar or different. Therefore, in order to derive an optimal prediction sample for the current block, the most optimal combination among various mode combinations must be selected. In addition, the decoder may combine not only the intra prediction directional modes derived from the 'prediction mode generator' process of Fig. 14 but also the encoding modes derived from 'other prediction' to derive an optimal prediction sample for the current block. Information about such combinations may be included in the bitstream. The mode combination described herein may mean using one of mode A, mode B, planar mode, DC mode, and MIP mode, or combining some or all of them.

[0221] Next, referring to FIG. 15, the decoder can select an optimal combination for deriving an optimal prediction sample for the current block by using the intra prediction modes determined in the 'Histogram analysis' process and the weight information corresponding to the derived intra prediction modes in the 'Prediction mode analysis' process. Specifically, the decoder can determine information on whether to use a weighted average to generate a prediction sample for the current block, which intra prediction mode to use, and how to set the weight for the intra prediction mode by using the derived intra prediction modes and the weight information corresponding thereto. In addition, the decoder can select an optimal combination for deriving a prediction sample for the current block by using at least one of the intra prediction modes determined in the 'Histogram analysis' process and the weight information corresponding to the determined intra prediction modes and the intra prediction modes of the neighboring blocks in the 'Prediction mode analysis' process. Specifically, the decoder can determine information on whether to use weighted average to generate a prediction sample for the current block, which intra prediction mode to use, and how to set weights for the intra prediction mode. At this time, the decoder can derive optimal combination information (Combination information for prediction modes) for generating a prediction sample for the current block by using at least one or more of the horizontal or vertical length of the current block, quantization parameter information, information on available intra prediction modes among neighboring blocks of the current block, information on whether a residual signal exists in neighboring blocks of the current block, and information on whether the current block is a luminance block or a chrominance block. The combination information can include intra prediction directional mode information and weights for the intra prediction directional mode.For example, if the weight of the mode with the second highest weight among the two derived intra prediction directional modes is '0' or within an arbitrary value, the decoder may generate a prediction block for the current block using only the intra prediction directional mode with the highest weight without applying a weighted average when generating the prediction block for the current block. At this time, the arbitrary value is an integer greater than or equal to 1, such as 10. In addition, if at least one of the two derived intra prediction directional modes is a DC mode, a Planar mode, or a MIP mode (i.e., not a directional mode), the decoder may generate a prediction block for the current block using only the intra prediction directional mode with the highest weight without applying a weighted average when generating the prediction block for the current block. In addition, if at least one of the two derived intra prediction modes is a DC mode, a Planar mode, or a MIP mode (i.e., not a directional mode), the decoder may apply a weighted average when generating the prediction block for the current block.

[0222] FIG. 16 illustrates a syntax structure including syntax elements related to DIMD according to one embodiment of the present invention.

[0223] Referring to Fig. 16, if the current block is encoded with DIMD (i.e., if the value of cu_dimd_flag is 1), the decoder can additionally parse a syntax element (cu_dimd_mode) for DIMD combination information (information on modes combined to obtain prediction samples, mode combination information). At this time, the parsing method of cu_dimd_mode may differ depending on the number of prediction modes combined. For example, if the number of combinations is '2', the decoder can parse only 1 bin. At this time, if the value of cu_dimd_mode is '0', the decoder can generate prediction samples using modeA and modeB. If the value of cu_dimd_mode is '1', the decoder can generate prediction samples using modeA, modeB, and the planar mode, or generate prediction samples using modeA and the planar mode, or generate prediction samples using modeB and the planar mode. When the number of combinations is '4', the decoder can parse two bins. At this time, when the value of cu_dimd_mode is '0', the decoder can generate prediction samples using modeA and modeB. When the value of cu_dimd_mode is '1', the decoder can generate prediction samples using modeA, modeB, and the flat mode. When the value of cu_dimd_mode is '2', the decoder can generate prediction samples using modeA and the flat mode. When the value of cu_dimd_mode is '3', the decoder can generate prediction samples using modeB and the flat mode.

[0224] If syntax elements for DIMD combination information are included in the bitstream, there may be a problem of increased bit volume. To address this issue, syntax elements for DIMD combination information are not included in the bitstream, and the decoder can derive combination information using information from the current block and surrounding blocks. As described above, the decoder can derive optimal combination information for generating prediction samples for the current block.

[0225] FIG. 17 is a diagram showing intra prediction directional mode and weight information for neighboring blocks of a current block according to one embodiment of the present invention.

[0226] Specifically, Fig. 17 shows weight information corresponding to the intra prediction directional mode for each block derived in the 'Histogram analysis' step described through Fig. 15. Referring to Fig. 17, the size of the weight (WeightX) can be expressed in alphabetical order. For example, the highest weight can be expressed as 'WeightA', and the second highest weight can be expressed as 'WeightB'. The weight information can exist as many as the number (X) of derived intra prediction directional modes. In addition, the intra prediction mode corresponding to the WeightA weight can be modeA. The characteristics of the weight information corresponding to the intra prediction directional mode may be different depending on the characteristics of the neighboring blocks adjacent to the current block. Referring to Fig. 17, Case 1 represents a case where the intra prediction directional modes of modeA and modeB and the corresponding weight information are similar to each other. Case 2 represents a case where the differences between the intra prediction directional modes of modeA and modeB and the corresponding weight information are greatly different. Case 3 represents a case where the intra prediction directional modes of modeA and modeB are similar, but the corresponding weight information differs significantly. Case 4 represents a case where the intra prediction directional modes of modeA and modeB are significantly different, but the corresponding weight information is similar.

[0227] FIG. 18 is a diagram illustrating a method for determining DIMD combination information according to one embodiment of the present invention.

[0228] Specifically, Fig. 18 shows a method for determining optimal DIMD combination information through the difference between the intra prediction directional modes (modeA, modeB) and corresponding weights (WeightA, WeightB) derived in the 'prediction mode generator' process.

[0229] Referring to FIG. 18, i) if the difference in absolute value between ModeA and ModeB is less than an arbitrary threshold value (Tmode1, for example, 10) and WeightA is less than an arbitrary threshold value (Tweight1, for example, 0.7), the DIMD optimal combination for the current block may be a combination of modeA and modeB, and the decoder may generate a prediction sample by combining modeA and modeB. ii) if i) does not apply and WeightA is greater than or equal to an arbitrary threshold value (Tweight2, for example, 0.85), the DIMD optimal combination for the current block may be a combination using only modeA, and the decoder may generate a prediction sample using only modeA. iii) If ii) does not apply and the difference in absolute values ​​between modeA and modeB is greater than or equal to an arbitrary threshold (Tmode2, for example, 15), the optimal DIMD combination for the current block may be a combination of modeA and some or all of the coding modes derived from the 'other Prediction' process (for example, planar mode, DC mode, MIP mode), and the decoder may generate prediction samples by combining some or all of the coding modes derived from modeA and the 'other Prediction' process (for example, planar mode, DC mode, MIP mode). iv) If iii) is not applicable, the optimal DIMD combination for the current block may be a combination of modeA and modeB and some or all of the coding modes derived from the 'other Prediction' process (e.g., planar mode, DC mode, MIP mode), and the decoder may generate prediction samples by combining some or all of the coding modes derived from modeA and modeB and the 'other Prediction' process (e.g., planar mode, DC mode, MIP mode).

[0230] Below, we describe a method for determining optimal DIMD combination information through the difference between the intra prediction directional modes (modeA, modeB) induced by the decoder and their corresponding weights (WeightA, WeightB).

[0231] The decoder can obtain DIMD combination information by comparing the weights of modeA and modeB with the sum of all weights of the histogram (see Fig. 11). Specifically, the DIMD combination information can be obtained by comparing the weights of the directional information for the surrounding blocks of the current block (including the weights of modeA and modeB) to the weights of modeA and modeB (e.g., the sum of the weights).

[0232] For example, if there is one induced intra prediction directional mode (modeA or modeB), and the ratio of the weight of the corresponding prediction directional mode among all weights is greater than a specific ratio, the corresponding prediction directional mode may be selected. Meanwhile, if the ratio of the weight of the induced intra prediction directional mode among all weights is equal to or less than a specific ratio, the DIMD combination information may be a combination of at least one of the induced intra prediction directional mode, the planar mode, the DC mode, and the MIP mode. In this case, the specific ratio may be 1 / 2, 2 / 3, 3 / 4, 3 / 8, etc.

[0233] As another example, if there are two derived intra prediction directional modes (modeA and modeB), and the sum of the weights of each intra prediction directional mode among the total weights is greater than a specific ratio, the corresponding two intra prediction directional modes can be selected. On the other hand, if the sum of the weights of the two derived intra prediction directional modes among the total weights is equal to or less than a specific ratio, the DIMD combination information can select at least one of the derived intra prediction directional modes, the planar mode, the DC mode, and the MIP mode. For example, modeA, modeB, and the planar mode can be selected. Or, modeA and modeB can be selected. In this case, the specific ratio can be 1 / 2, 2 / 3, 3 / 4, 3 / 8, etc.

[0234] FIG. 19 is a diagram illustrating a method for generating a prediction sample using intra prediction directional mode information and weights according to one embodiment of the present invention.

[0235] Specifically, Fig. 19 illustrates the 'Intra prediction' and 'weighted prediction' processes of Fig. 14. Referring to Fig. 19, when there are multiple intra prediction directional modes induced by the decoder, the decoder can obtain a prediction sample by performing weighted prediction using the weight information of each of the multiple intra prediction directional modes. The weight information can be reset based on at least one of the horizontal length of the current block, the vertical length, the quantization parameter information, and the information on whether the current block is luminance or chrominance (Additional information).

[0236] FIG. 20 and FIG. 21 are diagrams showing pixel values ​​of surrounding blocks used when deriving an intra prediction directional mode according to one embodiment of the present invention.

[0237] Figures 20 and 21 illustrate pixel values ​​of neighboring blocks used when deriving an intra-prediction directional mode in the 'histogram analysis' process of Figure 14. When deriving an intra-prediction directional mode, filtering calculations are required for all neighboring pixels located on the left and above the current block. At this time, the neighboring pixels may be pixels on lines adjacent to or spaced apart from the boundaries of the current block. That is, since filtering calculations must be performed on all neighboring pixels on lines adjacent to or spaced apart from the left and above boundaries of the current block in order to derive an intra-prediction directional mode, there is a problem that delays due to computational complexity may occur. To solve this problem, the decoder can separate the filtering calculations for neighboring pixels located on the left and above the current block and derive intra-prediction directional modes for neighboring pixels located on the left and above in parallel. In addition, the decoder can also derive directional information by performing filtering calculations only on neighboring pixels corresponding to an arbitrary, predetermined location.

[0238] Figures 20(a) and (c) illustrate the surrounding pixels located to the left of the current block used in the filtering calculation to derive the intra prediction directional mode. Figures 20(b) and (d) illustrate the surrounding pixels located above the current block used in the filtering calculation to derive the intra prediction directional mode.

[0239] Depending on the location of the reference pixel used by the decoder to obtain the histogram described in Fig. 11, the mappable intra-directional information may vary.

[0240] For example, the width and height of the current block may be the same. In this case, when deriving direction information for surrounding pixels located on the left side of the current block in Fig. 20 (a), the mapped intra prediction directional mode can only be used from indices -14 to 34. In Fig. 20 (b), when deriving direction information for surrounding pixels located on the upper side of the current block, the mapped intra prediction directional mode can only be used from indices 34 to 80.

[0241] Meanwhile, the width and height of the current block may differ, and the locations of the surrounding pixels used to derive directional information may vary depending on the width and height of the current block. For example, if the height of the current block is longer than the width, the decoder can derive directional information using only the surrounding pixels located on the left side of the current block, without using the surrounding pixels located above the current block. This has the effect of reducing computational complexity by using only the surrounding pixels located on the left side, without using the surrounding pixels located above. If the width of the current block is longer than the height, the decoder can derive directional information by applying a greater weight to the surrounding pixels located above the current block than to the surrounding pixels located on the left side. The weights can use specific, predetermined values. For example, if the width of the current block is longer than the height, the surrounding pixels located on the left side of the current block can be given a weight of 1, and the surrounding pixels located above the current block can be given a weight of 2. In other words, since the current block is longer horizontally than vertically, it is more effective to derive the intra prediction directional mode by using directional information about the surrounding pixels located above the current block rather than the surrounding pixels located to the left of the current block.

[0242] The decoder can perform filtering calculations only for a specific number of pixels among the surrounding pixels located around the current block. In this case, the specific number can be a multiple of N, and N can be 2, 3, 4, etc. Information about N can be included in the picture header information. Referring to Fig. 21, the decoder can perform filtering calculations and derive directionality information only for positions that are multiples of '2' based on a position moved from the upper left of the current block to (-2, -2) in the x and y axes. In addition, the decoder can derive directionality information if the current block is a luminance block, and not derive directionality information if the current block is a chrominance block. The decoder can apply the directionality information found in the luminance block to the chrominance block. Meanwhile, directionality information for the luminance block and directionality information for the chrominance block can be obtained respectively. The chrominance block can utilize information obtained using at least one of the following modes: planar mode, DC mode, horizontal mode, vertical mode, and MIP mode, without using the directional information found in the luminance block.

[0243] The intra prediction directional mode of the current block is likely to be similar to the intra prediction directional modes of the neighboring blocks. Therefore, in order to encode the intra prediction directional mode of the current block, a Most Probable Mode (MPM) list is constructed using the intra prediction directional modes of the neighboring blocks, and information about whether the intra prediction directional mode of the current block exists in the MPM list and information about the position at which it exists can be included in the bitstream. In other words, information about the intra prediction directional mode of the current block may not be separately included in the bitstream. Therefore, since the intra prediction directional mode of the current block is determined based on the information about whether the intra prediction directional mode of the current block exists in the MPM list and the information about the position at which it exists, the information (i.e., the amount of bits) for deriving the intra prediction directional mode of the current block may vary depending on whether the MPM list is constructed effectively.

[0244] The method of deriving an intra-prediction directional mode using the directional characteristics of the surrounding pixels of the current block can also be used in the process of constructing the MPM list. The decoder can use the intra-prediction directional mode for the current block, derived using the directional characteristics of the surrounding pixels of the current block, to encode the intra-prediction directional mode for the current block by adding it to the MPM list. This can be used when the surrounding blocks of the current block are not encoded with an intra-prediction mode or do not have an intra-prediction directional mode, such as the Matrix Intra Prediction (MIP) mode.

[0245] The neighboring blocks adjacent to the current block may contain blocks without intra-prediction directional modes and blocks with intra-prediction directional modes. If the neighboring block located to the left of the current block does not have an intra-prediction directional mode, the decoder can derive the intra-prediction directional mode of the current block by calculating the directional characteristics using only the neighboring pixels located above the current block. Alternatively, if the neighboring block located above the current block has an intra-prediction directional mode and the neighboring block located to the left of the current block does not have an intra-prediction directional mode, the decoder can include the intra-prediction directional mode of the neighboring block located above the current block in the MPM list and the intra-prediction directional mode derived from the directional characteristics of the neighboring pixels located to the left in the MPM list.

[0246] FIG. 22 is a diagram illustrating a method for constructing an MPM list including an intra prediction directional mode of a current block according to one embodiment of the present invention.

[0247] Referring to Fig. 22, the DIMD mode can be included with preference in the MPM list. The current block's intra-prediction directional modes derived through the DIMD mode can be multiple. Therefore, the decoder can obtain prediction samples through multiple predictions. The intra-prediction directional modes of blocks surrounding the current block that have intra-prediction directional modes can be added to the MPM list. If there is a blank space in the MPM list, a mode modified by +1 or -1 from modeA can be added to the list, and DC mode, horizontal mode, vertical mode, and MIP mode can be added. Instead of the DIMD mode, the TIMD (Template based Intra Mode Derivation) mode can be included with preference in the MPM list. Additionally, both DIMD and TIMD modes can be included in the MPM list. In addition, at least one of the two intra directional prediction modes derived using the DIMD mode and the two intra directional prediction modes derived using the TIMD mode may be included in the MPM list. In addition, if an intra prediction directional mode is used in a first region of one of the GPM blocks divided into two regions, the MPM list may be used to derive the intra prediction directional mode for the first region. The MPM list may include at least one of the two intra prediction directional modes derived using the DIMD mode and the two intra prediction directional modes derived using the TIMD mode.

[0248] When the MPM list includes the DIMD mode, information on whether the current block is encoded in the DIMD mode can be derived through the syntax element (mpm_idx). Therefore, additional information related to DIMD may not need to be signaled. In this case, when the current block is encoded in the DIMD mode, the reference line index may be 0 (mrl_ref_idx may be 0). In addition, when the DIMD mode is used, mrl_ref_idx may not be parsed and the value of mrl_ref_idx may be inferred as 0. In addition, the MPM list may include an intra prediction directional mode derived using the DIMD mode. When an intra prediction directional mode derived from DIMD is selected, mrl_ref_idx may be reset. For example, the value of mrl_ref_idx may be reset to any one of 0, 1, 2, ... The decoder can determine whether to add an intra prediction directional mode derived using the DIMD mode in the MPM list based on the value of mrl_ref_idx obtained by parsing mrl_ref_idx, and determine the priority of the intra prediction directional mode derived using the DIMD mode in the MPM list. For example, if the value of mrl_ref_idx is not 0, the decoder may not include an intra prediction directional mode derived using the DIMD mode in the MPM list. Alternatively, only when the value of mrl_ref_idx is 0, the decoder may include an intra prediction directional mode derived using the DIMD mode in the MPM list. Alternatively, only when the reference pixel line determined from the value of mrl_ref_idx is 0, 1, 2, or 3, the decoder may include an intra prediction directional mode derived using the DIMD mode in the MPM list.Alternatively, if the reference pixel line determined from the value of mrl_ref_idx is greater than 3, the decoder may not include the intra prediction directional mode derived using the DIMD mode in the MPM list. Alternatively, if the value of mrl_ref_idx is not 0, the decoder may include the intra prediction directional mode derived using the DIMD mode in the MPM list.

[0249] The intra prediction directional mode derived by the DIMD mode can be used to reorder intra prediction mode candidates within an MPM list. The decoder can construct an MPM list starting from neighboring blocks of the current block, and then derive an intra prediction directional mode using the DIMD mode. The decoder can reorder intra prediction mode candidates within the MPM list using the derived intra prediction directional mode. At this time, the decoder can reorder the MPM list using one or more of the derived intra prediction directional mode, the horizontal or vertical length of the current block, quantization parameter information, information on available intra prediction modes among neighboring blocks of the current block, information on whether a residual signal exists in neighboring blocks of the current block, and information on whether the current block is a luma block or a chroma block.

[0250] The decoder can reorder the MPM list using the difference between the intra prediction mode candidates in the MPM list and the derived intra prediction directional mode. For example, the decoder can calculate the difference between the derived intra prediction directional mode and each intra prediction mode candidate in the MPM list and sort the MPM list in order of the smallest difference (including 0). The intra prediction mode candidate with the smallest difference in the MPM list can be set to have the smallest index value in the MPM list. Furthermore, the derived intra prediction directional mode can be set to have the highest priority and the smallest index value in the MPM list. Furthermore, the decoder can sort the MPM list after the derived intra prediction directional mode in order of the smallest difference (including 0) by calculating the difference between the derived intra prediction directional mode and each intra prediction mode candidate in the MPM list. Furthermore, when two MPM lists are used, the first MPM list can be composed of intra prediction mode candidates similar to the derived intra prediction directional mode in order of the smallest difference. The derived intra prediction directional mode can be constructed in descending order of the difference between the intra prediction mode candidates in the MPM list and the derived intra prediction directional mode. The second MPM list can be constructed using candidates that do not have a high similarity to the derived intra prediction directional mode. For example, the second MPM list can be constructed in descending order of the difference between the derived intra prediction directional mode and the intra prediction mode candidates in the MPM list. When the size of the MPM list is fixed, there may be an unfilled empty space in the MPM list. In this case, a new prediction candidate derived from one or more of the candidates already included in the MPM list or frequently occurring candidates can be added to the empty space.For example, a new prediction candidate may be a candidate corresponding to a number that is increased or decreased by an arbitrary size in the '+' or '-' direction from the mode number (index) of an already included candidate. At this time, the arbitrary size may be a natural number such as '1', '2', '3', ..., and information about the arbitrary size may be included in the picture header information. In addition, when two MPM lists are used, the first MPM list may be composed of prediction modes obtained by referring to the prediction mode of a neighboring block of the current block, and the second MPM list may be composed of prediction modes derived by DIMD. At this time, if the number of prediction modes included in the MPM list is smaller than the number of prediction modes that can be included in a predefined MPM list, prediction modes derived by applying an offset to the prediction modes included in the MPM list may be added.

[0251] The intra prediction directional mode derived by the DIMD mode can be used to reorganize intra prediction mode candidates within an MPM list. The decoder can derive an intra prediction directional mode through the DIMD mode after constructing an MPM list based on the prediction modes of neighboring blocks of the current block. Then, the decoder can reorganize the intra prediction mode candidates within the MPM list using the derived intra prediction directional mode to reconstruct multiple prediction candidates. At this time, the decoder can reorganize the MPM list using one or more of the derived intra prediction directional mode, the horizontal or vertical length of the current block, quantization parameter information, information on available intra prediction modes among neighboring blocks of the current block, information on the presence or absence of residual signals in neighboring blocks of the current block, and information on whether the current block is a luminance block or a chrominance block. A method for reorganizing an MPM list is described below.

[0252] The decoder can reassemble the MPM list by using the difference between the derived intra prediction directional mode and the intra prediction mode candidates in the MPM list. For example, the decoder can select candidates whose difference is less than or equal to an arbitrary value, and include multiple prediction candidates formed by combining the derived intra prediction directional mode and the candidates (existing intra prediction modes in the MPM list) in the MPM list. At this time, the decoder can include the candidates in order of the smallest difference to the largest difference in the MPM list. Next, the decoder can sequentially insert the candidates whose difference is greater than the arbitrary value into the MPM list. At this time, the arbitrary value can be a natural number such as 1, 2, 3, ... For example, it can be assumed that the index of the derived intra prediction mode is '18', and the indices of the candidates in the MPM list are '16', '21', '34', '1', '66', and the arbitrary value is 5. At this time, indices '16' and '21', which have a difference of '5' or less from the derived intra prediction mode, can be changed to multiple prediction candidates, and the candidates in the MPM list can be changed to the prediction modes of indices '16, 18', '21, 18', '34', '1', and '66'. That is, '16, 18' and '21, 18' can be multiple prediction candidates. For example, if the decoder selects '16, 18', which is a multiple prediction candidate in the MPM list, the decoder can generate the final prediction block by weighting the prediction samples generated with the prediction mode of index 16 and the prediction samples generated with the prediction mode of index 18. At this time, if the number of MPM lists is limited to 5, the MPM list can be '16, 18', '21, 18', '16', '21', and '34'. Additionally, when two MPM lists are used, the first MPM list may consist of candidates that are recombined using candidates similar to the derived intra prediction directional mode.The second MPM list may be composed of candidates that do not have high similarity with the candidates in the first MPM list and the derived intra prediction directional mode. Therefore, the first MPM list may be composed of multiple prediction candidates, and the second MPM candidates may be composed of single prediction candidates. Alternatively, the first MPM list may be composed of both single prediction candidates and multiple prediction candidates, and the second MPM candidates may be composed of only single prediction candidates. For example, the derived intra prediction mode may have index '18', the prediction mode candidates in the first MPM list may have indices '16', '21', '34', '1', and '66', and the prediction mode candidates in the second MPM list may have indices '50', '2', '8', '30', and '40', and an arbitrary value of 5 may be set. In this case, indices '16' and '21' that differ from the derived intra prediction mode index 18 by less than 5 may be changed to multiple prediction candidates. At this time, the first MPM list may be composed of indices '16, 18', '21, 18', '16', '18', '34', and the second MPM list may be composed of indices '1', '66', '50', '2', '8', '30', '40'.

[0253] An intra prediction directional mode can be encoded based on whether it is in the MPM list and, if so, where it is located. If the intra prediction directional mode does not exist in the MPM list, the intra prediction directional mode can be encoded based on the total number of intra prediction directional modes minus the total number of prediction modes in the MPM list. Specifically, there are a total of 67 intra prediction directional modes, and encoding can be performed for 61 of them, excluding the total number of 5 prediction modes in the MPM list and the planar mode. In this case, since the 61 intra prediction directional modes can be encoded using fixed length coding, encoding for a total of 6 bins is required.

[0254] FIG. 23 and FIG. 24 are diagrams showing templates used to derive an intra prediction mode of a current block according to one embodiment of the present invention.

[0255] Referring to FIG. 23, the decoder can use a template, which is a reconstructed arbitrary region (pixel(s)) adjacent to the current block, to derive an intra-prediction mode of the current block. First, the decoder can generate a prediction template for the template using neighboring pixels (reference) adjacent to the template. Then, the decoder can use the intra-prediction mode for the prediction template that is most similar to the already reconstructed template to reconstruct the current block. The method of deriving the intra-prediction mode of the current block using the above-described template can be described as TIMD (Template intra-mode derivation). At this time, the intra-prediction mode can be a mode with an index of 0 to 67, and may only be an intra-prediction mode within the MPM list derived from the neighboring blocks of the current block. At this time, the intra-prediction mode can be an intra-prediction mode within the MPM list derived from the neighboring blocks of the current block and modes that differ from the intra-prediction mode by an arbitrary number. The arbitrary number can be 1, 2, 3, ... Alternatively, the intra prediction mode for the template may only correspond to a directional mode, and may not correspond to a non-directional mode (planar mode, DC mode).

[0256] Below, a method for deriving an intra prediction directional mode using the TIMD mode is described.

[0257] i) The decoder can set the size of the template. The width or height of the template can be 4, and if the width or height of the current block is 8 or less, the width or height of the template can be set to 2. ii) The decoder can set the type of the template. The type of the template can be classified into a type that uses only left samples, a type that uses only upper samples, and a type that uses all of the left, upper, and upper-left samples. The decoder can determine the type of the template based on whether the neighboring blocks are valid or whether the neighboring blocks can be used to derive an intra-prediction directional mode. Meanwhile, if the neighboring blocks cannot be used to derive an intra-prediction directional mode, the TIMD mode can be set to a planar mode, and weighted averaging may not be performed. iii) The decoder can configure a template for the current block. iv) The decoder can derive intra prediction directional modes for neighboring blocks located to the left, above, upper-left, upper-right, and lower-left of the current block to determine whether the current block has directionality. v) If none of the neighboring blocks of the current block have directionality (e.g., non-directional mode (DC mode, planar mode, MIP mode, etc.)), the decoder can select one intra prediction directional mode with the minimum cost and not perform the TIMD mode. In this case, weighted averaging using multiple prediction blocks may not be performed. vi) If there is one or more blocks among the neighboring blocks of the current block that have directionality, the process described below can be performed. The process described below can be performed based on the intra prediction directional modes existing in the MPM list. This is because complexity may increase if all 67 intra prediction directional modes are checked. a. The decoder can construct an MPM list. b.Next, the decoder can modify the MPM list by adding DC mode, horizontal mode, and vertical mode to the MPM list if they do not exist in the MPM list. c. The decoder can compare costs by evaluating all intra prediction directional modes in the modified list. The decoder can select a first mode with a lowest cost and a second mode with a second lowest cost. d. The decoder can additionally perform an evaluation for an intra prediction directional mode corresponding to an index that is one less than or greater than the intra prediction directional mode index of the first mode and the intra prediction directional mode index of the second mode to improve accuracy. The decoder can perform an additional evaluation and again select a third mode with a lowest cost and a fourth mode with a second lowest cost. Meanwhile, the first mode and the third mode may be the same, and the second mode and the fourth mode may be the same. e. The decoder can determine whether to perform weighted averaging based on the costs of the third mode and the fourth mode. If the difference between the cost of the third mode and the cost of the fourth mode is less than a specific value, the decoder can perform weighted averaging, and the weights of the third and fourth modes can be determined based on the costs of the third and fourth modes. If the difference between the cost of the third mode and the cost of the fourth mode is greater than a specific value, the decoder can generate a prediction block using only the third mode without performing weighted averaging. In this case, the specific value may be a predetermined value.

[0258] The size of a template may vary depending on the horizontal or vertical length of the current block. For example, as shown in Fig. 23(a), an above template may be configured that is longer than the horizontal length of the current block. In this case, the vertical length of the above template may be a predetermined length. Similarly, a left template may be configured that is longer than the vertical length of the current block. In this case, the horizontal length of the left template may be a predetermined length. The predetermined length may be 1, 2, 3, ...

[0259] If the current block is located at the CTU boundary (if any of the upper, lower, left, or right boundaries of the current block is included in the boundary of the CTU), the reference pixels for deriving / predicting the template used for the TIMD mode can be changed. Referring to Fig. 24, if the upper boundary of the current block is included in the boundary of the CTU, there can be only one reference line located at the upper side of the current block used for template construction. This is to minimize line buffer memory usage. Therefore, the decoder can perform the TIMD mode by constructing only the left template of the current block, without constructing the upper template of the current block. At this time, the reference pixels for predicting the left template can be the above reference pixel and the left reference pixel of the current block. At this time, the height of the left template can be the same as the height of the current block, as shown in Fig. 24(a). In addition, as shown in Fig. 24(b), the decoder can check whether the block adjacent to the left of the current block is a block that has already been restored, and if it is a block that has been restored, the height of the left template can be configured to be greater than the height of the current block.

[0260] In general, the accuracy of prediction samples for the current block can be increased as the decoder references more adjacent pixels of the current block. However, referencing more adjacent pixels increases the required memory. Furthermore, if there are blocks adjacent to the current block that have not yet been restored, those areas cannot be used as templates. To effectively handle this increased memory and unrestored areas, as shown in Figure 23(b), the length of the upper template can be set to be equal to the horizontal length of the current block, and the length of the left template can be set to be equal to the vertical length of the current block.

[0261] The decoder can use an intra prediction mode derived from a template to obtain prediction samples for the current block. The decoder can generate prediction samples using neighboring pixels adjacent to the current block and adaptively select which neighboring pixels to use for prediction sample generation. Furthermore, the decoder can use multiple reference lines to generate prediction samples, and the index information for these multiple reference lines can be included in the bitstream.

[0262] For entropy coding, a new context for the indices of multiple reference lines for TIMD mode can be defined. The increased number of contexts can be associated with increased memory and context switching complexity. Therefore, the context used to encode and decode the indices of multiple reference lines in TIMD mode can be reused from the existing context for the indices of multiple reference lines.

[0263] The transformation of the residual signal of the current block can be performed in two steps. The first transform can be a transform such as DCT-II, DST-VII, DCT-VIII, DCT5, DST4, DST1, identity transformation (IDT), etc., which are adaptively applied horizontally and vertically, respectively. A second transform can be additionally applied to the transform coefficients for which the first transform has been completed, and the second transform can be calculated as a matrix multiplication between the first-transformed transform coefficients and a predefined matrix. The second transform can be described as a low frequency non-separable transform (LFNST). The matrix transform set for the second transform can vary depending on the intra prediction mode of the current block. Coefficient information of the transform matrix used for the second transform can be included in the bitstream.

[0264] When a secondary transform is applied to a current block to which the DIMD mode or the TIMD mode is applied, a transform set for the secondary transform can be determined based on an intra prediction mode derived from the DIMD mode or the TIMD mode. Coefficient information of a transform matrix used for the secondary transform can be included in a bitstream. A decoder can parse the coefficient information included in the bitstream to set matrix coefficient information of the secondary transform for the DIMD mode or the TIMD mode. At this time, one of the two intra prediction modes derived from the TIMD mode can be used to select the primary transform or the secondary transform set. The costs of each of the two intra prediction directional modes can be compared, and the intra prediction directional mode with the smallest cost can be used to select the primary transform or the secondary transform set. In addition, one of the two intra prediction directional modes derived from DIMD can be used to select the primary transform or the secondary transform set. The weights of each of the two intra prediction modes can be compared, and the intra prediction directional mode with the highest weight can be used to select the first or second transform set.

[0265] TIMD mode is highly complex because it predicts the template of the current block and uses the intra prediction mode derived from the template to generate the prediction block of the current block. Therefore, when the decoder generates the prediction template for the template region, the existing reference sample filtering process may not be performed. In addition, TIMD mode may not be applied if the ISP mode is applied to the current block or if the CIIP mode is applied to the current block. The ISP mode or CIIP mode may not be applied to the current block to which TIMD mode is applied, or the syntax related to the ISP or CIIP may not be parsed. In this case, the value of the syntax related to the ISP or CIIP that is not parsed can be inferred as a predetermined value.

[0266] Template prediction can be performed by dividing the current block into a left template region and an upper template region, and an intra prediction mode can be derived for each template. In addition, two or more intra prediction modes can be derived for each template, and there can be four or more intra prediction modes for the current block. When there are two or more intra prediction modes, a prediction sample for the current block can be generated using all of the derived intra prediction modes, and the decoder can generate a final prediction block for the current block by performing a weighted average of the generated prediction samples. At this time, at least three or more of the two or more intra prediction modes derived from template prediction, a planar mode, a DC mode, and a MIP mode can be used to generate the prediction sample. For example, when the decoder generates (obtains) a prediction sample for the current block, the decoder can generate a final prediction sample by performing a weighted average of the prediction samples generated using the intra prediction modes derived from template prediction and the planar mode.

[0267] Even when CIIP mode is applied, prediction samples can be generated using the methods described above. CIIP mode utilizes both intra-prediction and inter-prediction when generating prediction samples (blocks) for the current block. The prediction sample for the current block can be generated as a weighted average of the intra-prediction samples and inter-prediction samples.

[0268] When generating intra prediction samples by applying the CIIP mode, the DIMD mode or the TIMD mode can be used. In this case, when the DIMD mode is used, the intra prediction sample can be generated based on the DIMD combination information. For example, the decoder can generate the first prediction sample using the intra prediction mode with the highest weight and the second prediction sample using the intra prediction mode with the second highest weight. Then, the decoder can generate the final intra prediction block by performing a weighted average of the first prediction sample and the second prediction sample. In this case, the decoder can generate the final intra prediction block by performing a weighted average of three prediction samples, including the planar mode predicted sample, the first prediction sample, and the second prediction sample among the neighboring blocks of the current block. In this case, the intra prediction sample can be generated based on the TIMD combination information. For example, the decoder can generate two prediction samples using each of the two intra prediction modes. Then, the decoder can generate a final intra prediction sample by weighting the two prediction samples. At this time, the decoder can generate a final intra prediction sample by weighting the two prediction samples and the sample predicted in planar mode.

[0269] Intra prediction samples may have varying accuracy depending on their location. That is, pixels located farther away from the surrounding pixels used for prediction within a prediction sample may contain more residual signals than pixels located closer to the surrounding pixels. Therefore, the decoder can divide the prediction sample into vertical, horizontal, and diagonal directions depending on the direction of the intra prediction mode, and set different weights depending on the distance from the surrounding pixels used for prediction. This can be applied to intra prediction blocks generated using the CIIP mode or intra prediction blocks generated using two or more intra prediction modes, and different weights can be set for each pixel within the prediction block depending on the distance between the location of the reference pixel and the pixel location within the prediction block. For example, if the intra prediction mode of the current block is a mode having a vertical or vertical-like direction, a higher weight can be set for each pixel location within the prediction block as the pixel location is closer to the top pixel, and a lower weight can be set for each pixel location as the pixel location is farther away from the top pixel.

[0270] When the current block is encoded in CIIP mode, the decoder can generate a final prediction block by weighting the intra-prediction samples and inter-prediction samples. The pixel-wise weights of the inter-prediction samples can be set by considering the pixel-wise weights of the intra-prediction samples. For example, the pixel-wise weights of the inter-prediction samples can be a value obtained by subtracting the pixel-wise weights of the intra-prediction samples from the sum of the total weights. In this case, the sum of the total weights can be a value obtained by adding the weights of the intra-prediction samples and the weights of the inter-prediction samples at the pixel level.

[0271] When two or more intra prediction modes are used to generate prediction samples, the decoder can generate prediction samples based on each intra prediction mode, and then weight and average the generated prediction samples to generate a final prediction sample. When generating prediction samples for each intra prediction mode, pixel-wise weights according to the intra prediction mode can be applied.

[0272] The pixel-level weights may be set based on at least one of the following: an intra prediction mode, the horizontal length and vertical length of the current block, a quantization parameter, information about whether the current block is luminance or chrominance, whether the surrounding block is intra coded, and information about the presence or absence of residual transform coefficients of the surrounding block.

[0273] FIGS. 25 to 28 are diagrams illustrating a method for generating prediction samples (pixels) based on a plurality of reference pixel lines according to one embodiment of the present invention.

[0274] Referring to Fig. 25(a), the video signal processing device can generate a prediction sample (2502) within the current block based on a first reference pixel line (reference line 1) adjacent to the current block (2501) and a second reference pixel line (reference line 2) adjacent above the first reference pixel line. The prediction sample (2502) of Fig. 25(a) is only a sample corresponding to a position according to an embodiment of the present invention, and the position of the pixel is not limited thereto. In the present specification, the meaning of “generate” by the video signal processing device may be the same as the meaning of “acquire” by the video signal processing device. Fig. 25(b) is a drawing showing Fig. 25(a) in more detail. For example, the video signal processing device can generate a first prediction pixel (2503) using a smoothing filter, a cubic filter, or a Gaussian filter according to an intra prediction mode through six reference pixels of the first reference pixel line. And, the video signal processing device can generate a second prediction pixel (2504) using a smoothing filter, a cubic filter, or a Gaussian filter according to the intra prediction mode through the six reference pixels of the second reference pixel line. The video signal processing device can generate a third prediction pixel (2505) by performing a weighted average through an arbitrary set of weights on the generated first prediction pixel (2503) and second prediction pixel (2504). At this time, the six reference pixels of the second reference pixel line may be reference pixels at a position shifted by one pixel to the right of each pixel of the first reference pixel line in consideration of the intra prediction mode of the current block, the position of the pixel to be generated, the position of the reference pixel line, etc. The video signal processing device can generate a prediction sample (2502) within the current block based on the third prediction pixel (2505).Alternatively, the video signal processing device may generate a prediction sample (2502) within the current block based on the third prediction pixel (2505) and the distance between the third prediction pixel (2505) and the prediction sample (2502) within the current block. The weight used by the video signal processing device to generate the third prediction pixel (2505) may be an integer greater than or equal to 0. For example, the weight of the first prediction pixel (2503) may be 3, and the weight of the second prediction pixel (2504) may be 1. At this time, the positions of the reference pixels used to generate the prediction sample (the positions of the six reference pixels of the first reference pixel line and the six reference pixels of the second reference pixel line in FIG. 25) may vary based on at least one of the following: the intra prediction mode of the current block, the positions of the pixels to be generated (e.g., the positions of the first prediction pixel (2503), the second prediction pixel (2504), the third prediction pixel (2505) in FIG. 25), the positions of the reference pixel lines (e.g., the positions of the first reference pixel line and the second reference pixel line in FIG. 25).

[0275] Referring to Fig. 26(a), the video signal processing device can generate a prediction sample (2601) within the current block by using reference pixels at the same vertical positions of two reference pixel lines. That is, each of the six pixels of the first reference pixel line (Reference line 1) and each of the six pixels of the second reference pixel line (Reference line 2), which are used to generate the prediction sample within the current block, may have the same vertical position. The position of each pixel can be determined regardless of the position of the reference pixel line. Referring to Fig. 26(b), the video signal processing device can generate a first prediction pixel (2602) by using six pixels of the first reference line. The video signal processing device can obtain a second prediction pixel (2603) by using six pixels (2607) of the second reference line. At this time, if a sample of the second reference line, which is the same as the sample of the first reference line in the vertical direction, is used, the right pixel (2606) of the second reference line may not be used. Accordingly, the video signal processing device can configure the right pixel (2606) of the second reference line by copying (padding) the pixel (2605) to the right pixel (2606) of the second reference line, and then use the right pixel (2606) of the second reference line to generate the second prediction pixel (2603). The video signal processing device can obtain the third prediction pixel (2604) using the first prediction pixel (2602) and the second prediction pixel (2603). The video signal processing device can generate the prediction sample (2601) within the current block using the third prediction pixel (2604). Fig. 26 is different from Fig. 25 only in the pixels of the first and second reference pixel lines used to generate the prediction sample within the current block, and the method for generating the prediction sample within the current block may be the same as Fig. 25.

[0276] When constructing an MPM list, the video signal processing device may include a DIMD mode, which derives an intra-prediction directional mode from a reconstructed neighboring block adjacent to the current block, in the MPM list. In this case, if there are two intra-prediction directional modes derived from the DIMD mode, the video signal processing device may include both intra-prediction directional modes in the MPM list.

[0277] When a video signal processing device generates a prediction sample for a current block using multiple reference pixel lines (methods of FIGS. 25 and 26), a DIMD mode included in the MPM list is one in which pixels adjacent to the current block are not used, and the video signal processing device can derive an intra prediction directional mode by performing the DIMD method at pixel positions indicated by the reference pixel lines. Then, the derived intra prediction directional mode can be included in the MPM list.

[0278] In addition, the video signal processing device can derive an intra prediction directional mode using DIMD for each reference pixel line, and then add the derived intra prediction directional mode to the MPM list. The reference pixel line may be a line located at a position spaced apart by 1, 3, 5, 7, or 12 pixels from the upper left position of the current block. Alternatively, the reference pixel line may be a reference pixel line located at a position adjacent to the upper side of the current block. At this time, the intra prediction directional mode derived by the video signal processing device using DIMD for each reference pixel line may be added to the MPM list. If the derived intra prediction directional modes are duplicated, the duplicated intra prediction directional modes may be excluded from the MPM list. In the present specification, the reference pixel line may be indexed. For example, a reference pixel line adjacent to the current block may be indexed and referred to as reference pixel line 0, and reference pixel lines spaced 1 pixel, 2 pixels, ... n pixels away from the current block may be indexed and referred to as reference pixel line 1, reference pixel line 2, ... reference pixel line n, respectively.

[0279] The reference pixel lines for performing DIMD may vary depending on the reference pixel lines used in the current block. For example, if the reference pixel lines for the current block are 1 and 3, the video signal processing device may perform DIMD using reference pixel lines 0, 1, and 2 and derive an intra-prediction directional mode. In addition, if the reference pixel lines for the current block are 5 and 7, the video signal processing device may perform DIMD using reference pixel lines 5, 6, and 7 and derive an intra-prediction directional mode. In addition, if the reference pixel lines for the current block are 12, the video signal processing device may perform DIMD using reference pixel lines 11, 12, and 13 and derive an intra-prediction directional mode.

[0280] When the current block is encoded in DIMD mode, the encoder can generate and signal a bitstream including information related to reference pixel lines to be used to derive an intra prediction directional mode. Then, the encoder can generate an intra prediction block using the reference pixel lines on which DIMD is performed and the intra prediction directional mode derived from the DIMD. When the current block is decoded in DIMD mode, the decoder can parse information related to the reference pixel lines and then derive an intra prediction directional mode using the reference pixel lines corresponding to the information related to the reference pixel lines. Then, the decoder can generate an intra prediction block using the reference pixel line information and the intra prediction directional mode derived from DIMD.

[0281] Referring to FIG. 27, a video signal processing device can generate a virtual new reference pixel line using a plurality of reference pixel lines, and generate a prediction sample within a current block based on the new reference pixel line.

[0282] Circles in the same horizontal row in Fig. 27 may indicate pixels located on the same reference pixel line. Fig. 27(a) shows that the positions of reference pixels used when generating prediction samples using at least one of the intra prediction mode of the current block, the positions of pixels to be generated, and the positions of reference pixel lines vary for each reference pixel line. The video signal processing device may generate samples (2701-a to 2701-d) at the '1' position for each reference pixel line using a smoothing filter, a cubic filter, or a Gaussian filter according to the intra prediction mode, and may generate a virtual new reference pixel line (2702) using multiple samples at the '1' positions. Meanwhile, in order to reduce complexity, samples at the '1' position may not be generated, and a virtual new reference pixel line (2702) may be generated using integer reference pixels closest to the '1' position. The video signal processing device may generate prediction samples within the current block using the virtual new reference pixel line. Referring to FIG. 27(b), the video signal processing device can use four reference pixels at the same vertical position to generate a new virtual reference pixel line (2705). That is, the pixels for generating the new virtual reference pixel line (2705) may be pixels at the same vertical position, including each of the six reference pixels of the first reference pixel line and each of the six reference pixels of the second reference pixel line. The video signal processing device can obtain a first prediction pixel (2703) using at least one of the new virtual reference pixel line and position, the intra prediction mode of the current block, and the pixel position to be generated. The video signal processing device can generate a prediction sample (2704) of the current block using the first prediction pixel (2703). The number of reference pixel lines used to generate the new virtual reference pixel line may be two or more.For example, two to five reference pixel lines may be used.

[0283] Referring to FIG. 28, a video signal processing device may use four reference pixels close to the positions of new reference pixels (2801) to be generated to generate a new virtual reference pixel line. At this time, the positions of the new reference pixels may be vertically identical to the reference pixel line. Additionally, the positions of the new reference pixels may be adjacent to the direction of the intra prediction mode of the current block.

[0284] FIG. 29 illustrates a method for predicting a sample using a plurality of reference pixel lines according to one embodiment of the present invention.

[0285] Referring to FIG. 29, a video signal processing device may receive a plurality of reference pixel lines as input and perform intra prediction to generate a prediction block within a current block. Depending on which reference pixel line is used, a different prediction block may be generated, and the video signal processing device may generate a final prediction block by performing a weighted average according to the weights input for each prediction block. At this time, the weights may be preset values. For example, the weight of a sample predicted by a main reference pixel line may be 3, and the weight of a sample predicted by a sub-reference pixel line may be 1. At this time, the weights may be determined based on at least one or more of the size of the current block, the horizontal or vertical size of the current block, the intra-prediction mode of the current block, quantization parameter information, and the distance (or difference) between the main reference pixel line and the sub-reference pixel line. In addition, the reference pixel line may be determined based on at least one or more of the size of the current block, the horizontal or vertical size of the current block, the intra-prediction mode of the current block, quantization parameter information, and MRL information. For example, the main reference pixel line may be a reference pixel line adjacent to the current block, and the sub-reference pixel line may be a reference pixel line indicated by the MRL. As another example, the main reference pixel line may be a reference pixel line indicated by the MRL, and the sub-reference pixel line may be a reference pixel line that is located at an arbitrary fixed position relative to the reference pixel line indicated by the MRL, and the arbitrary fixed position may be an integer from -N to +N, where N may be an integer greater than 0.

[0286] The intra prediction mode used in the method for generating prediction samples within the current block described above may be the same for each reference pixel line. Or, conversely, the intra prediction mode used in the method for generating prediction samples within the current block described above may be different for each reference pixel line. That is, a signaled intra prediction mode may be used in the main reference pixel line, and a prediction mode (corresponding to the index) that is added or subtracted by an arbitrary value from (the index of) the intra prediction mode used in the main reference pixel line may be used in the sub-reference pixel line. At this time, the arbitrary value may be an integer greater than or equal to 1. In addition, the video signal processing device may determine whether to increase or decrease the arbitrary value depending on the value of the intra prediction mode used in the main reference pixel line. For example, the video signal processing device may increase the intra prediction mode by an arbitrary value when the angle is negative, and may decrease the intra prediction mode by an arbitrary value when the angle is positive.

[0287] FIG. 30 illustrates a method for determining a reference pixel line based on a template according to one embodiment of the present invention.

[0288] Below, we describe a method for determining the optimal reference pixel line for the current block (for restoration of the current block) based on the template.

[0289] Referring to FIG. 30, a video signal processing device can construct a reference template using reference pixel lines adjacent to a current block. The video signal processing device can generate prediction samples for the positions of the reference templates using reference pixel lines 1, 2, 3, etc. The video signal processing device can calculate a cost between the generated prediction samples and samples of the reference template. At this time, the cost can be calculated using a method such as SAD (Sum of Absolute Differences) or MRSAD (Mean-Removed SAD). The reference pixel corresponding to the minimum cost may be the optimal reference pixel. In addition, the encoder can rearrange the calculated costs in ascending order, construct a list for reference pixel lines, and then generate and signal a bitstream including information on an index for the optimal reference pixel line. The decoder can construct a list for reference pixel lines using the above-described method, parse the index for the optimal reference pixel line included in the bitstream, and generate a prediction sample using the reference pixel line indicated by the index. As described herein, a method for a video signal processing device to determine a reference pixel line based on a template can be described as a Template-based Multiple Reference Line (TMRL) method or a TMRL intra prediction method.

[0290] In order to reduce the complexity of determining the optimal reference pixel line, the optimal reference pixel line may not be used for all intra prediction modes, but may be used only for the intra prediction modes included in the MPM list. That is, the encoder can construct a list of reference pixel lines by combining intra prediction modes included in the MPM list with multiple reference pixel lines, and calculate the cost between the prediction sample generated using each candidate in the list for the reference pixel line and the reference template. Then, the encoder can reconstruct the list in ascending order based on the cost and use only a few combinations with low costs. The encoder can generate and signal a bitstream that includes information about an index for the optimal combination information among the combination information (any intra prediction mode and any reference pixel lines) in the reconstructed list. The decoder can construct a list for the same reference pixel lines using the above-described method, parse the index for the optimal combination information included in the bitstream, and generate a prediction sample using the optimal combination information indicated by the index.

[0291] When prediction samples are generated using multiple reference pixel lines, different weights may be applied to each prediction sample generated through each reference pixel line. At this time, a template-based method may be used to derive optimal weights. That is, the encoder may construct a list for reference pixel lines by combining intra prediction modes included in the MPM list, multiple reference pixel lines, and weights (for example, one of 3:1 and 2:2) for samples predicted by each reference pixel line, and may calculate the cost between the prediction sample generated using each candidate in the list for the reference pixel line and the reference template. Then, the video signal processing device may rearrange the MPM list in ascending order based on the cost, and then reconstruct the MPM list using only a few combinations with low costs. The encoder can generate and signal a bitstream including information about an index for optimal combination information among combination information within the reconstructed list (any intra prediction mode, any reference pixel lines, and weights (e.g., one of 3:1 and 2:2) for samples predicted by each reference pixel line). The decoder can construct a list for the same reference pixel lines using the above-described method, and then parse the index for optimal combination information included in the bitstream to generate a prediction sample using the optimal combination information indicated by the index.

[0292] In the method for determining a reference pixel line based on a template described through FIG. 30, reference pixel lines adjacent to the current block can be used to construct the template. Accordingly, reference pixel lines determined based on the template can be determined using reference pixel lines not adjacent to the current block. Below, a method in which reference pixel lines adjacent to the current block can also be used to determine a reference pixel line based on a template is described.

[0293] FIG. 31 illustrates a method for setting a template for testing a reference pixel line adjacent to a current block according to one embodiment of the present invention.

[0294] As illustrated in FIG. 31, when a reference template is configured, a reference pixel line adjacent to the current block can also be used to determine a reference pixel line based on the template. Referring to FIG. 31(a), a reference template including only reference pixels adjacent to the left side of the current block can be configured. The encoder can generate a prediction sample for the reference template using at least one of Reference line 0 on the upper side of the current block and / or Reference line 1 on the left side of the current block, and calculate a cost between the reference template and the prediction sample. The encoder can generate a prediction sample for the reference template using Reference line 1, 2, 3 ... and calculate a cost between the reference template and the prediction sample. FIG. 31(b) illustrates a case where the reference template includes only reference pixels adjacent to the upper side of the current block. Similarly, the encoder can generate a prediction sample for a reference template using at least one of the reference pixel line 0 on the left side of the current block and / or the reference pixel line 1 on the top side of the current block, and calculate a cost between the reference template and the prediction sample. The encoder can generate a prediction sample for the reference template using reference pixel lines 1, 2, 3, ..., and calculate a cost between the reference template and the prediction sample.

[0295] The encoder can rearrange the calculated costs in ascending order to form a list of reference pixel lines, and then generate and signal a bitstream containing information about the index of the optimal reference pixel line. The decoder can generate prediction samples using the optimal reference pixel line determined by parsing the information about the index of the optimal reference pixel line included in the bitstream after forming the list of reference pixel lines using the above-described method.

[0296] FIG. 32 is a structural diagram illustrating a method for determining an optimal reference pixel line using a plurality of reference pixel lines based on a template according to one embodiment of the present invention.

[0297] Referring to FIG. 32, an encoder can receive multiple reference pixel lines as input and perform intra prediction to generate prediction blocks for a template. Depending on which reference pixel line is used, different prediction blocks can be generated. The encoder can perform a weighted average based on various weight information input to each prediction block to ultimately generate a prediction block for the template. Depending on which reference pixel lines are used and which weights are used, multiple prediction blocks can be generated. After calculating the cost between each prediction block and the reference template, the encoder can rearrange the prediction blocks in ascending order based on the cost corresponding to each prediction block and construct a separate list using only a predetermined number of top candidates. In this case, the predetermined number can be an integer greater than or equal to 2, and can be 10. The encoder can generate a prediction block for the current block using the combination information used to generate the prediction blocks in the separate list. The encoder can then select the optimal candidate from the list in terms of image quality and bit rate, and then generate and signal a bitstream containing information about the index of the optimal candidate. The decoder can then construct a separate list identical to the above-described method, parse the information about the optimal candidate index contained in the bitstream, and use the optimal combination information indicated by the index of the optimal candidate to generate prediction samples.

[0298] When the current block is encoded using an intra prediction mode, the encoded intra prediction mode can be any one of angular mode, planar mode, DC mode, and MIP mode. Prediction according to the angular mode can be performed according to 65 different angles, and prediction according to the MIP mode can be performed based on a predefined matrix. The angular mode can be effective in blocks that have characteristics such as edges within the current block. However, if the current block has smooth characteristics, blocks predicted using the angular mode can generate discontinuous edges at the boundary between blocks or visible outlines within the block. This can be a factor that reduces encoding efficiency. In addition, the DC mode can have the disadvantage of generating visible edges at the boundary between blocks at low bit rates. The planar mode can improve the edge problems that occur in the angular and DC modes, and can generate predicted blocks without discontinuities.

[0299] FIG. 33 illustrates a method for generating prediction samples using a planar mode according to one embodiment of the present invention.

[0300] Referring to FIG. 33, according to the planar mode, the video signal processing device can generate a linearly predicted value in the vertical direction and a linearly predicted value in the horizontal direction to generate a prediction sample within the current block. The video signal processing device can generate a prediction sample (value) within the current block by weighting the linearly predicted value in the vertical direction and the linearly predicted value in the horizontal direction.

[0301] A linearly predicted value in the vertical direction (predV (x, y)) can be generated based on Equation 4, and a linearly predicted value in the horizontal direction (predH (x, y)) can be generated based on Equation 5. And, a new predicted value (pred (x, y)) can be generated based on Equation 6. In Equations 4 to 6, W may be the horizontal size (width) of the current block, and H may be the vertical size (height) of the current block. rec(x, y) may mean a pixel value at the (x, y) coordinate. Predicted values ​​(predV(x, y), predH(x, y), pred(x, y)) may mean a predicted pixel value at the (x, y) coordinate.

[0302]

[0303]

[0304]

[0305] A video signal processing device may use only vertical linear prediction when performing prediction related to a current block according to a planar mode. Alternatively, the video signal processing device may use only horizontal linear prediction when performing prediction related to a current block according to a planar mode. Therefore, the planar mode can be divided into three modes. That is, in addition to the method of weighting and averaging prediction blocks generated using conventional vertical and horizontal linear prediction, it can be divided into a vertical planar mode that uses only vertical linear prediction, and a horizontal planar mode that uses only horizontal linear prediction. An encoder can generate and signal a bitstream including information on which of the three planar modes a current block used. A decoder can generate a prediction block for the current block based on a planar mode determined by parsing information on which prediction mode was used included in the bitstream.

[0306] Explicitly signaling the planar mode used by including it in the bitstream may result in increased bitrate. To save bitrate, the decoder can implicitly derive the planar mode used by using at least one of the following: the size of the current block, the width or height of the current block, the width and height ratio of the current block, the number of pixels in the current block, whether the current block is a luma signal or a chrominance signal, intra-prediction directional mode information of adjacent blocks to the current block, MPM list information for the current block, and intra-prediction directional mode information derived from DIMD or TIMD.

[0307] Vertical planar mode and horizontal planar mode can be more effective when the shape of the current block is rectangular rather than square. Therefore, the vertical planar mode and horizontal planar mode can be applied (activated) only when the width and height of the current block are different. In other words, the encoder can compare the width and height of the current block and, only when the sizes are different, generate and signal a bitstream that includes planar mode selection information on whether the vertical planar mode, the horizontal planar mode, or the conventional planar mode is applied. The decoder can compare the width and height of the current block and, only when the sizes are different, parse the planar mode selection information. On the other hand, if the width and height of the current block are the same, the conventional planar mode can be applied.

[0308] For convenience of explanation in this specification, information about which prediction mode among the three planar modes the current block used may be described as planar mode selection information.

[0309] Planar mode selection information can be signaled for each coding unit. However, since the amount of bits may increase if the planar mode selection information is signaled for all coding units, the encoder may generate and signal a bitstream including the planar mode selection information only when a specific condition is satisfied. When the specific condition is satisfied, the decoder may parse the planar mode selection information to determine an intra prediction directional mode for the current block, and may generate a prediction block for the current block using the determined intra prediction directional mode. At this time, the specific condition may be a condition related to the horizontal and vertical sizes of the current block, the ratio of the horizontal and vertical sizes of the current block, whether the intra prediction directional mode of the current block is a specific mode (e.g., whether it is a planar mode, a DC mode, a vertical mode, or a horizontal mode), whether the coding mode of the current block is a DIMD, TIMD, IntraTMP, IBC, ISP, or MIP coding mode, and index information of a reference pixel line used when generating the prediction block for the current block. Whether to encode and decode the plane selection information may be determined based on whether at least one of specific conditions is satisfied. Specifically, the specific conditions may be 1) when the intra prediction directional mode of the current block is a conventional planar mode (i.e., when the index of the intra prediction directional mode is 0), 2) when the horizontal and vertical sizes of the current block are equal to or smaller than the maximum transform block size, and the product of the horizontal and vertical sizes of the current block is greater than the product of the minimum transform block size and the minimum transform block size, and 3) when the horizontal and vertical sizes of the current block are different from each other. In this case, the size of the minimum transform block may be an integer, such as 4 or 8, and the size of the maximum transform block may be an integer, such as 64, 128, or 256.If at least one of the specific conditions 1) to 3) described above is satisfied, the encoder can generate and signal a bitstream including planar mode selection information, and the decoder can parse the planar mode selection information to determine an intra prediction directional mode for the current block.

[0310] If the current block is a chrominance component block, the vertical planar mode and the horizontal planar mode are not applied, and only the conventional planar mode can be applied. That is, if the current block is a chrominance component block, the video signal processing device can generate a prediction block using the conventional planar mode. Therefore, if the current block is a chrominance component block, the video signal processing device may not signal or parse the planar mode selection information. Meanwhile, even if the current block is a chrominance component block, the vertical planar mode or the horizontal planar mode can be applied in the same way as the luminance component block. For example, if the vertical planar mode is applied to the current block, the decoder can generate a prediction block for the luminance component block and the chrominance component block of the current block using the vertical planar mode.

[0311] If the width of the current block is greater than the height, the number of pixels adjacent to the upper side of the current block is greater than the number of pixels adjacent to the left side of the current block, so the decoder can generate a prediction block for the current block using the vertical planar mode. If the height of the current block is greater than the width, the number of pixels adjacent to the left side of the current block is greater than the number of pixels adjacent to the upper side of the current block, so the decoder can generate a prediction block for the current block using the horizontal planar mode. If the width and height of the current block are the same, the decoder can generate a prediction block for the current block using the conventional planar mode. Since the planar mode is implicitly determined based on the width and height of the current block, the encoder does not need to generate a bitstream including the planar mode selection information. The decoder can generate a prediction block for the current block based on the planar mode determined based on the width and height of the current block.

[0312] The vertical planar mode and the horizontal planar mode may not be applicable in the ISP mode. The encoder may not signal planar mode selection information (i.e., the bitstream may not include the planar mode selection information) if the current block is encoded in the ISP mode and the current block is encoded in the planar mode. The decoder may not parse the planar mode selection information if the current block is encoded in the ISP mode and the current block is encoded in the planar mode. Conversely, the vertical planar mode and the horizontal planar mode may be applicable in the ISP mode. The encoder may generate and signal a bitstream including the planar mode selection information if the current block is encoded in the ISP mode and the current block is encoded in the planar mode. The decoder may generate a prediction block for the current block using the planar mode determined by parsing the planar mode selection information if the current block is encoded in the ISP mode and the current block is encoded in the planar mode.

[0313] A video signal processing device can replace the horizontal mode (angle mode 18 in FIG. 6) among conventional intra prediction directional modes with the horizontal plane mode. In addition, the video signal processing device can replace the vertical mode (angle mode 50 in FIG. 6) among conventional intra prediction directional modes with the vertical plane mode. In other words, the video signal processing device can use the horizontal plane mode and the vertical plane mode instead of the horizontal mode (angle mode 18 in FIG. 6) and the vertical mode (angle mode 50 in FIG. 6) among conventional intra prediction directional modes. At this time, the video signal processing device can replace the horizontal mode (angle mode 18 in FIG. 6) and the vertical mode (angle mode 50 in FIG. 6) among conventional intra prediction directional modes with the horizontal plane mode and the vertical plane mode only when the horizontal size and the vertical size of the current block are different.

[0314] The vertical planar mode and the horizontal planar mode can be effective for small blocks. Therefore, the video signal processing device can apply the vertical planar mode and the horizontal planar mode only when the size of the current block is smaller than a certain size. At this time, the certain size may be 16 or 32 in width or height. That is, the video signal processing device can apply the vertical planar mode and the horizontal planar mode to the current block when the width or height of the current block is less than or equal to 32. Alternatively, the video signal processing device may not apply the vertical planar mode and the horizontal planar mode to the current block when either the width or height of the current block is greater than 32. For example, the encoder may not include planar mode selection information in the bitstream when either the width or height of the current block is greater than 32. The decoder may perform prediction of the current block using the conventional planar mode without parsing the planar mode selection information when the encoding mode of the current block is the planar mode and either the width or height of the current block is greater than 32.

[0315] DIMD and TIMD modes are modes that generate a predicted block by weighting blocks predicted from various intra prediction modes. At this time, a block predicted using the planar mode can be used for the DIMD and TIMD modes. When a video signal processing device generates a predicted block using the planar mode used in the DIMD and TIMD modes, any one of a vertical planar mode, a horizontal planar mode, and a conventional planar mode can be used. Planar mode selection information can be signaled by being included in a bitstream. A decoder can parse the planar mode selection information to determine which of the three planar modes to use. For example, if the planar mode selection information indicates a vertical planar mode, a prediction block used in the DIMD and TIMD modes can be a block predicted using the vertical planar mode.

[0316] MIP mode can be an effective mode for complex areas. To improve the encoding performance of MIP mode, multi-prediction-based MIP mode can be used. That is, multi-prediction-based MIP mode is a method of generating a final prediction block for the current block by weighting and averaging a prediction block generated by the MIP method and a prediction block generated based on an intra-prediction directional mode. An encoder can generate and signal a bitstream that includes both encoding information for the MIP mode and encoding information for the intra-prediction directional mode. A decoder can parse both encoding information for the MIP mode and encoding information for the intra-prediction directional mode to generate a prediction block to which the MIP mode is applied and a prediction block to which the intra-prediction directional mode is applied, and then generate a final prediction block for the current block by weighting and averaging the two prediction blocks.

[0317] MIP mode can be adaptively implemented on a block-by-block basis. The encoder can generate and signal a bitstream that includes information on whether a multi-prediction-based MIP mode is used. The decoder can parse the information on whether a multi-prediction-based MIP mode is used to determine whether a multi-prediction-based MIP mode or a single-prediction-based MIP mode is used when generating a prediction block for the current block. A single-prediction-based MIP mode is a method of generating a prediction block using only a MIP mode.

[0318] In order to reduce complexity and signaled encoding information, the encoder may additionally include and signal in the bitstream information about whether a multi-prediction-based MIP mode is used when the intra-prediction mode of the current block is MIP. The encoder may additionally include and signal in the bitstream information about an intra-prediction directional mode when the multi-prediction-based MIP mode is used for the current block. The decoder may additionally parse information about whether a multi-prediction-based MIP mode is used when the intra-prediction mode of the current block is MIP, and additionally parse information about an intra-prediction directional mode when the multi-prediction-based MIP mode is used.

[0319] If an intra prediction directional mode is additionally signaled, the bit rate may increase and the compression efficiency may decrease. If a multi-prediction-based MIP mode is used for the current block, only an arbitrary determined intra prediction directional mode may be used. In this case, the arbitrary determined intra prediction directional mode may be one of the MPM list, and the encoder may signal the bitstream by including index information for the intra prediction directional mode to be used in the multi-prediction-based MIP mode among the MPM list. If a multi-prediction-based MIP mode is used for the current block, the decoder may parse the index information to determine an intra prediction directional mode to be used in the multi-prediction-based MIP mode among the MPM list.

[0320] When a multi-prediction-based MIP mode is used for the current block, a vertical planar mode, a horizontal planar mode, and a conventional planar mode can be used to generate a prediction block based on an intra-prediction directional mode. That is, the encoder can generate and signal a bitstream including planar mode selection information. When a multi-prediction-based MIP mode is used for the current block, the decoder can parse the planar mode selection information to determine an intra-prediction directional mode to be used in the multi-prediction-based MIP mode.

[0321] When the multi-prediction-based MIP mode is used for the current block, the video signal processing device can determine which of the three planar modes to use by using the intra-prediction directional mode of the DIMD derived from the surrounding pixels of the current block. For example, when the multi-prediction-based MIP mode is used for the current block, the video signal processing device can apply the horizontal planar mode to the current block to generate a prediction block based on the intra-prediction directional mode if the DIMD (or TIMD) mode of the current block is less than 34. Alternatively, when the DIMD (or TIMD) mode of the current block is equal to or greater than 34, the vertical planar mode can be applied to the current block to generate a prediction block based on the intra-prediction directional mode.

[0322] The video signal processing device may, when a planar mode is used for a current block, generate prediction blocks for each mode using the vertical planar mode and the horizontal planar mode, and apply weights to each prediction block to generate a final prediction block. At this time, the weights for each prediction block may be the same or different depending on the intra-prediction directional mode of the DIMD derived from the surrounding pixels of the current block. If the intra-prediction directional mode of the DIMD derived from the surrounding pixels of the current block is greater than or equal to a predetermined value, the largest weight may be applied to the block predicted using the vertical planar mode. For example, the weight for the block predicted using the vertical planar mode may be 3, and the weight for the block predicted using the horizontal planar mode may be 1. If the intra-prediction directional mode of the DIMD derived from the surrounding pixels of the current block is less than a predetermined value, the largest weight may be applied to the block predicted using the horizontal planar mode. For example, a weight for a block predicted using a horizontal plane mode may be 3, and a weight for a block predicted using a vertical plane mode may be 1. Any value may be an integer, such as 34 (angle mode 34 in FIG. 6). DIMD information derived from the surrounding pixels of the current block may include information on a first intra prediction directional mode, a second intra prediction directional mode, and whether to perform weighted prediction. If weighted prediction is not performed among the DIMD information of the surrounding pixels of the current block, the video signal processing device may generate a prediction block by applying the same weight.

[0323] When the CIIP mode is used to generate a prediction block of the current block, the prediction block of the current block can be generated by weighting the prediction block using the intra prediction mode (intra prediction block) and the prediction block using the inter prediction mode (inter prediction block). At this time, when the intra prediction directional mode used to generate the intra prediction block in the CIIP mode is a planar mode, the encoder can generate and signal a bitstream including planar mode selection information. When the CIIP mode is used and the planar mode is used, the decoder can parse the planar mode selection information to determine the intra prediction mode used to generate the intra prediction block.

[0324] When the current block is predicted using an intra prediction mode, the continuity of pixel values ​​at the boundary between the current block and neighboring blocks may be discontinuous. To resolve this discontinuity, Position-dependent intra prediction combination (PDPC) filtering may be applied to the generated prediction block. When the vertical planar mode is used to generate the prediction block of the current block, PDPC filtering based on the planar mode may not be performed, but PDPC filtering based on the horizontal angle mode (e.g., the 18-degree angle mode in FIG. 6) may be performed. Alternatively, when the vertical planar mode is used to generate the prediction block of the current block, PDPC filtering based on the planar mode may not be performed, but PDPC filtering based on the vertical angle mode (e.g., the 50-degree angle mode in FIG. 6) may be performed. In addition, when the horizontal planar mode is used to generate the prediction block of the current block, PDPC filtering based on the planar mode may not be performed, but PDPC filtering based on the vertical angle mode (e.g., the 50-degree angle mode in FIG. 6) may be performed. Additionally, when a horizontal plane mode is used to generate a prediction block of the current block, PDPC filtering based on the plane mode may not be performed, but PDPC filtering based on the horizontal angle mode (e.g., angle mode 18 of FIG. 6) may be performed. In this specification, the meaning that the current block is predicted may be the same as the meaning that the prediction block of the current block is generated.

[0325] Referring to FIG. 33 and Equation 4, when the vertical planar mode is used to generate the prediction block of the current block, the prediction block of the current block can be generated based on the pixel value of rec(-1, H), which is a fixed position, and the pixel value of rec(x, -1) that changes dynamically according to the x-axis coordinate. Similarly, referring to FIG. 33 and Equation 5, when the horizontal planar mode is used to generate the prediction block of the current block, the prediction block of the current block can be generated based on the pixel value of rec(W, -1), which is a fixed position, and the pixel value of rec(-1, y) that changes dynamically according to the y-axis coordinate. That is, since the prediction block can be generated so that the continuity of the pixel value is maintained at the boundary between the neighboring blocks, when the prediction block of the current block is generated using the vertical planar mode or the horizontal planar mode, PDPC may not be performed.

[0326] The PDPC filtering for the above-described planar mode can also be applied when the current block is encoded in CIIP mode.

[0327] When a video signal processing device constructs an MPM list for a current block, if a neighboring block adjacent to the current block is predicted in a vertical planar mode or a horizontal planar mode, the video signal processing device may set the intra prediction directionality of the neighboring block to the planar mode and include the block in the MPM list. Alternatively, when the video signal processing device constructs an MPM list for a current block, if a neighboring block adjacent to the current block is predicted in a vertical planar mode or a horizontal planar mode, the video signal processing device may set the intra prediction directionality of the neighboring block to the DC mode and include the block in the MPM list. Alternatively, when the video signal processing device constructs an MPM list for a current block, if a neighboring block adjacent to the current block is predicted in a horizontal planar mode, the video signal processing device may set the intra prediction directionality of the neighboring block to the horizontal angle mode (angle mode 18 in FIG. 6) and include the block in the MPM list. Alternatively, when the video signal processing device constructs an MPM list for the current block, if a neighboring block adjacent to the current block is predicted in a vertical plane mode, the intra prediction directionality mode of the neighboring block may be set to the vertical angle mode (angle mode 50 in FIG. 6) and included in the MPM list. Conversely, since the horizontal plane mode may have a vertical characteristic, when the video signal processing device constructs an MPM list for the current block, if a neighboring block adjacent to the current block is predicted in a horizontal plane mode, the video signal processing device may set the intra prediction directionality mode of the neighboring block to the vertical angle mode (angle mode 50 in FIG. 6) and include it in the MPM list. Alternatively, when the video signal processing device constructs an MPM list for the current block, if a neighboring block adjacent to the current block is predicted in a vertical plane mode, the video signal processing device may set the intra prediction directionality mode of the neighboring block to the horizontal angle mode (angle mode 18 in FIG. 6) and include it in the MPM list.

[0328] The vertical plane mode and horizontal plane mode proposed in this specification are not signaled as any specific mode, but can be signaled as included in any one of the intra prediction directional modes. Referring to Fig. 6, there are a total of 67 intra prediction directional modes, among which 0 (plane mode) and 1 (DC mode) are non-directional modes, and 2 to 66 are directional modes (angular modes). The intra prediction directional modes can be extended, including the newly defined vertical plane mode and horizontal plane mode. For example, in the existing intra prediction directional mode, mode 2 can be set as the vertical plane mode, and mode 3 can be set as the horizontal plane mode. That is, modes 0 (plane mode), 1 (DC mode), 2 (vertical plane mode), and 3 (horizontal plane mode) can be set as non-directional modes, and modes 4 to 68 can be set to be the same as the existing directional modes 2 to 66.

[0329] In the first transform, the MTS transform, the transform is calculated by applying the transform kernel to the vertical and horizontal directions of the error block respectively, so it can be said to be a separable transform method. On the other hand, in the second transform, the LFNST transform described above, the transform is calculated by applying the transform kernel only once without applying the transform kernel to the vertical and horizontal directions respectively, so it can be said to be a non-separable transform method. In addition, since the second transform described above is additionally applied to the first transformed transform coefficients of the block to which the DCT-2 transform is applied, it can be said to be a two-step transform technique. The second transform described above has high encoding efficiency, but it has the disadvantage of being complex because the transform kernel is applied a total of three times. To reduce this complexity, the NSPT (Non-separable primary transform) method, which is a method of applying the transform only with the second transform method, can be applied. The NSPT transform method is a non-separable transform method, and is calculated by applying the transform kernel only once to the vertical and horizontal directions of the error block, without applying the transform kernel separately. In a video signal processing device, the error block of the current block can be transformed or inversely transformed using one of the following transform methods: MTS, DCT2 + LFNST, or NSPT transform.

[0330] Figure 34 shows a transformation set table for LFNST and NSPT transformations according to one embodiment of the present invention.

[0331] There can be 35 transform sets used in LFNST and NSPT transforms, and they can vary depending on the intra prediction mode (see FIG. 6). That is, the video signal processing device can derive the transform set index of the LFNST and NSPT transforms corresponding to the intra prediction mode (see FIG. 6) by referring to the transform set table of FIG. 50. In addition, the LFNST and NSPT transform sets can vary depending on the intra prediction mode, information on whether the current block is a luminance block or a chrominance block, the horizontal and vertical sizes of the current block, and whether the intra prediction directional mode of the current block is an extended angle mode. There can be an arbitrary number of transform matrices for each transform set. Here, the arbitrary number can be an integer greater than or equal to 1, and can be 3. The encoder can signal the index information for the optimal transform matrix among multiple transform matrices in the transform set by including it in the bitstream. After the decoder parses the index for the optimal transformation matrix, it can apply the inverse transformation using the transformation matrix corresponding to the index in the transformation set.

[0332] The video signal processing device can apply three types of transform kernels, LFNST4, LFNST8, and LFNST16, depending on the size of the transform block. If the width and height of the current block (e.g., transform block) are greater than or equal to 16, the video signal processing device can apply the LFNST16 transform kernel to the current block. If the width and height of the current block are greater than or equal to 8 and less than 16, the video signal processing device can apply the LFNST8 transform kernel to the current block. If the width and height of the current block are less than 8, the video signal processing device can apply the LFNST4 transform kernel to the current block.

[0333] Figure 35 shows a low frequency region of a current block according to one embodiment of the present invention.

[0334] Referring to Fig. 35, the gray area may be a low-frequency area after LFNST conversion, and the gray area may be described as a Region of Interest (ROI). A portion other than a pre-designated ROI may be zeroed out. In the case of LFNST16, since only 96 samples are required, the remaining white sub-blocks except for 6 sub-blocks (gray areas) as in Fig. 35(a) may be zeroed out. In the case of LFNST8, since only 64 samples are required, the remaining white sub-blocks except for 4 sub-blocks (gray areas) as in Fig. 35(b) may be zeroed out. Finally, in the case of LFNST4, zeroing out may be performed. Here, the size of the sub-blocks in Fig. 35 may be N x N, where N is a positive integer, such as 4.

[0335] NSPT transform can be a transform method that replaces the existing DCT2 + LFNST transform method. For blocks whose size is equal to or smaller than 16x16, one of the following kernels can be applied depending on the size of the transform block: NSPT4x4 (16x16 kernel), NSPT4x8 (32x20 kernel), NSPT8x4 (32x20 kernel), NSPT8x8 (64x32 kernel), NSPT4x16 (64x24 kernel), NSPT16x4 (64x24 kernel), NSPT8x16 (128x40 kernel), NSPT16x8 (128x40 kernel), NSPT4x32 (128x20 kernel), NSPT32x4 (128x20 kernel), NSPT8x32 (256x24 kernel), NSPT32x8 (256x24 kernel). NSPT, similar to LFNST, consists of 35 sets of transform kernels, each of which can be composed of three candidates. The encoder can derive a set of transform kernels according to the intra prediction mode, and then generate and signal a bitstream containing information about the index of the optimal candidate among the three candidates. The decoder can parse the information about the signaled index, and then use the transform kernel candidate indicated by the index information among the set of transform kernels derived using the intra prediction mode to inversely transform the current transform coefficients and obtain a residual block.

[0336] Zero-out may not be performed on a 4x4 block to which NSPT is applied. Furthermore, the number of coefficients zeroed out may vary depending on the size of the NSPT kernel. For example, a 32x20 sized NSPT may be applied to a 4x8 block or an 8x4 block. Therefore, out of the 32 transform coefficients, only 20 of them may be zeroed out, leaving the remaining 12.

[0337] Figure 36 illustrates a method for deriving a multi-transform set and an LFNST / NSPT set according to one embodiment of the present invention.

[0338] Referring to Fig. 36(a), the encoder can select which one of MTS, DCT2 + LFNST, and NSPT to apply to the residual block, and can transform the residual block and obtain transform coefficients based on the selected transform method. At this time, the encoder can signal information on which transform method was applied by including it in the bitstream. If the MTS transform is applied to the residual block, the transform coefficients of the residual block can be obtained by applying the MTS transform, and LFNST and NSPT transforms may not be applied. If the DCT2 + LFNST transform is applied to the residual block, the encoder can apply the DCT2 transform to the residual block to obtain the first transform coefficients, and apply the LFNST transform to the first transform coefficients to obtain the second transform coefficients. At this time, the MTS and NSPT transforms may not be applied. When the NSPT transform is applied to the residual block, the video encoder can output transform coefficients by applying the NSPT transform to the residual block, and at this time, the MTS and DCT2 + LFNST transforms may not be applied to the residual block.

[0339] Referring to Fig. 36(b), the decoder can parse information on which transform method was applied from the bitstream, and determine whether to apply one of the inverse transform methods among MTS, DCT2 + LFNST, and NSPT to the current transform coefficient based on the parsed information. Then, the decoder can perform an inverse transform on the transform coefficient based on the determined transform method and obtain a residual block. If the MTS transform is applied to the current transform coefficient, the decoder can perform an inverse MTS transform on the transform coefficient to obtain a residual block, and at this time, the LFNST and NSPT inverse transforms may not be applied. If the DCT2 + LFNST transform is applied to the secondary transform coefficient, the decoder can perform an inverse LFNST transform on the secondary transform coefficient to output a primary transform coefficient, and perform an inverse DCT2 transform on the primary transform coefficient to obtain a residual block, and at this time, the MTS and NSPT transforms may not be applied. If the NSPT transform is applied to the current transform coefficients, the decoder can obtain a residual block by performing the NSPT inverse transform on the current transform coefficients, and at this time, the MTS and DCT2 + LFNST transforms may not be applied.

[0340] A video signal processing device can derive a transform kernel for each of MTS, LFNST, and NSPT transforms (or inverse transforms) using an intra prediction mode. In addition, the video signal processing device can determine which transform (or inverse transform) is applied among MTS, DCT2 + LFNST, and NSPT. At this time, in order to determine the transform, at least one or more of the horizontal and vertical sizes of the current block, whether the components of the current block are luminance components or chrominance components, whether the current block is a single tree or a dual tree, information on whether the current block is encoded in intra mode or inter mode, information on the encoding mode of the current block (e.g., IBC, Intra TMP, Merge, AMVP, GPM, SGPM, CCLM, CCCM), and information on the quantization parameters of the current block may be used.

[0341] FIG. 37 illustrates a method for deriving a multi-transform set and an LFNST set for a vertical direction planar mode or a horizontal direction planar mode according to one embodiment of the present invention.

[0342] Figure 38 shows a mapping table according to one embodiment of the present invention.

[0343] Figure 39 shows a conversion type set table according to one embodiment of the present invention.

[0344] Figure 40 shows a conversion type combination table according to one embodiment of the present invention.

[0345] Figure 41 shows a threshold value table for an IDT conversion type according to one embodiment of the present invention.

[0346] When the vertical planar mode is used to generate the prediction block of the current block, the characteristics of the error (residual) signal (block) may be similar to the characteristics of the error signal of the vertical angular mode (the 50-degree angular mode in Fig. 6). The multiple transform set (MTS) applied to the error signal may vary based on the intra prediction directional mode of the current block. That is, when the vertical planar mode is used to generate the prediction block of the current block, the encoder may perform the primary transformation process based on the multiple transform set using the set of transformation matrices of the vertical angular mode (the 50-degree angular mode in Fig. 6) instead of using the set of transformation matrices of the planar mode for the error signal. Alternatively, the encoder may perform the primary transformation using a predetermined transformation set regardless of the multiple transform set. In addition, the encoder may perform a secondary transformation through LFNST on the primary transformed transform coefficients using the multiple transform set or the predetermined transformation set. The transformation matrix used when performing LFNST may vary depending on the intra prediction directional mode. That is, when the vertical planar mode is used to generate the prediction block of the current block, the encoder may perform the transformation process using the set of secondary LFNST transformation matrices of the vertical angular mode (angle mode 50 in FIG. 6) instead of the set of secondary LFNST transformation matrices for the planar mode for the error signal. When the horizontal planar mode is used to generate the prediction block of the current block, the encoder may derive the primary or secondary transformation matrix (or set of matrices, set of matrices, set of kernels) using the horizontal angular mode (angle mode 18 in FIG. 6) instead of the planar mode.When the vertical planar mode is used to generate a prediction block of the current block, the decoder may perform a transformation process using a set of first LFNST transformation matrices of the vertical angular mode (the 50-degree angular mode in FIG. 6) instead of a set of first LFNST transformation matrices for the planar mode for the error signal. In addition, when the vertical planar mode is used to generate a prediction block of the current block, the decoder may perform a second transformation process based on a multi-transform set using a set of transformation matrices of the vertical angular mode (the 50-degree angular mode in FIG. 6) instead of a set of transformation matrices for the planar mode for the error signal. In the present specification, the encoder may perform a second transformation after performing a first transformation in the encoding process, which correspond to the first transformation and the second transformation in the decoding process of the decoder, respectively. That is, the first transformation performed by the encoder corresponds to the second transformation performed by the decoder (the inverse transformation of the first transformation performed by the encoder), and the second transformation performed by the encoder corresponds to the first transformation performed by the decoder (the inverse transformation of the second transformation performed by the encoder).

[0347] Referring to Fig. 33 and Equation 4, when the vertical planar mode is used to generate the prediction block of the current block, the prediction block can be generated based on the pixel value of rec(-1, H), which is a fixed position, and the pixel value of rec(x, -1) that changes dynamically according to the x-axis coordinate. That is, when the vertical planar mode is used, since the pixel value changes in the x-axis, the characteristics of the error signal can be similar to the characteristics of the error signal of the horizontal angle mode (angle mode 50 in Fig. 6). The multiple transformation set applied to the error signal can vary based on the intra prediction directional mode of the current block. That is, when the vertical planar mode is used to generate the prediction block of the current block, the encoder can perform the first transformation process based on the multiple transformation set by using the set of transformation matrices of the horizontal angle mode (angle mode 18 in Fig. 6) instead of the set of transformation matrices of the planar mode for the error signal. Alternatively, the encoder can perform the primary transform using a predetermined transform set regardless of the multiple transform set. In addition, the encoder can perform the secondary transform through LFNST on the primary transformed transform coefficients using the multiple transform set or the predetermined transform set. The transform matrix used when performing LFNST may vary depending on the intra prediction directional mode. That is, if the prediction block of the current block is generated using the vertical planar mode, the encoder can perform the transform process using the set of secondary LFNST transform matrices of the horizontal angular mode (the 18th angular mode in FIG. 6) instead of the set of secondary LFNST transform matrices for the planar mode for the error signal. If the prediction block of the current block is generated using the horizontal planar mode, the encoder can derive the primary or secondary transform matrix (or the set of matrices, the set of matrices, the set of kernels) using the vertical angular mode (for example, the 50th angular mode in FIG. 6) instead of the planar mode.When the vertical planar mode is used to generate the prediction block of the current block, the decoder can perform the transformation process using the set of first LFNST transformation matrices of the horizontal angular mode (angle mode 18 in FIG. 6) instead of the set of first LFNST transformation matrices for the planar mode for the error signal. In addition, when the vertical planar mode is used to generate the prediction block of the current block, the decoder can perform the second transformation process based on the multi-transform set using the set of transformation matrices of the horizontal angular mode (angle mode 18 in FIG. 6) instead of the set of transformation matrices of the planar mode for the error signal. When the horizontal planar mode is used to generate the prediction mode of the current block, the encoder can derive the first or second transformation matrix (or the set of matrices, the set of matrices, the set of kernels) using the vertical angular mode (angle mode 50 in FIG. 6) instead of the planar mode. When the horizontal planar mode is used to generate the prediction block of the current block, the decoder can perform the transformation process using the set of first LFNST transformation matrices for the vertical angular mode (the 50-degree angular mode in Fig. 6) instead of using the set of first LFNST transformation matrices for the planar mode for the error signal. In addition, when the horizontal planar mode is used to generate the prediction block of the current block, the decoder can perform the secondary transformation process based on the multiple transformation set using the set of transformation matrices for the vertical angular mode (the 50-degree angular mode in Fig. 6) instead of using the set of transformation matrices for the planar mode for the error signal.

[0348] A method for selecting a set of multiple transforms available for a current block in a video signal processing device is described when a prediction block of a current block is generated using a vertical planar mode, a horizontal planar mode, or a conventional planar mode.

[0349] 1) First, the video signal processing device can derive the nSzIdxW and nSzIdxH values ​​based on the size of the current block to map the horizontal and vertical sizes of the current block into a single variable. nSzIdxW can be the minimum value among the logarithm of 2 calculated for the width of the current block, the difference of 2 with the decimal places discarded, and the three. nSzIdxH can be the minimum value among the logarithm of 2 calculated for the height of the current block, the difference of 2 with the decimal places discarded, and the three.

[0350] 2) Next, the video signal processing device can derive the intra-directional mode (predMode) of the current block. In the case of TIMD mode, the number of intra-prediction modes expanded from the existing 67 to 131 can be used, reducing the precision of the existing 67 modes.

[0351] 3) Next, the video signal processing device can derive the ucMode, nMdIdx, and isTrTransposed values.

[0352] A. If the current block is encoded in MIP mode, ucMode can be set to '0', nMdIdx can be set to '35', and isTrTransposed can be set to a value derived from MIP.

[0353] B. If the current block is not encoded in MIP mode, ucMode may be set to the intra directional mode (predMode) of the current block. predMode may mean an index value of the intra directional mode. predMode may be determined through an extended angle mode according to the aspect ratio of the current block. The video signal processing device may clip predMode to a value between 2 and 66. If the prediction block of the current block is generated using the vertical plane mode, the video signal processing device may reset predMode to the horizontal prediction mode (angle mode 18 in FIG. 6). If the prediction block of the current block is generated using the horizontal plane mode, the video signal processing device may reset predMode to the vertical prediction mode (angle mode 50 in FIG. 6). When predMode is greater than the 34th angular mode, which is a diagonal mode, the isTrTransposed value can be set to 1, and when predMode is equal to or less than 34, the isTrTransposed value can be set to 0. When predMode is greater than 34, the video signal processing device resets the value of predMode to a value that is a difference of 67 (the maximum value of the intra directional mode index) plus 1. For example, when predMode is 35, the video signal processing device can reset the 35th angular mode to the 33rd angular mode (67+1-35(predMode)). When predMode is 66, the video signal processing device can reset the 66th angular mode to the 2nd angular mode (67+1-66(predMode)). That is, by making it symmetrical with respect to the 34th angular mode, which is a diagonal mode, the size of the transformation mapping table of FIG. 35 is reduced by about half.

[0354] 4) The video signal processing device can derive the nSzIdx value through nSzIdxW, nSzIdxH, and isTrTransposed values. If the isTrTransposed value is '1', the value obtained by multiplying nSzIdxH by 4 and then adding nSzIdxW can be set to nSzIdx. If the isTrTransposed value is '0', the value obtained by multiplying nSzIdxW by 4 and then adding nSzIdxH can be set to nSzIdx.

[0355] 5) The video signal processing device can derive nTrSet, which is an index of an available transformation type set, according to the predefined table of FIG. 38 using nSzIdx, which is the size information of the current block, and nMdIdx, which is the intra-directional mode information of the current block. FIG. 38 defines an index of a transformation type set according to the intra-screen directional mode (0 to 34 and MIP) of the current block and the size index (0 to 15) of the current block. Referring to FIG. 38, nTrSet can be 80, and if the size of the current block is 4x8 and the intra-screen directional mode of the current block is 13, nTrSet can be '7'.

[0356] 6) The video signal processing device can derive a set of transformation types corresponding to nTrSet from the table of FIG. 39 by parsing mts_idx included in the bitstream. The transformation types in the vertical and horizontal directions are set differently depending on whether predMode is a value greater than the 34th angle mode, which is a diagonal mode. 0 to 79 in the gray-shaded vertical columns of FIG. 39 may correspond to nTrSet, and 0 to 3 in the gray-shaded horizontal columns may correspond to mts_idx. Referring to FIG. 36, if nTrSet is 7 and the value of mts_idx is 3, 22 may be selected from (2, 17, 18, 22). In addition, DST1 and DCT5 corresponding to index 22 of the transformation type combination table of FIG. 40 are selected, and the vertical transformation type of the current block may be set to DST1 and the horizontal transformation type may be set to DCT5. The gray-shaded horizontal rows 0 to 24 in Fig. 40 represent indices selected through Fig. 39, and the gray-shaded vertical rows 0 to 1 may represent vertical and horizontal transformation types, respectively. If the predicted directionality mode within the screen of the current block is greater than 34, which is a diagonal mode, the vertical and horizontal transformation types may be interchanged.

[0357] If the mts_idx value is '3' and the width and height of the current block are both 16 or less, the vertical or horizontal transformation type can be reset to the IDT transformation type through the process described below.

[0358] If the absolute difference between the index of the predicted directionality mode within the screen of the current block and the index of the horizontal direction mode, 18, is less than a predetermined value, the vertical transformation type may be reset to the IDT transformation type. If the absolute difference between the index of the predicted directionality mode within the screen of the current block and the index of the horizontal direction mode, 50, is less than a predetermined value, the horizontal transformation type may be reset to the IDT transformation type. At this time, the predetermined value may be an integer and may be determined based on the horizontal or vertical size of the current block. For example, the predetermined value may be determined through the table of Fig. 38. The table of Fig. 41(a) shows a case where the threshold value is set differently whenever the horizontal or vertical size differs by 4, and the table of Fig. 41(b) shows a case where the threshold value is set differently whenever the horizontal or vertical size differs by 2 times. If the size of the current block is 16x16, the vertical transformation type may not be reset to the IDT transformation type, but the existing transformation type may be maintained as is.

[0359] To reduce the bit count for encoding mts_idx, the number of transform type sets can be adaptively changed for each block. The number of transform type sets can be adaptively determined based on the sum of the absolute values ​​of the transform coefficients of the current transform block. For example, the number of transform type sets can be adaptively determined to be 1, 4, or 6. When the number of transform type sets is different, the maximum number of bins (bin_) for signaling mts_idx may be different. If the sum of the absolute values ​​of the transform coefficients is less than or equal to 6, the number of transform type sets may be one. Therefore, if the sum of the absolute values ​​of the transform coefficients is less than or equal to 6, the encoder may not include mts_idx in the bitstream (i.e., may not signal it), and the decoder may not parse mts_idx. If the sum of the absolute values ​​of the transform coefficients is greater than 6 and less than or equal to 32, the number of transform type sets may be four, and if the sum of the absolute values ​​of the transform coefficients is greater than 32, the number of transform type sets may be six. Transform Kernel In this case, when the number of transform type sets is multiple (e.g., 4 or 6), the encoder may generate and signal a bitstream including mts_idx based on the maximum number of transform type sets, The decoder can parse mts_idx based on the maximum number of transformation type sets, where the transformation type sets can be used in the same sense as transformation kernel candidates.

[0360] If the current block is encoded in inter mode, the transform kernel set for the current block can be any one of four combinations of transform kernel sets. The four combinations can be {(DST7, DST7), (DST7, DCT8), (DCT8, DST7), (DCT8, DCT8)}. The encoder can signal an index indicating the transform kernel set used among the four combinations by including it in the bitstream. The decoder can parse the index to determine the transform kernel set for the current block. For example, if the determined transform kernel set is (DST7, DCT8), DST7 can be applied to the current block in the horizontal direction and DCT8 can be applied to the vertical direction to perform transform / inverse transform. In addition, for complexity optimization, for images larger than 1920x1080 resolution, the maximum CU size to which inter MTS can be applied can be set to 32x32. For resolutions other than 1920x1080, the maximum CU size for which inter-MTS can be applied can be 16x16. Therefore, if the current block size is larger than 32x32 or 16x16, inter-MTS may not be applied to the current block, and DCT2 transform may be applied in the horizontal and vertical directions. In addition, the transform kernels DST7 and DCT8 for the current block size equal to or smaller than 16x16 may be replaced with a separable KLT (Karhunen-Loeve Transform).

[0361] Figure 42 shows block boundaries and samples around the boundaries in a deblocking filtering process according to one embodiment of the present invention.

[0362] Referring to Figure 42(a), the part indicated by the dotted line between the P block and the Q block may denote a block boundary. The block boundary may exist at any fixed size, and a block boundary may exist at every size of 4.

[0363] Figure 42(b) shows samples for which filtering is performed based on block boundaries. The video signal processing device may perform a process of alleviating blocking artifacts occurring at block boundaries by performing deblocking filtering on the currently restored block. The deblocking filtering process may include a process of determining a transform block boundary, determining a sub-block boundary, determining a length of a filter to perform filtering, determining a filtering strength (bS), determining a filtering parameter, determining whether to perform filtering, and determining a filtering type.

[0364] FIG. 43 illustrates a method for a video signal processing device according to one embodiment of the present invention to derive a first or second transformation matrix.

[0365] Specifically, FIG. 43 illustrates a flowchart of a method for a video signal processing device to derive a first or second transformation matrix (a set of matrices, a set of matrices, a set of kernels) when the current block is predicted using a vertical planar mode, a horizontal planar mode, or a conventional planar mode.

[0366] Referring to FIG. 43, a video signal processing device can receive an intra prediction mode and determine whether the prediction mode of a current block is a planar mode. If the prediction mode is not a planar mode, the video signal processing device can derive a first or second transformation matrix (a set of matrices, a set of matrices, a set of kernels) based on the input intra prediction directional mode. If the prediction mode is a planar mode, the video signal processing device can determine whether the prediction mode is a vertical planar mode. If the prediction mode is a vertical planar mode, the video signal processing device can derive a first or second transformation matrix (a set of matrices, a set of matrices, a set of kernels) based on a horizontal angle mode (angle mode 18 of FIG. 6). If the prediction mode is not a vertical planar mode, the video signal processing device can determine whether the prediction mode is a horizontal planar mode. When the prediction mode is a horizontal planar mode, the video signal processing device can derive a first or second transformation matrix (a set of matrices, a set of matrices, a set of kernels) based on a vertical angle mode (a 50-degree angle mode in FIG. 6). When the prediction mode is not a horizontal planar mode, the video signal processing device can derive a first or second transformation matrix (a set of matrices, a set of matrices, a set of kernels) based on a conventional planar mode.

[0367] When a prediction block of a current block is generated by using any one of a vertical planar mode, a horizontal planar mode, and a conventional planar mode, a video signal processing device can derive a first or second transformation matrix (a set of matrices, a set of matrices, a set of kernels) using an intra prediction directional mode derived using the DIMD method. In other words, when a prediction block of a current block is generated by using any one of a vertical planar mode, a horizontal planar mode, and a conventional planar mode, a video signal processing device can perform a first transformation process based on a multi-transform set using a set of transformation matrices of an intra prediction directional mode derived using the DIMD method. In addition, when a prediction block of a current block is generated by using any one of a vertical planar mode, a horizontal planar mode, and a conventional planar mode, a video signal processing device can perform a second transformation process based on LFNST using a set of transformation matrices of an intra prediction directional mode derived using the DIMD method. The DIMD information derived from the surrounding pixels of the current block may include the first intra prediction directional mode, the second intra prediction directional mode, and information on whether to perform weighted prediction. If weighted prediction is not applied among the DIMD information from the surrounding pixels of the current block in the encoder and decoder, the existing planar prediction mode can be used to derive the first or second transformation matrix (or a set of matrices, a set of matrices, or a set of kernels).

[0368] Since planar mode can be effective in smooth areas, in order to reduce complexity, the encoder can implicitly apply the DCT2 transform method without performing the first transform process based on the multi-transform set. The decoder can apply the DCT2 transform method if the current block is predicted in the planar mode. If the current block is predicted in the conventional planar mode, the video signal processing device can implicitly apply the DCT2 transform method without performing the first transform process based on the multi-transform set. If the current block is predicted in the vertical planar mode or the horizontal planar mode, the video signal processing device can apply the first transform process based on the multi-transform set. On the other hand, if the current block is predicted in the vertical planar mode or the horizontal planar mode, the video signal processing device can implicitly apply the DCT2 transform method without applying the first transform process based on the multi-transform set. If the current block is predicted in the conventional planar mode, the video signal processing device can apply the first transform process based on the multi-transform set. In addition, in the above-described method, if the size of the current block is an arbitrary size, the DST7 transformation method may be applied instead of the DCT2 transformation method. At this time, the arbitrary size may be a case where the horizontal or vertical size of the current block is greater than or equal to 4 or less than or equal to 16. For example, if the current block is predicted based on a vertical planar mode or a horizontal planar mode, and the horizontal size of the current block is 32 and the vertical size is 16, the video signal processing device may apply DCT2 for horizontal transformation and DST7 for vertical transformation.

[0369] Similar to the planar mode, the DC mode can also be classified into three prediction modes (three DC modes, three-directional DC prediction modes, or three DC prediction modes can be described interchangeably). Specifically, the DC mode can be classified into a mode based on the average between the upper pixels of the current block, the average between the left pixels of the current block, and the average between the upper and left pixels of the current block. If the horizontal size of the current block is greater than the vertical size, the video signal processing device can generate a prediction block of the current block using the average value between the upper pixels of the current block. If the vertical size of the current block is greater than the horizontal size, the video signal processing device can generate a prediction block of the current block using the average value between the left pixels of the current block. If the horizontal size and the vertical size of the current block are the same, the video signal processing device can generate a prediction block of the current block using the average value between the upper and left pixels. The encoder can explicitly signal which of the three DC prediction modes (i.e., the average between the above pixels of the current block, the average between the left pixels of the current block, and the average between the above and left pixels of the current block) is used. That is, the encoder can generate and signal a bitstream including information (DC mode selection information) on which of the three DC modes the current block was predicted based on. The method by which the encoder signals the DC mode selection information can be described as an explicit directional DC mode. The decoder can generate a prediction block for the current block based on the mode determined by parsing the DC mode selection information. The encoder can generate and signal a bitstream including information on which mode the current block was encoded in if the prediction mode of the current block is the DC mode.The decoder can parse the DC mode selection information to determine the final DC mode for the current block, if the prediction mode of the current block is DC mode. For example, if the current block is predicted in DC mode using the average between the left pixels, the encoder can signal that the current block is DC mode and signal that the current block is predicted using DC mode using the average between the left pixels using an additional flag bit. If the current block is in DC mode, the decoder can parse the additional flag bit to determine which mode is applied to the current block. The encoder can signal that the coding mode of the current block is DC mode. Alternatively, the decoder can use the MPM list to determine whether the coding mode of the current block is DC mode. Alternatively, the decoder can parse the information (syntax element) indicating whether the coding mode of the current block is DC mode using the MPM list. In this specification, among the three DC modes, the DC mode that uses the average between the upper pixels of the current block can be described as the Vertical DC mode or the above DC mode, and the DC mode that uses the average between the left pixels of the current block can be described as the Horizontal DC mode or the left DC mode.

[0370] The above three DC prediction modes may not be used in ISP mode. The encoder may not signal a flag bit indicating whether the current block is in DC mode using the average between left pixels or in DC mode using the average between top pixels, if the current block is encoded in ISP mode and the current block is encoded in DC mode. The decoder may not parse a flag bit indicating whether the current block is in DC mode using the average between left pixels or in DC mode using the average between top pixels, if the current block is in ISP mode and the current block is in DC mode.

[0371] Meanwhile, the above three DC prediction modes can be used in ISP mode. The encoder can signal a flag bit indicating which of the three DC prediction modes the prediction mode of the current block is, and include it in the bitstream, if the current block is encoded in ISP mode and the current block is encoded in DC mode. The decoder can parse the flag bit to set the final DC mode for the current block, if the current block is in ISP mode and the current block is in DC mode.

[0372] Whether to apply the above three DC prediction modes can be determined based on the color component of the current block. If the current block is a luminance component block, the above three DC prediction modes can be used. Alternatively, if the current block is a chrominance component block, only the DC prediction mode that uses the average between the upper and left pixels among the above three DC prediction modes can be used. Therefore, if the current block is a chrominance component block and the DC mode is applied, the encoder may not include a flag bit indicating which of the three DC modes is used in the bitstream. If the current block is a chrominance component block and the DC mode is applied, the decoder may not parse the flag bit indicating which of the three DC modes is used, and may set the DC mode for the current block to the DC prediction mode that uses the average between the upper and left pixels.

[0373] When the ISP mode is applied, the current block can be split horizontally or vertically. Depending on the horizontal or vertical size of the current block, one block can be split into two or four blocks. When the three planar modes or the three DC modes are used in a block encoded in the ISP mode, the prediction mode can be determined according to the partitioning shape of the block. If the current block is encoded in the ISP mode and the partitioning shape according to the ISP mode is horizontal partitioning, the horizontal planar mode among the three planar modes can be used. If the current block is encoded in the ISP mode and the partitioning shape according to the ISP mode is horizontal partitioning, the vertical planar mode among the three planar modes can be used. If the current block is encoded in the ISP mode and the partitioning shape according to the ISP mode is horizontal partitioning, the mode using the average between the left pixels among the three DC modes can be used. If the current block is encoded in ISP mode and the division type according to the ISP mode is horizontal division, a mode that uses the average between upper pixels among the three DC modes can be used.

[0374] The partitioning shape of the ISP mode can be determined based on the intra prediction directional mode derived from DIMD or the intra prediction directional mode derived from TIMD. If the DIMD (or TIMD) mode of the current block is less than 34, the ISP partitioning shape of the current block may be horizontal partitioning. If the DIMD (or TIMD) mode of the current block is equal to or greater than 34, the ISP partitioning shape of the current block may be vertical partitioning. Conversely, if the DIMD (or TIMD) mode of the current block is less than 34, the ISP partitioning shape of the current block may be vertical partitioning. If the DIMD (or TIMD) mode of the current block is equal to or greater than 34, the ISP partitioning shape of the current block may be horizontal partitioning. If the partition shape of the ISP mode is determined based on the intra prediction directional mode derived from DIMD (or TIMD), the partition shape is determined implicitly, so the encoder may not include information about the ISP partition shape in the bitstream, and the decoder may not parse information about the ISP partition shape.

[0375] The video signal processing device can use all three DC modes to generate prediction blocks for each mode, and can apply the same or different weights to each prediction block to generate a final prediction block through a weighted average. At this time, if the horizontal size of the current block is greater than the vertical size, the largest weight can be applied to the block predicted using the average between the upper pixels. Also, if the horizontal size of the current block is smaller than the vertical size, the largest weight can be applied to the block predicted using the average between the left pixels. Alternatively, if the intra-prediction directional mode of the DIMD derived from the surrounding pixels of the current block is greater than or equal to a certain value, the largest weight can be applied to the block predicted using the average between the upper pixels. If the intra-prediction directional mode of the DIMD derived from the surrounding pixels of the current block is less than a certain value, the largest weight can be applied to the block predicted using the average between the left pixels. Here, the arbitrary value can be an integer, and can be 34, which is the index of the diagonal mode (angle mode 34 in FIG. 6). The DIMD information derived from the surrounding pixels of the current block may include the first intra prediction directional mode, the second intra prediction directional mode, and information on whether to perform weighted prediction. If weighted prediction is not applied among the DIMD information derived from the surrounding pixels of the current block, the largest weight may be applied to the block predicted using the average of all pixels above and to the left.

[0376] When a prediction block is generated based on any one of the three DC prediction modes explicitly signaled by the encoder, the encoder can perform a transform on the error signal (residual signal) using a predetermined transform set, regardless of the multiple transform set. For example, when a prediction block is generated based on any one of the three DC prediction modes explicitly signaled by the encoder, the encoder can perform a transform process based on a multiple transform set (MTS) using the existing DC mode (or planar mode) on the error signal to obtain (output) transform coefficients. When a decoder explicitly uses any one of the three DC prediction modes to generate a prediction block of the current block, the decoder can perform an inverse transform on the transform coefficients using a predetermined transform set, regardless of the multiple transform set. For example, if the decoder explicitly uses any one of the three DC prediction modes to generate a prediction block of the current block, the decoder can perform an inverse transform based on MTS using the conventional DC mode (or planar mode) on the transform coefficients and obtain (output) an error signal.

[0377] Additionally, the encoder can perform a secondary transform on the primary transformed coefficients based on the MTS or a predetermined set of transforms. The secondary transform can be LFNST. The transform matrix used by the encoder when performing LFNST can vary depending on the intra prediction directional mode. For example, if the encoder explicitly uses any one of the three DC prediction modes to generate a prediction block of the current block, the primary transformed transform coefficients can be subjected to a secondary transform through LFNST. In this case, the encoder can perform the LFNST transform using the existing DC mode (or planar mode) and obtain (output) the secondary transform coefficients by performing the LFNST transform. Similarly, when the decoder performs an inverse transform using LFNST, the transform matrix used can vary depending on the intra prediction directional mode. For example, if the decoder explicitly uses one of the three DC prediction modes to generate the prediction block of the current block, the decoder can perform an LFNST inverse transform using the conventional DC mode (or planar mode) on the secondary transform coefficients to obtain (output) the primary transform coefficients. Then, the decoder can perform an inverse transform process based on a multiple transform set (MTS) using the conventional DC mode on the primary transform coefficients to obtain (output) the error signal.

[0378] When a video signal processing device explicitly uses one of three DC prediction modes to generate a prediction block of a current block, the video signal processing device may derive a first or second transformation matrix (or a set of matrices, a set of matrices, a set of kernels) using a mode other than the conventional DC prediction mode.

[0379] When the encoder generates a prediction block of the current block using the DC prediction mode that uses the average of the left pixel values ​​among the three DC prediction modes, the encoder can perform a first transformation process based on MTS using a set of transformation matrices of the horizontal angle mode (e.g., the 18th angle mode in FIG. 6) instead of using a set of transformation matrices of the existing DC prediction mode for the error signal, and can obtain a first transformation coefficient. In addition, the encoder can perform a transformation process using a set of secondary transformation (e.g., LFNST) matrices of the horizontal angle mode (e.g., the 18th angle mode in FIG. 6) instead of using a set of secondary transformation matrices of the existing DC prediction mode for the obtained first transformation coefficient, and can obtain a second transformation coefficient. When the decoder generates a prediction block of the current block using the DC mode that uses the average of the left pixel values ​​among the three DC prediction modes, the decoder can perform an inverse transformation process using a set of secondary transformation matrices of the horizontal angle mode (e.g., the 18th angle mode in FIG. 6) instead of a set of secondary transformation (e.g., LFNST) matrices of the existing DC prediction mode for the secondary transformation coefficients, and obtain a first transformation coefficient. In addition, the decoder can perform an inverse transformation process based on MTS using a set of transformation matrices of the horizontal angle mode (e.g., the 18th angle mode in FIG. 6) instead of a set of transformation matrices of the existing DC prediction mode for the primary transformation coefficients, and obtain an error signal.

[0380] When a prediction block of a current block is generated based on a DC mode that uses the average of upper pixel values ​​among three DC prediction modes, the decoder can perform an inverse transformation process using a set of secondary transformation (e.g., LFNST) matrices of a vertical angle mode (e.g., 50-degree angle mode in FIG. 6) and output a primary transformation coefficient. In addition, the decoder can perform an MTS-based inverse transformation process using a set of transformation matrices of a vertical angle mode (e.g., 50-degree angle mode in FIG. 6) without using a set of transformation matrices of an existing DC prediction mode for the primary transformation coefficient, and obtain an error signal.

[0381] When the prediction block of the current block is generated using the DC mode that uses the average of the upper pixel values ​​among the three DC prediction modes, the decoder can perform an inverse transformation process using a set of secondary transformation (e.g., LFNST) matrices of the horizontal angle mode (e.g., 18-angle mode in Fig. 6) and output a first transformation coefficient. In addition, the decoder can perform an inverse transformation process based on MTS using a set of transformation matrices of the horizontal angle mode (e.g., 18-angle mode in Fig. 6) without using a set of transformation matrices of the existing DC prediction mode for the first transformation coefficient, and obtain an error signal.

[0382] If the prediction block of the current block is generated using the DC mode that uses the average of the upper pixel values ​​among the three DC prediction modes, the video signal processing device can derive a first or second transformation matrix (a set of matrices, a set of matrices, a set of kernels) using the intra prediction directional mode derived using the DIMD method. In other words, if the prediction block of the current block is generated using the DC mode that uses the average of the upper pixel values ​​among the three DC prediction modes, the video signal processing device can perform a transformation process or an inverse transformation process based on MTS using the set of transformation matrices of the intra prediction directional mode derived using the DIMD method. In addition, if the prediction block of the current block is generated using the DC mode that uses the average of the upper pixel values ​​among the three DC prediction modes, the video signal processing device can perform a transformation process or an inverse transformation process based on LFNST using the set of transformation matrices of the intra prediction directional mode derived using the DIMD method.

[0383] When a prediction block of a current block is generated by explicitly using any one of the three DC prediction modes, the video signal processing device may use any one of the IDTR and MTS-based transformations for the horizontal or vertical transformation.

[0384] If the encoder explicitly uses any one of the three DC prediction modes to generate a prediction block of the current block, the encoder can obtain a transform coefficient by performing a transform using IDTR in at least one of the horizontal direction and the vertical direction on the error signal, regardless of the multiple transform sets. If the decoder explicitly uses any one of the three DC prediction modes to generate a prediction block of the current block, the decoder can perform an inverse transform using IDTR in at least one of the horizontal direction and the vertical direction on the transform coefficient, regardless of the multiple transform sets, and obtain an error signal.

[0385] When the encoder generates a prediction block of the current block using the DC mode that uses the average of the upper pixel values, the encoder can apply the IDTR transform for the horizontal direction of the error signal and perform an MTS-based transform using the conventional DC mode for the vertical direction to obtain the transform coefficients. When the decoder generates a prediction block of the current block using the DC mode that uses the average of the upper pixel values, the decoder can apply the IDTR inverse transform for the horizontal direction of the transform coefficients and perform an MTS-based inverse transform using the conventional DC mode for the vertical direction to obtain the error signal.

[0386] If the encoder generates a prediction block of the current block using the DC mode that uses the average of the upper pixel values, the IDTR transform can be applied to the vertical direction of the error signal, and the MTS-based transform can be performed using the conventional DC mode for the horizontal direction to obtain the transform coefficients. If the decoder generates a prediction block of the current block using the DC mode that uses the average of the upper pixel values, the IDTR inverse transform can be applied to the vertical direction of the transform coefficients, and the MTS-based inverse transform can be performed using the conventional DC mode for the horizontal direction to output the error signal. The IDTR transform can be applied only when the width and / or height of the current block is greater than or equal to a specific value. In this case, the specific value can be 8, 16, or 32.

[0387] The video signal processing device can generate a prediction block of the current block through a weighted average between the planar mode and the DC mode. The video signal processing device can generate the prediction block of the current block through a weighted average between the linear planar prediction mode in the vertical direction and the DC mode that uses the average of the upper pixel values. Alternatively, the video signal processing device can generate the prediction block of the current block through a weighted average between the linear planar prediction mode in the vertical direction and the DC mode that uses the average of the left pixel values. The video signal processing device can apply the above-described transformation methods to the error signal of the generated prediction block. For example, when the decoder generates the prediction block of the current block through a weighted average between the linear planar prediction mode in the vertical direction and the DC mode that uses the average of the left pixel values, the decoder can perform an inverse transformation process using a set of secondary transform (e.g., LFNST) matrices of a horizontal angular mode (e.g., angular mode 18 in FIG. 6) and output primary transform coefficients. In addition, the decoder can perform an inverse transformation process based on MTS using a set of transformation matrices of a horizontal angle mode (e.g., the 18th angle mode in Fig. 6) instead of using a set of transformation matrices of a conventional DC prediction mode for the first transform coefficients, and can obtain an error signal. In this specification, the planar mode may be described as a planar prediction mode, and the DC mode may be described as a DC prediction mode.

[0388] Figure 44 illustrates a DC prediction method for vertical or horizontal line units according to one embodiment of the present invention.

[0389] The DC mode is a prediction method that generates a prediction block for the current block using only one average value, and has the characteristic that all pixels within the prediction block have the same value. In order to increase the prediction efficiency using the DC mode in a block with a gentle change, the video signal processing device can generate a prediction block such that the average value changes according to the vertical or horizontal position within the block, and this is described as a gradient-based DC prediction mode. Referring to FIG. 44, when a prediction block for the current block is generated using the DC mode in the vertical direction, the video signal processing device can calculate the average value of pixels adjacent to the upper side of the current block (e.g., the hatched pixels in FIG. 444) and then apply it to pixels corresponding to the first horizontal line of the current block (e.g., the pixels indicated by 1 in FIG. 44) to generate a prediction sample. Next, the average value can be recalculated according to the gradient between the reference pixel (A) located at the topmost position among the pixels adjacent to the left side of the current block and the reference pixel (B) of the next horizontal line. The video signal processing device can generate a prediction sample by applying the recalculated average value to the second horizontal line of the current block (e.g., pixels indicated by 2 in FIG. 44). The recalculation of the average value for the second horizontal line can be accomplished by interpolation using the distance (L) between reference pixels (A) and reference pixels (B), the distance (M) between reference pixels (A) and reference pixels (E), and the difference (X) between the pixel values ​​of the reference pixel (A) and the pixel (E) at the position (-1, -1) with respect to the lower left position of the current block. For example, the average value can be recalculated by multiplying the value of L divided by M by X and adding it to the average value. The same process can be performed for the next horizontal line, so that a prediction sample for the current block can be generated. That is, the prediction block of the current block can be generated such that the average value for each horizontal (or vertical) line changes according to the gradient of the reference pixels adjacent to the left (or upper) of the current block.The pixel values ​​of the samples in each horizontal (or vertical) direction are configured to be the same, and the prediction block of the current block can be generated such that at least one vertical (or horizontal) pixel value is different. In addition, the line-by-line DC prediction mode can be divided into a line-by-line DC prediction mode in the vertical direction and a line-by-line DC prediction mode in the horizontal direction. If the horizontal size of the current block is larger than the vertical size, since there are many pixels adjacent to the upper side of the current block, the prediction block for the current block can be generated using the line-by-line DC prediction mode in the vertical direction. Alternatively, if the horizontal and vertical sizes of the current block are the same, the prediction block for the current block can be generated using the conventional DC prediction mode.

[0390] Figure 45 illustrates a method for predicting a plane in units of vertical or horizontal lines according to one embodiment of the present invention.

[0391] Referring to FIGS. 45(a) to (d), when the current block is predicted using the vertical planar mode, the position of the used reference reference pixel may vary for each horizontal line. Specifically, the first horizontal line of the current block (pixels indicated as 1 in FIG. 45(a)) may be predicted using pixels adjacent to the current block upwardly (e.g., the hatched pixels in FIG. 45) and pixel A. The second horizontal line of the current block (pixels indicated as 2 in FIG. 45(a)) may be predicted using pixels adjacent to the current block upwardly (e.g., the hatched pixels in FIG. 45) and pixel B. In addition, the line-by-line planar prediction mode may be divided into a vertical planar mode, a horizontal planar mode, and a mode that weights the prediction blocks in the vertical and horizontal directions. If the horizontal size of the current block is larger than the vertical size, since there are many pixels adjacent to the current block upwardly, the video signal processing device may generate a prediction block for the current block using the vertical planar mode. If the vertical size of the current block is greater than the horizontal size, and there are more pixels adjacent to the left side of the current block, the video signal processing device can generate a prediction block for the current block using the planar mode in the vertical direction. If the horizontal and vertical sizes of the current block are equal, the video signal processing device can generate a prediction block for the current block using the conventional planar mode.

[0392] Figure 46 illustrates a sub-block unit prediction method using a planar mode according to one embodiment of the present invention.

[0393] A video signal processing device can divide a current block into sub-blocks of an arbitrary specified size (MxN), and then perform prediction on a sub-block basis using a planar mode. Referring to Figs. 46(a) to (c), the positions of reference pixels for prediction (1, 2, 3, 4 in Fig. 46) can vary for each sub-block. Specifically, referring to Fig. 46(a), a current block can be divided into four sub-blocks of MxN size. The positions of reference pixels can be determined based on the upper left position of the current sub-block and / or the horizontal and vertical sizes of the current sub-block. In Fig. 46(a), the positions of reference reference pixels of the upper left sub-block can be 1 and 3, the positions of reference reference pixels of the upper right sub-block can be 2 and 3, the positions of reference reference pixels of the lower left sub-block can be 1 and 4, and the positions of reference reference pixels of the lower right sub-block can be 2 and 4. For example, when a prediction block for the upper right sub-block of Fig. 46(a) is generated, if the planar mode is used, the video signal processing device can generate a prediction value for the pixel marked with X by weighting the value generated using the V pixel value and the reference reference pixel 3 and the value generated using the H pixel value and the reference reference pixel 2. Fig. 46(b) shows prediction in the horizontal direction planar mode in units of sub-blocks. For example, when a prediction block for the lower left sub-block of Fig. 46(b) is generated, if the horizontal direction planar mode is used, the video signal processing device can generate a prediction value for the pixel marked with X by weighting the value generated using the H pixel value and the reference reference pixel 1. Fig. 46(c) shows prediction in the vertical direction planar mode in units of sub-blocks.For example, when a prediction block for the upper right sub-block of Fig. 46(c) is generated, if the vertical plane mode is used, the video signal processing device can generate a prediction value for the pixel indicated by X by weighting and averaging the values ​​generated using the V pixel value and the reference reference pixel 3.

[0394] The video signal processing device can determine which planar mode among a horizontal planar mode, a vertical planar mode, and a conventional planar mode is applied to each sub-block based on at least one of the horizontal or vertical size of the current block, the ratio of the horizontal and vertical sizes of the current block, whether the current block is a luminance component block or a chrominance component block, quantization parameter information, intra prediction directional mode information of blocks surrounding the current block, the position of the sub-block, and intra prediction directional mode information derived using DIMD from pixels surrounding the current block.

[0395] If the intra prediction directional mode derived from the surrounding pixels of the current block using DIMD is greater than or equal to an arbitrary value, the video signal processing device may generate a prediction block of the sub-block by applying a vertical planar mode. If the intra prediction directional mode derived from the surrounding pixels of the current block using DIMD is less than an arbitrary value, the video signal processing device may generate a prediction block of the sub-block by applying a horizontal planar mode. At this time, the arbitrary value may be an integer, and may be 34, which is an index of a diagonal mode (angle mode 34 in FIG. 6). The DIMD information derived from the surrounding pixels of the current block may include information on a first intra prediction directional mode, a second intra prediction directional mode, and whether to perform weighted prediction. If the DIMD information derived from the surrounding pixels of the current block indicates that weighted prediction is not performed, the video signal processing device may generate a prediction block of each sub-block by using a conventional planar mode.

[0396] Based on the position of each sub-block, a planar mode used to generate a prediction block of each sub-block can be determined. The video signal processing device can generate a prediction block of the upper left sub-block using a conventional planar mode, can generate a prediction block of the upper right sub-block using a vertical planar mode, can generate a prediction block of the lower left sub-block using a horizontal planar mode, and can generate a prediction block of the lower right sub-block using a conventional flat mode.

[0397] A planar mode prediction method for sub-blocks can be applied only when a vertical or horizontal planar mode is applied to the current block. In other words, when a conventional planar mode is applied to the current block, the video signal processing device can generate a prediction block of the current block using the conventional planar mode. When a vertical or horizontal planar mode is used for the current block, the video signal processing device can divide the current block into sub-blocks and generate a prediction block of each sub-block using the vertical or horizontal planar mode.

[0398] The first horizontal line of the current block (pixels indicated as 1 in Fig. 44(a)) can be predicted using the pixels adjacent to the upper side of the current block (e.g., the hatched pixels in Fig. 44) and pixel A. Similarly, the second horizontal line of the current block (pixels indicated as 2 in Fig. 44(a)) can be predicted using the pixels adjacent to the upper side of the current block (e.g., the hatched pixels in Fig. 44) and pixel B. In addition, the line-by-line planar mode can be divided into a vertical planar mode, a horizontal planar mode, and a prediction mode that weights the prediction blocks in the vertical and horizontal directions. If the horizontal size of the current block is larger than the vertical size, since the number of upper pixels adjacent to the current block is larger, the video signal processing device can generate a prediction block for the current block using the vertical planar mode. If the vertical size of the current block is greater than the horizontal size, and there are more pixels adjacent to the current block to the left, the video signal processing device can generate a prediction block for the current block using the horizontal planar mode. If the horizontal and vertical sizes of the current block are equal, the video signal processing device can generate a prediction block for the current block using the conventional planar mode.

[0399] When a prediction block of a current block is generated using a planar mode, a video signal processing device may generate a prediction block using a vertical planar mode, a prediction block using a horizontal planar mode, and a weighted average of the respective prediction blocks to generate a final prediction block. At this time, the weights may be the same or different. If the intra prediction directional mode of DIMD derived from the surrounding pixels of the current block is greater than or equal to a certain value, the weight of the block predicted using the vertical planar mode may be the largest. The weight of the block predicted using the vertical planar mode may be 3, and the weight of the block predicted using the horizontal planar mode may be 1. If the intra prediction directional mode of DIMD derived from the surrounding pixels of the current block is less than a certain value, the weight of the block predicted using the horizontal planar mode may be the largest. The weight of the block predicted using the horizontal planar mode may be 3, and the weight of the block predicted using the vertical planar mode may be 1. Here, any value is an integer, and may be 34, which is the index of the diagonal mode (angle mode 34 in Fig. 6). The DIMD information derived from the surrounding pixels of the current block may include the first intra prediction directional mode, the second intra prediction directional mode, and information on whether to perform weighted prediction. If the DIMD information derived from the surrounding pixels of the current block indicates that weighted prediction is not applied, the video signal processing device may apply the same weight to each prediction block. Here, the prediction block generated using the vertical planar mode and the prediction block generated using the horizontal planar mode may be generated using a sub-block-based planar mode prediction method.

[0400] Prediction using DC mode has a problem of generating discontinuous edges at the boundary between blocks at low bit rates. To improve this problem, a video signal processing device can compensate for a predicted block of a current block generated using DC mode by adding an arbitrary offset value. At this time, information about the arbitrary offset value can be explicitly signaled in the bitstream or implicitly derived from neighboring pixel values ​​adjacent to the current block. The decoder can compensate for the predicted block of the current block based on the offset value obtained by parsing the information about the arbitrary offset value. Alternatively, the decoder can compensate for the predicted block of the current block by deriving the offset value from neighboring pixel values ​​adjacent to the current block. Alternatively, the predicted block of the current block can be generated by weighting the block predicted using planar mode and the block predicted using DC mode.

[0401] The three planar modes or the three DC modes can be derived based on templates. First, the video signal processing device can construct a reference template including reconstructed neighboring blocks adjacent to the current block (see Fig. 23). Then, the video signal processing device can construct prediction templates for the three planar modes using reference pixels surrounding the reference template. After calculating the cost between the reference template and the prediction template, the video signal processing device can generate a prediction block of the current block using the planar prediction mode that exhibits the minimum cost.

[0402] In addition, the video signal processing device can construct a reference template including reconstructed neighboring blocks adjacent to the current block (see FIG. 23). In addition, the video signal processing device can construct a prediction template for three planar modes using reference pixels around the reference template. The video signal processing device can calculate a cost between the reference template and the prediction template, and then construct a list for planar modes based on the cost. At this time, the planar mode with the smallest cost can be positioned at the beginning of the list, and the list can be constructed in ascending order according to the cost. The encoder can generate and signal a bitstream including index information for an optimal planar mode for generating a prediction block of the current block among the planar modes in the list. The decoder can generate a prediction block of the current block using the planar mode determined by parsing the index information.

[0403] The template-based planar mode induction method described above can be equally applied to the three DC modes.

[0404] Figure 47 illustrates an intra prediction method based on bidirectional prediction according to one embodiment of the present invention.

[0405] When a video signal processing device encodes a current block in intra prediction mode, pixels on the left or upper side of the current block can be effectively predicted because they are adjacent to the surrounding pixels of the reconstructed current block. However, pixels on the right or lower side of the current block have lower prediction efficiency because the surrounding pixels have not yet been reconstructed. In other words, the further a pixel is located at the lower right of the current block, the farther it is from the reference pixel (the surrounding pixel of the reconstructed current block), resulting in a larger error signal. To improve this problem, as shown in FIG. 47, the video signal processing device can pre-reconstruct only one pixel located at the lower right side of the current block, and then generate a prediction block of the current block based on the reconstructed lower right pixel and the surrounding pixels adjacent to the current block. At this time, the pixel located at the lower right side of the current block can be predicted and encoded from the pixels adjacent to the current block, and information about the difference between the pixel value located at the lower right side of the current block and the predicted value can be signaled by being included in the bitstream. The decoder can reconstruct the pixel located at the lower right of the current block using the difference value determined by parsing the information about the difference value. Next, the video signal processing device can generate a prediction block of the current block using pixels adjacent to the current block and one pixel located at the lower right of the current block. The video signal processing device can predict the right pixels (pixels indicated by 1 in FIG. 47) and lower pixels (pixels indicated by 2 in FIG. 47) of the current block using pixels adjacent to the current block and one pixel located at the lower right of the current block, and then generate a prediction block of the current block using pixels adjacent to the current block and lower pixels and right pixels within the current block.

[0406] To improve coding efficiency, rather than coding the aforementioned residual signal as is, a method may be used in which the transform coefficient values ​​obtained by transforming the residual signal are quantized and the quantized transform coefficients are coded. As described above, the transform unit may obtain the transform coefficient values ​​by transforming the residual signal. At this time, the residual signal of a specific block may be distributed across the entire region of the current block. Accordingly, by performing a frequency-domain transformation on the residual signal, energy can be concentrated in the low-frequency region, thereby improving coding efficiency.

[0407] The encoder can obtain at least one residual block contai...

Claims

1. In a video signal decoding device, Includes a processor, The above processor, Obtain multiple pairs consisting of one reference line and one intra prediction mode, The above plurality of pairs includes a first pair and a second pair, Obtain a list consisting of a plurality of integrated pairs including a first integrated pair that integrates the first pair and the second pair, A video signal decoding device that restores a current block based on one integrated pair in the above list.

2. In paragraph 1, A video signal decoding device, wherein each of the above plurality of pairs is composed of a combination of different reference lines and intra prediction modes.

3. In paragraph 1, The above processor, Obtaining a first prediction block based on the first reference line and the first intra prediction mode of the first pair, Obtaining a second prediction block based on the second reference line and the second intra prediction mode of the second pair, Obtain a final prediction block by weighting the first prediction block and the second prediction block, A video signal decoding device that restores the current block based on the final prediction block.

4. In paragraph 1, A video signal decoding device, wherein the one integrated pair in the above list is indicated based on a syntax element included in a bitstream.

5. In paragraph 1, A video signal decoding device, wherein the plurality of integrated pairs constituting the above list are sorted based on the cost of each of the plurality of integrated pairs.

6. In paragraph 5, A video signal decoding device, wherein the above plurality of integrated pairs are sorted in order of their corresponding costs.

7. In a video signal encoding device, Includes a processor, The above processor obtains a bitstream decoded by a decoding method, The above decoding method is, A step of obtaining multiple pairs each consisting of one reference line and one intra prediction mode; The above plurality of pairs includes a first pair and a second pair, A step of obtaining a list composed of a plurality of integrated pairs including a first integrated pair that integrates the first pair and the second pair; and A video signal encoding device, comprising a step of restoring a current block based on one integrated pair in the above list.

8. In paragraph 7, A video signal encoding device, wherein each of the plurality of pairs is composed of a combination of different reference lines and intra prediction modes.

9. In paragraph 7, The above decoding method is, A step of obtaining a first prediction block based on a first reference line and a first intra prediction mode of the first pair; A step of obtaining a second prediction block based on the second reference line of the second pair and the second intra prediction mode; A step of obtaining a final prediction block by weighting and averaging the first prediction block and the second prediction block; and A video signal encoding device further comprising a step of restoring the current block based on the final prediction block.

10. In paragraph 7, A video signal encoding device, wherein the one integrated pair in the above list is indicated based on a syntax element included in a bitstream.

11. In paragraph 7, A video signal encoding device, wherein the plurality of integrated pairs constituting the above list are sorted based on the cost of each of the plurality of integrated pairs.

12. In paragraph 11, A video signal encoding device in which the above plurality of integrated pairs are sorted in order of their corresponding costs.

13. In a computer-readable non-transitory storage medium storing a bitstream, the bitstream is decoded by a decoding method, The above decoding method is, A step of obtaining multiple pairs each consisting of one reference line and one intra prediction mode; The above plurality of pairs includes a first pair and a second pair, A step of obtaining a list composed of a plurality of integrated pairs including a first integrated pair that integrates the first pair and the second pair; and A non-transitory storage medium comprising a step of restoring a current block based on one integrated pair in the above list.

14. In paragraph 13, A video signal encoding device, wherein each of the plurality of pairs is composed of a combination of different reference lines and intra prediction modes.

15. In paragraph 13, The above decoding method is, A step of obtaining a first prediction block based on a first reference line and a first intra prediction mode of the first pair; A step of obtaining a second prediction block based on the second reference line of the second pair and the second intra prediction mode; A step of obtaining a final prediction block by weighting and averaging the first prediction block and the second prediction block; and A non-transitory storage medium further comprising a step of restoring the current block based on the final predicted block.

16. In paragraph 13, A non-transitory storage medium in which the one integrated pair in the above list is indicated based on a syntax element included in the bitstream.

17. In paragraph 7, A non-transitory storage medium, wherein the plurality of integrated pairs constituting the above list are sorted based on the cost of each of the plurality of integrated pairs.

18. In paragraph 17, A non-transitory storage medium in which the above plurality of integrated pairs are sorted in order of their corresponding costs.

Citation Information

Patent Citations

  • Cancer targeted mesoporous reduced graphene oxide nanocomposite for enhanced photothermal and photodynamic therapy and method for its preparation

    KR1020230050952A

  • Method for managing user for using indoor bike

    KR1020240121456A

  • Apparatus for weeding ecological disturbance plants

    KR102362424B1

  • Template matching based intra prediction

    US20220345692A1

  • Efficient implementation of matrix-based intra-prediction

    WO2021058640A1