Video signal processing method and device therefor

WO2026168870A1PCT designated stage Publication Date: 2026-08-13WILUS INSTITUTE OF STANDARDS & TECHNOLOGY INC
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2026-01-29
Publication Date
2026-08-13

Smart Images

  • Figure KR2026001755_13082026_PF_FP_ABST
    Figure KR2026001755_13082026_PF_FP_ABST
Patent Text Reader

Abstract

This video signal decoding device may comprise a processor, wherein the processor: acquires a first cross-component prediction (CCP) model by using a first reference sample related to a current block; acquires a second CCP model by using a second reference sample related to the current block; acquires a first prediction sample of the current block on the basis of the first CCP model; acquires a second prediction sample of the current block on the basis of the second CCP model; acquires a first weight corresponding to the first prediction sample; acquires a second weight corresponding to the second prediction sample; and predicts a specific sample of the current block by performing weighted averaging using the first prediction sample, the first weight, the second prediction sample, and the second weight.
Need to check novelty before this filing date? Find Prior Art

Description

Video signal processing method and apparatus for the same

[0001] The present invention relates to a video signal processing method and an apparatus for the same, and more specifically, to a video signal processing method and apparatus for encoding or decoding a video signal.

[0002] Compression encoding refers to a series of signal processing techniques used to transmit digitized information over communication lines or store it in a form suitable for storage media. Targets of compression encoding include voice, video, and text; specifically, the technology of performing compression encoding on video is called video image compression. Compression encoding of video signals is achieved by removing redundant information by considering spatial correlation, temporal correlation, and probabilistic correlation. However, due to recent advancements in various media and data transmission media, there is a 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 an apparatus for the same to increase the coding efficiency of a video signal.

[0004] The present specification provides a video signal processing method and an apparatus for the same.

[0005] In the present specification, a video signal decoding device includes a processor, wherein the processor obtains a first Cross-Component Prediction (CCP) model using a first reference sample associated with a current block, obtains a second CCP model using a second reference sample associated with the current block, obtains a first prediction sample of the current block based on the first CCP model, obtains a second prediction sample of the current block based on the second CCP model, obtains a first weight corresponding to the first prediction sample, obtains a second weight corresponding to the second prediction sample, and can predict a specific sample of the current block through a weighted average using the first prediction sample, the first weight, the second prediction sample, and the second weight.

[0006] In the present specification, the video signal encoding device includes a processor, and the processor can acquire a bitstream that is decoded by a decoding method.

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

[0008] In the present specification, the decoding method may include the steps of: obtaining a first Cross-Component Prediction (CCP) model using a first reference sample associated with a current block; obtaining a second CCP model using a second reference sample associated with the current block; obtaining a first prediction sample of the current block based on the first CCP model; obtaining a second prediction sample of the current block based on the second CCP model; obtaining a first weight corresponding to the first prediction sample; obtaining a second weight corresponding to the second prediction sample; and predicting a specific sample of the current block through a weighted average using the first prediction sample, the first weight, the second prediction sample, and the second weight.

[0009] Additionally, in the present specification, the second weight may be obtained based on the first weight.

[0010] Additionally, in the present specification, the current block may be a chroma component block.

[0011] Additionally, in the present specification, the first weight may be determined based on the position of the first predicted sample.

[0012] Additionally, in the present specification, the first weight may be a weight determined for each position of each sample constituting the current block.

[0013] Additionally, in the present specification, the first reference sample and the second reference sample may be different reference samples.

[0014] In addition, in the present specification, the encoding mode for the first prediction sample and the second prediction sample may be one of horizontal direction Planar, vertical direction Planar, DC, CCP mode, motion information, DIMD (Decoder side intra mode derivation), TIMD (Template intra mode derivation), OBI (Occurrence-based intra coding) mode, intra fusion, and BCW (Bi-prediction with CU-level Weights).

[0015] The present specification provides a method for efficiently processing video signals.

[0016] The effects obtainable in this specification are not limited to those mentioned above, and other unmentioned effects will be clearly understood by those skilled in the art from the description below.

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

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

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

[0020] FIG. 4 illustrates a method for signaling the splitting of a quad tree and a multi-type tree according to one embodiment of the present specification.

[0021] FIGS. 5 and 6 illustrate an intra-prediction method according to an embodiment of the present specification in more detail.

[0022] FIG. 7 shows the locations of surrounding blocks used to construct a list of motion candidates in an inter prediction according to one embodiment of the present specification.

[0023] FIG. 8 illustrates a method for determining a reference pixel line based on a template according to one embodiment of the present specification.

[0024] FIG. 9 is a diagram showing block vectors related to an IBC encoding method according to one embodiment of the present specification.

[0025] FIG. 10 illustrates a method for predicting the current block using RRIBC in the horizontal direction according to one embodiment of the present specification.

[0026] FIG. 11 illustrates a method for predicting the current block using RRIBC in the vertical direction according to one embodiment of the present specification.

[0027] FIG. 12 shows a block vector of a block encoded in Intra TMP mode according to one embodiment of the present specification.

[0028] FIG. 13 illustrates a case where the current block is divided by a GPM mode according to one embodiment of the present specification, and the divided area is encoded in an IBC mode.

[0029] FIG. 14 illustrates a method in which a current block is encoded in IBC-CIIP mode according to one embodiment of the present specification.

[0030] FIG. 15 shows an example of a reference region and filter shape used to derive CCCM parameters according to an embodiment of the present specification.

[0031] FIG. 16 shows a type of conversion kernel that can be used for video coding according to one embodiment of the present specification.

[0032] FIG. 17 shows a conversion set table for LFNST and NSPT conversions according to one embodiment of the present specification.

[0033] FIG. 18 illustrates a method for deriving multiple conversion sets and LFNST / NSPT sets according to one embodiment of the present specification.

[0034] FIG. 19 shows a mapping table according to one embodiment of the present specification.

[0035] FIG. 20 shows a conversion type set table according to one embodiment of the present specification.

[0036] FIG. 21 shows a conversion type combination table according to one embodiment of the present specification.

[0037] FIG. 22 shows a threshold value table for IDT conversion types according to one embodiment of the present specification.

[0038] FIG. 23 shows the block boundary and samples around the boundary in a deblocking filtering process according to one embodiment of the present specification.

[0039] FIG. 24 shows an intra-prediction mode based on an extrapolation filter according to one embodiment of the present specification.

[0040] FIG. 25 is a diagram showing the Region of Interest (ROI) after LFNST conversion according to one embodiment of the present specification.

[0041] FIG. 26 is a diagram illustrating the process of generating a prediction block using DIMD (Decoder side intra mode derivation) according to one embodiment of the present specification.

[0042] FIG. 27 is a diagram showing the location of surrounding pixels used to induce directional information according to one embodiment of the present specification.

[0043] FIG. 28 is a diagram illustrating a method for mapping a directional mode according to one embodiment of the present specification.

[0044] FIG. 29 is a diagram showing a histogram for inducing an intra-predicted directional mode according to one embodiment of the present specification.

[0045] FIG. 30 is a diagram illustrating a method for generating a prediction sample to restore a current block according to one embodiment of the present specification.

[0046] FIG. 31 is a diagram illustrating a method for determining an intra-prediction mode according to one embodiment of the present specification.

[0047] FIG. 32 is a diagram illustrating a method for generating prediction samples using intra-prediction directional mode information and weights according to one embodiment of the present specification.

[0048] FIGS. 33 and FIGS. 34 are drawings showing a template used to induce an intra prediction mode of a current block according to one embodiment of the present specification.

[0049] FIG. 35 is a diagram illustrating a method for generating a prediction sample (pixel) based on a plurality of reference pixel lines according to one embodiment of the present specification.

[0050] FIG. 36 illustrates a method for predicting a sample using a plurality of reference pixel lines according to one embodiment of the present specification.

[0051] FIG. 37 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 specification.

[0052] FIG. 38 illustrates a method for generating a prediction sample using a planar mode according to one embodiment of the present specification.

[0053] FIG. 39 illustrates a method for selecting an intra prediction mode based on the frequency of occurrence of an intra prediction mode according to one embodiment of the present specification.

[0054] FIGS. 40 and FIGS. 41 show surrounding blocks of a current block according to one embodiment of the present specification.

[0055] FIG. 42 illustrates a method of using a prediction mode-based candidate list according to one embodiment of the present specification.

[0056] FIG. 43 illustrates reference sample filtering according to one embodiment of the present specification.

[0057] FIG. 44 illustrates PDPC filtering according to one embodiment of the present specification.

[0058] FIG. 45 illustrates gradient PDPC filtering according to one embodiment of the present specification.

[0059] FIG. 46 illustrates a matrix-based intra-prediction method according to one embodiment of the present specification.

[0060] FIG. 47 shows a surrounding sample used to calculate directionality according to one embodiment of the present specification.

[0061] FIG. 48 shows a group of surrounding samples used to calculate directionality according to one embodiment of the present specification.

[0062] FIG. 49 illustrates a method for setting sample unit weights based on the directionality of surrounding samples according to one embodiment of the present specification.

[0063] FIG. 50 shows an ambient sample used in DIMD chroma mode according to one embodiment of the present specification.

[0064] FIG. 51 illustrates a method for deriving a reference sample line in a color difference block according to one embodiment of the present specification.

[0065] FIG. 52 illustrates a method for deriving a DIMD mode in a reference block derived based on a block vector according to one embodiment of the present specification.

[0066] FIG. 53 shows samples used to derive CCCM parameters according to one embodiment of the present specification.

[0067] FIG. 54 shows a luminance sample around a luminance sample of the current block according to one embodiment of the present specification.

[0068] FIG. 55 shows luminance samples before downsampling used to derive color difference samples in CCCM-ND mode according to one embodiment of the present specification.

[0069] FIGS. 56 and 57 show structural diagrams for the application of a cross-component residual model (CCRM) according to one embodiment of the present specification.

[0070] FIG. 58 shows a downsampling filter and a sample position applied to a luminance block according to one embodiment of the present specification.

[0071] FIG. 59 shows the coefficients of filtering applied to a prediction block according to one embodiment of the present specification and the filtering positions.

[0072] FIG. 60 illustrates a method for determining a CCP mode based on a template cost according to an embodiment of the present invention.

[0073] FIG. 61 shows peripheral blocks used to induce CCCM for a current color difference block according to one embodiment of the present specification.

[0074] FIG. 62 shows a reference area indicated by the block vector of the current luminance block according to one embodiment of the present specification.

[0075] FIG. 63 is a structural diagram illustrating a method for predicting the current block using a CCP merge mode according to one embodiment of the specification.

[0076] FIG. 64 shows the surrounding blocks of the current block according to one embodiment of the present specification.

[0077] FIG. 65 shows a co-located block and surrounding blocks according to one embodiment of the present specification.

[0078] FIG. 66 shows a CCLM illustrated in the form of a graph according to one embodiment of the present specification.

[0079] FIG. 67 shows a reference template position used to rearrange a CCP merge list according to one embodiment of the present specification.

[0080] FIG. 68 illustrates a method for signaling information indicating whether a CCP method is activated according to one embodiment of the present specification.

[0081] FIG. 69 illustrates a regression-based prediction method according to one embodiment of the present specification.

[0082] FIG. 70 illustrates a method of applying CCP in sub-block units according to one embodiment of the present specification.

[0083] FIG. 71 shows a reference sample area used in each sub-block in a sub-block unit CCP method according to one embodiment of the present specification.

[0084] FIG. 72 illustrates a method for setting a CCP mode based on the location of a sub-block according to one embodiment of the present specification.

[0085] FIG. 73 illustrates a method for deriving a CCP model from a reference sub-block using motion information according to one embodiment of the present specification.

[0086] FIG. 74 illustrates a method for deriving a CCP model from a reference sub-block using a block vector according to one embodiment of the present specification.

[0087] FIG. 75 shows the position of a luminance block used to derive motion information and / or block vectors according to one embodiment of the present specification.

[0088] FIGS. 76 and 77 illustrate a method for predicting a current color difference block using two or more CCP modes (models) derived from different reference samples according to one embodiment of the present specification.

[0089] FIG. 78 illustrates a method in which a video signal processing device processes a video signal according to one embodiment of the specification.

[0090] The terms used in this specification have been selected to be as widely used as possible, taking into account their functions in the present invention; however, these may vary depending on the intent, convention, or emergence of new technologies of those skilled in the art. In addition, in certain cases, terms have been arbitrarily selected by the applicant, and in such cases, their meanings will be described in the relevant description of the invention. Therefore, it should be noted that the terms used in this specification should be interpreted based on their actual meanings and the overall content of this specification, rather than merely their names.

[0091] In this specification, 'A and / or B' may be interpreted as having the same meaning as 'comprising at least one of A or B'.

[0092] Some terms in this specification may be interpreted as follows. Depending on the case, "coding" may be interpreted as "encoding" or "decoding." In this specification, a device that performs encoding of a video signal to generate a video signal bitstream is referred to as an encoding device or an encoder, and a device that performs decoding of a video signal bitstream to restore a video signal is referred to as a decoding device or a decoder. Additionally, in this specification, "video signal processing device" is used as a conceptual term encompassing both encoders and decoders. "Information" is a term that includes values, parameters, coefficients, elements, etc., and since its meaning may be interpreted differently depending on the case, the present invention is not limited thereto. "Unit" is used to refer to a basic unit of image processing or a specific location of a picture, and refers to an image region that includes at least one of a luminance (luma) component and a chroma component. Additionally, 'block' refers to an image region containing 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. Furthermore, in this specification, 'current block' refers to a block scheduled for current encoding, and 'reference block' refers to a block that has already been encoded or decoded and is used as a reference in the current block. Additionally, in this specification, terms such as 'luma', 'luminance', and 'Y' may be used interchangeably. Furthermore, in this specification, terms such as 'chroma', 'chroma', 'chrominance', and 'Cb or Cr' may be used interchangeably, and since the chrominance component is divided into two types, Cb and Cr, each chrominance component may be used separately. Additionally, in this specification, 'unit' may be used as a concept that includes a coding unit, a prediction unit, and a transformation unit."Picture" refers to a field or a frame, and depending on the embodiment, these terms may be used interchangeably. Specifically, if the captured image is an interlaced image, a single frame is separated into an odd (or odd, top) field and an even (or even, bottom) field, and each field is configured as a single picture unit for encoding or decoding. If the captured image is a progressive image, a single frame is configured as a picture for encoding or decoding. Furthermore, in this specification, terms such as "error signal," "residual signal," "residual signal," "residual signal," and "difference signal" may be used interchangeably. Additionally, in this specification, terms such as "intra-prediction mode," "intra-prediction directional mode," "in-frame prediction mode," and "in-frame prediction directional mode" may be used interchangeably. Furthermore, in this specification, terms such as "motion" and "movement" may be used interchangeably. Additionally, in this specification, 'left', 'upper left', 'upper', 'upper right', 'right', 'lower right', 'lower side', and 'lower left' may be used interchangeably with 'left end', 'upper left end', 'top', 'upper right end', 'right end', 'lower right end', 'bottom', and 'lower left end'. Also, 'element' and 'member' may be used interchangeably. POC (Picture Order Count) represents temporal position information of a picture (or frame), may be the playback order displayed on the screen, and each picture may have a unique POC. Additionally, in this specification, the size of a block may be the sum or product of the width and height of the block. Alternatively, the size of a block may refer to the number of samples within the block. Bit depth is a representation of the range of sample values ​​in bits, and when the bit depth is 8 bits, the range of sample values ​​is from 0 to 255.Internal bit depth refers to the bit depth when the bit depth is expanded to effectively encode an image in a video signal processing device (e.g., encoder, decoder). Generally, a video signal processing device expands the bit depth before encoding the image and reduces the bit depth to the bit depth of the original input image when outputting after decoding. For example, encoding and decoding are performed by expanding an image with an 8-bit depth to an image with a 10-bit depth.

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

[0094] The conversion unit (110) converts the residual signal, which is the difference between the input video signal and the prediction signal generated by the prediction unit (150), to obtain a conversion coefficient value. For example, the Discrete Cosine Transform (DCT), Discrete Sine Transform (DST), or Wavelet Transform may be used. The Discrete Cosine Transform and Discrete Sine Transform divide the input picture signal into blocks to perform the conversion. In the conversion, the coding efficiency may vary depending on the distribution and characteristics of the values ​​within the conversion area. The conversion kernel used for the conversion of the residual block may be a conversion kernel having separable characteristics of vertical conversion and horizontal conversion. In this case, the conversion of the residual block can be performed by separating it into vertical conversion and horizontal conversion. For example, the encoder can perform a vertical conversion by applying the conversion kernel in the vertical direction of the residual block. Additionally, the encoder may perform a horizontal transformation by applying a transformation kernel in the horizontal direction of the residual block. In this disclosure, the term "transformation kernel" may be used to refer to a set of parameters used for transforming a 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. Furthermore, transformation kernels based on different transformation types may be used for the vertical transformation and the horizontal transformation, respectively.

[0095] Transformation coefficients are distributed such that higher coefficients are found towards the top-left corner of the block, while coefficients closer to '0' are found towards the bottom-right corner. As the current block size increases, there is a higher likelihood of '0' coefficients existing in the bottom-right region. To reduce the transformation complexity of large blocks, only an arbitrary top-left region can be retained, and the remaining regions can be reset to '0'.

[0096] Additionally, an error signal may exist only in some regions of a coding block. In this case, the conversion process may be performed only on some arbitrary regions. As an example of implementation, 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 second 2NxN block may not be encoded or decoded without the conversion process being performed. Here, N can be any positive integer.

[0097] The encoder may perform an additional transformation before the transformation coefficients are quantized. The aforementioned transformation method is referred to as a primary transform, and the additional transformation may be referred to as a secondary transform. The secondary transform may be optional for each residual block. According to one embodiment, the encoder may improve coding efficiency by performing a secondary transform on regions where it is difficult to concentrate energy in the low-frequency region using only the primary transform. For example, a secondary transform may be additionally performed on blocks where residual values ​​appear significantly 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).

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

[0099] To increase coding efficiency, instead of coding the picture signal as is, a method is used to predict the picture using an already coded region 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. To prevent mismatches from occurring in the encoder and decoder, information that is also available in the decoder must be used when performing prediction in the encoder. To this end, the encoder performs a process of restoring the currently encoded block. The inverse quantization unit (120) inversely quantizes the transform coefficient value, and the inverse transform unit (125) restores the residual value using the inversely quantized transform coefficient value. Meanwhile, the filtering unit (130) performs filtering operations to improve the quality of the restored picture and enhance 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 a decoded picture buffer (DPB, 156) to be output or used as a reference picture.

[0100] A deblocking filter is a filter designed to remove distortion within blocks generated at the boundaries between blocks in a restored picture. The encoder can determine whether to apply a deblocking filter to a given boundary based on the distribution of pixels within a few columns or rows relative to an arbitrary edge within the block. When a deblocking filter is applied to a block, the encoder can apply a Long Filter, Strong Filter, or Weak Filter depending on the filtering intensity. 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 residual blocks to which the deblocking filter has been applied. To correct the offset for a specific picture, the encoder can use a Band Offset method, which divides the pixels contained in the image into a certain number of regions, determines the region to be corrected, and applies the offset to that region. Alternatively, the encoder may use an Edge Offset method, which applies an offset by considering the edge information of each pixel. Cross-component SAO (CC-SAO) is a method for compensating samples. In CC-SAO, similar to conventional SAO, the video signal processor classifies the reconstructed samples into categories and derives an offset for each category to add to the reconstructed samples. While conventional SAO uses only the luminance and chrominance components, CC-SAO classifies categories using all three components: luminance and two chrominance components. An Adaptive Loop Filter (ALF) is a method that divides pixels included in an image into specific groups, determines a single filter to be applied to each group, and performs differential filtering for each group.Information regarding whether to apply ALF can be signaled at the coding unit level, and the shape and coefficients of the ALF filter to be applied may vary depending on each block. Additionally, an ALF filter of the same form (fixed form) may be applied regardless of the characteristics of the target block. Bilateral Filter (BF) filtering is a method that applies a sample-level offset derived from the difference in change between neighboring samples on a sample-by-sample basis.

[0101] 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 the current picture, and the inter prediction unit (154) performs inter prediction by predicting the current picture using a reference picture stored in the decoded picture buffer (156). The intra prediction unit (152) performs intra prediction from restored regions within the current picture and transmits 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 regarding a reference sample. The inter prediction unit (154) may again 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. Motion information for the reference area obtained by the motion estimation unit (154a), such as reference direction indicator information (L0 prediction, L1 prediction, bidirectional prediction), reference picture index, motion vector information, etc., is transmitted to the entropy coding unit (160) so that it can be included in the bitstream. Using the motion information transmitted 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) transmits inter-coding information containing motion information for the reference area to the entropy coding unit (160).

[0102] 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 from restored samples within the current picture and transmits IBC encoding information to the entropy coding unit (160). The IBC prediction unit obtains a block vector value indicating a reference area used for predicting the current area by referencing a specific area within the current picture. The IBC prediction unit may perform IBC prediction using the obtained block vector value. The IBC prediction unit transmits IBC encoding information to the entropy coding unit (160). The IBC encoding information may include at least one of size information of the reference area and block vector information (index information for predicting the block vector of the current block within the motion candidate list, block vector difference information).

[0103] When the above picture prediction is performed, the conversion unit (110) converts the residual value between the original picture and the predicted picture to obtain a conversion coefficient value. At this time, the conversion 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 conversion coefficient value generated by the conversion unit (110) and transmits the quantized conversion coefficient to the entropy coding unit (160).

[0104] The quantized transformation coefficients in the form of a two-dimensional array described above can be rearranged into a one-dimensional array for entropy coding. The method of scanning the quantized transformation coefficients can be determined by the size of the transformation block and the in-frame prediction mode, which scanning method will be used. As an example of implementation, diagonal, vertical, and horizontal scans may be applied. This scan information can be signaled in block units and can be derived according to pre-determined rules.

[0105] The entropy coding unit (160) generates a video signal bitstream by entropy coding information representing quantized conversion coefficients, intra-coding information, and inter-coding information. In the entropy coding unit (160), methods such as Variable Length Coding (VLC) and arithmetic coding may be used. Variable Length Coding (VLC) converts input symbols into a series of codewords, and the length of the codewords may be variable. For example, frequently occurring symbols are represented as short codewords, and infrequently occurring symbols are represented as long codewords. As a variable length coding method, Context-based Adaptive Variable Length Coding (CAVLC) may be used. Arithmetic coding converts a series of data symbols into a single prime number using the probability distribution of each data symbol, and arithmetic coding can obtain the optimal prime number bit required to represent each symbol. Context-based Adaptive Binary Arithmetic Coding (CABAC) can be used as arithmetic coding.

[0106] CABAC is a method of binary arithmetic encoding that utilizes multiple context models generated based on probabilities obtained through experiments. A context model can also be referred to as a context model. First, if a symbol is not in binary form, the encoder binarizes each symbol using tools such as exp-Golomb. Binarized 0s or 1s can be described as bins. 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, which is determined by the symbol type, quantization parameters (QP), and slice type (whether it is I, P, or B). A context model possessing this initialization information can use probability-based values ​​obtained through experiments. The context model provides the occurrence probability of the LPS (Least Probable Symbol) or MPS (Most Probable Symbol) for the symbol currently being coded, as well as information (valMPS) regarding which bin value (0 or 1) corresponds to the MPS. One of several context models is selected through the context index (ctxIdx), and the context index can be derived from information about the block currently to be encoded or information about surrounding blocks. Initialization for binary arithmetic coding is performed based on the probability model selected from the context model. Binary arithmetic encoding proceeds by dividing into probability intervals based on the occurrence probabilities of 0 and 1, and then making the probability interval corresponding to the bin to be processed the entire probability interval for the next bin to be processed. Location information within the probability interval where the last bin was processed is output. However, since the probability interval cannot be divided indefinitely, if it shrinks to within a certain size, a renormalization process is performed to widen the probability interval and output the corresponding location information. Additionally, after each bin is processed, a probability update process may be performed to newly set the probability for the next bin to be processed based on the information of the processed bin.A video signal processing device can entropy-code by setting the probability of 0 or 1 occurring without a context model to '0.5', and this can be described as a bypass mode.

[0107] A bitstream may consist of one or more coded video sequences (CVS), and a single CVS may be encoded independently of the others. Each CVS may consist of one or more layers, and each layer may represent a specific image quality or resolution, or a general image, a depth information map, or a transparency map. Additionally, a coded layer video sequence (CLVS) may refer to a layer-wise CVS composed of consecutive (in decoding order) PUs within the same layer. For example, a CLVS for a specific image quality layer may exist, as well as a CLVS for a depth information map.

[0108] The bitstream generated above is encapsulated into Network Abstraction Layer (NAL) units as the basic unit. NAL units are classified into Video Coding Layer (VCL) NAL units containing video data and non-VCL NAL units containing parameter information for decoding video data, and various types of VCL or non-VCL NAL units exist. A NAL unit consists of NAL header information and Raw Byte Sequence Payload (RBSP), which is the data; the NAL header information includes summary information regarding the RBSP. The RBSP of a VCL NAL unit contains an integer number of encoded coding tree units. To decode the bitstream in a video decoder, the bitstream must first be separated into NAL units, and then each separated NAL unit must be decoded. Meanwhile, information required for decoding a video signal bitstream can be transmitted by including it in a Video Parameter Set (VPS), Sequence Parameter Set (SPS), Picture Parameter Set (PPS), Adaptation Parameter Set (APS), etc. The RBSP of the VCL NAL unit may include an integer number of coding tree units. The VPS is a parameter set composed of common syntax by extracting duplicate parameters from the SPS parameter set signaled at each layer in a bitstream that supports image quality, resolution, frame rate scalability, or a bitstream that supports multiview.SPS is a parameter set that includes at least one of the following: a profile containing information on acceptable coding tools (or algorithms) and image formats; a level containing information on the decoder's processing capability regarding processable image resolution, frame rate, and acceptable memory size; a tier containing information on the maximum processable bit rate; and information on image resolution, bit depth, and whether a feature is enabled. PPS is a parameter set that includes at least one of the following: image resolution, tile partitioning information, information on whether weight prediction is enabled, quantization parameters, and filtering-related information. APS is a parameter set that includes one of the following information depending on the APS type: ALF filter coefficient information, LMCS-related parameters, and quantization scale parameters. APS is classified 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, since it is efficient to apply ALF filter coefficients derived from the previous picture to the next picture, it may be signaled as a suffix APS. Non-VCL NAL units include SEI (Supplemental Enhancement Information) NAL units, which may contain metadata that is not required for picture restoration. SEI NAL units can be used for picture output timing, error loss detection, and concealment. An AU (Access Unit) may be a set of pictures belonging to the same time. A CRA (Clean Random Access) picture is a VCL NAL unit that does not refer to other pictures other than itself for inter-prediction during the decoding process. A CRA picture may be the first picture in the output order or an intra-picture.An IDR (Instantaneous Decoding Refresh) picture is a VCL NAL unit; like a CRA picture, it does not reference other pictures for inter-prediction during the decoding process. An IDR picture can be the first picture in the output order or an intra picture. Pictures decoded after an IDR picture cannot reference pictures decoded before it. A picture decoded after a CRA picture but outputted before it can reference pictures decoded before it. An IRAP (Intra Random Access Point) picture is a picture that allows random access and can be either a CRA picture or an IDR picture.

[0109] Meanwhile, the block diagram of FIG. 1 shows an encoding device (100) according to one embodiment of the present specification, and the separated blocks represent the elements of the encoding device (100) logically distinguished. Accordingly, the elements of the aforementioned encoding device (100) may be mounted as a single chip or as a plurality of chips depending on the design of the device. According to one embodiment, the operation of each element of the aforementioned encoding device (100) may be performed by a processor (not shown).

[0110] FIG. 2 is a schematic block diagram of a video signal decoding device (200) according to one embodiment of the present specification. 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).

[0111] The entropy decoding unit (210) entropies 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 binary code for transform coefficient information of a specific region from the video signal bitstream. Additionally, the entropy decoding unit (210) inversely binarizes the binary code to obtain quantized transform coefficients. The inverse quantization unit (220) inversely quantizes the quantized transform coefficients, and the inverse transform unit (225) restores the residual value using the inversely quantized transform coefficients. The video signal processing device (200) restores the original pixel value by summing the residual value obtained from the inverse transform unit (225) with the predicted value obtained from the prediction unit (250).

[0112] Meanwhile, the filtering unit (230) performs filtering on the picture to improve 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 stored in a decoded picture buffer (DPB, 256) to be output or used as a reference picture for the next picture.

[0113] 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 aforementioned entropy decoding unit (210), the conversion coefficient for each region, and intra / inter encoding information. To restore the current block in which decoding is performed, the decoded regions of the current picture containing the current block or other pictures 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) capable of performing 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 set of motion information to predict each block, and a B picture (or tile / slice) uses at most two sets of motion information to predict each block. Here, a set of motion information includes one or more motion vectors and one reference picture index.

[0114] The intra prediction unit (252) generates a prediction block using intra encoding information and restored samples within the current picture. Specifically, samples within the current block can be predicted using reference samples derived using the sample location within the current block and the directionality of the intra prediction mode. If the location of the reference sample is not an integer unit sample, it can be predicted using interpolated reference samples through an interpolation method using adjacent reference samples, which can be referred to as linear-based intra prediction. As described above, the intra encoding information may include at least one of an intra prediction mode, an MPM (Most Probable Mode) flag, and an MPM index. The intra prediction unit (252) predicts the sample values ​​of the current block using restored samples located to the left and / or above the current block as reference samples. In the present disclosure, the restored samples, reference samples, and samples of the current block may represent pixels. Additionally, the sample values ​​may represent pixel values.

[0115] According to one embodiment, reference samples may be samples included in the surrounding blocks of the current block. For example, the reference samples may be samples adjacent to the left boundary of the current block and / or samples adjacent to the upper boundary. Additionally, the reference samples may be samples among the samples of the surrounding blocks of the current block located on a line within a preset distance from the left boundary of the current block and / or samples located on a line within a preset distance from the upper boundary of the current block. In this case, the surrounding 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 upper right (AR) block, or an upper left (AL) block adjacent to the current block. The surrounding blocks of the current block may be reference blocks for predicting the current block.

[0116] The inter-prediction unit (254) generates a prediction block using the reference picture and inter-coding information stored in the decoding picture buffer (256). The inter-coding information may include a set of motion information (reference picture index, motion vector information, etc.) of the current block for the reference block. Inter-prediction may include L0 prediction, L1 prediction, and bi-prediction. L0 prediction refers to a prediction using one reference picture included in the L0 picture list, and L1 prediction refers to a 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 regions may be used, and these two reference regions may exist in the same reference picture or in different pictures. That is, in the pair prediction method, up to two sets of motion information (e.g., motion vectors and reference picture indices) may be used, and the two motion vectors may correspond to the same reference picture index or different reference picture indices. In this case, the reference pictures are pictures located temporally before or after the current picture, and may be pictures that have already been restored and completed. According to one embodiment, the two reference regions used in the pair prediction method may be regions selected from the L0 picture list and the L1 picture list, respectively. Additionally, a prediction method that uses only reference pictures with a POC smaller than the current picture's POC or only reference pictures with a POC larger than the current picture's POC, based on the POC (picture order count) indicating the display order of the current picture, can be called unidirectional prediction.In addition, a prediction method that uses both a reference picture with a POC smaller than the current picture's POC and a reference picture with a POC larger than the current picture's POC, based on the POC (picture order count) representing the display order of the current picture, can be called bi-directional prediction. A prediction method that uses only one reference picture in unidirectional prediction can be called uni-prediction, and a prediction method that uses two reference pictures in unidirectional prediction can be called bi-prediction or paired prediction.

[0117] 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 within the reference picture corresponding to the reference picture index. Additionally, a sample value of the 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 may be used for the luminance signal and a 4-tap interpolation filter may be used for the 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 may use a set of motion information.

[0118] According to an additional embodiment, the prediction unit (250) may include an IBC prediction unit (not shown). The IBC prediction unit may restore a current region by referring to a specific region containing restored 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.

[0119] A restored video picture is generated by adding the predicted value output from the intra prediction unit (252) or the 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 by the prediction unit (250) and the residual obtained from the inverse transformation unit (225).

[0120] Meanwhile, the block diagram of FIG. 2 shows a decoding device (200) according to one embodiment of the present specification, and the separated blocks represent the elements of the decoding device (200) logically distinguished. Accordingly, the elements of the aforementioned decoding device (200) may be mounted as a single chip or multiple chips depending on the design of the device. According to one embodiment, the operation of each element of the aforementioned decoding device (200) may be performed by a processor (not shown).

[0121] Meanwhile, the technology proposed in this specification is applicable to both the methods and devices of encoders and decoders, and the parts described as signaling and parsing may be described for convenience of explanation. Generally, signaling can be described as encoding each syntax from the perspective of an encoder, and parsing as interpreting each syntax from the perspective of a decoder. That is, each syntax can be signaled by being included in a bitstream from the encoder, and the decoder can parse the syntax and use it in the restoration process. In this case, a sequence of bits for each syntax arranged according to a defined hierarchical configuration can be referred to as a bitstream.

[0122] A single picture can be divided and encoded into sub-pictures, slices, tiles, etc. A sub-picture may contain one or more slices or tiles. When a single picture is divided and encoded into multiple slices or tiles, it can only be displayed on the screen after all slices or tiles within the picture have been decoded. Conversely, when a single picture is encoded into multiple sub-pictures, only any sub-picture may be decoded and displayed on the screen. A slice may contain multiple tiles or sub-pictures. Alternatively, a tile may contain multiple sub-pictures or slices. Since sub-pictures, slices, and tiles can be encoded or decoded independently of each other, they are effective for parallel processing and improving processing speed. However, there is a disadvantage in that the bit size increases because the encoded information of adjacent sub-pictures, slices, or tiles cannot be utilized. Sub-pictures, slices, and tiles can be divided and encoded into multiple Coding Tree Units (CTUs).

[0123] FIG. 3 illustrates an embodiment in which a Coding Tree Unit (CTU) is divided into Coding Units (CUs) within a picture. During the coding process of a video signal, the picture may be divided into a sequence of Coding Tree Units (CTUs). A Coding Tree Unit may consist of a Luminance Coding Tree Block (CTB), two Chroma Coding Tree Blocks, and its encoded syntax information. A single Coding Tree Unit may consist of a single Coding Unit, or a single Coding Tree Unit may be divided into multiple Coding Units. A single Coding Unit may consist of a Luminance Coding Block (CB), two Chroma Coding Blocks, and its encoded syntax information. A single Coding Block may be divided into multiple Sub-Coding Blocks. A single Coding Unit may consist of a Transform Unit (TU), or a single Coding Unit may be divided into multiple Transform Units. A single transform unit may consist of a luminance transform block (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 become a leaf node. In this case, the coding tree unit itself may become a coding unit.

[0124] A coding unit refers to a basic unit for processing a picture during the video signal processing process described above, namely intra / inter prediction, transformation, quantization, and / or entropy coding. Within a single picture, the size and shape of the coding unit may not be constant. The 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 this specification, a vertical block is a block in which the height is greater than the width, and a horizontal block is a block in which the width is greater than the height. Additionally, in this specification, a non-square block may refer to a rectangular block, but the invention is not limited thereto.

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

[0126] Meanwhile, the leaf nodes of the aforementioned quad tree can be further divided into a Multi-Type Tree (MTT) structure. According to an embodiment of the present invention, in a multi-type tree structure, a single node can be divided into a binary or ternary tree structure by horizontal or vertical division. That is, in a multi-type tree structure, there are four division structures: vertical binary division, horizontal binary division, vertical ternary division, and horizontal ternary division. According to an embodiment of the present invention, in each of the tree structures, the width and height of the node can both have powers of 2 values. For example, in a binary tree (BT) structure, a node of size 2NX2N can be divided into two NX2N nodes by vertical binary division and into two 2NXN nodes by horizontal binary division. In addition, in a ternary tree (TT) structure, a node of size 2NX2N can be divided into (N / 2)X2N, NX2N, and (N / 2)X2N nodes by vertical ternary partitioning, and into 2NX(N / 2), 2NXN, and 2NX(N / 2) nodes by horizontal ternary partitioning. This multi-type tree partitioning can be performed recursively.

[0127] Leaf nodes of a multi-type tree can be coding units. If a coding unit is not large compared to 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 greater than the maximum transformation length, the current coding unit can be split into multiple transformation units without explicit signaling regarding splitting. Meanwhile, in the aforementioned quad tree and multi-type tree, at least one of the following parameters may be predefined or transmitted via an RBSP of a higher-level set such as PPS, SPS, VPS, etc. 1) CTU size: Size of the quad tree root node, 2) MinQtSize: Allowed minimum QT leaf node size, 3) MaxBtSize: Allowed maximum BT root node size, 4) MaxTtSize: Allowed maximum TT root node size, 5) MaxMttDepth: Maximum allowed depth of MTT splitting from the QT leaf node, 6) MinBtSize: Allowed minimum BT leaf node size, 7) MinTtSize: Allowed minimum TT leaf node size.

[0128] FIG. 4 illustrates an embodiment of a method for signaling the splitting of a quad tree and a multi-type tree. Pre-configured flags may be used to signal the splitting of the aforementioned quad tree and multi-type tree. Referring to FIG. 4, at least one of the following may be used: 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 the splitting direction of a multi-type tree node, or a flag 'mtt_split_cu_binary_flag' indicating the splitting shape of a multi-type tree node.

[0129] According to an embodiment of the present invention, a flag 'split_cu_flag' indicating whether the 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 unsplit coding unit. If the current node is a quad tree node 'QT node', the current node is a quad tree leaf node 'QT leaf node' and becomes a coding unit. If the current node is a multi-type tree node 'MTT node', the current node is a multi-type tree leaf node 'MTT leaf node' and becomes a coding unit.

[0130] When the value of 'split_cu_flag' is 1, the current node may be split into nodes of a quad tree or a multi-type tree according to the value of 'split_qt_flag'. A coding tree unit is the root node of a quad tree and may be split first into a quad tree structure. In a 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 quad tree leaf node 'QT leaf node' and is split into multi-type nodes. According to an embodiment of the present invention, quad tree splitting may be restricted depending on the type of the current node. Quad tree splitting may be allowed when 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 when the current node is a multi-type tree node. Each quad tree leaf node 'QT leaf node' can be further split into a multi-type tree structure. As described above, if 'split_qt_flag' is 0, the current node can be split into multi-type nodes. To indicate the split direction and split shape, 'mtt_split_cu_vertical_flag' and 'mtt_split_cu_binary_flag' can be signaled. If the value of 'mtt_split_cu_vertical_flag' is 1, a vertical split of node 'MTT node' is indicated, and if the value of 'mtt_split_cu_vertical_flag' is 0, a horizontal split of node 'MTT node' is indicated.Also, when the value of 'mtt_split_cu_binary_flag' is 1, the node 'MTT node' is split into 2 rectangular nodes, and when the value of 'mtt_split_cu_binary_flag' is 0, the node 'MTT node' is split into 3 rectangular nodes.

[0131] In a tree partitioning structure, luminance blocks and chrominance blocks can be partitioned in the same form. That is, a chrominance block can partition itself by referencing the partitioning form of the luminance block. If the current chrominance block is smaller than an arbitrarily defined size, the chrominance block may not be partitioned even if the luminance block has been partitioned.

[0132] The luminance block and the chrominance block can have the same tree partitioning structure, which can be referred to as a Single Tree. When the current block is encoded as a Single Tree, the partitioning structure, encoding mode information, and motion information of the luminance and chrominance blocks may be identical, while other information related to error signals may differ between the luminance and chrominance blocks. Additionally, the luminance and chrominance blocks can have different tree partitioning structures, which can be referred to as a Dual Tree. When the current block is encoded as a Dual Tree, at least one of the partitioning structure, encoding mode information, and motion information of the luminance and chrominance blocks may differ.

[0133] There may be a close correlation between the luminance block and the chrominance block corresponding to the luminance block. Therefore, in encoders and decoders, when the current block is encoded and decoded as a dual tree, the chrominance block can be encoded using the luminance block's partitioning information, encoding mode information, motion information, etc.

[0134] 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 may be the same or different. As an example of implementation, if the coding unit is in intra mode, the intra prediction mode of each sub-block may be the same or different. Also, if the coding unit is in inter mode, the movement information of each sub-block may be the same or different. Additionally, each sub-block may be capable of encoding or decoding independently of one another. Each sub-block can be distinguished through a sub-block index (sbIdx). Furthermore, when the coding unit is divided into sub-blocks, it may be divided horizontally or vertically, or diagonally. The mode in which the current coding unit is divided into two or four sub-blocks in the horizontal or vertical direction in intra mode is called ISP (Intra Sub Partitions). The mode in which the current coding block is divided diagonally in inter mode is called GPM (Geometric partitioning mode). In GPM mode, the position and direction of the diagonal line are determined using a predetermined angle table, and the index information of the angle table is signaled.

[0135] Motion information may include one or more of reference direction indicator 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.

[0136] Reference direction indicator information consists of L0 prediction, L1 prediction, and L0 and L1 predictions; L0 and L1 predictions are single predictions and unidirectional predictions, while L0 and L1 predictions are bidirectional predictions. Additionally, L0 and L1 predictions can be either unidirectional or bidirectional predictions. Here, L0 prediction is performed using reference pictures within the L0 reference picture list, and L1 prediction can be performed using reference pictures within the L1 reference picture list. In the L0 reference picture list, reference pictures with a POC smaller than the current picture's POC can be added based on the current picture's POC. Furthermore, the L0 reference picture list can be organized in order from reference pictures with a POC closer to the current picture's POC to reference pictures with a POC further away. In the L1 reference picture list, reference pictures with a POC larger than the current picture's POC can be added based on the current picture's POC. Additionally, the L1 reference picture list may be organized in order from reference pictures closer to the POC of the current picture to reference pictures further away from the POC. The L0 and L1 reference picture lists may vary for each slice, sub-picture, and picture. Furthermore, the L0 reference picture list may include reference pictures from the L1 reference picture list. And the L1 reference picture list may include reference pictures from the L0 reference picture list.

[0137] Reference picture information may vary per block and may be index information indicating which reference picture from the L0 reference picture list and / or L1 reference picture list the current block is predicted to use. Reference picture information may include one or more of L0 reference picture information and L1 reference picture information.

[0138] A motion vector is information indicating the block in the reference picture that best matches the current block; it is a value representing the distance from the top-left position of the current block within the picture to the reference block in horizontal and vertical coordinates.

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

[0140] A block vector is information indicating the block that best matches the current block within the already restored area of ​​the current picture; it is a value representing the distance from the top-left position of the current block to the reference block in horizontal and vertical coordinates.

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

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

[0143] LIC information may include whether LIC is applied to the current block.

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

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

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

[0147] Picture prediction (motion compensation) for coding is performed on indivisible coding units (i.e., leaf nodes of coding tree units). The basic unit that performs this prediction is hereinafter referred to as a prediction unit or prediction block.

[0148] Hereinafter, the term "unit" as used in this specification may be used as a substitute for the prediction unit, which is the basic unit for performing predictions. However, the present invention is not limited thereto, and may be understood more broadly as a concept including the coding unit.

[0149] FIGS. 5 and 6 further illustrate an intra prediction method according to an embodiment of the present specification. 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.

[0150] First, FIG. 5 illustrates an example of reference samples used for prediction of the current block in intra prediction mode. According to one example, the reference samples may be samples adjacent to the left boundary of the current block and / or samples adjacent to the 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, the reference samples may be set using up to 2W+2H+1 surrounding samples located to the left and / or upper side of the current block.

[0151] Meanwhile, pixels of multiple reference lines may be used for intra prediction of the current block. A multiple reference line may consist 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 named a reference line index.

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

[0153] Next, FIG. 6 illustrates an example of prediction modes used for intra prediction. For intra prediction, intra prediction mode information indicating the direction of intra prediction may be signaled. The intra prediction mode information indicates one of a plurality of intra prediction modes constituting a set of intra prediction modes. 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 for the current block based on the extracted intra prediction mode information.

[0154] 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 (e.g., 65) angle modes (i.e., direction 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, intra prediction mode index 0 indicates a planar mode, and intra prediction mode index 1 indicates a DC mode. Additionally, intra prediction mode indices 2 through 66 may each indicate different angle modes. Angle modes each indicate different angles within a preset angle range. For example, an angle mode may indicate an angle within an angle range between 45 degrees and -135 degrees clockwise (i.e., a first angle range). The angle 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.

[0155] Meanwhile, the pre-set angle ranges 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 clockwise may be additionally used. If the current block is a horizontal block, the angle mode may indicate an angle within an angle range between (45+offset1) degrees and (-135+offset1) degrees clockwise (i.e., a second angle range). In this case, angle modes 67 to 76 that fall outside the first angle range may be additionally used. Additionally, if the current block is a vertical block, the angle mode may indicate an angle within an angle range between (45-offset2) degrees and (-135-offset2) degrees clockwise (i.e., a third angle range). In this case, angle modes -10 to -1 that fall 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.

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

[0157] According to one embodiment, the basic angle mode is a mode corresponding to the angle used in the intra prediction of the existing HEVC (High Efficiency Video Coding) standard, and the extended angle mode may be a mode corresponding to the angle newly added in the 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. Accordingly, the angle indicated by the extended angle mode may be determined based on the angle indicated by the basic angle mode.

[0158] According to another embodiment, the basic angle mode is a mode corresponding to an angle within a preset first angle range, and the extended angle mode may be a wide angle mode that is outside the first angle range. That is, the basic angle mode is 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 the opposite angle of 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 depending on the size and / or shape of the current block. Meanwhile, the total number of intra-prediction modes included in the set of intra-prediction modes may vary depending on the configuration of the aforementioned basic angle mode and extended angle mode.

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

[0160] According to an embodiment of the present invention, an extended angle mode may be signaled based on a basic angle mode. For example, a wide angle mode (i.e., an extended angle mode) may replace at least one angle mode (i.e., a basic angle mode) within a first angle range. The replaced basic angle mode may be an angle mode corresponding to the opposite side of the wide angle mode. That is, the replaced basic angle mode is an angle mode corresponding to an angle in the opposite direction of the angle indicated by the wide angle mode, or an angle mode corresponding to an angle that differs 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 basic angle mode may be remapped to the wide angle mode to signal the corresponding wide angle mode. For example, wide angle modes {-14, -13, … , -1} may each be signaled by the intra-prediction mode index {52, 53, … , 66}, and wide angle modes {67, 68, … , 80} may be signaled by the intra-prediction mode index {2, 3, … Each can be signaled by { , 15}. In this way, by allowing the intra prediction mode index for the basic angle mode to signal the extended angle mode, the same set of intra prediction mode indexes can be used for signaling the intra prediction mode even if the configurations of the angle modes used for intra prediction in each block are different. Therefore, signaling overhead due to changes in the intra prediction mode configuration can be minimized.

[0161] 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. According to one embodiment, if the size of the current block is larger than a preset size, the extended angle mode is used for intra prediction of the current block, and otherwise, only the basic angle mode is used for intra prediction of the current block. According to another embodiment, if the current block is a non-square block, the extended angle mode is used for intra prediction of the current block, and if the current block is a square block, only the basic angle mode is used for intra prediction of the current block.

[0162] The intra prediction unit determines the reference samples and / or interpolated reference samples to be used for intra prediction of the current block based on the intra prediction mode information of the current block. If the intra prediction mode index indicates a specific angle mode, the reference sample or interpolated reference sample corresponding to the specific angle from the current sample of the current block is used for the prediction of the current pixel. Therefore, different sets of reference samples and / or interpolated reference samples may be used for intra prediction depending on the intra prediction mode. Once the 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.

[0163] The motion information used for inter-prediction may include reference direction indicator information (inter_pred_idc), reference picture indices (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 indicator information. As an example of implementation, in the case of unidirectional prediction using the L0 reference picture, predFlagL0 may be set to 1 and predFlagL1 to 0. In the case of unidirectional prediction using the L1 reference picture, predFlagL0 may be set to 0 and predFlagL1 to 1. In the case of bidirectional prediction using both the L0 and L1 reference pictures, predFlagL0 may be set to 1 and predFlagL1 to 1.

[0164] If the current block is a coding unit, the coding unit may be divided into multiple sub-blocks, and the prediction information of each sub-block may be the same or different. For example, if the coding unit is in intra mode, the intra prediction mode of each sub-block may be the same or different. Also, if the coding unit is in inter mode, the movement information of each sub-block may be the same or different. Additionally, each sub-block may be capable of encoding or decoding independently of each other. Each sub-block may be distinguished by a sub-block index (sbIdx).

[0165] The motion vector of the current block is highly likely to be similar to the motion vector of surrounding blocks. Therefore, the motion vectors of 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 surrounding blocks. Additionally, to improve the accuracy of the motion vector, the motion vector difference (mvd) between the optimal motion vector of the current block found from the original image by the encoder and the motion vector predictor can be signaled.

[0166] Motion vectors can have various resolutions, and the resolution of the motion vector 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, or integer units of 4. Since images such as screen content are simple graphic forms like text, interpolation filters do not need to be applied; therefore, integer units and integer units of 4 can be selectively applied on a block-by-block basis. For blocks encoded in Affine mode, which can express rotation and scale, the shape changes significantly; therefore, integer units, quarter-pixel units, and sixteenth-pixel units can be selectively applied based on the block. Information regarding whether to selectively apply motion vector resolution on a block-by-block basis is signaled by amvr_flag. If applied, which motion vector resolution to apply to the current block is signaled by amvr_precision_idx.

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

[0168] To improve the accuracy of motion prediction values, the Merge or AMVP (advanced motion vector prediction) 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 adjacent blocks; this method has the advantage of increasing the encoding efficiency of motion information by allowing motion information to propagate spatially without change within a homogeneous motion region. On the other hand, the AMVP method predicts motion information in the L0 and L1 prediction directions respectively to represent accurate motion information and signals the most optimal motion information. After deriving motion information for the current block through the AMVP or Merge method, the decoder uses the reference block located in the motion information derived from the reference picture as the prediction block for the current block.

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

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

[0171] In this specification, the motion candidate and the motion information candidate may have the same meaning. Additionally, the motion candidate list and the motion information candidate list may have the same meaning.

[0172] SMVD (Symmetric MVD) is a method that reduces the amount of bits of motion information transmitted by making the Motion Vector Difference (MVD) values ​​in the L0 and L1 directions symmetrical in the case of bi-directional prediction. The MVD information in the L1 direction that is symmetrical to the L0 direction is not transmitted, and the reference picture information in the L0 and L1 directions is also not transmitted and can be derived during the decoding process.

[0173] OBMC (Overlapped Block Motion Compensation) is a method that generates prediction blocks for the current block using motion information from surrounding blocks when motion information between blocks differs, and then generates a final prediction block for the current block by weighted averaging the prediction blocks. This has the effect of reducing blocking phenomena occurring at block boundaries in motion-compensated images.

[0174] The video signal processing device can divide the current block into multiple sub-blocks and then determine whether to apply OBMC and the OBMC mode for each sub-block. The OBMC mode can be determined based on different weights. The application of OBMC and the OBMC mode can be determined through a reference template constructed using surrounding samples adjacent to the current sub-block. The video signal processing device can predict a template using motion information of the current sub-block and motion information of surrounding blocks of the current sub-block, and then determine whether to apply OBMC and the OBMC mode based on the SAD or MR-SAD cost between the predicted template and the reference template. An OBMC mode using a template can be referred to as TM OBMC (Template Matching OBMC).

[0175] Generally, 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 corrects motion information using a single candidate selected from several motion difference value candidates. Information regarding the motion correction value obtained through the MMVD method (e.g., an index indicating a single candidate selected from the motion difference value candidates) can be included in the bitstream and transmitted to the decoder. Compared to the conventional method where motion information difference values ​​are included in the bitstream, the amount of bits can be saved by including information regarding the motion correction value in the bitstream.

[0176] MBVD (Merge Mode with Block Vector Differences) mode is a method for encoding difference values ​​for block vectors, similar to MMVD, which is a merge mode that encodes difference values ​​for motion vectors. The MBVD method determines a block vector by using a single candidate selected from several block vector difference value candidates. Information regarding the block vector difference value obtained through the MBVD method (e.g., an index indicating the single candidate selected from the block vector difference value candidates) can be included in the bitstream and transmitted to the decoder. Compared to the conventional method of including the block vector difference value in the bitstream, bit volume can be saved by including only a portion of the information regarding the block vector difference value in the bitstream.

[0177] Template Matching (TM) is a method that constructs a template using the surrounding pixels of the current block and finds the matching region with the highest similarity to the template to correct motion information. Template Matching is a method that performs motion prediction in the decoder without including motion information in the bitstream in order to reduce the size of the encoded bitstream. In this case, since the decoder does not have the original image, it can roughly derive motion information for the current block by using already restored surrounding blocks.

[0178] BM (Bilateral Matching) may be a method in which a video signal processing device corrects motion information based on the similarity between a reference block in a picture included in an L0 picture list derived based on motion information of the current block and a reference block in a picture included in an L1 picture list.

[0179] The Decoder-side Motion Vector Refinement (DMVR) method is a method that corrects motion information through the correlation of already restored reference images to find more accurate motion information. It uses the bidirectional motion information of the current block to select the point within the two reference pictures that best matches the reference blocks within the reference pictures within an arbitrary defined area of ​​the two reference pictures as the new bidirectional motion. When this DMVR is performed, the encoder can correct motion information by performing DMVR at the block level, and then divide the block into sub-blocks to perform DMVR at the sub-block level to correct the motion information of the sub-blocks. This can be referred to as Multi-pass DMVR (MP-DMVR).

[0180] The video signal processing device can construct an initial list of motion candidates and correct each motion candidate within the initial list using the TM or DMVR method. The video signal processing device can obtain a reordered list of motion candidates by reordering the corrected motion candidates based on the template cost. This can be referred to as ARMC (Adaptive Reordering of Merge Candidates).

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

[0182] Existing video encoding methods perform motion compensation that considers only up, down, left, and right translations, so encoding efficiency is reduced when encoding videos that include movements such as enlargement, reduction, and rotation, which are commonly encountered in reality. To represent movements such as enlargement, reduction, and rotation, an Affine model-based motion prediction technique using a 4-parameter (rotation) or 6-parameter (enlargement, reduction, rotation) model can be applied.

[0183] Bi-Directional Optical Flow (BDOF) is used to correct a prediction block by estimating the amount of pixel change based on optical flow from a reference block of a block composed of bidirectional motion. The motion of the current block can be corrected using motion information derived from the BDOF of this VVC.

[0184] PROF (Prediction refinement with optical flow) is a technology designed to improve the accuracy of sub-block affine motion prediction to be comparable to that of pixel-level motion prediction. Similar to BDOF, PROF is a technique that obtains a final prediction signal by calculating pixel-level correction values ​​for sub-block affine motion-compensated pixel values ​​based on optical flow.

[0185] The CIIP (Combined Inter- / Intra-picture Prediction) method generates a final prediction block for the current block by taking a weighted average of the prediction blocks generated by the intra-picture prediction method and the prediction blocks generated by the inter-picture prediction method.

[0186] The Intra Block Copy (IBC) method locates the part most similar to the current block within an already restored area of ​​the current picture and uses that reference block as the prediction block for the current block. In this process, information related to the block vector—the distance between the current block and the reference block—can be included in the bitstream. The decoder can parse the information related to the block vector contained in the bitstream to calculate or set the block vector for the current block.

[0187] The BCW (Bi-prediction with CU-level Weights) method is a method that performs a weighted average of 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.

[0188] 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 that reference block (the part found in the already restored area) as a prediction block for the current block.

[0189] The Multi-hypothesis Prediction (MHP) method performs weighted prediction through various prediction signals by transmitting additional motion information to unidirectional and bidirectional motion information during cross-frame prediction.

[0190] The Cross-component Linear Model (CCLM) is a method that predicts a chrominance signal by constructing a linear model utilizing the high correlation between a luminance signal and a chrominance signal located at the same position as the luminance signal. A template is constructed using a reconstructed block among the surrounding blocks adjacent to the current block, and parameters for the linear model are derived through this template. Next, depending on the image format, the reconstructed current luminance block is selectively downsampled to match the size of the chrominance block. Finally, the chrominance block of the current block is predicted using the downsampled luminance block and the corresponding linear model. In this context, the method of using two or more linear models is called Multi-model Linear Mode (MMLM). To derive two linear models for MMLM, the video signal processing device may construct two reference sample groups based on the average value of luminance reference samples and utilize each reference sample group.

[0191] The Gradient Linear Model (GLM) is a method that predicts color difference signals by constructing a model that additionally incorporates the gradient between a luminance sample corresponding to a color difference sample and surrounding luminance samples adjacent to it, in addition to linear models such as CCLM.

[0192] Prediction methods that utilize the correlation between different signals, such as CCLM, MMLM, CCCM, and GLM, can be called Cross-Component Prediction (CCP). In other words, a method of predicting another signal (which can be a chrominance signal, such as Cb or Cr) from a single signal (e.g., a luminance signal) can be called Cross-Component Prediction (CCP).

[0193] The CCP merge method is a method that predicts the color difference block of the current block using CCP models (such as CCLM, MMLM, and CCCM) used in neighboring blocks.

[0194] The encoding modes (prediction modes) described in this specification may be described by omitting the term "mode" or by using the term "method" instead of "mode." For example, a CCLM mode may be described as a CCLM method or CCLM.

[0195] In independent scalar quantization, the input coefficient t k The restored coefficient t' for k is the related quantization index q k It depends only on . 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 It may be a value including quantization error, and may differ or be the same depending on the quantization parameter. Here, t' k It can be named the restored transformation coefficient or the inverse quantized transformation coefficient, and the quantization index can also be named the quantized transformation coefficient.

[0196] In Uniform Reconstruction Quantizers (URQ), the reconstructed coefficients are arranged at equal intervals. The distance between two adjacent reconstructed values ​​can be called the quantization step size. The reconstructed values ​​may include zero, and the entire set of available reconstructed values ​​can be uniquely defined according to the quantization step size. The quantization step size may vary depending on the quantization parameter.

[0197] In conventional methods, quantization reduces the set of acceptable reconstructed transformation coefficients, and the number of elements in this set can be finite. Consequently, there are limitations in minimizing the average error between the original image and the reconstructed image. Vector quantization can be used as a method to minimize this average error.

[0198] A simple form of vector quantization method used in video encoding is sign data hiding. This is a method in which the encoder does not encode the sign for a single non-zero coefficient, and the decoder determines the sign for that coefficient based on whether the sum of the absolute values ​​of all coefficients is even or odd. To achieve this, at least one coefficient in the encoder can be increased or decreased by '1', and at least one coefficient can be selected and adjusted to be optimal in terms of the cost of rate distortion. As an example of implementation, a coefficient having a value close to the boundary of the quantization interval can be selected.

[0199] Another vector quantization method is Trellis-Coded Quantization, which is utilized in video encoding as an optimal path search technique to obtain optimized quantization values ​​in dependent quantization. In block units, quantization candidates for all coefficients within a block are placed on a trellis graph, and the optimal trellis path between the optimized quantization candidates is searched while considering the cost of rate distortion. Specifically, dependent quantization applied in video encoding can be designed so that the set of acceptable restored transform coefficients depends on the value of the transform coefficient preceding the current transform coefficient in the restoration order. In this case, by selectively using multiple quantizers based on the transform coefficient, the average error between the original image and the restored image is minimized, thereby increasing encoding efficiency.

[0200] Among intra-prediction coding techniques, the Matrix Intra Prediction (MIP) method is a matrix-based intra-prediction method that, unlike prediction methods that derive directionality from pixels of neighboring blocks adjacent to the current block, obtains a prediction signal by utilizing predefined matrix and offset values ​​for pixels to the left and top of neighboring blocks.

[0201] To derive the intra-mode derivation of the current block, an intra-mode derivation derived from the surrounding pixels of a template—which is an arbitrary region adjacent to the current block that has been restored—can be used for the restoration of the current block. First, the decoder generates a prediction template for the template using surrounding pixels (references) adjacent to the template, and the intra-mode derivation that generates the prediction template most similar to the already restored template can be used for the restoration of the current block. This method can be called TIMD (Template intra-mode derivation).

[0202] The TIMD merge mode is a mode used in the current block by inheriting TIMD information from neighboring blocks encoded in TIMD or TIMD merge mode. The TIMD information may be at least one of the following: an intra-prediction directionality mode, information on whether to apply a weighted average, weight information for each intra-prediction mode, and transformation type information. The video signal processing device may construct a TIMD merge list using the TIMD information used in neighboring blocks, and the video signal processing device may add a predetermined maximum number of TIMD information derived from neighboring blocks to the TIMD merge list in order from the closest location to the current block to the furthest location. Here, the predetermined maximum number may be a positive integer greater than or equal to 1, and may be 5. Next, the video signal processing device may rearrange the TIMD merge list based on the template cost and then use the candidate with the minimum cost as the TIMD mode for the current block. And, if the current block is encoded in TIMD merge mode, the video signal processing device may implicitly use the DST7 transform for the residual signal when the size of the current block is 4 or greater and 16 or less, and otherwise use a transform type derived from a neighboring block. Here, the transform type derived from a neighboring block may be transform type information within the TIMD candidate for the current block determined from the TIMD merge list.

[0203] Generally, 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. In this case, the bit amount of information regarding the prediction mode may be about 10% of the total bitstream size. To reduce the bit amount of information regarding 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 the restoration of the current block by utilizing the characteristics of surrounding blocks, and can restore the current block using the derived intra prediction mode. In this case, to derive the intra prediction mode, the decoder may use a method of inferring directional information by applying a Sobel filter in the horizontal and vertical directions to each surrounding pixel adjacent to the current block, and then mapping that directional information to the intra prediction mode. The method by which the decoder derives the intra prediction mode using surrounding blocks can be described as DIMD (Decoder-side intra mode derivation).

[0204] If the current block is a luminance block, the video signal processing device can derive an intra prediction mode through the DIMD and TIMD methods. If the current block is a chrominance block, since there is an already restored luminance block corresponding to the chrominance block, the video signal processing device can derive an intra prediction mode by applying the DIMD and TIMD methods using the restored luminance block, and then use the derived intra prediction mode as the intra prediction mode for the chrominance block. That is, the video signal processing device may derive directional information when the current block is a luminance block, and may not derive directional information when the current block is a chrominance block, and may apply the directional information found in the luminance block to the chrominance block. This mode can be referred to as the "DIMD Chroma" mode or the "TIMD Chroma" mode.

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

[0206] The surrounding blocks may be blocks of spatial location or blocks of temporal location. A surrounding block spatially adjacent to the current block may be at least one of the Left (A1) block, Left Below (A0) block, Above (B1) block, Above Right (B0) block, or Above Left (B2) block. A surrounding block temporally adjacent to the current block may be a block containing the top-left pixel position of the bottom-right (BR) block of the current block in the corresponding collocated picture. If the surrounding block temporally adjacent to the current block is encoded in intra mode or if the surrounding block temporally adjacent to the current block exists in an unusable location, a block containing the horizontal and vertical center (Center, Ctr) pixel position of the current block in the collocated picture corresponding to the current block may be used as the temporal surrounding block. Motion candidate information derived from a corresponding picture can be referred to as TMVP (Temporal Motion Vector Predictor). Only one TMVP can be derived from a single block, or a single block can be divided into multiple sub-blocks, and a TMVP candidate can be derived for each sub-block. The method of deriving TMVP at the sub-block level can be referred to as sbTMVP (sub-block Temporal Motion Vector Predictor).

[0207] Whether the methods described herein may be applied may be determined based on at least one of the following information: slice type information (e.g., whether it is an I slice, P slice, or B slice), whether it is a tile, whether it is a sub-picture, 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, and temporal hierarchy according to the reference order and hierarchy. The information used to determine whether the methods described herein may be applied may be information agreed upon in advance between the decoder and the encoder. Additionally, such information may be determined according to profiles and levels. Such information may be expressed as variable values, and the bitstream may contain information regarding variable values. That is, the decoder may determine whether the methods described above are applied by parsing information regarding variable values ​​included in the bitstream. For example, whether the methods described above are applied may be determined based on the horizontal length or vertical length of the coding unit. The methods described above may be applied if the width or height is 32 or greater (e.g., 32, 64, 128, etc.). Additionally, the methods described above may be applied if the width or height is less than 32 (e.g., 2, 4, 8, 16). Additionally, the methods described above may be applied if the width or height is 4 or 8.

[0208] FIG. 8 illustrates a method for determining a reference pixel line based on a template according to one embodiment of the present specification.

[0209] The method for determining the optimal reference pixel line for the current block (for the restoration of the current block) based on the template below is described. Here, the reference pixel line may have the same meaning as the reference sample line.

[0210] Referring to FIG. 8, the video signal processing device can construct a reference template using reference pixel lines adjacent to the current block. The video signal processing device can generate prediction samples for the location of the reference template using reference pixel lines 1, 2, 3..., etc. The video signal processing device can calculate the cost between the generated prediction samples and the samples of the reference template. At this time, the cost can be calculated through methods 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. Additionally, the encoder can rearrange the calculated costs in ascending order, construct 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 construct a list of reference pixel lines through the method described above, parse the index of the optimal reference pixel line included in the bitstream, and generate prediction samples using the reference pixel line indicated by the index. As described in this specification, a method for a video signal processing device to determine a reference pixel line based on a template may be described as a Template-based Multiple Reference Line (TMRL) method or a TMRL intra-prediction method. When calculating the template cost, the video signal processing device may use any one of SAD, SATD, MR-SAD, and MR-SATD.SAD (Sum of Absolute Difference) is the sum of absolute values ​​of differences between samples, SATD (Sum of Absolute Transformed Difference) is the sum of absolute values ​​of transformed differences between samples, MR-SAD (Mean Removal SAD) is the sum of absolute values ​​of differences between samples minus the mean, and SATD (Mean Removal SATD) is the sum of absolute values ​​of transformed differences between samples minus the mean. Here, various transformations may be used, and as an example, a Hadamard transformation with low complexity may be used.

[0211] FIG. 9 is a diagram showing block vectors related to an IBC encoding method according to one embodiment of the present specification.

[0212] The IBC encoding method (IBC mode) is a method that finds the part most similar to the current block (reference block) within an already restored area of ​​the current picture and uses the reference block as the prediction block for the current block. In this case, the encoder can generate a bitstream containing information related to the block vector, which is the distance between the current block and the reference block. The decoder can parse the information related to the block vector contained in the bitstream to calculate or set the block vector for the current block. The IBC encoding method can be applied to the chrominance block. In the chrominance block, instead of finding a new block vector, the block vector of the luminance block corresponding to the chrominance block can be used as the block vector for the chrominance block; this encoding method can be referred to as the DBV (Direct Block Vector) mode.

[0213] The RRIBC (Reconstruction-Reordered IBC) encoding mode can be used in IBC blocks (blocks to which the IBC encoding method is applied). RRIBC can consist of vertical flips and horizontal flips. In blocks to which RRIBC is applied, the reconstructed block is flipped according to the RRIBC type of the current block. The encoder may flip the original block to be encoded before finding the part most similar to the current block in the reference picture. That is, the most similar part in the reference picture is found using the flipped original block. Therefore, the prediction block uses the unflipped block, and the residual block may also be the unflipped block. The decoder may flip the final reconstructed block according to the RRIBC type of the current block.

[0214] Figure 10 shows a method for predicting the current block using RRIBC in the horizontal direction.

[0215] Figure 11 shows a method for predicting the current block using RRIBC in the vertical direction.

[0216] In FIGS. 10 and 11, (Xn, Yn) represents the center position of the surrounding blocks, and (Xc, Yc) represents the center position of the current block. BV n h , BV n v represent the horizontal block vector and vertical block vector of the surrounding block, respectively, and BV C h , BV C v and represent the horizontal block vector and vertical block vector of the current block, respectively. As shown in Fig. 10, when the RRIBC type of the current block is horizontal, BV C h is 2 * (Xn - Xc) + BV n hIt can be calculated as, and as shown in Fig. 11, if the RRIBC type of the current block is in the vertical direction, BV C v is 2 * (y n - y c ) + BV n v It can be calculated as. In this case, BV n h , BV n v Since it uses the restored block, BV n h , BV n v The sign of can be negative.

[0217] When the current block is encoded in RRIBC, the video signal processing device can determine the optimal block vector by constructing a block vector candidate list. In this case, the video signal processing device may construct the block vector candidate list according to the RRIBC type of the current block. For example, if the RRIBC type of the current block is horizontal, the video signal processing device may construct the block vector candidate list using only the surrounding blocks of the current block encoded in horizontal RRIBC. Additionally, the video signal processing device may construct the block vector candidate list regardless of the RRIBC type of the current block. For example, if the RRIBC type of the current block is horizontal, the block vector candidate list may be constructed using not only the surrounding blocks of the current block encoded in horizontal RRIBC, but also the surrounding blocks of the current block encoded in vertical RRIBC, / or blocks encoded in general motion, and / or blocks encoded in block vectors.

[0218] When a video signal processing device predicts the current block using general motion, the device may construct a motion candidate list based on whether the surrounding blocks of the current block are encoded in IBC mode or RRIBC mode. In this case, if the surrounding blocks of the current block are encoded in RRIBC mode, the device may construct the motion candidate list by additionally considering the RRIBC type. For example, when the video signal processing device constructs a motion candidate list for the current block, if the encoding mode of the surrounding blocks is RRIBC mode and the RRIBC type is vertical or horizontal, the block vectors of the surrounding blocks may not be included in the motion candidate list. Alternatively, when the video signal processing device predicts the current block using general motion, the device may construct the motion candidate list regardless of the encoding mode of the surrounding blocks of the current block. That is, the video signal processing device may construct a motion candidate list regardless of whether the surrounding blocks of the current block are encoded in IBC mode or RRIBC mode. For example, when a video signal processing device constructs a motion candidate list for a current block, it may include the block vector of a surrounding block in the motion candidate list even if the encoding mode of the surrounding block of the current block is IBC mode and the RRIBC type is vertical or horizontal direction.

[0219] The RRIBC encoding method is effective for images with symmetrical characteristics. Symmetrical characteristics can refer to perfect horizontal (or vertical) symmetry, where the current block and the reference block are separated by equal distances along a single central axis. The vertical (or horizontal) direction (axis of symmetry) of the current block may lie on the same line as the vertical (or horizontal) direction (axis of symmetry) of the reference block. In this case, the block vector in the vertical (or horizontal) direction may be set to '0', and the block vector in the horizontal direction may be set to any negative value other than '0'. The current block and the reference block may be configured symmetrically, differing by different distances along a single central axis, and the current block and the reference block may lie on different vertical lines. In this case, the block vector in the vertical direction may be set to any negative value other than '0'. That is, a video signal processing device can encode or decode the current block using a symmetric block in which both the horizontal and vertical directions have block vector values ​​of any negative value other than '0'.

[0220] FIG. 12 shows a block vector of a block encoded in Intra TMP mode according to one embodiment of the present specification.

[0221] Referring to FIG. 12, the Intra TMP method (Intra TMP encoding mode) 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 reference template within an already restored area (reference block) in the current picture, and then uses the reference block (Ref. luma block in FIG. 12) as a prediction block for the current block. At this time, there may be one or more block vectors used to generate a prediction block for the current luminance block, and FIG. 12 shows the case where there are two block vectors. The video signal processing device can generate a prediction block for the luminance block by weighted averaging the reference blocks predicted from the two block vectors of the current luminance block. This can be referred to as a fusion mode. In the case of a chrominance block, the video signal processing device can derive a block vector from the luminance block corresponding to the chrominance block and then use the block vector to generate a chrominance prediction block. There may be one or more block vectors used to generate a prediction block for the current chrominance block, and FIG. 12 shows the case where there are two block vectors for the chrominance block. In this case, the block vector of the chrominance block may be the same as or different from the block vector derived from the luminance block. In Intra TMP mode, the video signal processing device derives filter coefficients using the correlation between samples around the reference block indicated by the block vector and samples around the current block, and can apply filtering to the reference block indicated by the block vector using the derived filter coefficients. The video signal processing device can use the filtered reference block as the prediction block for the current block. This can be referred to as Intra TMP filtering mode. In Intra TMP mode, the video signal processing device can apply compensation to the current prediction block through the block vector, similar to the LIC method using motion information.

[0222] If the current block is divided into two regions using diagonal lines, such as in GPM mode, and both divided regions are predicted using Intra Prediction Mode (or IBC mode, or Intra TMP), this can be called Spatial GPM (SGPM) mode. Therefore, the combination of modes that can be used for the two divided regions can be one of (Intra Prediction Mode, Intra Prediction Mode), (Intra Prediction Mode, IBC Mode), (IBC Mode, Intra Prediction Mode), or (IBC Mode, IBC Mode). Additionally, in the above combinations, IBC mode can be changed to Intra TMP mode, and a combination of (IBC mode, Intra TMP mode) may also be possible.

[0223] FIG. 13 illustrates a case where the current block is divided by a GPM mode according to one embodiment of the present specification, and the divided area is encoded in an IBC mode.

[0224] The current block can be encoded or decoded in IBC-GPM mode. IBC-GPM mode may refer to a mode in which the current block is divided using GPM mode, and the divided regions are encoded in intra prediction mode or IBC prediction mode. Referring to Fig. 13, the current block can be divided into two regions based on the dotted line. At this time, one of the divided regions can be encoded in intra prediction mode, and the other can be encoded in IBC prediction mode. For example, among the divided regions, the left region can be encoded in intra prediction mode, and the right region can be encoded in IBC prediction mode. At this time, the region encoded in IBC prediction mode can be encoded in Intra TMP prediction mode, and this can be described as IntraTMP-GPM mode.

[0225] FIG. 14 illustrates a method in which a current block is encoded in IBC-CIIP mode according to one embodiment of the present specification.

[0226] The video signal processing device can predict the current block using a weighted average between the block predicted in intra mode and the block predicted in IBC mode, which can be referred to as the IBC-CIIP mode. In this case, the block predicted in Intra TMP mode may be used instead of the block predicted in IBC mode, which can be referred to as the IntraTMP-CIIP mode.

[0227] The video signal processing device can obtain a restored luminance block by adding the residual signal for the luminance prediction block of the current block and the luminance block, and can construct a CCP model using the correlation between the restored luminance block and the luminance prediction block. At this time, the CCP model can be one of CCLM, MMLM, GLM, CCCM, MM-CCCM, GL-CCCM, CCCM-ND, and CCCM-MDF. A first chrominance prediction block with the CCP model applied can be generated by applying the CCP model derived from the luminance block to the chrominance prediction block. A final chrominance block can be generated by adding the error signal for the first chrominance prediction block and the chrominance block.

[0228] If the current luminance block is encoded in Intra TMP or IBC mode, the video signal processing device can derive a CCP model through the correlation between the luminance block and the chrominance block of the reference block indicated by the block vector of the current luminance block. Using the derived CCP model and the currently restored luminance block, Cb and Cr prediction blocks, which are chrominance prediction blocks for the current block, can be generated. This is referred to as BVG CCP (block vector guided cross component prediction). The CCP model may include at least one of CCLM, MMLM, GLM, MM-GLM, CCCM, MM-CCCM, GL-CCCM, GL-MM-CCCM, CCCM-ND, MM-CCCM-ND, CCCM-MDF, MM-CCCM-MDF, and Chroma Fusion. If the CCCM model is applied, it may be referred to as BVG CCCM. If the GL-CCCM model is applied, it may be referred to as BVG GL-CCCM. In addition, various CCP models can be applied to BVG CCPs.

[0229] The types of CCP models may include at least one of CCLM, MMLM, GLM, MM-GLM, CCCM, MM-CCCM, GL-CCCM, MM-GL-CCCM, CCCM-ND, MM-CCCM-ND, CCCM-MDF, MM-CCCM-MDF, Chroma Fusion, BVG-CCCM, and CCP Merge. An MMLM may be composed of two CCLMs. If the types of CCP models between CCP models are different, they may be considered different CCP models. If the types of CCP models between CCP models are the same but the parameters between CCP models are different, they may be considered different CCP models. If the number of CCP models between CCP models is different, for example, if the first CCP model is composed of one CCLM and the second CCP model is composed of two CCLMs, they may be considered different CCP models. The types of CCP models may be referred to as CCP modes.

[0230] In chroma fusion (CF), the video signal processing unit can predict the chroma difference signal through a weighted average between the chroma difference block predicted via an intra-prediction mode and the current luminance block, without using a linear model (LM) mode. In this case, the weight parameters can be derived using the CCCM method.

[0231] BVG CCP (Block Vector Guided Cross Component Prediction) may be a method for deriving a CCP model through the correlation between the luminance block and the chrominance block of a reference block indicated by the block vector of the luminance block when the current luminance block is encoded in Intra TMP or IBC mode. Using the derived BVG CCP model and the currently restored luminance block, Cb and Cr prediction blocks, which are chrominance prediction blocks for the current block, can be generated.

[0232] In a Gradient Linear Model (GLM), the video processing unit constructs the model by additionally reflecting the gradient between the luminance sample corresponding to the color difference sample in the linear model and the surrounding luminance samples adjacent to that luminance sample, and can predict the color difference signal through the model.

[0233] The CCP model used to predict color difference blocks constructs a list of CCP candidates using the CCP models used in the surrounding blocks of the current block, and can derive the optimal CCP candidate from the list. This can be referred to as CCP merge mode.

[0234] FIG. 15 shows an example of a reference region and filter shape used to derive CCCM parameters according to an embodiment of the present specification.

[0235] CCCM (Convolutional Cross-Component Intra Prediction Model) is a method for predicting chrominance signals using a non-linear model constructed by utilizing the high correlation between a luminance signal and a chrominance signal located at the same position as the luminance signal. Fig. 15(a) shows the positional relationship between reference samples (vertical diagonal lines, 1520) for applying CCCM to the current prediction block (diagonal diagonal lines, 1510) and side samples (horizontal diagonal lines) required when applying a cross-shaped filter. The current prediction block (MxN) can be composed of reference samples in the top 6 rows (2Mx6), reference samples in the left 6 rows (6x2N), and 6x6 reference samples in the top-left row, with a chroma to luminance sample count ratio of 1:1. When a video signal processing device applies a cross-shaped sample filter (Fig. 15(b)) for CCCM to the chroma sample prediction equation (Fig. 15(c)), cases occur where the reference sample area is exceeded. In this case, the additional samples required may be side samples. The chroma sample prediction relationship of Fig. 15(c) can be applied to each chroma component (i.e., Cb, Cr). The sample at position C (Center) in Fig. 15(b) may be a luminance sample corresponding to the Cb and Cr chroma samples, and N (North), E (East), S (South), and W (West) may be luminance samples adjacent to the luminance sample at position C. Side samples may be additionally required one sample at a time for regions other than the reference sample, depending on the position of the C sample. If the sample value at the position of the side sample is unavailable, the sample value at the unavailable position may be padded with the C sample value. The P value in Fig. 15(c) may be a nonlinear term. The P value can be calculated as P = ( C*C + midVal ) >> bitDepth, and in the case of 10-bit content, P = ( C*C + 512 ) >> 10.In FIG. 15(c), the value of B can be an integer offset value as a bias value. The value of B can be an intermediate value of bitDepth. For 10-bit content, the value of B can be 512.

[0236] MM-CCCM (multi-model CCCM) is a method that derives two CCCM parameters based on the average value of a reference area (or restored current luminance block).

[0237] GL-CCCM (Gradient and location based convolutional cross-component model) is an additional CCCM mode that utilizes gradient and location information. In the case of the existing CCCM mode, the video signal processing unit can derive a chrominance sample for the current block using the luminance sample at the location corresponding to the chrominance sample to be predicted, four samples surrounding that luminance sample, and coefficient information. In the case of the GL-CCCM mode, the video signal processing unit can derive a chrominance sample for the current block by reflecting the vertical and horizontal differences of the luminance sample at the location corresponding to the chrominance sample to be predicted and eight samples surrounding that luminance sample, and also using the location value of the current luminance sample and its coefficient information.

[0238] When CCCM mode is applied, the video signal processing device may apply downsampling filters to match the resolution difference between the luminance block and the chrominance block. This is to reduce the resolution of the luminance block to that of the chrominance block. The mode that applies downsampling filters can be described as CCCM-MDF (CCCM with multiple downsampling filters).

[0239] When an inter-coding mode is applied to the current block, the video signal processing device may derive linear and non-linear models between a luminance prediction block (Y') derived using motion information of the current block and a first chrominance prediction block (Cb', Cr') derived using motion information of the current block (Derive filter), generate a restored luminance block of the current block using the luminance residual block of the current block, and generate a second chrominance prediction block of the current block by applying the derived linear and non-linear models to the restored luminance block of the current block (Apply filter). Subsequently, the video signal processing device may generate the final chrominance block (Cb, Cr) of the current block by adding the chrominance residual block to the second chrominance prediction block of the current block predicted using the linear and non-linear models. This method may be described as a cross-component residual model (CCRM). CCRM, Inter CCCM, and Inter CCP may have the same meaning.

[0240] The types of CCP models may include CCLM, MMLM, GLM, MM-GLM, CCCM, MM-CCCM, GL-CCCM, MM-GL-CCCM, CCCM-ND, MM-CCCM-ND, CCCM-MDF, MM-CCCM-MDF, Chroma Fusion, BVG-CCCM, CCP Merge, etc. MMLM may consist of two CCLMs. If the types of CCP models differ between CCP models, they can be considered different CCP models. If the types of CCP models are the same but the parameters differ between CCP models, they can be considered different CCP models. If the number of CCP models differs between CCP models (for example, if the first CCP model consists of one CCLM and the second CCP model consists of two CCLMs), they can be considered different CCP models. The type of a CCP model can be referred to as a CCP mode.

[0241] The video signal processing unit can construct a CCP list using a CCP model derived from the surrounding blocks of the current block, and then predict the chrominance block of the current block using the CCP list; this is referred to as the CCP merge mode. In this case, the surrounding blocks may be one or more of the following: surrounding blocks at spatially adjacent locations, surrounding blocks at spatially non-adjacent locations, temporal surrounding blocks corresponding to the position of the current block in a reference picture, or temporal surrounding blocks corresponding to a position moved by motion information related to the current block in the reference picture. Furthermore, when deriving the CCP model from the surrounding blocks, the CCP model and CCP model parameters used in the surrounding blocks can be added to the list. Additionally, when deriving the CCP model from the surrounding blocks, newly derived CCP models and CCP model parameters can be added to the list using the correlation between the luminance and chrominance of the surrounding blocks. Moreover, CCP models and model parameters derived from a CCP model table stored in a separate memory can be added to the CCP list. Furthermore, newly derived CCP models can be added to the CCP list using combinations of CCP candidates within the CCP list. Additionally, a newly derived CCP model can be added to the CCP list by modifying the model parameters of a CCP candidate within the CCP list. The current block can predict the current color difference block using the model parameters of the optimal CCP candidate from the CCP list. Furthermore, the current block can predict the current color difference block by utilizing only the model type of the optimal CCP candidate from the CCP list, newly deriving the CCP model parameters from adjacent samples of the current block, and then using the newly derived CCP model parameters.

[0242] To improve coding efficiency, instead of coding the aforementioned residual signal as is, a method may be used in which the transformation coefficient values ​​obtained by transforming the residual signal are quantized, and the quantized transformation coefficients are coded. As described above, the transformation unit can obtain transformation coefficient values ​​by transforming the residual signal. In this case, the residual signal of a specific block may be distributed across the entire range of the current block. Accordingly, coding efficiency can be improved by concentrating energy in the low-frequency range through frequency domain transformation of the residual signal.

[0243] The encoder may acquire at least one residual block containing residual signals for the current block. The residual block may be either the current block or blocks partitioned from the current block. In this specification, the residual block may be described as a residual array or a residual matrix containing residual samples of the current block. Additionally, in this specification, the residual block may represent a block of the same size as the size of the conversion unit or the conversion block.

[0244] An encoder may transform a residual block using a transformation kernel. The transformation kernel used for transforming the residual block may be a transformation kernel having separable characteristics of vertical transformation and horizontal transformation. In this case, the transformation for the residual block may be performed by separating it into a vertical transformation and a horizontal transformation. For example, the encoder may perform a vertical transformation by applying a transformation kernel in the vertical direction of the residual block. Additionally, the encoder may perform a horizontal transformation by applying a transformation kernel in the horizontal direction of the residual block. In this specification, the term transformation kernel may be used to refer to a set of parameters used for transforming a residual signal, such as a transformation matrix, a transformation array, a transformation function, or a transformation. According to one embodiment, 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. That is, before performing the first transformation, a transformation method for the vertical and horizontal directions can be derived using at least one of the current block's intra prediction mode, encoding mode, transformation method parsed from the bitstream, and size information of the current block. Additionally, to reduce computational complexity during the transformation process for large blocks, a process can be performed in which only the low-frequency region is retained and the high-frequency region is treated as '0'. This process is called high-frequency zeroing, and the transformation size during the actual first transformation can be set for this zeroing. In the high-frequency zeroing process, the low-frequency region can be set to an arbitrary fixed size; for example, the horizontal or vertical size can be a combination of 4, 8, 16, 32, etc.

[0245] The encoder can transmit the transformed block converted from the residual block to the quantization unit for quantization. At this time, the transformed block may include a plurality of transformation coefficients. Specifically, the transformed block may be composed of a plurality of transformation coefficients arranged in a two-dimensional array. The size of the transformed block may be the same as that of the residual block, either the current block or a block divided from the current block. The transformation coefficients transmitted to the quantization unit may be expressed as quantized values.

[0246] Additionally, the encoder may perform an additional transformation before the transformation coefficients are quantized. The aforementioned transformation method may be referred to as a primary transform, and the additional transformation may be referred to as a secondary transform. The secondary transform may be optional for each residual block. According to one embodiment, the encoder may improve coding efficiency by performing a secondary transform on regions where it is difficult to concentrate energy in the low-frequency region using only the primary transform. For example, a secondary transform may be added for blocks where residual values ​​appear significantly in directions other than the horizontal or vertical direction of the residual block. Residual values ​​of an intra-predicted block may have a higher probability of changing in directions other than the horizontal or vertical direction compared to residual values ​​of an inter-predicted block. Accordingly, the encoder may additionally perform a secondary transform on the residual signals of the intra-predicted block. Additionally, the encoder may omit the secondary transform for the residual signals of the inter-predicted block. High-frequency zeroing from the first conversion can also be performed during the second conversion process.

[0247] As another example, whether to perform a second transformation may be determined based on the size of the current block or the remaining block. Additionally, transformation kernels of different sizes may be used depending on the size of the current block or the remaining block. For example, an 8x8 second transformation may be applied to a block where the length of the shorter side (width or height) is greater than or equal to a first set length. Additionally, a 4x4 second transformation may be applied to a block where the length of the shorter side (width or height) is greater than or equal to a second set length and smaller than the first set length. In this case, the first set length may be a value greater than the second set length, but the present disclosure is not limited thereto. Furthermore, unlike the first transformation, the second transformation may not be performed separately into a vertical transformation and a horizontal transformation. Such a second transformation may be referred to as a Low Frequency Non-Separable Transform (LFNST).

[0248] Furthermore, in the case of video signals in specific regions, high-frequency band energy may not decrease even after frequency conversion due to abrupt changes in brightness. Consequently, compression performance through quantization may be degraded. Additionally, if conversion is performed on regions where residual values ​​are sparse, encoding and decoding times may increase unnecessarily. Accordingly, conversion for residual signals in specific regions may be omitted. Whether to perform conversion on residual signals in specific regions can be determined by syntax elements related to the conversion of those regions. For example, the syntax elements may include transform skip information. The transform skip information may be a transform skip flag. If the transform skip information for a residual block indicates a transform skip, the transformation for that residual block is not performed. In this case, the encoder can immediately quantize the residual signal for which the transformation was not performed.

[0249] The aforementioned transformation-related syntax elements may be information parsed from a video signal bitstream. A decoder can obtain the transformation-related syntax elements by entropy decoding the video signal bitstream. Additionally, an encoder can generate a video signal bitstream by entropy coding the transformation-related syntax elements.

[0250] The decoder can parse the transmitted bitstream to obtain encoding information necessary for decoding. At this time, information related to the conversion process includes index information for first and second conversion types and quantized conversion coefficients. The inverse conversion unit can obtain a residual signal by performing an inverse conversion on the inverse quantized conversion coefficients. First, the inverse conversion unit can detect whether an inverse conversion is performed for a specific region from the conversion-related syntax elements of that region. According to one embodiment, if the conversion-related syntax elements for a specific conversion block indicate a conversion skip, the conversion for that conversion block may be omitted. In this case, both the first inverse conversion and the second inverse conversion for the conversion block may be omitted. Additionally, the inverse quantized conversion coefficients may be used as a residual signal. For example, the decoder can use the inverse quantized conversion coefficients as a residual signal to restore the current block. Alternatively, a second inverse transform may be performed and a first inverse transform may be omitted, and the value of the second inverse transform may be used as a residual signal. The aforementioned first inverse transform represents the inverse transform for the first transform and may be referred to as the inverse first transform. The second inverse transform represents the inverse transform for the second transform and may be referred to as the inverse second transform or inverse LFNST. In the present invention, the first (inverse) transform may be referred to as the first (inverse) transform, and the second (inverse) transform may be referred to as the second (inverse) transform.

[0251] FIG. 16 shows a type of conversion kernel that can be used for video coding according to one embodiment of the present specification.

[0252] Figure 16 shows the formulas for the DCT-II, DCT-V (discrete cosine transform type-V), DCT-VIII (discrete cosine transform type-VIII), DST-I (discrete sine transform type-I), and DST-VII kernels applied to MTS. DCT and DST can be expressed as functions of cosine and sine, respectively. When the basis function of the transform kernel for the number of samples N is expressed as Ti(j), index i represents the index in the frequency domain, and index j represents the index within the basis function. That is, as i decreases, it represents a low-frequency basis function, and as i increases, it represents a high-frequency basis function. When the basis function Ti(j) is expressed as a two-dimensional matrix, it can represent the j-th element of the i-th row. Since all the transform kernels illustrated in Figure 16 have separable characteristics, transformations can be performed on the residual signal X in both the horizontal and vertical directions. In other words, if we denote the residual signal block as X and the transformation kernel matrix as T, the transformation for the residual signal X can be represented as TXT'. Here, T' represents the transpose of the transformation kernel matrix T. Since DCT and DST are decimal forms rather than integers, implementing them directly in hardware encoders and decoders poses a burden. Therefore, the decimal transformation kernel must be approximated into an integer form through scaling and rounding. The integer precision of the transformation kernel can be determined as 8-bit or 10-bit, but if precision is lowered, encoding efficiency may decrease. Although the orthonormal properties of DCT and DST may not be maintained due to the approximation, the resulting loss in encoding efficiency is not significant; therefore, approximating the transformation kernel into an integer form is advantageous in terms of hardware encoder and decoder implementation.An Identity Transform (IDTR) is a transformation in which the result is the original state itself; it is also called an identity transformation. Generally, an identity transformation constructs a transformation matrix by setting a '1' at positions where the row and column values ​​are identical. However, in this context, the identity transformation uses arbitrary fixed values ​​instead of '1' to equally increase or decrease the value of the input residual signal.

[0253] In the aforementioned first-order MTS transformation, the transformation is calculated by applying a transformation kernel to the vertical and horizontal directions of the error block, respectively, so it can be described as a separable transform method. On the other hand, in the aforementioned second-order LFNST transformation, the transformation is calculated by applying the transformation kernel only once, without applying a transformation kernel to the vertical and horizontal directions, so it can be described as a non-separable transform method. Furthermore, since the aforementioned second-order transformation is applied additionally to the first-order transformed transformation coefficients of the block to which the DCT-2 transformation has been applied, it can be described as a two-stage transformation technique. Although the aforementioned second-order transformation offers high encoding efficiency, it has the disadvantage of being complex because a total of three transformation kernels are applied. To reduce this complexity, the NSPT (Non-separable primary transform) method, which applies the transformation using only the second-order transformation method, can be applied. The NSPT transformation method is a non-separable transformation method, which is calculated by applying the transformation kernel only once, rather than applying transformation kernels to the vertical and horizontal directions of the error block separately. In a video signal processing device, the error block of the current block can be transformed or inversely transformed using one of the transformation methods among MTS, DCT2 + LFNST, and NSPT.

[0254] NSPT transformation may be a transformation method that replaces the existing DCT2 + LFNST transformation method. For a transformation block with a size equal to or smaller than 16x16, any one of the following kernels may be applied depending on the size of the transformation 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). Similar to LFNST, NSPT consists of 35 sets of transformation kernels, each set consisting of 3 candidates. The encoder can derive a set of transformation kernels according to the intra-prediction mode, and then generate and signal a bitstream containing information on the index for the optimal candidate among the 3 candidates. The decoder can parse the information on the signaled index, then inversely transform the current transformation coefficients using the transformation kernel candidate indicated by the index information from the set of transformation kernels derived using the intra-prediction mode, and obtain a residual block. Zero-out may not be performed on a 4x4 block to which NSPT is applied. Additionally, the number of coefficients zeroed out may vary depending on the size of the NSPT kernel. For example, a 32x20 NSPT may be applied to a 4x8 block or an 8x4 block. Therefore, out of the 32 transformation coefficients, the remaining 12 coefficients may be zeroed out, excluding only 20 transformation coefficients.

[0255] FIG. 17 shows a conversion set table for LFNST and NSPT conversions according to one embodiment of the present specification.

[0256] There may be 35 types of transform sets used in LFNST and NSPT transforms, and they may 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. 17. In addition, the LFNST and NSPT transform sets may vary depending on the intra-prediction mode, information on whether the current block is a luminance block or a chrominance block, the width and height of the current block, and whether the intra-prediction directional mode of the current block is an extended angle mode. For each transform set, there may be an arbitrary number of transform matrices. Here, the arbitrary number may be an integer greater than or equal to 1, or it may be 3. The encoder may signal by including index information for the optimal transform matrix among the multiple transform matrices within the transform set in the bitstream. The decoder may parse the index for the optimal transform matrix and then apply the inverse transform using the transform matrix corresponding to the index in the transform set.

[0257] The encoder and decoder can apply a total of three types of transformation kernels, LFNST4, LFNST8, and LFNST16, depending on the size of the transformation block. If the width and height of the current transformation block are greater than or equal to 16, the LFNST16 transformation kernel can be applied. Otherwise, if the width and height of the current transformation block are greater than or equal to 8, the LFNST8 transformation kernel can be applied. Otherwise (if the width and height of the current transformation block are less than 8), the LFNST4 transformation kernel can be applied.

[0258] FIG. 18 illustrates a method for deriving multiple conversion sets and LFNST / NSPT sets according to one embodiment of the present specification.

[0259] Referring to FIG. 18(a), the encoder can select to apply one of MTS, DCT2 + LFNST, or NSPT to the residual block, and can transform the residual block and obtain transformation coefficients based on the selected transformation method. At this time, the encoder can signal by including information about which transformation method was applied in the bitstream. If MTS transformation is applied to the residual block, the transformation coefficients of the residual block can be obtained by applying MTS transformation, and LFNST and NSPT transformations may not be applied. If DCT2 + LFNST transformation is applied to the residual block, the encoder can obtain first-order transformation coefficients by applying DCT2 transformation to the residual block, and obtain second-order transformation coefficients by applying LFNST transformation to the first-order transformation coefficients. At this time, MTS and NSPT transformations may not be applied. When the NSPT transform is applied to the residual block, the video encoder can apply the NSPT transform to the residual block and output transform coefficients, and in this case, the MTS and DCT2 + LFNST transforms may not be applied to the residual block.

[0260] Referring to FIG. 18(b), the decoder parses information regarding which conversion method is applied from the bitstream and, based on the parsed information, determines whether to apply one of the inverse conversion methods among MTS, DCT2 + LFNST, and NSPT to the current conversion coefficient. Then, the decoder performs an inverse conversion on the conversion coefficient based on the determined conversion method and can obtain a residual block. If the MTS conversion is applied to the current conversion coefficient, the decoder can perform an inverse MTS conversion on the conversion coefficient to obtain a residual block, and in this case, the LFNST and NSPT inverse conversions may not be applied. If the DCT2 + LFNST conversion is applied to the second conversion coefficient, the decoder can perform an inverse LFNST conversion on the second conversion coefficient to output a first conversion coefficient, and perform an inverse DCT2 conversion on the first conversion coefficient to obtain a residual block, and in this case, the MTS and NSPT conversions may not be applied. If the NSPT transform is applied to the current transform coefficients, the decoder can obtain the residual block by performing the inverse NSPT transform on the current transform coefficients, in which case the MTS and DCT2 + LFNST transforms may not be applied.

[0261] The video signal processing device can derive a transformation kernel for each of the MTS, LFNST, and NSPT transformations (or inverse transformations) using an intra prediction mode. Additionally, the video signal processing device can determine which transformation (or inverse transformation) among MTS, DCT2 + LFNST, and NSPT is applied. In this case, to determine the transformation, at least one of the following may be used: the width and height of the current block, whether the component of the current block is a luminance component or a chrominance component, whether the current block is a single tree or a dual tree, 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.

[0262] FIG. 19 shows a mapping table according to one embodiment of the present specification.

[0263] FIG. 20 shows a conversion type set table according to one embodiment of the present specification.

[0264] FIG. 21 shows a conversion type combination table according to one embodiment of the present specification.

[0265] FIG. 22 shows a threshold value table for IDT conversion types according to one embodiment of the present specification.

[0266] This describes how to select a set of multiple transforms available for the current block in a video signal processing device.

[0267] 1) First, the video signal processing device can derive the values ​​of nSzIdxW and nSzIdxH based on the size of the current block to map the width and height of the current block to a single variable. nSzIdxW may be the minimum value between 3 and the value obtained by calculating the logarithm of 2 of the width of the current block, discarding the decimal places, and then subtracting by 2. nSzIdxH may be the minimum value between 3 and the value obtained by calculating the logarithm of 2 of the height of the current block, discarding the decimal places, and then subtracting by 2.

[0268] 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 intra-prediction mode expanded from the existing 67 to 131 can be used, reducing the precision to the existing 67 modes.

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

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

[0271] 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 represent the index value of the intra-directional mode. predMode may be determined through the extended angle mode based on the aspect ratio of the current block. The video signal processing unit may clip predMode to a value between 2 and 66. If predMode is greater than the diagonal mode, angle mode 34, the isTrTransposed value may be set to 1, and if predMode is less than or equal to 34, the isTrTransposed value may be set to 0. If predMode is greater than 34, the video signal processing unit resets the value of predMode to the value obtained by subtracting predMode from the value obtained by adding 1 to 67 (the maximum value of the intra-directional mode index). For example, if predMode is 35, the video signal processing device can reset angle mode 35 to angle mode 33(67+1-35(predMode)). If predMode is 66, the video signal processing device can reset angle mode 66 to angle mode 2(67+1-66(predMode)). That is, by making it symmetrical with respect to angle mode 34, which is a diagonal mode, the size of the transformation mapping table in Fig. 19 is reduced by about half.

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

[0273] 5) The video signal processing device can derive nTrSet, which is an index of a set of available transformation types according to a predefined table of FIG. 19, using nSzIdx, which is information on the size of the current block, and nMdIdx, which is information on the intra-directional mode of the current block. FIG. 19 defines an index of a set of transformation types according to the intra-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. 19, nTrSet can be 80, and if the size of the current block is 4x8 and the intra-directional mode of the current block is 13, nTrSet can be '7'.

[0274] 6) The video signal processing device can parse mts_idx included in the bitstream to derive a set of transformation types corresponding to nTrSet from the table of FIG. 20. The transformation types for the vertical and horizontal directions are set differently depending on whether predMode is greater than the diagonal mode, angle mode 34. The gray-shaded vertical columns 0 to 79 of FIG. 20 correspond to nTrSet, and the gray-shaded horizontal columns 0 to 3 correspond to mts_idx. Referring to FIG. 20, if nTrSet is 7 and the value of mts_idx is 3, 22 can be selected from (2, 17, 18, 22). Then, DST1 and DCT5 corresponding to index 22 of the transformation type combination table of FIG. 21 are selected, and the vertical transformation type of the current block can be set to DST1 and the horizontal transformation type to DCT5. The gray-shaded horizontal columns 0 to 24 in FIG. 21 are indices selected through FIG. 20, and the gray-shaded vertical columns 0 to 1 may represent a vertical direction conversion type and a horizontal direction conversion type, respectively. If the in-screen predicted direction mode of the current block is greater than 34, which is a diagonal mode, the vertical and horizontal direction conversion types may be swapped.

[0275] 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 direction conversion type can be reset to the IDT conversion type through the process described below.

[0276] If the absolute difference between the index of the in-frame predicted directional mode of the current block and the index of the horizontal directional mode, 18, is less than an arbitrary predetermined value, the vertical directional transformation type can be reset to the IDT transformation type. If the absolute difference between the index of the in-frame predicted directional mode of the current block and the index of the horizontal directional mode, 50, is less than an arbitrary predetermined value, the horizontal directional transformation type can be reset to the IDT transformation type. In this case, the arbitrary predetermined value is an integer and can be determined based on the width or height of the current block. For example, the arbitrary predetermined value can be determined through the table in FIG. 19. The table in FIG. 22(a) shows a case where the threshold value is set differently whenever the width or height differs by 4, and the table in FIG. 22(b) shows a case where the threshold value is set differently whenever the width or height differs by a factor of 2. When the size of the current block is 16x16, the video signal processing device may not reset the vertical directional transformation type to the IDT transformation type and may maintain the existing transformation type.

[0277] The encoder and decoder can reduce the amount of bits required to encode mts_idx by adaptively changing the number of transformation type sets per block. The encoder and decoder can determine the number of transformation type sets to be 1, 4, or 6 depending on the sum of the absolute values ​​of the transformation coefficients of the current transformation block. If the number of transformation type sets changes, the maximum number of bins for signaling mts_idx may change. If the sum of the absolute values ​​of the transformation coefficients is less than or equal to 6, the number of transformation type sets is 1. Therefore, the encoder may not signal mts_idx. In this case, the decoder may not parse mts_idx. If the sum of the absolute values ​​of the transformation coefficients is greater than 6 and less than or equal to 32, the number of transformation type sets may be 4. If the sum of the absolute values ​​of the transformation coefficients is greater than 32, the number of transformation kernel candidates may be 6. In this case, the encoder can signal mts_idx based on the maximum number of transformation type sets. Additionally, the decoder can parse mts_idx based on the maximum number of transformation type sets.

[0278] If the current block is predicted to be in Inter-Coding mode, the encoder and decoder may use one of four combinations of transform kernel sets, such as {(DST7, DST7), (DST7, DCT8), (DCT8, DST7), (DCT8, DCT8)}. The encoder may signal an index indicating which transform kernel set was used. The decoder may parse the index to determine the transform kernel set to use for the current transform block. If the set transform kernel set is (DST7, DCT8), the encoder and decoder transform or inversely transform the current block using DST7 in the horizontal direction and transform or inversely transform the current block using DCT8 in the vertical direction. For complexity optimization, the encoder and decoder may set the maximum CU size to which Inter MTS can be applied for images larger than 1920x1080 resolution to 32x32. The encoder and decoder set the maximum CU size to which Inter MTS can be applied for images with resolutions smaller than 1920x1080 to 16x16. Therefore, the encoder and decoder can apply DCT2 transformations in the horizontal and vertical directions without applying Inter MTS to transformation blocks larger than 16x16, such as transformation blocks of size 32x32. Additionally, the encoder and decoder can use separable KLT instead of DST7 and DCT8 for transformation and inverse transformation of transformation blocks that are equal to or smaller than 16x16.

[0279] FIG. 23 shows the block boundary and samples around the boundary in a deblocking filtering process according to one embodiment of the present specification.

[0280] Referring to Fig. 23(a), the dotted line between block P and block Q may represent a block boundary. Block boundaries may exist at any given size, and block boundaries may exist at every size of 4.

[0281] FIG. 23(b) shows samples in which filtering is performed based on block boundaries. A video signal processing device can perform deblocking filtering on the currently restored block to mitigate blocking phenomena occurring at block boundaries. The deblocking filtering process may include determining the transform block boundary, determining the sub-block boundary, determining the length of the filter to be filtered, determining the filtering strength (bS), determining the filtering parameters, determining whether to perform filtering, and determining the type of filtering.

[0282] FIG. 24 shows an intra-prediction mode based on an extrapolation filter according to one embodiment of the present specification.

[0283] Specifically, FIG. 24 shows an Extrapolation Filter-Based Intra Prediction (EIP) mode, which is an intra prediction mode based on an extrapolation filter according to one embodiment of the present specification.

[0284] Figure 24 describes how a video signal processing device performs EIP mode.

[0285] Referring to FIG. 24(a), the video signal processing device can derive non-linear model parameters using a template constructed using surrounding samples adjacent to the current block. In this case, there may be three types of templates, and the video signal processing device can derive non-linear model parameters using one of the three types. The template may be composed of left surrounding samples and upper surrounding samples of the current block (L-shape), the template may be composed of left samples of the current block (left-only), and the template may be composed of upper samples of the current block (above-only). The non-linear model may be CCCM. Referring to FIG. 24(b), the filter shape used to derive the non-linear model parameters may be one of a square shape, a horizontally elongated rectangular shape (width is longer than height), or a vertically elongated rectangular shape (height is longer than width). The encoder can acquire a bitstream including first information indicating a template type and a filter shape, and the decoder can determine the template type and filter shape through the first information of the bitstream. Referring to FIG. 24(c), the video signal processing device can derive non-linear model parameters based on the template type and filter shape, and can predict the current block on a sample basis using the derived non-linear model parameters. When predicting the current block on a sample basis, the video signal processing device can predict diagonally. In predicting the current sample, a sample predicted prior to the current sample may be used. The video signal processing device can perform filtering on the predicted block using EIP mode. The encoder can generate and signal a bitstream including information indicating whether to apply filtering to the block predicted in EIP mode.In the decoder, when the current block is in EIP mode, information indicating whether filtering is applied to the predicted block can be parsed to set whether filtering is applied to the predicted block. At this time, the filtering may be as shown in Table 1 below. Table 1 shows filtering according to an embodiment of the present invention, including filtering related to a 3x3 kernel and a 5x5 kernel.

[0286]

[0287] For the residual signal of a block encoded in EIP mode, the video signal processing device can derive an intra prediction mode using the block predicted in EIP mode, and then derive a transform kernel for MTS, NSPT, LFNST, etc. using the derived intra prediction mode. At this time, to derive the intra prediction mode, the video signal processing device may use a DIMD method or a method similar to DIMD.

[0288] The EIP merge mode may be a mode in which a video signal processing device constructs an EIP merge list using the filter shapes and filter coefficients of neighboring blocks previously encoded in EIP mode, and then determines an EIP merge candidate having the optimal filter shape and filter coefficients for the current block. In this case, the EIP merge candidate (optimal filter shape and filter coefficients) can be determined through an index included in the bitstream. The EIP merge list may be constructed using adjacent spatial candidates, non-adjacent spatial candidates, temporal candidates, shifted temporal candidates, and history-based candidates for the current block. Additionally, the EIP merge list may be reordered based on the template cost.

[0289] If the current block is encoded in any one of the intra TMP, MIP, or EIP modes, the video signal processing device may store a planar mode, a DC mode, a derived DIMD mode, or an intra prediction mode at the location indicated by the block vector (BV) for the intra prediction mode of the current block. The derived DIMD mode may be an intra prediction mode derived by the DIMD method using pre-recovered samples adjacent to the current block. Alternatively, the derived DIMD mode may be an intra prediction mode derived by the DIMD method using the current prediction block. Alternatively, the derived DIMD mode may be an intra prediction mode derived by the DIMD method using samples of the recovered current block after the recovery of the current block is completed. The intra prediction mode indicated by the BV may be the intra prediction mode of the reference block indicated by the BV used for intra TMP prediction. The stored intra prediction mode may be used to derive an MPM list for intra prediction of the next block. Additionally, the video signal processing device may use the intra prediction mode of the reference block indicated by the BV to derive the intra prediction mode to be stored for a block encoded in IBC or intra TMP mode.

[0290] When a video signal processing device derives an MPM list for a current block, if the encoding mode of a surrounding block of the current block is any one of intra TMP, MIP, or EIP mode, the intra prediction mode of the surrounding block can be derived as any one of planar mode, DC mode, derived DIMD mode, or the intra prediction mode of the position indicated by BV.

[0291] If the current block is encoded in either SGPM (Spatial Geometry Partitioning Mode) or GPM (Geometry Partitioning Mode), the video signal processing device may set the value obtained by converting the angle of the diagonal line dividing the current block into an intra prediction mode as the intra prediction mode of the current block. If the current block is encoded in either SGPM or GPM and one of the two divided regions of the current block is encoded in an intra prediction mode, the intra prediction mode representing the current block may be the intra prediction mode applied to the region encoded in the intra prediction mode among the two regions. In this case, if the intra prediction mode is a directional mode (any one of modes 2 to 66), the intra prediction mode representing the current block may be the intra prediction mode corresponding to the directional mode (any one of modes 2 to 66). If the intra prediction mode is not a directional mode (any one of modes 2 through 66), the intra prediction mode representing the current block may be the value obtained by converting the angle of the diagonal line used in the current block's splitting process into an intra prediction mode.

[0292] The encoding mode of the surrounding block of the current block is one of SGPM or GPM, and one of the two divided regions of the current block may be encoded in an intra prediction mode. In this case, when the video signal processing device derives the MPM list for the current block, it may set the intra prediction mode of the region encoded in the intra prediction mode among the two divided regions of the surrounding block of the current block as the intra prediction mode of the surrounding block. In this case, if the intra prediction mode is a directional mode (any one of modes 2 to 66), the intra prediction mode of the surrounding block may be the intra prediction mode of the directional mode (any one of modes 2 to 66). If the intra prediction mode is not a directional mode (any one of modes 2 to 66), it may be a value obtained by converting the angle of the diagonal line used in the division process of the current block into an intra prediction mode. The derived intra prediction mode of the surrounding block may be added to the MPM list.

[0293] If the current block is encoded in IBC mode, the intra prediction mode of the current block may be one of the derived DIMD mode or the intra prediction mode of the location indicated by the BV. The derived DIMD mode may be an intra prediction mode derived in the DIMD manner using already reconstructed samples adjacent to the current block. Alternatively, the derived DIMD mode may be an intra prediction mode derived in the DIMD manner using the current prediction block. The derived DIMD mode may be an intra prediction mode derived in the DIMD manner using samples of the reconstructed current block after the current block has been reconstructed. The intra prediction mode indicated by the BV may be the intra prediction mode of the reference block indicated by the BV used for IBC prediction. If the encoding mode of the current block is RRIBC encoding mode, the intra prediction mode of the reference block indicated by the BV may be transformed according to the flip direction of the current block, and the intra prediction mode of the current block may be the transformed intra prediction mode.

[0294] FIG. 25 is a diagram showing the Region of Interest (ROI) after LFNST conversion according to one embodiment of the present specification.

[0295] Referring to FIG. 25, after the LFNST transformation, the gray block area, which is the low-frequency portion, may be the Region of Interest (ROI), and any portion other than the pre-specified ROI may be zeroed out to 0. In the case of LFNST16, since only 96 samples are required, the remaining white sub-blocks, excluding 6 NxN sub-blocks as shown in FIG. 25(a), may be zeroed out. In the case of LFNST8, since only 64 samples are required, the remaining white sub-blocks, excluding 4 NxN sub-blocks as shown in FIG. 25(b), may be zeroed out. Finally, in the case of LFNST4, there may be no zeroed-out region. Here, N is a positive integer and may be 4.

[0296] FIG. 26 is a diagram illustrating the process of generating a prediction block using DIMD according to one embodiment of the present specification.

[0297] Referring to FIG. 26, the decoder can derive a prediction block using surrounding samples (blocks, pixels). In this case, the surrounding samples may be surrounding blocks (pixels) of the current block. Specifically, the decoder can determine intra-prediction modes and weight information for the restoration of the current block through a histogram of directional information (angle information) using surrounding samples as input.

[0298] FIG. 27 is a diagram showing the location of surrounding pixels used to induce directional information according to one embodiment of the present specification.

[0299] FIG. 27(a) shows the case where all surrounding blocks of the current block are available to induce directional information, FIG. 27(b) shows the case where the upper boundary of the current block is a Sub-picture, Slice, Tile, or CTU boundary, and FIG. 27(c) shows the case where the left boundary of the current block is a Sub-picture, Slice, Tile, or CTU boundary. Meanwhile, if the surrounding blocks and the current block do not belong to the same Sub-picture, Slice, Tile, or CTU, the surrounding blocks may not be used to induce directional information. The gray dots in FIG. 27 indicate the location of the pixels used to induce actual directional information, and the dotted lines indicate the Sub-picture, Slice, Tile, or CTU boundaries. Additionally, referring to FIG. 27(d) through (f), pixels located at the boundaries may be padded one pixel at a time outside the boundaries to induce directional information. Through such padding, it is possible to derive more accurate directional information.

[0300] To derive directional 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 may represent pixel information (values) of the restored surrounding blocks of the current block of size 3x3. The directional information (θ) can be determined using Equation 2. To reduce the computational complexity for deriving directional information, the decoder can derive the directional information (θ) solely by calculating Gy / Gx in Equation 1, without calculating the atan function in Equation 2.

[0301]

[0302]

[0303] Referring to FIG. 27, directional information can be calculated for every gray point shown in FIG. 27, and the directional information can be mapped to the angle of an intra-prediction mode. The set of intra-prediction modes may include a planar mode, a DC mode, and a plurality (e.g., 65) angle modes (i.e., directional modes). There may be 67 types of intra-prediction modes, and the directional information (angle, θ) calculated through Equation 2 may be a value in real units. Therefore, a process of mapping the directional information to a specific intra-prediction directional mode is required. The directional mode described in this specification may be the same as the angle mode.

[0304] FIG. 28 is a diagram illustrating a method for mapping a directional mode according to one embodiment of the present specification.

[0305] Referring to FIG. 28, the intra-predicted 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-predicted directional mode can be divided into four sections from section 0 to section 3. Section 0 is from -45 degrees to 0 degrees, section 1 is from 0 degrees to 45 degrees, section 2 is from 45 degrees to 90 degrees, and section 3 is from 90 degrees to 135 degrees. At this time, each section may include 16 intra-predicted directional modes. The directional mode can be determined by comparing the sign and magnitude of Gx and Gy calculated through Equation 1, so that one of the four sections is determined. For example, if Gx and Gy are positive and the absolute value of Gx is greater than the absolute value of Gy, interval 1 may be selected. The intra-predicted directional mode mapped to each interval can be determined through the directional information (θ) calculated from Equation 2. Specifically, the decoder expands the value by multiplying the directional information (θ) by 2^16. Then, the decoder compares the expanded value with a value in a predefined table to find the value closest to the expanded value and determines the intra-predicted directional mode based on that closest value. In this case, there may be 17 values ​​in the predefined table. Specifically, the values ​​of the predefined table may be {0, 2048, 4096, 6144, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 47104, 53248, 59392, 65536}. In this case, the difference between the predefined table values ​​may be set differently depending on the difference between the angles of the intra-predicted directional mode.

[0306] On the other hand, if the directional angle is calculated using only Gy / Gx without performing atan calculations to reduce computational complexity, the difference between the predefined table values ​​may be inconsistent with the distance between angles in the intra-predicted directional mode. atan has the characteristic that the slope gradually decreases as the input value increases. Therefore, the values ​​in the above-defined table must be set by considering not only the difference between angles in the intra-predicted directional mode but also the non-linear characteristics of atan. For example, the difference between the above-defined table values ​​can be set to gradually decrease. Conversely, the difference between the above-defined table values ​​can be set to gradually increase.

[0307] If the width and height of the current block are different, the available intra prediction directional mode may differ. In other words, if the width and height of the current block are different, the section for inducing the intra prediction directional mode may differ. That is to say, the section for inducing the intra prediction directional mode may change based on the width and height of the current block (e.g., the ratio of the width to the height). For example, if the width of the current block is longer than the height, the intra prediction mode may be remapped from 67 to 80, and the intra prediction mode in the opposite direction may be excluded from 2 to 15. For example, if the width of the current block is n (integer) times longer than the height (e.g., 2 times), the intra prediction mode {3, 4, 5, 6, 7, 8} may be reset (mapped) to {67, 68, 69, 70, 71, 72} respectively. In addition, if the width of the current block is longer than the height, the intra prediction mode can be reset to a value of '65' added to the intra prediction mode. Meanwhile, if the width of the current block is shorter than the height, the intra prediction mode can be reset to a value of '67' subtracted from the intra prediction mode.

[0308] A histogram can be used to derive an intra-predicted directional mode for the restoration of the current block. If, as a result of acquiring directional information for surrounding blocks, there are more non-directional blocks than directional blocks, the prediction mode for non-directional blocks may have the highest cumulative value on the histogram. However, since a directional mode must be derived for the restoration of the current block, the prediction mode for non-directional blocks may be excluded even if it has the highest cumulative value on the histogram. In other words, smooth areas with no variation between surrounding pixels or lack of directionality may not be used to derive the intra-predicted directional mode. For example, the prediction mode for a non-directional block may be a planar mode or a DC mode. If the left surrounding block is in planar mode or DC mode, the left surrounding block may not be used to derive directional information, and directional information may be derived using only the upper surrounding block. In cases where there is a mixture of smooth areas and directional areas among the surrounding blocks of the current block, 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 for each intra-predicted directional mode, rather than a frequency-based one in which '1' is added for each intra-predicted directional mode that occurs.

[0309]

[0310] FIG. 29 is a diagram showing a histogram for inducing an intra-predicted directional mode according to one embodiment of the present specification.

[0311] The X-axis of FIG. 29 represents the intra-prediction directional mode, and the Y-axis represents the cumulative value of G values. The decoder can select the intra-prediction directional mode with the largest cumulative value of G values ​​among the intra-prediction directional modes. In other words, the decoder can select the intra-prediction directional mode for the current block based on the cumulative value. Referring to FIG. 29, mode A, which has the largest cumulative value, and mode B, which has the second largest cumulative value, can be selected as the intra-prediction directional modes. To generate a prediction block for the current block, the decoder can generate a final prediction block by weighted averaging the prediction block generated by mode A, the prediction block generated by mode B, and finally the prediction block generated by the flat mode. At this time, the weight of each prediction block can be determined using the cumulative values ​​of mode A and mode B. For example, the weight for the prediction block generated by the flat mode can be set to 1 / 3 of the total weight. The weight for the prediction block generated in mode A can be set to a weight corresponding to the value obtained by dividing the sum of the cumulative values ​​of mode A and mode B by the cumulative value of mode A. The weight for the prediction block generated in mode B can be determined by the difference between the total weight and the mode A weight and 1 / 3 of the total weight. To make the calculation of weights more accurate, the decoder can expand the range of weights by multiplying the weight for the prediction block generated in mode A by an arbitrary value. The weight for the prediction block generated in mode B and the weight for the prediction block generated in flat mode can also be expanded in the same way.

[0312] FIG. 30 is a diagram illustrating a method for generating a prediction sample to restore a current block according to one embodiment of the present specification.

[0313] Specifically, FIG. 30 is a structural diagram illustrating a process of generating prediction samples using an intra prediction mode by more effectively inducing an intra prediction mode to improve encoding performance.

[0314] Referring to FIG. 30, in the 'prediction mode generator' process, the decoder can derive an intra-prediction directional mode for the current block using samples from neighboring blocks adjacent to the current block. At this time, the decoder can derive at least one intra-prediction directional mode and derive weights for each mode. For example, to derive an intra-prediction directional mode, the decoder may use a histogram-based method that derives directional information from neighboring block samples through an arbitrary filter and determines frequently occurring directional information as the intra-prediction directional mode. Additionally, as a method for deriving an intra-prediction directional mode, a method may be used in which an intra-prediction pixel for the left pixel adjacent to the current block is generated using only the upper pixel adjacent to the current block, and the intra-prediction mode with the least distortion is determined as the intra-prediction directional mode for the current block.

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

[0316] The video signal processing unit may apply Position-dependent intra prediction combination (PDPC) filtering to each prediction block generated during the 'intra prediction' process. Since applying PDPC filtering to each prediction block may increase complexity in terms of the decoder, PDPC filtering may not be applied to prediction blocks predicted in DIMD mode if the prediction block is predicted in DIMD mode. Additionally, PDPC filtering may be applied only to either mode A, which has the largest cumulative value, or mode B, which has the second largest. For example, PDPC filtering may be applied only to mode A. Furthermore, whether PDPC filtering is applied may be determined based on the weights of each directional mode. For example, whether PDPC is applied to all or part of mode A and mode B may be determined based on the difference between the weights for mode A and mode B. For example, if the difference between the weights for mode A and mode B is smaller than a specific value, PDPC filtering may be applied to both mode A and mode B. In addition, the weights for mode A and mode B, respectively, can be compared with a specific value to determine whether PDPC filtering is applied to mode A and mode B. If the weights are greater than the specific value, PDPC filtering may be applied to the directional mode of the corresponding weight. For example, if the weight for mode A is greater than or equal to the specific value and the weight for mode B is less than the specific value, PDPC filtering may be applied to mode A, but not to mode B. Additionally, regardless of the directional mode, PDPC filtering of a pre-configured form may be applied only to the final prediction block to which the weighted average is applied through the weighted prediction process (see Fig. 30).Additionally, PDPC filtering can be applied using mode A to the final prediction block with the weighted average applied during the 'weighted prediction' process. PDPC filtering can also be applied using mode B to the final prediction block with the weighted average applied during the 'weighted prediction' process.

[0317] Referring to FIG. 30, in the 'other prediction' process, the decoder may additionally generate a prediction block for the current block. For example, the decoder may generate an intra prediction block using at least one of Plane Mode, DC Mode, and MIP (Matrix Intra Prediction). Whether the 'other prediction' process is performed can be determined by using at least one of the following: intra prediction directionality modes derived in the 'prediction mode generator' process and weight information for each prediction directionality; quantization parameter information of the current block; the width or height 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 existence of transform coefficients around the current block (which may correspond to Additional information A, B, and C in FIG. 30). The method for determining whether the 'other prediction' process is performed is described below.

[0318] Information regarding which mode (e.g., plane, DC, MIP mode, etc.) the decoder will use during the 'other prediction' process may be pre-defined or signaled via SPS. For example, the decoder may determine the mode based on a syntax element (sps_dimd_default_mode) indicating which mode to use. The decoder may determine which mode to use among plane mode, DC mode, and MIP mode based on the value of sps_dimd_default_mode. For example, if the value of sps_dimd_default_mode is '0', it may be instructed to use plane mode; if the value of sps_dimd_default_mode is '1', to use DC mode; and if the value of sps_dimd_default_mode is any value other than 0 or 1, to use MIP mode. Additionally, if the current block is a luminance block and there are transformation coefficients for surrounding blocks, the decoder may generate a prediction block using at least one of plane mode, DC mode, or MIP mode. If the current block is a chrominance block and there are no transformation coefficients for surrounding blocks, a prediction block can be generated using at least one of the Plane mode, DC mode, and MIP mode. Additionally, if the weights of the intra-prediction directional modes derived during the 'prediction mode generator' process are similar to each other (e.g., if the difference between the weights of each directional mode is smaller than a specific threshold), the 'other prediction' process may not be performed. If the weights of the intra-prediction directional modes derived during the 'prediction mode generator' process are similar to each other, the decoder can generate a prediction block using at least one of the Plane mode, DC mode, and MIP mode (i.e., the 'other prediction' process is performed).If the difference between the weights of the intra-prediction directional modes derived during the 'prediction mode generator' process is large (for example, if the difference between the weights of each directional mode is greater than a specific threshold), it implies that there is significant variation between pixels of surrounding blocks; therefore, the decoder can generate a prediction block using at least one of the Planar Mode, DC Mode, and MIP Mode. Additionally, if the width and height of the current block are different, the decoder can generate a prediction block using at least one of the Planar Mode, DC Mode, and MIP Mode. Conversely, when 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, DC Mode, and MIP Mode.

[0319] In the 'weighted prediction' process, the decoder can generate a single prediction sample by weighted 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 following: intra prediction directional mode and weight information derived in the 'prediction mode generator' process, quantization parameter information of the current block, the width or height 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 existence of transform coefficients around the current block.

[0320] FIG. 31 is a diagram illustrating a method for determining an intra-prediction mode according to one embodiment of the present specification.

[0321] Figure 31 illustrates the 'prediction mode generator' process of Figure 30 in more detail. Referring to Figure 31, the 'prediction mode generator' process of Figure 30 can derive intra-prediction directionality through histogram analysis. Specifically, in the 'Histogram analysis' process of Figure 31, the decoder can derive intra-prediction directionality by analyzing the histogram obtained using surrounding samples adjacent to the current block. At this time, the decoder can derive the intra-prediction directionality mode and weights for the current block by using at least one of the following: the width and height of the current block, quantization parameter information, information on possible intra-prediction directionality modes among the surrounding blocks of the current block, information on the existence of residual signals in the surrounding blocks of the current block, and information on whether the current block is a luminance block or a chrominance block. The method for deriving the intra-prediction directionality mode and weights for the current block is described below.

[0322] The intra-predicted directional mode can be set based on frequency. The decoder can acquire a histogram of the intra-predicted directional mode for surrounding blocks and, by analyzing the histogram, select the frequently occurring intra-predicted directional mode and the second most frequently occurring mode as the predicted directional mode. Additionally, the intra-predicted directional mode can be set based on a cumulative value (e.g., the G value in Fig. 29). The decoder can analyze the histogram obtained from the cumulative value obtained by adding the G value to each intra-predicted directional mode and select the intra-predicted directional mode with the highest weight and the mode with the second largest weight as the predicted directional mode. Additionally, the decoder can select the intra-predicted directional mode based on the distance between the intra-predicted directional modes of surrounding blocks and the cumulative value obtained by adding the G value. The distance between directional modes may refer to the difference in index of the directional mode. For example, the distance difference between the directional mode of index 66 and the directional mode of index 2 may be 64. Alternatively, 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 may obtain a histogram with the cumulative value of the G value added to each of the intra-predicted directional modes for the surrounding block, analyze the histogram, and first select the intra-predicted directional mode having the highest cumulative value. Next, the decoder may use the mode with the smallest distance between the mode having the highest cumulative value and the directional mode (closest mode) among the modes corresponding to the remaining cumulative values ​​excluding the highest cumulative value (e.g., the mode having the second highest cumulative value, the mode having the third highest cumulative value, the mode having the fourth highest cumulative value, etc.).Meanwhile, the decoder first selects the intra-prediction directional mode having the highest cumulative value, and the decoder may use the mode with the largest distance between the mode having the highest cumulative value and the directional mode (the furthest mode) among the modes corresponding to the remaining cumulative values ​​excluding the highest cumulative value (e.g., the mode having the second highest cumulative value, the mode having the third highest cumulative value, the mode having the fourth highest cumulative value, etc.). The cumulative value for each of the above intra-prediction directional modes can be used when determining the weights for the intra-prediction directional modes finally determined during the 'Histogram analysis' process.

[0323] There may be two or more intra-prediction directional modes for the current block derived during the 'Histogram analysis' process by the decoder of FIG. 31. When there are two or more intra-prediction directional modes derived from 'Histogram analysis', the distances between each intra-prediction directional mode may be similar or different. Additionally, the cumulative values ​​between the intra-prediction directional modes may also be similar or different. Therefore, to derive the optimal prediction sample for the current block, the most optimal combination among various mode combinations must be selected. Furthermore, to derive the optimal prediction sample for the current block, the decoder may combine not only the intra-prediction directional modes derived from the 'prediction mode generator' process of FIG. 30 but also the encoding modes derived from 'other prediction'. Information regarding such combinations may be included in the bitstream. The mode combinations 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.

[0324] Next, referring to FIG. 31, the decoder can select an optimal combination to derive an optimal prediction sample for the current block by utilizing the intra prediction modes determined in the 'Histogram analysis' process and the weight information corresponding to the derived intra prediction modes during the 'Prediction mode analysis' process. Specifically, the decoder can determine information regarding 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 weights for the intra prediction modes by utilizing the derived intra prediction modes and the corresponding weight information. Additionally, in the 'Prediction mode analysis' process, the decoder can select an optimal combination to derive a prediction sample for the current block by utilizing at least one of the intra prediction modes determined in the 'Histogram analysis' process, the weight information corresponding to the determined intra prediction modes, and the intra prediction modes of surrounding blocks. Specifically, the decoder can determine information regarding 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 weights for the intra prediction modes. At this time, optimal combination information for prediction modes for generating prediction samples for the current block can be derived by using at least one of the following: the width or height of the current block, quantization parameter information, information on available intra prediction modes among the surrounding blocks of the current block, information on the existence of residual signals in the surrounding blocks of the current block, and information on whether the current block is a luminance block or a chrominance block. The combination information may include intra prediction directional mode information and weights for the intra prediction directional modes.For example, if the weight of the second highest mode among the two derived intra-prediction directional modes is '0' or within any 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. In this case, the arbitrary value is an integer greater than or equal to 1, and may be 10. Additionally, if at least one of the two derived intra-prediction directional modes is a DC mode, Planar mode, or 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. Additionally, if at least one of the two derived intra-prediction modes is a DC mode, Planar mode, or MIP mode (i.e., not a directional mode), the decoder may apply a weighted average when generating the prediction block for the current block.

[0325] FIG. 32 is a diagram illustrating a method for generating prediction samples using intra-prediction directional mode information and weights according to one embodiment of the present specification.

[0326] Specifically, FIG. 32 illustrates the 'Intra prediction' and 'weighted prediction' processes of FIG. 30. Referring to FIG. 32, 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 following: the width and height of the current block, quantization parameter information, and information regarding whether the current block is luminance or chrominance (Additional information).

[0327] When DIMD is applied to the current block, the process performed by the video signal processing device is described.

[0328] First, the video signal processing device can generate left, top, and top-left histograms by deriving directionality from the restored samples at the left, top, and top-left positions adjacent to the current block, respectively. The video signal processing device can generate a whole histogram by deriving directionality from all the restored samples at the left, top, and top-left positions, and then use the whole histogram to select the top 5 directions with high frequency values.

[0329] Next, the video signal processing device can generate a predicted block for the current block using the top five directional modes through a position-based DIMD weighted average method. Specifically, for each of the top five directional modes, the video signal processing device can classify whether the directional mode is frequently derived from the left sample or frequently derived from the top sample into vertical, horizontal, and diagonal characteristics. The video signal processing device can classify each directional mode into vertical, horizontal, and diagonal characteristics by comparing the frequency values ​​in the overall histogram of each directional mode with the frequency values ​​in the left, top, and top-left histograms of each directional mode.

[0330] Next, the video signal processing device may determine whether to apply a weighted average to the current block using at least one of each directional mode, the frequency value for the directional mode, and whether the directional mode is a characteristic (vertical, horizontal, diagonal). For example, if the frequency value of the second-highest directional mode is greater than 0 and the first-highest directional modes are angular modes (i.e., not planar mode and DC mode), the video signal processing device may apply a weighted average to the current block. Otherwise, the video signal processing device may not apply a weighted average to the current block. If the first-highest mode is not a diagonal characteristic, the frequency value of the second-highest directional mode is 0, and the first-highest directional mode is angular mode, the video signal processing device may set the second-highest directional mode to planar mode and apply a weighted average using a 3:1 weight to the blocks predicted by the first directional mode and the second planar mode. The weights for each directional mode can be set based on the frequency values ​​for the directional mode and the sum of those frequency values. In this case, the method of applying the weighted average can be described as a blending mode.

[0331] Next, after generating prediction blocks using each directional mode, a first-order block-unit weighted average can be performed between prediction blocks of directional modes classified by the same feature using the previously calculated weights, and vertical feature prediction blocks, horizontal feature prediction blocks, and diagonal feature prediction blocks can be generated.

[0332] Next, the video signal processing device can calculate the vertical characteristic weight, horizontal characteristic weight, and diagonal characteristic weight by calculating the weighted sum among the weights for directional modes classified by the same characteristic. Then, the video signal processing device can perform a second sample-unit weighted average among the blocks that have been first weighted averaged. At this time, the mode of the second sample-unit weighted average can be determined based on at least one of the following: the difference in width and height of the current block, the size of the current block, and a comparison between the vertical characteristic weight, horizontal characteristic weight, and diagonal characteristic weight. For example, if both the vertical characteristic weight and the horizontal characteristic weight are greater than 0, the mode of the second sample-unit weighted average can be determined as the diagonal mode. Otherwise, if the vertical characteristic weight is greater than 0, the mode of the second sample-unit weighted average can be determined as the vertical mode. Otherwise (if the vertical characteristic weight is not greater than 0), the mode of the second sample-unit weighted average can be determined as the horizontal mode. When the mode of the second-order sample-unit weighted average is vertical mode, the sample-unit weighted average can be applied using the vertical feature prediction block, the diagonal feature prediction block, the vertical feature weights, and the diagonal feature weights. In this case, the vertical feature weights can be set to decrease and the diagonal feature weights to increase as one moves further away from the top boundary of the current block. Alternatively, when the mode of the second-order sample-unit weighted average is horizontal mode, the sample-unit weighted average can be applied using the horizontal feature prediction block, the diagonal feature prediction block, the horizontal feature weights, and the diagonal feature weights. In this case, the horizontal feature weights can be set to decrease and the diagonal feature weights to increase as one moves further away from the left boundary of the current block.Alternatively, if the mode of the second-order sample-unit weighted average is a diagonal mode, the sample-unit weighted average can be applied using the horizontal feature prediction block, vertical feature prediction block, diagonal feature prediction block, and horizontal feature weights, vertical feature weights, and diagonal feature weights. In this case, the horizontal feature weights and vertical feature weights can be set to decrease and the diagonal feature weights to increase as one moves further away from the left and top boundaries of the current block. This method can be described as a location-based DIMD weighted average method.

[0333] FIGS. 33 and FIGS. 34 are drawings showing a template used to induce an intra prediction mode of a current block according to one embodiment of the present specification.

[0334] Referring to FIG. 33, the decoder may use a template, which is a restored arbitrary region (pixel(s)) adjacent to the current block, to derive the intra prediction mode of the current block. First, the decoder may generate a prediction template for the template using surrounding pixels (references) adjacent to the template. Then, the decoder may use the intra prediction mode for the prediction template most similar to the already restored template for the restoration of the current block. The method of deriving the intra prediction mode of the current block using the above-described template may be described as TIMD (Template intra mode derivation). In this case, the intra prediction mode may be a mode with an index from 0 to 67, or it may be limited to only the intra prediction modes within the MPM list derived from the surrounding blocks of the current block. In this case, the intra prediction mode may be a mode within the MPM list derived from the surrounding blocks of the current block that differs from the corresponding intra prediction mode by an arbitrary number. The arbitrary number may be 1, 2, 3, ... Alternatively, for the intra prediction mode for the template, only directional modes may apply, and non-directional modes (planar mode, DC mode) may not apply.

[0335] The following describes a method for deriving the intra-predicted directional mode using the TIMD mode.

[0336] i) The decoder can set the size of the template. The width or height (length) of the template may be 4, and if the width or height (length) of the current block is 8 or less, the width or height of the template may be set to 2. ii) The decoder can set the type of the template. The template type may be classified into a type using only left samples, a type using only top samples, and a type using all left, top, and upper-left samples. The decoder may determine the type of the template based on whether the surrounding blocks are valid or whether the surrounding blocks can be used to induce an intra-prediction directional mode. Meanwhile, if the surrounding blocks cannot be used to induce an intra-prediction directional mode, the TIMD mode may be set to a flat mode, and weighted averaging may not be performed. iii) The decoder can construct a template for the current block. iv) The decoder may derive intra-predicted directional modes for surrounding 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 surrounding blocks of the current block have directionality (e.g., non-directional modes (DC mode, planar mode, MIP mode, etc.)), the decoder may select one intra-predicted directional mode with the minimum cost and not perform TIMD mode. In this case, weighted averaging using multiple prediction blocks may not be performed. vi) If there is at least one directional block among the surrounding blocks of the current block, the process described below may be performed. The process described below may be performed based on the intra-predicted directional modes existing in the MPM list. This is because checking all 67 types of intra-predicted directional modes may increase complexity. a. The decoder may construct an MPM list. b.Next, the decoder may modify the MPM list by adding DC mode, horizontal mode, and vertical mode if they do not exist within the MPM list. c. The decoder may evaluate all intra-predicted directional modes within the modified list and compare their costs. The decoder may select the first mode with the smallest cost and the second mode with the second smallest cost. d. To increase accuracy, the decoder may additionally evaluate intra-predicted directional modes corresponding to indices that are one less or greater than the intra-predicted directional mode index of the first mode and the intra-predicted directional mode index of the second mode. The decoder may perform additional evaluations and again select the third mode with the smallest cost and the fourth mode with the second smallest cost. Meanwhile, the first mode and the third mode may be identical, and the second mode and the fourth mode may be identical. e. The decoder may decide whether to perform a weighted average 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 smaller than a specific value, the decoder may perform a weighted average, and the weights of the third and fourth modes may 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 larger than a specific value, the decoder may generate a prediction block using only the third mode without performing a weighted average. In this case, the specific value may be a predetermined value.

[0337] The size of the template may vary depending on the width or height of the current block. For example, as shown in FIG. 33(a), an above template that is longer than the width of the current block may be configured. In this case, the height of the above template may be a predetermined length. Similarly, a left template that is longer than the height of the current block may be configured. In this case, the width of the left template may be a predetermined length. The predetermined lengths may be 1, 2, 3, ...

[0338] When the current block is located at the CTU boundary (where any of the top, bottom, left, or right boundaries of the current block is included in the CTU boundary), the reference pixels for deriving / predicting the template used for TIMD mode may be changed. Referring to FIG. 34, when the upper boundary of the current block is included in the CTU boundary, there may 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 TIMD mode by constructing only the left template of the current block without constructing the upper template of the current block. In this case, the above reference pixel and the left reference pixel of the current block may be used for predicting the left template. In this case, the height of the left template may be the same as the height of the current block, as shown in FIG. 34(a). In addition, as shown in Fig. 34(b), the decoder checks 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.

[0339] Generally, the accuracy of the prediction sample for the current block can be increased as the decoder refers more to the adjacent neighboring pixels of the current block. On the other hand, referring to many neighboring pixels increases the required memory. In addition, if there are blocks among the adjacent neighboring blocks that have not yet been restored, that area cannot be used as a template. To effectively handle this memory increase and the unrestored area, as shown in FIG. 33(b), the length of the upper template can be set to be equal to the width of the current block and the length of the left template can be set to be equal to the height of the current block.

[0340] The decoder may use an intra-prediction mode derived using a template to acquire prediction samples for the current block. The decoder may generate prediction samples using neighboring pixels adjacent to the current block and may adaptively select which neighboring pixels to use to generate the prediction samples. Additionally, the decoder may use multiple reference lines to generate prediction samples, wherein the index information of the multiple reference lines may be included in the bitstream.

[0341] For entropy coding, a new context may be defined for the index of a multi-reference line for TIMD mode. An increase in the number of context types may be associated with memory and context switching complexity. Therefore, the context used to code and decode the index of a multi-reference line used in TIMD mode may be a reuse of the existing context for the index of a multi-reference line.

[0342] The transformation of the residual signal of the current block may proceed in two stages. The first transformation may involve adaptively applying transformations such as DCT-II, DST-VII, DCT-VIII, DCT5, DST4, DST1, and identity transformation (IDT) to the horizontal and vertical, respectively. A second transformation may be additionally applied to the transformation coefficients after the first transformation is completed, and the second transformation may be calculated as a matrix multiplication between the transformation coefficients from the first transformation and a predefined matrix. The second transformation may be described as a Low Frequency Non-Separable Transform (LFNST). The matrix transformation set for the second transformation may vary depending on the intra-prediction mode of the current block. The coefficient information of the transformation matrix used for the second transformation may be included in the bitstream.

[0343] When a second transformation is applied to the current block to which DIMD mode or TIMD mode is applied, the transformation set for the second transformation can be determined based on the intra-prediction mode derived from DIMD mode or TIMD mode. The coefficient information of the transformation matrix used for the second transformation may be included in the bitstream. The decoder can parse the coefficient information included in the bitstream to set the matrix coefficient information of the second transformation for DIMD mode or TIMD mode. In this case, one of the two intra-prediction modes derived from TIMD mode may be used to select the first transformation or second transformation set. The intra-prediction directional mode having the smallest cost may be used to select the first transformation or second transformation set by comparing the costs of each of the two intra-prediction directional modes. Additionally, one of the two intra-prediction directional modes derived from DIMD may be used to select the first transformation or second transformation set. By comparing the weights of each of the two intra prediction modes, the intra prediction directional mode with the highest weight can be used to select a first-order transformation or a second-order transformation set.

[0344] TIMD mode is a highly complex mode because it predicts the template of the current block and uses an intra-prediction mode derived from the template to generate the prediction block of the current block. Therefore, when the decoder generates a prediction template for the template region, it may not perform the existing reference sample filtering process. Additionally, TIMD mode may not be applied if the current block is in ISP mode or CIIP mode. For a current block in which TIMD mode is applied, ISP mode or CIIP mode may not be applied, or syntax related to ISP or CIIP may not be parsed. In this case, the values ​​of the unparsed syntax related to ISP or CIIP can be inferred as pre-specified values.

[0345] Template prediction can be performed by dividing the left template region and the upper template region adjacent to the current block, and an intra prediction mode can be derived for each template. Additionally, 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. If there are two or more intra prediction modes, a prediction sample for the current block can be generated using all derived intra prediction modes, and the decoder can generate a final prediction block for the current block by weighted averaging the generated prediction samples. At this time, to generate the prediction sample, at least three of the two or more intra prediction modes derived from template prediction, plane mode, DC mode, and MIP mode may be used. For example, when the decoder generates (acquires) a prediction sample for the current block, the decoder can generate a final prediction sample by weighted averaging the prediction samples generated using the intra prediction modes derived from template prediction and the plane mode.

[0346] Even when CIIP mode is applied, prediction samples can be generated using the methods described above. CIIP mode is a method that uses both intra-prediction and inter-prediction when generating prediction samples (blocks) for the current block. Prediction samples for the current block can be generated as a weighted average between intra-prediction samples and inter-prediction samples.

[0347] When intra prediction samples are generated by applying CIIP mode, DIMD mode or TIMD mode may be used. In this case, if DIMD mode is used, intra prediction samples may be generated based on DIMD combination information. For example, the decoder may generate a first prediction sample using the intra prediction mode with the highest weight and generate a second prediction sample using the intra prediction mode with the second highest weight. Then, the decoder may generate a final intra prediction block by weighted averaging the first prediction sample and the second prediction sample. In this case, the decoder may generate the final intra prediction block by weighted averaging a total of three prediction samples: the sample predicted in plane mode among the surrounding blocks of the current block, the first prediction sample, and the second prediction sample. When TIMD mode is used, intra prediction samples may be generated based on TIMD combination information. For example, the decoder may generate two prediction samples using each of the two intra prediction modes. Then, the decoder may generate a final intra prediction sample by weighted averaging the two prediction samples. At this time, the decoder can generate a final intra-predicted sample by weighted averaging two predicted samples and a sample predicted in plane mode.

[0348] The accuracy of intra-prediction samples may vary depending on their location. That is, pixels located far from the neighboring pixels used for prediction within a prediction sample may contain more residual signals than pixels located close to them. Therefore, the decoder can divide the prediction samples into vertical, horizontal, and diagonal directions according to the direction of the intra-prediction mode and set different weights based on the distance from the neighboring pixels used for prediction. This can be applied to intra-prediction blocks created using CIIP mode or intra-prediction blocks created using two or more intra-prediction modes, and weights can be set differently for each pixel within the prediction block based on the distance between the location of the reference pixel and the location of the pixel within the prediction block. As an example of implementation, if the intra-prediction mode of the current block is a vertical direction or a mode with a direction similar to vertical, a higher weight may be set for each pixel location as the pixel location within the prediction block is closer to the top pixel, and a lower weight may be set for each pixel location as the pixel location is farther from the top pixel.

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

[0350] 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 generate a final prediction sample by weighted averaging the generated prediction samples. When generating prediction samples for each intra prediction mode, pixel-level weights according to the intra prediction mode may be applied.

[0351] Pixel-unit weights can be set based on at least one of the following: an intra-prediction mode, the width and height of the current block, quantization parameters, information on whether the current block is luminance or chrominance, whether surrounding blocks are intra-coded, and information on the existence of residual transformation coefficients of surrounding blocks.

[0352] FIG. 35 is a diagram illustrating a method for generating a prediction sample (pixel) based on a plurality of reference pixel lines according to one embodiment of the present specification.

[0353] Referring to FIG. 35(a), the video signal processing device may generate a prediction sample (3502) within the current block based on a first reference pixel line (reference line 1) adjacent to the current block (3501) and a second reference pixel line (reference line 2) adjacent to the first reference pixel line. The prediction sample (3502) of FIG. 35(a) is merely a sample corresponding to a location according to one embodiment of the present specification, and the location of the pixel is not limited thereto. In the present specification, the meaning of the video signal processing device generating may be the same as the meaning of the video signal processing device acquiring. FIG. 35(b) is a more detailed illustration of FIG. 35(a). For example, the video signal processing device may generate a first prediction pixel (3503) 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. Additionally, the video signal processing device can generate a second prediction pixel (3504) by 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 (3505) by performing a weighted average on the generated first prediction pixel (3503) and second prediction pixel (3504) using arbitrary predetermined weights. At this time, the six reference pixels of the second reference pixel line may be reference pixels located one pixel to the right of each pixel of the first reference pixel line, taking into account the intra prediction mode of the current block, the pixel location to be generated, the location of the reference pixel line, etc. The video signal processing device can generate a prediction sample (3502) within the current block based on the third prediction pixel (3505).Alternatively, the video signal processing device may generate a prediction sample (3502) within the current block based on the third prediction pixel (3505) and the distance between the third prediction pixel (3505) and the prediction sample (3502) within the current block. The weight used by the video signal processing device to generate the third prediction pixel (3505) may be an integer greater than or equal to 0. For example, the weight of the first prediction pixel (3503) may be 3, and the weight of the second prediction pixel (3504) may be 1. At this time, the position of the reference pixel used to generate a prediction sample based on at least one of the following may vary: the position of the current block’s intra prediction mode, the position of the generated pixel (e.g., the position of the first prediction pixel (3503), the position of the second prediction pixel (3504), the position of the third prediction pixel (3505) in FIG. 35), the position of the reference pixel line (e.g., the position of the first reference pixel line, the position of the second reference pixel line in FIG. 35).

[0354] A video signal processing device may acquire prediction samples within a current block according to the directionality of an intra-prediction mode using samples from a pre-specified or signaled reference sample line. Here, the pre-specified reference sample line may be a reference sample adjacent to the current block. Additionally, the signaled reference sample line may be a sample at a position -X samples from the boundary of the current block, where X is a signaled value. X can be 1, 2, 3, etc. The video signal processing device may generate a prediction block using multiple reference sample lines. In this specification, the pre-specified reference sample line or the signaled reference sample line may be referred to as the main reference sample line. The video signal processing device may set a sub-reference sample line based on the main reference sample line. In this specification, the sub-reference sample line may be a reference sample line at a position Y samples away from the main reference sample line. Here, Y can be an integer, such as -3, -2, -1, 1, 2, 3, etc. The encoder can signal information about the sub-reference sample line and include it in the bitstream, and the decoder can parse the information to set the sub-reference sample line. In a video signal processing device, a prediction block can be generated from the main reference pixel line and the sub-reference sample line, respectively, using a single intra prediction mode, and then a final prediction block can be generated by weighted averaging each prediction block; this method can be called intra fusion.

[0355] FIG. 36 illustrates a method for predicting a sample using a plurality of reference pixel lines according to one embodiment of the present specification.

[0356] Referring to FIG. 36, a video signal processing device can receive a plurality of reference pixel lines and perform intra prediction to generate a prediction block within the current block. Different prediction blocks may be generated depending on which reference pixel lines are used, and the video signal processing device can generate a final prediction block by weighting the input weights for each prediction block. In this case, the weights may be pre-set values. For example, the weight of a sample predicted by the main reference pixel line may be 3, and the weight of a sample predicted by the sub-reference pixel line may be 1. In this case, the weights may be determined based on at least one of the following: the size of the current block, the width or height 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. Additionally, the reference pixel line may be determined based on at least one of the following: the size of the current block, the width or height 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 located at an arbitrary fixed position away from the reference pixel line indicated by the MRL, the arbitrary fixed position may be an integer from -N to +N, where N is an integer greater than 0.

[0357] The intra prediction mode used in the method for generating prediction samples within the current block described above may be the same for every reference pixel line. Alternatively, conversely, the intra prediction mode used in the method for generating prediction samples within the current block described above may differ for every 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) may be used in the sub-reference pixel line, which is added to or subtracted by an arbitrary value from the intra prediction mode (index) used in the main reference pixel line. In this case, the arbitrary value may be an integer greater than or equal to 1. Additionally, 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 angle of the intra prediction mode by an arbitrary value if it is negative, and decrease it by an arbitrary value if it is positive.

[0358] FIG. 37 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 specification.

[0359] Referring to FIG. 37, the encoder can generate prediction blocks for a template by receiving multiple reference pixel lines as input and performing intra-prediction. Different prediction blocks may be generated depending on which reference pixel lines are used. The encoder can generate a final prediction block for the template by performing a weighted average based on various weight information input to each prediction block. Multiple prediction blocks may be generated depending on which reference pixel lines are used and which weights are used. The encoder calculates the cost between each prediction block and the reference template, then reorders them in ascending order based on the cost corresponding to each prediction block, and can construct a separate list using only a predetermined number of top candidates. At this time, the predetermined number may be an integer greater than or equal to 2, or 10. The encoder can generate a prediction block for the current block using the combination information used to generate the prediction blocks within the separate list. Then, the encoder can 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 construct the same separate list through the method described above and generate a prediction sample using the optimal combination information indicated by the optimal candidate index determined by parsing information about the optimal candidate index included in the bitstream.

[0360] When the current block is encoded in intra prediction mode, the intra prediction mode can be any one of the following: Angle mode, Planar mode, DC mode, or MIP mode. Prediction based on Angle mode can be performed according to 65 different angles, while prediction based on MIP mode can be performed based on a predefined matrix. Angle mode can be effective for blocks where characteristics such as edges exist within the current block. However, if the current block has smooth characteristics, blocks predicted using Angle mode may generate discontinuous edges at the boundaries between blocks or visible contours within the blocks. This can be a factor that reduces encoding efficiency. Additionally, DC mode may have the disadvantage of generating visible edges at the boundaries between blocks at low bit rates. Planar mode can improve the edge problems caused by Angle mode and DC mode, thereby generating predicted blocks without discontinuities.

[0361] FIG. 38 illustrates a method for generating a prediction sample using a planar mode according to one embodiment of the present specification.

[0362] Referring to FIG. 38, 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 predicted sample within the current block. The video signal processing device can generate a predicted sample (value) within the current block by weighting and averaging the linearly predicted value in the vertical direction and the linearly predicted value in the horizontal direction.

[0363] The linearly predicted value in the vertical direction (predV(x, y)) can be generated based on Equation 4, and the linearly predicted value in the horizontal direction (predH(x, y)) can be generated based on Equation 5. And, the new predicted value (pred(x, y)) can be generated based on Equation 6. In Equations 4 through 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 the pixel value at the (x, y) coordinate. The predicted value (predV(x, y), predH(x, y), pred(x, y)) may mean the predicted pixel value at the (x, y) coordinate.

[0364]

[0365]

[0366]

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

[0368] FIG. 39 illustrates a method for selecting an intra prediction mode based on the frequency of occurrence of an intra prediction mode according to one embodiment of the present specification.

[0369] FIGS. 40 and FIGS. 41 show surrounding blocks of a current block according to one embodiment of the present specification.

[0370] The OBIC (Occurrence-based intra coding) mode, which is an intra coding mode based on the frequency of occurrence of the intra prediction mode, can be performed in the following order.

[0371] Referring to FIG. 39, the video signal processing device can first determine whether the OBIC mode is applicable to the current block. Whether the OBIC mode is applicable can be determined by using at least one of the following: the position of the current block, whether the current block is a luminance block or a chrominance block, whether the current block is encoded in an intra-prediction mode, whether DIMD is applicable, the width and height of the current block, and the number of blocks among the surrounding blocks of the current block used to derive the OBIC mode. If the number of blocks among the surrounding blocks of the current block used to derive the OBIC mode is less than a predetermined number, the current block may not have the OBIC mode applied, and the syntax elements associated with OBIC may not be signaled or parsed.

[0372] If the OBIC mode is applicable to the current block, the video signal processing device can derive an intra prediction mode from the surrounding blocks of the current block. In this case, the surrounding blocks may be blocks adjacent to the current block. For example, the blocks at positions A0, A1, B0, B1, and B2 in FIG. 40 may be surrounding blocks. Alternatively, the surrounding blocks may be blocks not adjacent to the current block. For example, the blocks at positions Ax, Bx, Cx, ax, bx, and cx in FIG. 41 may be surrounding blocks. If the surrounding blocks of the current block are encoded in IBC or Intra TMP mode, the reference block indicated by the BV of the current block may be used as the surrounding block for the OBIC mode. Additionally, if the current picture is not the I picture but the P picture or the B picture, a temporal surrounding block corresponding to the current block from another reference picture that is not identical to the POC (picture order count) of the current picture may also be used as the surrounding block for the OBIC mode. Temporal neighbor blocks may be blocks whose positions have been moved using movement information of blocks adjacent to the current block.

[0373] The video signal processing device may additionally check (inspect) whether the peripheral blocks can be used for OBIC mode by using one or more of the encoding mode of the peripheral blocks and the distance between the peripheral blocks and the current block. If the peripheral blocks are not encoded in intra mode, the peripheral blocks may not be used for OBIC mode. If the peripheral blocks are encoded in intra mode and the encoding mode is one of EIP, Intra TMP, or MIP mode, the peripheral blocks may not be used for OBIC mode. If the peripheral blocks are encoded in intra mode and the encoding mode is one of EIP, Intra TMP, or MIP mode, the peripheral blocks may be used for OBIC mode. If the peripheral blocks are encoded in IBC or inter-coding mode, the peripheral blocks may be used for OBIC mode.

[0374] Available neighbor blocks can be sorted based on their distance from the current block, and only a predetermined number of neighbor blocks in sorted order can be used as neighbor blocks for OBIC mode. The predetermined number can be an integer greater than or equal to 1, and can be 20.

[0375] When the intra prediction mode of a surrounding block is DIMD or TIMD mode, the video signal processing device may also add the intra prediction mode used for blending to the histogram. When the intra prediction mode is added to the histogram using the intra prediction mode used for blending, the frequency may be a value smaller (or larger) than the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block), or the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block). For example, a value smaller (or larger) than the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block) may be half (or twice) the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block).

[0376] The video signal processing device may add a predetermined number of intra prediction modes to the histogram when the intra prediction mode of the surrounding block is OBIC mode. When an intra prediction mode is added to the histogram using an intra prediction mode other than the first intra prediction mode (the mode with the highest frequency in the histogram), the frequency may be the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block), or a value smaller than (or larger than) the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block). For example, a value smaller than (or larger than) the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block) may be half (or twice) the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block).

[0377] If the intra prediction mode of a surrounding block is SGPM mode, the intra prediction mode of each region can be added to the histogram. The value of the segmentation angle associated with SGPM converted to the intra prediction mode can be added to the histogram.

[0378] If the encoding mode of a neighboring block is Inter Prediction Mode or IBC Mode, the Intra Prediction Mode stored in the neighboring block can be added to the histogram. If the Intra Prediction Mode of a neighboring block is GPM Mode, the Intra Prediction Mode of each region partitioned based on GPM Mode can be added to the histogram. The value obtained by converting the partitioning angle associated with GPM into Intra Prediction Mode can be added to the histogram.

[0379] When a video signal processing device constructs a histogram, the histogram frequency value for the intra prediction mode derived from the surrounding block may vary depending on the encoding mode of the surrounding block. Depending on the encoding mode (e.g., any one of DIMD, TIMD, TMRL, SGPM, or MPM-based intra prediction modes), the frequency value may be pre-set. The pre-set frequency value may be a value greater than (or smaller than) the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block). For example, a value smaller than (or larger than) the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block) may be half (or twice) the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block). If the encoding mode of the current block is EIP, Intra TMP, or MIP encoding mode, the histogram frequency value may be a value smaller (or larger) than the product of the width and height of the neighboring block (or the sum of the width and height of the neighboring block). For example, a value smaller (or larger) than the product of the width and height of the neighboring block (or the sum of the width and height of the neighboring block) may be half (or twice) the product of the width and height of the neighboring block (or the sum of the width and height of the neighboring block). In addition to the intra prediction mode derived from the neighboring block, an intra prediction mode derived based on history may also be added to the histogram.

[0380] When a video signal processing device constructs a histogram, the histogram frequency value for an intra prediction mode derived from a surrounding block may vary depending on the distance between the surrounding block and the current block. The closer the distance between the surrounding block and the current block, the higher the histogram frequency value, and the farther the distance between the surrounding block and the current block, the lower the histogram frequency value. For example, the video signal processing device may construct a histogram using the histogram frequency value for an intra prediction mode derived from a surrounding block (the value obtained by subtracting the distance between the surrounding block and the current block from the product of the horizontal length and vertical length of the surrounding block (or the sum of the horizontal and vertical lengths of the surrounding block) as the frequency value.

[0381] Frequency-based methods (e.g., using histograms) can be used to construct a motion candidate list, a block vector candidate list, or a CCP candidate list. A video signal processing device can construct candidate lists (motion candidate list, block vector candidate list, CCP candidate list) based on the frequency of occurrence of surrounding blocks, or rearrange the candidates in order of frequency.

[0382] Next, the video signal processing device can derive an intra prediction mode from selected surrounding blocks. Then, the video signal processing device can generate a histogram for the intra prediction mode based on the value of the derived intra prediction mode and the product of the width and height of the surrounding blocks (or the sum of the width and height of the surrounding blocks). In this case, the value of the derived intra prediction mode may be the value of the X-axis component of the histogram (which may be described as a class in this specification), and the product of the width and height of the surrounding blocks (or the sum of the width and height of the surrounding blocks) may be the value of the Y-axis component of the histogram (which may be described as a frequency in this specification). The video signal processing device can generate a prediction block for the current block using the top K intra prediction modes that occurred most frequently in the histogram. Here, K is a predetermined number, which may be 5. When a video signal processing device uses multiple intra prediction modes, it can generate prediction blocks using each intra prediction mode, and then generate weighted average prediction blocks by applying a weight to each prediction block.

[0383] FIG. 42 illustrates a method of using a prediction mode-based candidate list according to one embodiment of the present specification.

[0384] Referring to FIG. 42, the video signal processing device can generate a predicted block of the current block using a candidate list based on a prediction mode. The video signal processing device can construct a prediction mode candidate list for the current block. In this case, the video signal processing device can construct the prediction mode candidate list using at least one of surrounding block information, DIMD information of the current block, TIMD information of the current block, MPM list of the current block, and Non-MPM list of the current block. The surrounding block information may be a block adjacent to the current block, a block that is not adjacent to the current block but is located at a predetermined distance, or a surrounding block stored in a separate memory. The surrounding block information may be intra-prediction directional mode information of the surrounding block and weight values ​​for each mode. The predetermined distance may be determined based on at least one of the top-left sample position of the current block, the width and height of the current block, and the predetermined width and height. For example, a video signal processing device can derive surrounding blocks based on a position moved horizontally to the left by the width of the current block based on the top-left sample position of the current block, and a position moved vertically upward based on the top-left sample position of the current block.

[0385] A method for a video signal processing device to construct a candidate list based on prediction modes is described. The video signal processing device may generate a prediction mode candidate by using at least one of the following: surrounding block information, DIMD information of the current block, TIMD information of the current block, MPM list of the current block, Non-MPM list of the current block, DIMD information derived from a cumulative histogram of multiple histograms used to derive DIMD in surrounding blocks, and the top N (a predetermined number) intra prediction modes with high occurrence frequency among the intra prediction modes used in surrounding blocks. The predetermined number may be an integer of 5. For example, a prediction mode candidate based on occurrence frequency may include 5 intra prediction modes. In this case, the prediction mode may consist of two or more intra prediction directional modes, and the intra prediction directional modes of a single prediction mode candidate may be different from each other. Additionally, the prediction mode may include only directional intra prediction modes. Furthermore, the prediction mode may not include a non-directional mode, such as a planar mode. If the intra-predicted directional mode derived from a surrounding block is a planar mode, the intra-predicted directional mode derived from the surrounding block may be excluded from the prediction mode. Additionally, the prediction mode may not include a non-directional mode, such as a DC mode. If the intra-predicted directional mode derived from a surrounding block is a DC mode, the intra-predicted directional mode derived from the surrounding block may be excluded from the prediction mode. A prediction mode candidate generated by the method described above may be added to the prediction mode candidate list. The video signal processing device may determine whether the same prediction mode candidate exists in the prediction mode candidate list, and only if it does not exist may the generated prediction mode candidate be added to the prediction mode candidate list. The maximum size of the prediction mode candidate list may be a predetermined number, and the predetermined number may be an integer, such as 25.If the maximum size of the prediction mode candidate list is a predetermined number, the video signal processing device may not add any more prediction mode candidates.

[0386] The video signal processing device can generate a reordered list of prediction mode candidates by performing a reorder based on the template cost on the list of prediction mode candidates. Meanwhile, the reordering process may not be performed. The reorder based on the template cost can be performed in the manner described above through FIG. 30. The video signal processing device can construct a reference template using restored surrounding samples adjacent to the current block. The video signal processing device can generate a prediction template for the reference template using the prediction mode candidates within the list of prediction mode candidates and a pre-specified reference sample line (e.g., Reference line 1, 2, 3, … in FIG. 8). The pre-specified reference sample line may be Reference line 1 (e.g., a line adjacent to the current block template). The video signal processing device can calculate the cost between the reference template and the prediction template. Here, the cost may be the sum of the absolute values ​​of the differences between samples (SAD). Additionally, the cost may be the sum of the absolute values ​​of the differences between sample values ​​(MR-SAD), calculated by subtracting the mean of each template from each sample value. The intra-prediction directional mode of a prediction mode candidate used to generate a prediction template can be used to generate a prediction template after being converted to an intra-prediction mode range that is extended beyond the range of the existing intra-prediction mode. For example, if the intra-prediction directional mode of a prediction mode candidate is N, the extended intra-prediction directional mode M can be (N * 2) - 2. Additionally, since the prediction mode candidate consists of two or more intra-prediction directional modes, the prediction templates generated using each intra-prediction directional mode can be weighted averaged by applying pre-specified weights, and the video signal processing device can generate a weighted averaged prediction template. In this case, the weights can be pre-specified values, and the weights for each intra-prediction directional mode can be the same or different from each other.Based on the above calculated costs, the list of prediction mode candidates can be reordered and reordered in ascending order.

[0387] The video signal processing device can reconstruct the prediction mode candidate list using the MPM list and the reordered prediction mode candidate list. In this case, the video signal processing device can construct the prediction mode candidate list using a portion of the MPM list and a portion of the reordered prediction mode candidate list. Candidates from the first candidate of the MPM list up to a predetermined number of candidates may be added to the prediction mode candidate list, and the predetermined number may be 5. Candidates from the prediction mode candidate list of the reordered prediction mode candidate list may be added to the prediction mode candidate list in order from lowest to highest cost, up to a predetermined number, and the predetermined number may be an integer or 16.

[0388] The encoder can determine the optimal prediction mode candidate for the current block from the derived prediction mode candidate list (or the prediction mode candidate list if the prediction mode candidate list reconstruction process has not been performed), and then generate and signal a bitstream containing index information for the optimal prediction mode candidate. The decoder can parse the index information for the optimal prediction mode candidate from the bitstream and obtain a prediction block for the current block using the determined optimal prediction mode candidate. The video signal processing device can obtain the final prediction block of the current block through a weighted average between the prediction block obtained based on the planar mode (or DC mode) and the prediction block obtained using the optimal prediction mode candidate.

[0389] Whether a method for generating a prediction block using a prediction mode-based candidate list is enabled can be determined based on at least one of the following: whether the current block is a luminance block or a chrominance block; whether an intra prediction mode is applied to the current block; whether one of the DIMD, TIMD, SGPM, ISP, MIP, Intra TMP, or TMRL modes is applied to the current block; the reference pixel line information of the current block; the width and height of the current block; and whether the current block is located at the top boundary of the CTU containing the current block. For example, if any of the DIMD, TIMD, SGPM, ISP, MIP, Intra TMP, or TMRL modes are applied to the current block, the video signal processing device may not use a method for generating a prediction block using a prediction mode-based candidate list and may not signal or parse the syntax associated with a method for generating a prediction block using a prediction mode-based candidate list.

[0390] If the video signal processing device is one of the coding modes of the current block, such as DIMD, TIMD, SGPM, MIP, Intra TMP, or TMRL, it can use a candidate list based on the derived prediction mode.

[0391] If DIMD is applied to the current block, the video signal processing unit may add the induced prediction mode to the candidate list based on the induced prediction mode using DIMD. Then, the video signal processing unit may rearrange the candidate list based on the template cost. The encoder may signal an index representing the optimal prediction mode within the candidate list, and the decoder may determine the prediction mode for the current block after parsing the index information from the bitstream.

[0392] If TIMD is applied to the current block, the video signal processing unit may add the induced prediction mode to the candidate list based on the induced prediction mode using TIMD. Then, the video signal processing unit may rearrange the candidate list based on the template cost. The encoder may signal an index representing the optimal prediction mode within the candidate list, and the decoder may determine the prediction mode for the current block after parsing the index information from the bitstream.

[0393] A video signal processing device may use one intra prediction mode as a reference intra prediction mode to derive one or more additional intra prediction modes through a predefined rule. The video signal processing device may generate one or more prediction blocks using the reference intra prediction mode and the derived intra prediction modes. Furthermore, if the video signal processing device generates multiple prediction blocks, it may generate a final prediction block by weighting and fusion the multiple prediction blocks. The predefined rule may involve constructing additional intra prediction modes by adding or subtracting a pre-specified value based on the reference intra prediction mode. The pre-specified value may be an integer greater than or equal to 1. For example, if the reference intra prediction mode is mode 18, the additionally derived intra prediction modes may be mode 17 (18-1) and mode 19 (18+1). The video signal processing device may generate multiple prediction blocks using one or more reference pixel lines, and then generate a final prediction block by weighting and fusion the prediction blocks. The method of generating a final prediction block by weighting and averaging multiple prediction blocks may be described as a reference intra prediction mode-based fusion method.

[0394]

[0395]

[0396] The range of the intra prediction mode can be selectively applied to each block, and the method of selectively applying the intra prediction mode to each block can be called AIDR (Adaptive Intra Directional Mode Resolution). In this case, the range of the intra prediction mode can be configured in various ways. For example, the first range mode can be a range from 2 to 34, the second range mode can be a range from 2 to 66, and the third range mode can be a range from 2 to 130. The video signal processing device can set different types of the range of the intra prediction mode by using at least one of the following: the width and height of the current block, the number of samples of the current block, and information regarding the color component of the current block (whether it is a luminance component or a chrominance component). For example, if the number of samples of the current block is less than 256, only the second and third ranges of the range of the intra prediction mode may be possible. Alternatively, if the number of samples of the current block is greater than 512, only the first range of the range of the intra prediction mode may be possible. If the encoding mode of the current block is not a mode that implicitly induces an intra prediction mode (e.g., DIMD, TIMD, TMRL, SGPM, ISP, MIP, Intra TMP, IBC, EIP) (i.e., an MPM-based encoding mode that explicitly signals an intra prediction mode), the encoder may include information indicating the range mode in the bitstream and signal it. The information indicating the range mode may be signaled before the Primary MPM index is signaled. Or the information indicating the range mode may be signaled before the Secondary MPM index is signaled. Or the information indicating the range mode may be signaled before the Non-MPM index is signaled.Alternatively, information indicating the range mode may be signaled after any one of the Primary MPM index, Secondary MPM index, or Non-MPM index is signaled. The decoder can parse the information indicating the range mode to set the range of the intra prediction mode for the current block.

[0397]

[0398] The extended intra-prediction mode range can be applied to all blocks. Additionally, the video signal processing device may use one or more of the information regarding the encoding mode or the range mode of the current block to perform scaling and inverse scaling on the intra-prediction mode derived from surrounding blocks, and use this to derive the intra-prediction mode for the current block.

[0399] FIG. 43 illustrates reference sample filtering according to one embodiment of the present specification.

[0400] The video signal processing unit can perform intra prediction using the restored surrounding samples. To prevent subjective quality degradation of the prediction block caused by noise in the surrounding samples, the video signal processing unit can perform filtering on the reference samples. Referring to FIG. 43, the video signal processing unit can perform reference sample filtering using a {1, 2, 1} filter. The video signal processing unit can use surrounding samples A and B to perform reference sample filtering for the reference sample location (X). The filtered sample (X') can be calculated using '(A + 2 * X + B) / 4'. Filtering can be performed on all reference samples adjacent to the block currently being predicted. In the same way, the video signal processing unit can use surrounding samples C and D to perform reference sample filtering for the reference sample location (Y).

[0401] FIG. 44 illustrates PDPC filtering according to one embodiment of the present specification.

[0402] Discontinuous changes in sample values ​​may occur at the boundary between an intra-prediction block and an adjacent block. These discontinuities may occur at the top and left boundary of the prediction block. To eliminate these discontinuities, the video signal processing device may apply filtering within the prediction block after the prediction block is generated, and this filtering may be described as PDPC filtering. The method of PDPC filtering may vary depending on the intra-prediction directional mode. Fig. 44(a) shows an example of a PDPC filtering method for the case where the intra-prediction directional mode is horizontal. Referring to Fig. 44(a), the video signal processing device may use at least one of the restored surrounding samples R(-1, 0), R(-1, -1), and R(1, -1), and perform filtering on the (1, 0) sample within the prediction block through a weighted average using each surrounding sample. That is, the video signal processing device may apply the difference in change between reference samples to the (1, 0) sample within the prediction block. FIG. 44(b) illustrates an example of a PDPC filtering method when the intra-prediction directional mode is not Planar, DC, horizontal, or vertical. Referring to FIG. 44(b), the video signal processing device may use at least one of the reconstructed surrounding samples R(3, -1) and R(-1, 3) and perform filtering on the (1, 1) sample within the prediction block through a weighted average using each surrounding sample. That is, if the (1, 1) sample within the prediction block is predicted from the upper surrounding sample R(3, -1), the video signal processing device may apply compensation to the (1, 1) sample within the prediction block using the left surrounding sample R(-1, 3) indicated by the intra-prediction directional mode. R(x, y) may be a reconstructed sample adjacent to the current block.The video signal processing device can perform a prediction for a sample within a prediction block from a first peripheral sample corresponding to a sample within a prediction block in a first reference sample using an intra-prediction mode, and can perform a PDPC filtering process using a sample within a prediction block in a second reference sample and / or a second peripheral sample corresponding to a first reference sample.

[0403] PDPC filtering is a method of applying filtering (or compensation) to samples within a prediction block based on the difference in change between neighboring samples. Depending on the intra prediction mode, there may be cases where it is not possible to derive a left neighboring sample corresponding to an upper neighboring sample. Conversely, depending on the intra prediction mode, there may be cases where it is not possible to derive an upper neighboring sample corresponding to a left neighboring sample. The video signal processing device may not apply PDPC filtering in an intra prediction mode where it is not possible to derive the difference in change between neighboring samples from the upper neighboring sample and the left neighboring sample. The video signal processing device may determine whether to apply PDPC filtering to the current block based on at least one of the width or height of the current block and the intra prediction mode. The upper neighboring sample and the left neighboring sample may include the upper-left neighboring sample. At least one of the first reference sample and the second reference sample may be a filtered sample generated through filtering between neighboring samples. Filtering between neighboring samples may be one of cubic, Gaussian, low-frequency, high-frequency, or smoothing filtering. For example, smoothing filtering may be 1:2:1 filtering.

[0404] FIG. 45 illustrates gradient PDPC filtering according to one embodiment of the present specification.

[0405] In cases where the difference in change between surrounding samples cannot be induced according to the intra prediction mode, the video signal processing device may not use surrounding samples corresponding to the sample within the prediction block, but may apply the difference in change between samples corresponding to the intra prediction mode among surrounding samples to the sample within the prediction block. Referring to FIG. 45, the video signal processing device may not perform PDPC filtering using the left reference sample corresponding to the sample (X) within the prediction block, but may perform PDPC filtering for the sample (X) within the prediction block using the difference in change between the r(-1+d, -1) sample and the r(-1, y) sample corresponding to the current intra prediction mode among the reference samples, and such filtering may be described as gradient PDPC filtering. Here, y may be the vertical coordinate of the sample within the prediction block, and d may be the decimal position of the sample pointed to by the intra prediction mode. y may be changed to a horizontal coordinate according to the intra prediction mode, and the sample may be changed to the r(-1, -1+d) sample and the r(x, -1) sample. A video signal processing device can use an intra-prediction mode to derive alternative possible change differences using a first reference sample and a second reference sample that do not correspond to a sample within the prediction block. Then, the video signal processing device can perform PDPC filtering by applying the derived alternative change differences to the sample within the prediction block. Here, at least one of the first reference sample and the second reference sample may be derived using one of vertical and / or horizontal coordinates in the sample within the prediction block. At least one of the first reference sample and the second reference sample may be a top-left sample. At least one of the first reference sample and the second reference sample may be a filtered sample generated through filtering between neighboring samples. Filtering between neighboring samples may be one of cubic, Gaussian, low-frequency, high-frequency, or smoothing filtering.For example, smoothing filtering can be 1:2:1 filtering. CIIP PDPC can be a mode that applies PDPC to intra-prediction blocks in CIIP mode.

[0406] FIG. 46 illustrates a matrix-based intra-prediction method according to one embodiment of the present specification.

[0407] A method of performing intra prediction using a model (or matrix) that infers the relationship between the current block and reference samples through a large amount of image data can be called a matrix-based position-dependent intra prediction (PDP). Referring to FIG. 46, a video signal processing device can generate a prediction block P(x, y) for the current block using a restored reference sample (r in FIG. 46) r(k) adjacent to the block to be predicted (p in FIG. 46) and a predefined matrix F(x, y, k) (see mathematical formula in FIG. 46(b)). The matrix can be determined based on the size of the current block and the intra prediction directionality mode. Additionally, the size of the reference sample can be determined based on the size of the current block. For example, if the width and height of the current block are smaller than or equal to a predefined first size, T1 and T2 may be a predefined second size. If the width and height of the current block are larger than the predefined first size, T1 and T2 may be a predefined third size. Here, the first predetermined size may be 16, the second predetermined size may be 2, and the third predetermined size may be 1. Also, in FIG. 46, W and H represent the width and height of the current block. Unlike conventional MIP methods, when a PDP is applicable to the current block, the video signal processing device can generate a prediction block for the current block using matrix-based intra prediction through the PDP, rather than using intra prediction through the conventional intra prediction directional mode.At this time, whether a PDP can be applied to the current block may be determined based on at least one of the following: the size of the current block, the number of samples of the current block, the ratio between the width and height of the current block, the intra-predicted directional mode of the current block, whether the current block is a luminance block or a chrominance block, whether an inferred matrix exists, whether a reference sample exists, the encoding mode of the current block, and the reference sample line. Here, if the encoding mode of the current block is one of DIMD, OBIC, CIIP, SGPM, TIMD, TMRL, Directional Planar, EIP, MIP, ISP, IBC, Intra TMP, BDPCM, Palette, Inter mode, LM, GPM, or CCCM, the current block may not be able to use a PDP-based method. The video signal processing device may determine whether a PDP mode is applicable based on the intra-predicted directional mode of the current block. For example, the video signal processing device may determine that the PDP mode is applicable to the current block only if the intra prediction directional mode of the current block is a pre-specified mode. The pre-specified mode may vary depending on the encoding mode of the current block. If the encoding mode of the current block is an MPM-based intra prediction mode, and the intra prediction mode is a planar (or directional planar) mode, DC mode, or even angle mode, the video signal processing device may generate a prediction block for the current block using matrix-based intra prediction via PDP instead of using intra prediction via the existing intra prediction directional mode. The encoding mode of the current block may be one of DIMD, OBIC, CIIP, SGPM, TIMD, TMRL, Directional Planar, EIP, MIP, ISP, IBC, Intra TMP, BDPCM, Palette, Inter mode, LM, GPM, or CCCM.The video signal processing device may apply the PDP to the current block only if the reference sample used to predict the current block via the PDP is within the slice and / or tile to which the current block belongs. The video signal processing device may determine that the PDP cannot be applied to the current block if the reference sample used to predict the current block via the PDP is in a different slice and tile other than the slice and / or tile to which the current block belongs. When the PDP mode is applied to the current block, the reference sample used may be determined based on the intra-prediction mode of the current block. For example, if the intra-prediction mode is a pre-specified mode, the size of the reference sample may be a pre-specified first size. Otherwise, if the intra-prediction mode is not a pre-specified mode, the size of the reference sample may be a pre-specified second size. Here, the pre-specified mode may be a range where the intra-prediction mode (see FIG. 6) is greater than or equal to 19 and less than or equal to 49. Referring to FIG. 46, the pre-specified first size may be W x T1 for the top reference sample and T2 x (H + T1) for the left reference sample. Referring to FIG. 46, the pre-specified second size may be 2W x T1 for the top reference sample and T2 x (2H + T1) for the left reference sample. Here, W x T1 may have a horizontal length of W and a vertical length of T1.

[0408] If the PDP method is applicable to the current block, the video signal processing device may generate a prediction block using the matrix and reference samples indicated by the intra prediction mode, without performing intra prediction through the intra prediction directional mode, by replacing the existing intra prediction method. Therefore, whether the PDP mode is applied may not be signaled on a block-by-block basis. If any one of the modes DIMD, TIMD, OBIC, SGPM, TMRL, Intra TMP, IBC, GPM, or CIIP is applied to the current block and the intra prediction directional mode is a mode to which the PDP method is applicable, the video signal processing device may generate a prediction block for the intra prediction directional mode through the PDP method. For example, if the DIMD mode is applied to the current block, the video signal processing device may weight-average the blocks predicted through up to six intra prediction directional modes. In this case, if the intra prediction directional mode is to which the PDP method is applicable, the prediction block may be generated through the PDP method. In DIMD mode, the prediction blocks used for the weighted average may be at least one of the blocks predicted through the intra prediction directional mode and the blocks predicted through the PDP method. This method can be similarly applied in TIMD, OBIC, SGPM, TMRL, Intra TMP, IBC, and CIIP.

[0409] If the intra prediction directional mode is one of the preset modes, the video signal processing device may generate a prediction block through linear interpolation using reference samples, which is a general intra prediction method, without using the PDP method. The preset modes may be any intra prediction mode from 0 to 66, and may be Planar, DC, horizontal, vertical, diagonal, or anti-diagonal. If one of DIMD, TIMD, or OBIC is applied to the current block and the intra prediction mode is one of the preset modes, the video signal processing device may generate a prediction block using a general intra prediction method instead of the PDP method. Alternatively, if the intra prediction mode is not a preset mode but the PDP method is applicable, the video signal processing device may generate a prediction block by performing prediction using the PDP method. Since the prediction accuracy of the PDP method may vary depending on the size of the current block, the decision to apply the PDP method may be determined based on the size of the current block. The video signal processing device may determine whether the PDP method is applied to the current block by considering at least one of the current block size, the width and height, and the ratio between the width and height. Alternatively, the video signal processing device may determine whether the PDPC method is applied to the block predicted by the PDP method by considering at least one of the current block size, the width and height, and the ratio between the width and height. For example, if the current block size is larger than a preset size, the PDP method may not be applied to the current block. Alternatively, if the current block size is larger than a preset size and the video signal processing device has generated a predicted block for the current block using the PDP mode, the video signal processing device may generate a filtered predicted block by applying the PDPC method to the predicted block.When a PDP method prediction is applied to the current block, the video signal processing device can derive a DIMD-based intra prediction mode by utilizing samples within the prediction block, and can derive a conversion kernel (or conversion method, set of conversion kernels) based on the derived intra prediction mode.

[0410] The DIMD method may be a method for deriving an intra-predicted directional mode using the directionality calculated from surrounding samples of the current block. The accuracy of the intra-predicted directional mode used in the DIMD method may be determined based on the number of surrounding samples used to calculate the directionality. If the size of the current block is small, the number of surrounding samples used to calculate the directionality may be small. Therefore, to improve the accuracy of the derived intra-predicted directional mode, the video signal processing device may determine the number of surrounding samples used to calculate the directionality using at least one of the width and height of the current block and the ratio of the width and height of the current block. The video signal processing device may determine a first threshold for histogram acquisition used in the DIMD method using at least one of the width and height of the current block and the ratio of the width and height of the current block. The video signal processing device may compare the first threshold with the sum of the histogram frequency values ​​derived through the directionality calculation, and calculate the directionality through surrounding samples and accumulate it in the histogram until the frequency value becomes greater than the first threshold. In one embodiment, if the width and height of the current block are smaller than a predetermined size, the number of surrounding samples used to compare the first threshold and the frequency value may be increased. The predetermined size may be the case where the size of the current block is M x N, where M and N may be integers, for example, 16 x 16. The first threshold may be an integer, for example, 1000. Additionally, the first threshold may be determined by multiplying the number of surrounding samples used to calculate the directionality by a predetermined value. In this case, the predetermined value may be an integer, for example, 1000.A method of inducing an intra-predicted directional mode by accumulating histograms based on a first threshold can be called an Adaptive DIMD method or Adaptive HoG (Histogram of Gradients) DIMD.

[0411] FIG. 47 shows a surrounding sample used to calculate directionality according to one embodiment of the present specification.

[0412] FIG. 47(a) shows upper-periphery samples around the current block used to calculate orientation in the adaptive DIMD method. The upper-periphery samples may include samples adjacent to the upper boundary of the current block (A in FIG. 47(a)). The upper-periphery samples may include samples located at a predetermined distance from the upper boundary of the current block (B, C, D in FIG. 47(a)). FIG. 47(b) shows left-periphery samples around the current block used to calculate orientation in the adaptive DIMD method. The left-periphery samples may include samples adjacent to the left boundary of the current block (A in FIG. 47(b)). The left-periphery samples may include samples located at a predetermined distance from the left boundary of the current block (B, C, D in FIG. 47(b)). To calculate directionality, the video signal processing device may use samples located at positions separated by a predetermined distance from the upper / left boundary of the current block, starting from samples adjacent to the upper / left boundary of the current block. For example, the video signal processing device may use A in FIG. 47(a) and A in FIG. 47(b), and sequentially use B in FIG. 47(a), B in FIG. 47(b), C in FIG. 47(a), C in FIG. 47(b), D in FIG. 47(a), and D in FIG. 47(b). In this specification, samples adjacent to the upper / left boundary of the current block and samples separated by the same distance from the upper / left boundary of the current block may be described as respective surrounding sample groups. For example, in this specification, A in FIG. 47(a) and A in FIG. 47(b) may be described as Group A, B in FIG. 47(a) and B in FIG. 47(b) as Group B, C in FIG. 47(a) and C in FIG. 47(b) as Group C, and D in FIG. 47(a) and Group D in FIG. 47(b). The range of samples used to calculate orientation within a surrounding sample group may be determined based on the distance between the boundary of the current block and the surrounding sample group.The video signal processing device may calculate the directionality for each sample within a surrounding sample group in sequence and generate a cumulative histogram based on the calculated directionality. The directionality may be calculated based on Equation 1 and Equation 2. The sample used by the video signal processing device to calculate the directionality may be a 3 x 3 area, and the 3 x 3 sample area may consist only of samples within the surrounding sample group. For each surrounding sample group, a weight may be multiplied to the directionality value calculated at the sample location, and a cumulative histogram may be generated using the weighted value. The weight value may decrease as it moves further away from the boundary of the current block. That is, the weight value may be highest for surrounding sample group A, and decrease in the order of B, C, and D. Group A has the highest importance, and the importance may decrease in the order of B, C, and D. Each of the weight values ​​for surrounding sample groups A, B, C, and D may differ in at least one way. Alternatively, the weight value may vary depending on the distance between the boundary sample of the current block and the sample used to calculate the directionality. For example, when the distance is short, the weight may be set high, and as the distance increases, the weight may be set low. Alternatively, the sample unit used to calculate the orientation may vary depending on the distance between the boundary sample of the current block and the sample used to calculate the orientation. For example, when the distance is short, an integer sample unit (or 1 / 2 sample unit) may be used, and as the distance increases, the sample unit resolution may increase (e.g., the sample unit is an integer sample unit of 2, an integer sample unit of 4, an integer sample unit of 8, ...). The 1 / 2 sample unit may be a sample unit interpolated using integer samples, and when using the 1 / 2 sample unit, surrounding samples may be upsampled.For example, the video signal processing device may calculate directionality at integer sample unit locations for sample group A and reflect it in the cumulative histogram, calculate directionality at 2 integer sample unit locations for sample group B and reflect it in the cumulative histogram, and calculate directionality at 4 integer sample unit locations for sample groups C and D and reflect it in the cumulative histogram. The sample unit may be a pixel unit. When the video signal processing device calculates directionality at 2 integer sample unit locations, the video signal processing device may not calculate directionality at odd-numbered sample positions, but may calculate directionality only at even-numbered sample positions and reflect it in the cumulative histogram. The weight and sample unit may be determined based on the reference sample line of the current block. For example, the weight of the surrounding sample group on the same line as the reference sample line of the current block may be set to the highest, and the sample unit may be set to integer sample (or decimal sample) units. Specifically, if the reference sample line of the current block is 3, the weight of the surrounding sample group B may be set to the highest value because the surrounding sample group B matches the reference sample line 3, and the sample unit of the surrounding sample group B may be set to an integer sample (or a decimal sample unit). Additionally, the weight in the surrounding sample group may decrease as it moves further away from the reference sample line, and the resolution of the sample unit of the surrounding sample group may increase. When the adaptive DIMD mode is applied to the current block, the encoder may generate a bitstream containing information about the reference sample line for the adaptive DIMD mode and signal the information about the reference sample line. When the adaptive DIMD mode is applied to the current block, the decoder may parse the information about the reference sample line and then set the reference sample line to be used for weight setting in the adaptive DIMD mode.The video signal processing device may set different weights for the surrounding sample groups based on the distance between the reference sample line and the surrounding samples used to derive the DIMD mode. The video signal processing device may generate a single cumulative histogram from the surrounding sample groups of FIG. 47(a) and FIG. 47(b). The video signal processing device may determine the top N intra-predicted directional modes with high frequency values ​​using the single cumulative histogram. N is a predetermined number and may be determined based on the width and height of the current block. For example, N may be 8. The video signal processing device may generate a prediction block for the current block using the N intra-predicted directional modes through a location-based DIMD weighted averaging method. Alternatively, the video signal processing device may generate a first cumulative histogram using the surrounding sample group of FIG. 47(a) and generate a second cumulative histogram using the surrounding sample group of FIG. 47(b). The video signal processing device may determine the top N intra-predicted directional modes with high frequency values ​​from the first cumulative histogram and the second cumulative histogram. Specifically, the video signal processing device may generate a single cumulative histogram using a first cumulative histogram and a second cumulative histogram, and then determine the top N intra-predicted directional modes with high frequency values ​​in the single cumulative histogram. N may be an integer greater than or equal to 1, and may be 5. Alternatively, the video signal processing device may determine the top J intra-predicted directional modes with high frequency values ​​in the first cumulative histogram and determine the top K intra-predicted directional modes with high frequency values ​​in the second cumulative histogram. Here, J and K may be integers greater than or equal to 1, and may be 3.

[0413] Referring to FIGS. 47(a) and FIGS. 47(b), if the intra-predicted directional mode derived in the gray area within the dotted line block is an intra-predicted directional mode of a predetermined range, the video signal processing device may not accumulate the frequency value for the directionality calculated in the gray area in the histogram. Here, the predetermined range may be a range greater than 18 for the horizontal direction mode and less than 50 for the vertical direction mode.

[0414] Referring to FIG. 47(c), the directionality calculated in the surrounding sample group A may have high importance because it is the directionality calculated from a sample close to the current block. Additionally, if the intra-predicted directionality mode derived using a sample from the surrounding sample group and the intra-predicted directionality mode derived using a neighbor sample of the surrounding sample group are similar, the importance of the intra-predicted directionality mode derived using a sample from the surrounding sample group may be high. If the difference between the intra-predicted directionality mode derived from the first sample of the surrounding sample group A and the intra-predicted directionality mode derived from the second sample adjacent to the first sample is less than or equal to a predetermined first value, the video signal processing device may add a predetermined second value to the frequency value of the directionality of the intra-predicted directionality mode derived from the first sample and reflect this in the cumulative histogram. Here, the predetermined value may be an integer, such as 1 or 2. Additionally, the predetermined second value may be an integer value obtained by multiplying the existing frequency value by a value such as 1 / 2, 1 / 4, or 1 / 8. This process may be a directional reinforcement process. Samples to which the directional reinforcement process can be applied may be determined based on at least one of the width and height of the current block and the distance between the boundary of the current block and the corresponding sample. For example, the directional reinforcement process may be applied only if the width or height of the current block is greater than a pre-specified size. Or, the directional reinforcement process may be applied only if the width or height of the current block is smaller than a pre-specified size. The pre-specified size may be an integer and may be 16, 32, or 64. Or, if the width and height of the current block are different, the directional reinforcement process may be applied only to the surrounding samples on the side where the width or height of the current block is greater than the pre-specified size. The pre-specified size may be an integer and may be 16, 32, or 64.For example, if the width of the current block is 32, the height is 8, and the pre-specified size is 16, the video signal processing device may apply the directionality enhancement process only to the surrounding samples of the upper boundary of the current block (upper surrounding samples) and not apply the directionality enhancement process to the surrounding samples of the left boundary (left surrounding samples). The directionality enhancement process can be applied to both the adaptive DIMD method and the conventional DIMD method. Additionally, when the video signal processing device performs the directionality enhancement process, previously calculated directionality and frequency values ​​of surrounding sample locations may be used. If the directionality of the surrounding sample location is greater than a pre-specified first value, the frequency value for the directionality of the surrounding sample location is greater than a pre-specified second value, the directionality of the current sample location is greater than a pre-specified first value, and the frequency value for the directionality at the current sample location is greater than a pre-specified second value, the frequency value for the directionality at the current sample location may be changed to a recalculated frequency value. The recalculated frequency value can be calculated using one of the frequency value for the direction of the current sample position or the frequency value for the direction of the surrounding sample position. For example, the recalculated frequency value (B) may be a value obtained by shifting the frequency value for the direction of the current sample position from the frequency value for the direction of the current sample position (A) by a predetermined third value (X) (B = A + A>>X). The first, second, and third values ​​may be integer values ​​greater than or equal to 0.

[0415]

[0416] FIG. 48 shows a group of surrounding samples used to calculate directionality according to one embodiment of the present specification.

[0417] Referring to FIG. 48, the surrounding sample group used by the video signal processing device to generate a cumulative histogram may be a combined form of the left surrounding sample group and the upper surrounding sample group of the current block. The surrounding sample group may be divided into integrated surrounding sample groups A, B, C, and D based on the boundary of the current block, and the directionality may be calculated in the order of integrated surrounding sample groups A, B, C, and D and reflected in the cumulative histogram. Additionally, the weight of the frequency value for the directionality may vary for each integrated surrounding sample group. The weight may decrease in the order of integrated surrounding sample groups A, B, C, and D. The sample unit used to calculate the directionality may vary depending on the distance between the boundary of the current block and the samples used to calculate the directionality. When the distance is short, the sample unit may be an integer sample unit (or 1 / 2 sample unit), and as the distance increases, the sample unit may increase to an integer sample unit of 2, an integer sample unit of 4, or an integer sample unit of 8. For example, the video signal processing device can calculate directionality at integer sample units of group A and reflect it in the cumulative histogram, calculate directionality at 2 integer sample units of group B and reflect it in the cumulative histogram, and calculate directionality at 4 integer sample units of sample groups C and D and reflect it in the cumulative histogram. A sample unit can be said to be a pixel unit. When the video signal processing device calculates directionality at 2 integer sample units, the video signal processing device may not calculate directionality at odd-numbered sample units, but only calculate directionality at even-numbered sample units and reflect it in the cumulative histogram. Additionally, referring to FIG. 48(b), if the horizontal length and vertical length of the current block are different, the shape of the surrounding sample group used by the video signal processing device may be different.If the horizontal length of the current block is smaller than the vertical length, the number of samples used to derive directionality from the upper peripheral samples is smaller than that of the left peripheral samples; thus, the weight of directionality derived from the upper peripheral samples is lowered, which may lower the accuracy of the intra-predicted directionality mode. Therefore, if the horizontal length is smaller than the vertical length, the video signal processing device may expand the upper peripheral sample group. Referring to FIG. 48(b), if the horizontal length of the current block is smaller than the vertical length, the video signal processing device may expand the upper peripheral sample group A from an area of ​​one column (or row) to an area of ​​N columns (or rows), where N can be an integer greater than or equal to 2. In the upper peripheral sample group A having multiple column (or row) areas, directionality can be derived for each column (or row) and reflected in the cumulative histogram. The area of ​​the upper peripheral sample group A may be (horizontal length of the current block + 6) x (3 x N). For example, when N is 2, the area of ​​the upper peripheral sample group A may be (length of the current block's width + 6) x (3 x 2). In this case, the 3x3 sample area used to derive directionality in the upper peripheral sample group A may be composed of each column (or row), and samples from other columns (or rows) may not be used. That is, if the positions of the upper peripheral samples are 1, 2, 3, 4, 5, and 6 in the vertical upward direction from the upper boundary of the current block, directionality may be calculated only in the column (or row) of the sample positions 2 and 5. Alternatively, the 3x3 sample area used to derive directionality in the upper peripheral sample group A may be composed using samples from other columns (or rows). That is, if N is 2 and the positions of the upper peripheral samples are 1, 2, 3, 4, 5, and 6 in the vertical upward direction from the upper boundary of the current block, the directionality can be calculated in the column (or row) of the sample positions 2, 3, 4, and 5.

[0418] FIG. 49 illustrates a method for setting sample unit weights based on the directionality of surrounding samples according to one embodiment of the present specification.

[0419] FIG. 49(a) shows three intra-prediction directional modes derived by applying the DIMD method to the current block. The first intra-prediction mode is indicated by a thick solid line and is the mode with the highest weight. The second intra-prediction mode is indicated by a thick dotted line and is the mode with the second highest weight. The third intra-prediction mode is indicated by a thin dotted line and is the mode with the lowest weight. The gray arrows represent the intra-prediction directional modes at surrounding sample locations derived throu...

Claims

1. In a video signal decoding device, Includes a processor, The above processor is, Obtain a first Cross-Component Prediction (CCP) model using a first reference sample associated with the current block, and A second CCP model is obtained using a second reference sample related to the current block above, and Based on the above first CCP model, a first prediction sample of the current block is obtained, and Based on the above second CCP model, a second prediction sample of the current block is obtained, and Obtain a first weight corresponding to the first prediction sample above, and Obtain a second weight corresponding to the second prediction sample above, and A video signal decoding device that predicts a specific sample of the current block through a weighted average using the first prediction sample, the first weight, the second prediction sample, and the second weight.

2. In Paragraph 1, A video signal decoding device in which the second weight is obtained based on the first weight.

3. In Paragraph 1, The above current block is a video signal decoding device, which is a chroma component block.

4. In Paragraph 1, A video signal decoding device in which the first weight is determined based on the position of the first predicted sample.

5. In Paragraph 1, A video signal decoding device in which the first weight is one of the respective weights determined for each position of each sample constituting the current block.

6. In Paragraph 1, A video signal decoding device in which the first reference sample and the second reference sample are different reference samples.

7. A video signal decoding device in which the encoding mode for the first prediction sample and the second prediction sample is one of horizontal direction Planar, vertical direction Planar, DC, CCP mode, motion information, DIMD (Decoder side intra mode derivation), TIMD (Template intra mode derivation), OBI (C (Occurrence-based intra coding) mode, intra fusion, BCW (Bi-prediction with CU-level Weights).

8. In a video signal encoding device, Includes a processor, The above processor acquires a bitstream that is decoded by a decoding method, and the decoding method is, A step of obtaining a first Cross-Component Prediction (CCP) model using a first reference sample associated with the current block; A step of obtaining a second CCP model using a second reference sample related to the current block above; A step of obtaining a first prediction sample of the current block based on the first CCP model; A step of obtaining a second prediction sample of the current block based on the second CCP model; A step of obtaining a first weight corresponding to the first prediction sample; A step of obtaining a second weight corresponding to the second prediction sample; and A video signal encoding device comprising the step of predicting a specific sample of the current block through a weighted average using the first prediction sample, the first weight, the second prediction sample, and the second weight.

9. In Paragraph 8, A video signal encoding device in which the second weight is obtained based on the first weight.

10. In Paragraph 8, The above-mentioned current block is a video signal encoding device, which is a chroma component block.

11. In Paragraph 8, A video signal encoding device in which the first weight is determined based on the position of the first predicted sample.

12. In Paragraph 8, A video signal encoding device in which the first weight is one of the respective weights determined for each position of each sample constituting the current block.

13. In Paragraph 8, A video signal encoding device in which the first reference sample and the second reference sample are different reference samples.

14. A video signal encoding device in which the encoding mode for the first prediction sample and the second prediction sample is one of horizontal direction Planar, vertical direction Planar, DC, CCP mode, motion information, DIMD (Decoder side intra mode derivation), TIMD (Template intra mode derivation), OBI (C (Occurrence-based intra coding) mode, intra fusion, BCW (Bi-prediction with CU-level Weights).

15. In a computer-readable non-transient storage medium storing a bitstream, the bitstream is decoded by a decoding method, and the decoding method comprises: A step of obtaining a first Cross-Component Prediction (CCP) model using a first reference sample associated with the current block; A step of obtaining a second CCP model using a second reference sample related to the current block above; A step of obtaining a first prediction sample of the current block based on the first CCP model; A step of obtaining a second prediction sample of the current block based on the second CCP model; A step of obtaining a first weight corresponding to the first prediction sample; A step of obtaining a second weight corresponding to the second prediction sample; and A non-transient storage medium comprising the step of predicting a specific sample of the current block through a weighted average using the first prediction sample, the first weight, the second prediction sample, and the second weight.

16. In Paragraph 15, The above second weight is a non-transient storage medium obtained based on the above first weight.

17. In Paragraph 15, The above current block is a non-transient storage medium that is a chroma component block.

18. In Paragraph 15, A non-transient storage medium in which the first weight is determined based on the position of the first predicted sample.

19. In Paragraph 15, A non-transient storage medium in which the first weight is one of the respective weights determined for each position of each sample constituting the current block.

20. In Paragraph 15, A non-transient storage medium in which the first reference sample and the second reference sample are different reference samples.