Video signal processing method and device

By adopting multiple transform sets and low-frequency inseparable transform transformation matrix sets in video signal processing, combining intra- and inter-frame prediction modes, the problem of low encoding and decoding efficiency in the prior art is solved, and more efficient video signal processing is achieved.

CN119732056APending Publication Date: 2025-03-28WILUS INSTITUTE OF STANDARDS & TECHNOLOGY INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380059908.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-01-09
Filing Date
2023-08-17
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The prior art is less efficient in the encoding and decoding process of video signals, and it is difficult to meet the efficiency requirements of modern media and data transmission requirements.

Method used

By adopting a multi-transform set and a low-frequency inseparable transformed transformation matrix set in video signal processing, combining intra- and inter-prediction modes, prediction blocks and residual blocks are generated, and the video signal blocks are reconstructed by the processor.

Benefits of technology

It improves the encoding and decoding efficiency of video signals, realizes more efficient video signal processing, and adapts to the needs of modern media and data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119732056A_ABST
    Figure CN119732056A_ABST
Patent Text Reader

Abstract

This processor of a video signal decoding apparatus may determine a first prediction mode of a current block, generate a prediction block of the current block based on the first prediction mode, generate a residual block of the current block according to a set of transform matrices determined based on a second prediction mode, and reconstruct the current block based on the prediction block and the residual block.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Compression coding refers to a series of signal processing techniques for sending digitized information through communication lines or storing information in a form suitable for storage media. Objects of compression coding include objects such as voice, video, and text, and in particular, the technology for performing compression coding on images is called video compression. Compression coding of video signals is performed by removing excess information in consideration of spatial correlation, temporal correlation, and random correlation. However, with the recent development of various media and data transmission media, more efficient video signal processing methods and devices are needed. Summary of the invention

[0003] Technical issues

[0004] The present disclosure is to provide a video signal processing method and device thereof, so as to improve the coding efficiency of the video signal.

[0005] Technical Solution

[0006] The present disclosure provides a video signal processing method and a device thereof.

[0007] In the present disclosure, a video signal decoding device may include a processor, wherein the processor is configured to: determine a first prediction mode of a current block; generate a prediction block of the current block based on the first prediction mode; generate a residual block of the current block according to a transformation matrix set determined based on a second prediction mode; and reconstruct the current block based on the prediction block and the residual block.

[0008] In the present disclosure, a video signal encoding device may include a processor, wherein the processor is configured to: determine a first prediction mode of a current block; generate a prediction block of the current block based on the first prediction mode; generate a residual block of the current block according to a transformation matrix set determined based on a second prediction mode; and reconstruct the current block based on the prediction block and the residual block.

[0009] In the present disclosure, in a non-temporary computer-readable storage medium storing a bitstream, the bitstream is decoded by a decoding method, and the decoding method may include: determining a first prediction mode of a current block; generating a prediction block of the current block based on the first prediction mode; generating a residual block of the current block according to a transformation matrix set determined based on a second prediction mode; and reconstructing the current block based on the prediction block and the residual block.

[0010] In addition, in the present disclosure, the residual block may be generated based on at least one of a set of transformation matrices of a multiple transform set (MTS) and / or a set of transformation matrices of a low frequency non-separable transform (LFNST).

[0011] In addition, in the present disclosure, the first prediction mode and the second prediction mode may be different from each other.

[0012] In addition, in the present disclosure, the first prediction mode may be one of a planar mode based on a horizontal direction and a planar mode based on a vertical direction.

[0013] In addition, in the present disclosure, the planar mode based on the horizontal direction can be a prediction mode based on the value of the block at the position (-1, y) and the value of the block at the position (W, -1), and the planar mode based on the vertical direction can be a prediction mode based on the value of the block at the position (x, -1) and the value of the block at the position (-1, H), the position of the upper left block of the current block can be (0, 0), and the position of the prediction block can be (x, y).

[0014] In addition, in the present disclosure, i) the first prediction mode may be a planar mode based on the horizontal direction, and the second prediction mode may be an angle mode based on the vertical direction, or ii) the first prediction mode may be a planar mode based on the horizontal direction, and the second prediction mode may be an angle mode based on the horizontal direction.

[0015] In addition, in the present disclosure, the first prediction mode may be based on a linear prediction mode.

[0016] In addition, in the present disclosure, the first prediction mode may be indicated by a syntax element included in a bitstream.

[0017] Beneficial effects of the present invention

[0018] The present disclosure provides a method for efficiently processing a video signal.

[0019] Effects that can be obtained from the present disclosure are not limited to the above-mentioned effects, and other unmentioned effects can be clearly understood from the following description by those skilled in the art to which the present disclosure belongs. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a schematic block diagram of a video signal encoding apparatus according to an embodiment of the present invention.

[0021] Figure 2 is a schematic block diagram of a video signal decoding apparatus according to an embodiment of the present invention.

[0022] Figure 3 An embodiment in which a coding tree unit is divided into coding units in a picture is shown.

[0023] Figure 4 An embodiment of a method for signaling partitioning of quadtrees and multi-type trees is shown.

[0024] Figure 5 and Figure 6 The intra prediction method is illustrated in more detail according to an embodiment of the present disclosure.

[0025] Figure 7 The diagram illustrates the positions of neighboring blocks used to construct a motion candidate list in inter-frame prediction.

[0026] Figure 8 A process of generating a prediction block by using a DIMD according to an embodiment of the present disclosure is illustrated.

[0027] Fig. 9 FIG. 1 illustrates positions of neighboring pixels used to derive orientation information according to an embodiment of the present disclosure.

[0028] Fig.10 A method of mapping a directional pattern according to an embodiment of the present disclosure is illustrated.

[0029] Fig.11 A histogram for deriving intra-prediction directional modes according to an embodiment of the present disclosure is illustrated.

[0030] Fig.12 A method of signaling a DIMD mode according to an embodiment of the present disclosure is illustrated.

[0031] Fig.13 A method of signaling a syntax element related to an intra prediction mode according to whether a DIMD mode is used according to an embodiment of the present disclosure is illustrated.

[0032] Fig.14 The diagram illustrates a prediction sample generation method for reconstructing a current block according to an embodiment of the present disclosure.

[0033] Fig.15 A method of determining an intra prediction mode according to an embodiment of the present disclosure is illustrated.

[0034] Fig.16 FIG. 1 illustrates a syntax structure including syntax elements related to DIMD according to an embodiment of the present disclosure.

[0035] Fig.17 FIG. 2 illustrates intra prediction directional modes and weight information of neighboring blocks for a current block according to an embodiment of the present disclosure.

[0036] Fig.18 A method of determining DIMD combination information according to an embodiment of the present disclosure is illustrated.

[0037] Fig.19A method of generating a prediction sample by using intra prediction directional mode information and a weight according to an embodiment of the present disclosure is illustrated.

[0038] Fig. 20 and Fig.21 Pixel values ​​of neighboring blocks used when deriving an intra-prediction directional mode according to an embodiment of the present disclosure are illustrated.

[0039] Fig. 22 A method of configuring an MPM list including an intra-prediction directional mode of a current block according to an embodiment of the present disclosure is illustrated.

[0040] Fig.23 and Fig.24 FIG. 1 illustrates a template used to derive an intra prediction mode of a current block according to an embodiment of the present disclosure.

[0041] Figure 25 to Figure 28 A method of generating prediction samples (pixels) based on a plurality of reference pixel lines according to an embodiment of the present disclosure is illustrated.

[0042] Fig.29 A method of predicting a sample by using a plurality of reference pixel lines according to an embodiment of the present disclosure is illustrated.

[0043] Fig.30 A method for determining a reference pixel line based on a template according to an embodiment of the present disclosure is illustrated.

[0044] Fig.31 A method of configuring a template for testing a reference pixel line adjacent to a current block according to an embodiment of the present disclosure is illustrated.

[0045] Fig.32 is a structural diagram illustrating a method of determining an optimal reference pixel line by using a plurality of reference pixel lines based on a template according to an embodiment of the present disclosure.

[0046] Fig.33 A method of generating a prediction sample by using a planar mode according to an embodiment of the present disclosure is illustrated.

[0047] Fig.34 A method of deriving a plurality of transform sets and a LFNST set for a vertical plane mode or a horizontal plane mode according to an embodiment of the present disclosure is illustrated.

[0048] Fig.35 A mapping table according to an embodiment of the present disclosure is illustrated.

[0049] Fig.36 A transformation type set table according to an embodiment of the present disclosure is illustrated.

[0050] Fig.37 A transformation type combination table according to an embodiment of the present disclosure is illustrated.

[0051] Fig.38 A threshold table for an IDT transformation type according to an embodiment of the present disclosure is illustrated.

[0052] Fig.39 A method of deriving a main transformation matrix or a secondary transformation matrix by a video signal processing apparatus according to an embodiment of the present disclosure is illustrated.

[0053] Fig.40 A DC prediction method in units of vertical or horizontal lines according to an embodiment of the present disclosure is illustrated.

[0054] Fig.41 A plane prediction method in units of vertical or horizontal lines according to an embodiment of the present disclosure is illustrated.

[0055] Fig.42 A prediction method in units of sub-blocks by using a planar mode according to an embodiment of the present disclosure is illustrated.

[0056] Fig.43 An intra prediction method based on bidirectional prediction according to an embodiment of the present disclosure is illustrated.

[0057] Fig.44 Illustrations show transform kernel types that can be used for video coding according to an embodiment of the present disclosure.

[0058] Fig.45 and 46 A portion of a sequence parameter set according to an embodiment of the present disclosure is illustrated.

[0059] Fig.47 FIG. 1 illustrates a portion of a general_constraint_info() syntax structure according to an embodiment of the present disclosure.

[0060] Fig.48 A method of configuring an MPM list by using a multiple-prediction mode according to an embodiment of the present disclosure is illustrated.

[0061] Fig.49 Illustrated are positions of reference pixels used when a prediction block is generated using a multi-prediction mode according to an embodiment of the present disclosure.

[0062] Fig.50 A transformation set table for LFNST and NSPT according to an embodiment of the present disclosure is illustrated.

[0063] Fig.51 A method of deriving a transform set for a linear mode in prediction using the linear mode according to an embodiment of the present disclosure is illustrated. DETAILED DESCRIPTION

[0064] Considering the functions in the present disclosure, the terms used in this specification may be general terms that are currently widely used, but may be changed according to the intention of those skilled in the art, customs, or the emergence of new technologies. In addition, in some cases, there may be terms arbitrarily selected by the applicant, and in this case, their meanings are described in the corresponding description section of the present disclosure. Therefore, the terms used in this specification should be interpreted based on the substantial meaning of the terms and contents throughout the specification.

[0065] In the present specification, “A and / or B” may be interpreted as “including at least one of A or B”.

[0066] In this specification, some terms may be explained as follows. In some cases, coding may be explained as encoding or decoding. In this specification, a device that generates a video signal bit stream by performing coding (coding) of a video signal is referred to as a coding device or encoder, and a device that performs decoding (decoding) of a video signal bit stream to reconstruct a video signal is referred to as a decoding device or decoder. In addition, in this specification, a video signal processing device is used as a term that includes the concepts of both encoders and decoders. Information is a term that includes all values, parameters, coefficients, elements, etc. In some cases, the meaning is interpreted differently, so the present disclosure is not limited thereto. "Unit" is used as a meaning that refers to a basic unit of image processing or a specific position of a picture, and refers to an image area that includes both luminance components and chrominance components. In addition, "block" refers to an area of ​​a special component in an image that includes luminance components and chrominance components (ie, Cb and Cr). However, depending on the embodiment, the terms "unit", "block", "partition", "signal" and "area" may be used interchangeably. In addition, in this specification, the term "current block" refers to a block currently scheduled to be encoded, and the term "reference block" refers to a block that has been encoded or decoded and is used as a reference in the current block. In addition, in this specification, the terms "luma", "luminance", "Y", etc. can be used interchangeably. In addition, in this specification, the terms "chroma", "chrominance", "Cb or Cr", etc. can be used interchangeably, and the chroma component is classified into two components, Cb and Cr, and thus each chroma component can be distinguished and used. In addition, in this specification, the term "unit" can be used as a concept including a coding unit, a prediction unit, and a transform unit. "Picture" refers to a field or a frame, and these terms can be used interchangeably depending on the embodiment. Specifically, when the captured video is an interlaced video, a single frame can be separated into an odd (or base or top) field and an even (or even number or bottom) field, and each field can be configured in a picture unit and encoded or decoded. If the captured video is a progressively scanned video, a single frame can be configured as a picture and encoded or decoded. In addition, in this specification, the terms "error signal", "residual signal", "residue signal", "residual signal" and "difference signal" can be used interchangeably. In addition, in this specification, the terms "intra-frame prediction mode", "intra-frame prediction directional mode", "intra-frame picture prediction mode" and "intra-frame picture prediction directional mode" can be used interchangeably. In addition, in this specification, the terms "motion", "movement" and the like can be used interchangeably.In addition, in the present specification, the terms "left", "upper left", "above", "upper right", "right", "lower right", "below", and "lower left" may be used interchangeably with "leftmost", "upper left", "above", "upper right", "right", "lower right", "below", and "lower left". In addition, the terms "element" and "member" may be used interchangeably. A picture order count (POC) represents time position information of a picture (or frame) and may be a playback order in which display is performed on a screen, and each picture may have a unique POC.

[0067] Figure 1 is a schematic block diagram of a video signal encoding apparatus according to an embodiment of the present invention. Figure 1 , the encoding device 100 of the present invention includes a transform unit 110, a quantization unit 115, an inverse quantization unit 120, an inverse transform unit 125, a filtering unit 130, a prediction unit 150 and an entropy coding unit 160.

[0068] The transform unit 110 obtains the value of the transform coefficient by transforming the residual signal, which is the difference between the input video signal and the prediction signal generated by the prediction unit 150. For example, a discrete cosine transform (DCT), a discrete sine transform (DST), or a wavelet transform may be used. DCT and DST perform the transform by dividing the input picture signal into a plurality of blocks. In the transform, the coding efficiency may vary according to the distribution and characteristics of the values ​​in the transform area. The transform kernel used for the transform of the residual block may have a characteristic that allows the vertical transform and the horizontal transform to be separable. In this case, the transform of the residual block may be performed separately as a vertical transform and a horizontal transform. For example, the encoder may perform a vertical transform by applying the transform kernel in the vertical direction of the residual block. In addition, the encoder may perform a horizontal transform by applying the transform kernel in the horizontal direction of the residual block. In the present disclosure, the transform kernel may be used to refer to a set of parameters used for the transform of the residual signal, such as a transform matrix, a transform array, a transform function, or a transform. For example, the transform kernel may be any one of a plurality of available kernels. In addition, transform kernels based on different transform types may be used for vertical transform and horizontal transform, respectively.

[0069] The transform coefficients are distributed with higher coefficients toward the upper left corner of the block and coefficients closer to "0" toward the lower right corner of the block. As the size of the current block increases, there may be many coefficients of "0" in the lower right area of ​​the block. In order to reduce the transform complexity of large-sized blocks, only the random upper left area may be retained and the remaining area may be reset to "0".

[0070] In addition, the error signal may only exist in some areas of the coding block. In this case, the transform process may be performed only on some random areas. In an embodiment, in a block with a size of 2Nx2N, the error signal may only exist in the first 2NxN block, and the transform process may be performed on the first 2NxN block. However, the second 2NxN block may not be transformed and may not be encoded or decoded. Here, N may be any positive integer.

[0071] The encoder may perform an additional transform before quantizing the transform coefficients. The above-mentioned transform method may be referred to as a main transform, and the additional transform may be referred to as an auxiliary transform. The auxiliary transform may be selectable for each residual block. According to an embodiment, the encoder may improve coding efficiency by performing an auxiliary transform on an area where it is difficult to concentrate energy in a low-frequency area by using only the main transform. For example, an auxiliary transform may be additionally performed on a block where a large residual value appears in a direction other than the horizontal or vertical direction of the residual block. Unlike the main transform, the auxiliary transform cannot be performed separately as a vertical transform and a horizontal transform. This auxiliary transform may be referred to as a low-frequency inseparable transform (LFNST).

[0072] The quantization unit 115 quantizes the value of the transform coefficient value output from the transform unit 110 .

[0073] In order to improve the coding efficiency, instead of the method of coding the picture signal as it is, a method is used to predict the picture using the area that has been encoded by the prediction unit 150, and to obtain the reconstructed picture by adding the residual value between the original picture and the predicted picture to the predicted picture. In order to prevent the mismatch between the encoder and the decoder, when the prediction is performed in the encoder, information that can be used in the decoder should be used. To this end, the encoder performs the process of reconstructing the encoded current block again. The inverse quantization unit 120 inversely quantizes the value of the transform coefficient, and the inverse transform unit 125 reconstructs the residual value using the inversely quantized transform coefficient value. At the same time, the filtering unit 130 performs a filtering operation to improve the quality of the reconstructed picture and improve the coding efficiency. For example, a deblocking filter, a sample adaptive offset (SAO), and an adaptive loop filter may be included. The filtered picture is output or stored in a decoded picture buffer (DPB) 156 to be used as a reference picture.

[0074] A deblocking filter is a filter for removing intra-block distortion generated at the boundary between blocks in a reconstructed picture. By distributing pixels included in several columns or rows based on random edges in the block, the encoder can determine whether to apply a deblocking filter to the edge. When applying a deblocking filter to a block, the encoder can apply a long filter, a strong filter, or a weak filter depending on the strength of the deblocking filter. In addition, horizontal filtering and vertical filtering can be processed in parallel. Sample adaptive offset (SAO) can be used to correct the offset from the original video on a pixel-by-pixel basis relative to the residual block to which the deblocking filter has been applied. In order to correct the offset of a special picture, the encoder can use a technique of dividing the pixels included in the picture into a predetermined number of regions, determining the region in which the offset correction is to be performed, and applying the offset to the region (with offset). Alternatively, the encoder can use a method for applying an offset considering the edge information of each pixel (edge ​​offset). An adaptive loop filter (ALF) is a technique of dividing the pixels included in a video into predetermined groups and then determining a filter to be applied to each group so as to perform filtering differently for each group. Information about whether to apply ALF can be signaled on a per-coding unit basis, and the shape and filter coefficients of the ALF to be applied can vary for each block. In addition, regardless of the characteristics of the target block to which the ALF filter is to be applied, an ALF filter having the same shape (fixed shape) can be applied.

[0075] 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 to predict the current picture by using the reference picture stored in the decoded picture buffer 156. The intra prediction unit 152 performs intra prediction from the reconstructed area in the current picture, and sends intra coding information to the entropy coding unit 160. The intra coding information may include at least one of an intra prediction mode, a most probable mode (MPM) flag, an MPM index, and information about a reference sample. The inter prediction unit 154 may also include a motion estimation unit 154a and a motion compensation unit 154b. The motion estimation unit 154a finds the most similar part to the current area with reference to a specific area of ​​the reconstructed reference picture, and obtains a motion vector value as a distance between the areas. The reference area related motion information (reference direction indication information (L0 prediction, L1 prediction or bidirectional prediction), reference picture index, motion vector information, etc.) obtained by the motion estimation unit 154a is sent to the entropy coding unit 160 so as to be included in the bitstream. The motion compensation unit 154B performs inter motion compensation by using the motion information transmitted from the motion estimation unit 154a to generate a prediction block for the current block. The inter prediction unit 154 transmits inter encoding information including the motion information related to the reference region to the entropy coding unit 160.

[0076] 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 based on the reconstructed samples in the current picture and sends IBC encoding information to the entropy coding unit 160. The IBC prediction unit refers to a specific area within the current picture to obtain a block vector value indicating a reference area used to predict the current area. The IBC prediction unit may perform IBC prediction by using the obtained block vector value. The IBC prediction unit sends the IBC encoding information to the entropy coding unit 160. The IBC encoding information may include at least one of reference area size information and block vector information (index information and block vector difference information of the block vector for predicting the current block in the motion candidate list).

[0077] When performing the above-mentioned picture prediction, the transform unit 110 transforms the residual value between the original picture and the predicted picture to obtain a transform coefficient value. At this time, the transform can be performed based on a specific block in the picture, and the size of the specific block can vary within a predetermined range. The quantization unit 115 quantizes the transform coefficient value generated by the transform unit 110 and sends the quantized transform coefficient to the entropy coding unit 160.

[0078] The quantized transform coefficients in the form of a two-dimensional array can be rearranged into a one-dimensional array for entropy coding. Regarding the method for scanning the quantized transform coefficients, the size of the transform block and the intra-picture prediction mode can determine which scanning method is used. In an embodiment, diagonal, vertical and horizontal scanning can be applied. This scanning information can be signaled on a block-by-block basis and can be derived based on predetermined rules.

[0079] The entropy coding unit 160 generates a video signal bit stream by indicating entropy coding information of quantized transform coefficients, intra-frame coding information, and inter-frame coding information. The entropy coding unit 160 can use variable length coding (VLC) and arithmetic coding. Variable length coding (VLC) is a technique for transforming input symbols into continuous codewords, wherein the length of the codeword is variable. For example, frequently occurring symbols are represented by shorter codewords, while less frequently occurring symbols are represented by longer codewords. As variable length coding, context-based adaptive variable length coding (CAVLC) can be used. Arithmetic coding uses the probability distribution of each data symbol to transform continuous data symbols into a single decimal number. Arithmetic coding allows the optimal decimal position required to represent each symbol to be obtained. As arithmetic coding, context-based adaptive binary arithmetic coding (CABAC) can be used.

[0080] CABAC is a binary arithmetic coding technique that uses multiple context models generated based on probabilities obtained from experiments. First, when the symbol is not in binary form, the encoder binarizes each symbol by using exponential-Golomb (exp-Golomb) and the like. The binarized value 0 or 1 can be described as bin. The CABAC initialization process is divided into context initialization and arithmetic coding initialization. Context initialization is the process of initializing the probability of occurrence of each symbol, and is determined by the type of symbol, quantization parameter (QP) and slice type (I, P or B). The context model with initialization information can use probability-based values ​​obtained by experiment. The context model provides information about the probability of occurrence of the minimum possible symbol (LPS) or the maximum possible symbol (MPS) for the symbol currently to be coded and about which of the bin values ​​0 and 1 corresponds to the MPS (valMPS). One of the multiple context models is selected via a context index (ctxIdx), and the context index can be derived from information in the current block to be encoded or information about neighboring blocks. Initialization for binary arithmetic coding is performed based on the probability model selected from the context model. In binary arithmetic compilation, encoding is performed by dividing the probability interval by the probability of occurrence of 0 and 1, and then the probability interval corresponding to the bin to be processed becomes the entire probability interval of the next bin to be processed. Information about the position within the previous bin where the previous bin has been processed is output. However, the probability interval cannot be divided infinitely, and therefore, when the probability interval is reduced to a certain size, a renormalization process is performed to widen the probability interval and output the corresponding position information. In addition, after each bin is processed, a probability update process can be performed, in which information about the processed bin is used to set a new probability for the next one to be processed.

[0081] The generated bitstream is encapsulated in a network abstraction layer (NAL) unit as a basic unit. NAL units are classified into video coding layer (VCL) NAL units including video data and non-VCL NAL units including parameter information for decoding video data. There are multiple types of VCL or non-VCL NAL units. The NAL unit includes NAL header information and a raw byte sequence payload (RBSP) as data. The NAL header information includes summary information about the RBSP. The RBSP of the VCL NAL unit includes an integer number of encoded coding tree units. In order to decode the bitstream in a video decoder, it is necessary to separate the bitstream into NAL units and then decode each individual NAL unit. The information required for decoding the video signal bitstream can be included in a picture parameter set (PPS), a sequence parameter set (SPS), a video parameter set (VPS), etc. and sent.

[0082] Figure 1The block diagram of the encoding device 100 according to an embodiment of the present disclosure is illustrated, wherein the blocks shown separately logically distinguish the elements of the encoding device 100. Therefore, depending on the design of the device, the above elements of the encoding device 100 may be installed as a single chip or multiple chips. According to an embodiment, the above operations of each element of the encoding device 100 may be performed by a processor (not shown).

[0083] Figure 2 2 is a schematic block diagram of a video signal decoding apparatus 200 according to an embodiment of the present invention. Figure 2 The decoding device 200 of the present invention includes an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 225, a filtering unit 230 and a prediction unit 250.

[0084] The entropy decoding unit 210 performs entropy decoding on the video signal bit stream to extract the transform coefficient information, intra-frame coding information, inter-frame coding information, etc. of each region. For example, the entropy decoding unit 210 can obtain the binarization code for the transform coefficient information of a specific region from the video signal bit stream. The entropy decoding unit 210 obtains the quantized transform coefficient by inverse binarization of the binary code. The inverse quantization unit 220 inverse quantizes the quantized transform coefficient, and the inverse transform unit 225 reconstructs the residual value by using the inverse quantized transform coefficient. The video signal processing device 200 reconstructs the original pixel value by adding the residual value obtained by the inverse transform unit 225 to the predicted value obtained by the prediction unit 250.

[0085] At the same time, the filtering unit 230 performs filtering on the picture to improve the image quality. This may include a deblocking filter for reducing block distortion and / or an adaptive loop filter for removing distortion of the entire picture. The filtered picture is output or stored in the DPB 256 to be used as a reference picture for the next picture.

[0086] The prediction unit 250 includes an intra prediction unit 252 and an inter prediction unit 254. The prediction unit 250 generates a predicted picture by using the encoding type, the transform coefficient of each region, and the intra / inter encoding information decoded by the above-mentioned entropy decoding unit 210. In order to reconstruct the current block in which decoding is performed, the decoded region of the current picture or other pictures including the current block may be used. In reconstruction, only the current picture, that is, the picture (or tile / slice) in which only intra prediction or intra BC prediction is performed is referred to as an intra picture or an I picture (or tile / slice), and the picture (or tile / slice) in which all intra prediction, inter prediction, and intra BC prediction can be performed is referred to as an inter picture (or tile / slice). In order to predict the sample values ​​of each block in an inter-frame picture (or patch / slice), a picture (or patch / slice) using at most one motion vector and a reference picture index is called a predicted picture or a P picture (or patch / slice), and a picture (or patch / slice) using at most two motion vectors and a reference picture index is called a bidirectional predicted picture or a B picture (or patch / slice). In other words, a P picture (or patch / slice) uses at most one motion information set to predict each block, and a B picture (or patch / slice) uses at most two motion information sets to predict each block. Here, a motion information set includes one or more motion vectors and a reference picture index.

[0087] The intra prediction unit 252 generates a prediction block using the intra coding information and the reconstructed samples in the current picture. As described above, the intra coding information may include at least one of an intra prediction mode, a most probable mode (MPM) flag, and an MPM index. The intra prediction unit 252 predicts the sample value of the current block by using the reconstructed samples located to the left and / or above the current block as reference samples. In the present disclosure, the reconstructed samples, the reference samples, and the samples of the current block may represent pixels. Moreover, the sample value may represent a pixel value.

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

[0089] The inter prediction unit 254 generates a prediction block using the reference picture and inter coding information stored in the DPB 256. The inter coding information may include a motion information set (reference picture index, motion vector information, etc.) for the current block of the reference block. Inter prediction may include L0 prediction, L1 prediction, and bidirectional prediction. L0 prediction means prediction using a reference picture included in the L0 picture list, and L1 prediction means prediction using a reference picture included in the L1 picture list. To this end, a motion information set (e.g., motion vector and reference picture index) may be required. In the bidirectional prediction method, up to two reference areas may be used, and the two reference areas may exist in the same reference picture or may exist in different pictures. That is, in the bidirectional prediction method, up to two motion information sets (e.g., motion vector and reference picture index) may be used, and the two motion vectors may correspond to the same reference picture index or different reference picture indexes. In this case, the reference picture is a picture that is temporally located before or after the current picture, and may be a picture that has been reconstructed. According to an embodiment, the two reference areas used in the bidirectional prediction scheme may be areas selected from the picture list L0 and the picture list L1, respectively.

[0090] The inter-frame prediction unit 254 can use the motion vector and the reference picture index to obtain the reference block of the current block. The reference block is in the reference picture corresponding to the reference picture index. Moreover, the sample value of the block specified by the motion vector or its interpolated value 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 for luminance signal and a 4-tap interpolation filter for chrominance signal can be used. However, the interpolation filter for motion prediction in sub-pixel units is not limited to this. In this way, the inter-frame prediction unit 254 performs motion compensation to predict the texture of the current unit based on the motion picture previously reconstructed using motion information. In such a case, the inter-frame prediction unit can use a motion information set.

[0091] According to another embodiment, the prediction unit 250 may include an IBC prediction unit (not shown). The IBC prediction unit may reconstruct the current region by referring to a specific region including the reconstructed samples in the current picture. The IBC prediction unit obtains IBC encoding information for the current region from the entropy decoding unit 210. The IBC prediction unit obtains a block vector value of the current region indicating a specific region in the current picture. The IBC prediction unit may perform IBC prediction by using the obtained block vector value. The IBC encoding information may include block vector information.

[0092] The reconstructed video picture is generated by adding the prediction value output from the intra prediction unit 252 or the inter prediction unit 254 to the residual value output from the inverse transform unit 225. That is, the video signal decoding apparatus 200 reconstructs the current block using the prediction block generated by the prediction unit 250 and the residual obtained from the inverse transform unit 225.

[0093] at the same time, Figure 2 The block diagram of the decoding device 200 according to an embodiment of the present invention is shown, and the blocks shown separately logically distinguish and show the elements of the decoding device 200. Therefore, the elements of the above-mentioned decoding device 200 may be installed as one chip or multiple chips depending on the design of the device. According to the embodiment, the operation of each element of the above-mentioned decoding device 200 may be performed by a processor (not shown).

[0094] The techniques presented in this specification can be applied to methods and apparatus for both encoders and decoders, and the wording signaling and parsing can be used for convenience of description. In general, signaling can be described as encoding each type of syntax from the perspective of the encoder, and parsing can be described as interpreting each type of syntax from the perspective of the decoder. In other words, each type of syntax can be included in a bitstream and signaled by the encoder, and the decoder can parse the syntax and use it in the reconstruction process. In this case, the bit sequence of each type of syntax arranged according to a specified hierarchical configuration can be referred to as a bitstream.

[0095] A picture can be partitioned into sub-pictures, slices, tiles, etc. and encoded. A sub-picture may include one or more slices or tiles. When a picture is partitioned into multiple slices or tiles and encoded, all slices or tiles within the picture must be decoded before the picture can be output on the screen. On the other hand, when a picture is encoded into multiple sub-pictures, only random sub-pictures can be decoded and output on the screen. A slice may include multiple tiles or sub-pictures. Alternatively, a tile may include multiple sub-pictures or slices. Sub-pictures, slices, and tiles can be encoded or decoded independently of each other, and therefore are conducive to parallel processing and improvements in processing speed. However, there is a disadvantage of increased bit rate because the encoding information of other adjacent sub-pictures, slices, and tiles is not available. Sub-pictures, slices, and tiles can be partitioned into multiple coding tree units (CTUs) and encoded.

[0096] Figure 3An embodiment in which a coding tree unit (CTU) is divided into coding units (CUs) within a picture is illustrated. In the process of coding a video signal, a picture may be divided into a series of coding tree units (CTUs). A coding tree unit may include a luma coding tree block (CTB), two chroma coding tree blocks, and syntax information encoded therein. A coding tree unit may include one coding unit, or a coding tree unit may be divided into multiple coding units. A coding unit may include a luma coding block (CB), two chroma coding blocks, and syntax information encoded therein. A coding block may be partitioned into multiple sub-coding blocks. A coding unit may include one transform unit (TU), or a coding unit may be partitioned into multiple transform units. A transform unit may include a luma transform block (TB), two chroma transform blocks, and syntax information encoded therein. A coding tree unit may be partitioned into multiple coding units. A coding tree unit may become a leaf node without being partitioned. In this case, the coding tree unit itself may be a coding unit.

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

[0098] refer to Figure 3 , firstly, the compilation tree unit is split into a quadtree (QT) structure. That is, a node having a size of 2NX2N in the quadtree structure can be split into four nodes having a size of NXN. In this specification, a quadtree may also be referred to as a quadtree. Quadtree splitting may be performed recursively, and not all nodes need to be split at the same depth.

[0099] At the same time, the leaf nodes of the above-mentioned quadtree 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 node can be divided into a binary or ternary tree structure divided horizontally or vertically. That is, in a multi-type tree structure, there are four segmentation structures, such as vertical binary segmentation, horizontal binary segmentation, vertical ternary segmentation and horizontal ternary segmentation. According to an embodiment of the present invention, in each tree structure, the width and height of the node can have a power of 2. For example, in a binary tree (BT) structure, a node of 2NX2N size can be divided into two NX2N nodes by vertical binary segmentation, and divided into two 2NXN nodes by horizontal binary segmentation. In addition, in a ternary tree (TT) structure, a node of 2NX2N size is divided into (N / 2)X2N, NX2N and (N / 2)X2N nodes by vertical ternary segmentation, and is divided into 2NX(N / 2), 2NXN and 2NX(N / 2) nodes by horizontal ternary segmentation. This multi-type tree splitting can be performed recursively.

[0100] The leaf nodes of the multi-type tree can be coding units. When the coding unit is not larger than the maximum transform length, the coding unit can be used as a unit of prediction and / or transformation without further segmentation. As an embodiment, when the width or height of the current coding unit is larger than the maximum transform length, the current coding unit can be segmented into multiple transform units without explicit signaling about the segmentation. On the other hand, at least one of the following parameters in the above-mentioned quadtree and multi-type tree can be predefined or sent through RBSP of a higher level set such as PPS, SPS, VPS, etc. 1) CTU size: the root node size of the quadtree, 2) Minimum QT size MinQtSize: the minimum allowed QT leaf node size, 3) Maximum BT size MaxBtSize: the maximum allowed BT root node size, 4) Maximum TT size MaxTtSize: the maximum allowed TT root node size, 5) Maximum MTT depth MaxMttDepth: the maximum allowed depth of the MTT split from the leaf node of the QT, 6) Minimum BT size MinBtSize: the minimum allowed BT leaf node size, 7) Minimum TT size MinTtSize: the minimum allowed TT leaf node size.

[0101] Figure 4 An embodiment of a method for signaling a partition of a quadtree and a multi-type tree is shown. A preset flag may be used to signal the partition of the quadtree and the multi-type tree. Figure 4, at least one of the flag "split_cu_flag" indicating whether to split a node, the flag "split_qt_flag" indicating whether to split a quadtree node, the flag "mtt_split_cu_vertical_flag" indicating the split direction of a multi-type tree node, or the flag "mtt_split_cu_binary_flag" indicating the split shape of a multi-type tree node may be used.

[0102] According to an embodiment of the present invention, a "split_cu_flag" as a flag indicating whether to split the current node may first be sent with a signal. When the value of "split_cu_flag" is 0, it indicates that the current node is not split and the current node becomes a compilation unit. When the current node is a compilation tree unit, the compilation tree unit includes an unsplit compilation unit. When the current node is a quadtree node "QT node", the current node is a leaf node "QT leaf node" of the quadtree and becomes a compilation unit. When the current node is a multi-class tree node "MTT node", the current node is a leaf node "MTT leaf node" of the multi-class tree and becomes a compilation unit.

[0103] When the value of "split_cu_flag" is 1, the current node can be split into nodes of a quadtree or a multi-type tree according to the value of "split_qt_flag". The compilation tree unit is the root node of the quadtree and can be first split into a quadtree structure. In the quadtree structure, "split_qt_flag" is sent with a signal for each node "QT node". When the value of "split_qt_flag" is 1, the corresponding node is split into 4 square nodes, and when the value of "qt_split_flag" is 0, the corresponding node becomes a "QT leaf node" of the quadtree, and the corresponding node is split into multiple types of nodes. According to an embodiment of the present invention, the splitting of the quadtree can be limited according to the type of the current node. Quadtree splitting can be allowed when the current node is a compilation tree unit (the root node of the quadtree) or a quadtree node, and quadtree splitting is not allowed when the current node is a multi-type tree node. Each quadtree leaf node "QT leaf node" can be further split into a multi-type tree structure. As described above, when "split_qt_flag" is 0, the current node can be split into multiple types of nodes. In order to indicate the split direction and split shape, "mtt_split_cu_vertical_flag" and "mtt_split_cu_binary_flag" can be sent by signal. When the value of "mtt_split_cu_vertical_flag" is 1, it indicates the vertical splitting of the node "MTT node", and when the value of "mtt_split_cu_vertical_flag" is 0, it indicates the horizontal splitting of the node "MTT node". In addition, when the value of "mtt_split_cu_binary_flag" is 1, the node "MTT node" is split into two rectangular nodes, and when the value of "mtt_split_cu_binary_flag" is 0, the node "MTT node" is split into three rectangular nodes.

[0104] In the tree partition structure, the luminance block and the chrominance block can be partitioned in the same form. That is, the chrominance block can be partitioned with reference to the partition form of the luminance block. When the current chrominance block is smaller than a predetermined size, even if the luminance block is partitioned, the chrominance block may not be partitioned.

[0105] In the tree partition structure, the luminance block and the chrominance block may have different forms. In this case, the luminance block partition information and the chrominance block partition information may be separately signaled. In addition, in addition to the partition information, the luminance block encoding information and the chrominance block encoding information may also be different from each other. In one example, the luminance block and the chrominance block may be different in at least one aspect among the intra-frame coding mode, the encoding information for motion information, and the like.

[0106] The node to be divided into the smallest unit can be regarded as a coding block. When the current block is a coding block, the coding block can be partitioned into several sub-blocks (sub-coding blocks), and the sub-blocks can have the same prediction information or different prediction information. In one example, when the coding unit is in intra mode, the intra prediction modes of the sub-blocks can be the same or different from each other. In addition, when the coding unit is in inter mode, the sub-blocks can have the same motion information or different motion information. In addition, the sub-blocks can be encoded or decoded independently of each other. Each sub-block can be distinguished by a sub-block index (sbIdx). In addition, when the coding unit is partitioned into sub-blocks, the coding unit can be partitioned horizontally, vertically or diagonally. In intra mode, a mode in which the current coding unit is partitioned horizontally or vertically into two or four sub-blocks is called intra sub-partitioning (ISP). In inter mode, a mode in which the current coding block is partitioned diagonally is called a geometric partitioning mode (GPM). In GPM mode, a predetermined angle table is used to derive the position and direction of the diagonal line, and the index information of the angle table is sent by signal.

[0107] Picture prediction (motion compensation) for encoding is performed on a coding unit that is no longer divided (ie, a leaf node of a coding unit tree). Hereinafter, a basic unit for performing prediction will be referred to as a "prediction unit" or a "prediction block".

[0108] Hereinafter, the term "unit" used herein may replace a prediction unit, which is a basic unit for performing prediction. However, the present disclosure is not limited thereto, and the "unit" may be understood as broadly covering the concept of a coding unit.

[0109] Figure 5 and Figure 6 The intra prediction method according to an embodiment of the present invention is illustrated in more detail. As described above, the intra prediction unit predicts sample values ​​of the current block by using reconstructed samples located on the left and / or above the current block as reference samples.

[0110] first, Figure 5 An embodiment of a reference sample used for prediction of a current block in an intra prediction mode is shown. According to an embodiment, the reference sample may be a sample adjacent to the left boundary of the current block and / or a sample adjacent to the upper boundary. Figure 5 As shown in , 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, a maximum of 2W+2H+1 neighboring samples located on the left and top of the current block can be used to configure reference samples.

[0111] Pixels from multiple reference lines may be used for intra prediction of the current block. The multiple reference lines may include n lines located within a predetermined range from the current block. According to an embodiment, when pixels from multiple reference lines are used for intra prediction, separate index information indicating lines to be set as reference pixels may be signaled and may be named reference line index.

[0112] When at least some samples to be used as reference samples have not been reconstructed, the intra prediction unit may obtain reference samples by performing a reference sample filling process. The intra prediction unit may perform a reference sample filtering process to reduce errors in intra prediction. That is, filtering may be performed on adjacent samples and / or reference samples obtained by the reference sample filling process to obtain filtered reference samples. The intra prediction unit predicts samples of the current block by using the reference samples obtained as above. The intra prediction unit predicts samples of the current block by using unfiltered reference samples or filtered reference samples. In the present disclosure, adjacent samples may include samples on at least one reference line. For example, adjacent samples may include adjacent samples on a line adjacent to a boundary of the current block.

[0113] Next, Figure 6 An embodiment of a prediction mode for intra prediction is shown. For intra prediction, intra prediction mode information indicating an intra prediction direction may be signaled. The intra prediction mode information indicates one of a plurality of intra prediction modes included in an intra prediction mode set. When a current block is an intra prediction block, a decoder receives the intra prediction mode information of the current block from a bitstream. An intra prediction unit of the decoder performs intra prediction on the current block based on the extracted intra prediction mode information.

[0114] According to an embodiment of the present invention, the intra prediction mode set may include all intra prediction modes used in intra prediction (e.g., a total of 67 intra prediction modes). More specifically, the intra prediction mode set may include a plane mode, a DC mode, and a plurality of (e.g., 65) angle modes (i.e., directional modes). Each intra prediction mode may be indicated by a preset index (i.e., an intra prediction mode index). For example, Figure 6As shown, intra-frame prediction mode index 0 indicates plane mode, and intra-frame prediction mode index 1 indicates DC mode. In addition, intra-frame prediction mode indexes 2 to 66 may indicate different angle modes, respectively. The angle modes respectively indicate angles that are different from each other within a preset angle range. For example, the angle mode may indicate an angle within an angle range (i.e., a first angle range) between 45 degrees and -135 degrees in a clockwise direction. The angle mode may be defined based on the 12 o'clock direction. In this case, intra-frame prediction mode index 2 indicates a horizontal diagonal (HDIA) mode, intra-frame prediction mode index 18 indicates a horizontal (horizontal, HOR) mode, intra-frame prediction mode index 34 indicates a diagonal (DIA) mode, intra-frame prediction mode index 50 indicates a vertical (VER) mode, and intra-frame prediction mode index 66 indicates a vertical diagonal (VDIA) mode.

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

[0116] According to yet another embodiment of the present invention, the plurality of angle modes configuring the 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 according to the basic angle mode.

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

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

[0119] In the above embodiment, the intervals between the extended angle modes can be set based on the intervals between the corresponding basic angle modes. For example, the intervals between the extended angle modes {3, 5, 7, ..., 65} can be determined based on the intervals between the corresponding basic angle modes {2, 4, 6, ..., 66}. In addition, the intervals between the extended angle modes {-14, -12, ..., -1} can be determined based on the intervals between the corresponding basic angle modes {53, 54, ..., 66} on the opposite side, and the intervals of the extended angle modes {67, 68, ..., 80} can be determined based on the intervals between the corresponding basic angle modes {2, 3, 4, ..., 15} on the opposite side. The angular intervals between the extended angle modes can be set to be the same as the angular intervals between the corresponding basic angle modes. In addition, the number of extended angle modes in the intra-frame prediction mode set can be set to be less than or equal to the number of basic angle modes.

[0120] 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 basic angle mode to be replaced may be a corresponding angle mode on a side opposite to the wide angle mode. That is, the basic angle mode to be replaced is an angle mode corresponding to an angle in the opposite direction to the angle indicated by the wide angle mode, or an angle mode corresponding to an angle in the opposite direction that differs by a preset offset index. According to one embodiment of the present invention, the preset offset index is 1. The intra-frame prediction mode index corresponding to the basic angle mode to be replaced may be remapped to the wide angle mode to signal the corresponding wide angle mode. For example, the wide angle mode {-14, -12, ..., -1} may be signaled by the intra-frame prediction mode index {52, 53, ..., 66}, respectively, and the wide angle mode {67, 68, ..., 80} may be signaled by the intra-frame prediction mode index {2, 3, ..., 15}, respectively. In this way, the intra-frame prediction mode index for the basic angle mode is used to signal the extended angle mode, and thus even if the configuration of the angle mode for intra-frame prediction of each block is different from each other, the intra-frame prediction mode can be signaled using the same intra-frame prediction mode index set. Therefore, the signaling overhead caused by the change of the intra-frame prediction mode configuration can be minimized.

[0121] 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 an embodiment, when the size of the current block is greater than a preset size, the extended angle mode may be used for intra-frame prediction of the current block, otherwise the basic angle mode can be used only for intra-frame prediction of the current block. According to another embodiment, when the current block is a block other than a square, the extended angle mode may be used for intra-frame prediction of the current block, and when the current block is a square block, only the basic angle mode may be used for intra-frame prediction of the current block.

[0122] 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. When the intra prediction mode index indicates a specific angle mode, the reference samples corresponding to the specific angle or the interpolated reference samples from the current samples in the current block are used for the prediction of the current pixel. Therefore, depending on the intra prediction mode, different sets of reference samples and / or interpolated reference samples can be used for intra prediction. After performing intra prediction of the current block using the reference samples and the intra prediction mode information, the decoder reconstructs 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.

[0123] The motion information used for inter prediction may include reference direction indication information (inter_pred_idc), reference picture indexes (ref_idx_l0, ref_idx_l1), and motion vectors (mvL0, mvL1). Reference picture list utilization information (predFlagL0, predFlagL1) may be set based on the reference direction indication information. In one example, for unidirectional prediction using L0 reference pictures, predFlagL0=1 and predFlagL1=0 may be set. For unidirectional prediction using L1 reference pictures, predFlagL0=0 and predFlagL1=1 may be set. For bidirectional prediction using both L0 and L1 reference pictures, predFlagL0=1 and predFlagL1=1 may be set.

[0124] When the current block is a coding unit, the coding unit may be partitioned into a plurality of sub-blocks, and the sub-blocks may have the same prediction information or different prediction information. In one example, when the coding unit is in intra mode, the intra prediction modes of the sub-blocks may be the same or different from each other. In addition, when the coding unit is in inter mode, the sub-blocks may have the same motion information or different motion information. In addition, the sub-blocks may be encoded or decoded independently of each other. Each sub-block may be distinguished by a sub-block index (sbIdx).

[0125] The motion vector of the current block is likely to be similar to the motion vectors of neighboring blocks. Therefore, the motion vectors of neighboring blocks can be used as motion vector predictors (MVPs), and the motion vectors of neighboring blocks can be used to derive the motion vector of the current block. In addition, to improve the accuracy of the motion vector, the motion vector difference (MVD) between the best motion vector of the current block and the motion vector predictor found by the encoder from the original video can be signaled.

[0126] Motion vectors can have various resolutions, and the resolution of motion vectors can vary on a block-by-block basis. Motion vector resolution can be expressed in integer units, half-pixel units, 1 / 4 pixel units, 1 / 16 pixel units, 4 integer pixel units, etc. Videos such as screen content have simple graphic forms such as text, and do not require the application of interpolation filters. Therefore, integer units and 4 integer pixel units can be selectively applied on a block-by-block basis. Blocks encoded using affine modes representing rotation and scaling show significant changes in form, so integer units, 1 / 4 pixel units, and 1 / 16 pixel units can be selectively applied on a block-by-block basis. Information about whether motion vector resolution is selectively applied on a block-by-block basis is sent by amvr_flag with a signal. If applied, information about the motion vector resolution to be applied to the current block is sent by amvr_precision_idx with a signal.

[0127] In the case of a block to which bidirectional prediction is applied, weights applied between two predicted blocks may be equal or different, and information on the weights is signaled via BCW_IDX.

[0128] In order to improve the accuracy of the motion vector predictor, a merge or AMVP (Advanced Motion Vector Prediction) method can be selectively used on a block-by-block basis. The merge method is a method of configuring the motion information of the current block to be the same as the motion information of the neighboring blocks adjacent to the current block, and its advantage is that the motion information is propagated spatially without changes in motion areas with homogeneity, and thus the encoding efficiency of the motion information is increased. On the other hand, the AMVP method is a method for predicting motion information in the L0 and L1 prediction directions, respectively, and signaling the optimal motion information in order to represent accurate motion information. The decoder derives the motion information for the current block by using the AMVP or merge method, and then uses the reference block in the motion information located in the reference picture as the prediction block for the current block.

[0129] A method for deriving motion information in a merge or AMVP relates to a method for constructing a motion candidate list using a motion vector predictor derived from a neighboring block of a current block, and then signaling index information for the best motion candidate. In the case of AMVP, motion candidate lists are derived for L0 and L1, respectively, so the best motion candidate indexes (mvp_l0_flag, mvp_l1_flag) for L0 and L1 are signaled, respectively. In the case of a merge, a single motion candidate list is derived, so a single merge index (merge_idx) is signaled. There may be various motion candidate lists derived from a single coding unit, 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 about a residual block in a block encoded using a merge mode may be referred to as a merge skip (MergeSkip) mode.

[0130] In this specification, a motion candidate and a motion information candidate may have the same meaning. In addition, a motion candidate list and a motion information candidate list may have the same meaning.

[0131] Symmetric MVD (SMVD) is a method that makes the motion vector difference (MVD) values ​​in the L0 and L1 directions symmetrical in the case of bidirectional prediction, thereby reducing the bit rate of the transmitted motion information. The MVD information in the L1 direction, which is symmetrical with the L0 direction, is not transmitted, and the reference picture information in the L0 and L1 directions is not transmitted, but is derived during decoding.

[0132] Overlapped Block Motion Compensation (OBMC) is a method that generates a prediction block for a current block by using the motion information of neighboring blocks when the blocks have different motion information, and then weighted averaging the prediction blocks to generate a final prediction block for the current block. This has the effect of reducing the blocking phenomenon that occurs at the edges of blocks in motion compensated video.

[0133] Typically, the merged motion candidate has lower motion accuracy. In order to improve the accuracy of the merged motion candidate, a merge mode with MVD (MMVD) method can be used. The MMVD method is a method for correcting motion information by using a candidate selected from several motion difference value candidates. Information about the correction value of the motion information obtained by the MMVD method (for example, an index indicating a candidate selected from the motion difference value candidates, etc.) can be included in the bitstream and sent to the decoder. By including information about the correction value of the motion information in the bitstream, bit rate can be saved compared to including the existing motion information difference value in the bitstream.

[0134] The template matching (TM) method is a method of configuring a template by neighboring pixels of a current block, searching for a matching area most similar to the template, and correcting motion information. Template matching (TM) is a method of reducing the size of the encoded bitstream by performing motion prediction by a decoder without including motion information in the bitstream. The decoder does not have the original image, and therefore can schematically derive motion information of the current block by using pre-reconstructed neighboring blocks.

[0135] The decoder-side motion vector refinement (DMVR) method is a method for correcting motion information by correlation with an already reconstructed reference video in order to find more accurate motion information. The DMVR method is a method of using the bidirectional motion information of the current block to use the point with the best match between the reference blocks in the reference picture as a new bidirectional motion within a predetermined area of ​​the two reference pictures. When performing the DMVR method, the encoder may perform DMVR on one block to correct the motion information, and then partition the block into sub-blocks, and perform DMVR on each sub-block to correct the motion information of the sub-block again, and this may be referred to as multi-pass DMVR (MP-DMVR).

[0136] The local illumination compensation (LIC) method is a method for compensating for brightness variation between blocks, and is a method of deriving a linear model by using neighboring pixels adjacent to a current block, and then compensating for brightness information of the current block by using the linear model.

[0137] Existing video coding methods perform motion compensation by only considering parallel motion in the upward, downward, leftward and rightward directions, thus reducing coding efficiency when encoding videos including motions such as scaling, zooming and rotation that are common in real life. In order to express motions such as scaling, zooming and rotation, an affine model-based motion prediction technique using four (rotation) or six (scaling, scaling, rotation) parameter models can be applied.

[0138] Bidirectional optical flow (BDOF) is used to correct the predicted block by estimating the amount of change in pixels based on optical flow from a reference block of a block with bidirectional motion. The motion information derived by BDOF of VVC can be used to correct the motion of the current block.

[0139] Prediction refinement with optical flow (PROF) is a technique for improving the affine motion prediction accuracy for each sub-block to make it similar to the motion prediction accuracy for each pixel. Similar to BDOF, PROF is a technique for obtaining the final prediction signal by calculating a correction value for each pixel relative to the pixel value of affine motion compensation for each sub-block based on optical flow.

[0140] The combined inter / intra prediction (CIIP) method is a method for generating a final prediction block by performing weighted averaging of a prediction block generated by an intra prediction method and a prediction block generated by an inter prediction method when generating a prediction block for a current block.

[0141] The intra block copy (IBC) method is a method for finding a portion most similar to a current block in an already reconstructed area within a current picture and using a reference block as a prediction block for the current block. In this case, information related to a block vector, which is a distance between the current block and the reference block, may be included in a bitstream. The decoder is able to parse the information related to the block vector contained in the bitstream to calculate or set the block vector for the current block.

[0142] The bi-prediction with CU level weight (BCW) method is a method of performing weighted averaging of two prediction blocks by adaptively applying weights on a block-by-block basis without generating the prediction blocks using an average value, with respect to two motion compensated prediction blocks from different reference pictures.

[0143] The intra template matching prediction (TMP) method is a method in which a video signal processing apparatus configures a reference template by using pixel values ​​of neighboring blocks adjacent to a current block, searches for a portion most similar to the configured reference template in a reconstructed area in a current picture, and then uses a corresponding reference block (a portion found in the reconstructed area) as a prediction block for the current block.

[0144] The Multiple Hypothesis Prediction (MHP) method is a method for performing weighted prediction through various prediction signals by transmitting additional motion information in addition to unidirectional and bidirectional motion information during inter-picture prediction.

[0145] The cross component linear model (CCLM) is a method for configuring a linear model by using a high correlation between a luminance signal and a chrominance signal at the same position as the corresponding luminance signal, and then predicting the chrominance signal through the corresponding linear model. After configuring a template using a block from a neighboring block adjacent to the current block that has been reconstructed, the parameters of the linear model are then derived through the template. Next, the current luminance block that is selectively reconstructed according to the size of the chrominance block according to the video format is downsampled. Finally, the chrominance component block of the current block is predicted using the downsampled luminance component block and the corresponding linear model. In this case, the method using two or more linear models is called a multi-model linear model (MMLM).

[0146] In independent scalar quantization, the reconstructed coefficient t'k of the input coefficient tk depends only on the quantization index qk. That is, the quantization index of any reconstructed coefficient has a different value from the quantization index of other reconstructed coefficients. In this case, t'k may be a value obtained by adding the quantization error to tk, and may vary or remain unchanged according to the quantization parameter. Here, t'k may also be referred to as a reconstructed transform coefficient or an inverse quantized transform coefficient, and the quantization index may also be referred to as a quantized transform coefficient.

[0147] In uniform reconstruction quantization (URQ), the reconstruction coefficients have the property of being arranged at equal intervals. The distance between two adjacent reconstruction values ​​may be referred to as the quantization step size. The reconstruction value may include 0, and the entire set of available reconstruction values ​​may be uniquely defined based on the quantization step size. The quantization step size may vary depending on the quantization parameter.

[0148] In existing methods, quantization reduces the set of acceptable reconstructed transform coefficients, and the elements of this set may be limited. Therefore, there is a limitation in minimizing the average error between the original video and the reconstructed video. Vector quantization can be used as a method for minimizing the average error.

[0149] A simple form of vector quantization used in video coding is sign data hiding. This is a method in which the encoder does not encode the sign for a non-zero coefficient, and the decoder determines the sign for the coefficient based on whether the sum of the absolute values ​​of all coefficients is even or odd. To this end, in the encoder, at least one coefficient may be incremented or decremented by "1", and at least one coefficient may be selected and have a value adjusted to be optimal from a rate-distortion cost perspective. In one example, a coefficient having a value close to a boundary between quantization intervals may be selected.

[0150] Another vector quantization method is grid-coded quantization, and in video coding, it is used as an optimal path search technique to obtain optimized quantization values ​​in dependent quantization. On a block-by-block basis, the quantization candidates for all coefficients in the block are placed in a grid map, and the optimal grid path between the optimized quantization candidates is found by considering the rate-distortion cost. Specifically, the dependent quantization applied to video coding can be designed so that the set of acceptable reconstructed transform coefficients relative to the transform coefficients depends on the value of the transform coefficients that precede the current transform coefficient in the reconstruction order. At this time, by selectively using multiple quantizers according to the transform coefficients, the average error between the original video and the reconstructed video is minimized, thereby increasing the coding efficiency.

[0151] In the intra-frame prediction coding technology, the matrix intra-frame prediction (MIP) method is a matrix-based intra-frame prediction method, and obtains a prediction signal by using a predefined matrix and an offset value of pixels on the left and top of a neighboring block, which is different from a prediction method with directionality of pixels from neighboring blocks adjacent to a current block.

[0152] In order to derive an intra prediction mode for a current block, based on a template that is a random reconstruction area adjacent to the current block, the current block may be reconstructed using an intra prediction mode for a template derived from neighboring pixels of the template. First, the decoder may generate a prediction template for the template by using neighboring pixels (references) adjacent to the template, and may use an intra prediction mode that generates a prediction template that is most similar to the reconstructed template to reconstruct the current block. This method may be referred to as template intra mode derivation (TIMD).

[0153] Typically, the encoder can determine the prediction mode for generating a prediction block and generate a bitstream including information about the determined prediction mode. The decoder can parse the received bitstream to set the intra-frame prediction mode. In this case, the bit rate of the information about the prediction mode can be approximately 10% of the total bitstream size. In order to reduce the bit rate of the information about the prediction mode, the encoder may not include the information about the intra-frame prediction mode in the bitstream. Therefore, the decoder can use the characteristics of the neighboring blocks to derive (determine) the intra-frame prediction mode for reconstruction of the current block, and can use the derived intra-frame prediction mode to reconstruct the current block. In this case, in order to derive the intra-frame prediction mode, the decoder can apply the Sobel filter horizontally and vertically to each neighboring pixel adjacent to the current block to infer the directional information, and then map the directional information to the intra-frame prediction mode. The method by which the decoder derives the intra-frame prediction mode using the neighboring blocks can be described as decoder-side intra-frame mode derivation (DIMD).

[0154] Figure 7The diagram illustrates the positions of neighboring blocks used to construct a motion candidate list in inter-frame prediction.

[0155] The neighboring block may be a spatially positioned block or a temporally positioned block. The neighboring block spatially adjacent to the current block may be at least one of a left (A1) block, a lower left (A0) block, an upper (B1) block, an upper right (B0) block, or an upper left (B2) block. The neighboring block temporally adjacent to the current block may be a block in a collocated picture, which includes the position of the upper left pixel of the lower right (BR) block of the current block. When the neighboring block temporally adjacent to the current block is encoded using an intra-frame mode, or when the neighboring block temporally adjacent to the current block is positioned as not being used, a block including the horizontal and vertical center (Ctr) pixel positions in the current block in the collocated picture corresponding to the current picture may be used as a temporal neighboring block. The motion candidate information derived from the collocated picture may be referred to as a temporal motion vector predictor (TMVP). Only one TMVP can be derived from a block. A block may be partitioned into a plurality of sub-blocks, and a TMVP candidate may be derived for each sub-block. The method for deriving TMVP based on sub-blocks may be referred to as sub-block temporal motion vector predictor (sbTMVP).

[0156] It can be determined whether to apply the method described in this specification based on at least one of the information related to slice type information (e.g., whether the slice is an I slice, a P slice, or a B slice), whether the current block is a tile, whether the current block 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 the frame is a reference frame or a non-reference frame, and the temporal layer corresponding to the reference sequence and layer. The multiple pieces of information used to determine whether to apply the method described in this specification can be multiple pieces of information pre-agreed between the decoder and the encoder. In addition, such multiple pieces of information can be determined according to the profile and level. Such multiple pieces of information can be expressed by variable values, and the bitstream can include information about the variable values. That is, the decoder can parse the information about the variable values ​​included in the bitstream to determine whether to apply the above method. For example, it can be determined whether to apply the above method based on the width length or height length of the coding unit. If the width length or height length is equal to or greater than 32 (e.g., 32, 64, or 128), the above method can be applied. If the width length or height length is less than 32 (e.g., 2, 4, 8, or 16), the above method can be applied. If width length or height length is equal to 4 or 8, the above method can be applied.

[0157] Figure 8 A process of generating a prediction block by using a DIMD according to an embodiment of the present disclosure is illustrated.

[0158] refer to Figure 8, the decoder can derive the prediction block by using neighboring samples (blocks or pixels). In this case, the neighboring samples can be neighboring blocks (pixels) of the current block. Specifically, the decoder can determine the intra-frame prediction mode for reconstructing the current block through a histogram of directional information (angle information) and weight information by using neighboring samples as input.

[0159] Fig. 9 FIG. 1 illustrates positions of neighboring pixels used to derive orientation information according to an embodiment of the present disclosure.

[0160] Fig. 9 (a) illustrates the situation where all neighboring blocks of the current block can be used to derive directional information. Fig. 9 (b) illustrates a case where the upper boundary of the current block corresponds to the boundary of a sub-picture, a slice, a tile, and a CTU, and Fig. 9 (c) illustrates a case where the upper boundary of the current block corresponds to the boundary of a sub-picture, a slice, a tile, and a CTU. When the neighboring block and the current block do not belong to the same sub-picture, slice, tile, and CTU, the neighboring block cannot be used to derive directional information. Fig. 9 The gray dots in indicate the positions of pixels that are actually used to derive orientation information, and the dashed lines indicate the boundaries of sub-pictures, slices, tiles, and CTUs. Fig. 9 (d) to Fig. 9 (f) In order to derive orientation information, the pixels located at the boundary can be filled with a pixel beyond the boundary. Through this filling, the orientation information can be derived more accurately.

[0161] In order to derive the directional information of the pixel in a specific position, the 3x3 Sobel filter in Formula 1 may be applied to each of the horizontal and vertical directions. A in Formula 1 may mean the pixel information (value) of the reconstructed neighboring block of the 3x3 current block. The directional information (θ) may be determined using Formula 2. In order to reduce the computational complexity for deriving the directional information, the decoder may derive the directional information (θ) by performing calculations on only Gy / Gx in Formula 1 without calculating the atan function in Formula 2.

[0162] [Formula 1]

[0163]

[0164] [Formula 2]

[0165]

[0166] refer to Fig. 9 , can be targeted Fig. 9The directional information is calculated for each of the gray points shown in , and the directional information can be mapped to the angle of the intra-frame prediction mode. The intra-frame prediction mode set may include a planar mode, a DC mode, and multiple (e.g., 65) angle modes (i.e., directional modes). The intra-frame prediction mode may include 67 modes, and the directional information (angle (θ)) calculated by Formula 2 may be a value in real numbers. Therefore, a process of mapping the directional information to a specific intra-frame prediction directional mode is required. The directional mode described in the present disclosure may be the same as the angle mode.

[0167] Fig.10 A method of mapping a directional pattern according to an embodiment of the present disclosure is illustrated.

[0168] refer to Fig.10 , the intra prediction directional mode can be divided into four sections, such as 0 degrees (index 18), 45 degrees (index 34), 90 degrees (index 50) and 135 degrees (index 66) (see Figure 6 ). refer to Fig.10 , the interval for determining the intra-frame prediction directional mode can be divided into four segments from segment 0 to segment 3. Segment 0 may correspond to a segment from -45 degrees to 0 degrees, segment 1 may correspond to a segment from 0 degrees to 45 degrees, segment 2 may correspond to a segment from 45 degrees to 90 degrees, and segment 3 may correspond to a segment from 90 degrees to 135 degrees. In this case, each segment may include 16 intra-frame prediction directional modes. By comparing the signs and magnitudes of Gx and Gy calculated by formula 1, the directional mode can be determined as one of the four segments. For example, when Gx and Gy are positive numbers and the absolute value of Gx is greater than the absolute value of Gy, segment 1 can be selected. The intra-frame prediction directional mode mapped to each segment can be determined by the directional information (θ) calculated from formula 2. Specifically, the decoder scales the directional information (θ) by multiplying the value by 2^16. In addition, the decoder can find the value closest to the scaling value by comparing the scaling value with the numerical value in the predefined table, and determine the intra-frame prediction direction mode based on the closest value. In this case, the number of values ​​in the predefined table can be 17. Specifically, the values ​​in the predefined table can 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 values ​​in the predefined table can be configured differently according to the difference between the angles of the intra-frame prediction directional mode.

[0169] In order to reduce the computational complexity, when the orientation angle is obtained by using only Gy / Gx without performing atan calculation, the difference between the values ​​in the predefined table may not match the distance between the angles of the intra-frame prediction orientation mode. The atan function has the characteristic that its slope gradually decreases as the input value increases. Therefore, it is also necessary to consider both the difference between the angles of the intra-frame prediction orientation mode and the nonlinear characteristics of the atan function to configure the numerical values ​​of the definition table. For example, the difference between the values ​​in the definition table can be configured to gradually decrease. On the contrary, the difference between the values ​​in the definition table can be configured to gradually increase.

[0170] When the width and height of the current block are different from each other, the intra-prediction directional mode that can be used may change. That is, when the width and height of the current block are different from each other, the segment used to derive the intra-prediction directional mode may change. In other words, the segment used to derive the intra-prediction directional mode can be changed based on the width and height of the current block (e.g., the ratio between the width and the height, etc.). For example, when the width of the current block is greater than its height, the intra-prediction mode can be remapped from 67 to 80, and the intra-prediction mode in the opposite direction can be excluded from 2 to 15. For example, when the width of the current block is n (integer) times greater than the height (e.g., twice as long), the intra-prediction mode {3, 4, 5, 6, 7, 8} can be reconfigured to (mapped to) {67, 68, 69, 70, 71, 72}, respectively. In addition, when the width of the current block is greater than the height, the intra-prediction mode can be reconfigured using the value obtained by adding "65" to the intra-prediction mode. When the width of the current block is smaller than the height, the intra prediction mode may be reconfigured using a value obtained by subtracting '67' from the intra prediction mode.

[0171] A histogram may be used to derive an intra-frame prediction directional mode for reconstructing the current block. When there are more non-directional blocks than directional blocks due to obtaining directional information of neighboring blocks, the prediction mode for the non-directional blocks may have the highest cumulative value in the histogram. However, it is necessary to derive a directional mode to reconstruct the current block, and even if the cumulative value in the histogram is the highest value, the prediction mode of the non-directional mode may be excluded. That is, a flat area with no change or no directionality between neighboring pixels may not be used to derive an intra-frame prediction directional mode. For example, the prediction mode of a non-directional block may be a plane mode and a DC mode. When the left neighboring block is in a plane mode or a DC mode, the left neighboring block may not be used to derive directional information, and only the upper neighboring block is used to derive directional information. When both flat areas and directional areas are mixed in the neighboring blocks of the current block, the decoder may generate a histogram to emphasize directivity by using the G value calculated as in Formula 3. In this case, the histogram may not be based on a frequency count of adding "1" to each occurrence of the intra-frame prediction directional mode, but on a cumulative value of the G value calculated to add the intra-frame prediction directional mode each time.

[0172] [Formula 3]

[0173] G=|G x |+|G y |

[0174] Fig.11 A histogram for deriving intra-prediction directional modes according to an embodiment of the present disclosure is illustrated.

[0175] Fig.11 The X-axis in indicates the intra-prediction directional mode, and the Y-axis indicates the accumulated G value. The decoder can select the intra-prediction directional mode with the largest accumulated G value 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 accumulated value. Fig.11, mode A with the largest cumulative value and mode B with the second largest cumulative value can be selected as intra-frame prediction directional modes. In order to generate the prediction block of the current block, the decoder can generate the final prediction block by weighted averaging the prediction block generated using mode A, the prediction block generated using mode B, and the prediction block finally generated using the plane mode. In this case, the weight of each prediction block can be determined using the cumulative values ​​of mode A and mode B. For example, the weight of the prediction block generated using the plane mode can be configured as 1 / 3 of the total weight. The weight of the prediction block generated using mode A can be configured as a weight corresponding to the value obtained by dividing the cumulative value of mode A by the sum of the cumulative values ​​of mode A and mode B. The weight of the prediction block generated using mode B can be determined as the value obtained by subtracting the weight of mode A and 1 / 3 of the total weight from the total weight. In order to calculate the weight more accurately, the decoder can multiply the weight of the prediction block generated using mode A by an arbitrary value to expand the range of the weight. The weight of the prediction block generated using mode B and the weight of the prediction block generated using the plane mode can also be expanded in the same way.

[0176] Fig.12 A method of signaling a DIMD mode according to an embodiment of the present disclosure is illustrated.

[0177] Specifically, Fig.12 The figure shows a signaling method for storing a syntax element indicating whether the DIMD mode is applied in a bitstream and transmitting it to a decoder. Fig.12, when the coding mode of the current block is intra mode, the syntax element (sps_dimd_enabled_flag) indicating whether the DIMD mode configured in the SPS is activated indicates that the DIMD mode is activated (for example, when the value of sps_dimd_enabled_flag is 1), the coding mode of the current block is not SKIP mode, the current block is a luminance block, and the current block is not in inter coding mode, the syntax element (cu_dimd_flag) of whether to use the DIMD mode to generate the prediction block of the current block can be parsed. In this case, when the value of cu_dimd_flag is "1", it indicates that the DIMD mode is used to decode the current block, and when the value of cu_dimd_flag is "0", it can indicate that the DIMD mode is not used to decode the current block. When cu_dimd_flag is not parsed, the value of cu_dimd_flag can be configured to "0". sps_dimd_enabled_flag can be controlled by the syntax elements included in the profile, hierarchy, and level syntax. For example, the sps_dimd_enabled_flag may be configured by a gci_no_dimd_constraint_flag corresponding to a syntax element included in the general_conatraints_info() syntax. The gci_no_dimd_constraint_flag may be defined to perform the following operations. When the value of the gci_no_dimd_constraint_flag is 1, the sps_dimd_enabled_flag value for all pictures in OlsInScope may be 0. When the value of the gci_no_dimd_constraint_flag is 0, there may be no separate constraint (gci_no_dimd_constraint_flag equal to 1 specifies that the sps_dimd_enabled_flag for all pictures in OlsInScope should be equal to 0. The gci_no_dimd_constraint_flag equal to 0 does not impose such a constraint.).

[0178] Fig.13 A method of signaling a syntax element related to an intra prediction mode according to whether a DIMD mode is used according to an embodiment of the present invention is shown.

[0179] When the current block is decoded using the DIMD mode, additional information (syntax elements) related to the coding mode may not be parsed. Fig.13, when the value of cu_dimd_flag is 1, additional information related to the coding mode of the current block (e.g., intra_mip_flag, intra_subpartitions_mode_flag, intra_luma_mpm_flag, intra_luma_not_planar_flag, intra_luma_mpm_idx, intra_luma_mpm_remainder, etc.) may not be parsed. Thereafter, when a residual signal exists, whether the transform coefficient of the residual signal exists and syntax elements related to the residual signal may be parsed.

[0180] Fig.14 The diagram illustrates a prediction sample generation method for reconstructing a current block according to an embodiment of the present disclosure.

[0181] Specifically, Fig.14 is a structural diagram illustrating a process of more efficiently deriving an intra prediction mode and generating a prediction sample by using the derived intra prediction mode in order to improve encoding performance.

[0182] refer to Fig.14 , in the "prediction mode generator" process, the decoder can derive the intra-frame prediction directional mode of the current block by using samples of neighboring blocks adjacent to the current block (neighboring samples). In this case, the decoder can derive at least one intra-frame prediction directional mode and derive the weight of each mode. For example, in order to derive the intra-frame prediction directional mode, the decoder can use a histogram-based method of deriving directional information of neighboring block samples through an arbitrary filter and determining frequently occurring directional information by using the intra-frame prediction directional mode. In addition, as a method of deriving the intra-frame prediction directional mode, a method of generating intra-frame prediction pixels of left pixels adjacent to the current block by using only upper pixels adjacent to the current block, so as to determine the intra-frame prediction mode with the minimum distortion as the intra-frame prediction directional mode for the current block.

[0183] refer to Fig.14 In the "Intra Prediction" process, the weights and intra prediction directional modes derived in the "Prediction Mode Generator" process may be used to generate a prediction block for the current block. The number of prediction blocks may be determined according to the number of intra prediction directional modes derived in the prediction mode generator process. For example, when the number of derived intra prediction directional modes is 2, the number of prediction blocks for the current block may be 2. Position Dependent Intra Prediction Combination (PDPC) filtering using the method described below may be applied to the prediction blocks generated in the "Intra Prediction" process.

[0184] Position dependent intra prediction combination (PDPC) filter can be applied to each of the prediction blocks generated in the "intra prediction" process. When PDPC filtering is applied to each prediction block, from the perspective of the decoder, the complexity can increase, and therefore when the prediction block is predicted using the DIMD mode, the PDPC filtering may not be applied to the corresponding prediction block. In addition, PDPC filtering can be applied only to one of the mode A with the largest cumulative value and the mode B with the second largest cumulative value. For example, PDPC filtering can be applied only to mode A. In addition, it can be determined whether to apply PDPC filtering according to the weight of each directional mode. For example, it can be determined whether to apply PDPC to all or part of mode A and mode B based on the difference between the weight for mode A and the weight for mode B. For example, when the difference between the weight for mode A and the weight for mode B is less than a specific value, PDPC filtering can be applied to both mode A and mode B. In addition, each of the weight for mode A and the weight for mode B is compared with a specific value, so that it is possible to determine whether to apply PDPC filtering to mode A and mode B. When the weight is greater than a specific value, PDPC filtering can be applied to the directional mode of the corresponding weight. For example, when the weight for mode A is equal to or greater than a specific value and the weight for mode B is less than a specific value, PDCP filtering may be applied to mode A, and PDPC filtering may not be applied to mode B. In addition, regardless of the directional mode, the pre-configured form of PDPC filtering may be applied only to the final prediction block to which the weighted average is applied through the weighted prediction process (see Fig.14 ). In addition, by using mode A, PDPC filtering can be applied to the final prediction block to which the weighted average is applied in the "weighted prediction" process. By using mode B, PDPC filtering can be applied to the final prediction block to which the weighted average is applied in the "weighted prediction" process.

[0185] refer to Fig.14 , in the "other prediction" process, the decoder can additionally generate a prediction block for the current block. For example, the decoder can generate an intra prediction block by using at least one of a planar mode, a DC mode, and a matrix intra prediction (MIP). The intra prediction directional mode derived in the "prediction mode generator" process and the weight information of the prediction directional property, the quantization parameter information of the current block, the width or height of the current block, the information about whether the current block is a luminance block or a chrominance block, the intra prediction mode around the current block, and at least one of the information about whether there are transform coefficients around the current block (which may correspond to Fig.14 The additional information A, B and C) of the UE determines whether to perform the "other prediction" process. In the following, a method for determining whether to perform the "other prediction" process is described.

[0186] Information about the mode (e.g., plane, DC or MIP mode, etc.) to be used by the decoder in the "other prediction" process may be agreed upon in advance or may be signaled via SPS. For example, the decoder may determine the mode based on the syntax element (sps_dimd_default_mode) indicating the mode to be used. The decoder may determine the mode to be used among the plane mode, DC mode, and MIP mode according to the value of sps_dimd_default_mode. For example, when the value of sps_dimd_default_mode is "0", it may indicate the use of the plane mode, when the value of sps_dimd_default_mode is "1", it may indicate the use of the DC mode, and when the value of sps_dimd_default_mode is a value other than 0 or 1, it may indicate the use of the MIP mode. In addition, when the current block is a luminance block and there are transform coefficients of neighboring blocks, the decoder may generate a prediction block by using at least one of the plane mode, DC mode, and MIP mode. When the current block is a chrominance block and there are no transform coefficients of neighboring blocks, the decoder may generate a prediction block by using at least one of the plane mode, DC mode, and MIP mode. In addition, when the weights of the intra-frame prediction directional modes derived in the "prediction mode generator" process are similar to each other (for example, when the difference between the weights of the corresponding directional modes is less than a specific threshold, etc.), the "other prediction" process may not be performed. When the weights of the intra-frame prediction directional modes derived in the "prediction mode generator" process are similar to each other, the decoder can generate a prediction block by using at least one of the plane mode, DC mode, and MIP mode (that is, perform the "other prediction" process). When the difference between the weights of the intra-frame prediction directional modes derived in the "prediction mode generator" process is large (for example, when the difference between the weights of the corresponding directional modes is greater than a specific threshold, etc.), it may mean that there is a large change between the pixels of the adjacent blocks, and therefore the decoder can generate a prediction block by using at least one of the plane mode, DC mode, and MIP mode. In addition, when the width and height of the current block are different from each other, the decoder can generate a prediction block by using at least one of the plane mode, DC mode, and MIP mode. On the contrary, when the width and height of the current block are the same as each other, the decoder can generate a prediction block by using at least one of the plane mode, DC mode, and MIP mode.

[0187] In the "weighted prediction" process, the decoder can generate a prediction sample by weighted averaging several intra-frame prediction blocks generated in the "intra-frame prediction" and "other prediction" processes. The weight of each intra-frame prediction block can be determined based on at least one of the intra-frame prediction directional mode and weight information derived in the "prediction mode generator" process, the quantization parameter information of the current block, the width or height of the current block, information about whether the current block is a luminance block or a chrominance block, the intra-frame prediction mode around the current block, and information about whether there are transform coefficients around the current block.

[0188] Fig.15 A method of determining an intra prediction mode according to an embodiment of the present disclosure is illustrated.

[0189] Fig.15 Detailed illustration Fig.14 The "Forecast Pattern Generator" process of . Fig.15 , Fig.14 The "prediction mode generator" process of can derive the intra prediction directionality through histogram analysis. Specifically, in Fig.15 In the "histogram analysis" process of the decoder, the decoder can derive the intra-frame prediction directionality by analyzing the histogram obtained using neighboring samples adjacent to the current block. In this case, the decoder can derive the intra-frame prediction directionality and weight of the current block by using at least one of the width or height of the current block, quantization parameter information, intra-frame prediction directionality mode information available among neighboring blocks of the current block, information about whether there is a residual signal of a neighboring block of the current block, and information about whether the current block is a luminance block or a chrominance block. Hereinafter, a method of deriving the intra-frame prediction directionality and weight for the current block is described.

[0190] The intra-frame prediction directional mode can be configured based on a frequency count. The decoder can obtain a histogram of intra-frame prediction directional modes for neighboring blocks and can analyze the histogram to select the most frequently occurring intra-frame prediction directional mode and the second most frequently occurring mode as the prediction directional mode. In addition, the intra-frame prediction directional mode can be based on a cumulative value (e.g., Fig.11The decoder can analyze the histogram obtained by adding the G value to each of the intra-frame prediction directional modes and the cumulative value obtained, so that the most frequently occurring intra-frame prediction directional mode and the second most frequently occurring mode are selected as the prediction directional mode. In addition, the decoder can select the intra-frame prediction directional mode based on the distance between the intra-frame prediction directional modes of the adjacent blocks and the cumulative value obtained by adding the G value. The distance between the directional modes can mean the index difference of the directional mode. For example, the distance difference between the directional mode with an index of 66 and the directional mode with an index of 2 can be 64. Alternatively, 66 is the last index relative to the index of the directional mode, and therefore the distance difference between the directional mode with an index of 66 and the directional mode with an index of 2 can be 2. The decoder can obtain a histogram by using the cumulative value obtained by adding the G value to each of the intra-frame prediction directional modes for the adjacent blocks, analyze the histogram, and first select the intra-frame prediction directional mode with the largest cumulative value. Next, the decoder may use the mode with the maximum cumulative value among the modes corresponding to the cumulative values ​​remaining after excluding the maximum cumulative value (e.g., the mode with the second largest cumulative value, the mode with the third largest cumulative value, the mode with the fourth largest cumulative value, etc.), and the mode in which the distance between the directional modes is the shortest (closest). The decoder may first select the intra-frame prediction directional mode with the maximum cumulative value, and the decoder may use the mode with the maximum cumulative value among the modes corresponding to the cumulative values ​​remaining after excluding the maximum cumulative value (e.g., the mode with the second largest cumulative value, the mode with the third largest cumulative value, the mode with the fourth largest cumulative value, etc.), and the mode in which the distance between the directional modes is the largest (farthest). When determining the weight for the intra-frame prediction directional mode finally determined in the "histogram analysis" process, the cumulative value for each of the intra-frame prediction directional modes may be used.

[0191] pass Fig.15 The number of intra-frame prediction directional modes for the current block derived by the decoder in the "histogram analysis" process can be 2 or more. When the number of intra-frame prediction directional modes derived in the "histogram analysis" is 2 or more, the distances between the corresponding intra-frame prediction directional modes may be similar or different from each other. In addition, the cumulative values ​​among the intra-frame prediction directional modes may be similar or different from each other. Therefore, in order to derive the best prediction sample for the current block, it is necessary to select the best combination of various mode combinations. In addition, in order to derive the best prediction sample for the current block, the decoder can combine Fig.14The intra prediction directional mode derived in the "Prediction Mode Generator" process in the MPEG-4 AVC and the coding mode derived in the "Other Prediction" process in the MPEG-4 AVC ...

[0192] Next, refer to Fig.15, in the "prediction mode analysis" process, the decoder can select the best combination for deriving the best prediction sample for the current block by using the weight information corresponding to the determined intra-frame prediction mode and the derived intra-frame prediction mode in the "histogram analysis" process. Specifically, in order to generate the prediction sample for the current block by using the derived intra-frame prediction mode and its corresponding weight information, the decoder can determine information about whether to use weighted averaging, the intra-frame prediction mode to be used, and information about how to configure the weight for the intra-frame prediction mode. In addition, in the "prediction mode analysis" process, the decoder can select the best combination for deriving the prediction sample for the current block by using the intra-frame prediction mode determined in the "histogram analysis" process, the weight information corresponding to the determined intra-frame prediction mode, and at least one of the intra-frame prediction modes of the neighboring blocks. Specifically, in order to generate the prediction sample for the current block, the decoder can determine information about whether to use weighted averaging, the intra-frame prediction mode to be used, and information about how to configure the weight for the intra-frame prediction mode. In this case, the best combination information (combination information for prediction mode) for generating prediction samples for the current block can be derived by using the width or height of the current block, quantization parameter information, intra-frame prediction mode information available among the neighboring blocks of the current block, information about whether there is a residual signal of the neighboring blocks of the current block, and information about whether the current block is a luminance block or a chrominance block. The combination information may include information about the intra-frame prediction directional mode and the weight of the intra-frame prediction directional mode. For example, the weight of the mode with the second largest weight among those of the two derived intra-frame prediction directional modes is "0" or within an arbitrary value, and the decoder may not apply weighted averaging when generating a prediction block for the current block, and generate a prediction block by using only the intra-frame prediction directional mode with the largest weight. In this case, the arbitrary value is an integer greater than or equal to 1, and may be 10. In addition, when at least one of the two derived intra-frame prediction modes is a DC mode, a plane mode, or a MIP mode (i.e., when the intra-frame prediction mode is not a directional mode), the decoder may not apply weighted averaging when generating a prediction block for the current block, and generate a prediction block by using only one intra-frame prediction directional mode with the maximum weight. In addition, when at least one of the two derived intra-frame prediction modes is a DC mode, a plane mode, or a MIP mode (i.e., when the intra-frame prediction mode is not a directional mode), the decoder may apply weighted averaging when generating a prediction block for the current block.

[0193] Fig.16 FIG. 1 illustrates a syntax structure including syntax elements related to DIMD according to an embodiment of the present disclosure.

[0194] refer to Fig.16, when the current block is encoded using DIMD (ie, when the value of cu_dimd_flag is 1), the decoder may additionally parse a syntax element (cu_dimd_mode) for DIMD combination information (information about the modes that are combined to obtain prediction samples, ie, mode combination information). In this case, the method for parsing cu_dimd_mode may vary depending on the number of prediction modes combined. For example, when the number of combined modes is "2", the decoder may parse only one bin. In such a case, when the value of cu_dimd_mode is 0, the decoder may generate prediction samples by using mode A and mode B. When the value of cu_dimd_mode is "1", the decoder may generate prediction samples by using mode A, mode B, and plane mode, or by using mode A and plane mode, or by using mode B and plane mode. When the number of combined modes is "4", the decoder may parse two bins. In such a case, when the value of cu_dimd_mode is "0", the decoder may generate prediction samples by using mode A and mode B. When the value of cu_dimd_mode is "1", the decoder can generate prediction samples by using mode A, mode B, and planar mode. When the value of cu_dimd_mode is "2", the decoder can generate prediction samples by using mode A and planar mode. When the value of cu_dimd_mode is "3", the decoder can generate prediction samples by using mode B and planar mode.

[0195] When the syntax element for DIMD combination information is included in the bitstream, there may be a problem of increased bit amount. To solve this problem, the syntax element for DIMD combination information may not be included in the bitstream, and the decoder may derive the combination information through information about the current block and the neighboring blocks. As described above, the decoder may derive the optimal combination information for generating a prediction sample for the current block.

[0196] Fig.17 FIG. 2 illustrates intra prediction directional modes and weight information of neighboring blocks for a current block according to an embodiment of the present disclosure.

[0197] Specifically, Fig.17 The diagram is shown in Fig.15 The weight information corresponding to the intra prediction directional mode for each block is derived during the "histogram analysis" process described in the reference. Fig.17, the size of the weight (weight X) can be represented in alphabetical order. For example, the largest weight can be represented as "weight A" and the second largest weight can be represented as "weight B". There is as much weight information as the number (X) of derived intra-frame prediction directional modes. In addition, the intra-frame prediction mode corresponding to the weight weight A can be mode A. The characteristics of the weight information corresponding to the intra-frame prediction directional mode can vary according to the characteristics of the neighboring blocks adjacent to the current block. Reference Fig.17 , Case 1 shows a case where the intra-frame prediction directional modes of mode A and mode B and the multiple pieces of weight information corresponding thereto are similar. Case 2 shows a case where the difference between the intra-frame prediction directional modes of mode A and mode B and the multiple pieces of weight information corresponding thereto is large. Case 3 shows a case where the intra-frame prediction directional modes of mode A and mode B are similar but the difference between the multiple pieces of weight information corresponding thereto is large. Case 4 is a case where the intra-frame prediction directional modes of mode A and mode B are the most different but the multiple pieces of weight information corresponding thereto are similar.

[0198] Fig.18 A method of determining DIMD combination information according to an embodiment of the present disclosure is illustrated.

[0199] Specifically, Fig.18 The diagram illustrates a method of determining optimal DIMD combination information by the difference between weights (Weight A and Weight B) corresponding to intra-prediction directional modes (Mode A and Mode B) derived in the "Prediction Mode Generator" process.

[0200] refer to Fig.18, i) When the difference between the absolute values ​​of mode A and mode B is less than an arbitrary value (Tmode1, for example, 10) and weight A is less than an arbitrary threshold (Tweight1, for example, 0.7), the best DIMD combination for the current block may be a combination of mode A and mode B, and the decoder may generate a prediction sample by combining mode A and mode B. ii) When i) is not satisfied and weight A is equal to or greater than an arbitrary threshold (Tweight2, for example, 0.85), the best DIMD combination for the current block may use only mode A, and the decoder may generate a prediction sample by using only mode A. iii) When ii) is not satisfied and the difference between the absolute values ​​of mode A and mode B is greater than or equal to an arbitrary threshold (Tmode2, for example, 15), the best DIMD combination for the current block may be a combination of mode A and all or part of the coding modes (e.g., plane mode, DC mode, and MIP mode) derived in the "other prediction" process, and the decoder may generate a prediction sample by combining mode A with some or all of the coding modes (e.g., plane mode, DC mode, and MIP mode) derived in the "other prediction" process. iv) When iii) is not satisfied, the optimal DIMD combination for the current block can be a combination of mode A, mode B, and all or part of the coding modes (e.g., planar mode, DC mode, and MIP mode) derived in the "other prediction" process, and the decoder can generate prediction samples by combining mode A, mode B, and part or all of the coding modes (e.g., planar mode, DC mode, and MIP mode) derived in the "other prediction" process.

[0201] Hereinafter, a method of determining optimal DIMD combining information by a difference between intra prediction directional modes (mode A and mode B) derived by a decoder and weights (weight A and weight B) corresponding thereto is described.

[0202] The decoder can obtain the DIMD combination information by comparing the weights of mode A and mode B with the sum of all weights of the histogram (see Fig.11 Specifically, the DIMD combination information can be obtained by comparing all (eg, the sum of) the weights of the directional information of the neighboring blocks of the current block (including the weights of mode A and mode B) with the weights of mode A and mode B.

[0203] For example, when the number of derived intra-frame prediction directional modes is 1 (mode A or mode B) and the ratio of the weight of the corresponding prediction directional mode among all weights is greater than a specific ratio, the corresponding prediction directional mode can be selected. When the ratio of the weight of the derived intra-frame prediction directional mode among all weights is equal to or less than a specific ratio, the DIMD combination information can be a combination of one or more of the derived intra-frame prediction directional mode, planar mode, DC mode, and MIP mode. In this case, the specific ratio can be 1 / 2, 2 / 3, 3 / 4, 3 / 8, etc.

[0204] As another example, when the number of derived intra-frame prediction directional modes is two (mode A and mode B) and the ratio of the sum of the weights of the corresponding intra-frame prediction directional modes among all weights is greater than a specific ratio, the corresponding two intra-frame prediction directional modes can be selected. When the ratio of the sum of the weights of the two derived intra-frame prediction directional modes among all weights is equal to or less than a specific ratio, one or more of the derived intra-frame prediction directional modes, plane mode, DC mode and MIP mode can be selected as DIMD combination information. For example, mode A, mode B and plane mode can be selected. Alternatively, mode A and mode B can be selected. In such a case, the specific ratio can be 1 / 2, 2 / 3, 3 / 4, 3 / 8, etc.

[0205] Fig.19 A method of generating a prediction sample by using intra prediction directional mode information and a weight according to an embodiment of the present disclosure is illustrated.

[0206] Specifically, Fig.19 Diagram Fig.14 The "intra-frame prediction" and "weighted prediction" processes of Fig.19 , when there are multiple intra-prediction directional modes derived by the decoder, the decoder can use weight information of each of the multiple intra-prediction directional modes to obtain a prediction sample by performing weighted prediction using the weight information. The weight information (additional information) can be reconfigured based on at least one of the weight and height of the current block, the quantization parameter information, and whether the current block is a luminance block or a chrominance block.

[0207] Fig. 20 and Fig.21 Pixel values ​​of neighboring blocks used when deriving an intra-prediction directional mode according to an embodiment of the present disclosure are illustrated.

[0208] Fig. 20 and Fig.21 The picture is Fig.14The pixel values ​​of the neighboring blocks used when deriving the intra-frame prediction directional mode during the "histogram analysis" process of the decoder. When deriving the intra-frame prediction directional mode, it is necessary to perform filtering calculations on all neighboring pixels located on the left and upper sides of the current block. In this case, the neighboring pixels may be pixels adjacent to the boundary of the current block or separated from the boundary of the current block by one line. In other words, it is necessary to perform filtering calculations on all neighboring pixels on rows adjacent to or separated from the left and upper boundaries of the current block to derive the intra-frame prediction directional mode, and therefore there is a delay problem that may be caused by computational complexity. To solve this problem, the decoder can derive the intra-frame prediction directional mode for neighboring pixels located on the left and upper sides of the current block in parallel by separating the filtering calculations for neighboring pixels located on the left and upper sides of the current block. In addition, the decoder can derive the directional information by performing filtering calculations only on neighboring pixels corresponding to predetermined positions.

[0209] Fig. 20 (a) and Fig. 20 (c) illustrates neighboring pixels located on the left side of the current block that are used for filtering calculation to derive the intra prediction directional mode. Fig. 20 (b) and Fig. 20 (d) illustrates neighboring pixels located on the upper side of the current block used for filtering calculation to derive the intra prediction directional mode.

[0210] The intra-frame directional information that can be mapped can be used by the decoder to obtain Fig.11 The position of the reference pixel in the histogram described in FIG.

[0211] For example, the width and height of the current block can be the same. In this case, Fig. 20 In (a), when deriving directional information of neighboring pixels located on the left side of the current block, the mapped intra prediction directional mode can use only indexes -14 to 34. Fig. 20 In (b), when deriving directional information of neighboring pixels located on the upper side of the current block, the mapped intra prediction directional mode can use only indexes 34 to 80.

[0212] There may be a situation where the width and height of the current block are different, and the position of the neighboring pixels used when deriving the directional information may vary according to the width and height of the current block. For example, when the height of the current block is greater than the width, the decoder can derive the directional information by using only the neighboring pixels located on the left side without using the neighboring pixels located on the upper side of the current block. By using only the neighboring pixels located on the left side and not using the neighboring pixels located on the upper side, the complexity of the calculation can be reduced. When the width of the current block is greater than the height, the decoder can derive the directional information by applying a larger weight to the neighboring pixels located on the left side of the current block compared to the neighboring pixels located on the upper side of the current block. A predetermined specific value can be used for the weight. For example, when the height of the current block is greater than the width, a weight of 1 can be used for the neighboring pixels located on the left side of the current block and a weight of 2 can be used for the neighboring pixels located on the upper side. In other words, the width of the current block is greater than the height, and therefore it is more effective to derive the intra-frame prediction directional mode by using the directional information of the neighboring pixels located on the upper side than by using the directional information of the neighboring pixels located on the left side of the current block to derive the intra-frame prediction directional mode.

[0213] The decoder may perform filtering calculations only on pixels corresponding to a specific number among neighboring pixels located around the current block. In this case, the specific number may be a multiple of N, and N may be 2, 3, 4, etc. Information about N may include picture header information. Fig.21 , based on the position displaced by (-2, -2) along the x and y axes at the upper left end of the current block, the decoder can perform filtering calculations and derive directional information only at positions corresponding to multiples of "2". In addition, when the current block is a luminance block, the decoder can derive directional information, and when the current block is a chrominance block, the decoder may not derive directional information. The decoder may apply the directional information found in the luminance block to the chrominance block. The directional information of the luminance block and the directional information of the chrominance block may be obtained. Instead of using the directional information found in the luminance block, the chrominance block may use information obtained by using at least one of a planar mode, a DC mode, a horizontal mode, a vertical mode, and a MIP mode.

[0214] There is a high possibility that the intra-frame prediction directional mode of the current block is similar to the intra-frame prediction directional mode of the neighboring block. Therefore, in order to encode the intra-frame prediction directional mode of the current block, the most likely mode (MPM) list is configured using the intra-frame prediction directional mode of the neighboring block, and information about whether the intra-frame prediction directional mode of the current block exists in the MPM list and information about the location where the MPM list exists may be included in the bitstream. That is, the information about the intra-frame prediction directional mode of the current block may not be included separately in the bitstream. Therefore, the intra-frame prediction directional mode of the current block is determined based on information about whether the intra-frame prediction directional mode of the current block exists in the MPM list and information about the location where the MPM list exists, and therefore the information (i.e., the amount of bits) used to derive the intra-frame prediction directional mode of the current block may vary depending on whether the MPM list is effectively configured.

[0215] In the process of configuring the MPM list, a method of deriving an intra-prediction directional mode by using the directional characteristics of the neighboring pixels of the current block can also be used. The decoder can add the intra-prediction directional mode of the current block derived using the directional characteristics of the neighboring pixels of the current block to the MPM list and use it to encode the intra-prediction directional mode of the current block. This can be used when the neighboring blocks of the current block are not encoded in the intra-prediction mode, or when there is no intra-prediction directional mode such as the matrix intra-prediction (MIP) mode.

[0216] In the neighboring blocks adjacent to the current block, blocks in which there is no intra-frame prediction directional mode and blocks in which there is an intra-frame prediction directional mode may be mixed. When the neighboring block located on the left side of the current block is a block without an intra-frame prediction directional mode, the decoder may calculate the directional characteristics by using only the neighboring pixels located on the upper side of the current block, and derive the intra-frame prediction directional mode of the current block. Alternatively, when the intra-frame prediction directional mode exists in the neighboring block located on the upper side of the current block and the intra-frame prediction directional mode does not exist in the neighboring block located on the left side of the current block, the decoder may include the intra-frame prediction directional mode of the neighboring block located on the upper side in the MPM list, and may include the intra-frame prediction directional mode derived by the directional characteristics of the neighboring pixels located on the left side in the MPM list.

[0217] Fig. 22 A method of configuring an MPM list including an intra-prediction directional mode of a current block according to an embodiment of the present disclosure is illustrated.

[0218] refer to Fig. 22, the DIMD mode may be first included in the MPM list. There may be multiple intra-frame prediction directional modes of the current block derived by the DIMD mode. Therefore, the decoder can obtain prediction samples by multiple predictions. The intra-frame prediction directional mode of the block in which the intra-frame prediction directional mode exists among the neighboring blocks of the current block can be added to the MPM list. When there is a blank space in the MPM list, the mode obtained by modifying mode A by pressing +1 or -1 can be added to the list, and the DC mode, horizontal mode, vertical mode and MIP mode can be added. Instead of the DIMD mode, the template-based intra-frame mode derivation (TIMD) mode may be first included in the MPM list. In addition, both the DIMD mode and the TIMD mode may be included in the MPM list. In addition, at least one of the two intra-frame prediction directional modes derived using the DIMD mode and the two intra-frame prediction directional modes derived using the TIMD mode may be included in the MPM list. In addition, when the intra-frame prediction directional mode is used for the first area among the GPM blocks divided into two areas, the MPM list may be used to derive the intra-frame prediction directional mode for the first area. At least one of the two intra prediction directional modes derived using the DIMD mode and the two intra prediction directional modes derived using the TIMD mode may be included in the MPM list.

[0219] When the DIMD mode is included in the MPM list, information about whether the current block is encoded in the DIMD mode can be derived through a syntax element (mpm_idx). Therefore, it may not be necessary to send additional information related to DIMD with a signal. In this case, when the current block is encoded in the DIMD mode, the reference line index can be 0 (mrl_ref_idx is 0). In addition, when the DIMD mode is used, mrl_ref_idxm may not be parsed, and the value of mrl_ref_idx may be inferred to be 0. In addition, the intra-frame prediction directional mode derived using the DIMD mode may be included in the MPM list. When the intra-frame prediction directional mode derived from DIMD is selected, mrl_ref_idx may be reconfigured. For example, the value of mrl_ref_idx may be reconfigured to one of 0, 1, 2, ... The decoder may determine whether to add the intra-frame prediction directional mode derived using the DIMD mode to the MPM list based on the value of mrl_ref_idx obtained by parsing mrl_ref_idx, and the priority of the intra-frame prediction directional mode derived using the DIMD mode is added to the MPM list. For example, when the value of mrl_ref_idx is not 0, the decoder may not include the intra-frame prediction directional mode derived using the DIMD mode in the MPM list. Alternatively, the decoder may include the intra-frame prediction directional mode derived using the DIMD mode in the MPM list only when the value of mrl_ref_idx is 0. Alternatively, the decoder may include the intra-frame prediction directional mode derived using the DIMD mode in the MPM list only when the reference pixel line determined according to the value of mrl_ref_idx is 0, 1, 2 or 3. Alternatively, when the reference pixel line determined according to the value of mrl_ref_idx is greater than 3, the decoder may not include the intra-frame prediction directional mode derived using the DIMD mode in the MPM list. Alternatively, when the value of mrl_ref_idx is not 0, the decoder may include the intra-frame prediction directional mode derived using the DIMD mode in the MPM list.

[0220] The intra-frame prediction directional mode derived using the DIMD mode can be used to rearrange the intra-frame prediction mode candidates in the MPM list. After configuring the MPM list from the neighboring blocks of the current block, the decoder can derive the intra-frame prediction directional mode by using the DIMD mode. The decoder can rearrange the intra-frame prediction mode candidates in the MPM list by using the derived intra-frame prediction directional mode. In this case, the decoder can rearrange the MPM list by using at least one of the derived intra-frame prediction directional mode, the width or length of the current block, the quantization parameter information, the information about the available intra-frame prediction modes among the neighboring blocks of the current block, the information about whether there is a residual signal among the neighboring blocks of the current block, and the information about whether the current block is a luminance block or a chrominance block.

[0221] The decoder can rearrange the MPM list by using the difference between the intra-frame prediction mode candidate in the MPM list and the derived intra-frame prediction directional mode. For example, the decoder can calculate the difference between the derived intra-frame prediction directional mode and each intra-frame prediction mode candidate in the MPM list, so that the MPM list is rearranged in ascending order of the difference (including 0). The intra-frame prediction mode candidate with the smallest difference in the MPM list can be configured to have the smallest index value in the MPM list. In addition, the derived intra-frame prediction directional mode can be configured to have the highest priority in the MPM list and can be configured to have the smallest index value. The decoder can calculate the difference between the derived intra-frame prediction directional mode and each intra-frame prediction mode candidate, so that the MPM list is arranged after the derived intra-frame prediction directional mode in ascending order of the difference (including 0). In addition, when two MPM lists are used, the first MPM list can be configured in the order of the intra-frame prediction mode candidates similar to the derived intra-frame prediction directional mode. The first MPM list can be configured in ascending order of the difference between the derived intra-frame prediction directional mode and each intra-frame prediction mode candidate in the list. The second MPM can be configured using a candidate that is not too similar to the derived intra-frame prediction directional mode. For example, the second MPM list can be configured in descending order of the difference between the derived intra-frame prediction directional mode and the intra-frame prediction mode candidates in the MPM list. When the size of the MPM list is fixed, there may be blank space in the MPM list. In this case, new prediction candidates derived using one or more frequently occurring candidates or candidates already included in the MPM list can be added to the blank space. For example, a new prediction candidate can be a candidate corresponding to a number plus or minus an arbitrary value in the "+" or "-" direction starting from the mode number (index) of the candidate already included. In this case, the arbitrary value can be a natural number such as "1", "2", "3"..., and information about the arbitrary value can be included in the picture header information. In addition, when two MPM lists are used, the first MPM list can be configured with a prediction mode obtained by referring to the prediction mode of the neighboring blocks of the current block, and the second MPM list can be configured with a prediction mode derived using DIMD. In this case, when the number of prediction modes included in the MPM list is less than the number of prediction modes that can be included in the predefined MPM list, a prediction mode obtained by applying an offset to the prediction mode included in the MPM list may be added.

[0222] The intra-frame prediction directional mode derived using the DIMD mode can be used to reorganize the intra-frame prediction mode candidates in the MPM list. The decoder can configure the MPM list based on the prediction mode of the neighboring blocks of the current block, and then derive the intra-frame prediction directional mode through the DIMD mode. The decoder can reorganize the intra-frame prediction mode candidates in the MPM list and reconfigure multiple predictions by using the derived intra-frame prediction directional mode. In this case, the decoder can reorganize the MPM list by using at least one of the derived intra-frame prediction directional mode, the width or length of the current block, the quantization parameter information, the information about the available intra-frame prediction mode among the neighboring blocks of the current block, the information about whether the residual signal of the neighboring blocks of the current block exists, and the information about whether the current block is a luminance block or a chrominance block. The MPM list reorganization method is described below.

[0223] The decoder can reassemble the MPM list by using the difference between the derived intra-frame prediction directional mode and the intra-frame prediction mode candidate in the MPM list. For example, the decoder can select a candidate with a difference equal to or less than an arbitrary value, and can include a multiple prediction candidate configured by combining the derived intra-frame prediction directional mode and the candidate (the existing intra-frame prediction mode in the MPM list) in the MPM list. In this case, the decoder can include the corresponding candidates in the MPM list in ascending order of the difference. Next, the decoder can then insert the candidate with a difference greater than an arbitrary value into the MPM list. In this case, the arbitrary value can be a natural number such as 1, 2, 3, ... For example, it can be assumed that the index of the derived intra-frame prediction mode is "18", the index of the candidate in the MPM list is "16", "21", "34", "1" and "66", and the arbitrary value is 5. In this case, the indexes "16" and "21" with a difference of less than 5 from the derived intra-frame prediction mode can be changed to multiple prediction candidates, and the candidates in the MPM list can be changed to prediction modes with indexes "16,18", "21,18", "34", "1" and "66". That is, the indexes "16, 18" and "21, 18" can be multiple prediction candidates. For example, when the decoder selects "16, 18" corresponding to the multiple prediction candidates in the MPM list, the decoder can generate the final prediction block by weighted averaging the prediction samples generated using the prediction mode of index 16 and the prediction samples generated in the prediction using index 18. In this case, when the number of MPM lists is limited to 5, the MPM lists can be "16, 18", "21, 18", "16", "21" and "34". In addition, when two MPM lists are used, the first MPM list can be configured with candidates recombined using candidates similar to the derived intra-frame prediction directional mode. The second MPM list can be configured with candidates of the first MPM list and candidates that are not too similar to the derived intra-frame prediction directional mode. Therefore, the first MPM list can be configured with multiple prediction candidates, and the second MPM list can be configured with single prediction candidates. Alternatively, the first MPM list can be configured to include both single prediction candidates and multiple prediction candidates, and the second MPM list can be configured only with single prediction candidates. For example, the derived intra prediction mode may be index '18', the prediction mode candidates in the first MPM list may be indexes '16', '21', '34', '1', and '66', the prediction mode candidates in the second MPM list may be indexes '50', '2', '8', '30', and '40', and the arbitrary value may be 5. In this case, the indexes '16' and '21' having a difference of 5 or less from the derived intra prediction mode index 18 may be changed to multiple prediction candidates.In this case, the first MPM list may be configured with indexes "16, 18", "21, 18", "16", "18", and "34", and the second MPM list may be configured with indexes "1", "66", "50", "2", "8", "30", and "40".

[0224] The intra-frame prediction directional mode can be encoded based on whether the intra-frame prediction directional mode exists in the MPM list, and if the intra-frame prediction directional mode exists in the MPM list, based on the position in the MPM list. When the intra-frame prediction directional mode does not exist in the MPM list, the intra-frame prediction directional mode can be encoded based on the value obtained by subtracting the total number of prediction modes in the MPM list from the total number of intra-frame prediction directional modes. Specifically, there are a total of 67 intra-frame prediction directional modes, and the remaining 61 modes can be encoded after excluding a total of 5 prediction modes and the plane mode in the MPM list. In this case, the 61 intra-frame prediction directional modes can be encoded using fixed-length coding, and a total of 6 bins need to be encoded.

[0225] Fig.23 and Fig.24 FIG. 1 illustrates a template used to derive an intra prediction mode of a current block according to an embodiment of the present disclosure.

[0226] refer to Fig.23 , the decoder can derive the intra prediction mode of the current block using a template corresponding to an arbitrary reconstructed area (pixel) adjacent to the current block. First, the decoder can generate a prediction template for the template by using neighboring pixels (references) adjacent to the template. In addition, the decoder can reconstruct the current block using the intra prediction mode of the prediction template that is most similar to the reconstructed template. The method of deriving the intra prediction mode of the current block by using a template may be referred to as template intra mode derivation (TIMD). In this case, the intra prediction mode may correspond to a mode with indexes 0 to 67, and may correspond only to an intra prediction mode in the MPM list derived from the neighboring blocks of the current block. In this case, the intra prediction mode may correspond to an intra prediction mode in the MPM list derived from the neighboring blocks of the current block and a mode with an arbitrary number of differences from the intra prediction mode. The arbitrary number may be 1, 2, 3, ... Alternatively, the intra prediction mode for the template may correspond only to a directional mode, and may not correspond to a non-directional mode (planar mode or DC mode).

[0227] Hereinafter, a method of deriving an intra prediction directional mode by using a TIMD mode is described.

[0228] i) The decoder can configure the size of the template. The width or height of the template can be 4, and when the width or height of the current block is equal to or less than 8, the width or height of the template can be configured to 2. ii) The decoder can configure the type of template. The type of template can be divided into a type that uses only left samples, a type that uses upper samples, and a type that uses left samples, upper samples, and upper left samples. The decoder can determine the type of template based on whether the neighboring block is valid or whether the neighboring block can be used to derive the intra-frame prediction directional mode. When the neighboring block cannot be used to derive the intra-frame prediction directional mode, the TIMD mode can be configured as a plane mode and weighted averaging is not performed. iii) The decoder can configure the template for the current block. iv) The decoder can derive the intra-frame prediction directional mode for the neighboring blocks positioned on the left, top, upper left, upper right, and lower left of the current block to determine whether the current block has directionality. v) When none of the neighboring blocks of the current block has directionality (for example, in the case of a non-directional mode (DC mode, planar mode, MIP mode, etc.), the decoder can select an intra-frame prediction directional mode with the minimum cost, and the TIMD mode may not be performed. In this case, the weighted average using several prediction blocks may not be performed. vi) When there are one or more blocks with directionality among the neighboring blocks of the current block, the following process may be performed. The following process may be performed based on the intra-frame prediction directional modes present in the MPM list. This is because the complexity may increase when all 67 intra-frame prediction directional modes are identified. a. The decoder may configure the MPM list. b. Next, when the DC mode, horizontal mode, and vertical mode do not exist in the MPM list, the decoder may modify the MPM list by adding the DC mode, horizontal mode, and vertical mode to the MPM list. c. The decoder may compare the costs by performing an evaluation on all intra-frame prediction directional modes in the modified MPM list. The decoder may select a first mode with the minimum cost and a second mode with the second minimum cost. d. In order to increase accuracy, the decoder may additionally perform an evaluation of an intra-prediction directional mode corresponding to an index less than or greater than 1 of the intra-prediction directional mode index of the first mode and the intra-prediction directional mode index of the second mode. The decoder may perform an additional evaluation and select the third mode with the smallest cost and the fourth mode with the second smallest cost again. The first mode and the third mode may be the same as each other, and the second mode and the fourth mode may be the same as each other. e. The decoder may determine whether to perform weighted averaging based on the costs of the third mode and the fourth mode. When the difference between the cost of the third mode and the cost of the fourth mode is less than a specific value, the decoder may perform weighted averaging, and the weights of the third mode and the third mode may be determined based on the costs of the third mode and the fourth mode. When the difference between the cost of the third mode and the cost of the fourth mode is greater than a specific value, the decoder may generate a prediction block by using only the third mode without performing weighted averaging.In this case, the specific value may be a predetermined value.

[0229] The size of the template can vary depending on the width or height of the current block. For example, Fig.23 As shown in (a), the upper template is larger than the width of the current block. In this case, the height of the upper template can be a predetermined length. Similarly, a left template longer than the height of the current block can be configured. In this case, the width of the left template can be a predetermined length. The predetermined length can be 1, 2, 3, ...

[0230] When the current block is located at the CTU boundary (when any boundary among the top, bottom, left, and right of the current block is included in the CTU boundary), the reference pixels used for deriving / predicting the template used for the TIMD mode may be changed. Fig.24 , when the top boundary of the current block is included in the CTU boundary, the number of reference lines positioned on the top of the previous block used for template configuration can be 1. This is to minimize the line buffer memory usage. Therefore, the decoder can perform TIMD mode by configuring only the left template of the current block while not configuring the upper template of the current block. In this case, the upper reference and left reference of the current block can be used as reference pixels for predicting the left template. In this case, the height of the left template can be the same as the height of the current block, such as Fig.24 In addition, Fig.24 As shown in (b), the decoder may identify whether a neighboring block on the left side of the current block is a reconstructed block, and in the case of a reconstructed block, the height of the left template may be configured to be greater than the height of the current block.

[0231] Generally, as more neighboring pixels adjacent to the current block are referenced, the accuracy of the prediction sample for the current block can be increased. On the other hand, when more neighboring pixels are referenced, the required memory is increased. In addition, when there is a block that has not been reconstructed among the neighboring blocks adjacent to the current block, the corresponding area cannot be used as a template. In order to increase the memory and effectively process the unreconstructed area, such as Fig.23 As shown in (b), the length of the above template can be configured to be the same as the width of the current block, and the length of the left template can be configured to be the same as the height of the current block.

[0232] The decoder can use the intra prediction mode derived using the template to obtain the prediction sample of the current block. The decoder can generate the prediction sample by using the neighboring pixels adjacent to the current block, and can adaptively select the neighboring pixels to be used to generate the prediction sample. In addition, the decoder can use multiple reference lines to generate the prediction sample, and in this case, the index information of the multiple reference lines can be included in the bitstream.

[0233] For entropy coding, the context for the index of the multi-reference line used in the TIMD mode can be redefined. The increase in context types may be related to memory and context switching complexity. Therefore, the context for encoding and decoding the index of the multi-reference line used in the TIMD mode can be a reuse of the context for the index of the existing multi-reference line.

[0234] The transformation of the residual signal of the current block can be performed in two stages. The first main transformation can be to adaptively apply such as DCT-II, DST-VII, DCT-VIII, DCT5, DST4, DST1 and the identity transform (IDT) to the horizontal and vertical directions. The auxiliary transformation can be additionally applied to the transform coefficients obtained after completing the main transformation, and the auxiliary transformation can be calculated by the matrix multiplication between the transform coefficients after the main transformation and the predefined matrix. The auxiliary transformation can be described as a low-frequency inseparable transform (LFNST). The matrix transformation set for the auxiliary transformation can vary according to the intra-frame prediction mode of the current block. The coefficient information of the transform matrix used for the auxiliary transformation can be included in the bitstream.

[0235] When the auxiliary transform is applied to the current block to which the DIMD mode or TIMD mode is applied, the transform set for the auxiliary transform can be determined based on the intra-prediction mode derived using the DIMD mode or TIMD mode. The coefficient information of the transform matrix used for the auxiliary transform can be included in the bitstream. The decoder can parse the coefficient information included in the bitstream and configure the matrix coefficient information of the auxiliary transform for the DIMD mode or TIMD mode. In this case, one of the two intra-prediction modes derived from the TIMD mode can be used to select the main transform or the auxiliary transform set. The costs of the two intra-prediction directional modes are compared, and the intra-prediction directional mode with the minimum cost can be used to select the main transform or the auxiliary transform set. In addition, one of the two intra-prediction directional modes derived from DIMD can be used to select the main transform or the auxiliary transform set. The weights of the two intra-prediction modes are compared, and the intra-prediction directional mode with the highest weight can be used to select the main transform or the auxiliary transform set.

[0236] The TIMD mode is a mode that predicts a template of the current block and uses an intra-prediction mode derived from the template to generate a prediction block of the current block, and therefore has a high complexity. Therefore, when generating a prediction template for a template area, the decoder may not perform an existing reference sample filtering process. In addition, when the ISP mode is applied to the current block or when the CIIP mode is applied to the current block, the TIMD mode may not be applied. The ISP mode or the CIIP mode may not be applied to the current block to which the TIMD mode is applied, or the syntax associated with the ISP or CIIP may not be parsed. In this case, the value of the unparsed ISP or CIIP related syntax may be inferred to be a pre-specified value.

[0237] Template prediction can be performed in the divided areas of the left template area and the upper template area adjacent to the current block, and the intra-frame prediction mode can be derived for each template. In addition, two or more intra-frame prediction modes can be derived for each template, and the number of intra-frame prediction modes for the current block can be four or more. When there are two or more intra-frame prediction modes, all derived intra-frame prediction modes can be used to generate prediction samples for the current block, and the decoder can generate a final prediction block for the current block by weighted averaging the generated prediction samples. In this case, three or more of two or more intra-frame prediction modes, plane mode, DC mode, and MIP mode derived from template prediction can be used to generate prediction samples. For example, when generating (obtaining) prediction samples for the current block, the decoder can generate the final prediction samples by weighted averaging the prediction samples generated using the plane mode and the intra-frame prediction mode derived by template prediction.

[0238] In the case where the CIIP mode is applied, the above method can also be used to generate prediction samples. The CIIP mode is a method that uses both intra prediction and inter prediction when generating prediction samples (blocks) for the current block. The prediction samples for the current block can be generated by weighted averaging the intra prediction samples and the inter prediction samples.

[0239] When generating intra-frame prediction samples by applying CIIP mode, DIMD mode or TIMD mode can be used. In this case, when using DIMD mode, intra-frame prediction samples can be generated based on DIMD combination information. For example, the decoder can generate a first prediction sample by using the intra-frame prediction mode with the maximum weight, and generate a second prediction sample by using the intra-frame prediction mode with the second largest weight. In addition, the decoder can generate a final intra-frame prediction block by weighted averaging the first prediction sample and the second prediction sample. In this case, the decoder can generate a final intra-frame prediction block by weighted averaging a total of three prediction samples including a sample predicted using a plane mode, a first prediction sample, and a second prediction sample among neighboring blocks of the current block. When using TIMD mode, intra-frame prediction samples can be generated based on TIMD combination information. For example, the decoder can generate two prediction samples by using two intra-frame prediction modes. In addition, the decoder can generate a final intra-frame prediction sample by weighted averaging two prediction samples. In this case, the decoder can generate a final intra-frame prediction sample by weighted averaging two prediction samples and samples predicted using a plane mode.

[0240] The accuracy of the intra-frame prediction sample may vary according to the position. That is, the pixels in the prediction sample that are farther from the neighboring pixels used for prediction may include more residual signals than the pixels that are closer to the neighboring pixels. Therefore, the decoder can segment the prediction samples in the vertical, horizontal and diagonal directions according to the direction of the intra-frame prediction mode, and can configure different weights according to the distance from the neighboring pixels used for prediction. This can be applied to the intra-frame prediction block generated using the CIIP mode or the intra-frame prediction block generated using two or more intra-frame prediction modes, and different weights can be configured for each pixel in the prediction block according to the distance between the position of the reference pixel and the position of the pixel in the prediction block. In an embodiment, when the intra-frame prediction mode of the current block is a mode with a vertical direction or a direction similar to a vertical direction, the closer the pixel position of the prediction block is to the top pixel, the higher the weight can be configured, and the farther the pixel position is from the top pixel, the lower the weight can be configured for each pixel position.

[0241] When encoding the current block in the 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 weight in the inter prediction sample can be configured in consideration of the pixel unit weight of the intra prediction sample. For example, the pixel unit weight in the inter prediction sample can be a value obtained by subtracting the pixel unit weight of the intra prediction sample from the sum of all weights. In this case, the sum of all weights can be a value obtained by summing the weight of the intra prediction sample and the weight of the inter prediction sample in units of pixels.

[0242] When two or more intra prediction modes are used to generate prediction samples, the decoder may generate prediction samples based on each intra prediction mode, and may generate a final prediction sample by weighted averaging the generated prediction samples. When generating prediction samples for each intra prediction mode, a pixel-unit weight may be applied according to the intra prediction mode.

[0243] The pixel unit weight may be configured based on at least one of an intra prediction mode, a width or height of a current block, a quantization parameter, information about whether the current block is a luminance block or a chrominance block, information about whether intra coding of a neighboring block is performed, and information about whether a residual transform coefficient of a neighboring block exists.

[0244] Figure 25 to Figure 28 A method of generating prediction samples (pixels) based on a plurality of reference pixel lines according to an embodiment of the present disclosure is illustrated.

[0245] See also Fig.25 (a), the video signal processing device can generate a prediction 2502 in the current block based on a first reference pixel line (reference line 1) adjacent to the current block 2501 and a second reference pixel line (reference line 2) adjacent to the top of the first reference pixel line. Fig.25 The predicted sample 2502 of (a) is only a sample corresponding to the position according to an embodiment of the present disclosure, and the position of the pixel is not limited thereto. In the present disclosure, the meaning of performing generation by the video signal processing device may be equal to the meaning of performing acquisition by the video signal processing device. Fig.25 (b) Detailed illustration Fig.25 (a). For example, the video signal processing device may generate the first predicted pixel 2053 by using a smoothing filter and a cubic or Gaussian filter according to the intra prediction mode through six reference pixels of the first reference pixel line. In addition, the video signal processing device may generate the second predicted pixel 2504 by using a smoothing filter and a cubic or Gaussian filter according to the intra prediction mode through six reference pixels of the second reference pixel line. The video signal processing device may generate the third predicted pixel 2505 by performing weighted averaging with a predetermined weight on the generated first predicted pixel 2503 and the second predicted pixel 2504. In this case, the six reference pixels of the second reference pixel line may be reference pixels at a position shifted to the right by one pixel from each pixel of the first reference pixel line in consideration of the intra prediction mode of the current block, the position of the pixel to be generated, the position of the reference pixel line, etc. The video signal processing device may generate the predicted sample 2502 in the current block based on the third predicted pixel 2505. Alternatively, the video signal processing device may generate the third predicted pixel 2505 and the predicted sample 2502 in the current block based on the distance between the third predicted pixel 2505 and the predicted sample 2502 in the current block. The weight used by the video signal processing apparatus to generate the third predicted pixel 2505 may be an integer greater than or equal to 0. For example, the weight of the first predicted pixel 2503 may be 3, and the weight of the second predicted pixel 2504 may be 1. In this case, the position of the reference pixel line used to generate the predicted sample ( Fig.25 The positions of the six reference pixels of the first reference pixel line and the positions of the six reference pixels of the second reference pixel line) may be based on the intra prediction mode of the current block, the positions of the pixels to be generated (e.g., Fig.25 The position of the first predicted pixel 2503, the position of the second predicted pixel 2504, and the position of the third predicted pixel 2505), the position of the reference pixel line (for example, Fig.25 The pixel line may change depending on at least one of the positions of the first reference pixel line and the second reference pixel line, etc.

[0246] refer to Fig.26(a), the video signal processing device can generate the prediction sample 2601 in the current block by using the reference pixels at the same position in the same vertical direction of the two reference pixel lines. That is, the positions of the corresponding six pixels of the first reference pixel line (reference line 1) and the corresponding six pixels of the second reference pixel line (reference line 2) used to generate the prediction sample in the current block can be the same in the vertical direction. Regardless of the position of the reference pixel line, the position of the corresponding pixel can be determined. Reference Fig.26 (b), the video signal processing device may generate a first predicted pixel 2602 by using six pixels of the first reference line. The video signal processing device may obtain a second predicted sample 2603 by using six pixels 2607 of the second reference line. In this case, when using a sample of the second reference line that is the same as the first reference line in the vertical direction, the right pixel 2606 of the second reference line may not be used. Therefore, the video signal processing device may configure the right pixel 2606 of the second reference line by copying (filling) the pixel 2605, and then may generate the second predicted pixel 2603 using the right pixel 2606 of the second reference line. The video signal processing device may obtain a third predicted pixel 2604 by using the first predicted pixel 2602 and the second predicted pixel 2603. The video signal processing device may use the third predicted pixel 2604 to generate the predicted sample 2601 in the current block. Fig.26 and Fig.25 The difference between the first and second reference pixel lines is only in the pixels of the first and second reference pixel lines used to generate the prediction sample in the current block, but the method for generating the prediction sample in the current block can be the same as Fig.25 The same as in.

[0247] When configuring the MPM list, the video signal processing device may include in the MPM list a DIMD mode for deriving an intra-frame prediction directional mode from a reconstructed neighboring block adjacent to the current block. In this case, when there are two intra-frame prediction directional modes derived using the DIMD mode, the video signal processing device may include the two intra-frame prediction directional modes in the MPM list.

[0248] When the video signal processing device generates ( Fig.25 and 26 When a method) is used for a prediction sample of a current block, the DIMD mode included in the MPM list does not use neighboring pixels of the current block, and the video signal processing device can derive the intra-frame prediction directional mode by performing the DIMD method at a pixel position indicated by a reference pixel line. The derived intra-frame prediction directional mode may be included in the MPM list.

[0249] In addition, the video signal processing device can derive the intra-frame prediction directional mode by using the DIMD for each reference pixel line, and then add the derived intra-frame prediction directional mode to the MPM list. The reference pixel line can be a line separated from the upper left position of the current block by 1, 3, 5, 7 and 12 pixels. Alternatively, the reference pixel line can be a reference pixel line at a position adjacent to the top of the current block. In this case, the video signal processing device can add the intra-frame prediction directional mode derived using the DIMD for each reference pixel line to the MPM list. When the derived intra-frame prediction directional mode is copied, the copied intra-frame prediction directional mode can be excluded from the MPM list. The reference pixel lines in the present disclosure can be indexed. For example, the reference pixel line adjacent to the current block can be indexed and referred to as reference pixel line 0, and the reference pixel lines separated from the current block by one pixel, two pixels, ..., and n pixels can be indexed and referred to as reference pixel line 1, reference pixel line 2, ..., and reference pixel line n, respectively.

[0250] For example, when the reference pixel lines of the current block are 1 and 3, the video signal processing device may perform DIMD by using reference pixel lines 0, 1, and 2, and derive the intra-frame prediction directional mode. In addition, when the reference pixel lines of the current block are 5 and 7, the video signal processing device may perform DIMD by using reference pixel lines 5, 6, and 7, and derive the intra-frame prediction directional mode. In addition, when the reference pixel line of the current block is 12, the video signal processing device may perform DIMD by using reference pixel lines 11, 12, and 13, and derive the intra-frame prediction directional mode.

[0251] When encoding the current block in DIMD mode, the encoder can generate a bitstream by including information related to the reference pixel line to be used to derive the intra-frame prediction directional mode, and perform signaling. The encoder can generate an intra-frame prediction block by using the intra-frame prediction directional mode derived from DIMD and the reference pixel line performing DIMD. When decoding the current block using DIMD mode, the decoder can parse the information related to the reference pixel line, and then derive the intra-frame prediction directional mode by using the reference pixel line corresponding to the information related to the reference pixel line. The decoder can generate an intra-frame prediction block by using the intra-frame prediction directional mode and reference pixel line information derived from DIMD.

[0252] refer to Fig. 27 , the video signal processing apparatus may generate a new virtual reference pixel line by using a plurality of reference pixel lines, and generate a prediction sample in the current block based on the new virtual reference pixel line.

[0253] Fig. 27 Circles in the same horizontal row in may mean pixels located on the same reference pixel line. Fig. 27(a) illustrates that the position of the reference pixel used when generating the prediction sample by using at least one of the intra prediction mode of the current block, the position of the pixel to be generated, the position of the reference pixel line, etc. varies for each reference pixel line. The video signal processing device can generate samples 2701-a to 2701-d at the "1" position for each reference pixel line by using a smoothing filter, a cubic filter, or a Gaussian filter according to the intra prediction mode, and generate a new virtual reference pixel line 2702 by using several samples at the "1" position. In order to reduce complexity, the sample at the "1" position may not be generated, and the new virtual reference pixel line 2702 may be generated using reference pixels of integer units adjacent to the position closest to the "1" position. The video signal processing device can generate the prediction sample in the current block by using the new virtual reference pixel line. Reference Fig. 27 (b), the video signal processing device can use four reference pixels at the same position in the vertical direction to generate a new virtual reference pixel line 2705. That is, the pixels used to generate the new virtual reference pixel line 2705 can be pixels at the same position in the vertical direction as each of the six reference pixels of the first reference pixel line and each of the six reference pixels of the second reference pixel line. The video signal processing device can obtain the first predicted pixel 2703 by using at least one of the new virtual reference pixel line and position, the intra-frame prediction mode of the current block, the position of the pixel to be generated, etc. The video signal processing device can generate a predicted sample 2704 of the current block through the first predicted pixel 2703. The number of reference pixel lines used to generate the new virtual reference pixel line can be two or more. For example, two to five reference pixel lines can be used.

[0254] refer to Fig.28 , the video signal processing apparatus may generate a new virtual reference pixel line using four reference pixels close to the position of the new reference pixel 2801 to be generated. In this case, the new reference pixel position may be the same as the reference pixel line in the vertical direction. In addition, the position of the new reference pixel may be adjacent to the direction of the intra prediction mode of the current block.

[0255] Fig.29 A method of predicting a sample by using a plurality of reference pixel lines according to an embodiment of the present disclosure is illustrated.

[0256] refer to Fig.29, the video signal processing device may receive a plurality of reference pixel lines and generate a prediction block in the current block by performing intra prediction. According to the reference pixel line to be used, other prediction blocks may be generated, and the video signal processing device may generate a final prediction block by performing weighted averaging according to the weights input for each prediction block. In this case, the weight may be a preconfigured value. For example, the weight of a sample predicted as a main reference pixel line may be 3, and the weight of a sample predicted as a sub-reference pixel line may be 1. In this case, the weight may be determined based on at least one of the size of the current block, the width or height of the current block, the intra-frame prediction mode of the current block, the quantization parameter information, the distance (or difference) between the main reference pixel line and the sub-reference pixel line, etc. In addition, the reference pixel line may be determined based on at least one of the size of the current block, the width or height of the current block, the intra-frame prediction mode of the current block, the quantization parameter information, the MRL information, etc. 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 MRL, and the sub-reference pixel line may be a reference pixel line separated from the reference pixel line indicated by MRL by a predetermined position, the predetermined position may be an integer in the range of -N and +N, and N may be an integer greater than 0.

[0257] The intra prediction mode used in the above method for generating the prediction sample in the current block may be the same for each reference pixel line. Alternatively, the intra prediction mode used in the above method for generating the prediction sample in the current block may be different for each reference pixel line. That is, the intra prediction mode transmitted by the signal may be used in the main reference pixel line, and the prediction mode (corresponding to the index) obtained by increasing or decreasing the intra prediction mode (index) used in the main reference pixel line by a predetermined value may be used in the sub-reference pixel line. In this case, the predetermined value may be an integer equal to or greater than 1. In addition, the video signal processing device may determine whether to increase or decrease the predetermined value according to the value of the intra prediction mode used in the main reference pixel line. For example, when the angle of the intra prediction mode is a negative value, the video signal processing device may increase the index by a predetermined value, and when the angle of the intra prediction mode is a possible value, the index may be reduced by a predetermined value.

[0258] Fig.30 A method for determining a reference pixel line based on a template according to an embodiment of the present disclosure is illustrated.

[0259] Hereinafter, a method of determining an optimal reference pixel line (for reconstructing the current block) for a current block based on a template is described.

[0260] In the present disclosure, for the convenience of description, the method of determining the best reference pixel line for the current block (for reconstructing the current block) may be referred to as template-based multiple reference line intra prediction (TMRL).

[0261] refer to Fig.30 , the video signal processing device can configure the reference template by using the reference pixel line adjacent to the current block. The video signal processing device can generate a prediction sample for the position of the reference template by using reference pixel lines 1, 2, 3, ... (reference lines 1, 2, 3, ...). The video signal processing device can calculate the cost between the generated prediction sample and the sample of the reference template. In this case, the cost can be calculated by methods such as the sum of absolute differences (SAD) and mean removal SAD (MRSAD). The reference pixel corresponding to the minimum cost can be the best reference pixel. In addition, the encoder can rearrange the calculated costs in ascending order, configure a list for reference pixel lines, and then generate a bitstream including information about the index for the best reference pixel line, and perform signaling. The decoder can configure the list of reference pixel lines by the above method, parse the index for the best reference pixel line included in the bitstream, and can generate a prediction sample by using the reference pixel line indicated by the index.

[0262] When determining the best reference pixel line, the best reference pixel line is not used for all intra prediction modes, but the best reference pixel line can be used only for the intra prediction mode included in the MPM list to reduce complexity. That is, the encoder can configure the list of reference pixel lines with a combination of intra prediction modes and multiple reference pixel lines included in the MPM list, and calculate the cost between the reference template and the prediction sample generated using each candidate in the reference pixel line list. In addition, the encoder can rearrange the list in ascending order with reference to the cost, and can reconfigure the list by using only some low-cost combinations. The encoder can generate a bitstream including information about the index of the best combination information for reconfiguring the combination information in the list (any intra prediction mode and any reference pixel line), and perform signaling. The decoder can configure the same reference pixel line by the above method, and can then parse the index for the best combination information included in the bitstream, and generate prediction samples using the best combination information indicated by the index.

[0263] When a prediction sample is generated by using several reference pixel lines, a difference weight can be applied to the prediction sample generated by each reference pixel line. In this case, in order to derive the optimal weight, a template-based method can be used. That is, the encoder can configure the list of reference pixel lines with a combination of intra-frame prediction modes, multiple reference pixel lines, and weights (for example, one of 3:1 and 2:2) included in the MPM list, and the cost between the reference template and the prediction sample generated using each candidate in the reference pixel line list can be calculated. The video signal processing device can rearrange the MPM list in ascending order with reference to the cost, and then the MPM list can be reconfigured by using only some low-cost combinations. The encoder can generate a bitstream including an index of the best combination information among the combination information (any intra-frame prediction mode and any reference pixel line) in the reconfigured list and information on the weights (for example, one of 3:1 and 2:2) used as prediction samples for each reference pixel line, and perform signaling. The decoder can configure the same reference pixel line list through the above method, and can then parse the index for the best combination information included in the bitstream, and generate a prediction sample by using the best combination information indicated by the index.

[0264] Relative to passing Fig.30 The method for determining a reference pixel line based on a template described herein can use a reference pixel line adjacent to the current block to configure the template. Therefore, a reference pixel line not adjacent to the current block can be used to determine a reference pixel line determined based on the template. Hereinafter, a method for determining a reference pixel line based on a template using a reference pixel line adjacent to the current block is described.

[0265] Fig.31 A method of configuring a template for testing a reference pixel line adjacent to a current block according to an embodiment of the present disclosure is illustrated.

[0266] like Fig.31 As shown in FIG. 1 , when configuring a reference template, a reference pixel line adjacent to the current block may also be used to determine a reference pixel line based on the template. Fig.31 (a), a reference template including only reference pixels adjacent to the left side of the current block may be configured. The encoder may generate prediction samples for the reference template using at least one of reference pixel line 0 (reference line 0) above the current block and / or reference pixel line 1 (reference line 1) on the left side of the current block, and calculate the cost between the reference template and the prediction samples. The encoder may generate prediction samples for the reference template using reference pixel lines 1, 2, 3, ... (reference lines 1, 2, 3, ...), and calculate the cost between the reference template and the prediction samples. Fig.31(b) illustrates a case where the reference template includes only reference pixels adjacent to the top of the current block. Similarly, the encoder can generate prediction samples for the reference template by using at least one of reference pixel line 0 (reference line 0) on the left side of the current block and / or reference pixel line 1 (reference line 0) above the current block, and calculate the cost between the reference template and the prediction samples. The encoder can generate prediction samples for the reference template by using reference pixel lines 1, 2, 3, ... (reference lines 1, 2, 3, ...), and calculate the cost between the reference template and the prediction samples.

[0267] The encoder may configure a list of reference pixel lines by rearranging the calculated costs in ascending order, and may then generate a bitstream including information about the index of the best reference pixel line and perform signaling. The decoder may configure a list of reference pixel lines by the above method, and may then generate a prediction sample by using the best reference pixel determined by parsing the information about the index of the best reference pixel line included in the bitstream.

[0268] Fig.32 is a structural diagram illustrating a method of determining an optimal reference pixel line by using a plurality of reference pixel lines based on a template according to an embodiment of the present disclosure.

[0269] refer to Fig.32 , the encoder may receive multiple reference pixel lines and perform intra prediction to generate a prediction block for the template. According to the reference pixel lines used, other prediction blocks may be generated. The encoder may perform weighted averaging according to various weight information input to each prediction block, so that a prediction block for the template is finally generated. According to the reference pixel lines used and the weights used, multiple prediction blocks may be generated. The encoder may calculate the cost between each prediction block and the reference template, rearrange the list in ascending order based on the cost corresponding to the corresponding prediction block, and configure a separate list by using only a predetermined number of best candidates. In this case, the predetermined number may be an integer equal to or greater than 2, and may be 10. The encoder may generate a prediction block for the current block by combining information in a separate list that is used to generate a prediction block. The encoder may select the best candidate in terms of image quality and bit amount from the list, and may then generate a bitstream including information about the index for the best candidate, and perform signaling. The decoder may configure the same separate list by the above method, and may generate a prediction sample by using the best combination information indicated by the index of the best candidate determined by parsing the information about the index of the best candidate included in the bitstream.

[0270] When the current block is encoded in the intra prediction mode, the encoded intra prediction mode may be one of the angle mode, the plane mode, the DC mode and the MIP mode. The prediction according to the angle mode may be a prediction performed according to 65 angles, and the prediction according to the MIP mode may be a prediction performed based on a predefined matrix. The angle mode may be effective in blocks where there are characteristics such as edges in the current block. However, when the current block has a flat characteristic, discontinuous edges may be generated at the block boundary or visible contours may be generated within the block in the block predicted using the angle mode. This may be a factor that reduces coding efficiency. In addition, the DC mode may have the disadvantage of generating visible edges at the block boundary at a low bit rate. The plane mode can generate discontinuous prediction blocks by improving the edge problems that may be caused in the angle mode and the DC mode.

[0271] Fig.33 A method of generating a prediction sample by using a planar mode according to an embodiment of the present disclosure is illustrated.

[0272] refer to Fig.33 According to the planar mode, the video signal processing device can generate a linear prediction value in the vertical direction and a linear prediction value in the horizontal direction to generate a prediction sample in the current block. The video signal processing device can generate a prediction sample (value) of the current block by weighted averaging the linear prediction value in the vertical direction and the linear prediction value in the horizontal direction.

[0273] The linear prediction value (predV(x,y)) in the vertical direction may be generated based on Formula 4, and the linear prediction value (predH(x,y)) in the horizontal direction may be generated based on Formula 5. The new prediction value (pred(x,y)) may be generated based on Formula 6. W in Formulas 4 to 6 may indicate the width of the current block, and H may indicate the height of the current block. rec(x,y) may mean a pixel value in (x,y,) coordinates. The prediction values ​​(predV(x,y), predH(x,y), and pred(x,y)) may mean pixel values ​​predicted in (x,y,) coordinates.

[0274] [Formula 4]

[0275] predV(x, y)=((H-1-y)*rec(x,-1)+(y+1)*rec(-1, H))<<log2W

[0276] [Formula 5]

[0277] predH(x, y)=((W-1-x)*rec(-1, y)+(x+1)*rec(W,-1))<<log2H

[0278] [Formula 6]

[0279] pred(x, y) = (predV(x, y) + predH(x, y) + W*H) >> (log2W + log2H + 1) The video signal processing device may use only linear prediction in the vertical direction when performing prediction related to the current block according to the plane mode. Alternatively, the video signal processing device may use only linear prediction in the horizontal direction when performing prediction related to the current block according to the plane mode. Therefore, the plane mode can be divided into three modes. That is, in addition to the method of weighted averaging the prediction block generated using the existing linear prediction in the vertical and horizontal directions, it can also be divided into a vertical plane mode that uses only linear prediction in the vertical direction and a horizontal plane mode that uses only linear prediction in the horizontal direction. The encoder can generate a bitstream including information about the prediction mode used for the current block among the three plane modes, and perform signaling. The decoder can generate a prediction block for the current block based on the plane mode determined by parsing the information about the prediction mode used included in the bitstream.

[0280] An explicit method of performing signaling by including information about the plane mode used in the bitstream may have the problem of increasing the amount of bits. In order to save the amount of bits, the decoder may implicitly derive the plane used by using at least one of the size of the current block, the width or height of the current block, the ratio between the width and height of the current block, the number of pixels of the current block, information about whether the current block corresponds to a luminance signal or a chrominance signal, information about the intra-frame prediction directional mode of a neighboring block adjacent to the current block, information about the MPM list for the current block, and information about the intra-frame prediction directional mode derived from DIMD or TIMD.

[0281] When the shape of the current block is a rectangle rather than a square, the vertical plane mode and the horizontal plane mode may be more effective. Therefore, the vertical plane mode and the horizontal plane mode can be applied (activated) only when the width and height of the current block are different from each other. In other words, after comparing the width and height of the current block, the encoder can generate a bitstream including plane mode selection information, which indicates whether to apply the vertical plane mode, whether to apply the horizontal plane mode, or only apply the existing plane mode when the width and height of the current block are different from each other, and signaling can be performed. After comparing the width and height of the current block, the decoder can parse the plane mode selection information only when the width and height of the current block are different. When the width and height of the current block are the same as each other, the conventional plane mode can be applied.

[0282] In the present disclosure, for convenience of description, information on a prediction mode used for a current block among three planar modes may be described as planar mode selection information.

[0283] Plane mode selection information may be signaled for each coding unit. However, when plane mode selection information is signaled to correspond to all coding units, the amount of bits may increase, and therefore the encoder may generate a bitstream including plane mode selection information, and perform signaling only when specific conditions are met. When specific conditions are met, the decoder may determine the intra-frame prediction directional mode for the current block by parsing the plane mode selection information, and may generate a prediction block for the current block by using the determined intra-frame prediction directional mode. In such a case, the specific conditions may be conditions related to: the width and height of the current block, the ratio of the width and height of the current block, information about whether the coding mode of the current block is DIMD, TIMD, IntraTMP, IBC, ISP, or MIP coding mode when the intra-frame prediction directional mode of the current block is a specific mode (e.g., plane mode, DC mode, vertical mode, horizontal mode), and the index information of the reference pixel line used when generating the prediction block for the current block. Whether encoding and decoding are performed on the plane selection information may be determined based on whether at least one of the specific conditions is met. Specifically, the specific conditions may include: 1) the case where the intra-frame prediction directional mode of the current block is a plane mode (i.e., the case where the index of the intra-frame prediction directional mode is 0); 2) the case where the width and height of the current block are equal to or less than the maximum transform block size and the product of the width and height of the current block is greater than the product of the minimum transform block size and the minimum transform block size; and 3) the case where the width and height of the current block are different from each other. In such a case, the minimum transmission block size may be an integer and may be 4, 8, etc., and the maximum transform block size may be an integer and may be 64, 128, 256, etc. When at least one of the above specific conditions 1) to 3) is met, the encoder may generate a bitstream including plane mode selection information and perform signaling, and the decoder may determine the intra-frame prediction directional mode for the current block by parsing the plane mode selection information.

[0284] When the current block is a chrominance component block, the vertical plane mode and the horizontal plane mode are not applied, and the existing plane mode can be applied. That is, when the current block is a chrominance component block, the video signal processing device can generate a prediction block by using the existing plane mode. Therefore, when the current block is a chrominance component block, the video signal processing device can neither send a signal nor parse the plane mode selection information. Even if the current block is a chrominance component block, the vertical plane mode or the horizontal plane mode can be applied as in the case of the luminance component block. For example, when the vertical plane mode is applied to the current block, the decoder can generate a prediction block for the luminance component block and the chrominance component block of the current block by using the vertical plane mode for the luminance component block and the chrominance component block of the current block.

[0285] When the width of the current block is greater than the height, the number of pixels adjacent to the left side of the current block is greater than the number of pixels adjacent to the top of the current block, and the decoder can generate a prediction block for the current block by using a vertical plane mode. When the height of the current block is greater than the width, the number of pixels adjacent to the top of the current block is greater than the number of pixels adjacent to the left side of the current block, and the decoder can generate a prediction block for the current block by using a horizontal plane mode. When the width and height of the current block are the same, the decoder can generate a prediction block for the current block by using an existing plane mode. The plane mode is implicitly determined based on the width and height of the current block, and therefore the encoder does not need to generate a bitstream including plane mode selection information. The decoder can generate a prediction block for the current block based on a plane mode determined based on the width and height of the current block.

[0286] The vertical plane mode and the horizontal plane mode may not be applied in the ISP mode. When the current block is encoded in the ISP mode and the current block is encoded in the plane mode, the encoder may not signal the plane mode selection information (i.e., the plane mode selection information may not be included in the bitstream). When the current block is encoded in the ISP mode and the current block is encoded in the plane mode, the decoder may not parse the plane mode selection information. On the other hand, the vertical plane mode and the horizontal plane mode may be applied in the ISP mode. When the current block is encoded in the ISP mode and the current block is encoded in the plane mode, the encoder may generate a bitstream including the plane mode selection information and perform signaling. When the current block is encoded in the ISP mode and the current block is encoded in the plane mode, the decoder may generate a prediction block for the current block by using the plane mode determined by parsing the plane mode selection information.

[0287] The video signal processing device can use the horizontal plane mode to replace the horizontal mode ( Figure 6 In addition, the video signal processing device can use the vertical plane mode to replace the vertical mode ( Figure 6 In other words, the video signal processing apparatus may use the horizontal plane mode and the vertical plane mode to replace the horizontal mode ( Figure 6 Angle mode 18) and vertical mode ( Figure 6 In this case, the video signal processing apparatus can replace the horizontal mode ( ) among the conventional intra prediction directional modes with the horizontal plane mode and the vertical plane mode only when the width and height of the current block are different from each other. Figure 6 Angle mode 18) and vertical mode ( Figure 6 Angle mode 50) and use them.

[0288] The vertical plane mode and the horizontal plane mode may be more effective for smaller blocks. Therefore, the video signal processing device may apply the vertical plane mode and the horizontal plane mode only when the current block is smaller than a predetermined size. In this case, the predetermined size corresponding to the width or height may be 16 or 32. That is, when the width or height of the current block is equal to or less than 32, the video signal processing device may apply the vertical plane mode and the horizontal plane mode to the current block. Alternatively, when any one of the width and height of the current block is greater than 32, the video signal processing device may not apply the vertical plane mode and the horizontal plane mode to the current block. For example, when any one of the width and height of the current block is greater than 32, the encoder may not include the plane mode selection information in the bitstream. When the encoding mode of the current block is the plane mode and any one of the width and height of the current block is greater than 32, the decoder may not parse the plane mode selection information, and may perform prediction of the current block by using the conventional plane mode.

[0289] DIMD and TIMD modes are modes for generating prediction blocks by weighted averaging of blocks predicted from various intra-frame prediction modes. In this case, blocks predicted using plane mode can be used for DIMD and TIMD modes. When a video signal processing device generates blocks predicted using the plane mode used in DIMD and TIMD modes, any one of vertical plane mode, horizontal plane mode and conventional plane mode can be used. Plane mode selection information can be included in the bitstream and sent with a signal. The decoder can parse the plane mode selection information and determine the mode to be used among the three plane modes. For example, when the plane mode selection information indicates the vertical plane mode, the prediction block used for DIMD and TIMD modes can be a block predicted using the vertical plane mode.

[0290] The MIP mode can be a mode that is effective for complex areas. In order to improve the encoding performance of the MIP mode, a MIP mode based on multiple predictions can be used. That is, the MIP mode based on multiple predictions is a method for generating a final prediction block for the current block by weighted averaging a prediction block generated using the MIP mode and a prediction block generated based on an intra-frame prediction directional mode. The encoder can generate a bit stream including both encoding information for the MIP mode and encoding information for the intra-frame prediction directional mode, and perform signaling. The decoder can parse the encoding information for the MIP mode and the encoding information for the intra-frame prediction directional mode, generate a prediction block to which the MIP mode is applied and a prediction block to which the intra-frame prediction directional mode is applied, and then generate a final prediction block for the current block by weighted averaging the two prediction blocks.

[0291] The MIP mode may be adaptively performed in units of blocks. The encoder may generate a bitstream including information on whether to use the MIP mode based on multiple predictions and perform signaling. When a prediction block for a current block is generated by parsing the information on whether to use the MIP mode based on multiple predictions, the decoder may determine whether to use the MIP mode based on multiple predictions or to use the MIP mode based on single predictions. The MIP mode based on single predictions is a method for generating a prediction block by using only the MIP mode.

[0292] In order to reduce the complexity and the encoding information sent with the signal, when the intra-frame prediction mode of the current block is the MIP mode, the encoder may additionally include information about whether to use the MIP mode based on multiple predictions in the bitstream and perform signaling. When the MIP mode based on multiple predictions is used, the encoder may additionally include information about the intra-frame prediction directional mode in the bitstream and perform signaling. When the intra-frame prediction mode of the current block is the MIP mode, the decoder may additionally parse information about whether to use the MIP mode based on multiple predictions, and may additionally parse information about the intra-frame prediction directional mode when the MIP mode based on multiple predictions is used.

[0293] When the intra-frame prediction directional mode is additionally signaled, the bit amount increases, and thus the compression efficiency can be reduced. When the MIP mode based on multiple predictions is used for the current block, only the predetermined intra-frame prediction directional mode can be used. In this case, the predetermined intra-frame prediction directional mode can be one of the MPM lists, and the encoder can include index information of the intra-frame prediction directional mode to be used in the MIP mode based on multiple predictions in the bitstream, and perform signaling. When the MIP mode based on multiple predictions is used for the current block, the decoder can parse the index information to determine the intra-frame prediction directional mode to be used in the MIP mode based on multiple predictions in the MPM list.

[0294] When the MIP mode based on multiple prediction is used for the current block, the vertical plane mode, the horizontal plane mode and the normal plane mode can be used to generate a prediction block based on the intra-frame prediction directional mode. That is, the encoder can generate a bit stream including the plane mode selection information and perform signaling. When the MIP mode based on multiple prediction is used, the decoder can parse the plane mode selection information to determine the intra-frame prediction directional mode to be used in the MIP mode based on multiple prediction.

[0295] When a MIP mode based on multiple predictions is used for a current block, the video signal processing device may determine a plane mode to be used among the three plane modes by using an intra-frame prediction directional mode of DIMD derived from neighboring pixels of the current block. For example, when a MIP mode based on multiple predictions is used for a current block, when the DIMD (or TIMD) mode of the current block is less than 34, the video signal processing device may apply a horizontal plane mode to the current block to facilitate generating a prediction block based on an intra-frame prediction directional mode. Alternatively, when the DIMD (or TIMD) mode of the current block is equal to or greater than 34, a vertical plane mode may be applied to the current block to generate a prediction block based on an intra-frame prediction directional mode.

[0296] When the plane mode is used for the current block, the video signal processing device may use the vertical plane mode and the horizontal plane mode to generate a prediction block for each mode, and generate a final prediction block by applying a weight to each prediction block. In this case, the weights of the corresponding prediction blocks may be the same or different from each other according to the intra-frame prediction directional mode of the DIMD derived from the neighboring pixels of the current block. When the intra-frame prediction directional mode of the DIMD derived from the neighboring pixels of the current block is equal to or greater than a predetermined value, the maximum weight may be applied to the block predicted using the vertical plane mode. For example, the weight for the block predicted using the vertical plane mode may be 3, and the weight for the block predicted using the horizontal plane mode may be 1. When the intra-frame prediction directional mode of the DIMD derived from the neighboring pixels of the current block is less than a predetermined value, the maximum weight may be applied to the block predicted using the horizontal plane mode. For example, the weight for the block predicted using the horizontal plane mode may be 3, and the weight for the block predicted using the vertical plane mode may be 1. The predetermined value is an integer, and may be 34( Figure 6 The DIMD information derived from the neighboring pixels of the current block may include a first intra-frame prediction directional mode, a second intra-frame prediction directional mode, and information on whether to perform weighted prediction. When weighted prediction is not performed in the DIMD information of the neighboring pixels of the current block, the video signal processing device may generate a prediction block by applying the same weight.

[0297] When the CIIP mode is used to generate the prediction block of the current block, the prediction block of the current block can be generated by weighted averaging the prediction block using the intra prediction mode (intra prediction block) and the prediction block using the inter prediction mode (inter prediction block). In this case, when the intra prediction directional mode used to generate the intra prediction block is the plane mode in the CIIP mode, the encoder can generate a bit stream including the plane mode selection information and perform signaling. When the CIIP mode is used and the plane mode is used, the decoder can parse the plane mode selection information to determine the intra prediction mode used to generate the intra prediction block.

[0298] When the current block is predicted using the intra prediction mode, the continuity of the pixel values ​​at the boundary between the current block and the neighboring blocks may be interrupted. In order to solve the discontinuity problem, position-dependent intra prediction combination (PDPC) filtering may be applied to the generated prediction block. When the vertical plane mode is used and the prediction block of the current block is generated, the PDPC filtering based on the plane mode may not be performed, and the PDPC filtering based on the horizontal angle mode (e.g., Figure 6 Alternatively, when the vertical plane mode is used and a prediction block of the current block is generated, PDPC filtering based on the plane mode may not be performed, and PDPC filtering based on the vertical angle mode (for example, angle mode 50 of FIG. 60 ) may be performed. In addition, when the horizontal plane mode is used and a prediction block of the current block is generated, PDPC filtering based on the plane mode may not be performed and PDPC filtering based on the vertical angle mode (for example, angle mode 50 of FIG. 60 ) may be performed. Figure 6 In addition, when the horizontal plane mode is used and a prediction block of the current block is generated, the PDPC filtering based on the plane mode may not be performed and the PDPC filtering based on the horizontal angle mode (e.g., Figure 6 The meaning of predicting a current block in the present disclosure may be the same as the meaning of generating a prediction block for a current block.

[0299] refer to Fig.33 And Formula 4, when the prediction block of the current block is generated by using the vertical plane mode, the prediction block for the current block can be generated based on the pixel value at the fixed position rec(-1, H) and the pixel value at rec(x, -1) that changes dynamically according to the x-axis coordinate. Similarly, refer to Fig.32 According to Formula 5, when the prediction block of the current block is generated by using the horizontal plane mode, the prediction block for the current block can be generated based on the pixel value at the fixed position rec(W, -1) and the pixel value at rec(-1, y) that changes dynamically according to the y-axis coordinate. That is, the prediction block can be generated so that the continuity of the pixel value at the boundary between adjacent blocks is achieved, and therefore when the prediction block of the current block is generated using the vertical plane mode or the horizontal plane mode, PDPC may not be performed.

[0300] When encoding the current block in CIIP mode, the PDPC filtering described above for planar mode may also be applied.

[0301] When a vertical plane mode or a horizontal plane mode is used to predict a neighboring block adjacent to the current block in a case where the video signal processing device configures an MPM list for the current block, the video signal processing device may configure the intra-frame prediction directional mode of the neighboring block as a plane mode and include it in the MPM list. Alternatively, when a vertical plane mode or a horizontal plane mode is used to predict a neighboring block adjacent to the current block in a case where the video signal processing device configures an MPM list for the current block, the video signal processing device may configure the intra-frame prediction directional mode of the neighboring block as a DC mode and include it in the MPM list. Alternatively, when a horizontal plane mode is used to predict a neighboring block adjacent to the current block in a case where the video signal processing device configures an MPM list for the current block, the video signal processing device may configure the intra-frame prediction directional mode of the neighboring block as a horizontal angle mode ( Figure 6 Alternatively, when the video signal processing device configures the MPM list for the current block, the video signal processing device may configure the intra-frame prediction directional mode of the neighboring block to be the vertical angle mode ( Figure 6 On the other hand, the horizontal plane mode may have a vertical characteristic, and therefore, when predicting a neighboring block adjacent to the current block using the horizontal plane mode when the video signal processing device configures the MPM list for the current block, the video signal processing device may configure the intra-frame prediction directional mode of the neighboring block to the vertical angle mode ( Figure 6 Alternatively, when the video signal processing device configures the MPM list for the current block, the video signal processing device may configure the intra-frame prediction directional mode of the neighboring block to be the horizontal angle mode ( Figure 6 angle mode 18) and include it in the MPM list.

[0302] The vertical plane mode and the horizontal plane mode proposed in the present disclosure may not be signaled as a predetermined specific mode, and may be included in any one of the intra prediction directional modes and signaled. Figure 6, the total number of intra-frame prediction directional modes is 67, among which mode 0 (plane mode) and mode 1 (DC mode) are non-directional modes, and nodes 2 to 66 are directional modes (angle modes). The intra-frame prediction directional mode can be extended by including a newly defined vertical plane mode and a horizontal plane mode. For example, in the traditional intra-frame prediction directional mode, mode 2 can be configured as a vertical plane mode, and mode 3 can be configured as a horizontal plane mode. That is, mode 0 (plane mode), mode 1 (DC mode), mode 2 (vertical plane mode) and mode 3 (horizontal plane mode) are non-directional modes, and modes 4 to 68 can be configured as directional modes like traditional modes 2 to 66.

[0303] Fig.34 A method of deriving a multiple transform set and a LFNST set for a vertical plane mode or a horizontal plane mode according to an embodiment of the present disclosure is illustrated.

[0304] Fig.35 A mapping table according to an embodiment of the present disclosure is illustrated.

[0305] Fig.36 A transformation type set table according to an embodiment of the present disclosure is illustrated.

[0306] Fig.37 A transformation type combination table according to an embodiment of the present disclosure is illustrated.

[0307] Fig.38 A threshold table for an IDT transformation type according to an embodiment of the present disclosure is illustrated.

[0308] When the vertical plane mode is used and a prediction block of the current block is generated, the characteristics of the error (residual) signal (block) may be similar to that of the vertical angle mode ( Figure 6 The characteristics of the error signal of the angle mode 50) are determined by the encoder. The multiple transform set (MTS) applied to the error signal may vary based on the intra prediction directional mode of the current block. That is, when the vertical plane mode is used and the prediction block of the current block is generated, the encoder can use the vertical angle mode ( Figure 6The encoder may perform an MTS-based main transform process by using a set of transform matrices for the vertical angle mode (angle mode 50 of Figure 60) instead of a set of transform matrices for the planar mode. Alternatively, the encoder may perform the main transform using a predetermined transform set regardless of the MTS. In addition, the encoder may use the MPS or a predetermined transform set to perform an auxiliary transform on the main transform coefficients through LFNST. The transform matrix used to perform LFNST may vary according to the intra-prediction directional mode. That is, when the vertical plane mode is used and a prediction block for the current block is generated, for the error signal, the encoder may perform the transform process by using a set of auxiliary LFNST transform matrices for the vertical angle mode (angle mode 50 of Figure 60) instead of a set of auxiliary LFSNT transform matrices for the planar mode. When the horizontal plane mode is used and a prediction block for the current block is generated, the encoder may perform the transform process by using a set of auxiliary LFNST transform matrices for the horizontal angle mode ( Figure 6 When the vertical plane mode is used and the prediction block of the current block is generated, the decoder can generate the error signal by using the vertical angle mode ( Figure 6 The transform process is performed by using a set of main LFNST transform matrices of the angular mode 50) instead of a set of main LFNST transform matrices of the plane mode. In addition, the vertical plane mode is used and a prediction block of the current block is generated. For the error signal, the decoder can use the vertical angle mode ( Figure 6 The MTS-based auxiliary transformation process is performed by using a set of transformation matrices for the angle mode 50) instead of a set of transformation matrices for the plane mode. In the present disclosure, the encoder may perform an auxiliary transformation after performing a main transformation in the encoding process, which respectively correspond to the main transformation and the auxiliary transformation in the decoding process of the decoder. That is, the main transformation performed by the encoder corresponds to the auxiliary transformation performed by the decoder (the inverse transformation of the main transformation performed by the encoder), and the auxiliary transformation corresponds to the main transformation performed by the decoder (the inverse transformation of the auxiliary transformation performed by the encoder).

[0309] refer to Fig.33 And formula 4, when the vertical plane mode is used and the prediction block of the current block is generated, the prediction block can be generated based on the pixel value at the fixed position rec(-1, H) and the pixel value at rec(x, -1) that changes dynamically according to the x-axis coordinate. That is, when the vertical plane mode is used, the change in pixel value occurs on the x-axis, and therefore the characteristics of the error signal can be similar to the characteristics of the error signal of the horizontal angle mode (angle mode 50 of Figure 60). The MTS applied to the error signal can vary based on the intra-frame prediction directional mode of the current block. That is, when the vertical plane mode is used and the prediction block of the current block is generated, for the error signal, the encoder can use the horizontal angle mode ( Figure 6The MTS-based main transform process is performed by using a set of transform matrices for the angular mode 18) instead of a set of transform matrices for the planar mode. Alternatively, the encoder can perform the main transform by using a predetermined transform set regardless of the MTS. In addition, the encoder can perform a secondary main transform on the transform coefficients of the main transform through LFNST using MTS or a predetermined transform set. The transform matrix used to perform LFNST can vary depending on the intra-frame prediction directional mode. That is, when the vertical plane mode is used and a prediction block for the current block is generated, the encoder can generate a secondary main transform for the error signal by using the horizontal angle mode ( Figure 6 The transform process is performed by using a set of auxiliary LFNST transform matrices for the angular mode 18) instead of a set of auxiliary LFNST transform matrices for the planar mode. When the horizontal planar mode is used and a prediction block for the current block is generated, the encoder can generate the prediction block by using a vertical angular mode (e.g., Figure 6 50) instead of the planar mode to derive the primary or secondary transform matrix (or set of matrices, matrix set or kernel set). When the vertical planar mode is used and the prediction block of the current block is generated, the decoder can use the horizontal angular mode ( Figure 6 The transform process is performed by using a set of main LFNST transform matrices of the angular mode 18) instead of a set of main LFNST transform matrices of the planar mode. In addition, when the vertical planar mode is used and a prediction block of the current block is generated, the decoder can use the horizontal angular mode ( Figure 6 When using the horizontal plane mode and generating a prediction block for the current block, the encoder can use the vertical angle mode ( Figure 6 50) instead of the planar mode to derive the primary or secondary transform matrix (or set of matrices, matrix set or kernel set). When the horizontal planar mode is used and the prediction block of the current block is generated, the decoder can generate the error signal by using the vertical angular mode ( Figure 6 The transform process is performed by using a set of main LFNST transform matrices of the angular mode 50) instead of a set of main LFNST transform matrices of the planar mode. In addition, when the horizontal planar mode is used and a prediction block of the current block is generated, the decoder can use the vertical angular mode ( Figure 6 A set of transformation matrices for the angle mode 50) is used instead of a set of transformation matrices for the planar mode to perform the MTS-based auxiliary transformation process.

[0310] A method of selecting an MTS that can be used for a current block by a video signal processing apparatus when a vertical plane mode, a horizontal plane mode, and a normal plane mode are used and a prediction block of the current block is generated is described.

[0311] 1) First, in order to map the width and height of the current block into a single variable, the video signal processing device may derive nSzIdxW and nSzIdxH values ​​based on the size of the current block. nSzIdxW may be a minimum value between 3 and a value obtained by calculating a base 2 logarithmic value of the width of the current block, truncating the decimal place, and subtracting 2 therefrom. nSzIdxH may be a minimum value between 2 and a value obtained by calculating a base 2 logarithmic value of the height of the current block, truncating the decimal place, and subtracting 2 therefrom.

[0312] 2) Next, the video signal processing apparatus may derive the intra-frame directional mode (predMode) of the current block. In the case of the TIMD mode, 131 intra-frame prediction modes extended from the existing 67 intra-frame prediction modes may be used, reducing the accuracy to the existing 67 modes.

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

[0314] A. When the current block is encoded in MIP mode, ucMode may be configured to '0', nMdIdx may be configured to '35', and isTrTransposed may be configured to a value derived from MIP.

[0315] B. When the current block is not encoded in MIP mode, ucMode may be configured as an intra-frame directional mode (predMode) of the current block. predMode may refer to an index value of the intra-frame directional mode. predMode may be determined by an extended angle mode according to a ratio between a width and a height of the current block. The video signal processing device may crop predMode to a value in a range between 2 and 66. When using a vertical plane mode and generating a prediction block for the current block, the video signal processing device may reconfigure predMode to a horizontal prediction mode ( Figure 6 When the horizontal plane mode is used and a prediction block of the current block is generated, the video signal processing device may reconfigure predMode to a vertical prediction mode ( Figure 6angle mode 50). When predMode is greater than angle mode 34 corresponding to the diagonal mode, the isTrTransposed value can be configured to 1, and when predMode is equal to or less than 34, the isTrTransposed value can be configured to 0. When predMode is greater than 34, the video signal processing device can reconfigure the value of predMode to a value obtained by adding 1 to 67 (the maximum value of the intra-frame directional mode index) and subtracting the value of predMode therefrom. For example, when predMode is 35, the video signal processing device can reconfigure angle mode 35 to angle mode 33 (67+1-35(predMode)). When predMode is 66, the video signal processing device can reconfigure angle mode 66 to angle mode 2 (67+1-66(predMode). That is, by ensuring symmetry with respect to angle mode 34 corresponding to the diagonal mode, it is possible to effectively Fig.35 The size of the transform map in is reduced by about half.

[0316] 4) The video signal processing device may derive the nSzIdx value through nSzIdxW, nSzIdxH, and isTrTransposed values. When the isTrTransposed value is "1", the value obtained by multiplying nSzIdxH by 4 and adding nSzIdxW thereto may be configured as nSzIdx. When the isTrTransposed value is "0", the value obtained by multiplying nSzIdxW by 4 and adding nSzIdxH thereto may be configured as nSzIdx.

[0317] 5) The video signal processing device can be based on Fig.35 The nTrSet corresponding to the index of the available transform type set is derived by using the nSzIdx corresponding to the size information of the current block and the nMdIdx corresponding to the intra-frame directional mode information of the current block. Fig.35 The index of the transform type set is defined according to the intra orientation mode of the current block (0 to 34 and MIP) and the size index of the current block (0 to 15). Fig.35 , nTrSet may be 80, and when the size of the current block is 4x8 and the intra directional mode of the current block is 13, nTrSet may be "7".

[0318] 6) The video signal processing device can parse the mts_idx included in the bitstream to obtain Fig.36 The transform type set corresponding to nTrSet is derived from the table of . Depending on whether predMode has a value greater than angle mode 34 corresponding to the diagonal mode, the vertical and horizontal transform types are configured differently. Fig.36 , the numbers 0 to 79 on the gray shaded vertical columns may correspond to nTrSet, and the numbers 0 to 3 on the gray shaded horizontal rows may correspond to mts_idx. Fig.36 , when nTrSet is 7 and the value of mts_idx is 3, 22 can be selected from (2, 17, 18, 22). In addition, Fig.37 The vertical transform type of the current block may be configured as DST1 and the horizontal transform type may be configured as DCT5, corresponding to index 22 of the transform type combination table. Fig.37 The numbers 0 to 24 on the gray-shaded horizontal rows can refer to Fig.36 The selected index, and the numbers 0 and 1 on the gray shaded vertical columns may mean the vertical transform type and the horizontal transform type, respectively. When the intra prediction directional mode of the current block is greater than 34 corresponding to the diagonal mode, the vertical and horizontal transform types are interchanged.

[0319] When the value of mts_idx is '3' and both the width and height of the current block are equal to or less than 16, the vertical or horizontal transform type may be reconfigured to the IDT transform type through the following process.

[0320] When the absolute difference between the index of the intra-frame prediction directional mode of the current block and 18 corresponding to the index of the horizontal mode is less than a predetermined value, the vertical transform type can be reconfigured to the IDT transform type. When the absolute difference between the index of the intra-frame prediction directional mode of the current block and 50 corresponding to the index of the horizontal mode is less than a predetermined value, the horizontal transform type can be reconfigured to the IDT transform type. In this case, the predetermined value is an integer and can be determined based on the width or height of the current block. For example, it can be determined by Fig.38 The table below is used to determine the predetermined value. Fig.38 The table in (a) of FIG. 1 illustrates a case where the threshold is configured differently whenever the width or height differs by 4, and Fig.38 The table in (b) of illustrates a case where the threshold is configured differently whenever the width or height differs by a multiple of 2. When the size of the current block is 16x16, the vertical transform type is not reconfigured to the IDT transform type, and the existing transform type may remain unchanged.

[0321] Fig.39 A method of deriving a main transformation matrix or a secondary transformation matrix by a video signal processing apparatus according to an embodiment of the present disclosure is illustrated.

[0322] Specifically, Fig.39is a flowchart illustrating a method of deriving a primary transform matrix or a secondary transform matrix (a set of matrices, a matrix set, or a kernel set) by a video signal processing apparatus when a current block is predicted using a vertical plane mode, a horizontal plane mode, and a normal plane mode.

[0323] refer to Fig.39 , the video signal processing device may receive the intra-frame prediction directional mode (intra-frame prediction mode) and identify whether the prediction mode of the current block is a planar mode. When the prediction mode is not a planar mode, the video signal processing device may derive a primary transformation matrix or an auxiliary transformation matrix (a set of matrices, a matrix set, or a core set) based on the input intra-frame prediction directional mode. When the prediction mode is a planar mode, the video signal processing device may identify whether the prediction mode is a vertical plane mode. When the prediction mode is a vertical plane mode, the video signal processing device may derive a primary transformation matrix or an auxiliary transformation matrix (a set of matrices, a matrix set, or a core set) based on the input intra-frame prediction directional mode. Figure 6 When the prediction mode is not the vertical plane mode, the video signal processing device may identify whether the prediction mode is the horizontal plane mode. When the prediction mode is the horizontal plane mode, the video signal processing device may determine whether the prediction mode is the horizontal plane mode based on the vertical angle mode ( Figure 6 The video signal processing device may derive the main transformation matrix or the auxiliary transformation matrix (a set of matrices, a matrix set, or a core set) based on the normal plane mode when the prediction mode is not the horizontal plane mode.

[0324] When one of the vertical plane mode, the horizontal plane mode, and the regular plane mode is used and the prediction block of the current block is generated, the video signal processing device can derive the main or auxiliary transformation matrix (a set of matrices, a matrix set, or a core set) by using the DIMD method. In other words, when one of the vertical plane mode, the horizontal plane mode, and the regular plane mode is used to generate the prediction block of the current block, the video signal processing device can perform the main transformation process based on MTS by using the set of transformation matrices. In addition, when one of the vertical plane mode, the horizontal plane mode, and the regular plane mode is used to generate the prediction block of the current block, the video signal processing device can perform the auxiliary transformation process based on LFNST by using the set of transformation matrices of the intra-frame prediction directional mode derived using the DIMD method. The DIMD information derived from the neighboring pixels of the current block may include the first intra-frame prediction directional mode, the second intra-frame prediction directional mode, and information about whether to perform weighted prediction. When weighted prediction is not applied in the DIMD information from the neighboring pixels of the current block, the encoder and the decoder can derive the main or auxiliary transformation matrix (or a set of matrices, a matrix set, or a core set) by using the existing plane prediction mode.

[0325] Planar mode may be effective for smooth areas, and therefore in order to reduce complexity, the encoder may implicitly apply the DCT2 transform method without performing the MTS-based main transform process. When the planar mode is used to predict the current block, the decoder may apply the DCT2 transform method. When the conventional planar mode is used to predict the current block, the video signal processing device may implicitly apply the DCT2 transform method without performing the MTS-based main transform process. When the vertical plane mode or the horizontal plane mode is used to predict the current block, the video signal processing device may apply the MTS-based main transform process. When the vertical plane mode or the horizontal plane mode is used to predict the current block, the video signal processing device may implicitly apply the DCT2 transform method without applying the MTS-based main transform process. When the conventional planar mode is used to predict the current block, the video signal processing device may apply the MTS-based main transform process. In addition, in the above method, when the size of the current block is a predetermined size, the DST7 transform method may be applied instead of the DCT2 transform method. In this case, the predetermined size may be a case where the width or height of the current block is equal to or greater than 4 or equal to or less than 16. For example, when the current block is predicted based on the vertical plane mode or the horizontal plane mode, the width of the current block is 32 and the height is 16, the video signal processing apparatus may apply DCT2 to horizontal transform and may apply DCT7 to vertical transform.

[0326] Similar to the plane mode, the DC mode can be divided into three prediction modes. Specifically, the DC mode can be divided into a mode according to the average of the top pixels of the current block, a mode according to the average of the left pixels of the current block, and a mode according to the average of the top pixels and the left pixels of the current block. When the width of the current block is greater than the height, the video signal processing device can generate a prediction block of the current block by using the average value between the top pixels of the current block. When the height of the current block is greater than the width, the video signal processing device can generate a prediction block of the current block by using the average value between the left pixels of the current block. When the width and height of the current block are the same, the video signal processing device can generate a prediction block of the current block by using the average value between the top pixels and the left pixels. The encoder can generate a bitstream including information about the mode used in predicting the current block among the three DC modes (DC mode selection information), and perform signaling. The decoder can generate a prediction block for the current block based on the mode determined by parsing the DC mode selection information. When the prediction mode of the current block is the DC mode, the encoder can generate a bitstream including information about the mode used for encoding, and perform signaling. When the prediction mode of the current block is the DC mode, the decoder can determine the final DC mode for the current block by parsing the DC mode selection information. For example, when the current block is predicted using the DC mode that uses the average of the left pixels, the encoder can signal information indicating that the current block is in the DC mode, and can use an additional flag bit to signal information indicating that the current block is predicted by the DC mode using the average of the left pixels. When the current block is in the DC mode, the decoder can determine the mode applied to the current block by parsing the additional flag bit.

[0327] These three DC prediction modes may not be used in ISP mode. When the current block is encoded in ISP mode and the current block is encoded in DC mode, the encoder may not signal whether the current block corresponds to a DC mode using an average of left pixels and a DC mode using an average of top pixels. When the current block is in ISP mode and the current block is in DC mode, the decoder may not parse the flag indicating whether the current block corresponds to a DC mode using an average of left pixels or a DC mode using an average of top pixels.

[0328] Meanwhile, three DC prediction modes can be used in ISP mode. When the current block is encoded in ISP mode and the current block is encoded in DC mode, the encoder can signal a flag indicating the prediction mode of the current block among the three DC prediction modes and include it in the bitstream. When the current block is in ISP mode and the current block is in DC mode, the decoder can parse the flag to configure the final DC mode for the current block.

[0329] It can be determined whether to apply three DC prediction modes based on the color components of the current block. When the current block is a luminance component block, three DC prediction modes can be used. Alternatively, when the current block is a chrominance block, only the DC prediction mode using the average of the top and left pixels among the three DC prediction modes can be used. Therefore, when the current block is a chrominance component block and the DC mode is applied, the encoder may not include a flag indicating the DC mode to be used among the three DC modes in the bitstream. When the current block is a chrominance component block and the DC mode is not applied, the decoder may not parse the flag indicating the DC mode to be used among the three DC modes, and the DC mode of the current block may be configured as a DC prediction mode using the average of the top and left pixels.

[0330] When the ISP mode is applied, the current block can be divided in the horizontal direction and can be divided in the vertical direction. A block can be divided into two or four blocks according to the width or height of the current block. When three plane modes or three DC modes are used in the coding block in the ISP mode, the prediction mode can be determined according to the form of the divided block. When the current block is encoded in the ISP mode and the division form according to the ISP mode is horizontal division, the horizontal plane mode among the three plane modes can be used. When the current block is encoded in the ISP mode and the division form according to the ISP mode is horizontal division, the vertical plane mode among the three plane modes can be used. When the current block is encoded in the ISP mode and the division form according to the ISP mode is horizontal division, the mode using the average of the left pixels among the three DC modes can be used. When the current block is encoded in the ISP mode and the division form according to the ISP mode is horizontal division, the mode using the average of the top pixels among the three DC modes can be used.

[0331] The ISP mode division form can be determined based on the intra-frame prediction directional mode derived from DIMD or the intra-frame prediction directional mode derived from TIMD. When the DIMD (or TIMD) mode of the current block is less than 34, the ISP division form of the current block can be horizontal division. When the DIMD (or TIMD) mode of the current block is greater than or equal to 34, the ISP division form of the current block can be vertical division. On the contrary, when the DIMD (or TIMD) mode of the current block is less than 34, the ISP division form of the current block can be vertical division. When the DIMD (or TIMD) mode of the current block is greater than or equal to 34, the ISP division form of the current block can be horizontal division. When the division form of the ISP mode is determined based on the intra-frame prediction directional mode derived from DIMD (or TIMD), the division form is implicitly determined, so the encoder may not include information about the ISP division form in the bitstream, and the decoder may not parse the information about the ISP division form.

[0332] The video signal processing device can generate a prediction block for each mode by using all three DC modes, and generate a final prediction block by weighted averaging by applying the same or different weights to each prediction block. In this case, when the width of the current block is greater than the height, the maximum weight can be applied to the block using the average prediction of the top pixels. In addition, when the width of the current block is less than the height, the maximum weight can be applied to the block using the average prediction of the left pixels. Alternatively, when the DIMD intra-frame prediction directional mode derived from the neighboring pixels of the current block has a value equal to or greater than a predetermined value, the maximum weight can be applied to the block using the average prediction of the top pixels. When the DIMD intra-frame prediction directional mode derived from the neighboring pixels of the current block is less than a predetermined value, the maximum weight can be applied to the block using the average prediction of the left pixels. Here, the predetermined value can be an integer and can be a value corresponding to a diagonal pattern ( Figure 6 The DIMD information derived from the neighboring pixels of the current block may include a first intra prediction directional mode, a second intra prediction directional mode, and information on whether weighted prediction is performed. When weighted prediction is not applied among the DIMD information derived from the neighboring pixels of the current block, a maximum weight may be applied to a block predicted using an average of all top and left pixels.

[0333] Fig.40 A DC prediction method in units of vertical or horizontal lines according to an embodiment of the present disclosure is illustrated.

[0334] The DC mode is a prediction method that generates a prediction block of the current block by using only one average value, and all pixels in the prediction block have the same value. In order to improve the prediction efficiency of using the DC mode in a block with a gradual change, the video signal processing device may generate a prediction block so that the average value changes according to the vertical or horizontal position within the block, and this is called a gradient-based DC prediction mode. Fig.40 When generating a prediction block for a current block using the DC mode in the horizontal direction, the video signal processing apparatus may calculate pixels adjacent to the top of the current block (eg, Fig.40 ), and then by applying the average value to the pixels corresponding to the first horizontal line (e.g., Fig.40 Next, the average value may be recalculated according to the gradient between the reference pixel (A) positioned at the top among the pixels adjacent to the left side of the current block and the reference pixel (B) in the next horizontal line. The video signal processing apparatus may recalculate the average value by applying the recalculated average value to the second horizontal line (e.g., Fig.40) to generate prediction samples. A method of recalculating the average value for the second horizontal line may be to refer to the lower left corner position of the current block, use the distance (L) between the reference pixel (A) and the reference pixel (B), the distance (M) between the reference pixel (A) and the reference pixel (E), and the difference (X) between the values ​​of the reference pixel (A) and the pixel (E) positioned at (-1, -1), by calculation of an interpolation method. For example, the average value may be recalculated by adding the average value to the product of the value obtained by dividing X by L by M. The same calculation may be performed on the next horizontal line, and a prediction sample for the current block may be generated. That is, a prediction block for the current block may be generated so that the average value for each horizontal (or vertical) line changes according to the gradient of the reference pixel adjacent to the left (or top) of the current block. The pixel values ​​of the corresponding horizontal (or vertical) direction samples are configured to be the same as each other, and a prediction block for the current block may be generated so that one or more vertical (or horizontal) pixel values ​​change. In addition, the DC prediction mode in units of lines can be divided into a DC prediction mode in units of lines in the vertical direction and a DC prediction mode in units of lines in the horizontal direction. When the width of the current block is greater than the height, the number of pixels adjacent to the top of the current block is large, and the DC prediction mode in units of lines in the vertical direction can be used to generate a prediction block for the current block. Alternatively, when the width and height of the current block are the same, a conventional DC prediction mode can be used to generate a prediction block for the current block.

[0335] Fig.41 A plane prediction method in units of vertical or horizontal lines according to an embodiment of the present disclosure is illustrated.

[0336] refer to Fig.41 (a) to (d) of FIG. 1 , when the horizontal plane mode is used to predict the current block, the position of the reference pixel used may change for each horizontal line. Specifically, pixel A and the pixel adjacent to the top of the current block (e.g., Fig.41 The shaded pixels in the image are used to predict the first horizontal line of the current block ( Fig.41 Pixel B and pixels adjacent to the top of the current block (e.g., Fig.41 The shaded pixels in the image are used to predict the second horizontal line of the current block ( Fig.41) In addition, the plane prediction mode in units of lines can be divided into a vertical plane mode, a horizontal plane mode, and a mode obtained by weighted averaging the prediction blocks in the vertical and horizontal directions. When the width of the current block is greater than the height, the number of pixels adjacent to the top of the current block is large, and therefore the video signal processing device can generate a prediction block for the current block by using the vertical plane mode. When the height of the current block is greater than the width, the number of pixels adjacent to the left side of the current block, the video signal processing device can generate a prediction block for the current block by using the horizontal plane mode. When the width and height of the current block are the same as each other, the video signal processing device can generate a prediction block for the current block by using the conventional plane mode.

[0337] Fig.42 A prediction method in units of sub-blocks by using a planar mode according to an embodiment of the present disclosure is illustrated.

[0338] After dividing the current block into sub-blocks of a predetermined size (MxN), the video signal processing apparatus may perform prediction in units of sub-blocks by using a planar mode. Fig.42 (a) to (c), the position of the reference pixel used for prediction ( Fig.42 1, 2, 3 or 4) can be changed for each sub-block. Specifically, refer to Fig.42 (a), the current block may be divided into four sub-blocks of size (MXN). The position of the reference pixel may be determined based on the upper left position of the current sub-block and / or the width and height of the current sub-block. Fig.42 In (a), the position of the reference pixel of the upper left sub-block may be 1 or 3, the position of the reference pixel of the upper right sub-block may be 2 or 3, the position of the reference pixel of the lower left sub-block may be 1 or 4, and the position of the reference pixel of the lower right sub-block may be 2 or 4. For example, when the planar mode is used to generate the image for Fig.42 When the prediction block of the upper right sub-block is calculated, the video signal processing device can generate a prediction value for the pixel indicated as "X" by weighted averaging the value generated using the value of reference pixel 3 and pixel V and the value generated using the value of reference pixel 2 and pixel H. Fig.42 (b) of FIG. 1 illustrates the prediction of the horizontal plane mode in units of sub-blocks. For example, when the horizontal plane mode is used to generate Fig.42 When the prediction block of the lower left sub-block of (b) is selected, the video signal processing device can generate a prediction value for the pixel indicated as “X” by weighted averaging the value of pixel H and the value generated using reference pixel 1. Fig.42 (c) of FIG. 1 illustrates the prediction of the vertical plane mode in units of sub-blocks. For example, when the vertical plane mode is used to generate Fig.42When the prediction block of the upper right sub-block of (c) is selected, the video signal processing device can generate a prediction value for the pixel indicated as "X" by weighted averaging the value generated using the reference pixel 3 and the value of the pixel V.

[0339] The video signal processing device can determine a plane mode to be applied to each sub-block from among a horizontal plane mode, a vertical plane mode, and a normal plane mode based on the width or height of the current block, the ratio between the width and the height of the current block, information about whether the current block is a luminance component block or a chrominance component block, quantization parameter information, information about the intra-frame prediction directional mode of a neighboring block of the current block, the position of the sub-block, and information about the intra-frame prediction directional mode derived from neighboring pixels of the current block using DIMD.

[0340] When the intra-frame prediction directional mode derived using the DIMD of the neighboring pixels from the current block has a value equal to or greater than a predetermined value, the video signal processing device may generate a prediction block for the sub-block by applying the vertical plane mode. When the intra-frame prediction directional mode derived using the DIMD of the neighboring pixels from the current block has a value less than the predetermined value, the video signal processing device may generate a prediction block for the sub-block by applying the horizontal plane mode. In this case, the predetermined value may be an integer and may be the same as the diagonal mode ( Figure 6 The DIMD information derived from the neighboring pixels of the current block may include the first intra-frame prediction directional mode, the second intra-frame prediction directional mode, and information on whether to perform weighted averaging. When the DIMD information derived from the neighboring pixels of the current block indicates that weighted prediction is not performed, the video signal processing apparatus may generate a prediction block for each sub-block by using a conventional planar mode.

[0341] The plane mode to be used to generate the prediction block of each sub-block can be determined based on the position of each sub-block. The video signal processing device can generate the prediction block of the upper left sub-block by using the normal plane mode, generate the prediction block of the upper right sub-block by using the vertical plane mode, generate the prediction block of the lower left sub-block by using the horizontal plane mode, and generate the prediction block of the lower right sub-block by using the normal plane mode.

[0342] The plane mode prediction method in units of subblocks can be applied only when the vertical or horizontal plane mode is applied to the current block. In other words, when the conventional plane mode is applied to the current block, the video signal processing device can generate a prediction block of the current block by using the conventional plane mode. When the vertical or horizontal plane mode is used for the current block, the video signal processing device can divide the current block into subblocks and generate a prediction of each subblock by using the vertical or horizontal plane mode.

[0343] Pixel A and the top neighboring pixels of the current block (e.g., Fig.40 The shadow pixels) are used to predict the first horizontal line of the current block ( Fig.40 Similarly, pixel B and pixels adjacent to the top of the current block (e.g., Fig.40 The shadow pixels) are used to predict the second horizontal line of the current block ( Fig.40 ) In addition, the plane mode in units of lines can be divided into a vertical plane mode, a horizontal plane mode, and a prediction mode of a weighted average prediction block in vertical and horizontal directions. When the width of the current block is greater than the height, the number of top pixels adjacent to the current block is large, and thus the video signal processing device can generate a prediction block for the current block by using the vertical plane mode. When the height and width of the current block are the same as each other, the number of pixels adjacent to the left side of the current block is large, and thus the video signal processing device can generate a prediction block for the current block by using the horizontal plane mode. When the width and height of the current block are the same as each other, the video signal processing device can generate a prediction block for the current block by using the conventional plane mode.

[0344] When a prediction block of a current block is generated using a plane mode, the video signal processing device may generate a prediction block by using a vertical plane mode, may generate a prediction block by using a horizontal plane mode, and may generate a final prediction block by weighted averaging the corresponding prediction blocks. In this case, the weights may be the same as or different from each other. When a DIMD intra-frame prediction directional mode derived from neighboring pixels of the current block has a value equal to or greater than a predetermined value, the weight of a block predicted using a vertical plane mode may be the largest. The weight of a block predicted using a vertical plane mode may be 3, and the weight of a block predicted using a horizontal plane mode may be 1. When a DIMD intra-frame prediction directional mode derived from neighboring pixels of the current block has a value less than a predetermined value, the weight of a block predicted using a horizontal plane mode may be the largest. The weight of a block predicted using a horizontal plane mode may be 3, and the weight of a block predicted using a vertical plane mode may be 1. Here, the predetermined value may be an integer, and may be a value corresponding to a diagonal mode ( Figure 6 The DIMD information derived from the neighboring pixels of the current block may include a first intra-frame prediction directional mode, a second intra-frame prediction directional mode, and information about whether weighted prediction is performed. When the DIMD information derived from the neighboring pixels of the current block indicates that weighted prediction is not applied, the video signal processing device may apply the same weight to each prediction block. Here, a sub-block-based plane mode prediction method may be used to generate a prediction block generated using a vertical plane mode and a prediction block generated using a horizontal plane mode.

[0345] Prediction using the DC mode has the problem of generating discontinuous edges at the boundaries between blocks at a low bit rate. In order to improve this problem, the video signal processing device can perform correction of the prediction block by adding a predetermined offset value to the prediction block of the current block generated by the DC mode. In this case, the information about the predetermined offset value can be explicitly signaled by including it in the bitstream, or it can be implicitly derived from the values ​​of neighboring pixels adjacent to the current block. The decoder can perform correction on the prediction block of the current block based on the offset value obtained by parsing the information about the predetermined offset value. Alternatively, the decoder can perform correction on the prediction block of the current block by deriving the offset value from the values ​​of neighboring pixels adjacent to the current block. Alternatively, the prediction block of the current block can be generated by weighted averaging a block predicted using a plane mode and a block predicted using a DC mode.

[0346] Three plane modes and three DC modes can be derived based on the template. First, the video signal processing device can configure a reference template including a reconstructed neighboring block adjacent to the current block (see Fig.23 ). The video signal processing apparatus may configure prediction templates for three planar modes by using reference pixels around the reference template. The video signal processing apparatus may calculate a cost between the reference template and the prediction template, and then generate a prediction block of the current block by using a planar prediction mode indicating a minimum cost.

[0347] In addition, the video signal processing apparatus may configure a reference template including a reconstructed neighboring block adjacent to the current block (see Fig.23 ). The video signal processing device may configure prediction templates for three plane modes by using reference pixels around the reference template. The video signal processing device may calculate the cost between the reference template and the prediction template, and then configure a list for the plane mode based on the cost. In this case, the plane mode with the smallest cost may be positioned at the top of the list, and the list may be configured in ascending order according to the cost. The encoder may generate and signal a bitstream including index information of an optimal plane mode for generating a prediction block of the current block among the plane modes in the list. The decoder may generate a prediction block of the current block by using the plane mode determined by parsing the index information.

[0348] The above template-based planar pattern derivation method can be similarly applied to these three DC modes.

[0349] Fig.43 An intra prediction method based on bidirectional prediction according to an embodiment of the present disclosure is illustrated.

[0350] When the video signal processing device encodes the current block in the intra-frame prediction mode, the pixels on the left side of the current block or above the current block are adjacent to the neighboring pixels of the reconstructed current block, and thus effective prediction can be performed. However, the neighboring pixels around the pixels on the right side of the current block or below the current block have not been reconstructed, and thus the prediction efficiency is low. That is, the pixels located closer to the lower right of the current block are farther away from the reference pixels (the pixels around the reconstructed current block), and thus the number of error signals increases. In order to improve this problem, as Fig.43 As shown in , the video signal processing device may reconstruct only one pixel positioned at the lower right of the current block in advance, and then generate a prediction block of the current block based on the reconstructed lower right pixel and the neighboring pixels adjacent to the current block. In this case, the pixel positioned at the lower right of the current block can be predicted and encoded from the pixels adjacent to the current block, and information about the difference corresponding to the difference between the pixel value positioned at the lower right of the current block and the predicted value can be included in the bitstream and sent with a signal. The decoder can reconstruct the pixel positioned at the lower right of the current block by using the difference determined by parsing the information about the difference. Next, the video signal processing device can generate a prediction block of the current block using one pixel positioned at the lower right of the current block and pixels adjacent to the current block. The video signal processing device can predict the right pixel ( Fig.43 ) and the bottom pixels ( Fig.43 ), and then a prediction block of the current block may be generated by using pixels adjacent to the current block and bottom and right pixels within the current block.

[0351] In order to increase the coding efficiency, a method of quantizing the transform coefficient value obtained by transforming the residual signal and coding the quantized transform coefficient can be used instead of coding the above residual signal without transformation. As described above, the transform unit can obtain the transform coefficient value by transforming the residual signal. In this case, the residual signal of a specific block can be distributed to all areas of the current block. Therefore, by performing a frequency domain transform on the residual signal to concentrate the energy in the low-frequency area, the coding efficiency can be increased.

[0352] The encoder may obtain at least one residual block including a residual signal of the current block. The residual block may be one of the blocks segmented from the current block or the current block. In the present disclosure, the residual block may be described as a residual array or a residual matrix including residual samples of the current block. In addition, in the present disclosure, the residual block may indicate a block having the same size as the size of a transform unit or a transform block.

[0353] The encoder may transform the residual block by using a transform kernel. The transform kernel used for the transform of the residual block may be a transform kernel having separable characteristics of vertical and horizontal transforms. In this case, the transform of the residual block may be separated into a vertical transform and a horizontal transform and performed. For example, the encoder may apply the transform kernel in the vertical direction of the residual block to perform a vertical transform. In addition, the encoder may apply the transform kernel in the horizontal direction of the residual block to perform a horizontal transform. In the present disclosure, the transform kernel may be used as a term indicating a parameter set used for the transform of the residual signal, such as a transform matrix, a transform array, a transform function, and a transform. According to an embodiment, the transform kernel may be one of a plurality of available kernels. In addition, transform kernels based on different transform types may be used for each of the vertical transform and the horizontal transform. That is, before performing the main transform, at least one of the intra prediction mode of the current block, the coding mode, the transform method parsed from the bitstream, or the size information of the current block may be used to derive the transform method for the vertical and horizontal directions. In addition, in order to reduce the computational complexity in the transform process of the large block, a process of leaving only the low-frequency region and processing the high-frequency region as "0" may be performed. This process may be referred to as high frequency zeroing, and for this zeroing, the transform size during the actual main transform may be configured. During the high frequency zeroing process, the low frequency region may be configured to have a predetermined size, and for example, the width or height may be a combination of 4, 8, 16, 32, etc.

[0354] The encoder may transmit the transform block transformed from the residual block to the quantization unit and quantize it. In this case, the transform block may include a plurality of transform coefficients. Specifically, the transform block may include a plurality of two-dimensional arrays of transform coefficients. The size of the transform block may be the same as the current block, or the same as one of the blocks divided from the current block, similar to the residual block. The transform coefficient transmitted to the quantization unit may be represented as a quantized value.

[0355] In addition, the encoder may perform an additional transform before quantizing the transform coefficients. The above-mentioned transform method may be referred to as a main transform, and the additional transform may be referred to as an auxiliary transform. The auxiliary transform may be optional for each residual block. According to an embodiment, the encoder may perform an auxiliary transform on an area where it is difficult to concentrate energy in the low-frequency area of ​​the main transform only, so as to improve coding efficiency. For example, an auxiliary transform may be added to a block in which the residual value is large in a direction other than the horizontal or vertical direction of the residual block. Compared with the residual value of the inter-frame prediction block, the residual value of the intra-frame prediction block may have a high probability of changing in a direction other than the horizontal or vertical direction. Therefore, the encoder may perform an auxiliary transform on the residual signal of the intra-frame prediction block in addition. In addition, the encoder may omit the auxiliary transform for the residual signal of the inter-frame prediction block. High-frequency zeroing in the main transform may also be performed during the auxiliary transform process.

[0356] In another example, it can be determined whether to perform an auxiliary transform according to the size of the current block or the residual block. In addition, transform kernels of different sizes can be used according to the size of the current block or the residual block. For example, an 8X8 auxiliary transform can be applied to a block in which the length of the shorter side between the width and the height is equal to or greater than the first preconfigured length. In addition, a 4X4 auxiliary transform can be applied to a block in which the length of the shorter side between the width and the height is equal to or greater than the second preconfigured length and less than the first preconfigured length. In this case, the first preconfigured length may have a value greater than the second preconfigured length, and the present disclosure is not limited thereto. In addition, unlike the main transform, the auxiliary transform may be divided into a vertical transform and a horizontal transform. The auxiliary transform may be referred to as a low-frequency inseparable transform (LFNST).

[0357] In addition, in the case of a video signal in a specific area, due to sudden brightness changes, even if a frequency transform is performed, the high-frequency band energy may not be reduced. Therefore, the compression performance by quantization may deteriorate. In addition, when a transform is performed on an area where residual values ​​are sparsely present, the encoding time and the decoding time may be unnecessarily increased. Therefore, the transform of the residual signal in a specific area can be omitted. Whether a transform is performed on the residual signal in a specific area can be determined by a syntax element related to the transform of the specific area. For example, the syntax element may include transform skip information. The transform skip information may be a transform skip flag. When the transform skip information for the residual block indicates a transform skip, the transform for the corresponding residual block is not performed. In this case, the encoder can immediately quantize the residual signal for which the transform of the corresponding area is not performed.

[0358] The above-mentioned transform-related syntax elements may be information parsed from a video signal bitstream. The decoder may obtain the transform-related syntax elements by entropy decoding the video signal bitstream. In addition, the encoder may generate a video signal bitstream by entropy coding the transform-related syntax elements.

[0359] The decoder may obtain the encoding information required to parse and decode the received bitstream. In this case, the information related to the transform process may be index information for the main transform type and the auxiliary transform type, quantized transform coefficients, etc. The inverse transform unit may obtain a residual signal by inversely transforming the inverse quantized transform coefficients. First, the inverse transform unit may detect whether to perform an inverse transform for the corresponding region from the transform-related syntax element of a specific region. According to an embodiment, when the transform-related syntax element for a specific transform block indicates a transform skip, the transform for the corresponding transform block may be omitted. In this case, for the transform block, both the main inverse transform and the auxiliary inverse transform may be omitted. In addition, the inverse quantized transform coefficient may be used as a residual signal. For example, the decoder may reconstruct the current block by using the inverse quantized transform coefficient as a residual signal. Alternatively, an auxiliary inverse transform may be performed, the main inverse transform may be omitted, and the value obtained by the auxiliary inverse transform may be used as a residual signal. The above-mentioned main inverse transform may indicate an inverse transform for the main transform, and may be referred to as an inverse main transform. The auxiliary inverse transform may indicate an inverse transform for the auxiliary transform, and may be referred to as an inverse auxiliary transform or an inverse LFNST. In the present disclosure, the primary (inverse) transform may be referred to as a first (inverse) transform, and the secondary (inverse) transform may be referred to as a second (inverse) transform.

[0360] Fig.44 Illustrations show transform kernel types that can be used for video coding according to an embodiment of the present disclosure.

[0361] Fig.44 Formulas of discrete cosine transform type (DCT)-II, DCT-V, DCT-VIII, discrete sine transform type (DST)-I and DST-VII kernels applied to MTS are illustrated. DCT and DST can be expressed by cosine and sine functions, respectively, and when the basis function of the transform kernel for the number of samples N is expressed by Ti(j), the index i indicates the index in the frequency domain, and the index j indicates the index in the basis function. That is, as i decreases, it indicates a low-frequency basis function, and as i increases, it indicates a high-frequency basis function. When the basis function Ti(j) is expressed by a two-dimensional matrix, the basis function Ti(j) can indicate the jth element in the i-th row, Fig.30All the transform kernels illustrated in FIG. 3 have separable characteristics, and therefore the transform in each of the horizontal and vertical directions can be performed on the residual signal X. That is, when the residual signal block is X and the transform kernel matrix is ​​T, the transform for the residual signal X can be indicated as "TXT'". In this case, "T'" means the transposition of the transform kernel matrix T. DCT and DST are in floating point form, not integer form, so they are burdensome when directly implemented in hardware encoders and decoders. Therefore, it is necessary to approximate the floating point transform kernel to an integer transform kernel by scaling and rounding. The integer precision of the transform kernel can be determined to be 8 bits or 10 bits, but if the precision is reduced, the coding efficiency may be reduced. Depending on the orthogonality of the approximate DCT and DST, it may not be retained, but the resulting coding efficiency loss is not significant, and therefore approximating the transform kernel in the form of an integer is conducive to the implementation of the hardware encoder and decoder. The identity transform (IDTR) refers to a transform in which the output of the transform is the same as the transform itself before the transform, and is called an identity transform. In general, in an identity transform, a transform matrix is ​​configured by setting "1" at positions where rows and columns have the same value. However, in this case, the identity transform uses a predetermined fixed value instead of "1", and uniformly increases or decreases the input residual signal using the same value.

[0362] The bitstream may include one or more coded video sequences (CVS), and one CVS is encoded independently of other CVSs. Each CVS includes one or more layers, and each layer may indicate a specific image quality or a specific resolution, or indicate normal video, a depth information map, and a transparency map. In addition, a coded layer video sequence (CLVS) means a layer-by-layer CVS including continuous Pu (in decoding order) in the same layer. For example, there may be a CLVS for a layer with a specific image quality, and there may be a CLVS for a depth information map.

[0363] Fig.45 and Fig.46 A portion of a sequence parameter set according to an embodiment of the present disclosure is illustrated.

[0364] Fig.45 A method of signaling a syntax element indicating whether a vertical plane mode and a horizontal plane mode are enabled via an SPS is illustrated.

[0365] when Fig.45When sps_directional_planar_enabled_flag is "1" (true), it can indicate that the vertical plane mode and the horizontal plane mode are enabled. When sps_directional_planar_enabled_flag is "0" (false), it can indicate that the vertical plane mode and the horizontal plane mode are disabled. That is, the vertical plane mode and the horizontal plane mode are not used for all blocks. When sps_directional_planar_enabled_flag is not parsed (not included in the bitstream), the value of sps_directional_planar_enabled_flag can be inferred to be 0.

[0366] sps_directional_planar_enabled_flag equal to 1 specifies that the vertical plane and horizontal plane modes are enabled for CLVS. sps_directional_planar_enabled_flag equal to 0 specifies that the vertical plane and horizontal plane modes are disabled for CLVS. When sps_directional_planar_enabled_flag is not present, it is inferred to be equal to 0.

[0367] In the same manner as the above-described method of performing signaling in the SPS, a syntax element indicating whether the vertical plane mode and the horizontal plane mode are enabled may also be signaled in the PPS. That is, depending on the syntax element (e.g., pps_directional_planar_enabled_flag) signaled in the PPS, whether the vertical plane mode and the horizontal plane mode are enabled may vary for each picture and / or frame.

[0368] Fig.46 Illustrate a method of signaling a syntax element in an SPS, the syntax element indicating whether to enable Figure 25 to Figure 29 The method of generating a prediction block by using multiple reference pixel lines described above can be described as intra-frame fusion.

[0369] when Fig.46When sps_intra_fusion_enabled_flag is "1" (true), it can indicate that intra-frame fusion is enabled. When sps_intra_fusion_enabled_flag is "0" (false), it indicates that intra-frame fusion is disabled. That is, intra-frame fusion is not performed on all blocks. When sps_intra_fusion_enabled_flag is not parsed (not included in the bitstream), the value of sps_intra_fusion_enabled_flag can be inferred to be 0.

[0370] sps_intra_fusion_enabled_flag equal to 1 specifies that the intra-fusion method is enabled for CLVS. sps_intra_fusion_enabled_flag equal to 0 specifies that the intra-fusion method is disabled for CLVS. When sps_intra_fusion_enabled_flag is not present, it is inferred to be equal to 0.

[0371] In the same manner as the above-described method of performing signaling in SPS, a syntax element indicating whether intra-frame fusion is enabled may also be signaled in PPS. That is, depending on the syntax element (e.g., pps_intra_fusion_enabled_flag) signaled in PPS, whether intra-frame fusion is enabled may vary for each picture and / or frame.

[0372] Fig.47 FIG. 1 illustrates a portion of a general_constraint_info() syntax structure according to an embodiment of the present disclosure.

[0373] Fig.47 Illustration of constraint flags related to vertical and horizontal plane modes and intra-frame blending. Fig.47 The general_constraint_info() syntax 47 can be called by the profile_tier_level() syntax. The profile_tier_level() syntax can be called by the sequence parameter set RBSP syntax, the video parameter set RBSP syntax, and the decoding capability information RBSP syntax. Individual syntax elements of the general_constraint_info() syntax can have corresponding syntax elements within the sequence parameter set RBSP, and whether the corresponding sequence parameter set RBSP syntax element is enabled / disabled can be constrained by the definition of the corresponding flog.

[0374] The constraint flag related to the vertical planar mode and the horizontal planar mode can be gci_no_directional_planar_constraint_flag.

[0375] When the value of gci_no_directional_planar_constraint_flag is equal to 1, the value of sps_directional_planar_enabled_flag for all pictures present in OlsScope is restricted to 0. That is, the vertical plane mode and the horizontal plane mode may be restricted (forcibly) disabled. When the value of gci_no_directional_planar_constraint_flag is equal to 0, the value of sps_directional_planar_enabled_flag is not restricted.

[0376] gci_no_directional_planar_constraint_flag equal to 1 specifies that sps_directional_planar_enabled_flag for all pictures in OlsInScope shall be equal to 0. gci_no_directional_planar_constraint_flag equal to 0 does not impose such a restriction.

[0377] The constraint flag related to intra-frame fusion can be gci_no_intra_fusion_constraint_flag.

[0378] When the value of gci_no_intra_fusion_constraint_flag is equal to 1, for all pictures present in OlsScope, the value of sps_intra_fusion_enabled_flag is constrained to 0. That is, intra-frame fusion can be constrained (forced) to be disabled. When the value of gci_no_intra_fusion_constraint_flag is equal to 0, the value of sps_intra_fusion_enabled_flag is not constrained to 0.

[0379] gci_no_intra_fusion_constraint_flag equal to 1 specifies that sps_intra_fusion_enabled_flag for all pictures in OlsInScope shall be equal to 0. gci_no_intra_fusion_constraint_flag equal to 0 does not impose such a constraint.

[0380] When generating a prediction for the current block, the video signal processing device can use a multiple prediction mode that performs a weighted average of two or more intra-frame prediction blocks. When using DIMD or TIMD mode, two intra-frame prediction directional modes can be implicitly determined from neighboring blocks or MPM lists. In blocks other than DIMD or TIMD mode, two intra-frame prediction directional modes can be signaled from the bitstream, but the bit amount is increased and therefore the compression efficiency can be reduced.

[0381] In order to mitigate such an increase in the bit amount, when the video signal processing apparatus configures the MPM list, the number of intra-prediction directional modes to be included in each item of the list may be configured to be two or more, instead of one.

[0382] Fig.48 A method of configuring an MPM list by using multiple prediction modes according to an embodiment of the present disclosure is illustrated.

[0383] Fig.48 (a), A, B, C, ..., F, G may indicate one of the predetermined prediction directional modes, MIP, intra-frame TMP, IBC, DIMD, and TIMD, "N / A" indicates that the mode is not used, and the fourth and fifth of the MPM list may be configured as only one intra-frame prediction directional mode, not a multi-prediction mode. Fig.48 As shown in (b), after the single prediction mode is first added to the MPM list, the multiple prediction mode can be added, "N / A" indicates that the mode is not used, and the first and second of the MPM list can be configured as only one intra-frame prediction directional mode, rather than a multiple prediction mode.

[0384] The encoder may adaptively include information about whether to use an MPM list including only one intra-frame prediction directional mode (MPM list based on single prediction) or an MPM list based on multiple predictions in a block unit in the bitstream and send it with a signal. The decoder may parse the information about whether to use an MPM list including only one intra-frame prediction directional mode (MPM list based on single prediction) or an MPM list based on multiple predictions, and determine the MPM list used to generate a prediction block for the current block.

[0385] The video signal processing device can determine whether to use the MPM list based on multiple prediction by using at least one of the width or height of the current block, the ratio of the width and height of the current block, information about whether the current block is a luminance block or a chrominance block, quantization parameter information, information about the intra-frame prediction directional mode of the neighboring blocks of the current block, and the encoding mode information of the current block.

[0386] Coding efficiency may vary according to the configuration of the MPM list based on multiple predictions, and various schemes may be applied as follows.

[0387] After configuring the MPM list based on a single prediction, the video signal processing device can configure the MPM list based on multiple predictions by using the MPM list based on a single prediction. For example, the video signal processing device can configure the MPM list based on multiple predictions with a combination of corresponding intra-frame prediction directional modes in the MPM list based on a single prediction. In this case, the video signal processing device can rearrange the MPM list based on a single prediction by using the template cost-based rearrangement method used in the TIMD method. The video signal processing device can configure the MPM list based on multiple predictions by using only the first intra-frame prediction directional mode of the rearranged MPM list based on a single prediction and a combination of intra-frame prediction directional modes other than the first one.

[0388] The video signal processing device can configure the MPM list based on multiple predictions by using a combination of the intra-frame prediction directional mode derived from the DIMD and the MPM list based on a single prediction. For example, the video signal processing device can combine the first intra-frame prediction directional mode derived from the DIMD and the first intra-frame prediction directional mode in the MPM list based on a single prediction to add it to the first one in the MPM list based on multiple predictions. The video signal processing device can combine the second intra-frame prediction directional mode derived from the DIMD and the first intra-frame prediction directional mode in the MPM list based on a single prediction to add it to the second one in the MPM list based on multiple predictions. The video signal processing device can combine the first intra-frame prediction directional mode derived from the DIMD and the second intra-frame prediction directional mode in the MPM list based on a single prediction to add it to the third one in the MPM list based on multiple predictions. In this way, the video signal processing device can configure the MPM list based on multiple predictions by using all possible combinations.

[0389] The video signal processing device may configure an MPM list based on multiple prediction by using a predefined number of multiple prediction modes. Here, the predefined number of multiple prediction modes may be (18,0), (50,0), (34,0), (2,0), (66,0), (18,1), (50,1), (34,1), (2,1), (66,1), etc., and in "(X,Y)", X and Y may be Figure 6 (index of) the intra-frame prediction directional mode.

[0390] The video signal processing apparatus may rearrange the multi-prediction based MPM list by a TIMD-based rearrangement method. The video signal processing apparatus may reconfigure the multi-prediction based MPM list by using only some items having low cost.

[0391] When the video signal processing device generates a prediction by using multiple prediction modes, the intra-frame prediction mode for generating each prediction block can be signaled based on the main MPM and the auxiliary MPM. The main MPM may include 6 intra-frame prediction directional modes, and the auxiliary MPM may include 16 intra-frame prediction directional modes. The auxiliary MPM can be configured using a predefined number of intra-frame prediction modes. For example, when there is no prediction mode of DC, 50, 18, 46, 54, 14, 22, 42, 58, 10, 26, 38, 62, 6, 30, 34, 66, 2, 48, 52, and 16 in the main MPM (see Figure 6 Intra-prediction mode), the video signal processing device may configure the auxiliary MPM list by sequentially adding prediction modes of DC, 50, 18, 46, 54, 14, 22, 42, 58, 10, 26, 38, 62, 6, 30, 34, 66, 2, 48, 52 and 16 until the auxiliary MPM list is fully configured. When multiple prediction modes are used for the current block, the video signal processing device may derive one intra-prediction directional mode from the main MPM and another intra-prediction directional mode from the auxiliary MPM, thereby determining the intra-prediction directional mode used to generate the prediction block of the current block. When multiple prediction modes are used for the current block, the encoder may include index information indicating the intra-prediction directional mode used in the main MPM and the auxiliary MPM in the bitstream and send the index information with a signal. When multiple prediction modes are used for the current block, the decoder may parse the index information to determine the intra-prediction directional mode used to generate the prediction block for the current block in the main MPM and the auxiliary MPM list.

[0392] When multiple prediction modes are used for the current block, the video signal processing device can determine the intra-frame prediction directional mode used to generate the prediction block of the current block by using the intra-frame prediction directional mode derived from the DIMD, the main MPM and the auxiliary MPM. When multiple prediction modes are used for the current block, the encoder can include information about whether the intra-frame prediction directional mode derived from the DIMD has been used, and index information indicating the intra-frame prediction directional mode that has been used in the main MPM and the auxiliary MPM in the bitstream, and send the index information with a signal. When multiple prediction modes are used for the current block, the decoder can parse the information about whether the intra-frame prediction directional mode derived from the DIMD has been used, and the index information indicating the intra-frame prediction directional mode that has been used in the main MPM and the auxiliary MPM, and determine the intra-frame prediction directional mode used to generate the prediction block for the current block.

[0393] When multiple prediction modes are used for the current block, the video signal processing device can configure the auxiliary MPM list as an MPM list based on multiple predictions by using the main MPM list. For example, when the main MPM mode generated from the neighboring block corresponds to the planar mode and modes 18, 54, 30, 45, 17, modes such as Planar+18, Planard+54,... can be added to the auxiliary MPM list and configured as an MPM list based on multiple predictions. When multiple prediction modes are used for the current block, the encoder can configure the auxiliary MPM list as an MPM list based on multiple predictions by using the main MPM list, and then determine the multiple prediction mode used to generate the prediction block of the current block from the auxiliary MPM list, and the index information of the determined auxiliary MPM list can be included in the bitstream and sent with a signal. The decoder can parse the index information to determine the multiple prediction mode used to generate the prediction block of the current block from the auxiliary MPM list.

[0394] In addition, when multiple prediction modes are used for the current block, the video signal processing device can configure the auxiliary MPM list as an MPM list based on multiple predictions by using the intra-frame prediction directional mode and the main MPM list derived from the DIMD. For example, when the main MPM mode generated from the neighboring block corresponds to the plane mode and modes 18, 54, 30, 45 and 17, modes such as Planar+18, Planard+54 can be added to the auxiliary MPM list and configured as an MPM list based on multiple predictions. When multiple prediction modes are used for the current block, the encoder can configure the auxiliary MPM list as an MPM list based on multiple predictions by using the intra-frame prediction directional mode and the main MPM list derived from the DIMD. The encoder can determine the multiple prediction mode used to generate the prediction block of the current block from the auxiliary MPM list, and can include the index information of the auxiliary MPM list in the bitstream and send it with a signal. The decoder can parse the index information to determine the multiple prediction mode used to generate the prediction block of the current block from the auxiliary MPM list.

[0395] When generating prediction blocks using multiple prediction modes, the video signal processing device can determine the positions of reference pixels used to generate each prediction block. That is, the video signal processing device can specify the left reference pixel line and the upper reference pixel line used to generate each prediction block among various reference pixel lines (see Fig.31 ). The encoder can determine the best reference pixel line and can then include information about the position of the left reference pixel line and information about the position of the upper reference pixel line in the bitstream and send it with a signal. The decoder can parse each position information to determine the position of the left reference pixel line and the upper reference pixel line used to generate each prediction block.

[0396] Fig.49Illustrated are positions of reference pixels used when a prediction block is generated using a multi-prediction mode according to an embodiment of the present disclosure.

[0397] refer to Fig.49 When the first intra-frame prediction directional mode of the multiple prediction modes is used to generate a prediction block, the video signal processing device can generate a prediction block by using only the left reference pixel of the current block. In addition, when the second intra-frame prediction directional mode of the multiple prediction modes is used to generate a prediction block, the video signal processing device can generate a prediction block by using only the upper reference pixel of the current block. As the first intra-frame prediction directional mode, only Figure 6 The intra-frame prediction directional mode has an index less than 34, and as the second intra-frame prediction directional mode, only Figure 6 A mode having an index equal to or greater than 34 among the intra-frame prediction directional modes. Therefore, the MPM list based on multi-prediction can be configured so that as the first intra-frame prediction directional mode, only modes with indexes less than 34 are used, and as the second intra-frame prediction directional mode, only modes with indexes equal to or greater than 34 are used.

[0398] refer to Fig.49 , the video signal processing device may specify the left reference pixel line and the upper reference pixel line respectively to generate the prediction block. After determining the best reference pixel line, the encoder may include information about the position of the left reference pixel line...

Claims

1. A video signal decoding device, comprising a processor, in, The processor is configured to: Determining a first prediction mode for a current block; Based on the first prediction mode, generating a prediction block of the current block; generating a residual block of the current block according to a transformation matrix set determined based on a second prediction mode; as well as The current block is reconstructed based on the prediction block and the residual block.

2. The video signal decoding device according to claim 1, wherein: The residual block is generated based on at least one of a set of transformation matrices of a multiple transform set (MTS) and / or a set of transformation matrices of a low frequency non-separable transform (LFNST).

3. The video signal decoding device according to claim 1, wherein: The first prediction mode and the second prediction mode are different from each other.

4. The video signal decoding device according to claim 3, wherein: The first prediction mode is one of a planar mode based on a horizontal direction or a planar mode based on a vertical direction.

5. The video signal decoding device according to claim 4, wherein: The planar mode based on the horizontal direction is a prediction mode based on a value of a block at a position (-1, y) and a value of a block at a position (W, -1), The planar mode based on the vertical direction is a prediction mode based on a value of a block at a position (x, -1) and a value of a block at a position (-1, H), The position of the upper left block of the current block is (0, 0), and The position of the prediction block is (x, y).

6. The video signal decoding device according to claim 4, wherein: i) the first prediction mode is the planar mode based on the horizontal direction, and the second prediction mode is the angular mode in the vertical direction, or ii) The first prediction mode is the planar mode based on the horizontal direction, and the second prediction mode is a horizontal direction angular mode.

7. The video signal decoding device according to claim 4, wherein: The first prediction mode is a linear prediction mode.

8. The video signal decoding apparatus according to claim 4, wherein: The first prediction mode is indicated by a syntax element included in the bitstream.

9. A video signal encoding device, comprising a processor, in, The processor is configured to: Determining a first prediction mode for a current block; generating a prediction block of the current block based on the first prediction mode; generating a residual block of the current block according to a transformation matrix set determined based on a second prediction mode; and The current block is reconstructed based on the prediction block and the residual block.

10. The video signal encoding device according to claim 9, wherein: The residual block is generated based on at least one of a set of transformation matrices of a multiple transform set (MTS) and / or a set of transformation matrices of a low frequency non-separable transform (LFNST).

11. The video signal encoding apparatus according to claim 9, wherein: The first prediction mode and the second prediction mode are different from each other.

12. The video signal encoding apparatus according to claim 11, wherein: The first prediction mode is one of a planar mode based on a horizontal direction or a planar mode based on a vertical direction.

13. The video signal encoding apparatus according to claim 12, wherein: The planar mode based on the horizontal direction is a prediction mode based on a value of a block at a position (-1, y) and a value of a block at a position (W, -1), The planar mode based on the vertical direction is a prediction mode based on a value of a block at a position (x, -1) and a value of a block at a position (-1, H), The position of the upper left block of the current block is (0, 0), and The position of the prediction block is (x, y).

14. The video signal encoding apparatus according to claim 12, wherein: i) the first prediction mode is the planar mode based on the horizontal direction, and the second prediction mode is the angular mode in the vertical direction, or ii) The first prediction mode is the planar mode based on the horizontal direction, and the second prediction mode is a horizontal direction angular mode.

15. The video signal encoding apparatus according to claim 12, wherein: The first prediction mode is a linear prediction mode.

16. The video signal encoding apparatus according to claim 12, wherein: The first prediction mode is indicated by a syntax element included in the bitstream.

17. A non-transitory computer-readable storage medium storing a bit stream, the bit stream being decoded by a decoding method, in, The decoding method comprises: Determining a first prediction mode for a current block; Based on the first prediction mode, generating a prediction block of the current block; generating a residual block of the current block according to a transformation matrix set determined based on a second prediction mode; and The current block is reconstructed based on the prediction block and the residual block.

18. The non-transitory computer-readable storage medium of claim 17, wherein: The residual block is generated based on at least one of a set of transformation matrices of a multiple transform set (MTS) and / or a set of transformation matrices of a low frequency non-separable transform (LFNST).

19. The non-transitory computer-readable storage medium of claim 17, wherein: The first prediction mode and the second prediction mode are different from each other.

20. The non-transitory computer-readable storage medium of claim 19, wherein: The first prediction mode is one of a planar mode based on a horizontal direction or a planar mode based on a vertical direction.