Video signal processing method and apparatus using multiple hypothesis prediction - Patents.com

The video signal processing method improves coding efficiency by configuring a merge candidate list with spatial candidates and HMVPs, and generating predicted blocks based on motion information from merge candidates and a merge sharing node, effectively addressing inefficiencies in existing methods.

JP7670378B2Active Publication Date: 2025-04-30WILUS INSTITUTE OF STANDARDS & TECHNOLOGY INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2023140496
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2019-09-06
Filing Date
2023-08-30
Publication Date
2025-04-30
Estimated Expiration
2039-10-14

AI Technical Summary

Technical Problem

Existing video signal processing methods struggle to achieve high coding efficiency, particularly in transforming blocks, due to inefficient use of motion information and prediction modes.

Method used

A video signal processing method that configures a merge candidate list using spatial candidates, adds a specific History-Based Motion Vector Predictor (HMVP) to the list, and generates predicted blocks based on motion information from merge candidates and a merge sharing node, while updating the HMVP table with motion information from coding blocks with slow decoding order.

Benefits of technology

The method significantly enhances coding efficiency by effectively utilizing motion information and prediction modes, leading to improved compression performance and reduced computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007670378000024
    Figure 0007670378000024
  • Figure 0007670378000025
    Figure 0007670378000025
  • Figure 0007670378000026
    Figure 0007670378000026
Patent Text Reader

Abstract

To provide a video signal processing method and apparatus for encoding or decoding a video signal.SOLUTION: The method comprises the steps of: receiving information for prediction of a current block; determining whether or not a merge mode is applied to the current block on the basis of the information for prediction; when a merge mode is applied to the current block, obtaining a first syntax element indicating whether or not a combined prediction is applied to the current block, wherein the combined prediction indicates a prediction mode that combines inter-prediction and intra-prediction; generating an inter-prediction block and an intra-prediction block of the current block when the first syntax element indicates that the combined prediction is applied to the current block; and generating a combined prediction block of the current block by weighted-summing the inter-prediction block and the intra-prediction block.SELECTED DRAWING: Figure 45
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

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

[0002] Compression coding refers to a series of signal processing techniques for transmitting digitized information via a communication line or storing it in a form suitable for a storage medium. The objects of compression coding include voice, video, text, etc., and the technology for compressing and coding video in particular is called video compression. Compression coding of video signals is performed by removing redundant information by considering spatial correlation, temporal correlation, probabilistic correlation, etc. However, with the recent development of various media and data transmission media, there is a demand for more efficient video signal processing methods and devices. Summary of the Invention [Problem to be solved by the invention]

[0003] SUMMARY OF THE PRESENTLY PREFERRED EMBODIMENTS An object of the present invention is to improve the coding efficiency of a video signal. Specifically, the present invention has an object to improve the coding efficiency by using a transform kernel suitable for a transform block. [Means for solving the problem]

[0004] In order to solve the above problems, the present invention provides a video signal processing device and a video signal processing method as follows.

[0005] According to an embodiment of the present invention, there is provided a video signal processing method, comprising: constructing a merge candidate list using spatial candidates; adding a specific HMVP in an HMVP table including at least one history-based motion vector predictor (HMVP) to the merge candidate list, where the HMVP indicates motion information of a block previously coded before the plurality of coding blocks; obtaining index information indicating a merge candidate used for predicting a current block in the merge candidate list; and generating a predicted block of the current block based on motion information of the merge candidate determined based on the index information, wherein when the current block is located within a merge sharing node including a plurality of coding blocks, the merge candidate list is constructed using spatial candidates adjacent to the merge sharing node, and motion information of at least one coding block included in the merge sharing node is not updated to the HMVP table.

[0006] According to another embodiment of the present invention, there is provided a video signal processing apparatus, comprising: a processor, wherein the processor configures a merge candidate list using spatial candidates; and adds a specific HMVP in an HMVP table including at least one history-based motion vector predictor (HMVP) to the merge candidate list, wherein the HMVP obtains index information indicating a merge candidate used for predicting a current block in the merge candidate list, the merge candidate indicating motion information of a block previously coded before the plurality of coding blocks; and generates a predicted block of the current block based on motion information of the merge candidate determined based on the index information; and, when the current block is located within a merge sharing node including a plurality of coding blocks, the merge candidate list is configured using spatial candidates adjacent to the merge sharing node; and motion information of at least one coding block among the plurality of coding blocks included in the merge sharing node is not updated to the HMVP table.

[0007] As an example, the method may further include updating the HMVP table using motion information of a predefined number of coding blocks having a relatively late decoding order among a plurality of coding blocks included in the merge sharing node.

[0008] As an example, the method may further include updating the HMVP table using motion information of a coding block having a relatively latest decoding order among a plurality of coding blocks included in the merge sharing node.

[0009] In an embodiment, if the current block is not located within the merge share node, the method may further include updating the HMVP table using motion information of the merge candidate.

[0010] As an embodiment, the step of adding the HMVP to the merge candidate list may include the steps of: determining whether an HMVP having a specific index predefined in the HMVP table has motion information that overlaps with a candidate in the merge candidate list; and, if the HMVP having the specific index does not have motion information that overlaps with a candidate in the merge candidate list, adding the HMVP having the specific index to the merge candidate list.

[0011] According to one embodiment of the present invention, there is provided a video signal processing method, comprising: receiving information for prediction of a current block; determining whether a merge mode is applied to the current block based on the information for prediction; if the merge mode is applied to the current block, obtaining a first syntax element indicating whether a combined prediction is applied to the current block, where the combined prediction indicates a prediction mode combining inter prediction and intra prediction; if the first syntax element indicates that the combined prediction is applied to the current block, generating an inter predicted block and an intra predicted block of the current block; and generating a combined prediction block of the current block by performing a weighted sum of the inter predicted block and the intra predicted block.

[0012] Also, according to one embodiment of the present invention, a video signal processing device is provided, the video signal processing device including a processor, wherein when a merge mode is applied to a current block, the processor obtains a first syntax element indicating whether a combined prediction is applied to the current block, where the combined prediction indicates a prediction mode combining inter prediction and intra prediction, and when the first syntax element indicates that the combined prediction is applied to the current block, the video signal processing device generates an inter prediction block and an intra prediction block of the current block, and generates a combined prediction block of the current block by performing a weighted sum of the inter prediction block and the intra prediction block.

[0013] As an embodiment, the method may further include: decoding a residual block of the current block; and reconstructing the current block using the combined predicted block and the residual block.

[0014] As an embodiment, the step of decoding the residual block may further include, when the first syntax element indicates that the combined prediction is not applied to the current block, obtaining a second syntax element indicating whether a sub-block transform is applied to the current block, and the sub-block transform may indicate a transform mode that applies transform to only one of the sub-blocks of the current block divided in the horizontal or vertical direction.

[0015] As an example, if the second syntax element is not present, the value of the second syntax element may be inferred to be 0.

[0016] As an example, if the first syntax element indicates that the combined prediction is applied to the current block, an intra prediction mode for intra prediction for the current block may be set to a planar mode.

[0017] As an embodiment, the method may further include setting the positions of the left peripheral block and the upper peripheral block referenced for the combined prediction, and the positions of the left peripheral block and the upper peripheral block may be the same as the positions referenced by the intra prediction.

[0018] As an example, the positions of the left and top peripheral blocks may be determined using a scaling factor variable that is determined by a color component index value of the current block. Effect of the Invention

[0019] According to an embodiment of the present invention, it is possible to improve the coding efficiency of a video signal. Also, according to an embodiment of the present invention, it is possible to select a transform kernel suitable for a current transform block. [Brief description of the drawings]

[0020] [Figure 1] 1 is a schematic block diagram of a video signal encoding apparatus according to an embodiment of the present invention; [Diagram 2] 1 is a schematic block diagram of a video signal decoding device according to an embodiment of the present invention; [Diagram 3] FIG. 2 shows an example of how coding tree units are divided into coding units within a picture. [Figure 4] FIG. 1 illustrates an embodiment of a method for signaling splits of quad trees and multi-type trees. [Diagram 5] FIG. 2 illustrates in more detail an intra-prediction method according to an embodiment of the present invention; [Figure 6] FIG. 2 illustrates in more detail an intra-prediction method according to an embodiment of the present invention; [Figure 7] 1 illustrates an inter-prediction method according to an embodiment of the present invention. [Figure 8]FIG. 2 illustrates how an encoder converts a residual signal. [Figure 9] FIG. 2 illustrates how an encoder and a decoder inversely transform transform coefficients to obtain a residual signal. [Figure 10] 1 is a diagram illustrating a motion vector signaling method according to one embodiment of the present invention. [Figure 11] 1 is a diagram illustrating a method of signaling adaptive motion vector resolution information according to one embodiment of the present invention. [Figure 12] FIG. 1 illustrates a history-based motion vector prediction (HMVP) method according to an embodiment of the present invention. [Figure 13] 11 is a diagram illustrating a method of updating an HMVP table according to one embodiment of the present invention. [Figure 14] 11 is a diagram illustrating a method of updating an HMVP table according to one embodiment of the present invention. [Figure 15] 11 is a diagram illustrating a method of updating an HMVP table according to one embodiment of the present invention. [Figure 16] 11 is a diagram illustrating a method of updating an HMVP table according to one embodiment of the present invention. [Figure 17] 11 is a diagram illustrating a method of updating an HMVP table according to one embodiment of the present invention. [Figure 18] FIG. 2 illustrates a pruning process according to one embodiment of the present invention. [Figure 19] 10 is a diagram illustrating a method for adding an HMVP candidate according to one embodiment of the present invention. [Figure 20] FIG. 2 illustrates a merge sharing node according to one embodiment of the present invention. [Figure 21]11 is a diagram illustrating a method for updating HMVP when a shared list is used according to one embodiment of the present invention. [Figure 22] 10 is a diagram illustrating a method for updating an HMVP table based on motion information of blocks in a merge shared node according to one embodiment of the present invention. [Figure 23] 11 is a diagram illustrating a method for updating HMVP when a shared list is used according to one embodiment of the present invention. [Figure 24] 10 is a diagram illustrating a method for updating an HMVP table based on motion information of blocks in a merge shared node according to one embodiment of the present invention. [Diagram 25] 1 is a diagram illustrating a method for processing a video signal based on HMVP according to one embodiment of the present invention. [Figure 26] FIG. 2 is a diagram illustrating a multi-hypothesis prediction method according to an embodiment of the present invention. [Figure 27] 4 is a diagram illustrating a multiple hypothesis prediction mode determination method according to an embodiment of the present invention. [Figure 28] 4 is a diagram illustrating a multiple hypothesis prediction mode determination method according to an embodiment of the present invention. [Figure 29] FIG. 11 is a diagram illustrating neighboring positions referenced in multiple hypothesis prediction according to an embodiment of the present invention. [Diagram 30] 11 is a diagram illustrating a method for referring to a surrounding mode according to one embodiment of the present invention. [Diagram 31] 1 is a diagram illustrating a method for generating a candidate list according to an embodiment of the present invention. [Diagram 32] 1 is a diagram illustrating a method for generating a candidate list according to an embodiment of the present invention. [Diagram 33] FIG. 11 is a diagram illustrating neighboring positions referenced in multiple hypothesis prediction according to an embodiment of the present invention. [Diagram 34] 11 is a diagram illustrating a method for referring to a surrounding mode according to one embodiment of the present invention. [Diagram 35]1 is a diagram illustrating a method of using neighboring reference samples according to one embodiment of the present invention. [Diagram 36] FIG. 2 illustrates a conversion mode according to an embodiment of the present invention. [Figure 37] FIG. 4 is a diagram showing the relationship between color difference components according to one embodiment of the present invention. [Figure 38] FIG. 2 is a diagram showing the relationship between color components according to one embodiment of the present invention. [Figure 39] FIG. 2 is a diagram showing peripheral reference positions according to one embodiment of the present invention. [Diagram 40] FIG. 2 illustrates a weighted sample prediction process according to one embodiment of the present invention. [Diagram 41] FIG. 2 is a diagram showing peripheral reference positions according to one embodiment of the present invention. [Diagram 42] FIG. 2 illustrates a weighted sample prediction process according to one embodiment of the present invention. [Diagram 43] FIG. 2 illustrates a weighted sample prediction process according to one embodiment of the present invention. [Diagram 44] FIG. 2 illustrates a weighted sample prediction process according to one embodiment of the present invention. [Diagram 45] 1 is a diagram illustrating a video signal processing method based on multiple hypothesis prediction according to an embodiment of the present invention; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0021] The terms used in this specification are selected from currently widely used general terms as much as possible while taking into consideration the functions in the present invention, but this may vary depending on the intentions of the engineers in this field, customs, or the emergence of new technologies. In addition, in certain cases, the applicant may arbitrarily select terms, and in this case, the meanings of the terms will be described in the corresponding embodiment of the invention. Therefore, it is made clear that the terms used in this specification should be interpreted based on the substantial meanings of the terms and the contents of this specification as a whole, rather than simply the names of the terms.

[0022] In this specification, some terms are interpreted as follows. Coding may be interpreted as encoding or decoding depending on the circumstances. In this specification, an apparatus for encoding a video signal to generate a video signal bitstream is referred to as an encoding apparatus or encoder, and an apparatus for decoding a video signal bitstream to restore a video signal is referred to as a decoding apparatus or decoder. In this specification, a video signal processing apparatus is used as a term including both an encoder and a decoder. Information is a term including values, parameters, coefficients, elements, etc., and may be interpreted differently depending on the circumstances, so the present invention is not limited thereto. A 'unit' is used to mean a basic unit of image processing or a specific position of a picture, and refers to an image area including at least one of a luma component and a chroma component. In addition, a 'block' refers to an image area including a specific component of a luminance component and a chrominance component (i.e., Cb and Cr). However, depending on the embodiment, the terms 'unit', 'block', 'partition', and 'area' may be used interchangeably. In this specification, a unit is used as a concept including a coding unit, a prediction unit, and a transform unit, and a picture refers to a field or a frame, and the terms are used interchangeably depending on the embodiment.

[0023] 1 is a schematic block diagram of a video signal encoding apparatus 100 according to an embodiment of the present invention. Referring to FIG. 1, the encoding apparatus 100 of the present specification 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.

[0024] The transform unit 110 transforms a residual signal, which is a difference between an input video signal and a prediction signal generated by the prediction unit 150, to obtain a transform coefficient value. For example, a discrete cosine transform (DCT), a discrete sine transform (DST), or a wavelet transform is used. The discrete cosine transform and the discrete sine transform divide the input picture signal into blocks and perform the transform. In the transform, the coding efficiency may vary depending on the distribution and characteristics of values ​​in the transform domain. The quantizer 115 quantizes the values ​​of the transform coefficients output from the transform unit 110.

[0025] In order to improve coding efficiency, instead of coding the picture signal as it is, a method is used in which a picture is predicted using a pre-coded area through the prediction unit 150, and a residual value between the original picture and the predicted picture is added to the predicted picture to obtain a reconstructed picture. In order to prevent mismatch between the encoder and the decoder, when the encoder performs prediction, information that can also be used by the decoder should be used. For this purpose, the encoder performs a process of further reconstructing the current block that has been coded. The inverse quantization unit 120 inversely quantizes the transform coefficient values, and the inverse transform unit 125 reconstructs the residual values ​​using the inversely quantized transform coefficient values. Meanwhile, the filtering unit 130 performs a filtering operation to improve the quality of the reconstructed picture and the coding efficiency. For example, the filtering unit 130 may include a deblocking filter, a sample adaptive offset (SAO), an adaptive loop filter, and the like. The filtered picture is stored in a decoded picture buffer (DPB) 156 to be output or used as a reference picture.

[0026] In order to improve coding efficiency, a method is used in which a picture signal is not coded as it is, but a picture is predicted using an already coded area in the prediction unit 150, and a residual value between the original picture and the predicted picture is added to the predicted picture to obtain a restored picture. The intra prediction unit 152 performs intra prediction within the current picture, and the inter prediction unit 154 predicts the current picture using a reference picture stored in the decoded picture buffer 156. The intra prediction unit 152 performs intra prediction from a restored area in the current picture, and transmits intra coding information to the entropy coding unit 160. The inter prediction unit 154 may further include a motion estimation unit 154a and a motion compensation unit 154b. The motion estimation unit 154a obtains a motion vector value of the current area by referring to a specific restored area. The motion estimation unit 154a transmits position information (reference frame, motion vector, etc.) of the reference area to the entropy coding unit 160 so that it can be included in the bitstream. Using the motion vector values ​​transmitted from the motion estimation unit 154a, the motion compensation unit 154b performs inter-frame motion compensation.

[0027] The prediction unit 150 includes an intra prediction unit 152 and an inter prediction unit 154. The intra prediction unit 152 performs intra prediction within a current picture, and the inter prediction unit 154 performs inter prediction to predict the current picture using a reference buffer stored in a decoded picture buffer 156. The intra prediction unit 152 performs intra prediction from reconstructed samples within the current picture, and transmits intra coding information to the entropy coding unit 160. The intra coding information includes at least one of an intra prediction mode, a Most Probable Mode (MPM) flag, and an MPM index. The intra coding information may include information about a reference sample. The intra coding information may include information about a reference sample. The inter prediction unit 154 includes a motion estimation unit 154a and a motion compensation unit 154b. The motion estimation unit 154a obtains a motion vector value of a current region by referring to a specific region of a reconstructed reference signal picture. The motion estimation unit 154a transmits a motion information set (reference picture index, motion vector information) for the reference region to the entropy coding unit 160. The motion compensation unit 154b performs motion compensation using the motion vector values ​​transmitted from the motion compensation unit 154a. The inter prediction unit 154 transmits inter coding information including the motion information for the reference region to the entropy coding unit 160.

[0028] According to a further embodiment, the prediction unit 150 includes an intra block copy (BC) prediction unit (not shown). The intra BC prediction unit performs intra BC prediction from reconstructed samples in the current picture and transmits intra BC coding information to the entropy coding unit 160. The intra BC prediction unit obtains block vector values ​​indicating a reference region to be used for predicting the current region by referring to a specific region in the current picture. The intra BC prediction unit performs intra BC prediction using the obtained block vector values. The intra BC prediction unit transmits the intra BC coding information to the entropy coding unit 160. The intra BC prediction unit includes the block vector information.

[0029] When the above-mentioned picture prediction is performed, the transform unit 110 converts residual values ​​between the original picture and the predicted picture to obtain transform coefficient values. At this time, the transform is performed in units of specific blocks within the picture, and the size of the specific blocks varies within a preset range. The quantization unit 115 quantizes the transform coefficient values ​​generated by the transform unit 110 and transfers the quantized values ​​to the entropy coding unit 160.

[0030] The entropy coding unit 160 generates a video signal bit stream by entropy coding information indicating quantized transform coefficients, intra-coding information, and inter-coding information. The entropy coding unit 160 uses a variable length coding (VLC) method, an arithmetic coding method, and the like. The variable length coding (VLC) method converts input symbols into consecutive code words, but the length of the code words is variable. For example, frequently occurring symbols are represented by short code words, and infrequently occurring symbols are represented by long code words. As the variable length coding method, a context-based adaptive variable length coding (CAVLC) method is used. In arithmetic coding, consecutive data symbols are converted into one prime number, and arithmetic coding obtains optimal prime number bits required to represent each symbol. As the arithmetic coding, a context-based adaptive binary arithmetic coding (CABAC) method is used. For example, the entropy coding unit 160 may binarize information indicating the quantized transform coefficients, and may arithmetically code the binarized information to generate a bitstream.

[0031] The generated bitstream is encapsulated in a basic unit of Network Abstraction Layer (NAL) units. An NAL unit includes an integer number of coded coding tree units. In order for a video decoder to decode the bitstream, the bitstream must first be separated into NAL units and then each separated NAL unit must be decoded. Meanwhile, information required for decoding the video signal bitstream is transmitted via Raw Byte Sequence Payload (RBSP) of higher level sets such as a Picture Parameter Set (PPS), a Sequence Parameter Set (SPS), a Video Parameter Set (VPS), etc.

[0032] 1 illustrates an encoding apparatus 100 according to one embodiment of the present invention, with separate blocks illustrating logically distinct elements of encoding apparatus 100. Thus, the elements of encoding apparatus 100 described above may be implemented on a single chip or multiple chips depending on the device design. According to one embodiment, the operation of each of the elements of encoding apparatus 100 described above is performed by a processor (not shown).

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

[0034] The entropy decoding unit 210 entropy decodes the video signal bitstream to extract transform coefficient information, intra-coding information, inter-coding information, etc. for each region. For example, the entropy decoding unit 210 may obtain a binary code for transform coefficient information of a specific region from the video signal bitstream. The entropy decoding unit 210 also de-binarizes the binary code to obtain quantized transform coefficients. The inverse quantization unit 220 inverse quantizes the quantized transform coefficients, and the inverse transform unit 225 restores residual values ​​using the inverse quantized transform coefficients. The video signal processing device 200 combines the residual values ​​obtained from the inverse transform unit 225 with the predicted values ​​obtained from the prediction unit 250 to restore original pixel values.

[0035] Meanwhile, the filtering unit 230 performs filtering on the picture to improve image quality, including a deblocking filter for reducing block distortion and / or an adaptive loop filter for removing distortion of the entire picture, etc. The filtered picture is output or stored in a decoded picture buffer (DPB) 256 to be used as a reference picture for the next picture.

[0036] The prediction unit 250 includes an intra prediction unit 252 and an inter prediction unit 254. The prediction unit 250 generates a predicted picture using the coding type, the transform coefficient for each region, the intra / inter coding information, etc., decoded through the entropy decoding unit 210. To reconstruct the current block to be decoded, the current picture including the current block or a decoded region of another picture can be used. A picture (or tile / slice) that uses only the current picture for reconstruction, i.e., performs intra prediction or intra BC prediction, is called an intra picture or I picture (or tile / slice), and a picture (or tile / slice) that can perform all of intra prediction, inter prediction, and intra BC prediction is called an inter picture (or tile / slice). Among interpictures (or tiles / slices), a picture (or tile / slice) that uses at most one motion vector and reference picture index to predict sample values ​​of each block is called a predictive picture or P picture (or tile / slice), and a picture (or tile / slice) that uses at most two motion vectors and reference picture indexes is called a bi-predictive picture or B picture (or tile / slice). In other words, a P picture (or tile / slice) uses at most one motion information set to predict each block, and a B picture (or tile / slice) uses at most two motion information sets to predict each block. Here, a motion information set includes one or more motion vectors and one reference picture index.

[0037] The intra prediction unit 252 generates a prediction block using intra coding information and reconstructed samples in the current picture. As described above, the intra coding information includes at least one of an intra prediction mode, a MOST Probable Mode (MPM) flag, and an MPM index. The intra prediction unit 252 predicts sample values ​​of the current block using reconstructed samples located 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 refer to pixels. Also, a sample value refers to a pixel value.

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

[0039] The inter prediction unit 254 generates a prediction block using the reference picture and inter coding information stored in the decoded picture buffer 256. The inter coding information includes a motion information set (reference picture index, motion vector, etc.) of a current block with respect to a reference block. Inter prediction includes L0 prediction, L1 prediction, and bi-prediction. L0 prediction means a prediction using one reference picture included in an L0 picture list, and L1 prediction means a prediction using one reference picture included in an L1 picture list. For this purpose, one set of motion information (e.g., motion vector and reference picture index) is required. In the bi-prediction method, a maximum of two reference regions are used, and the two reference regions may exist in the same reference picture or may exist in different pictures. That is, in the bi-prediction method, a maximum of two sets of motion information (e.g., motion vector and reference picture index) are used, and the two motion vectors may correspond to the same reference picture index or may correspond to different reference picture indexes. In this case, the reference picture may be displayed (or output) either before or after the current picture in terms of time. According to one embodiment, in a bi-prediction scheme, the two reference regions used may be regions selected from the L0 picture list and the L1 picture list, respectively.

[0040] The inter prediction unit 254 obtains a current reference block using a motion vector and a reference picture index. The reference block exists in a reference picture corresponding to the reference picture index. In addition, a sample value of a block identified by the motion vector or an interpolated value thereof is used as a predictor of the current block. For motion prediction with pixel accuracy in sub-pel units, for example, an 8-tab interpolation filter is used for a luminance signal, and a 4-tab interpolation filter is used for a chrominance signal. However, the interpolation filter for sub-pel unit motion prediction is not limited thereto. In this way, the inter prediction unit 254 performs motion compensation to predict the texture of the current unit from a previously restored picture. In this case, the inter prediction unit uses a motion information set.

[0041] According to a further embodiment, the prediction unit 250 may include an intra BC prediction unit (not shown). The intra BC prediction unit may reconstruct the current region by referring to a specific region including reconstructed samples in the current picture. The intra BC prediction unit obtains intra BC coding information for the current region from the entropy decoding unit 210. The intra BC prediction unit obtains block vector values ​​of the current region indicating the specific region in the current picture. The intra BC prediction unit may perform intra BC prediction using the obtained block vector values. The intra BC coding information may include block vector information.

[0042] A reconstructed video picture is generated by summing the predicted value output from the intra prediction unit 252 or the inter prediction unit 254 and the residual value output from the inverse transformation unit 225. That is, the video signal decoding apparatus 200 reconstructs a current block using the predicted block generated by the prediction unit 250 and the residual obtained from the inverse transformation unit 225.

[0043] 2 shows a block diagram of a decoding apparatus 200 according to an embodiment of the present invention, with separate blocks illustrating the logical separation of elements of the decoding apparatus 200. Thus, the elements of the decoding apparatus 200 described above may be implemented on a single chip or multiple chips depending on the device design. According to one embodiment, the operation of each element of the decoding apparatus 200 described above is performed by a processor (not shown).

[0044] FIG. 3 illustrates an embodiment in which a coding tree unit (CTU) is divided into coding units (CUs) in a picture. In the process of coding a video signal, a picture is divided into a sequence of coding tree units (CTUs). A coding tree unit consists of two blocks, an NXN block of luma samples and a corresponding chroma sample. A coding tree unit is divided into a plurality of coding units. A coding tree unit may be a leaf node without being divided. In this case, the coding tree unit itself may be a coding unit. A coding unit refers to a basic unit for processing a picture in the above-mentioned video signal processing process, i.e., in the process of intra / inter prediction, transformation, quantization, and / or entropy coding. In one picture, the size and pattern of the coding units are not constant. The coding units have a square or rectangular pattern. 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 refers to a rectangular block, but the present invention is not limited to this.

[0045] Referring to Figure 3, the coding tree unit is first divided into a quad tree (QT) structure. That is, in the quad tree structure, one node having a size of 2N x 2N is divided into four nodes having a size of N x N. In this specification, the quad tree is also referred to as a quaternary tree. The quad tree division is performed recursively, and it is not necessary that all nodes are divided to the same depth.

[0046] Meanwhile, the leaf node of the above-mentioned quad tree is further divided into a Multi-Type Tree (MTT) structure. According to an embodiment of the present invention, in the Multi-Type Tree structure, one node is divided into a horizontally or vertically divided binary or ternary tree structure. That is, the Multi-Type Tree structure has four division structures, namely, vertical binary division, horizontal binary division, vertical ternary division, and horizontal ternary division. According to an embodiment of the present invention, in each of the tree structures, the width and height of the node are both powers of 2. For example, in a Binary Tree (BT) structure, a node of size 2N×2N is divided into two N×2N nodes by vertical binary division and divided into two 2N×N nodes by horizontal binary division. In addition, in a Ternary Tree (TT) structure, a node of size 2N x 2N is divided into (N / 2) x 2N, N x 2N, and (N / 2) x 2N nodes by vertical ternary division, and into 2N x (N / 2), 2N x N, and 2N x (N / 2) nodes by horizontal ternary division. Such multi-type tree division is performed recursively.

[0047] A leaf node of a multi-type tree can be a coding unit. If no division is indicated for a coding unit or the coding unit is not larger than the maximum transform length, the coding unit is used as a unit of prediction and transformation without further division. Meanwhile, in the above-mentioned quad tree and multi-type tree, at least one of the following parameters is predefined or transmitted via the RBSP of a higher level set such as PPS, SPS, VPS, etc. 1) CTU size: size of the root node of the quad tree, 2) MinQT size (MinQtSize): size of the minimum QT leaf node allowed, 3) MaxBt size (MaxBtSize): size of the maximum BT root node allowed, 4) MaxTt size (MaxTtSize): size of the maximum TT root node allowed, 5) MaxMttDepth (MaxMttDepth): maximum allowed depth of MTT division from the QT leaf node, 6) MinBt size (MinBtSize): size of the minimum BT leaf node allowed, 7) MinTT size: size of the minimum TT leaf node allowed.

[0048] 4 illustrates an embodiment of a method for signaling the split of a quad tree and a multi-type tree. A preset flag may be used to signal the split of the quad tree and the multi-type tree. Referring to FIG. 4, at least one of a flag 'qt_split_flag' indicating whether to split a quad tree node, a flag 'mtt_split_flag' indicating whether to split a multi-type tree node, a flag 'mtt_split_vertical_flag' indicating the split direction of a multi-type tree node, or a flag 'mtt_split_binary_flag' indicating the split type of a multi-type tree node may be used.

[0049] According to an embodiment of the present invention, the coding tree unit is the root node of a quad tree and can be split into a quad tree structure in advance. In the quad tree structure, 'qt_split_flag' is signaled for each node 'QT_node'. If the value of 'qt_split_flag' is 1, the corresponding node is split into four regular square nodes, and if the value of 'qt_split_flag' is 0, the corresponding node becomes a leaf node 'QT_leaf_node' of the quad tree.

[0050] Each quad tree leaf node 'QT_leaf_node' can be further split into a multi-type tree structure. In the multi-type tree structure, 'mtt_split_flag' is signaled for each node 'MTT_node'. If the value of 'mtt_split_flag' is 1, the corresponding node is split into multiple rectangular nodes, and if the value of 'mtt_split_flag' is 0, the corresponding node becomes the leaf node 'MTT_leaf_node' of the multi-type tree. If the multi-type tree node 'MTT_node' is split into multiple rectangular nodes (i.e., if the value of 'mtt_split_flag' is 1), 'mtt_split_vertical_flag' and 'mtt_split_binary_flag' can be additionally signaled for the node 'MTT_node'. If the value of 'mtt_split_vertical_flag' is 1, the node 'MTT_node' is split vertically, and if the value of 'mtt_split_vertical_flag' is 0, the node 'MTT_node' is split horizontally. If the value of 'mtt_split_binary_flag' is 1, the node 'MTT_node' is split into two rectangular nodes, and if the value of 'mtt_split_binary_flag' is 0, the node 'MTT_node' is split into three rectangular nodes.

[0051] Picture prediction (motion compensation) for coding is performed on coding units that cannot be further divided (i.e., leaf nodes of a coding unit tree). The basic unit for performing such prediction is hereinafter referred to as a prediction unit or a prediction block.

[0052] Hereinafter, the term "unit" used in this specification is used as an alternative term to the prediction unit, which is a basic unit for performing prediction, but the present invention is not limited thereto, and in a broader sense, the term "unit" is understood as a concept including the coding unit.

[0053] 5 and 6 are diagrams illustrating in more detail an intra prediction method according to an embodiment of the present invention. As described above, the intra prediction unit predicts sample values ​​of a current block using reconstructed samples located to the left and / or above the current block as reference samples.

[0054] First, Fig. 5 shows an example of a reference sample used to predict a current block in an intra prediction mode. According to an example, the reference sample is a sample adjacent to the left boundary and / or the top boundary of the current block. As shown in Fig. 5, if the size of the current block is W x H and a sample of a single reference line adjacent to the current block is used for intra prediction, the reference sample is set using up to 2W + 2H + 1 neighboring samples located to the left and / or top of the current block.

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

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

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

[0058] Hereinafter, an inter prediction method according to an embodiment of the present invention will be described with reference to Fig. 7. In the present invention, the inter prediction method may include a general inter prediction method optimized for translation motion and an affine model-based inter prediction method. In addition, the motion vector may include at least one of a general motion vector for motion compensation based on the inter prediction method and a control point motion vector for affine motion compensation.

[0059] FIG. 7 illustrates an inter-prediction method according to an embodiment of the present invention. As described above, a decoder can predict a current block by referring to reconstructed samples of other decoded pictures. Referring to FIG. 7, the decoder obtains a reference block 702 in a reference picture 720 based on a motion information set of a current block 701. In this case, the motion information set may include a reference picture index and a motion vector 703. The reference picture index indicates a reference picture 720 in a reference picture list in which a reference block for inter-prediction of the current block is included. According to an embodiment, the reference picture list may include at least one of the above-mentioned L0 picture list or L1 picture list. The motion vector 703 indicates an offset between the coordinate value of the current block 701 in the current picture 710 and the coordinate value of the reference block 702 in the reference picture 720. The decoder obtains a predictor of the current block 701 based on a sample value of the reference block 702, and reconstructs the current block 701 using the predictor.

[0060] Specifically, the encoder may obtain the reference block by searching for a block similar to the current block in a picture with an earlier reconstruction order. For example, the encoder may search for a reference block in which the sum of differences between the current block and sample values ​​is the smallest within a preset search area. In this case, at least one of SAD (Sum Of Absolute Difference) and SATD (Sum of Hadamard Transformed Difference) may be used to measure the similarity between the current block and the reference block samples. Here, SAD may be a value obtained by adding up all absolute values ​​of differences between sample values ​​included in two blocks. Also, SATD may be a value obtained by adding up all absolute values ​​of Hadamard transform coefficients obtained by performing Hadamard transform on the differences between sample values ​​included in two blocks.

[0061] Meanwhile, the current block may be predicted using one or more reference regions. As described above, the current block may be inter-predicted by a bi-prediction method using two or more reference regions. According to an embodiment, the decoder may obtain two reference blocks based on two sets of motion information of the current block. Also, the decoder may obtain a first predictor and a second predictor of the current block based on sample values ​​of each of the obtained two reference blocks. Also, the decoder may reconstruct the current block using the first predictor and the second predictor. For example, the decoder may reconstruct the current block based on a sample-by-sample average of the first predictor and the second predictor.

[0062] As described above, one or more motion information sets can be signaled for motion compensation of the current block. In this case, similarity between the motion information sets for each of the motion compensation of a plurality of blocks can be used. For example, the motion information set used for predicting the current block can be derived from the motion information set used for predicting one of the other samples that have already been reconstructed. Through this, the encoder and decoder can reduce signaling overhead. Hereinafter, various embodiments in which the motion information set of the current block is signaled will be described.

[0063] For example, there may be a plurality of candidate blocks that may be predicted based on a motion information set that is the same as or similar to the motion information set of the current block. The decoder may generate a merge candidate list based on the plurality of candidate blocks. Here, the merge candidate list may include candidates corresponding to samples that may be predicted based on a motion information set related to the motion information set of the current block among samples reconstructed before the current block. The encoder and the decoder may configure the merge candidate list of the current block based on a predefined rule. In this case, the merge candidate lists respectively configured by the encoder and the decoder may be the same as each other. For example, the encoder and the decoder may configure the merge candidate list of the current block based on the position of the current block in the current picture. The method of the encoder and the decoder configuring the merge candidate list of the current block will be described later with reference to FIG. 9. In the present disclosure, the position of a specific block represents a relative position of a top-left sample of the specific block in a picture including the specific block.

[0064] Meanwhile, in order to improve coding efficiency, a method may be used in which the residual signal is not directly coded, but the transform coefficient values ​​obtained by transforming the residual signal are quantized, and the quantized transform coefficients are coded. As described above, the transform unit may obtain transform coefficient values ​​by transforming the residual signal. In this case, the residual signal of a specific block may be distributed over the entire region of the current block. Thus, energy may be concentrated in a low frequency region using a frequency domain transform on the residual signal, thereby improving coding efficiency. Hereinafter, a method of transforming or inverse transforming the residual signal will be described in detail.

[0065] FIG. 8 is a diagram specifically illustrating a method in which an encoder transforms a residual signal. As described above, a residual signal in the spatial domain may be transformed into a frequency domain. The encoder may transform the obtained residual signal to obtain transform coefficients. First, the encoder may obtain at least one residual block including a residual signal for a current block. The residual block may be either the current block or a block divided from the current block. In the present disclosure, the residual block may be referred to as a residual array or a residual matrix including residual samples of the current block. In addition, in the present disclosure, the residual block refers to a block having the same size as the size of a transform unit or a transform block.

[0066] Next, the encoder may transform the residual block using a transform kernel. The transform kernel used for transforming the residual block may be a transform kernel having separable characteristics of vertical transform and horizontal transform. In this case, the transform of the residual block may be performed separately into vertical transform and horizontal transform. For example, the encoder may perform a vertical transform by applying a transform kernel to the vertical direction of the residual block. Also, the encoder may perform a horizontal transform by applying a transform kernel to the horizontal direction of the residual block. In the present disclosure, the transform kernel may be used as a term representing a parameter set used for transforming the residual signal, such as a transform matrix, a transform array, a transform function, or a transform. According to an embodiment, the transform kernel may be any one of a plurality of available kernels. Also, a transform kernel based on a different transform type may be used for each of the vertical transform and the horizontal transform. A method for selecting any one of a plurality of available transform kernels will be described later with reference to FIG. 12 to FIG. 26.

[0067] The encoder may transmit the transform block transformed from the residual block to a quantization unit for quantization. At this time, the transform block may include a plurality of transform coefficients. Specifically, the transform block may be composed of a plurality of transform coefficients arranged in a two-dimensional array. The size of the transform block may be the same as that of the residual block, or may be the same as that of any one of the current block or blocks divided from the current block. The transform coefficients transmitted to the quantization unit may be represented as quantized values.

[0068] Also, the encoder may perform an additional transform before the transform coefficients are quantized. As shown in FIG. 8, the above-described transform method may be called a primary transform, and the additional transform may be called a secondary transform. The secondary transform may be selective for each residual block. According to an embodiment, the encoder may perform a secondary transform on a region where it is difficult to concentrate energy in a low frequency region by the primary transform alone, thereby improving coding efficiency. For example, a secondary transform may be added to a block in which the residual value is significantly present in a direction other than the horizontal or vertical direction of the residual block. The residual value of the intra predicted block may be more likely to change in a direction other than the horizontal or vertical direction than the residual value of the inter predicted block. Accordingly, the encoder may further perform a secondary transform on the residual signal of the intra predicted block. Also, the encoder may omit the secondary transform on the residual signal of the inter predicted block.

[0069] As another example, whether to perform the secondary transform may be determined according to the size of the current block or the residual block. Also, transform kernels of different sizes may be used according to the size of the current block or the residual block. For example, an 8×8 secondary transform may be applied to a block whose shorter side of the width or height is shorter than a first preset length. Also, a 4×4 secondary transform may be applied to a block whose shorter side of the width or height is longer than a second preset length. In this case, the first preset length may be greater than the second preset length, but the present disclosure is not limited thereto. Also, unlike the primary transform, the secondary transform may not be separated into a vertical transform and a horizontal transform. Such a secondary transform may be called a Low Frequency Non-Separable Transform (LFNST).

[0070] In addition, in the case of a video signal of a specific region, high frequency band energy may not be reduced even if frequency transformation is performed due to a sudden brightness change. This may result in a decrease in compression performance due to quantization. In addition, when transformation is performed on a region where residual values ​​rarely exist, encoding time and decoding time may be unnecessarily increased. For this reason, transformation of the residual signal of the specific region may be omitted. Whether or not to transform the residual signal of the specific region may be determined by a syntax element related to the transformation of the specific region. For example, the syntax element may include transform skip information. The transform skip information may be a transform skip flag. If the transform skip information for a residual block indicates a transform skip, the transformation of the residual block is not performed. In this case, the encoder may immediately quantize the residual signal of the corresponding region that is not transformed. The operation of the encoder described with reference to FIG. 8 may be performed by the transform unit of FIG. 1.

[0071] The aforementioned transform-related syntax elements may be information parsed from a video signal bitstream. A decoder may entropy decode the video signal bitstream to obtain the transform-related syntax elements. An encoder may entropy code the transform-related syntax elements to generate a video signal bitstream.

[0072] FIG. 9 is a diagram specifically illustrating a method in which an encoder and a decoder inversely transform transform coefficients to obtain a residual signal. For convenience of explanation, it will be described below that an inverse transform operation is performed in each inverse transform unit of an encoder and a decoder. The inverse transform unit may inversely transform the inverse quantized transform coefficients to obtain a residual signal. First, the inverse transform unit may detect whether an inverse transform is performed on a specific region from a transform-related syntax element of the specific region. According to an embodiment, if a transform-related syntax element for a specific transform block indicates a transform skip, a transform for the specific transform block may be omitted. In this case, the above-mentioned first inverse transform and second inverse transform may both be omitted for the transform block. Also, the inverse quantized transform coefficients may be used as a residual signal. For example, the decoder may restore a current block using the inverse quantized transform coefficients as a residual signal.

[0073] In another embodiment, a transform-related syntax element for a specific transform block may not indicate a transform skip. In this case, the inverse transform unit may determine whether to perform a secondary inverse transform for the secondary transform. For example, if the transform block is a transform block of an intra-predicted block, a secondary inverse transform may be performed on the transform block. Also, a secondary transform kernel to be used for the transform block may be determined based on an intra-prediction mode corresponding to the transform block. As another example, whether to perform a secondary inverse transform may be determined based on a size of the transform block. The secondary inverse transform may be performed after an inverse quantization process and before a primary inverse transform is performed.

[0074] The inverse transform unit may perform a primary inverse transform on the inverse quantized transform coefficients or the transform coefficients that have been subjected to the secondary inverse transform. In the case of the primary inverse transform, the primary inverse transform may be performed separately into a vertical transform and a horizontal transform, as in the primary transform. For example, the inverse transform unit may perform a vertical inverse transform and a horizontal inverse transform on the transform block to obtain a residual block. The inverse transform unit may inverse transform the transform block based on a transform kernel used in transforming the transform block. For example, the encoder may explicitly or implicitly signal information indicating a transform kernel applied to a current transform block from among a plurality of available transform kernels. The decoder may select a transform kernel to be used for inverse transforming the transform block from among a plurality of available transform kernels using the information indicating the signaled transform kernel. The inverse transform unit may restore the current block using a residual signal obtained by inverse transforming the transform coefficients.

[0075] 10 is a diagram illustrating a motion vector signaling method according to an embodiment of the present invention. According to an embodiment of the present invention, a motion vector (MV) may be generated based on a motion vector prediction (or predictor) (MVP). As an example, the MV may be determined to be the MVP as shown in the following mathematical formula 1. In other words, the MV may be determined (or set, induced) to be the same value as the MVP.

[0076]

number

[0077] As another example, the MV may be determined based on the MVP and a motion vector difference (MVD), as shown in the following Mathematical Formula 2. The encoder can signal MVD information to the decoder to indicate a more accurate MV, and the decoder can derive the MV by adding the obtained MVD to the MVP.

[0078]

number

[0079] According to an embodiment of the present invention, an encoder transmits the determined motion information to a decoder, and the decoder generates (or induces) an MV from the received motion information and generates a prediction block based on the MV. For example, the motion information may include MVP information and MVD information. In this case, components of the motion information may change depending on an inter prediction mode. For example, in a merge mode, the motion information may include MVP information but may not include MVD information. For another example, in an advanced motion vector prediction (AMVP) mode, the motion information may include MVP information and MVD information.

[0080] In order to determine, transmit, and receive information about MVPs, the encoder and decoder can generate MVP candidates (or MVP candidate lists) in the same manner. For example, the encoder and decoder can generate the same MVP candidates in the same order. Then, the encoder transmits an index indicating (or pointing to) the determined (or selected) MVP from the generated MVP candidates to the decoder, and the decoder can derive the determined MVP and / or MV based on the received index.

[0081] According to an embodiment of the present invention, the MVP candidate may include a spatial candidate, a temporal candidate, etc. The MVP candidate may be called a merge candidate when a merge mode is applied, and may be called an AMVP candidate when an AMVP mode is applied. The spatial candidate may be an MV (or motion information) for a block at a specific position based on the current block. For example, the spatial candidate may be an MV of a block at a position adjacent or non-adjacent to the current block. The temporal candidate may be an MV corresponding to a block in the current picture and another picture. In addition, for example, the MVP candidate may include an affine MV, ATMVP, STMVP, a combination of the above-mentioned MVs (or candidates), an average MV of the above-mentioned MVs (or candidates), a zero MV, etc.

[0082] In one embodiment, the encoder can signal information indicating the reference picture to the decoder. As an embodiment, when the reference picture of the MVP candidate is different from the reference picture of the current block (or the currently processed block), the encoder / decoder can scale the MV of the MVP candidate (motion vector scaling). In this case, the MV scaling can be performed based on the picture order count (POC) of the current picture, the POC of the reference picture of the current block, and the POC of the reference picture of the MVP candidate.

[0083] A specific embodiment of the MVD signaling method will be described below. Table 1 below illustrates a syntax structure for MVD signaling.

[0084] [Table 1]

[0085] Referring to Table 1, according to an embodiment of the present invention, the MVD may be coded by separating the sign and absolute value of the MVD. That is, the sign and absolute value of the MVD may be different syntaxes (or syntax elements). The absolute value of the MVD may be directly coded or may be coded stepwise based on a flag indicating whether the absolute value is greater than N as in Table 1. If the absolute value is greater than N, the value of (absolute value-N) may be signaled together. Specifically, in the example of Table 1, abs_mvd_greater0_flag indicating whether the absolute value is greater than 0 may be transmitted. If the abs_mvd_greater0_flag indicates (or indicates) that the absolute value is not greater than 0, the absolute value of the MVD may be determined to be 0. Also, if abs_mvd_greater0_flag indicates that the absolute value is greater than 0, additional syntax (or syntax elements) may be present.

[0086] For example, abs_mvd_greater1_flag may be transmitted to indicate whether the absolute value is greater than 1. If abs_mvd_greater1_flag indicates (or indicates) that the absolute value is not greater than 1, the absolute value of the MVD may be determined to be 1. If abs_mvd_greater1_flag indicates that the absolute value is greater than 1, additional syntax may be present. For example, abs_mvd_minus2 may be present. abs_mvd_minus2 may be a value of (absolute value-2). Because the abs_mvd_greater0_flag and abs_mvd_greater1_flag values ​​determine that the absolute value is greater than 1 (i.e., 2 or greater), the value of (absolute value-2) may be signaled. In this way, by hierarchically signaling information about the absolute value using syntax, fewer bits can be used compared to the case where the absolute value is directly binarized and signaled.

[0087] In one embodiment, the absolute value related syntax described above may be coded using a variable length binarization method such as Exponential-Golomb, truncated unary, truncated Rice, etc. Also, a flag indicating the sign of the MVD may be signaled by mvd_sign_flag.

[0088] In the above embodiment, a coding method for MVD has been described, but information other than MVD can also be signaled by dividing the sign and absolute value. The absolute value can be coded as a flag indicating whether the absolute value is greater than a predefined specific value and a value obtained by subtracting the specific value from the absolute value. In Table 1, [0] and [1] can represent component indexes. For example, they can represent x-component (i.e., horizontal component) and y-component (i.e., vertical component).

[0089] FIG. 11 is a diagram illustrating a method of signaling adaptive motion vector resolution information according to an embodiment of the present invention. According to an embodiment of the present invention, the resolution for indicating MV or MVD may be various. For example, the resolution may be expressed based on pixels (or pels). For example, MV or MVD may be signaled in units of 1 / 4, 1 / 2, 1 (integer), 2, 4 pixels, etc. Then, the encoder may signal the resolution information of MV or MVD to the decoder. Also, for example, 16 may be coded as 64 in 1 / 4 units (1 / 4*64=16), coded as 16 in 1 units (1*16=16), and coded as 4 in 4 units (4*.4=16). That is, the MV or MVD value may be determined by the following mathematical formula 3.

[0090]

number

[0091] In Equation 3, valueDetermined represents an MV or MVD value. Also, valuePerResolution represents a value signaled based on the determined resolution. In this case, if the value signaled by MV or MVD is not divisible by the determined resolution, a rounding process or the like may be applied. Using a high resolution may improve accuracy, but many bits may be used because the coded value is large, and using a low resolution may reduce accuracy, but fewer bits may be used because the coded value is small. In one embodiment, the above-mentioned resolution may be set individually in units such as a sequence, a picture, a slice, a coding tree unit (CTU), a coding unit (CU), etc. That is, the encoder / decoder may adaptively determine / apply the resolution according to a predefined unit among the above-mentioned units.

[0092] According to an embodiment of the present specification, the above-mentioned resolution information may be signaled from the encoder to the decoder. At this time, the resolution information may be binarized and signaled based on the above-mentioned variable length. In this case, if the resolution information is signaled based on an index corresponding to a minimum value (i.e., the first value), signaling overhead can be reduced. As an embodiment, the resolution information may be mapped to a signaling index in the order from high resolution to low resolution.

[0093] According to an embodiment of the present specification, FIG. 11 illustrates a signaling method assuming that three resolutions are used among various multiple resolutions. In this case, the three signaling bits may be 0, 10, and 11, and the three signaling indexes may represent a first resolution, a second resolution, and a third resolution, respectively. Since one bit is required to signal the first resolution and two bits are required to signal the remaining resolutions, the signaling overhead can be relatively reduced when signaling the first resolution. In the example of FIG. 11, the first resolution, the second resolution, and the third resolution may be defined as 1 / 4, 1, and 4 pixel resolutions, respectively. In the following embodiment, MV resolution may refer to the resolution of the MVD.

[0094] 12 is a diagram illustrating a history-based motion vector prediction (HMVP) method according to an embodiment of the present invention. As described above, the encoder / decoder can use spatial candidates, time candidates, etc. as motion vector candidates, and in one embodiment of the present invention, the encoder / decoder can further use a history-based motion vector, i.e., HMVP, as a motion vector candidate.

[0095] According to an embodiment of the present specification, an encoder / decoder may store motion information of a previously coded block in a table. In the present specification, HMVP represents motion information of a previously coded block. That is, an encoder / decoder may store HMVP in a table. In the present specification, a table for storing the HMVP is referred to as a table or an HMVP table, but the present invention is not limited to such names. As an example, the table (or the HMVP table) may be referred to as a buffer, an HMVP buffer, an HMVP candidate buffer, an HMVP list, an HMVP candidate list, etc.

[0096] The motion information stored in the HMVP table may include at least one of an MV, a reference list, a reference index, or a utilization flag. For example, the motion information may include at least one of an MV of a reference list L0, an MV of an L1, an L0 reference index, an L1 reference index, an L0 prediction list utilization flag, or an L1 prediction list utilization flag. In this case, the prediction list utilization flag may indicate whether the information is available for the corresponding list, whether the information is significant, etc.

[0097] Also, according to an embodiment of the present specification, the motion information stored in the HMVP table may be generated / stored on a history-based basis. The history-based motion information represents motion information of blocks coded before the current block in the coding order. For example, the encoder / decoder may store motion information of blocks coded before the current block in the HMVP table. In this case, the blocks may be coding units (CUs) or prediction units (PUs). The motion information of the blocks may refer to motion information used for motion compensation of the blocks or motion information candidates used for motion compensation. The motion information stored in the HMVP table (i.e., HMVP) may be used for motion compensation of blocks to be encoded / decoded later. For example, the motion information stored in the HMVP table may be used for motion candidate list construction.

[0098] Referring to FIG. 12, the encoder / decoder may retrieve one or more HMVP candidates from an HMVP table (S1201). Then, the encoder / decoder may add the HMVP candidates to a motion candidate list. For example, the motion candidate list may be a merge candidate list (or a merge list) or an AMVP candidate list (or an AMVP list). Then, the encoder / decoder may perform motion compensation and encoding / decoding for a current block based on the motion candidate list (S1202). The encoder / decoder may update the HMVP table using information used in motion compensation or decoding of the current block (S1203).

[0099] According to an embodiment of the present invention, the HMVP candidates may be used in the merge candidate list construction process. The latest HMVP candidates in the HMVP table may be checked in order and inserted (or added) to the merge candidate list in the order following the temporal motion vector prediction (or predictor) (TMVP) candidate. Also, when adding an HMVP candidate, a pruning process (or pruning check) may be performed on the spatial or temporal merge candidates included in the merge list except for the sub-block motion candidate (i.e., ATMVP). In one embodiment, in order to reduce the number of pruning operations, the following embodiment may be applied.

[0100] 1) For example, the number of HMPV candidates may be set according to the following mathematical formula 4.

[0101]

number

[0102] In Equation 4, L represents the number of HMVP candidates, N represents the number of available non-sub block merging candidates, and M represents the number of HMVP candidates available in the table. For example, N may indicate the number of non-sub block merging candidates included in the merging candidate list. If N is less than or equal to 4, the number of HMVP candidates may be determined as M, otherwise, the number of HMVP candidates may be determined as (8-N).

[0103] 2) Also, for example, the process of constructing a merge candidate list from the HMVP list may terminate once the total number of available merge candidates reaches the signaled maximum allowed number of merge candidates minus one.

[0104] 3) Also, for example, the number of candidate pairs for derivation of a combined bi-predictive merge candidate may be reduced from 12 to 6.

[0105] According to an embodiment of the present invention, HMVP candidates may also be used in the AMVP candidate list construction process. The motion vectors of the HMVP candidates with the last K indexes in the table may be inserted following the TMVP candidates. In an embodiment, only HMVP candidates with the same reference picture as the AMVP target reference picture may be used to construct the AMVP candidate list. In this case, the pruning process described above may also be applied to the HMVP candidates. For example, the above-mentioned K may be set to 4, and the size (or length) of the AMVP list may be set to 2.

[0106] FIG. 13 is a diagram illustrating a method of updating an HMVP table according to an embodiment of the present invention. According to an embodiment of the present invention, the HMVP table may be maintained / managed in a FIFO (first-in, first-out) manner. That is, when there is a new input, the oldest element (or candidate) may be output first. For example, when adding motion information used in a current block to an HMVP table, if the maximum number of elements in the HMVP table is filled, the encoder / decoder may output the oldest added motion information from the HMVP table and add the motion information used in the current block to the HMVP table. In this case, when outputting motion information existing in an existing HMVP table, the encoder / decoder may move the motion information at the next position (or index) while filling the output position. For example, when the HMVP table index of the output motion information is m and the oldest element is located at HMVP table index 0, the motion information corresponding to index n, which is greater than m, may be moved to the index (n-1) position of the HMVP table. This leaves the high index positions empty in the HMVP table, and the encoder / decoder can assign the highest index in the HMVP table to the motion information used for the current block, i.e., the motion information of the current block may be inserted at index (M+1) when the maximum index containing a valid element is M.

[0107] According to an embodiment of the present invention, the encoder / decoder may apply a pruning process when updating the HMVP table based on specific motion information. That is, the encoder / decoder may check whether the specific motion information or information corresponding to the specific motion information is included in the HMVP table. Then, the encoder / decoder may define an HMVP table update method separately for when duplicate motion information is included and when it is not. This may prevent duplicate motion information from being included in the HMVP table and allow various candidates to be considered for motion compensation.

[0108] In one embodiment, when the encoder / decoder updates the HMVP table based on the motion information used for the current block, if the motion information is already included in the HMVP table, the encoder / decoder may delete the duplicated motion information already included in the HMVP table and add the motion information to the HMVP table. In this case, the method described for FIFO may be used prior to the method of deleting the existing candidate and adding the new candidate. That is, the index of the motion information to be currently added in the HMVP table may be determined as m, and the most recent motion information may be output. If the motion information is not already included in the HMVP table, the encoder / decoder may delete the most recently added motion information and add the motion information to the HMVP table.

[0109] In another embodiment, when updating the HMVP table based on the motion information used for the current block, the encoder / decoder may leave the HMVP table unchanged if the motion information is already included in the HMVP table, and may update the HMVP table in a FIFO manner if the motion information is not already included.

[0110] According to an embodiment of the present invention, the encoder / decoder may initialize (or reset) the HMVP table at a predefined time or at a predefined position. The encoder and decoder must use the same motion candidate list, so the encoder and decoder must use the same HMVP table. If the HMVP table is used continuously without being initialized, there is a problem that dependency between coding blocks occurs. Therefore, it is necessary to reduce the dependency between blocks to support parallel processing, and an operation of initializing the HMVP table may be preset according to a unit supporting parallel processing. For example, the encoder / decoder may be set to initialize the HMVP table at a slice level, a CTU row level, a CTU level, etc. For example, if the initialization of the HMVP table is defined at the CTU row level, the encoder / decoder may perform encoding / decoding with the HMVP table empty when starting coding for each CTU row.

[0111] FIG. 14 is a diagram for explaining a method of updating an HMVP table according to an embodiment of the present invention. Referring to FIG. 14, in an embodiment of the present invention, an encoder / decoder can update HMVPCandList based on mvCand. In this specification, HMVPCandList represents an HMVP table, and mvCand represents motion information of a current block. The process shown in FIG. 14 can receive as input a motion candidate mvCand having two motion vectors mvL0 and mvL1, two reference indexes refIdxL0 and refIdxL1, and two prediction list usage flags predFlagL0 and predFlagL1. Then, the process shown in FIG. 14 can output a modified HMVPCandList array.

[0112] In the first step (Step 1), the encoder / decoder can check whether mvCand is the same as HMVPCandList[HMVPIdx] while changing the value of HMVPIdx, which is a variable indicating an index of an HMVP in the HMVP table, from 0 to (HMVPCandNum-1). Here, HMVPCandNum indicates the number of HMVPs included in the HMVP table. And HMVPCandList[HMVPIdx] indicates a candidate in the HMVP table having the HMVPIdx value. If mvCand is the same as HMVPCandList[HMVPIdx], the encoder / decoder can set a variable sameCand, which indicates whether the candidates are the same, to true. In one embodiment, when checking whether mvCand is identical to HMVPCandList[HMVPIdx], the encoder / decoder may perform a comparison on motion information of MVs and reference indices associated with L0, or MVs and reference indices associated with L1, whose prediction list utilization flag is 1.

[0113] Then, in the second step (Step 2), the encoder / decoder may set a variable tempIdx indicating a temporary index to HMVPCandNum. In the third step (Step 3), if sameCand is true or HMVPCandNum is equal to the size (or length) of the maximum HMVP table, the encoder / decoder may copy HMVPCandList[tempIdx] to HMVPCandList[tempIdx-1] while varying tempIdx from (sameCand?HMVPIdx:1) to (HMVPCandNum-1). That is, if sameCand is true, tempIdx starts from HMVPIdx, and the encoder / decoder may set HMVPIdx to the same element index as mvCand in the HMVP table plus 1. Also, if sameCand is false, tempIdx may start from 1, and HMVPCandList[0] may be written with the contents of HMVPCandList[1].

[0114] In the fourth step (Step 4), the encoder / decoder can copy the motion information to be updated, mvCand, to HMVPCandList[tempIdx]. In the fifth step (Step 5), if HMVPCandNum is smaller than the maximum HMVP table size, the encoder / decoder can increment HMVPCandNum by 1.

[0115] FIG. 15 is a diagram for explaining a method of updating an HMVP table according to an embodiment of the present invention. Referring to FIG. 15, in an embodiment of the present invention, an encoder / decoder may start comparing HMVPIdx from a value greater than 0 in the process of checking whether motion information of a current block is included in the HMVP table. For example, when checking whether motion information of a current block is included in the HMVP table, the encoder / decoder may compare HMVPIdx0 except for one corresponding to HMVPIdx0. In other words, the encoder / decoder may compare mvCand starting from a candidate corresponding to HMVPIdx1. The process shown in FIG. 15 may receive as input a motion candidate mvCand having two motion vectors mvL0 and mvL1, two reference indexes refIdxL0 and refIdxL1, and two prediction list use flags predFlagL0 and predFlagL1. The process shown in FIG. 15 may then output a modified HMVPCandList array.

[0116] To further explain the HMVP table update method described in FIG. 14, in the first step, it is possible to check whether there is motion information identical to mvCand from HMVPIdx0. However, in the above-mentioned update method, if mvCand is present in HMVPCandList[0] or is not present in HMVPCandList[HMVPIdx] corresponding to HMVPIdx0 to HMVPCandNum, the motion information of HMVPCandList[0] is output, and if mvCand is present in HMVPCandList[HMVPIdx] among HMVPIdx other than 0, the contents of HMVPCandList[0] are not updated, so mvCand does not need to be compared with HMVPCandList[0]. Also, since the motion information of the current block is similar to the motion information of the spatially adjacent blocks, it is highly likely to be similar to the motion information recently added in the HMVP table. According to this assumption, mvCand may have motion information that is more similar to that of a candidate whose HMVPIdx is greater than 0 than that of a candidate corresponding to HMVPIdx0, and if similar (or identical) motion information is found, the pruning process can be terminated. Therefore, by performing the first step of Figure 14 above from a value of HMVPIdx greater than 0, the number of comparisons can be reduced compared to the embodiment of Figure 14 above.

[0117] FIG. 16 is a diagram for explaining a method of updating an HMVP table according to an embodiment of the present invention. Referring to FIG. 16, in an embodiment of the present invention, an encoder / decoder can compare HMVPIdx from values ​​greater than 0 in a process of checking whether motion information of a current block, i.e., mvCand, is included in the HMVP table. The process shown in FIG. 16 can receive as input a motion candidate mvCand having two motion vectors mvL0 and mvL1, two reference indexes refIdxL0 and refIdxL1, and two prediction list use flags predFlagL0 and predFlagL1. The process shown in FIG. 16 can output a modified HMVPCandList array. For example, when checking whether mvCand is included in the HMVP table, the encoder / decoder can perform a comparison process (or pruning process) by excluding a predefined specific number of motion information (or candidates) whose HMVPIdx value is equal to or greater than 0. Specifically, when a variable indicating the number of elements to be compared is represented by NumPrune, the encoder / decoder can check whether mvCand matches an HMVP table element corresponding to HMVPIdx (HMVPCandNum-NumPrune+1) to (HMVPCandNum-1). This significantly reduces the number of comparisons compared to the previously described embodiment.

[0118] In another embodiment, the encoder / decoder can compare mvCand with a specific position already set in the HMVP table other than HMVPIdx 0. For example, the encoder / decoder can compare mvCand with HMVP table elements corresponding to HMVPIdx PruneStart to (HMVPCandNum-1) to see if there is overlapping motion information.

[0119] FIG. 17 is a diagram for explaining a method of updating an HMVP table according to an embodiment of the present invention. Referring to FIG. 17, in the process of checking whether mvCand is included in the HMVP table, the encoder / decoder may compare mvCand with the HMVP table element from the most recently added to the oldest HMVP table element. The process shown in FIG. 17 may receive as input a motion candidate mvCand having two motion vectors mvL0 and mvL1, two reference indexes refIdxL0 and refIdxL1, and two prediction list use flags predFlagL0 and predFlagL1. The process shown in FIG. 17 may output a modified HMVPCandList array. Since mvCand is likely to be similar to motion information of spatially adjacent blocks, it may be similar to the relatively recently added motion information in the HMVP table. In this manner, if similar (or identical) motion information is found, the pruning process may be terminated. Therefore, as in the embodiment of FIG. 17, by performing comparison starting from the HMVPIdx corresponding to the most recently added element, the number of comparisons can be reduced.

[0120] FIG. 18 is a diagram illustrating a pruning process according to an embodiment of the present invention. According to an embodiment of the present invention, when checking whether motion information of a current block is already included in the HMVP table, the encoder / decoder can compare it with some information of the HMVP table. This is to reduce the complexity of the comparison process. For example, when checking whether motion information is included in HMVPCandList[HMVPIdx], the encoder / decoder can perform the pruning process using a subset of HMVPCandList[HMVPIdx] or HMVPCandList[HMVPIdx] having a predefined index. For example, HMVPCandList[HMVPIdx] may include information on L0 and L1, respectively, and when both L0 and L1 utilization flags are 1, the encoder / decoder can select and compare either L0 or L1 according to a previously set rule (or condition). For example, the pruning process can be performed to check for duplicated motion information only for a smaller reference list of the L0 reference index and the L1 reference index.

[0121] In one embodiment, the encoder / decoder may perform the pruning process only on a smaller reference list of the L0 reference index and the L1 reference index of the motion information of the HMVP table. For example, the encoder / decoder may perform the pruning process only on a smaller reference index of the L0 reference index and the L1 reference index of the motion information of the current block. In another embodiment, the encoder / decoder may compare a value based on a subset of the reference index bits and the motion information bits of the current block with a value based on a subset of the reference index bits and the motion information bits of the HMVP table element to determine whether the current block is already included in the HMVP table. In one embodiment, the value based on the subset of the reference index bits and the motion information bits may be some of the reference index bits and the motion information bits. In another embodiment, the value based on the subset of the reference index bits and the motion information bits may be a value (or an output) obtained by passing the first and second subsets through a hash function. In another embodiment, if the size difference between the two motion vectors in the pruning process is smaller than or equal to a predefined threshold value, the encoder / decoder may determine that the two motion vectors are the same or similar.

[0122] 19 is a diagram illustrating a method of adding an HMVP candidate according to an embodiment of the present invention. According to an embodiment of the present invention, an encoder / decoder can add an MV included in an HMVP table to a motion candidate list. As an example, since the motion of a current block may be similar to a recently added motion and the recently added motion may be useful as a candidate, the encoder / decoder can add the recently added element in the HMVP table to the candidate list.

[0123] In this case, in one embodiment, referring to Fig. 19, the encoder / decoder may add to the candidate list an element having a specific index value, rather than the most recently added HMVP table element, or may add to the candidate list a specific number of previously added elements, rather than the most recently added HMVP table element, rather than the next element.

[0124] Alternatively, in one embodiment, the encoder / decoder may add a certain number of previously added elements excluding one or more of the most recently added HMVP table elements to the candidate list, and in this case, the encoder / decoder may preferentially add relatively recently input motion information among the HMVP table elements to the candidate list.

[0125] The most recently added HMVP table element may correspond to a block spatially adjacent to the current block, and therefore is likely to have already been added as a spatial candidate in the candidate list construction process. Therefore, by constructing a candidate list excluding a specific number of recently added candidates as in this embodiment, it is possible to prevent unnecessary candidates from being added to the candidate list and reduce the complexity of the pruning processor when adding candidates to the candidate list. Although the HMVP table elements and their use have been described with a focus on motion candidate list construction, the present invention is not limited thereto and may be applied to other parameters or inter / intra prediction related information.

[0126] FIG. 20 is a diagram illustrating a merge sharing node according to an embodiment of the present invention. According to an embodiment of the present invention, an encoder / decoder may share the same candidate list for multiple blocks to facilitate parallel processing. The candidate list may be a motion candidate list. The multiple blocks may be defined according to a previously set rule. For example, blocks below a block (or region) that satisfies a specific condition may be defined as the multiple blocks. Or, blocks included in a block that satisfies a specific condition may be defined as the multiple blocks. In this specification, a candidate list that is used by the multiple blocks in common may be called a shared list. If applied to a merge candidate list, it may be called a shared merge list.

[0127] In addition, in this specification, the block satisfying the specific condition may be referred to as a merge sharing node (i.e., the portion indicated by the dotted line in FIG. 20), a shared merge node, a merge sharing region, a shared merge region, a shared merge list node, a shared merge list region, etc. The encoder / decoder may configure a motion candidate list based on motion information of neighboring blocks adjacent to the merge sharing node, thereby ensuring parallel processing of coding units in the merge sharing node. In addition, a threshold value may be used as the above-mentioned specific condition. For example, the block defined as the merge sharing node may be defined (or determined) based on the threshold value. As an example, the threshold value used in the specific condition may be set to a value related to a block size, a width / height of a block.

[0128] FIG. 21 is a diagram for explaining an HMVP update method when a shared list according to an embodiment of the present invention is used. In FIG. 21, it is assumed that the shared list described above in FIG. 20 is used. When a shared list is constructed using HMVP candidates, the encoder and the decoder must maintain the same HMVP table. If an update rule for the HMVP table is not defined based on the motion information used by multiple blocks using the same shared list, the same candidate list cannot be constructed. Therefore, in FIG. 22 to FIG. 24 described later, it is assumed that CU1, CU2, CU3, and CU4 use a shared list in the merge share node shown in FIG. 21, and an HMVP table update method for ensuring the same shared list in the merge share node will be described.

[0129] Figure 22 is a diagram illustrating a method of updating an HMVP table based on motion information of blocks in a merge shared node according to an embodiment of the present invention. Referring to Figure 22, the encoder / decoder can apply the same shared list to CU1, CU2, CU3, and CU4 in the lower node coding units of the merge shared node. Specifically, the encoder / decoder can configure the same motion candidate list for CU1, CU2, CU3, and CU4 based on the motion information of neighboring blocks adjacent to the merge shared node (S2201, S2202, S2203, S2204). The motion candidate list can include motion vector components and reference indexes.

[0130] After inducing or encoding / decoding motion information for CU1, CU2, CU3, and CU4 using the shared motion candidate list, the encoder / decoder may update the HMVP table using the motion information for CU1, CU2, CU3, and CU4 (S2205). In a situation where the same candidate list should be used, that is, if multiple CUs in a merged shared node update their HMVP tables, the same candidate list may not be used. Therefore, according to one embodiment of the present invention, in a situation where a shared list is used, the HMVP table may be updated after MV induction or coding of all CUs belonging to the merged shared node is completed, so that all CUs belonging to the merged shared node can configure motion candidate lists based on the same HMVP table.

[0131] Figure 23 is a diagram for explaining an HMVP update method when a shared list is used according to an embodiment of the present invention. With reference to Figure 23, it is assumed that the shared list described in Figures 20 to 22 is used. In this case, when MV induction or encoding / decoding of each CU in Figure 22 is completed, since there are multiple CUs in the merge shared node, there may be multiple pieces of used motion information.

[0132] According to an embodiment of the present invention, as shown in Fig. 23, the encoder / decoder can update the HMVP table using all the motion information in the merge shared node. In other words, the encoder / decoder can update the HMVP table using the motion information used by all the CUs that use the same shared list. In this case, the update order must already be set in the encoder and the decoder.

[0133] In one embodiment, the encoder / decoder may refer to a regular decoding order as the update order. For example, as shown in FIG. 23, the motion information corresponding to each CU may be used in order as an input for the HMVP table update process according to the regular coding order. Alternatively, in one embodiment, the encoder / decoder may determine an HMVP table update order for the motion information of a plurality of CUs by referring to a reference index order, a POC relationship between a current picture and a reference picture, etc. For example, all the motion information in the merge share node may be updated to the HMVP table in the reference index order. Alternatively, all the motion information in the merge share node may be updated to the HMVP table in the order of low or high POC difference between the current picture and the reference picture.

[0134] 24 is a diagram illustrating a method for updating an HMVP table based on motion information of blocks in a merge shared node according to an embodiment of the present invention. With reference to FIG. 24, it is assumed that the shared list described in FIG. 20 to FIG. 22 is used. In this case, when MV induction or encoding / decoding of each CU in FIG. 22 is completed, since there are multiple CUs in the merge shared node, there may be multiple pieces of used motion information.

[0135] According to an embodiment of the present invention, the encoder / decoder may update the HMVP table using some of the motion information used in a plurality of CUs in the merge sharing node. In other words, the encoder / decoder may not update the motion information of at least some of the CUs in the merge sharing node in the HMVP table. As an example, the encoder / decoder may refer to a regular coding order as the update order. For example, the encoder / decoder may update the HMVP table using a previously set number of pieces of motion information that are late in the decoding order among the motion information corresponding to each CU according to the regular decoding order. This is because a late block in the regular coding order is likely to be spatially adjacent to the next coded block and may require similar motion during motion compensation.

[0136] In one embodiment, referring to Fig. 24, when there are CU1 to CU4 using the same shared list, the encoder / decoder can use only the motion information for CU4, which is coded last in the normal decoding order, for updating the HMVP table. In another embodiment, the encoder / decoder can update the HMVP table using some of the motion information of multiple CUs by referring to the reference index order, the POC relationship between the current picture and the reference picture, etc.

[0137] According to another embodiment of the present invention, when adding an HMVP candidate from an HMVP table to a candidate list, the encoder / decoder may add the HMVP candidate to the candidate list by referring to the relationship between the current block and a block corresponding to an element in the HMVP table. Alternatively, when adding an HMVP candidate from an HMVP table to a candidate list, the encoder / decoder may refer to the positional relationship between the candidate blocks included in the HMVP table. For example, the encoder / decoder may add an HMVP candidate from the HMVP table to the candidate list by considering the decoding order of the HMVP or blocks.

[0138] Fig. 25 is a diagram illustrating a method for processing a video signal based on HMVP according to an embodiment of the present invention. For convenience of explanation, a decoder will be described with reference to Fig. 25, but the present invention is not limited thereto, and the HMVP-based video signal processing method according to this embodiment can be substantially similarly applied to an encoder.

[0139] Specifically, when a current block is located within a merge sharing node including a plurality of coding blocks, the decoder may construct a merge candidate list using spatial candidates adjacent to the merge sharing node (S2501). The decoder may add a specific HMVP in an HMVP table including at least one history-based motion vector predictor (HMVP) to the merge candidate list (S2502). Here, the HMVP represents motion information of a block coded before the plurality of coding blocks.

[0140] The decoder obtains index information indicating a merge candidate used for predicting the current block in the merge candidate list (S2503), and generates a predicted block of the current block based on motion information of the merge candidate (S2504). The decoder may generate a reconstructed block of the current block by adding the predicted block and a residual block. As described above, according to an embodiment of the present invention, motion information of at least one coding block among a plurality of coding blocks included in the merge share node may not be updated in the HMVP table. As described above, the decoder may update the HMVP table using motion information of a predefined number of coding blocks having a relatively late decoding order among a plurality of coding blocks included in the merge share node.

[0141] Also, as described above, the decoder may update the HMVP table using motion information of a coding block that is relatively latest in decoding order among a plurality of coding blocks included in the merge share node. Also, the decoder may update the HMVP table using motion information of the merge candidate if the current block is not located within the merge share node. Also, as described above, the decoder may check whether an HMVP has motion information that overlaps with a candidate in the merge candidate list, using an HMVP having a specific index predefined in the HMVP table.

[0142] FIG. 26 is a diagram for explaining a multi-hypothesis prediction method according to an embodiment of the present invention. According to an embodiment of the present invention, an encoder / decoder may generate a prediction block based on a plurality of prediction methods. In this specification, a prediction method based on such a plurality of prediction modes is called a multi-hypothesis prediction. However, the present invention is not limited to such names, and in this specification, the multi-hypothesis prediction may be called a multiple prediction, a multiple prediction, a combined prediction, an inter-intra weighted prediction, a combined inter-intra prediction, a combined inter-intra weighted prediction, or the like. In one embodiment, the multi-hypothesis prediction may refer to a block generated by any prediction method. In another embodiment, the prediction method in the multi-prediction may include a method such as an intra prediction, an inter prediction, or the like. Alternatively, the prediction method in the multi-prediction may be further divided to refer to a merge mode, an AMVP mode, a specific mode of intra prediction, or the like. In addition, the encoder / decoder may generate a final prediction block by performing a weighted sum of the prediction blocks (or prediction samples) generated based on the multi-prediction.

[0143] According to an embodiment of the present invention, the maximum number of prediction methods used in multi-prediction may be preset. For example, the maximum number of multi-prediction may be 2. Therefore, the encoder / decoder can generate a prediction block by applying two predictions in the case of uni-prediction, and two (i.e., when multi-prediction is used for prediction from only one reference list) or four (i.e., when multi-prediction is used for prediction from two reference lists) predictions in the case of bi-prediction.

[0144] Alternatively, according to an embodiment of the present invention, prediction modes available for multiple hypothesis prediction may be preset. Alternatively, prediction mode combinations available for multiple hypothesis prediction may be preset. For example, the encoder / decoder may perform multiple hypothesis prediction using prediction blocks (or prediction samples) generated by inter prediction and intra prediction.

[0145] According to an embodiment of the present invention, the encoder / decoder can use only some prediction modes among the inter prediction and / or intra prediction modes for the multiple hypothesis prediction. For example, the encoder / decoder can use only the merge mode among the inter prediction for the multiple hypothesis prediction. Or, the encoder / decoder can use the merge mode, not the subblock merge mode, among the inter prediction for the multiple hypothesis prediction. Or, the encoder / decoder can use a specific intra mode among the intra prediction modes for the multiple hypothesis prediction. For example, the encoder / decoder can use prediction modes including at least one of planar, DC, vertical, and / or horizontal modes among the intra prediction for the multiple hypothesis prediction in a restricted manner. As an embodiment, the encoder / decoder can generate a prediction block based on prediction of the merge mode and the intra prediction, and at this time, only at least one restricted prediction mode among the planar, DC, vertical, and / or horizontal modes can be used for the intra prediction.

[0146] Referring to FIG. 26, the encoder / decoder may generate a predicted block using a first prediction (prediction 1) and a second prediction (prediction 2). Specifically, the encoder / decoder may generate a first temporary predicted block (or a predicted sample) by applying the first prediction, and generate a second temporary predicted block by applying the second prediction. The encoder / decoder may generate a final predicted block by performing a weighted sum of the first temporary predicted block and the second temporary predicted block. In this case, the encoder / decoder may perform a weighted sum by applying a first weighting value w1 to the first temporary predicted block generated by the first prediction and applying a second weighting value w2 to the second temporary predicted block generated by the second prediction.

[0147] According to an embodiment of the present invention, when a prediction block is generated based on multiple hypothesis prediction, a weight applied to the multiple hypothesis prediction may be determined based on a specific position in a block. In this case, the block may be a current block or a neighboring block. Alternatively, the weight of the multiple hypothesis prediction may be based on a mode for generating a prediction. For example, when one of the modes for generating a prediction is intra prediction, the encoder / decoder may determine a weight based on a prediction mode. Also, for example, when one of the prediction modes is intra prediction and a directional mode, the encoder / decoder may increase a weight for a sample located far away from a reference sample.

[0148] According to an embodiment of the present invention, when the intra prediction mode used in the multiple hypothesis prediction is a directional mode and the other prediction mode is inter prediction, the encoder / decoder may apply a relatively high weight to a prediction sample generated based on intra prediction far from the reference sample. This is because, in the case of inter prediction, motion compensation can be performed using a spatial neighbor candidate, and in this case, there is a high probability that the motion of the current block and the spatial neighbor block referenced for motion compensation are the same or similar, and therefore, there is a high probability that the prediction of the area adjacent to the spatial neighbor block and the prediction of the area including an object with motion are more accurate than other parts. In this case, a residual signal adjacent to the opposite direction boundary of the spatial neighbor block may be left more than other areas (or parts). According to an embodiment of the present invention, this can be offset by applying a combination of intra predicted samples in the multiple hypothesis prediction. In addition, in one embodiment, since the reference sample position of the intra prediction may be close to the spatial neighbor candidate of the inter prediction, the encoder / decoder may apply a high weight to an area relatively far from it.

[0149] In another embodiment, when one of the modes used to generate multiple hypothesis prediction samples is intra prediction and a directional mode, the encoder / decoder may apply a high weight to a sample located relatively close to the reference sample. More specifically, when one of the modes used to generate multiple hypothesis prediction samples is intra prediction and a directional mode, and the mode used to generate the other multiple hypothesis prediction samples is inter prediction, the encoder / decoder may apply a high weight to a prediction generated based on intra prediction closer to the reference sample. This is because the closer the distance between the prediction sample and the reference sample in intra prediction, the higher the accuracy of the prediction.

[0150] In another embodiment, when one of the modes used to generate the multiple hypothesis prediction samples is intra prediction and is not a directional mode (e.g., planar, DC mode), the weighting value may be set to a constant value regardless of the position in the block. Also, in one embodiment, in multiple hypothesis prediction, the weighting value for prediction 2 may be determined based on the weighting value for prediction 1. The following equation represents an example of determining a prediction sample based on multiple hypothesis prediction.

[0151]

number

[0152] In Equation 5, pbSamples represents a (final) predicted sample (or predicted block) generated by multiple hypothesis prediction, predSamples represents a block / sample generated by inter prediction, and predSamplesIntra represents a block / sample generated by intra prediction. In Equation 5, x and y represent coordinates of a sample in a block and may be in the following range: x=0..nCbW-1 and y=0..nCbH-1. Also, nCbW and nCbH may be the width and height of the current block, respectively. Also, in one embodiment, the weight value w may be determined by the following process.

[0153] - If predModeIntra is INTRA_PLANAR or INTRA_DC, or nCbW<4, or nCbH<4, or cIdx>0, then w may be set to 4.

[0154] Otherwise, if predModeIntra is INTRA_ANGULAR50 and y<(nCbH / 4), then w may be set to 6.

[0155] - Otherwise, if predModeIntra is INTRA_ANGULAR50 and (nCbH / 4)<=y<(nCbH / 2), then w may be set to 5.

[0156] - Otherwise, if predModeIntra is INTRA_ANGULAR50 and (nCbH / 2)<=y<(3*nCbH / 4), then w may be set to 4.

[0157] - Otherwise, if predModeIntra is INTRA_ANGULAR50 and (3*nCbH / 4)<=y<nCbH, then w may be set to 3.

[0158] - Otherwise, if predModeIntra is INTRA_ANGULAR18 and x<(nCbW / 4), then w may be set to 6.

[0159] - Otherwise, if predModeIntra is INTRA_ANGULAR18 and (nCbW / 4)<=x<(nCbW / 2), then w may be set to 5.

[0160] - Otherwise, if predModeIntra is INTRA_ANGULAR18 and (nCbW / 2)<=x<(3*nCbW / 4), then w may be set to 4.

[0161] - Otherwise, if predModeIntra is INTRA_ANGULAR18 and (3*nCbW / 4)<=x<nCbW, then w may be set to 3.

[0162] The following Table 2 illustrates the multiple hypothesis prediction related syntax structure according to an embodiment of the present invention.

[0163]

Table 2

[0164] In Table 2, mh_intra_flag is a flag indicating whether or not multiple hypothesis prediction is used. According to an embodiment of the present invention, multiple hypothesis prediction may be applied only when predefined specific conditions for multiple hypothesis prediction (referred to as mh_conditions in this specification for convenience of explanation) are satisfied. If the mh_conditions are not satisfied, the encoder / decoder may not parse mh_intra_flag and may infer it to be 0. For example, mh_conditions may include a condition regarding a block size. Also, mh_conditions may include a condition regarding whether or not a predefined specific mode is used. For example, mh_intra_flag may be parsed when merge_flag, which is a flag indicating whether a merge mode is applied, is 1 and subblock_merge_flag, which is a flag indicating whether a subblock merge mode is applied, is 0. In other words, the encoder / decoder may consider (or apply) multiple hypothesis prediction when a merge mode is applied to a current block and a subblock merge mode is not applied.

[0165] Also, according to an embodiment of the present invention, the encoder may configure candidate modes into a plurality of lists to determine a mode in multiple hypothesis prediction, and signal to the decoder which list to use. Referring to Table 2, mh_intra_luma_mpm_flag may be a flag indicating which of the plurality of lists to use. If mh_intra_luma_mpm_flag is not present, it may be inferred (or considered) to be 1. Also, in one embodiment of the present invention, the plurality of lists may be an MPM list and a non-MPM list.

[0166] Also, as an embodiment, the encoder may signal to the decoder an index (or index information) indicating which index candidate to use in the list of the plurality of lists. With reference to Table 2, mh_intra_luma_mpm_idx may be the above-mentioned index. Also, as an embodiment, the index may be signaled only when a specific list is selected. The decoder may parse mh_intra_luma_mpm_idx only when a specific list is determined by mh_intra_luma_mpm_flag.

[0167] According to an embodiment of the present invention, as in the embodiment described in FIG. 26, multiple hypothesis prediction may be performed based on a prediction generated by inter prediction and a prediction generated by intra prediction. As an example, the encoder / decoder may perform multiple hypothesis prediction only when it is signaled that inter prediction is used. Or, the encoder / decoder may perform multiple hypothesis prediction only when it is signaled that a specific mode of inter prediction, such as a merge mode, is used. In this case, signaling for inter prediction may not be separately required. Also, as an example, when the encoder / decoder generates a prediction by intra prediction, there may be a total of four candidate modes. For example, the first list and the second list may be configured using three and one candidate modes, respectively, out of the total four candidate modes. In this case, when the second list including one prediction mode is selected, the encoder may not need to signal an index to the decoder. Also, when the first list is selected, an index indicating a specific candidate may be signaled to the decoder. In this case, since the first list contains three candidates, signaling can be performed with one or two bits using a variable length coding method.

[0168] Table 3 below illustrates a syntax structure related to multiple hypothesis prediction according to one embodiment of the present invention.

[0169] [Table 3]

[0170] In Table 3, as described in Table 2 above, there may be signaling indicating which list among multiple lists is to be used, and mh_intra_luma_mpm_flag may be such a syntax element in Tables 2 and 3. In this regard, the description of syntax elements that overlap with those in Table 2 above will be omitted.

[0171] According to an embodiment of the present invention, signaling indicating which list to use may be explicitly signaled only in certain cases. If not explicitly signaled, the encoder / decoder may infer the value of the syntax element by a previously set method. With reference to Table 3, if the condition of mh_mpm_infer_condition is satisfied, there may be no explicit signaling, and if the condition of mh_mpm_infer_condition is not satisfied, there may be explicit signaling. Also, if the condition of mh_mpm_infer_condition is satisfied, mh_intra_luma_mpm_flag may not be present, and in that case, it may be inferred to be 1. That is, the encoder / decoder may infer that an MPM list is used in this case.

[0172] Table 4 below illustrates a syntax structure related to multiple hypothesis prediction according to one embodiment of the present invention.

[0173] [Table 4]

[0174] As described above in Tables 2 and 3, there may be signaling indicating which list among multiple lists to use, and if a predefined condition is met, the encoder / decoder may infer the value. In this regard, the description of syntax elements that overlap with those in Tables 2 and 3 will be omitted.

[0175] According to an embodiment of the present invention, a condition for inferring a signaling (or syntax element, parameter) value indicating which list among a plurality of lists to use may be determined based on a current block size. For example, the encoder / decoder may determine based on the width and height of the current block. Specifically, the encoder / decoder may infer the signaling value when the larger of the width and height of the current block is greater than n times the smaller of the width and height of the current block. For example, n may be set to a natural number such as 2, 3, 4, etc. Referring to Table 4, a condition for inferring a signaling value indicating which list among a plurality of lists to use may be a condition when the larger of the width and height of the current block is greater than twice the smaller of the width and height of the current block. If the width and height of the current block are cbWidth and cbHeight, respectively, the Abs(Log2(cbWidth / cbHeight)) value is 0 when cbWidth and cbHeight are the same, and is 1 when they are 2 times different. Therefore, if the difference between cbWidth and cbHeight is more than twice as large, the Abs(Log2(cbWidth / cbHeight)) value will be greater than 1 (i.e., it can have a value of 2 or greater).

[0176] FIG. 27 is a diagram illustrating a multiple hypothesis prediction mode determination method according to an embodiment of the present invention. As described in Tables 2 to 4 above, the determination of a prediction mode used in multiple hypothesis prediction may be performed based on a plurality of lists. As an example, the prediction mode may indicate an intra mode for generating a prediction based on intra prediction. In addition, the plurality of lists may include two lists, a first list and a second list. Referring to FIG. 27, it may be determined whether or not to use the first list based on list1_flag. In an embodiment, there may be a plurality of candidates that may belong to the first list, and there may be one candidate that may belong to the second list.

[0177] If list1_flag is inferred, the encoder / decoder can infer that the first list is to be used and its value (S2701). In this case, list1_index, which is an index indicating which candidate in the first list is to be used, can be parsed (S2704). If list1_flag is not inferred (S2701), the encoder / decoder can parse list1_flag (S2702). If list1_flag is 1, the encoder / decoder can parse list1_index, and if list1_flag is not 1, the encoder / decoder does not need to parse the index. If list1_flag is 1, the encoder / decoder can determine a mode to be actually used from among the candidate modes in the first list based on the index (S2703). If list1_flag is not 1, the encoder / decoder can determine a candidate mode in the second list to be actually used without an index. That is, in the first list, the mode may be determined based on the flag and the index, and in the second list, the mode may be determined based on the flag.

[0178] FIG. 28 is a diagram illustrating a multiple hypothesis prediction mode determination method according to an embodiment of the present invention. According to an embodiment of the present invention, when an index for determining a candidate mode in a list is variable length coded, a method for determining the order of modes included in a candidate list may be applied to increase coding efficiency. For example, a method for determining the order of modes included in a first list may exist. In this case, the encoder / decoder may refer to a mode around a current block to determine the mode order. Also, the second list may be determined without referring to a mode around a current block. For example, the encoder / decoder may generate the first list by referring to a mode around a current block, and may include a mode not included in the first list in the second list. In one embodiment, the first list may be an MPM mode, and the second list may be a non-MPM mode. Also, the total number of candidate modes may be four, and the first list may include three modes, and the second list may include one mode.

[0179] Referring to FIG. 28, there may be a syntax element list1_flag indicating whether the first list is used. If the first list is used, the encoder / decoder may generate the first list (S2801, S2802) and select a specific mode from the first list. At this time, the generation of the first list and the confirmation of whether the first list is used may be performed in any order. For example, in a situation where the first list is used, the first list may be generated before or after the confirmation of whether the first list is used. Also, the encoder / decoder may not need to perform a process of generating the second list when the first list is used.

[0180] If the first list is not used, the encoder / decoder may generate a second list (S2803) and select a specific mode from the second list. In this case, the encoder / decoder may generate the first list in order to generate the second list. The encoder / decoder may include candidates not included in the first list among the candidate modes in the second list. In addition, according to an embodiment of the present invention, the method of generating the first list may be the same regardless of whether the first list is used (list1_flag value), whether the first list is used, whether inference is performed, etc. In this case, the methods described above in Tables 2 to 4 and FIG. 27 may be applied to list signaling and mode signaling.

[0181] Hereinafter, a method of constructing (or generating) a plurality of lists for determining a prediction mode used in the multiple hypothesis prediction described above with reference to Figs. 27 and 28 will be further described. As an example, as described above, the plurality of lists may be constructed of two lists. That is, the plurality of lists may include a first list and a second list. Also, the plurality of lists may be used in a multiple hypothesis prediction process.

[0182] According to an embodiment of the present invention, an encoder / decoder may generate a plurality of lists by referring to a mode around a current block. The encoder / decoder may also perform intra prediction using a mode selected from the list, and generate a multi-hypothesis prediction block by combining a prediction sample (or a prediction block) generated by the intra prediction with an inter-predicted prediction sample. In this specification, the final prediction sample (or a prediction block) generated by the multi-hypothesis prediction is referred to as a multi-hypothesis prediction block, but the present invention is not limited thereto. For example, the multi-hypothesis prediction block may be referred to as a prediction block, a final prediction block, a multi-prediction block, a combined prediction block, an inter-intra weighted prediction block, a combined inter-intra prediction block, a combined inter-intra weighted prediction block, etc.

[0183] As an example, the modes (candidate modes) that may be included in the list may be set to at least one of planar mode, DC mode, vertical mode, and / or horizontal mode of an intra prediction method. In this case, the vertical mode may be the mode with index (or mode number) 50 in Fig. 6, and the horizontal mode may be the mode with index 18 in Fig. 6. In addition, the planar mode and DC mode may have indexes 0 and 1, respectively.

[0184] According to an embodiment of the present invention, a candidate mode list may be generated by referring to prediction modes of neighboring blocks of a current block. The candidate mode list may be referred to as candModeList in this specification. As an example, the candidate mode list may be the first list described in the above embodiment. As an example, the mode of the neighboring blocks of the current block may be expressed as candIntraPredModeX. That is, candIntraPredModeX represents a variable indicating the mode of the neighboring blocks. Here, X represents a variable indicating a specific position around the current block, such as A, B, etc.

[0185] As an example, the encoder / decoder may generate a candidate mode list based on whether there is a match between multiple candIntraPredModeX. For example, candIntraPredModeX may exist for two positions, and the modes at the positions may be represented as candIntraPredModeA and candIntraPredModeB. As an example, if candIntraPredModeA and candIntraPredModeB are identical, the candidate mode list may include planar mode and DC mode.

[0186] As an example, when candIntraPredModeA and candIntraPredModeB are the same and the value indicates a planar mode or a DC mode, the encoder / decoder may add the mode indicated by candIntraPredModeA and candIntraPredModeB to the candidate mode list. Also, the encoder / decoder may add a mode not indicated by candIntraPredModeA and candIntraPredModeB among the planar mode and the DC mode to the candidate mode list. Also, the encoder / decoder may add a mode that is already set, not the planar mode or the DC mode, to the candidate mode list. As an example, in this case, the order of the planar mode, the DC mode, and the already set specific mode in the candidate mode list may be already set. For example, the order may be planar, DC, and the already set mode. That is, candModeList[0]=planar mode, candModeList[1]=DC mode, candModeList[2]=the already set mode. Also, the already set mode may be a vertical mode. In yet another embodiment, among the planar mode, DC mode, and the already set modes, the modes indicated by candIntraPredModeA and candIntraPredModeB may be added first to the candidate mode list, and among the planar mode and DC mode, the modes not indicated by candIntraPredModeA and candIntraPredModeB may be added as the next candidates, followed by the already set modes.

[0187] Also, if candIntraPredModeA and candIntraPredModeB are the same and the values ​​do not indicate the planar mode and the DC mode, the encoder / decoder can add the mode indicated by candIntraPredModeA and candIntraPredModeB to the candidate mode list. Also, the planar mode and the DC mode may be added to the candidate mode list. Also, in this case, the order of the mode indicated by candIntraPredModeA and candIntraPredModeB, the planar mode, and the DC mode in the candidate mode list may be already set. Also, the already set order may be the order of the mode indicated by candIntraPredModeA and candIntraPredModeB, the planar mode, and the DC mode. That is, candModeList[0]=candIntraPredModeA, candModeList[1]=planar mode, and candModeList[2]=DC mode.

[0188] Also, if candIntraPredModeA and candIntraPredModeB are different from each other, the encoder / decoder may add both candIntraPredModeA and candIntraPredModeB to the candidate mode list. Also, candIntraPredModeA and candIntraPredModeB may be included in the candidate mode list according to a predefined specific order. For example, candIntraPredModeA, candIntraPredModeB may be included in the candidate mode list in that order. Also, there may be a predefined order between the candidate modes, and the encoder / decoder may add modes other than candIntraPredModeA and candIntraPredModeB to the candidate mode list among the modes according to the predefined order. Also, modes other than candIntraPredModeA and candIntraPredModeB may be added after candIntraPredModeA and candIntraPredModeB in the candidate mode list. Also, the predefined order may be planar mode, DC mode, and vertical mode. Alternatively, the previously set order may be planar mode, DC mode, vertical mode, and horizontal mode. That is, candModeList[0]=candIntraPredModeA, candModeList[1]=candIntraPredModeB, and candModeList[2] may be the first mode among planar mode, DC mode, and vertical mode that is neither candIntraPredModeA nor candIntraPredModeB.

[0189] Also, in one embodiment, a mode not included in the candidate mode list among the candidate modes may be defined as candIntraPredModeC. As an example, candIntraPredModeC may be included in the second list. Also, if the signaling indicating whether the above-mentioned first list is used indicates that it is not used, candIntraPredModeC may be determined. If the first list is used, the encoder / decoder determines a mode according to an index in the candidate mode list, and if the first list is not used, the encoder / decoder may use a mode in the second list.

[0190] Also, as described above, after generating the candidate mode list, a process of modifying the candidate mode list may be added. For example, the encoder / decoder may or may not further perform the modifying process depending on a current block size condition. For example, the current block size condition may be determined based on the width and height of the current block. For example, if the larger of the width and height of the current block is n times larger than the other, the modifying process may be further performed. For example, n may be defined as 2.

[0191] Also, in one embodiment, the modifying process may be a process of changing a mode to another mode when any mode is included in the candidate mode list. For example, when the candidate mode list includes a vertical mode, the encoder / decoder may insert a horizontal mode into the candidate mode list instead of the vertical mode. Or, when the candidate mode list includes a vertical mode, the encoder / decoder may insert the candIntraPredModeC into the candidate mode list instead of the vertical mode. Or, when the candidate mode list is generated, the planar mode and the DC mode may always be included in the candidate mode list, so in this case, candIntraPredModeC may be a horizontal mode. Also, such a modifying process may be used when the height of the current block is greater than n times the width. For example, n may be defined as 2. This is because, when the height is greater than the width, the accuracy of the vertical mode may be low because the lower side of the block is far from the reference sample for intra prediction. Or, such a modifying process may be used when it is inferred that the first list is used.

[0192] According to an embodiment of the present invention, as another example of the candidate list modification process, the encoder / decoder may add a vertical mode to the candidate mode list instead of the horizontal mode when the horizontal mode is included in the candidate mode list. Or, when the horizontal mode is included in the candidate mode list, the encoder / decoder may add the candIntraPredModeC to the candidate mode list instead of the horizontal mode. Or, since the planar mode and the DC mode may always be included in the candidate mode list when generating the candidate mode list, in this case, the candIntraPredModeC may be a vertical mode. Also, such a modification process may be used when the width of the current block is greater than n times the height. For example, n may be defined as 2. This is because, when the width is greater than the height, the right side of the block is far from the reference sample for intra prediction, and therefore the accuracy of the horizontal mode may be low. Or, such a modification process may be used when it is inferred that the first list is used.

[0193] An example of the list setting method described above will be further described below. In this specification, IntraPredModeY indicates a mode used for intra prediction during multiple hypothesis prediction. In addition, IntraPredModeY can indicate a mode of a luminance component. As an example, an intra prediction mode of a chrominance component in multiple hypothesis prediction may be derived from a luminance component. In addition, in this specification, mh_intra_luma_mpm_flag represents a variable (or a syntax element) indicating which list among a plurality of lists is to be used. For example, mh_intra_luma_mpm_flag may be mh_intra_luma_mpm_flag in Tables 2 to 4, or list1_flag in FIG. 27 and FIG. 28. In addition, in this specification, mh_intra_luma_mpm_idx represents an index indicating which candidate is to be used in a list. For example, mh_intra_luma_mpm_idx may be mh_intra_luma_mpm_idx in Tables 2 to 4, or list1_index in Fig. 27. In this specification, xCb and yCb may be the x and y coordinates of the top-left corner of the current block. Also, cbWidth and cbHeight may be the width and height of the current block.

[0194] FIG. 29 is a diagram illustrating a neighboring position to be referred to in multiple hypothesis prediction according to an embodiment of the present invention. Referring to FIG. 29, as described above, the encoder / decoder can refer to the neighboring positions in the process of creating a candidate list for multiple hypothesis prediction. For example, the above-mentioned candIntraPredModeX may be necessary. In this case, the positions of A and B around the current block to be referred to may be NbA and NbB shown in FIG. 29. That is, they may be positions to the left and above adjacent to the upper left sample of the current block. If the upper left position of the current block is Cb as shown in FIG. 18 and its coordinates are (xCb, yCb), NbA may be (xNbA, yNbA)=(xCb-1, yCb), and NbB may be (xNbB, yNbB)=(xCb, yCb-1).

[0195] FIG. 30 is a diagram illustrating a method of referring to a surrounding mode according to an embodiment of the present invention. Referring to FIG. 30, as described above, the encoder / decoder may refer to the surrounding position in the process of creating a candidate list for multiple hypothesis prediction. In addition, the surrounding mode may be used as is, or a candidate mode list may be generated using a mode based on the surrounding mode. As an example, the mode generated by referring to the surrounding position may be candIntraPredModeX. As an example, if the surrounding position is unavailable, candIntraPredModeX may be a mode that has already been set. If it is unavailable, it may include a case where the surrounding position uses inter prediction, or a case where a mode is not determined in a predetermined encoding / decoding order. Alternatively, if the surrounding position does not use multiple hypothesis prediction, candIntraPredModeX may be a mode that has already been set. Alternatively, if the surrounding position is above the CTU to which the current block belongs, candIntraPredModeX may be a mode that has already been set. As another example, if the surrounding position is outside the CTU to which the current block belongs, candIntraPredModeX may be a mode that has already been set. Also, as an example, the previously set mode may be a DC mode. In yet another embodiment, the preset mode may be a planar mode.

[0196] According to an embodiment of the present invention, candIntraPredModeX may be set depending on whether the mode at the peripheral position exceeds a threshold angle or whether the index of the mode at the peripheral position exceeds a threshold. For example, if the index of the mode at the peripheral position is greater than a specific directional mode index, the encoder / decoder may set candIntraPredModeX to a vertical mode index. Also, if the index of the mode at the peripheral position is less than or equal to the specific directional mode index and is a directional mode, the encoder / decoder may set candIntraPredModeX to a horizontal mode index. For example, the specific directional mode index may be mode 34 in FIG. 6 described above. Also, if the mode at the peripheral position is a planar mode or a DC mode, candIntraPredModeX may be set to a planar mode or a DC mode.

[0197] Referring to FIG. 30, mh_intra_flag may be a syntax element (or a variable, a parameter) indicating whether or not multiple hypothesis prediction is used. Also, the intra prediction mode used in the neighboring blocks may be X. Also, since the current block can use multiple hypothesis prediction, a candidate list can be generated using a candidate intra prediction mode based on the mode of the neighboring blocks, but since the neighboring blocks did not use multiple hypothesis prediction, the encoder / decoder can set the candidate intra prediction mode to the DC mode, which is a previously set mode, regardless of the intra prediction mode of the neighboring blocks used or regardless of whether the neighboring blocks used intra prediction.

[0198] An example of the above-described peripheral mode reference method is further described below.

[0199] According to an embodiment of the present invention, the intra prediction mode candIntraPredModeX (X is A or B) of the neighboring block can be derived in the following manner.

[0200] 1. The availability induction process for the block specified in the adjacent block availability confirmation process is called, and the availability induction process can set the position (xCurr, yCurr) to (xCb, yCb), set the input (xNbX, yNbX) to the adjacent position (xNbY, yNbY), and the output can be assigned to the availability variable availableX.

[0201] 2. The candidate intra prediction mode candIntraPredModeX may be induced in the following way:

[0202] A. If one or more of the following conditions are true, candIntraPredModeX may be set to the INTRA_DC mode.

[0203] a) If the variable availableX is FALSE.

[0204] b) If mh_intra_flag[xNbX][yNbX] is not 1.

[0205] c) If X is B and yCb - 1 is less than ((yCb >> CtbLog2SizeY) << CtbLog2SizeY).

[0206] B. Otherwise, if IntraPredModeY[xNbX][yNbX] > INTRA_ANGULAR34, candIntraPredModeX may be set to INTRA_ANGULAR50.

[0207] C. Otherwise, if IntraPredModeY[xNbX][yNbX] <= INTRA_ANGULAR34 and IntraPredModeY[xNbX][yNbX] > INTRA_DC, candIntraPredModeX may be set to INTRA_ANGULAR18.

[0208] D. Otherwise, candIntraPredModeX may be set equal to IntraPredModeY[xNbX][yNbX].

[0209] As mentioned above, in the list setting method described above, candIntraPredModeX may be determined by the surrounding mode reference method.

[0210] FIG. 31 is a diagram illustrating a candidate list generating method according to an embodiment of the present invention. According to the first and second list generating methods described in Tables 2 to 4 above, the encoder / decoder may generate the first list by referring to the modes around the current block, and generate the second list by using the modes not included in the first list among the candidate modes. Since there is spatial similarity within a picture, the one referring to the surrounding modes may have a higher priority. That is, the first list may have a higher priority than the second list. However, according to the first and second list signaling methods described in Tables 2 to 4, if the signaling for determining the list is not inferred, the encoder / decoder may signal using a flag and an index to use the mode of the first list, and may use only a flag to use the mode of the second list. That is, the encoder / decoder may use relatively few bits for signaling the second list. However, using relatively many bits for signaling the mode of the list with a higher priority may be unfavorable in terms of coding efficiency. Therefore, according to one embodiment of the present invention, a method is proposed that uses relatively few bits of signaling for high priority lists and modes.

[0211] That is, according to an embodiment of the present invention, a method of generating a candidate list may be defined individually depending on whether only a list with a relatively high priority can be used. Whether only the first list can be used may indicate whether signaling indicating a list to be used is inferred. For example, assuming that there is a second list generated by a method already set using a candidate mode, the encoder / decoder may insert the third list by dividing it into the first list and the second list. For example, the third list generated by a method already set and the method of generating the third list may be the above-mentioned candidate mode list and its generation method. If signaling indicating a list to be used is inferred, only the first list may be used, and in that case, the encoder / decoder may fill the first list from the front of the third list. Also, if signaling indicating a list to be used is not inferred, the first list or the second list may be used, and in that case, the second list may be filled from the front of the third list, and the remaining part may be filled with the first list. In this case, the encoder / decoder may fill the third list in order even when filling the first list. That is, candIntraPredModeX can be included in the candidate list by referring to the modes around the current block, but candIntraPredModeX can be included in the first list if signaling indicating the list is inferred, and added to the second list if it is not inferred.

[0212] In one embodiment, the size of the second list may be 1, in which case the encoder / decoder can add candIntraPredModeA to the first list if signaling indicating the list is inferred, and can add it to the second list if not inferred. candIntraPredModeA may be list 3[0], which is the top mode of the third list. Therefore, in the present invention, candIntraPredModeA, which is a mode based on a surrounding mode, may be added to both the first list and the second list depending on the case. Meanwhile, in the method described in Tables 2 to 4, candIntraPredModeA could only be included in the first list. That is, in the present invention, the first list generation method may be set individually depending on whether signaling indicating the list to be used is inferred or not.

[0213] Referring to FIG. 31, the candidate mode may be a candidate that can be used to generate intra-prediction of multiple hypothesis prediction. That is, the method of generating the candidate list may differ depending on whether or not list1_flag, which is signaling indicating the list to be used, is inferred (S3101, S3102). If it is inferred, it can be inferred that the first list is to be used, and only the first list can be used, so the encoder / decoder can add the mode based on the surrounding mode to the top when generating the third list. Also, if it is not inferred, both the first list and the second list may be used, so the encoder / decoder can add the mode based on the top of the third list to the second list with less signaling (S3104). And, when the first list is necessary, for example, when it is signaled that the first list is to be used, the encoder / decoder can add the candidates included in the second list from the third list to the first list (S3105). For the sake of convenience, the present invention has been described with reference to the case where the third list is generated. However, the present invention is not limited to this, and the candidates may be temporarily classified and the first and second lists may be generated based on the classified candidates.

[0214] According to an embodiment of the present invention, the method of generating a candidate list according to the embodiment described below and the method of generating a candidate list described in Figures 27 to 28 can be adaptively used depending on the situation. For example, the encoder / decoder can select one of the two methods of creating a candidate list depending on whether signaling indicating which list to use is inferred or not. This may also be the case of multiple hypothesis prediction. The following first list may include three modes, and the second list may include one mode. As described above in Figures 27 to 28, the encoder / decoder can signal the mode of the first list with a flag and an index, and signal the mode of the second list with a flag.

[0215] As an example, when candIntraPredModeA and candIntraPredModeB are the same and candIntraPredModeA is the planar mode or the DC mode, it may be determined that List2[0]=planar mode, List1[0]=DC mode, List1[1]=vertical mode, and List1[2]=horizontal mode. As yet another example, when candIntraPredModeA and candIntraPredModeB are the same and candIntraPredModeA is the planar mode or the DC mode, it may be determined that List2[0]=candIntraPredModeA, List1[0]=!candIntraPredModeA, List1[1]=vertical mode, and List1[2]=horizontal mode.

[0216] Also, as an example, when candIntraPredModeA and candIntraPredModeB are the same and candIntraPredModeA is a directional mode, it may be determined that List2[0]=candIntraPredModeA, List1[0]=planar mode, List1[1]=DC mode, and List1[2]=vertical mode. Also, as an example, when candIntraPredModeA and candIntraPredModeB are different, List2[0]=candIntraPredModeA, List1[0]=candIntraPredModeB. List1[1] and List1[2] may be added from the planar mode, DC mode, vertical mode, and horizontal mode other than candIntraPredModeA and candIntraPredModeB.

[0217] FIG. 32 is a diagram illustrating a method of generating a candidate list according to an embodiment of the present invention. In the above embodiment, a method of determining a mode based on multiple lists has been described. Referring to FIG. 32, according to an embodiment of the present invention, a mode may be determined based on a single list instead of multiple lists. Specifically, as shown in FIG. 32, one candidate list including all candidate modes of multiple hypothesis prediction may be generated. Table 5 below illustrates a syntax structure related to multiple hypothesis prediction according to an embodiment of the present invention.

[0218] [Table 5]

[0219] Referring to Table 5, since there is only one candidate list, there is no signaling for selecting the list, and there may be index signaling indicating which mode of the candidate list is to be used. Therefore, when mh_intra_flag indicating whether or not multiple hypothesis prediction is used is 1, the decoder can parse mh_intra_luma_idx, which is a candidate index. According to an embodiment of the present invention, the method for generating a candidate list for multiple hypothesis prediction may be based on the MPM list generation method in the existing intra prediction. Alternatively, according to an embodiment, the candidate list for multiple hypothesis prediction may be formed of a list in the form of combining the first list and the second list in the order in the first list and second list generation method described in FIG. 28 above.

[0220] That is, if the candidate list of multiple hypothesis prediction is the candidate mode list, the size of the candidate mode list in this embodiment may be 4. If candIntraPredModeA and candIntraPredModeB are the same and are planar mode or DC mode, the candidate mode list may be determined according to a previously set order. For example, candModeList[0]=planar mode, candModeList[1]=DC mode, candModeList[2]=vertical mode, candModeList[3]=horizontal mode. As another example, if candIntraPredModeA and candIntraPredModeB are the same and are planar mode or DC mode, candModeList[0]=candIntraPredModeA, candModeList[1]=!candIntraPredModeA, candModeList[2]=vertical mode, candModeList[3]=horizontal mode may be determined.

[0221] Alternatively, if candIntraPredModeA and candIntraPredModeB are the same and are directional modes, candModeList[0]=candIntraPredModeA, candModeList[1]=planar mode, candModeList[2]=DC mode, candModeList[3]=candIntraPredModeA, and modes other than planar mode and DC mode may be determined. If candIntraPredModeA and candIntraPredModeB are different, candModeList[0]=candIntraPredModeA, candModeList[1]=candIntraPredModeB. Also, candModeList[2] and candModeList[3" may sequentially add modes other than candIntraPredModeA and candIntraPredModeB according to a previously set order of candidate modes. The previously set order may be determined as planar mode, DC mode, vertical mode, and horizontal mode.

[0222] According to an embodiment of the present invention, the candidate list may vary depending on the block size condition. If the relatively larger of the block width and height is greater than n times the other, the candidate list may be shorter. For example, if the width is greater than n times the height, the encoder / decoder may remove the horizontal mode from the candidate list described in FIG. 31 and move the next mode forward to fill the candidate list. If the height is greater than n times the width, the encoder / decoder may remove the vertical mode from the candidate list described in FIG. 32 and move the next mode forward to fill the candidate list. Thus, if the width is greater than n times the height, the candidate list size may be 3. If the width is greater than n times the height, the candidate list size may be smaller or equal to that of the other case.

[0223] As an example, the candidate index in the embodiment described in FIG. 32 may be variable length coded. This can increase signaling efficiency by adding a mode with a relatively high probability of being used to the front of the list. As another example, the candidate index in the embodiment described in FIG. 32 may be fixed length coded. The number of modes used in multiple hypothesis prediction may be an exponential power of 2. For example, as described above, it can be used in four intra prediction modes. In this case, even if fixed length coding is performed, no unassigned values ​​are generated, and unnecessary parts are not generated in signaling. In addition, when fixed length coding is performed, the number of cases in which a list is configured may be one. The number of bits is the same regardless of which index is signaled.

[0224] According to an embodiment, the candidate index may be variable length coded or fixed length coded depending on the circumstances. For example, as in the above embodiment, the candidate list size may vary depending on the circumstances. As an embodiment, the candidate index may be variable length coded or fixed length coded depending on the candidate list size. For example, if the candidate list size is a power of 2, it may be fixed length coded, and if the candidate list size is not a power of 2, it may be variable length coded. That is, according to the above embodiment, the coding method may vary depending on the block size condition.

[0225] According to an embodiment of the present invention, when using multiple hypothesis prediction, if DC mode is used, weights between multiple predictions for the entire block may be the same, so that the same / similar results may be obtained as adjusting the weights of the predicted block. Therefore, DC mode may be excluded from multiple hypothesis prediction. As an embodiment, the encoder / decoder may use only one of planar mode, vertical mode, and horizontal mode in multiple hypothesis prediction. In this case, the encoder / decoder may signal multiple hypothesis prediction using one list as shown in FIG. 32. Also, the encoder / decoder may use variable length coding for index signaling. As an embodiment, the lists may be generated in a fixed order. For example, the order may be planar mode, vertical mode, and horizontal mode.

[0226] In yet another embodiment, the encoder / decoder may generate the list by referring to the modes around the current block. For example, if candIntraPredModeA and candIntraPredModeB are the same, candModeList[0] may be set to candIntraPredModeA. If candIntraPredModeA and candIntraPredModeB are the same and candIntraPredModeA is a planar mode, candModeList[1] and candModeList[2] may be set according to the previously set order. If candIntraPredModeA and candIntraPredModeB are the same and candIntraPredModeA is not a planar mode, candModeList[1] may be set to a mode other than the planar mode, not candIntraPredModeA, and candModeList[2] may be set to a mode other than the planar mode. If candIntraPredModeA and candIntraPredModeB are different, candModeList[0] = candIntraPredModeA, candModeList[1] = candIntraPredModeB, and candModeList[2] may be a mode other than candIntraPredModeA and candIntraPredModeB.

[0227] In another embodiment, the encoder / decoder may use only one of three modes in the multiple hypothesis prediction. The three modes may include a planar mode and a DC mode. The three modes may also include one of a vertical mode and a horizontal mode depending on a condition. The condition may be a condition related to a block size. For example, whether to include a horizontal mode or a vertical mode may be determined depending on which of a width and a height of a block is larger. For example, if the width of a block is larger than the height, the vertical mode may be included. If the height of a block is larger than the width, the horizontal mode may be included. If the height and width of a block are equal, a predefined specific mode of the vertical mode or the horizontal mode may be included.

[0228] Also, in one embodiment, the encoder / decoder may generate the list in a fixed order. For example, the order may be defined as planar mode, DC mode, vertical or horizontal mode. Also, in another embodiment, the list may be generated by referring to the mode around the current block. For example, if candIntraPredModeA and candIntraPredModeB are the same, candModeList[0]=candIntraPredModeA. If candIntraPredModeA and candIntraPredModeB are the same and candIntraPredModeA is not a directional mode, the encoder / decoder may set candModeList[1] and candModeList[2] according to the previously set order. If candIntraPredModeA and candIntraPredModeB are the same and candIntraPredModeA is a directional mode, candModeList[1]=planar mode, candModeList[2]=DC mode. If candIntraPredModeA and candIntraPredModeB are different, candModeList[0] = candIntraPredModeA, candModeList[1] = candIntraPredModeB, and candModeList[2] may be a mode other than candIntraPredModeB, not candIntraPredModeA.

[0229] According to another embodiment of the present invention, only one of two modes may be used in the multiple hypothesis prediction. The two modes may include a planar mode. The two modes may also include one of a vertical mode and a horizontal mode, depending on a condition. The condition may be a condition related to a block size. For example, the encoder / decoder may determine whether to include a horizontal mode or a vertical mode depending on which of the width and height of the block is larger. For example, if the width of the block is larger than the height, the vertical mode may be included. If the height of the block is larger than the width, the horizontal mode may be included. If the height and width of the block are equal, the promised mode of the vertical mode or the horizontal mode may be included. In this case, a flag may be signaled to indicate which mode to use in the multiple hypothesis prediction.

[0230] According to one embodiment, the encoder / decoder can exclude a particular mode depending on the block size. For example, if the block size is small, a particular mode can be excluded. For example, if the block size is small, only the planar mode can be used in multiple hypothesis prediction. If a particular mode is excluded, mode signaling can be omitted or reduced.

[0231] According to another embodiment of the present invention, the encoder / decoder may use only one mode (i.e., intra prediction mode) to generate intra predicted samples in multiple hypothesis prediction. In one embodiment, the one mode may be defined as a planar mode. As described above, multiple hypothesis prediction may use inter predicted samples and intra predicted samples. If an optimal prediction mode is determined to generate an intra predicted sample while generating an inter predicted sample, the accuracy of prediction may be improved, but the encoding complexity may increase and signaling bits may increase. Therefore, by using only the planar mode that occurs most frequently statistically as the intra prediction mode when performing multiple hypothesis prediction, the encoding complexity may be improved and signaling bits may be saved, thereby improving the image compression performance.

[0232] In yet another embodiment, the one mode may be determined based on the block size, either the vertical mode or the horizontal mode. For example, depending on which of the width and height of the block is larger, either the vertical mode or the horizontal mode may be determined. For example, if the width of the block is larger than the height, the vertical mode may be determined, and if the height of the block is larger than the width, the horizontal mode may be determined. If the width and height of the block are equal, the encoder / decoder may determine the mode as already set. If the width and height of the block are equal, the encoder / decoder may determine the mode as already set, either the horizontal mode or the vertical mode. If the width and height of the block are equal, the encoder / decoder may determine the mode as already set, either the planar mode or the DC mode.

[0233] Also, according to an embodiment of the present invention, there may be a flipping signaling for flipping a prediction generated in the multiple hypothesis prediction. This can have the effect of eliminating the residual on the opposite side by flipping even if one mode is selected in the multiple hypothesis prediction. This can also have the effect of reducing the number of candidate modes available in the multiple hypothesis prediction. More specifically, for example, flipping can be used when only one mode is used in the above embodiment. This can improve prediction performance. The flipping can mean flipping for the x-axis, flipping for the y-axis, or flipping for both the x-axis and the y-axis. As an example, the flipping direction may be determined based on the mode selected in the multiple hypothesis prediction. For example, if the mode selected in the multiple hypothesis prediction is a planar mode, the encoder / decoder may determine that the flipping is for both the x-axis and the y-axis. Also, flipping for both the x-axis and the y-axis may depend on the block size or shape. For example, if the block is not square, the encoder / decoder may determine not to flip for both the x-axis and the y-axis. For example, if the mode selected in the multiple hypothesis prediction is a horizontal mode, the encoder / decoder may determine that it is a flipping about the x-axis. For example, if the mode selected in the multiple hypothesis prediction is a vertical mode, the encoder / decoder may determine that it is a flipping about the y-axis. Also, if the mode selected in the multiple hypothesis prediction is a DC mode, the encoder / decoder may determine that there is no flipping and may not need to perform any explicit signaling / parsing.

[0234] Also, in multiple hypothesis prediction, the DC mode may have an effect similar to illumination compensation. Therefore, according to an embodiment of the present invention, if one of the DC mode and the illumination compensation method is used in multiple hypothesis prediction, the other may not be used. Also, multiple hypothesis prediction may have an effect similar to GBi (generalized bi-prediction). For example, in multiple hypothesis prediction, the DC mode may have an effect similar to GBi. GBi prediction may be a technique for adjusting a weight between two reference blocks of bidirectional prediction in a block unit or a CU unit. Therefore, according to an embodiment of the present invention, if one of the multiple hypothesis prediction (or the DC mode in multiple hypothesis prediction) and the GBi prediction method is used, the other may not be used. This may also include a case where the prediction of the multiple hypothesis prediction is bidirectional. For example, if the selected merge candidate of the multiple hypothesis prediction is bidirectional, the GBi prediction may not be used. In these embodiments, the relationship between the multiple hypothesis prediction and the GBi prediction may be limited to the case where a specific mode of the multiple hypothesis prediction, for example, the DC mode, is used. Alternatively, if GBi prediction-related signaling exists before multiple hypothesis prediction-related signaling, the use of GBi prediction can eliminate the need to use multiple hypothesis prediction or a specific mode of multiple hypothesis prediction. In the present invention, not using any method can mean not signaling for any of the methods and not parsing related syntax.

[0235] FIG. 33 is a diagram illustrating a peripheral position to be referred to in multiple hypothesis prediction according to an embodiment of the present invention. As described above, the encoder / decoder can refer to the peripheral position in the process of creating a candidate list for multiple hypothesis prediction. For example, the above-mentioned candIntraPredModeX may be used. In this case, the positions of A and B around the current block to be referred to may be NbA and NbB shown in FIG. 33. If the position of the upper left sample of the current block is Cb as shown in FIG. 29 and its coordinates are (xCb, yCb), NbA may be (xNbA, yNbA)=(xCb-1, yCb+cbHeight-1), and NbB may be (xNbB, yNbB)=(xCb+cbWidth-1, yCb-1). Here, cbWidth and cbHeight may be the width and height of the current block, respectively. In addition, in the process of creating a candidate list for multiple hypothesis prediction, the neighboring positions may be the same as the neighboring positions referred to in generating the MPM list for intra prediction.

[0236] In yet another embodiment, the neighboring positions referred to in the process of creating a candidate list for multiple hypothesis prediction may be the left center position and the top center position of the current block or positions close to them. For example, NbA and NbB may be (xCb-1, yCb+cbHeight / 2-1) and (xCb+cbWidth / 2-1, yCb-1). Or, NbA and NbB may be (xCb-1, yCb+cbHeight / 2) and (xCb+cbWidth / 2, yCb-1).

[0237] FIG. 34 is a diagram illustrating a method of referring to a surrounding mode according to an embodiment of the present invention. As described above, the surrounding positions can be referred to in the process of creating a candidate list for multiple hypothesis prediction. In the embodiment of FIG. 30, if the surrounding positions do not use multiple hypothesis prediction, candIntraPredModeX is set to the already set mode. This means that when candIntraPredModeX is set, the mode of the surrounding positions may not be candIntraPredModeX as it is. Therefore, according to an embodiment of the present invention, even if the surrounding positions do not use multiple hypothesis prediction, if the mode used by the surrounding positions is a mode used for multiple hypothesis prediction, the encoder / decoder can set candIntraPredModeX to the mode used by the surrounding positions. The mode used for multiple hypothesis prediction may be a planar mode, a DC mode, a vertical mode, or a horizontal mode.

[0238] Or, even if the surrounding position does not use multiple hypothesis prediction, if the mode used by the surrounding position is a specific mode, the encoder / decoder can set candIntraPredModeX to the mode used by the surrounding position. Or, even if the surrounding position does not use multiple hypothesis prediction, if the mode used by the surrounding position is a vertical mode or a height mode, the encoder / decoder can set candIntraPredModeX to the mode used by the surrounding position. Or, when the surrounding position is on the upper side of the current block, even if the surrounding position does not use multiple hypothesis prediction, if the mode used by the surrounding position is a vertical mode, the encoder / decoder can set candIntraPredModeX to the mode used by the surrounding position. Also, when the surrounding position is on the left side of the current block, even if the surrounding position does not use multiple hypothesis prediction, if the mode used by the surrounding position is a horizontal mode, the encoder / decoder can set candIntraPredModeX to the mode used by the surrounding position.

[0239] Referring to FIG. 34, mh_intra_flag may be a syntax element (or variable) indicating whether or not multiple hypothesis prediction is used. In addition, the intra prediction mode used in the neighboring blocks may be horizontal mode. In addition, the current block can use multiple hypothesis prediction, and a candidate list can be generated using candIntraPredMode based on the mode of the neighboring blocks. Even if the neighboring blocks do not use multiple hypothesis prediction, the encoder / decoder can set candIntraPredMode to horizontal mode because the intra prediction mode of the neighboring blocks is a specific mode, for example, horizontal mode.

[0240] The above-described example of the surrounding mode reference method will be described again below in combination with another embodiment of Figure 30. According to one embodiment of the present invention, the intra prediction mode candIntraPredModeX (X is A or B) of the surrounding block can be derived in the following manner.

[0241] 1. An availability induction process for the block specified in the neighbor block availability confirmation process is called, and the availability induction process sets the position (xCurr, yCurr) to (xCb, yCb) and can take the neighbor position (xNbY, yNbY) as (xNbX, yNbX) as input, and the output may be assigned to the availability variable availableX.

[0242] 2. The candidate intra prediction modes candIntraPredModeX may be derived in the following manner:

[0243] A. candIntraPredModeX may be set to INTRA_DC mode if one or more of the following conditions are true:

[0244] a) The variable availableX is FALSE.

[0245] b) When mh_intra_flag[xNbX][yNbX] is not 1 and IntraPredModeY[xNbX][yNbX] is not INTRA_ANGULAR50 and INTRA_ANGULAR18.

[0246] c) When X is B and yCb-1 is smaller than ((yCb>>CtbLog2SizeY)<<CtbLog2SizeY).

[0247] B. Otherwise, if IntraPredModeY[xNbX][yNbX]>INTRA_ANGULAR34, candIntraPredModeX may be set to INTRA_ANGULAR50.

[0248] C. Otherwise, if IntraPredModeY[xNbX][yNbX]<=INTRA_ANGULAR34 and IntraPredModeY[xNbX][yNbX]>INTRA_DC, candIntraPredModeX may be set to INTRA_ANGULAR18.

[0249] D. Otherwise, candIntraPredModeX may be set to IntraPredModeY[xNbX][yNbX].

[0250] According to another embodiment of the present invention, the intra prediction mode candIntraPredModeX (X is A or B) of the peripheral block can be derived in the following manner.

[0251] 1. The availability derivation process for the block specified in the adjacent block availability confirmation process is called. The availability derivation process may set the position (xCurr, yCurr) to (xCb, yCb), and the adjacent position (xNbY, yNbY) can take (xNbX, yNbX) as input, and the output may be assigned to the availability variable availableX.

[0252] 2. The candidate intra prediction mode candIntraPredModeX can be derived in the following way:

[0253] A. If one or more of the following conditions are true, candIntraPredModeX may be set to the INTRA_DC mode.

[0254] a) If the variable availableX is FALSE.

[0255] b) If mh_intra_flag[xNbX][yNbX] is not 1 and IntraPredModeY[xNbX][yNbX] is not INTRA_PLANAR, INTRA_DC, INTRA_ANGULAR50, and INTRA_ANGULAR18.

[0256] c) If X is B and yCb-1 is less than ((yCb >> CtbLog2SizeY) << CtbLog2SizeY).

[0257] B. Otherwise, if IntraPredModeY[xNbX][yNbX] > INTRA_ANGULAR34, candIntraPredModeX may be set to INTRA_ANGULAR50.

[0258] C. Otherwise, if IntraPredModeY[xNbX][yNbX] <= INTRA_ANGULAR34 and IntraPredModeY[xNbX][yNbX] > INTRA_DC, candIntraPredModeX may be set to INTRA_ANGULAR18.

[0259] D. Otherwise, candIntraPredModeX may be set to IntraPredModeY[xNbX][yNbX].

[0260] In the above-mentioned list setting method, candIntraPredModeX may be determined by the surrounding mode reference method.

[0261] FIG. 35 is a diagram illustrating a method of using neighboring reference samples according to an embodiment of the present invention. As described above, when multiple hypothesis prediction is used, intra prediction can be used in combination with other predictions. Therefore, when multiple hypothesis prediction is used, intra prediction can be generated using samples around the current block as reference samples. According to an embodiment of the present invention, when multiple hypothesis prediction is used, a mode using reconstructed samples can be used. Also, when multiple hypothesis prediction is not used, the mode using reconstructed samples does not need to be used. The reconstructed samples may be reconstructed samples around the current block.

[0262] A template matching method can be used as an example of the mode using the reconstructed sample. That is, a reconstructed sample at a position already set based on a certain block can be defined as a template (or a template region). The template matching may be an operation of comparing the cost of a template of a block to be compared with that of a current block to search for a block with a smaller cost. In this case, the cost can be defined as the sum of absolute values ​​of templates, the sum of squared differences, etc. For example, the encoder / decoder can search for a block expected to be similar to the current block using template matching between the current block and a block of a reference picture, and can set a motion vector or refine the motion vector based on the search. In addition, examples of the mode using the reconstructed sample include motion compensation using a reconstructed sample, motion vector refinement, etc.

[0263] In order to use reconstructed samples around the current block, it is necessary to wait for the completion of decoding of the neighboring blocks when decoding the current block. In this case, it may be difficult to process the current block and the neighboring blocks in parallel. Therefore, when multiple hypothesis prediction is not used, the encoder / decoder may not use a mode using reconstructed samples around the current block to enable parallel processing. Alternatively, when multiple hypothesis prediction is used, the encoder / decoder may use other modes using reconstructed samples around the current block since intra prediction can be generated using reconstructed samples around the current block.

[0264] Also, according to an embodiment of the present invention, even if multiple hypothesis prediction is used, whether or not reconstructed samples around the current block can be used may vary depending on the candidate index. As an embodiment, when the candidate index is smaller than a predefined specific threshold, reconstructed samples around the current block can be used. When the candidate index is small, the number of candidate index signaling bits is small and the accuracy of the candidate is high, and the accuracy can be further improved by using reconstructed samples for candidates with high coding efficiency. As another embodiment, when the candidate index is larger than a specific threshold, reconstructed samples around the current block can be used. When the candidate index is large, the number of candidate index signaling bits is large and the accuracy of the candidate may be low, and the accuracy can be complemented by using reconstructed samples around the current block for the candidate with low accuracy.

[0265] According to an embodiment of the present invention, when using multiple hypothesis prediction, the encoder / decoder may generate inter prediction using reconstructed samples around the current block, and generate a predicted block by combining the inter prediction with intra prediction of the multiple hypothesis prediction. Referring to Figure 35, the value of mh_intra_flag, which is signaling indicating whether the current block uses multiple hypothesis prediction, is 1. Since the current block uses multiple hypothesis prediction, a mode using reconstructed samples around the current block may be used.

[0266] FIG. 36 is a diagram illustrating a transform mode according to an embodiment of the present invention. According to an embodiment of the present invention, a transform mode may exist in which a transform is applied only to a sub-part of a block. In this specification, such a transform mode in which a transform is applied only to a sub-part may be called a sub-block transform (SBT) or a spatially varying transform (SVT). For example, a CU or a PU may be divided into a plurality of TUs, and only a part of the plurality of TUs may be transformed. Or, for example, only one of the plurality of TUs may be transformed. A TU that is not transformed among the plurality of TUs may be set to have a residual of 0.

[0267] Referring to FIG. 36, there are two types of types for dividing one CU or PU into multiple TUs: SBT-V (SBT-vertical) and SBT-H (SBT-horizontal). SBT-V may be a type in which the height of multiple TUs is equal to the CU or PU height, and the width of multiple TUs is different from the CU or PU width. SBT-H may be a type in which the height of multiple TUs is different from the CU or PU height, and the width of multiple TUs is equal to the CU or PU width. As an embodiment, the width and position of the TU to be transformed in SBT-V may be signaled. Also, the height and position of the TU to be transformed in SBT-H may be signaled. According to an embodiment, a transformation kernel according to the SBT type, position, and width or height may be set in advance.

[0268] In this way, the mode of transforming only a part of a CU or PU exists because the residual may mainly exist in a part of a CU or PU after prediction. That is, SBT has the same concept as the skip mode for a TU. In this case, the existing skip mode may be the skip mode for a CU.

[0269] Referring to FIG. 36, for each type of SBT-V ((a) and (b) of FIG. 36) and SBT-H ((c) and (d) of FIG. 36), a transformation position indicated by A may be defined. Then, the width or height may be defined as 1 / 2 or 1 / 4 of the CU width or CU height. Also, the residual in the part other than the area indicated by A may be considered to be a zero value. Also, conditions under which SBT can be used may be defined. For example, the conditions under which SBT is possible may be signaled as to whether it is usable or not in conditions related to the block size or in the syntax of a higher level (e.g., sequence, slice, tile, etc.).

[0270] According to an embodiment of the present invention, there may be a relationship between the multiple hypothesis prediction and the conversion mode. For example, the use of one of the modes may determine whether the other mode is used. Or, the use of one mode may determine whether the other mode is used. Or, the use of one mode may determine whether the other mode is used. As an example, the conversion mode may be the SBT described in FIG. 36. That is, the use of the SBT may determine whether the multiple hypothesis prediction is used. Or, the use of the multiple hypothesis prediction may determine whether the SBT is used. Table 6 below shows a syntax structure illustrating a relationship between the multiple hypothesis prediction and the conversion mode according to an embodiment of the present invention.

[0271] [Table 6]

[0272] Referring to Table 6, whether SBT is used may be determined depending on whether multiple hypothesis prediction is used. That is, if multiple hypothesis prediction is not applied to the current block (!mh_intra_flag is true), the decoder may parse cu_sbt_flag, which is a syntax element indicating whether SBT is applied. If multiple hypothesis prediction is not applied to the current block, cu_sbt_flag may not need to be parsed. In this case, the value of cu_sbt_flag may be inferred to be 0 according to a predefined condition.

[0273] As described above, the SBT continues to improve compression performance when residuals exist only in a part of a block after prediction for the processing block. Meanwhile, in the case of multiple hypothesis prediction, since the movement of an object can be effectively reflected using inter prediction and the remaining area can be efficiently predicted using intra prediction, the prediction performance for the entire block is expected to be improved. That is, when multiple hypothesis prediction is applied, the prediction performance for the entire block is improved, and the phenomenon in which residuals are concentrated only in a part of the block occurs relatively less. Therefore, according to one embodiment of the present invention, the encoder / decoder may not apply the SBT when multiple hypothesis prediction is applied. Alternatively, the encoder / decoder may not apply the multiple hypothesis prediction when SBT is applied.

[0274] According to an embodiment of the present invention, the position of the TU transformed by the SBT may be restricted depending on whether or not multiple hypothesis prediction is used or the mode of multiple hypothesis prediction. Alternatively, the width (SBT-V) or height (SBT-H) of the TU transformed by the SBT may be restricted depending on whether or not multiple hypothesis prediction is used or the mode of multiple hypothesis prediction. This can reduce signaling related to the position, width, or height. For example, the position of the TU transformed by the SBT does not need to be in an area with a high weight value of intra prediction in multiple hypothesis prediction. This is because the residual of an area with a high weight value can be reduced by multiple hypothesis prediction.

[0275] Therefore, when multiple hypothesis prediction is used, there may be no mode that converts the side with a larger weight value in SBT. For example, when the horizontal mode or vertical mode is used in multiple hypothesis prediction, the SBT types in (b) and (d) of FIG. 36 may be omitted (i.e., may not be considered). As another embodiment, when the planar mode is used in multiple hypothesis prediction, the position of the TU to be converted by the SBT may be restricted. For example, when the planar mode is used in multiple hypothesis prediction, the SBT types in (a) and (c) of FIG. 36 may be omitted. This is because, when the planar mode is used in multiple hypothesis prediction, the area adjacent to the reference sample of intra prediction may have a value similar to the reference sample value, and therefore, the residual in the area adjacent to the reference sample may be relatively small.

[0276] In another embodiment, when multiple hypothesis prediction is used, the possible width or height value of the TU to be converted by SBT may change. Or, when a specific mode is used in multiple hypothesis prediction, the possible width or height value of the TU to be converted by SBT may change. For example, when multiple hypothesis prediction is used, since not much residual is left in a wide part of a block, a large value of the width or height of the TU to be converted by SBT may be excluded. Or, when multiple hypothesis prediction is used, the value of the width or height of the TU to be converted by SBT, such as a unit in which a weight value changes in multiple hypothesis prediction, may be excluded.

[0277] Referring to Table 6, cu_sbt_flag indicating whether SBT is used and mh_intra_flag indicating whether multiple hypothesis prediction is used may be present. If mh_intra_flag is 0, cu_sbt_flag may be parsed. Also, if cu_sbt_flag is not present, it may be inferred to be 0. Both combining intra prediction with multiple hypothesis prediction and SBT can be used to solve the problem that a large amount of residual may remain only in a part of a CU or PU when the corresponding technology is not used. Therefore, since there may be an association between the two technologies, it is possible to determine whether one technology is used or whether a specific mode of one technology is used based on the other technology.

[0278] Also, in Table 6, sbtBlockConditions may indicate conditions under which SBT is possible. The conditions under which SBT is possible may include conditions related to block size, signaling values ​​regarding whether or not it is available at a higher level (e.g., sequence, slice, tile, etc.), etc.

[0279] FIG. 37 is a diagram illustrating a relationship between chrominance components according to an embodiment of the present invention. Referring to FIG. 37, a color format may be expressed as chroma_format_idc, Chroma format, separate_colour_plane_flag, etc. If it is monochrome, only one sample array may exist. SubWidthC and SubHeightC may both be 1. If it is 4:2:0 sampling, there may be two chrominance arrays (or chrominance components, chrominance blocks). The chrominance array may have half the width and half the height of the luma array (or luma component, luminance block). SubWidthC and SubHeightC may both be 2. SubWidthC and SubHeightC may indicate the size of the chrominance array compared to the luma array, where if the width or height of the chrominance array is half the size of the luma array, SubWidthC or SubHeightC may be 2, and if the width or height of the chrominance array is the same size as the luma array, SubWidthC or SubHeightC may be 1.

[0280] If the sampling is 4:2:2, there may be two chrominance arrays. The chrominance arrays may be half the width and the same height as the luma array. SubWidthC and SubHeightC may be 2 and 1, respectively. If the sampling is 4:4:4, the chrominance arrays may be the same width and height as the luma array. SubWidthC and SubHeightC may both be 1. In this case, they may be processed separately based on separate_colour_plane_flag. If separate_colour_plane_flag is 0, the chrominance arrays may be the same width and height as the luma array. If separate_colour_plane_flag is 1, the three color planes (luminance, Cb, Cr) may be processed separately. Regardless of separate_colour_plane_flag, if the sampling is 4:4:4, SubWidthC and SubHeightC may both be 1.

[0281] If separate_colour_plane_flag is 1, one slice may only correspond to one color component. If separate_colour_plane_flag is 0, one slice may correspond to multiple color components. Referring to FIG. 38, SubWidthC and SubHeightC may be different only in the case of 4:2:2. Therefore, in the case of 4:2:2, the relationship between the luminance reference width and height and the relationship between the chrominance reference width and height may be different.

[0282] For example, if a reference width of luminance samples is widthL and a reference width of chrominance samples is widthC, and widthL and widthC correspond to each other, the relationship between them is expressed by the following Equation 6.

[0283]

number

[0284] Similarly, if the reference height of the luminance sample is heightL and the reference height of the chrominance sample is heightC, and heightL and heightC correspond to each other, the relationship between them is expressed by the following Equation 7.

[0285]

number

[0286] There may also be a value that indicates a color component. For example, cIdx may indicate a color component. For example, cIdx may be a color component index. If cIdx is 0, it may indicate a luma component. If cIdx is not 0, it may indicate a chrominance component. If cIdx is 1, it may indicate a chrominance Cb component. If cIdx is 2, it may indicate a chrominance Cr component.

[0287] FIG. 38 is a diagram showing a relationship between color components according to an embodiment of the present invention. (a), (b), and (c) of FIG. 38 assume the cases of 4:2:0, 4:2:2, and 4:4:4, respectively. Referring to FIG. 38(a), one chrominance sample (one Cb, one Cr) may be located for every two luminance samples in the horizontal direction. Also, one chrominance sample (one Cb, one Cr) may be located for every two luminance samples in the vertical direction. Referring to FIG. 38(b), one chrominance sample (one Cb, one Cr) may be located for every two luminance samples in the horizontal direction. Also, one chrominance sample (one Cb, one Cr) may be located for every luminance sample in the vertical direction. Referring to FIG. 38(c), one chrominance sample (one Cb, one Cr) may be located for every luminance sample in the horizontal direction. Also, one chrominance sample (one Cb, one Cr) may be located for each luma sample in the vertical direction.

[0288] As described above, SubWidthC and SubHeightC described in Fig. 37 may be determined based on such a relationship. Then, conversion between the luminance sample standard and the chrominance sample standard can be performed based on SubWidthC and SubHeightC.

[0289] FIG. 39 is a diagram illustrating a peripheral reference position according to an embodiment of the present invention. According to an embodiment of the present invention, an encoder / decoder may refer to a peripheral position during prediction. For example, as described above, when performing combined inter-picture merge and intra-picture prediction (CIIP), the peripheral position may be referenced. The CIIP may be the above-mentioned multiple hypothesis prediction. That is, the CIIP may be a prediction method combining inter prediction (e.g., merge mode inter prediction) and intra prediction. According to an embodiment of the present invention, the encoder / decoder may combine inter prediction and intra prediction with reference to the peripheral position. For example, the encoder / decoder may determine a ratio of inter prediction to intra prediction with reference to the peripheral position. Alternatively, the encoder / decoder may determine a weighting when combining inter prediction and intra prediction with reference to the peripheral position. Alternatively, the encoder / decoder may determine a weighting when performing a weighted sum (or weighted average) of inter prediction and intra prediction with reference to the peripheral position.

[0290] According to an embodiment of the present invention, the referenced neighboring positions may include NbA and NbB. The coordinates of NbA and NbB may be (xNbA, yNbA) and (xNbB, yNbB), respectively. NbA may be the left position of the current block. Specifically, if the top left coordinate of the current block is (xCb, yCb) and the width and height of the current block are cbWidth and cbHeight, respectively, NbA may be (xCb-1, yCb+cbHeight-1). The top left coordinate (xCb, yCb) of the current block may be a value based on the luma sample. Alternatively, the top left coordinate (xCb, yCb) of the current block may be the position of the top left luma sample of the current luma coding block relative to the top left luma sample of the current picture. Furthermore, the cbWidth and cbHeight may indicate width and height based on the color component, respectively. The above-described coordinates may be for a luma component (or a luma block). For example, the cbWidth and cbHeight may indicate width and height based on the luma component.

[0291] Also, NbB may be the upper position of the current block. More specifically, if the top left coordinate of the current block is (xCb, yCb) and the width and height of the current block are cbWidth and cbHeight, respectively, NbB may be (xCb+cbWidth-1, yCb-1). The top left coordinate (xCb, yCb) of the current block may be a value based on a luma sample. Or, the top left coordinate (xCb, yCb) of the current block may be a top left luma sample position of a current luma coding block with respect to the top left luma sample of a current picture. Also, the cbWidth and cbHeight may be values ​​based on the corresponding color component. The above coordinates may be for a luma component (luma block). For example, cbWidth and cbHeight may be values ​​based on a luma component.

[0292] Referring to FIG. 39, the top left corner, coordinates of NbA, coordinates of NbB, etc., for a luminance block are illustrated. Also, NbA may be the left position of the current block. More specifically, if the top left corner coordinates of the current block are (xCb, yCb) and the width and height of the current block are cbWidth and cbHeight, respectively, NbA may be (xCb-1, yCb+2*cbHeight-1). The top left corner coordinates (xCb, yCb) of the current block may be values ​​based on the luminance sample. Or, the top left corner coordinates (xCb, yCb) of the current block may be the top left corner luminance sample position of the current luminance coding block with respect to the top left corner luminance sample of the current picture. Also, the cbWidth and cbHeight may be values ​​based on the corresponding color component. The above coordinates may be for a chrominance component (chrominance block). For example, cbWidth and cbHeight may be values ​​based on chrominance components, and the coordinates may be in 4:2:0 format.

[0293] Also, NbB may be the upper position of the current block. More specifically, if the top left coordinate of the current block is (xCb, yCb) and the width and height of the current block are cbWidth and cbHeight, respectively, NbB may be (xCb+2*cbWidth-1, yCb-1). The top left coordinate (xCb, yCb) of the current block may be a value based on a luminance sample. Or, the top left coordinate (xCb, yCb) of the current block may be a top left luminance sample position of a current luminance coding block with respect to the top left luminance sample of the current picture. Also, the cbWidth and cbHeight may be values ​​based on the corresponding color component. The above coordinates may be for a chroma component. For example, cbWidth and cbHeight may be values ​​based on a chroma component. Also, this coordinate may be in a 4:2:0 format or a 4:2:2 format. Referring to Figure 39, the top left corner, coordinates of NbA, coordinates of NbB, etc., for a chrominance block are illustrated.

[0294] FIG. 40 illustrates a weighted sample prediction process according to an embodiment of the present invention. In the embodiment of FIG. 40, a method of combining two or more prediction signals is described. The embodiment of FIG. 40 can be applied when CIIP is used. The embodiment of FIG. 40 can include the peripheral location reference method described in FIG. 39. Referring to FIG. 44, a variable scalFact indicating a scaling factor can be expressed as the following Equation 8.

[0295]

number

[0296] In Mathematical Formula 8, when cIdx is 0, the encoder / decoder can set scallFact to 0, and when cIdx is not 0, the encoder / decoder can set scallFact to 1. In an embodiment of the present invention, x?y:z may indicate a y value when x is true or x is not 0, and may indicate a z value otherwise (when x is false (or when x is 0)).

[0297] Also, the encoder / decoder can set the coordinates (xNbA, yNbA) and (xNbB, yNbB) of the peripheral positions NbA and NbB referred to for multi-hypothesis prediction. According to the embodiment described in FIG. 39, for the luminance component, (xNbA, yNbA) and (xNbB, yNbB) may be (xCb - 1, yCb + cbHeight - 1) and (xCb + cbWidth - 1, yCb - 1), respectively, and for the color difference component, (xNbA, yNbA) and (xNbB, yNbB) may be set to (xCb - 1, yCb + 2*cbHeight - 1) and (xCb + 2*cbWidth - 1, yCb - 1), respectively. Also, the operation of multiplying by 2^n may be the same as the operation of left-shifting n bits. For example, the operation of multiplying by 2 may be calculated as the value of left-shifting 1 bit. Also, left-shifting x by n bits can be expressed as "x << n". Also, the operation of dividing by 2^n may be the same as the operation of right-shifting n bits. Also, the operation of dividing by 2^n and discarding the fraction part may be calculated as the value of right-shifting n bits. For example, the operation of dividing by 2 may be calculated as the value of right-shifting 1 bit. Also, right-shifting x by n bits can be expressed as "x >> n". Therefore, (xCb - 1, yCb + 2*cbHeight - 1) and (xCb + 2*cbWidth - 1, yCb - 1) can be expressed as (xCb - 1, yCb + (cbHeight << 1) - 1) and (xCb + (cbWidth << 1) - 1). Therefore, when representing both the coordinates for the luminance component and the coordinates for the color difference component described above, it is as shown in the following Mathematical Formula 9.

[0298]

number

[0299] In Equation 9, scallFact may be determined as (cIdx==0)?0:1 as described above. Here, cbWidth and cbHeight represent width and height based on each color component. For example, when the width and height based on the luminance component are cbWidthL and cbHeightL, respectively, and a weighted sample prediction process is performed on the luminance component, cbWidth and cbHeight may be cbWidthL and cbHeightL, respectively. Also, when the width and height based on the luminance component are cbWidthL and cbHeightL, respectively, and a weighted sample prediction process is performed on the chrominance component, cbWidth and cbHeight may be cbWidthL / SubWidthC and cbHeightL / SubHeightC, respectively.

[0300] According to an embodiment of the present invention, the encoder / decoder may determine a prediction mode of a corresponding position by referring to a neighboring position. For example, the encoder / decoder may determine whether the prediction mode is intra prediction. The prediction mode may be indicated by CuPredMode. If CuPredMode is MODE_INTRA, the mode may be a mode using intra prediction. The CuPredMode value may be MODE_INTRA, MODE_INTER, MODE_IBC, or MODE_PLT. If CuPredMode is MODE_INTER, inter prediction may be used. If CuPredMode is MODE_IBC, intra block copy (IBC) may be used. If CuPredMode is MODE_PLT, palette mode may be used. CuPredMode may be indicated by a channel type (channel type, chType) and a position. For example, it may be indicated as CuPredMode[chType][x][y], and this value may be a CuPredMode value for a channel type chType at a (x, y) position.

[0301] Also, according to an embodiment of the present invention, chType may be based on a tree type. For example, the tree type may be set to values ​​such as SINGLE_TREE, DUAL_TREE_LUMA, DUAL_TREE_CHROMA, etc. In the case of SINGLE_TREE, there may be a shared portion of block partitioning of the luminance component and the chrominance component. For example, in the case of SINGLE_TREE, the block partitioning of the luminance component and the chrominance component may be the same. Alternatively, in the case of SINGLE_TREE, the block partitioning of the luminance component and the chrominance component may be the same or partially the same. Alternatively, in the case of SINGLE_TREE, the block partitioning of the luminance component and the chrominance component may be performed by the same syntax element value.

[0302] Also, according to an embodiment of the present invention, in the case of a DUAL TREE, block partitioning of the luminance component and the chrominance component may be independent. Or, in the case of a DUAL TREE, block partitioning of the luminance component and the chrominance component may be performed by different syntax element values. In addition, in the case of a DUAL TREE, a tree type value may be DUAL_TREE_LUMA or DUAL_TREE_CHROMA. If the tree type is DUAL_TREE_LUMA, a DUAL TREE may be used to indicate that it is a process for the luminance component. If the tree type is DUAL_TREE_CHROMA, a DUAL TREE may be used to indicate that it is a process for the chrominance component. In addition, chType may be determined based on whether the tree type is DUAL_TREE_CHROMA. For example, chType may be set to 1 if the tree type is DUAL_TREE_CHROMA, and may be set to 0 if the tree type is not DUAL_TREE_CHROMA. Therefore, referring to Figure 40, the CuPredMode[0][xNbX][yNbY] value can be determined. X is replaceable with A and B. That is, the CuPredMode value for the NbA and NbB positions can be determined.

[0303] Also, according to an embodiment of the present invention, the isIntraCodedNeighbourX value may be set based on the prediction mode for the surrounding position. For example, the isIntraCodedNeighbourX value may be set depending on whether the CuPredMode for the surrounding position is MODE_INTRA. If the CuPredMode for the surrounding position is MODE_INTRA, the isIntraCodedNeighbourX value may be set to TRUE, and if the CuPredMode for the surrounding position is not MODE_INTRA, the isIntraCodedNeighbourX value may be set to FALSE. In the present invention described above and below, X may be replaced with A or B, etc. Also, X may indicate that it corresponds to the X position.

[0304] Also, according to an embodiment of the present invention, it is possible to determine whether the location is available by referring to the neighboring locations. Whether the location is available can be set by availableX. Also, isIntraCodedNeighbourX can be set based on availableX. For example, if availableX is TRUE, isIntraCodedNeighbourX can be set to TRUE, and for example, if availableX is FALSE, isIntraCodedNeighbourX can be set to FALSE. Referring to FIG. 40, whether the location is available can be determined by invoking "the derivation process for neighbouring block availability". Also, whether the location is available can be determined based on whether the location is inside the current picture. If the location is (xNbY, yNbY), and xNbY or yNbY is less than 0, it is outside the current picture, and availableX may be set to FALSE. Also, if xNbY is equal to or greater than the picture width, it is a picture that is out of the current picture, and availableX may be set to FALSE. The picture width may be indicated by pic_width_in_luma_samples. Also, if yNbY is equal to or greater than the picture height, it is a picture that is out of the current picture, and availableX may be set to FALSE. The picture height may be indicated by pic_height_in_luma_samples. Also, if the position is in a block or slice different from the current block, availableX may be set to FALSE. Also, if reconstruction of the position is not completed, availableX may be set to FALSE. Whether reconstruction is completed or not may be indicated by IsAvailable[cIdx][xNbY][yNbY]. In short, if any one of the following conditions is met, availableX may be set to FALSE, and if not (if all of the following conditions are not met), availableX may be set to TRUE.

[0305] - Condition 1: xNbY<0

[0306] - Condition 2: yNbY<0

[0307] - Condition 3: xNbY>=pic_width_in_luma_samples

[0308] - Condition 4:yNbY>=pic_height_in_luma_samples

[0309] - Condition 5: IsAvailable[cIdx][xNbY][yNbY]==FALSE

[0310] Condition 6: If the position (peripheral position (xNbY, yNbY) position) belongs to a block (or a slice) different from the current block

[0311] Also, according to an embodiment of the present invention, it is possible to determine whether the current location and the target location are in the same CuPredMode by an option and set availableX. The two conditions described above can be combined to set isIntraCodedNeighbourX. For example, if all of the following conditions are met, isIntraCodedNeighbourX can be set to TRUE, and if not (if at least one of the following conditions is not met), isIntraCodedNeighbourX can be set to FALSE.

[0312] - Condition 1: availableX==TRUE

[0313] - Condition 2: CuPredMode[0][xNbX][yNbX]==MODE_INTRA

[0314] Also, according to an embodiment of the present invention, a weight value of CIIP may be determined based on a plurality of isIntraCodedNeighbourX. For example, when inter prediction and intra prediction are combined based on a plurality of isIntraCodedNeighbourX, a weight value may be determined. For example, it may be determined based on isIntraCodedNeighbourA and isIntraCodedNeighbourB. According to an embodiment, if isIntraCodedNeighbourA and isIntraCodedNeighbourB are both TRUE, w may be set to 3. For example, w may be a value that determines a weight value or a weight value of CIIP. Also, if isIntraCodedNeighbourA and isIntraCodedNeighbourB are both FALSE, w may be set to 1. Also, if one of isIntraCodedNeighbourA and isIntraCodedNeighbourB is FALSE (same as when one of both is TRUE), w may be set to 2. That is, w can be set based on whether or not the surrounding positions are predicted by intra prediction, or based on how much the surrounding positions are predicted by intra prediction.

[0315] Also, according to an embodiment of the present invention, w may be a weighting value corresponding to intra prediction. Also, a weighting value corresponding to inter prediction may be determined based on w. For example, a weighting value corresponding to inter prediction may be (4-w). When combining two or more prediction signals, the encoder / decoder may use the following Equation 10.

[0316]

number

[0317] In Equation 10, predSamplesIntra and predSamplesInter may be prediction signals. For example, predSamplesIntra and predSamplesInter may be prediction signals predicted by intra prediction and inter prediction (e.g., merge mode, more specifically, regular merge mode), respectively. Also, predSampleComb may be a prediction signal used in CIIP.

[0318] Furthermore, according to an embodiment of the present invention, a process of updating prediction signals before combination may be included prior to application of Equation 10. For example, the following Equation 11 may be applied to the update process. For example, the process of updating prediction signals may be a process of updating an inter-prediction signal of CIIP.

[0319]

number

[0320] FIG. 41 is a diagram showing peripheral reference positions according to one embodiment of the present invention.

[0321] Although the peripheral reference positions have been described in FIG. 39 and FIG. 40, problems may occur if the described positions are used in all cases (for example, all chrominance blocks), and this problem will be described in FIG. 41. The embodiment of FIG. 41 shows a chrominance block. In FIG. 39 and FIG. 40, the NbA and NbB coordinates based on the luminance sample for the chrominance block are (xCb-1, yCb+2*cbHeight-1) and (xCb+2*cbWidth-1, yCb-1), respectively. However, when SubWidthC or SubHeightC is 1, it may indicate the position shown in FIG. 41, which is different from the position shown in FIG. 39. In the above coordinates, cbWidth and cbHeight are multiplied by 2 because cbWidth and cbHeight are based on each color component (chrominance component in this embodiment) and the coordinates are based on the luminance, so in the case of 4:2:0, this may be to compensate for the number of luminance samples versus chrominance samples. That is, the coordinates may be expressed on a luminance basis when there is one chrominance sample corresponding to two luminance samples based on the x-axis and one chrominance sample corresponding to two luminance samples based on the y-axis. Therefore, when SubWidthC or SubHeightC is 1, a different position may be indicated. Therefore, if the (xCb-1, yCb+2*cbHeight-1) or (xCb+2*cbWidth-1, yCb-1) position is always used for the chrominance block, a position far away from the current chrominance block may be referenced. In addition, in this case, the relative position used for the luminance block of the current block may not match the relative position used for the chrominance block. In addition, since different positions are referenced for the chrominance block, a weight may be set by referring to a position that is less related to the current block, or decoding / restoration may not be performed in the block decoding order.

[0322] 41 shows the positions of the above-mentioned luminance reference coordinates in the case of 4:4:4, that is, when SubWidthC and SubHeightC are both 1. NbA and NbB are located away from the chrominance blocks shown by solid lines.

[0323] FIG. 42 is a diagram illustrating a weighted sample prediction process according to an embodiment of the present invention. The embodiment of FIG. 42 may be an embodiment for solving the problems described in FIG. 39 to FIG. 41. Also, the description of the contents overlapping with the contents described above will be omitted. In FIG. 40, the peripheral positions are set based on scallFact, and as described in FIG. 41, scallFact is a value for converting the position when SubWidthC and SubHeightC are 2. However, as described above, problems may occur depending on the color format, and the ratio of chrominance samples to luminance samples may differ in the horizontal and vertical directions, so according to an embodiment of the present invention, scallFact can be separated into the horizontal (width) and vertical (height).

[0324] According to an embodiment of the present invention, scallFactWidth and scallFactHeight may exist, and the peripheral position may be set based on scallFactWidth and scallFactHeight. Also, the peripheral position may be set based on luma samples (luminance blocks). Also, scallFactWidth may be set based on cIdx and SubWidthC. For example, if cIdx is 0 or SubWidthC is 1, scallFactWidth may be set to 0, and otherwise (if cIdx is not 0 and SubWidthC is not 1 (if SubWidthC is 2)), scallFactWidth may be set to 1. In this case, scallFactWidth may be determined using the following mathematical formula 12.

[0325]

number

[0326] Also, scallFactHeight can be set based on cIdx and SubHeightC. For example, if cIdx is 0 or SubHeightC is 1, scallFactHeight can be set to 0, and otherwise (if cIdx is not 0 and SubHeightC is not 1 (if SubHeightC is 2)), scallFactHeight can be set to 1. In this case, scallFactHeight can be determined using the following mathematical formula 13.

[0327]

number

[0328] Also, the x coordinate of the peripheral position can be indicated based on scallFactWidth, and the y coordinate of the peripheral position can be indicated based on scallFactHeight. For example, the coordinate of NbB can be set based on scallFactWidth. For example, the coordinate of NbA can be set based on scallFactHeight. Also, as described above, the basis of scallFactWidth here can be based on SubWidthC, and the basis of scallFactHeight can be based on SubHeightC. For example, the peripheral position coordinates are as shown in the following mathematical formula 14.

[0329]

number

[0330] In this case, xCb and yCb may be coordinates based on the luminance sample as described above, and cbWidth and cbHeight may be coordinates based on each color component.

[0331] Therefore, if it is a chrominance block and SubWidthC is 1, (xNbB, yNbB)=(xCb+cbWidth-1, yCb-1). That is, in this case, the NbB coordinate for the luma block and the NbB coordinate for the chrominance block may be the same. Also, if it is a chrominance block and SubHeightC is 1, (xNbA, yNbA)=(xCb-1, yCb+cbHeight-1). That is, in this case, the NbA coordinate for the luma block and the NbA coordinate for the chrominance block may be the same.

[0332] Therefore, the embodiment of Figure 42 can set the same peripheral coordinates as the embodiments of Figures 39 and 40 when the format is 4:2:0, and can set different peripheral coordinates from the embodiments of Figures 39 and 40 when the format is 4:2:2 or 4:4:4.

[0333] The process other than that of Fig. 42 may be the same as that described in Fig. 40. That is, the prediction mode or availability may be determined based on the peripheral position coordinates described in Fig. 42, and the weight of the CIIP may be determined. In the present invention, the peripheral position and the coordinates of the peripheral position may be used interchangeably.

[0334] FIG. 43 is a diagram illustrating a weighted sample prediction process according to an embodiment of the present invention. The embodiment of FIG. 43 expresses the peripheral position coordinates described in FIG. 42 in a different manner. Therefore, the same content as described above may be omitted. As described above, bit shifting can be expressed by multiplication. FIG. 42 may be shown using bit shifting, and FIG. 43 may be shown using multiplication.

[0335] According to one embodiment, scallFactWidth can be set based on cIdx and SubWidthC. For example, if cIdx is 0 or SubWidthC is 1, scallFactWidth can be set to 1, otherwise (if cIdx is not 0 and SubWidthC is not 1 (SubWidthC is 2)), scallFactWidth can be set to 2. In this case, scallFactWidth can be determined using the following mathematical formula 15.

[0336]

number

[0337] Also, scallFactHeight can be set based on cIdx and SubHeightC. For example, if cIdx is 0 or SubHeightC is 1, scallFactHeight can be set to 1, otherwise (if cIdx is not 0 and SubHeightC is not 1 (if SubHeightC is 2)), scallFactHeight can be set to 2. In this case, scallFactHeight can be determined using the following mathematical formula 16.

[0338]

number

[0339] Also, the x coordinate of the peripheral position can be indicated based on scallFactWidth, and the y coordinate of the peripheral position can be indicated based on scallFactHeight. For example, the coordinate of NbB can be set based on scallFactWidth. For example, the coordinate of NbA can be set based on scallFactHeight. Also, as described above, here, being based on scallFactWidth may be being based on SubWidthC, and being based on scallFactHeight may be being based on SubHeightC. For example, the peripheral position coordinates are as shown in the following mathematical formula 17.

[0340]

number

[0341] In this case, xCb and yCb may be coordinates based on the luminance sample as described above, and cbWidth and cbHeight may be coordinates based on each color component.

[0342] FIG. 44 is a diagram illustrating a weighted sample prediction process according to an embodiment of the present invention. In the embodiments of FIG. 40, FIG. 42, FIG. 43, etc., whether a position is available is determined by referring to neighboring positions. At this time, cIdx, which is an index indicating a color component, is set to 0 (luminance component). In addition, when determining whether a position is available, cIdx can be used to determine whether reconstruction of the position cIdx is completed. That is, when determining whether a position is available, cIdx can be used to determine the value of IsAvailable[cIdx][xNbY][yNbY]. However, when performing a weighted sample prediction process for a chrominance block, referring to the IsAvailable value corresponding to cIdx0 may result in an erroneous determination. For example, if the restoration of the luminance component of a block including a neighboring position is not completed but the restoration of the chrominance component is completed, if cIdx is not 0, IsAvailable[0][xNbY][yNbY] may be FALSE and IsAvailable[cIdx][xNbY][yNbY] may be TRUE. Therefore, even if the neighboring position is actually available, it may be determined that it is not available. In the embodiment of FIG. 44, in order to solve such a problem, when determining whether the position is available by referring to the neighboring position, the cIdx of the current coding block can be used as an input. That is, when calling "the derivation process for neighbouring block availability", the input cIdx can be the cIdx of the current coding block. In this embodiment, the description overlapping with the contents described in FIG. 42 and FIG. 43 is omitted.

[0343] In addition, when determining the prediction mode of the peripheral position, CuPredMode[0][xNbX][yNbY], which is CuPredMode corresponding to chType0, is referenced, but if the chType of the current block does not match, an incorrect parameter may be referenced. Therefore, according to one embodiment of the present invention, when determining the prediction mode of the peripheral position, CuPredMode[chType][xNbX][yNbY] corresponding to the chType value corresponding to the current block may be referenced.

[0344] Figure 45 is a diagram illustrating a video signal processing method based on multiple hypothesis prediction according to an embodiment to which the present invention is applied. With reference to Figure 45, for convenience of explanation, a decoder will be mainly described, but the present invention is not limited thereto, and the multiple hypothesis prediction-based video signal processing method according to this embodiment can be applied to an encoder in substantially the same manner.

[0345] Specifically, when a merge mode is applied to a current block, the decoder may obtain a first syntax element indicating whether or not a combined prediction is applied to the current block (S4501). Here, the combined prediction refers to a prediction mode that combines inter prediction and intra prediction. As described above, the present invention is not limited to such names, and in this specification, the multiple hypothesis prediction may be referred to as multiple prediction, multiple prediction, combined prediction, inter-intra weighted prediction, combined inter-intra prediction, combined inter-intra weighted prediction, etc. In one embodiment, the decoder may receive information for prediction of the current block prior to step S4501, and determine whether or not a merge mode is applied to the current block based on the information for prediction.

[0346] If the first syntax element indicates that the combined prediction is applied to the current block, the decoder may generate an inter-predicted block and an intra-predicted block of the current block (S4502). The decoder may then generate a combined prediction block by performing a weighted sum of the inter-predicted block and the intra-predicted block (S4503). The decoder may then decode a residual block of the current block and reconstruct the current block using the combined prediction block and the residual block.

[0347] As described above, in one embodiment, the decoding of the residual block may include obtaining a second syntax element indicating whether a sub-block transform is applied to the current block when the first syntax element indicates that the combined prediction is not applied to the current block. That is, the sub-block transform is applicable only when the combined prediction is not applied to the current block, and syntax signaling regarding whether to apply the sub-block transform may be performed. Here, the sub-block transform represents a transform mode for applying transform to any one of the sub-blocks of the current block divided in the horizontal or vertical direction.

[0348] As mentioned above, in one embodiment, if the second syntax element is not present, the value of the second syntax element may be inferred to be zero.

[0349] As mentioned above, in one embodiment, if the first syntax element indicates that the combined prediction is applied to the current block, the intra prediction mode for intra prediction for the current block may be set to planar mode.

[0350] As described above, in one embodiment, the decoder may set the positions of the left and upper neighboring blocks referenced for the combined prediction, and perform combined prediction based on the intra prediction mode of the set positions. In one embodiment, the decoder may determine weights used for combined prediction based on the intra prediction mode of the set position. Also, as described above, the positions of the left and upper neighboring blocks may be determined using a scaling factor variable determined by a color component index value of the current block.

[0351] The above-described embodiments of the present invention may be implemented in a variety of ways, for example, in hardware, firmware, software, or a combination thereof.

[0352] In the case of a hardware implementation, the methods according to the embodiments of the present invention may be implemented using one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSDPs), Programmable Logic Devices (PDLs), Field Programmable Gate Arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, etc.

[0353] In the case of implementation by firmware or software, the method according to the embodiment of the present invention may be implemented in the form of modules, procedures, or functions performing the functions or operations described above. The software code is stored in a memory and implemented by a processor. The memory may be located inside or outside the processor and may exchange data with the processor by various means known in the art.

[0354] Some embodiments may be embodied in the form of a recording medium including computer executable instructions such as program modules executed by a computer. Computer readable media is any available medium that can be accessed by a computer, including both volatile and non-volatile media, and both separate and non-separate media. Computer readable media also includes both storage media and communication media. Computer storage media includes both volatile and non-volatile media, and both separate and non-separate media embodied in any method or technology for storage of information such as computer readable instructions, data structures, program modules, or other data. Communication media typically includes computer readable instructions, data structures, or other data in a modulated data signal such as a program module, or other transmission mechanism, and includes any information delivery media.

[0355] The above description of the present invention is for illustrative purposes only, and those skilled in the art will understand that the present invention can be easily modified into other specific forms without changing the technical idea or essential features of the present invention. Therefore, it should be understood that the above-described embodiments are illustrative in all respects and are not limiting. For example, each component described as a single type may be implemented in a distributed form, and each component described as a distributed form may be implemented in a combined form.

[0356] The scope of the present invention is indicated by the claims set forth below rather than by the above detailed description, and all modifications and variations derived from the meaning and scope of the claims and their equivalent concepts should be interpreted as being included in the scope of the present invention. [Explanation of symbols]

[0357] 110 Conversion unit 115 Quantization section 120 Inverse quantization section 125 Reverse conversion unit 130 Filtering section 150 Prediction Department 152 Intra prediction unit 154 Inter Prediction Unit 154a Motion Estimation Unit 154b Motion compensation section 160 Entropy coding unit 210 Entropy Decoding Unit 220 Inverse quantization section 225 Inverse conversion unit 230 Filtering section 250 Prediction Department 252 Intra prediction unit 254 Inter Prediction Unit

Claims

1. 1. A video signal decoding device, comprising: A processor is included. The processor, Determine whether merge mode applies to the current block, When the merge mode is applied to the current block, a value of a first syntax element indicating whether combined prediction is applied to the current block is obtained; When the first syntax element indicates that the combined prediction is not applied to the current block, a value of a second syntax element indicating whether a sub-block transform is applied to the current block is obtained; wherein when the second syntax element is not present, the value of the second syntax element is inferred as a value indicating that the sub-block transform is not applied to the current block; The combined prediction is a prediction mode using the merge mode of inter prediction and intra prediction, The sub-block transform indicates a transform mode for applying a transform to a part of a sub-block of the current block divided in the horizontal or vertical direction. A video signal decoding device configured as follows.

2. The processor, When the value of the first syntax element indicates that the combined prediction is applied to the current block, reconstructing the current block based on the combined prediction; When the value of the first syntax element indicates that the combined prediction is not applied to the current block and the value of the second syntax element indicates that the sub-block transform is applied to the current block, reconstructing the current block based on the sub-block transform.

2. The video signal decoding device according to claim 1, configured to:

3. When the value of the first syntax element indicates that the combined prediction is applied to the current block, the current block is reconstructed based on a combined prediction block of the current block; The combined prediction block of the current block is obtained by a weighted sum of an inter prediction block and an intra prediction block; The video signal decoding apparatus of claim 2 , wherein the inter-predicted block is obtained by the merge mode of the inter prediction of the current block, and the intra-predicted block is obtained by the intra prediction of the current block.

4. The video signal decoding apparatus according to claim 3 , wherein the intra-prediction block is obtained based on a planar mode.

5. The adjacent positions referred to by the combined prediction are (xCb-1, yCb-1+cbHeight) and (xCb-1+cbWidth, yCb-1), 2. The video signal decoding apparatus of claim 1, wherein (xCb, yCb) is the top left coordinate of the current block, the cbHeight is the height of the current block, and the cbWidth is the width of the current block.

6. 6. The video signal decoding apparatus of claim 5, wherein the neighboring positions are determined using a scaling factor variable determined based on a color component index value of the current block.

7. 1. A method for processing a video signal, comprising the steps of: determining whether a merge mode is applied to the current block; obtaining a value of a first syntax element indicating whether combined prediction is applied to the current block when the merge mode is applied to the current block; and obtaining a value of a second syntax element indicating whether a sub-block transform is applied to the current block when the first syntax element indicates that the combined prediction is not applied to the current block; Including, when the second syntax element is not present, the value of the second syntax element is inferred as a value indicating that the sub-block transform is not applied to the current block; The combined prediction is a prediction mode using the merge mode of inter prediction and intra prediction, The sub-block transform indicates a transform mode that applies a transform to a part of a sub-block of the current block divided in a horizontal or vertical direction.

8. when the value of the first syntax element indicates that the combined prediction is applied to the current block, reconstructing the current block based on the combined prediction; and reconstructing the current block based on the sub-block transform when the value of the first syntax element indicates that the combined prediction is not applied to the current block and the value of the second syntax element indicates that the sub-block transform is applied to the current block.

8. The method of claim 7, further comprising:

9. When the value of the first syntax element indicates that the combined prediction is applied to the current block, the current block is reconstructed based on a combined prediction block of the current block; The combined prediction block of the current block is obtained by a weighted sum of an inter prediction block and an intra prediction block; The method of claim 8 , wherein the inter-predicted block is obtained by the merge mode of the inter prediction of the current block, and the intra-predicted block is obtained by the intra prediction of the current block.

10. The video signal processing method of claim 9 , wherein the intra-predicted block is obtained based on a planar mode.

11. The adjacent positions referred to by the combined prediction are (xCb-1, yCb-1+cbHeight) and (xCb-1+cbWidth, yCb-1), 8. The method of claim 7, wherein (xCb, yCb) is the top left coordinate of the current block, the cbHeight is the height of the current block, and the cbWidth is the width of the current block.

12. 12. The method of claim 11, wherein the neighboring positions are determined using a scaling factor variable determined based on a color component index value of the current block.

13. 1. A video signal encoding device, comprising: A processor is included. The processor, Determine whether merge mode applies to the current block, determining whether a combined prediction is applied to the current block when the merge mode is applied to the current block; When the combined prediction is not applied to the current block, determining whether a sub-block transform is applied to the current block; Obtaining a bitstream for reconstructing the current block; Here, when a second syntax element indicating whether a sub-block transform is applied to the current block is not included in the bitstream, the sub-block transform is not applied to the current block; The combined prediction is a prediction mode using the merge mode of inter prediction and intra prediction, The sub-block transform indicates a transform mode for applying a transform to a part of a sub-block of the current block divided horizontally or vertically. A video signal encoding device configured as follows.

14. The processor, When the combined prediction is applied to the current block, the current block is reconstructed based on the combined prediction; When the combined prediction is not applied to the current block and the sub-block transform is applied to the current block, the current block is restored based on the sub-block transform.

14. A video signal encoding device according to claim 13, configured to:

15. When the combined prediction is applied to the current block, the current block is reconstructed based on the combined prediction block of the current block; The combined prediction block of the current block is obtained by a weighted sum of an inter prediction block and an intra prediction block; The video signal encoding device according to claim 14 , wherein the inter-predicted block is obtained by the merge mode of the inter prediction of the current block, and the intra-predicted block is obtained by the intra prediction of the current block.

16. The video signal encoding device according to claim 15, wherein the intra-prediction block is obtained based on a planar mode.

17. The adjacent positions referred to by the combined prediction are (xCb-1, yCb-1+cbHeight) and (xCb-1+cbWidth, yCb-1), 14. The video signal encoding device of claim 13, wherein (xCb, yCb) is the top left coordinate of the current block, the cbHeight is the height of the current block, and the cbWidth is the width of the current block.

18. 20. The video signal encoding apparatus of claim 17, wherein the neighboring positions are determined using a scaling factor variable determined based on a color component index value of the current block.

19. 1. A method for obtaining a bitstream, comprising: determining whether a merge mode is applied to the current block; determining whether a combined prediction is applied to the current block when the merge mode is applied to the current block; determining whether a sub-block transform is applied to the current block when the combined prediction is not applied to the current block; and obtaining the bitstream for reconstructing the current block; Including, Here, when a second syntax element indicating whether a sub-block transform is applied to the current block is not included in the bitstream, the sub-block transform is not applied to the current block; The combined prediction is a prediction mode using the merge mode of inter prediction and intra prediction, A method for obtaining a bitstream, wherein the sub-block transform indicates a transform mode that applies a transform to a portion of a sub-block of the current block that is divided horizontally or vertically.

20. when the combined prediction is applied to the current block, reconstructing the current block based on the combined prediction; when the combined prediction is not applied to the current block and the sub-block transform is applied to the current block, reconstructing the current block based on the sub-block transform.

20. The method for obtaining a bitstream of claim 19, further comprising:

21. When the combined prediction is applied to the current block, the current block is reconstructed based on the combined prediction block of the current block; The combined prediction block of the current block is obtained by a weighted sum of an inter prediction block and an intra prediction block; The method for obtaining a bitstream according to claim 20, wherein the inter-predicted block is obtained by the merge mode of the inter prediction of the current block, and the intra-predicted block is obtained by the intra prediction of the current block.

22. The method for obtaining a bitstream according to claim 21 , wherein the intra-predicted blocks are obtained based on a planar mode.

23. The adjacent positions referred to by the combined prediction are (xCb-1, yCb-1+cbHeight) and (xCb-1+cbWidth, yCb-1), 20. The method for obtaining a bitstream of claim 19, wherein (xCb, yCb) is the top-left coordinate of the current block, the cbHeight is the height of the current block, and the cbWidth is the width of the current block.

24. 24. The method for obtaining a bitstream of claim 23, wherein the neighboring positions are determined using a scaling factor variable determined based on a color component index value of the current block.