Apparatus for decoding and encoding image and transmitting data

By determining the inter prediction mode and deriving motion information in image encoding, and adopting an explicit weighted prediction method, the problem of low image encoding efficiency in the prior art is solved, and more efficient inter prediction and motion information derivation is achieved.

CN119544976APending Publication Date: 2025-02-28LG ELECTRONICS INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411950341.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2020-02-25
Filing Date
2021-02-25
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

The prior art is difficult to effectively improve image encoding efficiency, especially in the inter prediction mode, and it is difficult to accurately determine the inter prediction mode and deduce motion information.

Method used

By determining the inter prediction mode of the current block, motion information is derived, and an explicit weighted prediction method is used to improve the accuracy of inter prediction. The method includes encoding and decoding the weighted prediction information using weight common information, weight quantity information, flags indicating whether the weight exists, weight increment information or offset information.

Benefits of technology

It effectively improves image encoding efficiency, improves the accuracy of inter prediction mode and the accuracy of motion information, and realizes efficient encoding and decoding of weighted prediction information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544976A_ABST
    Figure CN119544976A_ABST
Patent Text Reader

Abstract

An apparatus for decoding and encoding an image and transmitting data is disclosed. An image decoding method and apparatus according to the present disclosure may determine an inter prediction mode of a current block, derive motion information of the current block according to the determined inter prediction mode, and obtain a prediction block of the current block based on the derived motion information.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with the original application number 202180029035.6 (International application number: PCT / KR2021 / 002347, application date: February 25, 2021, invention name: Image encoding / decoding method and device based on inter-frame prediction and recording medium for storing bit stream). Technical Field

[0002] The present disclosure relates to an image encoding / decoding method and apparatus and a recording medium storing a bit stream. Background Art

[0003] Recently, the demand for high-resolution, high-quality images, such as high-definition (HD) images and ultra-high-definition (UHD) images, is increasing in various application fields, which has led to discussions on efficient image compression technology.

[0004] Image compression technology includes various technologies such as inter-frame prediction technology, intra-frame prediction technology, and entropy coding technology, wherein the inter-frame prediction technology predicts the pixel value included in the current picture from the previous picture or the next picture of the current picture, the intra-frame prediction technology predicts the pixel value included in the current picture by using the pixel information in the current picture, and the entropy coding technology assigns short codes to values ​​that appear more frequently and assigns long codes to values ​​that appear less frequently. Image data can be transmitted or stored by effectively compressing the image data using the image compression technology. Summary of the invention

[0005] Technical issues

[0006] The present disclosure provides a method and a device for improving image coding efficiency based on inter-frame prediction.

[0007] The present disclosure provides a method and apparatus for efficiently determining an inter-prediction mode.

[0008] The present disclosure provides a method and apparatus for efficiently deriving motion information for inter-frame prediction.

[0009] The present disclosure provides a weighted prediction method and device for improving the accuracy of inter-frame prediction.

[0010] The present disclosure provides a method and apparatus for efficiently encoding / decoding weighted prediction information for weighted prediction.

[0011] The present disclosure provides a computer-readable storage medium storing a bit stream generated by an image encoding / decoding method and apparatus.

[0012] Technical Solution

[0013] According to the image decoding method and device of the present disclosure, an inter-frame prediction mode of a current block can be determined, motion information of the current block can be derived according to the determined inter-frame prediction mode, and a prediction block of the current block can be obtained based on the derived motion information.

[0014] In the image decoding method and device according to the present disclosure, the prediction block may be obtained based on weighted prediction information of explicit weighted prediction of the current block. The weighted prediction information may include at least one of weight common information, weight quantity information, a flag indicating whether a weight exists, weight increment information, or offset information.

[0015] In the image decoding method and device according to the present disclosure, the weight quantity information can be adaptively signaled based on at least one of a first flag that specifies the location of the weighted prediction information to be signaled and a second flag that indicates whether the explicit weighted prediction is applied to a dual prediction (B) slice.

[0016] In the image decoding method and device according to the embodiment, the motion information of the current block may be derived based on a merge candidate list. The merge candidate list may include at least one of a spatial merge candidate, a temporal merge candidate, a history-based merge candidate, or an average merge candidate.

[0017] In the image decoding method and apparatus according to an embodiment, deriving the motion information of the current block may include modifying a motion vector among the derived motion information by using a specific motion vector difference (MVD).

[0018] In the image decoding method and apparatus according to an embodiment, the MVD may be derived based on at least one of a length of the MVD, a direction of the MVD, and a picture order count (POC) difference between a reference picture of the current block and a current picture.

[0019] In an image decoding method and device according to an embodiment, obtaining the prediction block of the current block may include: obtaining the weighted prediction information of the explicit weighted prediction of the current block; deriving at least one of the weights or offsets of the explicit weighted prediction of the current block by using the weighted prediction information; and performing weighted prediction of the current block based on at least one of the derived weights or offsets.

[0020] In the image decoding method and device according to the embodiment, the weight quantity information may include weight quantity information in the list0 (L0) direction and weight quantity information in the list1 (L1) direction. The weight quantity information in the L0 direction may be adaptively signaled based on the first flag that specifies the position of the weighted prediction information to be signaled. The weight quantity information in the L1 direction may be adaptively signaled based on the first flag that specifies the position of the weighted prediction information to be signaled and the second flag indicating whether the explicit weighted prediction is applied to the B slice.

[0021] In the image decoding method and apparatus according to the embodiment, the first flag that specifies the position of the weighted prediction information to be signaled may specify whether the weighted prediction information exists in a picture header or in a slice header. The second flag that indicates whether the explicit weighted prediction is applied to the B slice may specify whether the explicit weighted prediction is applied to the B slice or a default weighted prediction is applied to the B slice.

[0022] In the image decoding method and device according to the embodiment, if the weighted prediction information exists in the slice header according to the first flag or the explicit weighted prediction is not applied to the B slice according to the second flag, the weight quantity information in the L1 direction can be derived as 0.

[0023] The image encoding method and apparatus according to the embodiment may determine an inter prediction mode of a current block, derive motion information of the current block according to the determined inter prediction mode, and obtain weighted prediction information of weighted prediction of the current block.

[0024] In the image encoding method and apparatus according to the embodiment, the weighted prediction information may include at least one of weight common information, weight quantity information, a flag indicating whether a weight exists, weight increment information, and offset information.

[0025] In the image encoding method and apparatus according to an embodiment, the weight amount information may be adaptively encoded based on at least one of a first flag specifying a location where the weighted prediction information is encoded and a second flag indicating whether explicit weighted prediction is applied to a B slice.

[0026] In the image encoding method and device according to the embodiment, the motion information of the current block may be derived based on a merge candidate list. The merge candidate list may include at least one of a spatial merge candidate, a temporal merge candidate, a history-based merge candidate, or an average merge candidate.

[0027] In the image encoding method and apparatus according to an embodiment, deriving the motion information of the current block may include: modifying a motion vector among the derived motion information by using a specific MVD.

[0028] In the image encoding method and apparatus according to an embodiment, the MVD may be derived based on at least one of a length of the MVD, a direction of the MVD, and a POC difference between a reference picture of the current block and a current picture.

[0029] In the image encoding method and device according to the embodiment, obtaining the weighted prediction information of the weighted prediction of the current block may include: determining at least one of the weight or offset of the weighted prediction of the current block; and obtaining the weighted prediction information of the current block based on at least one of the determined weights or offsets.

[0030] In the image encoding method and device according to the embodiment, the weight quantity information may include weight quantity information in the L0 direction and weight quantity information in the L1 direction. The weight quantity information in the L0 direction may be adaptively encoded based on the first flag specifying the position where the weighted prediction information is encoded. The weight quantity information in the L1 direction may be adaptively encoded based on the first flag specifying the position where the weighted prediction information is encoded and the second flag indicating whether the explicit weighted prediction is applied to the B slice.

[0031] In the image encoding method and apparatus according to an embodiment, the first flag that specifies the position of the weighted prediction information to be signaled may specify whether the weighted prediction information exists in a picture header or in a slice header. The second flag that indicates whether the explicit weighted prediction is applied to the B slice may specify whether the explicit weighted prediction is applied to the B slice or a default weighted prediction is applied to the B slice.

[0032] In the image encoding method and device according to the embodiment, if the weighted prediction information is encoded in the slice header according to the first flag or the explicit weighted prediction is not applied to the B slice according to the second flag, the weight amount information in the L1 direction may not be encoded.

[0033] In a computer-readable storage medium storing coding information, the coding information enables an image decoding device according to the present disclosure to perform an image decoding method, which may include the following steps: determining an inter-frame prediction mode of a current block; deriving motion information of the current block according to the determined inter-frame prediction mode; and obtaining a prediction block of the current block based on the derived motion information.

[0034] In a computer-readable storage medium according to the present disclosure, the prediction block may be obtained based on weighted prediction information of explicit weighted prediction of the current block. The weighted prediction information may include at least one of weight common information, weight quantity information, a flag indicating whether a weight exists, weight increment information, or offset information.

[0035] In a computer-readable storage medium according to the present disclosure, the weight amount information may be adaptively signaled based on at least one of a first flag that specifies a location to signal the weighted prediction information and a second flag that indicates whether to apply the explicit weighted prediction to a B slice.

[0036] Beneficial Effects

[0037] Image encoding efficiency can be improved through inter-frame prediction according to the present disclosure.

[0038] According to the present disclosure, the inter prediction mode can be efficiently determined.

[0039] According to the present disclosure, motion information for inter-frame prediction can be efficiently derived.

[0040] The accuracy of inter-frame prediction can be improved through weighted prediction according to the present disclosure.

[0041] According to the present disclosure, weighted prediction information of weighted prediction can be efficiently encoded / decoded.

[0042] A computer-readable storage medium storing a bit stream generated by an image encoding / decoding method and apparatus may be provided according to the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A video / image encoding system according to the present disclosure is illustrated.

[0044] Figure 2 is a schematic block diagram of an encoding device that performs encoding of a video / image signal and to which an embodiment of the present specification can be applied.

[0045] Figure 3 is a schematic block diagram of a decoding device that performs decoding of a video / image signal and to which an embodiment of the present specification can be applied.

[0046] Figure 4 An inter-frame prediction method in a decoding device according to the present disclosure is illustrated.

[0047] Figures 5 to 7 A method of deriving motion information in merge mode according to the present disclosure is illustrated.

[0048] Figure 8 An explicit weighted prediction method in a decoding device according to the present disclosure is illustrated.

[0049] Fig. 9 The structure of the inter-frame predictor 332 in the decoding device according to the present disclosure is schematically illustrated.

[0050] Fig.10 The structure of the prediction block obtainer 920 in the inter-frame predictor 332 according to the present disclosure is schematically illustrated.

[0051] Fig.11 An inter-frame prediction method in an encoding device according to the present disclosure is illustrated.

[0052] Fig.12 The structure of the inter-frame predictor 221 in the encoding device according to the present disclosure is schematically illustrated. DETAILED DESCRIPTION

[0053] According to the image decoding method and device of the present disclosure, an inter-frame prediction mode of a current block can be determined, motion information of the current block can be derived according to the determined inter-frame prediction mode, and a prediction block of the current block can be obtained based on the derived motion information.

[0054] In the image decoding method and device according to the present disclosure, the prediction block can be obtained based on weighted prediction information of explicit weighted prediction of the current block. The weighted prediction information may include at least one of weight common information, weight quantity information, a flag indicating whether a weight exists, weight increment information, or offset information.

[0055] In the image decoding method and device according to the present disclosure, weight quantity information can be adaptively signaled based on at least one of a first flag that specifies the location of signaling weighted prediction information and a second flag that indicates whether explicit weighted prediction is applied to a dual-prediction (B) slice.

[0056] In the image decoding method and device according to the embodiment, the motion information of the current block may be derived based on the merge candidate list. The merge candidate list may include at least one of a spatial merge candidate, a temporal merge candidate, a history-based merge candidate, or an average merge candidate.

[0057] In the image decoding method and apparatus according to an embodiment, deriving motion information of the current block may include modifying a motion vector among the derived motion information by using a specific motion vector difference (MVD).

[0058] In the image decoding method and apparatus according to an embodiment, the MVD may be derived based on at least one of a length of the MVD, a direction of the MVD, or a picture order count (POC) difference between a reference picture of a current block and a current picture.

[0059] In an image decoding method and device according to an embodiment, the step of obtaining a prediction block of a current block may include: obtaining weighted prediction information of an explicit weighted prediction of the current block; deriving at least one of a weight or an offset of the explicit weighted prediction of the current block by using the weighted prediction information; and performing weighted prediction of the current block based on at least one of the derived weights or offsets.

[0060] In an image decoding method and apparatus according to an embodiment, the weight quantity information may include weight quantity information in a list0 (L0) direction and weight quantity information in a list1 (L1) direction. The weight quantity information in the L0 direction may be adaptively signaled based on a first flag that specifies a position for signaling weighted prediction information. The weight quantity information in the L1 direction may be adaptively signaled based on a first flag that specifies a position for signaling weighted prediction information and a second flag that indicates whether explicit weighted prediction is applied to a B slice.

[0061] In the image decoding method and apparatus according to the embodiment, the first flag that specifies the location of signaling weighted prediction information may specify whether the weighted prediction information is present in the picture header or in the slice header. The second flag that indicates whether explicit weighted prediction is applied to the B slice may specify whether explicit weighted prediction is applied to the B slice or default weighted prediction is applied to the B slice.

[0062] In the image decoding method and apparatus according to the embodiment, if weighted prediction information exists in the slice header according to the first flag or explicit weighted prediction is not applied to the B slice according to the second flag, the weight quantity information in the L1 direction can be derived as 0.

[0063] The image encoding method and apparatus according to the embodiment may determine an inter prediction mode of a current block, derive motion information of the current block according to the determined inter prediction mode, and obtain weighted prediction information for weighted prediction of the current block.

[0064] In the image encoding method and apparatus according to the embodiment, the weighted prediction information may include at least one of weight common information, weight quantity information, a flag indicating whether a weight exists, weight increment information, and offset information.

[0065] In the image encoding method and apparatus according to an embodiment, weight amount information may be adaptively encoded based on at least one of a first flag specifying a location where weighted prediction information is encoded or a second flag indicating whether explicit weighted prediction is applied to a B slice.

[0066] In the image encoding method and device according to the embodiment, the motion information of the current block may be derived based on the merge candidate list. The merge candidate list may include at least one of a spatial merge candidate, a temporal merge candidate, a history-based merge candidate, or an average merge candidate.

[0067] In the image encoding method and apparatus according to an embodiment, deriving motion information of the current block may include modifying a motion vector among the derived motion information by using a specific MVD.

[0068] In the image encoding method and apparatus according to an embodiment, the MVD may be derived based on at least one of a length of the MVD, a direction of the MVD, and a POC difference between a reference picture of a current block and a current picture.

[0069] In the image encoding method and device according to the embodiment, the step of obtaining weighted prediction information of weighted prediction of the current block may include: determining at least one of the weight or offset of the weighted prediction of the current block; and obtaining the weighted prediction information of the current block based on at least one of the determined weight or offset.

[0070] In the image encoding method and device according to the embodiment, the weight quantity information may include the weight quantity information of the L0 direction and the weight quantity information of the L1 direction. The weight quantity information of the L0 direction may be adaptively encoded based on a first flag that specifies the position where the weighted prediction information is encoded. The weight quantity information of the L1 direction may be adaptively encoded based on a first flag that specifies the position where the weighted prediction information is encoded and a second flag that indicates whether explicit weighted prediction is applied to the B slice.

[0071] In the image encoding method and apparatus according to the embodiment, the first flag that specifies the location of signaling weighted prediction information may specify whether the weighted prediction information exists in the picture header or in the slice header. The second flag that indicates whether explicit weighted prediction is applied to the B slice may specify whether explicit weighted prediction is applied to the B slice or default weighted prediction is applied to the B slice.

[0072] In the image encoding method and apparatus according to the embodiment, if weighted prediction information is encoded in the slice header according to the first flag or explicit weighted prediction is not applied to the B slice according to the second flag, weight amount information in the L1 direction may not be encoded.

[0073] In a computer-readable storage medium storing encoding information, the encoding information enables an image decoding device according to the present disclosure to perform an image decoding method, which may include: determining an inter-frame prediction mode of a current block; deriving motion information of the current block according to the determined inter-frame prediction mode; and obtaining a prediction block of the current block based on the derived motion information.

[0074] In a computer-readable storage medium according to the present disclosure, the prediction block may be obtained based on weighted prediction information of explicit weighted prediction of the current block. The weighted prediction information may include at least one of weight common information, weight quantity information, a flag indicating whether a weight exists, weight increment information, or offset information.

[0075] In a computer-readable storage medium according to the present disclosure, weight amount information may be adaptively signaled based on at least one of a first flag that specifies a location to signal weighted prediction information and a second flag that indicates whether explicit weighted prediction is applied to a B slice.

[0076] Description of Exemplary Embodiments

[0077] This document may be modified in various ways and may have various embodiments, and specific embodiments will be illustrated in the drawings and described in detail. However, it should be understood that the disclosure is not limited to the disclosed embodiments, but rather, the disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the appended claims. In all drawings, the same reference numerals are used to indicate the same elements.

[0078] It will be understood that although the terms "first" and "second" are used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. Therefore, without departing from the scope of the present disclosure, the first element discussed below may be referred to as the second element, and similarly, the second element may be referred to as the first element. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0079] It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, or intervening elements may be present. Conversely, when an element is referred to as being "directly connected" or "directly coupled" to another element, there are no intervening elements.

[0080] The commonly used terms in this specification are used to describe specific embodiments and are not used to limit the technical spirit of this document. Unless otherwise clearly expressed in the context, the expression of singular quantity includes plural expression. In this specification, terms such as "including" or "having" should be understood to indicate the presence of the features, quantities, steps, operations, elements, parts or combinations thereof described in the specification, and do not exclude the presence or possibility of adding one or more other features, quantities, steps, operations, elements, parts or combinations thereof.

[0081] The present disclosure relates to video / image coding. For example, the methods / examples disclosed in this specification may be applied to methods disclosed in the Versatile Video Coding (VVC) standard. In addition, the methods / examples disclosed in this specification may be applied to methods disclosed in the Versatile Video Coding (VVC) standard, the Essential Video Coding (EVC) standard, the AOMedia Video 1 (AV1) standard, the second generation audio video coding standard (AVS2), or the next generation video / image coding standard (e.g., H.267, H.268, etc.).

[0082] In this document, various embodiments related to video / image encoding may be provided, and unless otherwise specified, the embodiments may be performed in combination with each other.

[0083] In this specification, video may mean a collection of a series of images over time. A picture generally means a unit representing an image in a specific time zone, and a slice / patch is a unit that constitutes a part of a picture in coding. A slice / patch may include one or more coding tree units (CTUs). A picture may be composed of one or more slices / patch blocks. A patch may be composed of one or more patch groups. A patch is a rectangular area consisting of multiple CTUs in a specific patch column and a specific patch row in a picture. A patch column is a rectangular area of ​​a CTU whose height is equal to the height of the picture and whose width is specified by a syntax request or a picture parameter set. A patch row is a rectangular area of ​​a CTU whose height is specified by a picture parameter set and whose width is equal to the width of the picture. CTUs within a patch are arranged continuously according to a CTU raster scan, and patches within a picture are arranged continuously according to a patch raster scan. A slice may include an integer number of continuous complete CTU rows or an integer number of complete patches within a patch of a picture that may be specifically included in a single NAL unit. In addition, a picture may be divided into two or more sub-pictures. A sub-picture may be a rectangular region of one or more slices within a picture.

[0084] A pixel or a pel may refer to the smallest unit constituting a single picture (or image). In addition, a "sample" may be used as a term corresponding to a pixel. A sample may generally represent a pixel or a value of a pixel, and may represent only a pixel / pixel value of a luminance component or only a pixel / pixel value of a chrominance component.

[0085] A unit may represent a basic unit of image processing. A unit may include at least one of a specific area of ​​a picture and information associated with the area. A unit may include a luminance block and two chrominance (e.g., cb, cr) blocks. In some cases, the term "unit" may be used interchangeably with terms such as block or area. In general, an M×N block may include a set (or array) of samples (or sample arrays) or transform coefficients consisting of M columns and N rows.

[0086] In this document, "A or B" may mean "only A", "only B", or "both A and B". In other words, in this document, "A or B" may be interpreted as "A and / or B". For example, "A, B, or C" in this document means "only A", "only B", "only C", or "any combination of A, B, and C".

[0087] A slash ( / ) or a comma (,) used in this document may mean "and / or". For example, "A / B" may mean "A and / or B". Accordingly, "A / B" may mean "only A", "only B", or "both A and B". For example, "A, B, C" may mean "A, B, or C".

[0088] In this document, "at least one of A and B" may mean "only A", "only B", or "both A and B". In addition, in this document, the expression "at least one of A or B" or "at least one of A and / or B" may be interpreted as the same as "at least one of A and B".

[0089] In addition, in this document, "at least one of A, B, and C" means "only A", "only B", "only C", or "A, B, and C", "any combination of A, B, and C". In addition, "at least one of A, B, or C" or "at least one of A, B and / or C" may mean "at least one of A, B, and C".

[0090] In addition, brackets used in the present specification may mean "for example". Specifically, when "prediction (intra-frame prediction)" is indicated, "intra-frame prediction" may be proposed as an example of "prediction". In other words, "prediction" in the present specification is not limited to "intra-frame prediction", and "intra-frame prediction" may be proposed as an example of "prediction". In addition, even when "prediction (ie, intra-frame prediction)" is indicated, "intra-frame prediction" may be proposed as an example of "prediction".

[0091] In this document, technical features described individually in one drawing may be implemented individually or may be implemented simultaneously.

[0092] Figure 1 A video / image encoding system according to the present disclosure is illustrated.

[0093] Reference Figure 1 , a video / image encoding system may include a first device (source device) and a second device (receiving device).

[0094] The source device may transmit coded video / image information or data to the receiving device in the form of a file or stream transmission via a digital storage medium or a network. The source device may include a video source, an encoding device, and a transmitter. The receiving device may include a receiver, a decoding device, and a renderer. The encoding device may be referred to as a video / image encoding device, and the decoding device may be referred to as a video / image decoding device. The transmitter may be included in the encoding device. The receiver may be included in the decoding device. The renderer may include a display, and the display may be configured as a separate device or an external component.

[0095] The video source may acquire the video / image by capturing, synthesizing or generating the video / image process. The video source may include a video / image capture device and / or a video / image generation device. The video / image capture device may include one or more cameras, a video / image archive including previously captured videos / images, etc. The video / image generation device may include a computer, a tablet computer, and a smart phone, and may (electronically) generate the video / image. For example, a virtual video / image may be generated by a computer, etc. In this case, the video / image capture process may be replaced by a process that generates relevant data.

[0096] The encoding device can encode the input video / image. The encoding device can perform a series of processes such as prediction, transformation and quantization to achieve compression and coding efficiency. The encoded data (encoded video / image information) can be output in the form of a bitstream.

[0097] The transmitter may transmit the coded image / image information or data output in the form of a bit stream to the receiver of the receiving device in the form of a file or stream transmission through a digital storage medium or a network. The digital storage medium may include various storage media such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, etc. The transmitter may include an element for generating a media file in a predetermined file format, and may include an element for transmitting through a broadcast / communication network. The receiver may receive / extract a bit stream and transmit the received bit stream to a decoding device.

[0098] The decoding device may decode a video / image by performing a series of processes such as dequantization, inverse transformation, and prediction corresponding to the operations of the encoding device.

[0099] The renderer can render the decoded video / image. The rendered video / image can be displayed through a display.

[0100] Figure 2 is a schematic block diagram of an encoding device that performs encoding of a video / image signal and to which an embodiment of the present specification can be applied.

[0101] Reference Figure 2, the encoding device 200 includes an image segmenter 210, a predictor 220, a residual processor 230 and an entropy encoder 240, an adder 250, a filter 260 and a memory 270. The predictor 220 may include an inter-frame predictor 221 and an intra-frame predictor 222. The residual processor 230 may include a transformer 232, a quantizer 233, a dequantizer 234 and an inverse transformer 235. The residual processor 230 may also include a subtractor 231. The adder 250 may be called a reconstructor or a reconstructed block generator. According to an embodiment, the image segmenter 210, the predictor 220, the residual processor 230, the entropy encoder 240, the adder 250 and the filter 260 may be configured by at least one hardware component (e.g., an encoder chipset or processor). In addition, the memory 270 may include a decoded picture buffer (DPB) or may be configured by a digital storage medium. The hardware component may also include a memory 270 as an internal / external component.

[0102] The image divider 210 may divide the input image (or picture or frame) input to the encoding device 200 into one or more processors. For example, the processor may be referred to as a coding unit (CU). In this case, the coding unit may be recursively divided from a coding tree unit (CTU) or a maximum coding unit (LCU) according to a quadtree binary tree ternary tree (QTBTTT) structure.

[0103] For example, a coding unit can be divided into multiple coding units with a deeper depth based on a quadtree structure, a binary tree structure, and / or a ternary structure. In this case, for example, the quadtree structure can be applied first, and the binary tree structure and / or the ternary tree structure can be applied later. Alternatively, the binary tree structure can be applied first. The encoding process according to the present disclosure can be performed based on the final coding unit that is no longer divided. In this case, the maximum coding unit can be directly used as the final coding unit based on coding efficiency according to image characteristics, or alternatively, the coding unit can be recursively divided into coding units with a deeper depth so that a coding unit with an optimal size can be used as the final coding unit. In this article, the encoding process may include processes such as prediction, transformation, and reconstruction, which will be described later.

[0104] As another example, the processor may further include a prediction unit (PU) or a transform unit (TU). In this case, the prediction unit and the transform unit may be divided or split from the aforementioned final coding unit. The prediction unit may be a unit for sample prediction, and the transform unit may be a unit for deriving a transform coefficient and / or a unit for deriving a residual signal from the transform coefficient.

[0105] In some cases, a unit may be used interchangeably with terms such as a block or region. In general, an M×N block may represent a set of samples or transform coefficients consisting of M columns and N rows. A sample may generally represent a pixel or a pixel value, may represent a pixel / pixel value of a luminance component only, or may represent a pixel / pixel value of a chrominance component only. A sample may be used as a term corresponding to a picture (or image) of a pixel or a picture element.

[0106] The encoding device 200 can generate a residual signal (residual block, residual sample array) by subtracting the prediction signal (prediction block, prediction sample array) output from the inter-frame predictor 221 or the intra-frame predictor 222 from the input image signal (original block, original sample array), and the generated residual signal is sent to the transformer 232. In this case, the unit for subtracting the prediction signal (prediction block, prediction sample array) from the input image signal (original block, original sample array) within the encoding device 200 can be referred to as a subtractor 231.

[0107] The predictor may perform prediction on a processing target block (hereinafter referred to as a 'current block') and generate a prediction block including prediction samples of the current block. The predictor may determine whether intra prediction or inter prediction is applied in the current block or CU unit. As discussed later in the description of each prediction mode, the predictor may generate various information related to the prediction, such as prediction mode information, and send the generated information to the entropy encoder 240. The information about the prediction may be encoded in the entropy encoder 240 and output in the form of a bitstream.

[0108] The intra-frame predictor 222 can predict the current block with reference to the samples in the current picture. Depending on the prediction mode, the referenced sample can be located near the current block, or can be far away from the current block. In intra-frame prediction, the prediction mode may include multiple non-directional modes and multiple directional modes. The non-directional mode may include at least one of a DC mode and a plane mode. Depending on the level of detail of the prediction direction, the directional mode may include 33 directional prediction modes or 65 directional prediction modes. However, this is illustrative, and depending on the setting, more or less directional prediction modes than the above number may be used. The intra-frame predictor 222 may also determine the prediction mode applied to the current block by using the prediction mode applied to the neighboring blocks.

[0109] The inter-frame predictor 221 may derive a prediction block of the current block based on a reference block (reference sample array) specified by a motion vector on a reference picture. Here, in order to reduce the amount of motion information sent in the inter-frame prediction mode, the motion information may be predicted in units of blocks, sub-blocks, or samples based on the correlation of the motion information between the neighboring blocks and the current block. The motion information may include a motion vector and a reference picture index. The motion information may also include inter-frame prediction direction (L0 prediction, L1 prediction, Bi prediction, etc.) information. In the case of inter-frame prediction, the neighboring blocks may include spatial neighboring blocks present in the current picture and temporal neighboring blocks present in the reference picture. The reference picture including the reference block and the reference picture including the temporal neighboring block may be the same or different. The temporal neighboring block may be referred to as a collocated reference block, a co-located CU (colCU), etc., and the reference picture including the temporal neighboring block may be referred to as a collocated picture (colPic). For example, the inter-frame predictor 221 may configure a motion information candidate list based on the neighboring blocks, and generate information indicating which candidate is used to derive the motion vector and / or reference picture index of the current block. Inter-frame prediction may be performed based on various prediction modes. For example, in the case of skip mode and merge mode, the inter-frame predictor 221 may use the motion information of the neighboring block as the motion information of the current block. In skip mode, unlike merge mode, a residual signal may not be transmitted. In the case of motion vector prediction (MVP) mode, the motion vector of the neighboring block may be used as a motion vector predictor, and the motion vector of the current block may be indicated by signaling a motion vector difference.

[0110] The predictor can generate a prediction signal based on various prediction methods described later. For example, the predictor can not only apply intra prediction or inter prediction to predict a block, but also apply both intra prediction and inter prediction at the same time. This can be called inter-frame intra combined prediction (CIIP). In addition, the predictor can be based on an intra-block copy (IBC) prediction mode or a palette mode to perform prediction on the block. The IBC prediction mode or the palette mode can be used for content image / video encoding (e.g., screen content coding (SCC)) of games, etc. IBC basically performs prediction in the current picture, but because the reference block is derived in the current picture, it can be performed similarly to inter prediction. That is, IBC can use at least one of the inter prediction techniques described in this document. The palette mode can be regarded as an example of intra coding or intra prediction. When the palette mode is applied, the sample value within the picture can be signaled based on information about the palette index and the palette table. The prediction signal generated by the predictor (including the inter-frame predictor 221 and / or the intra-frame predictor 222) may be used to generate a reconstructed signal or to generate a residual signal.

[0111] The transformer 232 may generate transform coefficients by applying a transform technique to the residual signal. For example, the transform technique may include at least one of a discrete cosine transform (DCT), a discrete sine transform (DST), a Karhunen-Loève transform (KLT), a graph-based transform (GBT), or a conditional nonlinear transform (CNT). Here, when the relationship information between pixels is illustrated as a graph, GBT means a transform obtained from the graph. CNT means a transform obtained based on a prediction signal generated by using all previously reconstructed pixels. In addition, the transform process may be applied to square pixel blocks of the same size, or may also be applied to blocks of variable size other than square.

[0112] The quantizer 233 may quantize the transform coefficients and send them to the entropy encoder 240, and the entropy encoder 240 may encode the quantized signal (information about the quantized transform coefficients) and output a bitstream. The information about the quantized transform coefficients may be referred to as residual information. The quantizer 233 may rearrange the block type quantized transform coefficients into a one-dimensional vector form based on the coefficient scanning order, and generate information about the quantized transform coefficients based on the quantized transform coefficients in the one-dimensional vector form.

[0113] The entropy encoder 240 may perform various encoding methods such as exponential Golomb, context adaptive variable length coding (CAVLC), context adaptive binary arithmetic coding (CABAC), etc. The entropy encoder 240 may encode information required for video / image reconstruction (e.g., values ​​of syntax elements, etc.) in addition to the quantized transform coefficients together or separately.

[0114] The coding information (e.g., coded video / image information) may be transmitted or stored in units of a network abstraction layer (NAL) in the form of a bitstream. The video / image information may also include information about various parameter sets such as an adaptive parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). In addition, the video / image information may also include general constraint information. In this document, the information and / or syntax elements that are signaled / transmitted and / or described later may be encoded and thus included in the bitstream by the aforementioned encoding process. The bitstream may be transmitted over a network, or may be stored in a digital storage medium. Here, the network may include a broadcast network and / or a communication network, etc., and the digital storage medium may include various storage media such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, etc. A transmitter (not illustrated) for transmitting a signal output from the entropy encoder 240 and / or a storage device (not illustrated) for storing the signal may be configured as an internal / external element of the encoding device 200, or the transmitter may also be included in the entropy encoder 240.

[0115] The quantized transform coefficients output from the quantizer 233 can be used to generate a prediction signal. For example, the dequantizer 234 and the inverse transformer 235 apply dequantization and inverse transformation to the quantized transform coefficients so that the residual signal (residual block or residual sample) can be reconstructed. The adder 250 adds the reconstructed residual signal to the prediction signal output from the inter-frame predictor 221 or the intra-frame predictor 222 so that a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array) can be generated. As in the case of applying the skip mode, if the block to be processed has no residual, the prediction block can be used as a reconstructed block. The adder 250 can be called a reconstructor or a reconstructed block generator. The generated reconstructed signal can be used for intra-frame prediction of the next block to be processed in the current picture, and as described later, it can also be used for inter-frame prediction of the next picture by filtering. In addition, during picture encoding and / or reconstruction, luminance mapping and chrominance scaling (LMCS) can be applied.

[0116] The filter 260 can apply filtering to the reconstructed signal to improve the subjective / objective image quality. For example, the filter 260 can apply various filtering methods to the reconstructed picture to generate a modified reconstructed picture, and store the modified reconstructed picture in the memory 270 (specifically, the DPB of the memory 270). Various filtering methods may include deblocking filtering, sample adaptive offset, adaptive loop filter, bilateral filter, etc. The filter 260 can generate various filtering related information to transmit the generated information to the entropy encoder 240. The filtering related information can be encoded by the entropy encoder 240 and output in the form of a bit stream.

[0117] The modified reconstructed picture sent to the memory 270 may be used as a reference picture in the inter predictor 221. If inter prediction is applied through the inter predictor, the encoding device may avoid prediction mismatch between the encoding device 200 and the decoding device, and may also improve encoding efficiency.

[0118] The DPB of the memory 270 may store a modified reconstructed picture to be used as a reference picture in the inter-frame predictor 221. The memory 270 may store motion information of a block for deriving (or encoding) motion information within the current picture and / or motion information of a block in a previously reconstructed picture. The stored motion information may be transmitted to the inter-frame predictor 221 for use as motion information of a spatially adjacent block or motion information of a temporally adjacent block. The memory 270 may store a reconstructed sample of a reconstructed block within the current picture and transmit the reconstructed sample to the intra-frame predictor 222.

[0119] Figure 3 is a schematic block diagram of a decoding device that performs decoding of a video / image signal and to which an embodiment of the present specification can be applied.

[0120] Reference Figure 3 , the decoding device 300 may include and be configured with an entropy decoder 310, a residual processor 320, a predictor 330, an adder 340, a filter 350, and a memory 360. The predictor 330 may include an inter-frame predictor 332 and an intra-frame predictor 331. The residual processor 320 may include a dequantizer 321 and an inverse transformer 322.

[0121] According to an embodiment, the above entropy decoder 310, the residual processor 320, the predictor 330, the adder 340 and the filter 350 may be configured by one or more hardware components (e.g., a decoder chipset or a processor). In addition, the memory 360 may include a decoded picture buffer (DPB) and may be configured by a digital storage medium. The hardware component may also include the memory 360 as an internal / external component.

[0122] When a bitstream including video / image information is input, the decoding device 300 can reconstruct the image in response to the processing of the video / image information in the encoding device. For example, the decoding device 300 can derive the unit / block based on the block partition related information obtained from the bitstream. The decoding device 300 can perform decoding using a processing unit applied to the encoding device. Therefore, the processing unit for decoding can be a coding unit, and the coding unit can be divided from the coding tree unit or the maximum coding unit according to a quadtree structure, a binary tree structure and / or a ternary tree structure. One or more transform units can be derived from the coding unit. In addition, the reconstructed image signal decoded and output by the decoding device 300 can be reproduced by a reproduction device.

[0123] The decoding device 300 may receive a signal output from the encoding device in the form of a bitstream, and may decode the received signal through the entropy decoder 310. For example, the entropy decoder 310 may derive information (e.g., video / image information) required for image reconstruction (or picture reconstruction) by parsing the bitstream. The video / image information may also include information about various parameter sets such as an adaptive parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), and a video parameter set (VPS). In addition, the video / image information may also include general constraint information. The decoding device may also decode the picture based on the information about the parameter set and / or the general constraint information. The signaled / received information and / or syntax elements described later in this document may be decoded through a decoding process and obtained from the bitstream. For example, the entropy decoder 310 may decode the information in the bitstream based on a coding method such as exponential Golomb coding, CAVLC, or CABAC, and output the values ​​of the syntax elements required for image reconstruction and the quantized values ​​of the residual-related transform coefficients. More specifically, the CABAC entropy decoding method can receive a bin corresponding to each syntax element from a bitstream, use the syntax element information to be decoded and decode the information of the adjacent block or the block to be decoded or the information of the symbol / bin decoded in the previous stage to determine the context model, and generate a symbol corresponding to the value of each syntax element by predicting the generation probability of the bin according to the determined context model to perform arithmetic decoding on the bin. At this time, the CABAC entropy decoding method can determine the context model, and then update the context model by using the decoded symbol / bin information for the context model of the next symbol / bin. The information about the prediction among the information decoded by the entropy decoder 310 can be provided to the predictor (inter-frame predictor 332 and intra-frame predictor 331), and the residual value (ie, quantized transform coefficient and related parameter information) to which the entropy decoder 310 performs entropy decoding can be input to the residual processor 320. The residual processor 320 can derive a residual signal (residual block, residual sample, residual sample array). In addition, the information about filtering among the information decoded by the entropy decoder 310 can be provided to the filter 350. In addition, a receiver (not illustrated) for receiving a signal output from the encoding device may also be configured as an internal / external element of the decoding device 300 , or the receiver may also be a component of the entropy decoder 310 .

[0124] In addition, the decoding device according to the present document may be referred to as a video / image / picture decoding device, and the decoding device may also be classified into an information decoder (video / image / picture information decoder) and a sample decoder (video / image / picture sample decoder). The information decoder may include an entropy decoder 310, and the sample decoder may include a dequantizer 321, an inverse transformer 322, an adder 340, a filter 350, a memory 360, an inter-frame predictor 332, and at least one of an intra-frame predictor 331.

[0125] The dequantizer 321 may dequantize the quantized transform coefficients and output the transform coefficients. The dequantizer 321 may rearrange the quantized transform coefficients in the form of two-dimensional blocks. In this case, the rearrangement may be performed based on the coefficient scanning order performed by the encoding device. The dequantizer 321 may dequantize the quantized transform coefficients using quantization parameters (e.g., quantization step size information) and obtain the transform coefficients.

[0126] The inverse transformer 322 performs an inverse transform on the transform coefficients to obtain a residual signal (residual block, residual sample array).

[0127] The predictor 330 may perform prediction on the current block and generate a prediction block including prediction samples of the current block. The predictor may determine whether to apply intra prediction or inter prediction to the current block based on the information on prediction output from the entropy decoder 310, and determine a specific intra / inter prediction mode.

[0128] The predictor can generate a prediction signal based on various prediction methods to be described later. For example, the predictor can not only apply intra prediction or inter prediction to predict a block, but also apply intra prediction and inter prediction at the same time. This can be called inter-frame and intra-frame combined prediction (CIIP). In addition, the predictor can be based on an intra-frame block copy (IBC) prediction mode or a palette mode to perform prediction on the block. The IBC prediction mode or the palette mode can be used for content image / video encoding (e.g., screen content coding (SCC)) of games, etc. IBC basically performs prediction in the current picture, but because the reference block is derived in the current picture, IBC can be performed similarly to inter prediction. That is, IBC can use at least one of the inter prediction techniques described in this document. The palette mode can be regarded as an example of intra coding or intra prediction. When the palette mode is applied, information about the palette table and the palette index can be included in the video / image information and notified with a signal.

[0129] The intra-frame predictor 331 can predict the current block with reference to samples in the current picture. Depending on the prediction mode, the referenced sample can be located near the current block, or can also be far away from the current block. In intra-frame prediction, the prediction mode can include multiple non-directional modes and multiple directional modes. The intra-frame predictor 331 can also determine the prediction mode applied to the current block by using the prediction mode applied to the neighboring block.

[0130] The inter-frame predictor 332 can infer the prediction block of the current block based on the reference block (reference sample array) specified by the motion vector on the reference picture. At this time, in order to reduce the amount of motion information sent in the inter-frame prediction mode, the motion information can be predicted in units of blocks, sub-blocks or samples based on the correlation of the motion information between the neighboring blocks and the current block. The motion information may include a motion vector and a reference picture index. The motion information may also include inter-frame prediction direction (L0 prediction, L1 prediction, Bi prediction, etc.) information. In the case of inter-frame prediction, the neighboring blocks may include spatial neighboring blocks present in the current picture and temporal neighboring blocks present in the reference picture. For example, the inter-frame predictor 332 may configure a motion information candidate list based on the neighboring blocks, and derive the motion vector and / or reference picture index of the current block based on the received candidate selection information. Inter-frame prediction can be performed based on various prediction modes, and the information about the prediction may include information indicating the mode of inter-frame prediction of the current block.

[0131] The adder 340 may add the obtained residual signal to the prediction signal (prediction block, prediction sample array) output from the predictor (including the inter-frame predictor 332 and / or the intra-frame predictor 331) to generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array). As in the case of applying the skip mode, if the block to be processed has no residual, the prediction block may be used as the reconstructed block.

[0132] The adder 340 may be referred to as a reconstructor or a reconstructed block generator. The generated reconstructed signal may be used for intra-frame prediction of the next block to be processed in the current picture, and as described below, may also be output through filtering, or may be used for inter-frame prediction of the next picture. In addition, luminance mapping and chrominance scaling (LMCS) may be applied during picture decoding.

[0133] The filter 350 may apply filtering to the reconstructed signal to improve the subjective / objective image quality. For example, the filter 350 may apply various filtering methods to the reconstructed picture to generate a modified reconstructed picture, and store the modified reconstructed picture in the memory 360 (specifically, the DPB of the memory 360). The various filtering methods may include, for example, deblocking filtering, sample adaptive offset, adaptive loop filter, bilateral filter, etc.

[0134] The (modified) reconstructed picture stored in the DPB of the memory 360 can be used as a reference picture in the inter-frame predictor 332. The memory 360 can store the motion information of the block from which the motion information in the current picture is derived (decoded) and / or the motion information of the block in the previously reconstructed picture. The stored motion information can be transmitted to the inter-frame predictor 332 to be used as the motion information of the spatial neighboring block or the motion information of the temporal neighboring block. The memory 360 can store the reconstructed samples of the reconstructed block in the current picture, and the stored reconstructed samples can be transmitted to the intra-frame predictor 331.

[0135] In the present specification, the exemplary embodiments described in the filter 260 , the inter predictor 221 , and the intra predictor 222 of the encoding device 200 may be applied equivalently or correspondingly to the filter 350 , the inter predictor 332 , and the intra predictor 331 of the decoding device 300 .

[0136] Figure 4 An inter-frame prediction method in a decoding device according to the present disclosure is illustrated.

[0137] Reference Figure 4 , the inter prediction mode of the current block can be determined (S400).

[0138] At least one of a plurality of inter prediction modes predefined in the decoding device may be determined as the inter prediction mode of the current block. Herein, the plurality of inter prediction modes may include various modes such as skip mode, merge mode, motion vector prediction (MVP) mode, sub-block merge mode, affine mode, merge with MVD (MMVD) mode, inter-frame and intra-frame combined prediction (CIIP) mode, etc. Affine mode may be referred to as affine motion prediction mode. MVP mode may be referred to as advanced motion vector prediction (AMVP) mode.

[0139] In addition, decoder-side motion vector refinement (DMVR) mode, adaptive motion vector resolution (AMVR) mode, bidirectional optical flow (BDOF), etc. may also be used additionally or alternatively as additional modes.

[0140] Prediction mode information indicating the inter-frame prediction mode of the current block can be notified to the decoding device by signal from the encoding device. The prediction mode information can be included in the bitstream and received by the decoding device. The prediction mode information may include index information indicating one of multiple candidate modes. Alternatively, the inter-frame prediction mode can be indicated by hierarchical signaling of flag information. In this case, the prediction mode information may include one or more flags.

[0141] For example, a skip flag may be signaled to indicate whether skip mode is applied, and if skip mode is not applied, a merge flag may be signaled to indicate whether merge mode is applied. If merge mode is not applied, MVP mode may be applied, or additionally, a flag for identifying an inter-prediction mode may also be signaled. Affine mode may be signaled as an independent mode, or may be signaled as a mode that depends on merge mode or MVP mode. For example, conceptually, an affine mode may include an affine merge mode and an affine MVP mode.

[0142] In addition, if the merge mode is not applied, information (inter_pred_idc) indicating whether list0 (L0) prediction, list1 (L1) prediction, or bi-prediction is used for the current block may be signaled in the current block. The information may be referred to as motion prediction direction information, inter-prediction direction information, or inter-prediction indication information. In this specification, for ease of explanation, the inter-prediction type (L0 prediction, L1 prediction, or bi-prediction) indicated by the syntax element inter_pred_idc may be indicated as a motion prediction direction. L0 prediction, L1 prediction, and bi-prediction may be represented as pred_L0, pred_L1, and pred_BI, respectively.

[0143] A picture may include one or more slices. A slice may have any of the slice types including intra (I) slices, predicted (P) slices, and bi-predicted (B) slices. The slice type may be indicated based on slice type information. For blocks in an I slice, inter prediction may not be used and only intra prediction may be used. Of course, even in this case, the original sample values ​​may be encoded and signaled without prediction. For blocks in a P slice, intra prediction or inter prediction may be used, and only unidirectional prediction may be used when inter prediction is used. In addition, for blocks in a B slice, intra prediction and / or inter prediction may be used, and when inter prediction is used, not only unidirectional prediction but also bidirectional prediction may be used.

[0144] L0 and L1 may include reference pictures that are encoded / decoded before the current picture. For example, L0 may include reference pictures that are before and / or after the current picture in POC order, and L1 may include reference pictures that are after and / or before the current picture in POC order. In this case, L0 may be assigned a reference picture index relative to the previous reference picture in POC order that is lower than the current reference picture, and L1 may be assigned a reference picture index relative to the previous reference picture in POC order that is lower than the current picture. In the case of B slices, bi-prediction may be applied, and in this case, unidirectional bi-prediction may be applied or bi-directional bi-prediction may be applied. Bi-directional bi-prediction may be referred to as true bi-prediction.

[0145] Information about the inter prediction mode of the current block may be encoded and signaled at a level such as a CU (CU syntax), or may be implicitly determined according to certain conditions. Information may be explicitly signaled in some modes and may be implicitly derived in other modes.

[0146] For example, the CU syntax may define information about the (inter) prediction mode as follows. cu_skip_flag may indicate whether the skip mode is applied to the current block CU. pred_mode_ibc_flag may indicate whether the current block is a block encoded in IBC prediction mode. For example, a pred_mode_ibc_flag with a value of 1 may specify that the current block is encoded in IBC prediction mode, and a pred_mode_ibc_flag with a value of 0 may specify that the current block is not encoded in IBC prediction mode. In this document, the IBC prediction mode means a mode in which prediction is performed by referring to an area that belongs to the same picture as the current block and is pre-reconstructed before the current block, and the pre-reconstructed area may be specified by a specific motion vector.

[0147] general_merge_flag may indicate that general merging is available. When the value of general_merge_flag is 1, conventional merge mode, mmvd mode, and merge sub-block mode (sub-block merge mode) may be used. For example, when the value of general_merge_flag is 1, merge data syntax may be parsed from coded video / image information (or bitstream), and the merge data syntax may be configured / encoded to include the following information.

[0148] merge_block_flag may indicate whether a subblock-based merge mode (or affine merge mode) is applied to the current block. merge_block_idx may specify a merge candidate index of a subblock-based merge candidate list. regular_merge_flag may indicate whether a merge mode (i.e., regular merge mode) is applied to the current block. For example, if the value of regular_merge_flag is 1, the motion information of the current block may be derived using a merge mode with motion vector difference (MMVD) or a regular merge mode.

[0149] mmvd_merge_flag may indicate whether MMVD is applied to the current block. In this article, MMVD may mean a mode of correcting a motion vector by adding a specific MVD to a motion vector pre-derived according to a merge mode. For example, if the value of mmvd_merge_flag is 1, MMVD may be used to derive motion information of the current block. mmvd_cand_flag may indicate whether the first candidate of the merge candidate list or its second candidate is used as a motion vector according to a merge mode.

[0150] ciip_flag may indicate whether the CIIP mode is applied to the current block. The CIIP mode means a method of generating an inter-prediction block and an intra-prediction block by inter-prediction and intra-prediction for the current block, respectively, and generating a final prediction block of the current block by weighted summation of the inter-prediction block and the intra-prediction block. In this article, the inter-prediction block may be performed based on at least any one of the aforementioned inter-prediction modes. Alternatively, the inter-prediction block may be generated by using only a merge mode (specifically, a regular merge mode) among the aforementioned inter-prediction modes. The intra-prediction block may be generated by using only a non-directional mode (e.g., a planar mode) among the predefined intra-prediction modes.

[0151] Reference Figure 4 , motion information of the current block may be derived based on the determined inter prediction mode (S410).

[0152] The motion information may include at least one of a motion vector (mv), a reference picture index (refIdx), and a prediction direction flag (predFlagL0, predFlagL1). The motion vector may specify the position of the reference block, and the reference picture index may specify a reference picture among one or more reference pictures belonging to a reference picture list of the current block. In addition, predFlagL0 may indicate whether L0 prediction is performed, and predFlagL1 may indicate whether L1 prediction is performed. When the merge mode is applied, the motion information of the current block is not directly sent, and the motion information of the current prediction block is derived using the motion information of the neighboring blocks. Therefore, the motion information of the current block may be indicated by sending flag information indicating the use of the merge mode and specifying a merge index of a merge candidate in a merge candidate list of the current block. The merge mode may be referred to as a regular merge mode. For example, when the value of regular_merge_flag is 1, the merge mode may be applied.

[0153] In the following, reference will be made to Figures 5 to 7 A method for deriving motion information based on merge mode is described in detail.

[0154] The merge candidate list can be configured by using five merge candidate blocks. For example, four spatial merge candidates and one temporal candidate can be used. In the case of spatial merge candidates, Figure 5 All or some of the blocks may be used as spatial merging candidates.

[0155] The encoding device (encoder / decoder) inserts the spatial merge candidate derived by searching the spatial neighboring blocks of the current block into the merge candidate list. For example, the spatial neighboring block may include the lower left neighboring block, the left neighboring block, the upper right neighboring block, the top neighboring block, and the upper left neighboring block of the current block. However, this is only an example, and in addition to the spatial neighboring blocks described above, additional neighboring blocks (e.g., right neighboring blocks, bottom neighboring blocks, and lower right neighboring blocks) may be used as spatial neighboring blocks.

[0156] The encoding device may search for spatially adjacent blocks based on the priority for detecting available blocks, and may derive motion information of the detected blocks as spatial merge candidates. For example, the encoding device and the decoding device may search in the order of A1, B1, B0, A0, and B2. Figure 5 The five blocks shown in , and the available candidates are indexed in sequence to configure the merge candidate list. However, not limited to this, the five blocks may also be searched in the order of B1, A1, B0, A0, and B2. The block at position B2 may be searched only when at least one of the blocks at positions A1, B1, B0, A0, and B2 is unavailable. In this article, the unavailable situation may be a situation where it belongs to a slice or patch different from the slice or patch of the current block, a situation where the corresponding block is encoded in intra-frame mode, and the like.

[0157] In addition, a redundancy check may be performed between spatially adjacent blocks to insert spatial merge candidates. This will exclude spatially adjacent blocks having the same motion information as spatially adjacent blocks predetermined as spatial merge candidates from the merge candidate list. However, a redundancy check may be performed only between predefined block pairs to reduce computational complexity. In this article, block pairs such as (A1, B1), (B0, B1), (A0, A1), (B1, B2), (A1, B2) may be defined. That is, if the spatially adjacent block at position B1 is available, it may be checked whether the spatially adjacent blocks at positions A1 and B0 have the same motion information as the spatially adjacent block at position B1. If the spatially adjacent block at position A1 is available, it may be checked whether the spatially adjacent block at position A1 has the same motion information as the spatially adjacent block at position A1. In the case of having the same motion information as a result of the redundancy check, the corresponding spatially adjacent blocks may not be inserted into the merge candidate list. However, the block pairs are for exemplary purposes only and may also be defined as, for example, (A0, A1), (A0, B0), (B0, B1), (B0, B2), (A0, B2).

[0158] The encoding device inserts the temporal merge candidate derived by searching the temporal neighboring blocks of the current block into the merge candidate list. The temporal neighboring block may belong to a reference picture that is a different picture from the current picture to which the current block belongs. The reference picture in which the temporal neighboring block is located may be referred to as a collocated picture or col picture. The temporal neighboring blocks may be searched in the order of the lower right corner neighboring block and the lower right center block of the collocated block of the current block on the col picture.

[0159] In addition, refer to Figure 6 , in the process of deriving a temporal merge candidate, a scaled motion vector may be derived based on a temporal neighboring block belonging to a col picture. A list of reference pictures used to derive temporal neighboring blocks may be explicitly signaled in a slice header. The scaled motion vector of the temporal merge candidate may be obtained by applying specific POC distances tb and td to the motion vector of the temporal neighboring block. In this document, tb may be defined as the POC difference between the current picture and the reference picture of the current picture, and td may be defined as the POC difference between the col picture and the reference picture of the col picture. The reference picture index of the temporal merge candidate may be set to 0 regardless of the temporal neighboring blocks, or may be set to the reference picture index of the temporal neighboring block.

[0160] In addition, when motion data compression is applied, specific motion information may be stored as representative motion information of each predetermined storage unit in the col picture. In this case, it is not necessary to store motion information of all blocks in the predetermined storage unit, thereby obtaining a motion data compression effect. In this case, the predetermined storage unit may be predetermined as a 16×16 sample unit, an 8×8 sample unit, etc., or size information about the predetermined storage unit may be notified from the encoding device to the decoding device using a signal.

[0161] When motion data compression is applied, the motion information of the temporal neighboring block may be replaced with representative motion information of a predetermined storage unit where the temporal neighboring block is located. That is, in this case, in implementation aspects, after arithmetically shifting by a specific value to the right, not based on the prediction block located at the coordinates of the temporal neighboring block but based on the coordinates of the temporal neighboring block (upper left sample position), the temporal merge candidate may be derived based on the motion information of the prediction block covering the position arithmetically shifted to the left.

[0162] For example, if the predetermined storage unit is a 2n×2n sample unit, and assuming the coordinates of the temporally neighboring block are (xTnb, yTnb), the motion information of the prediction block located at the modified position ((xTnb>>n)<<n), (yTnb>>n)<<n) can be used for temporal merge candidates. Specifically, if the predetermined storage unit is a 16×16 sample unit, and assuming the coordinates of the temporally neighboring block are (xTnb, yTnb), the motion information of the prediction block located at the modified position ((xTnb>>4)<<4), (yTnb>>4)<<4) can be used for temporal merge candidates. Alternatively, if the predetermined storage unit is an 8×8 sample unit, and assuming the coordinates of the temporally neighboring block are (xTnb, yTnb), the motion information of the prediction block located at the modified position ((xTnb>>3)<<3), (yTnb>>3)<<3) can be used for temporal merge candidates.

[0163] The encoding device can determine whether the number of current merge candidates is less than the maximum number of merge candidates. The maximum number of merge candidates can be predefined or can be signaled from the encoding device to the decoding device. For example, the encoding device can generate information about the maximum number of merge candidates, encode the information, and send the encoded information to the decoding device in the form of a bitstream. If the number of current merge candidates is equal to the maximum number of merge candidates, the additional merge candidate insertion process may not be performed.

[0164] As a result of the check, if the number of current merge candidates is less than the maximum number of merge candidates, the encoding device inserts additional merge candidates into the merge candidate list. The additional merge candidates can include at least one of a history-based merge candidate, a pairwise average merge candidate, an ATMVP, and a combined dual-prediction merge candidate (when the slice / tile group type of the current slice / tile group is B) and / or a zero vector merge candidate.

[0165] The history-based merge candidate can be added to the merge candidate list and can be added after the spatial merge candidates and the temporal merge candidates. That is, the motion information of the pre-coded block can be stored in a table or buffer of a specific size and can be used as a merge candidate for the current block. Hereinafter, the pre-coded block stored in the table or the motion information of the pre-coded block is referred to as an HVMP candidate.

[0166] The table includes multiple HMVP candidates, but the number of HMVP candidates can be reset to 0 in units of CTU rows. When the pre-coded block is encoded in inter-frame mode and it is not based on a merge mode of a sub-block, the pre-coded block can be added to the table as an HMVP candidate. In this case, the pre-coded block can be added to the last entry of the table, or the pre-coded block can be added to the first entry. The size of the table is 5, which may mean that up to 5 HMVP candidates can be added to the table. When a new HMVP candidate is added, a pre-stored HVMP candidate can be removed from the table (i.e., in a first-in, first-out manner). However, if there is an HMVP candidate with the same motion information as the newly added HMVP candidate in the table, the HVMP candidate with the same motion information can be removed from the table. After being removed, all or some of the remaining HMVP candidates move forward in the table. For example, if the i-th HMVP candidate is removed, the (i+1)th HMVP candidate moves to the position of the i-th HMVP candidate, and the (i+2)th HMVP candidate moves to the position of the (i+1)th HMVP candidate. Next, the newly added HMVP candidate can be added to the last entry of the table.

[0167] A redundancy check may be performed on the most recently added H HMVP candidates and spatial / temporal merge candidates among the HMVP candidates belonging to the table. However, in order to reduce the number of redundant check operations, the number H of HMVP candidates used to generate the merge candidate list may be variably determined based on the number N of merge candidates present in the merge candidate list. For example, if the number N of merge candidates present in the merge candidate list is less than or equal to 4, the number H may be set to the number of available HMVP candidates in the table. Otherwise, if the number N of merge candidates present in the merge candidate list is greater than 4, the number H may be set to (8-N). However, only history-based merge candidates may be added until the number of current merge candidates in the merge candidate list reaches (the maximum number of merge candidates - 1).

[0168] In addition, in this specification, paired average merge candidates may also be referred to as average merge candidates, paired average candidates, or paired candidates. Paired average candidates may be generated by averaging predefined merge candidate pairs among the merge candidates in the merge candidate list. Merge candidate pairs are defined as {(0,1), (0,2), (1,2), (0,3), (1,3), (2,3)}, where the numbers represent the merge indexes of the merge candidate list. If the number of current merge candidates of the merge candidate list does not reach the maximum number of merge candidates even after the average merge candidate is added to the merge candidate list, a zero vector merge candidate may be added to the last entry of the merge candidate list. Zero vector merge candidates may be added until the number of current merge candidates of the merge candidate list reaches the maximum number of merge candidates.

[0169] Hereinafter, a method of deriving an average merge candidate will be described in detail. For convenience of explanation, any one merge candidate in the existing merge candidate list is referred to as a first merge candidate, and another merge candidate is referred to as a second merge candidate.

[0170] The motion information of the average merge candidate can be derived by weighted averaging the motion information of the first merge candidate and the second merge candidate. In this article, the weights of the weighted average are [1:1], [1:2], [1:3], [2:3], etc., but are not limited to this. The weights can be predefined in the encoding device / decoding device, or can be derived in the decoding device. In this case, the weights can be derived by considering the distance between the current picture and the reference picture of the merge candidate and at least one of the prediction directions of the merge candidate. Alternatively, the motion information of the average merge candidate can be derived by obtaining the motion information in the L0 direction from the first merge candidate and the motion information in the L1 direction from the second merge candidate and combining the two motion information. As described below, the motion information of the average merge candidate can be derived based on at least one of the aforementioned derivation methods, and the derivation method can be performed by considering the prediction direction of the merge candidate to be combined.

[0171] 1. When unidirectional prediction is applied to both the first merge candidate and the second merge candidate

[0172] (Case 1) When L0 prediction is applied to the first merge candidate and L1 prediction is applied to the second merge candidate, the reference picture index in the L0 direction of the average merge candidate may be derived as the reference picture index of the first merge candidate. The prediction direction flag in the L0 direction of the average merge candidate may be derived as 1. The motion vector in the L0 direction of the average merge candidate may be derived as the motion vector of the first merge candidate. The reference picture index in the L1 direction of the average merge candidate may be derived as the reference picture index of the second merge candidate. The prediction direction flag in the L1 direction of the average merge candidate may be derived as 1. The motion vector in the L1 direction of the average merge candidate may be derived as the motion vector of the second merge candidate.

[0173] (Case 2) When L1 prediction is applied to the first merge candidate and L0 prediction is applied to the second merge candidate, the reference picture index in the L0 direction of the average merge candidate may be derived as the reference picture index of the second merge candidate. The prediction direction flag in the L0 direction of the average merge candidate may be derived as 1. The motion vector in the L0 direction of the average merge candidate may be derived as the motion vector of the second merge candidate. The reference picture index in the L1 direction of the average merge candidate may be derived as the reference picture index of the first merge candidate. The prediction direction flag in the L1 direction of the average merge candidate may be derived as 1. The motion vector in the L1 direction of the average merge candidate may be derived as the motion vector of the first merge candidate.

[0174] (Case 3) When L0 prediction is applied to the first merge candidate and the second merge candidate, the reference picture index in the L0 direction of the average merge candidate can be derived as the reference picture index of any one of the first merge candidate and the second merge candidate. For example, between the first merge candidate and the second merge candidate, the reference picture index of the merge candidate with the smallest index can be set to the reference picture index in the L0 direction of the average merge candidate. The prediction direction flag in the L0 direction of the average merge candidate can be derived as 1. The motion vector in the L0 direction of the average merge candidate can be derived by weighted average of the motion vectors of the first merge candidate and the second merge candidate. The reference picture index in the L1 direction of the average merge candidate can be derived as -1. The prediction direction flag in the L1 direction can be derived as 0. The motion information in the L1 direction can be derived as 0.

[0175] (Case 4) When L1 prediction is applied to the first merge candidate and the second merge candidate, the reference picture index in the L0 direction of the average merge candidate can be derived as -1. The prediction direction flag in the L0 direction can be derived as 0. The motion information in the L0 direction can be derived as 0. The reference picture index in the L1 direction of the average merge candidate can be derived as the reference picture index of any one of the first merge candidate and the second merge candidate. For example, between the first merge candidate and the second merge candidate, the reference picture index of the merge candidate with the smallest index can be set to the reference picture index in the L1 direction of the average merge candidate. The prediction direction flag in the L1 direction of the average merge candidate can be derived as 1. The motion vector in the L1 direction of the average merge candidate can be derived by weighted average of the motion vectors of the first merge candidate and the second merge candidate.

[0176] 2. When bidirectional prediction is applied to both the first merging candidate and the second merging candidate

[0177] (Case 5) The reference picture index in the L0 direction of the average merge candidate can be derived as the reference picture index of any one of the first merge candidate and the second merge candidate. For example, between the first merge candidate and the second merge candidate, the reference picture index of the merge candidate with the smallest index can be set as the reference picture index in the L0 direction of the average merge candidate. The prediction direction flag in the L0 direction of the average merge candidate can be derived as 1. The motion vector in the L0 direction of the average merge candidate can be derived by the weighted average of the motion vectors of the first merge candidate and the second merge candidate. The reference picture index in the L1 direction of the average merge candidate can be derived as the reference picture index of any one of the first merge candidate and the second merge candidate. For example, between the first merge candidate and the second merge candidate, the reference picture index of the merge candidate with the smallest index can be set as the reference picture index in the L1 direction of the average merge candidate. The prediction direction flag in the L1 direction of the average merge candidate can be derived as 1. The motion vector in the L1 direction of the average merge candidate can be derived by the weighted average of the motion vectors of the first merge candidate and the second merge candidate.

[0178] 3. When bidirectional prediction is applied to the first merge candidate and unidirectional prediction is applied to the second merge candidate

[0179] (Case 6) When L0 prediction is applied to the second merge candidate, the reference picture index in the L0 direction of the average merge candidate can be derived as the reference picture index of any one of the first merge candidate and the second merge candidate. For example, between the first merge candidate and the second merge candidate, the reference picture index of the merge candidate with the smallest index can be set to the reference picture index in the L0 direction of the average merge candidate. The prediction direction flag in the L0 direction of the average merge candidate can be derived as 1. The motion vector in the L0 direction of the average merge candidate can be derived by weighted averaging of the motion vectors of the first merge candidate and the second merge candidate. The prediction direction flag in the L1 direction of the average merge candidate can be derived as 1. The motion vector in the L1 direction of the average merge candidate can be derived as the motion vector of the first merge candidate.

[0180] (Case 7) When L1 prediction is applied to the second merge candidate, the reference picture index in the L0 direction of the average merge candidate can be derived as the reference picture index of the first merge candidate. The prediction direction flag in the L0 direction of the average merge candidate can be derived as 1. The motion vector in the L0 direction of the average merge candidate can be derived as the motion vector of the first merge candidate. The reference picture index in the L1 direction of the average merge candidate can be derived as the reference picture index of any one of the first merge candidate and the second merge candidate. For example, between the first merge candidate and the second merge candidate, the reference picture index of the merge candidate with the smallest index can be set to the reference picture index in the L1 direction of the average merge candidate. The prediction direction flag in the L1 direction of the average merge candidate can be derived as 1. The motion vector in the L1 direction of the average merge candidate can be derived by weighted average of the motion vectors of the first merge candidate and the second merge candidate.

[0181] As a result of the check, if the number of current merge candidates is not less than the maximum number of merge candidates, the encoding device may stop configuring the merge candidate list. In this case, the encoding device may select the optimal merge candidate among the merge candidates constituting the merge candidate list based on the rate-distortion (RD) cost, and signal the selection information (e.g., merge index) indicating the selected merge candidate to the decoding device. The decoding device may select the optimal merge candidate based on the merge candidate list and the selection information.

[0182] The motion information of the selected merge candidate can be used as the motion information of the current block. Alternatively, the motion information of the selected merge candidate can be used as the motion information of the current block. Figure 7 The motion vector of the selected merge candidate is corrected using a motion vector difference (MVD) having a specific length and direction, and the motion vector corrected based on the MVD can be used as the motion vector of the current block.

[0183] At least one of mmvd_distance_idx and mmvd_direction_idx may be used to derive MVD. mmvd_distance_idx may indicate an index for deriving MVD length (MmvdDistance), and mmvd_direction_idx may indicate an index for deriving MVD direction or sign (MmvdSign). For example, MVD may be derived as shown in the following Equation 1.

[0184] [Formula 1]

[0185] MmvdOffset[x0][y0][0]=(MmvdDistance[x0][y0]<<2)*MmvdSign[x0][y0][0]

[0186] MmvdOffset[x0][y0][1]=(MmvdDistance[x0][y0]<<2)*MmvdSign[x0][y0][1]

[0187] Herein, MmvdDistance may be derived as shown in Table 1 below based on mmvd_distance_idx and a specific flag (ph_mmvd_fullpel_only_flag).

[0188] [Table 1]

[0189]

[0190] Herein, ph_mmvd_fullpel_only_flag may indicate whether the motion vector uses integer pixel precision in the merge mode of the current block. For example, when ph_mmvd_fullpel_only_flag is a first value, the merge mode of the current block uses integer pixel precision. That is, this may mean that the motion vector resolution of the current block is an integer pixel. On the other hand, when ph_mmvd_fullpel_only_flag is a second value, the merge mode of the current block may use fractional pixel precision. In other words, when ph_mmvd_fullpel_only_flag is a second value, the merge mode of the current block may use integer pixel precision or fractional pixel precision. Alternatively, when ph_mmvd_fullpel_only_flag is a second value, the merge mode of the current block may be limited to using only fractional pixel precision. Examples of fractional pixel precision include 1 / 2 pixel, 1 / 4 pixel, and 1 / 8 pixel.

[0191] In addition, MmvdSign may indicate the direction of the MMVD, and the direction may include at least one of left, right, top, bottom, upper left, lower left, upper right, and lower right. For example, as shown in Table 2 below, MmvdSign may be determined.

[0192] [Table 2]

[0193] mmvd_direction_idx[x0][y0] MmvdSign[x0][y0][0] MmvdSign[x0][y0][1] 0 +1 0 1 -1 0 2 0 +1 3 0 -1

[0194] In Table 2, MmvdSign[x0][y0][0] may represent the sign of the x component of the MVD, and MmvdSign[x0][y0][1] may represent the sign of the y component of the MVD. When mmvd_direction_idx is 0, the MVD direction may be determined as the right direction. When mmvd_direction_idx is 1, the MVD direction may be determined as the left direction. When mmvd_direction_idx is 2, the MVD direction may be determined as the bottom direction. When mmvd_direction_idx is 3, the MVD direction may be determined as the top direction.

[0195] Only when mmvd_merge_flag is 1, the aforementioned mmvd_distance_idx and mmvd_direction_idx can be encoded / decoded.

[0196] In addition, the MVD can be set to be the same as the previously determined MmvdOffset. Alternatively, the MmvdOffset can be corrected considering the POC difference (PocDiff) between the reference picture of the current block and the current picture to which the current block belongs, and the corrected MmvdOffset can be set to the MVD. In this case, the current block is encoded / decoded by bidirectional prediction, and the reference picture of the current block may include a first reference picture (reference picture in the L0 direction) and a second reference picture (reference picture in the L1 direction). For ease of explanation, hereinafter, the POC difference between the first reference picture and the current picture is referred to as PocDiff0, and the POC difference between the second reference picture and the current picture is referred to as PocDiff1. The MVD in the L0 direction is referred to as MVD0, and the MVD in the L1 direction is referred to as MVD1.

[0197] When PocDiff0 and PocDiff1 are the same, each of MVD0 and MVD1 of the current block may be equally set to MmvdOffset.

[0198] In the case where PocDiff0 and PocDiff1 are not the same, when the absolute value of PocDiff0 is greater than or equal to the absolute value of PocDiff1, MVD0 may be set equal to MmvdOffset. In addition, MVD1 may be derived based on a preset MVD0. For example, when the first reference picture and the second reference picture are long-term reference pictures, MVD1 may be derived by applying a first scaling factor to MVD0. The first scaling factor may be determined based on PocDiff0 and PocDiff1. On the other hand, when at least one of the first reference picture and the second reference picture is a short-term reference picture, MVD1 may be derived by applying a second scaling factor to MVD0. The second scaling factor may be a fixed value (e.g., -1 / 2, -1, etc.) pre-agreed in the encoding device / decoding device. However, the second scaling factor may be applied only when the sign of PocDiff0 and the sign of PocDiff1 are different from each other. When the sign of PocDiff0 and the sign of PocDiff1 are the same as each other, MVD1 is set equal to MVD0, and no additional scaling may be performed.

[0199] In addition, in the case where PocDiff0 and PocDiff1 are not the same, when the absolute value of PocDiff0 is less than the absolute value of PocDiff1, MVD1 may be set equal to MmvdOffset. In addition, MVD0 may be derived based on a preset MVD1. For example, when the first reference picture and the second reference picture are long-term reference pictures, MVD0 may be derived by applying a first scaling factor to MVD1. The first scaling factor may be determined based on PocDiff0 and PocDiff1. On the other hand, when at least one of the first reference picture and the second reference picture is a short-term reference picture, MVD0 may be derived by applying a second scaling factor to MVD1. The second scaling factor may be a fixed value (e.g., -1 / 2, -1, etc.) pre-agreed in the encoding device / decoding device. However, the second scaling factor may be applied only when the sign of PocDiff0 and the sign of PocDiff1 are different from each other. When the sign of PocDiff0 and the sign of PocDiff1 are the same as each other, MVD0 is set equal to MVD1, and no additional scaling may be performed.

[0200] Reference Figure 4 , a prediction block of the current block can be obtained based on the derived motion information (S420).

[0201] The prediction block may include prediction samples (prediction sample array) of the current block. When the motion vector of the current block indicates a fractional sample unit, an interpolation process may be performed so that the prediction samples of the current block may be derived based on reference samples in fractional sample units within a reference picture. When affine inter prediction is applied to the current block, the prediction block may be obtained based on the motion vector in a sample unit or a sub-block unit.

[0202] The obtained prediction block may include at least one of a block obtained by L0 prediction (hereinafter referred to as L0 prediction block) and a block obtained by L1 prediction (hereinafter referred to as L1 prediction block). L0 prediction may mean prediction using a reference picture of reference picture list 0 (List0) and a motion vector (mvL0) in the L0 direction. L1 prediction may mean prediction using a reference picture of reference picture list 1 (List1) and a motion vector (mvL1) in the L1 direction.

[0203] For example, when the current block performs uni-prediction, only either the L0 prediction block or the L1 prediction block may be obtained for the current block. Specifically, when the current block performs only L0 prediction (i.e., predFlagL0=1, predFlagL1=0), only the L0 prediction block may be obtained for the current block. On the other hand, when the current block performs L1 prediction (i.e., predFlagL0=0, predFlagL1=1), only the L1 prediction block may be obtained for the current block. The obtained L0 prediction block or L1 prediction block may be used as the prediction block of the current block, or weighted prediction may be applied to the obtained L0 prediction block or L1 prediction block to obtain the prediction block of the current block.

[0204] Furthermore, when bi-prediction is performed on the current block, each of the L0 prediction block and the L1 prediction block may be obtained for the current block, and the prediction block of the current block may be obtained through weighted prediction of the L0 prediction block and the L1 prediction block.

[0205] The weighted prediction according to the present disclosure can be roughly divided into explicit weighted prediction and default weighted prediction. Either of the explicit weighted prediction and the default weighted prediction can be selectively used, and for this, a specific flag (weightedPredFlag) can be used. If the slice type of the slice to which the current block belongs is a P slice, the value of weightedPredFlag can be set to the value of the flag (pps_weighted_pred_flag) that specifies whether explicit weighted prediction is applied to the P slice. If the slice type of the slice to which the current block belongs is a B slice, the value of weightedPredFlag can be set to the value of the flag (pps_weighted_pred_flag) that specifies whether explicit weighted prediction is applied to the B slice. If the value of weightedPredFlag is 1, explicit weighted prediction can be applied, and if the value of weightedPredFlag is 0, default weighted prediction can be applied. In this article, explicit weighted prediction and default weighted prediction will be described in detail.

[0206] 1. Explicit Weighted Prediction

[0207] Explicit weighted prediction may mean that the L0 prediction block and the L1 prediction block of the current block are weighted predicted based on weighted prediction information explicitly signaled. Figure 8 An explicit weighted prediction method using weighted prediction information is described in detail.

[0208] 2. Default weighted prediction

[0209] The default weighted prediction may mean that the L0 prediction block / L1 prediction block is weighted predicted based on weight candidates predefined in the decoding device. The default weighted prediction may be performed as shown in Equations 2 to 5 based on predFlagL0 and predFlagL1 of the current block.

[0210] (Case 1) When predFlagL0=1 and predFlagL1=0

[0211] This is the case where only L0 prediction is performed on the current block and only L0 prediction blocks can be obtained for the current block. In this case, the prediction block of the current block can be obtained by applying a specific offset (offset1) to the L0 prediction block obtained in advance. In this article, the offset can be variably determined based on the bit depth of the encoded image. For example, the prediction block of the current block can be obtained by weighted prediction, as shown in the following formula 2.

[0212] [Formula 2]

[0213] pbSamples[x][y]=Clip3(0,(1<<bitDepth)-1,(predSamplesL0[x][y]+offset1)> >shift1)

[0214] In Equation 2, pbSamples[x][y] may represent a prediction block of a current block, and predSamplesL0[x][y] may represent an L0 prediction block obtained by L0 prediction. offset1 may be set equal to (1<<(shift1-1)), and shift1 may be set equal to Max(2,14-bitDepth). The variable bitDepth may represent the bit depth of the encoded image, and may be determined based on the encoding information to specify the bit depth of the luma / chroma samples. The information may be signaled at a higher level (i.e., at least one of a video parameter set, a sequence parameter set, a picture parameter set, a picture header, and a slice header).

[0215] (Case 2) When predFlagL0=0 and predFlagL1=1

[0216] This is the case where only L1 prediction is performed on the current block and only L1 prediction blocks can be obtained for the current block. In this case, the prediction block of the current block can be obtained by applying a specific offset (offset1) to the L1 prediction block obtained in advance. For example, as shown in the following formula 3, the prediction block of the current block can be obtained by weighted prediction.

[0217] [Formula 3]

[0218] pbSamples[x][y]=Clip3(0,(1<<bitDepth)-1,(predSamplesL1[x][y]+offset1)> >shift1)

[0219] In Equation 3, pbSamples[x][y] may represent a prediction block of a current block, and predSamplesL1[x][y] may represent an L1 prediction block obtained through L1 prediction. offset1 and shift1 are the same as described in Case 1, and a detailed description thereof will be omitted.

[0220] (Case 3) When predFlagL0=1 and predFlagL1=1

[0221] This is the case where the current block performs both L0 prediction and L1 prediction and the L0 prediction block and the L1 prediction block can be obtained for the current block. In this case, the prediction block of the current block can be obtained by applying a specific weight or offset to the L0 prediction block and the L1 prediction block obtained in advance. The weight and offset can be determined based on at least one of the weight candidate, the weight index (bcwIdx), and whether it is a block encoded in CIIP mode.

[0222] For example, when the value of the weighted index is 0, the prediction block of the current block can be obtained through weighted prediction, as shown in the following formula 4.

[0223] [Formula 4]

[0224] pbSamples[x][y]=Clip3(0,(1<<bitDepth)-1,(predSamplesL0[x][y]+predSamplesL1[x][y]+offset2)> >shift2)

[0225] In Formula 4, pbSamples[x][y] can represent the prediction block of the current block, and predSamplesL0[x][y] and predSamplesL1[x][y] can represent the L0 prediction block and the L1 prediction block obtained by L0 prediction and L1 prediction, respectively. The same weight is applied to each of the L0 prediction block and the L1 prediction block, which means that the prediction block of the current block is obtained by averaging the L0 prediction block and the L1 prediction block. The offset (offset1) used for weighted prediction can be set to be equal to (1<<(shift2-1)), where the variable shift2 can be set to be equal to Max(3,15-bitDepth). In addition, even if the current block is a block encoded in CIIP mode, the same weighted prediction as shown in Formula 4 above can be equally applied.

[0226] Otherwise, when the value of the weighted index is not 0, the prediction block of the current block can be obtained by weighted prediction, as shown in the following formula 5.

[0227] [Formula 5]

[0228] pbSamples[x][y]=Clip3(0,(1<<bitDepth)-1,(w0*predSamplesL0[x][y]+w1*predSamplesL1[x][y]+offset3)> >(shift1+3))

[0229] In Equation 5, pbSamples[x][y], predSamplesL0[x][y], and predSamplesL1[x][y] are the same as described above, and w0 and w1 represent weights applied to the L0 prediction block and the L1 prediction block, respectively. The offset (offset3) for weighted prediction can be set equal to (1<<(shift1+2)), where the variable shift1 can be set equal to Max(2,14-bitDepth).

[0230] The weight {w0, w1} of formula 5 can be determined based on the weight candidates and weight index (bcwIdx) predefined in the decoding device. The weight candidates may include at least one of {4, 4}, {3, 5}, {5, 3}, {-2, 10}, and {10, -2}. Each weight candidate has a unique index, and a weight candidate having the same index as the weight index (bcwIdx) can be set as the weight for the default weighted prediction.

[0231] The weight index (bcwIdx) may be information for specifying any one of a plurality of weight candidates. In the case of the merge mode, the weight index may be derived from the merge candidate specified by the merge index. In the case of the AMVP mode, the weight index may be encoded and signaled in the encoding device. However, the weight index may be limitedly signaled based on at least one of an inter-prediction indicator (inter_pred_idc), a flag indicating the presence / absence of weights in the L0 direction / L1 direction to be described later (luma_weight_lX_flag, chroma_weight_lX_flag, X=0, 1), and the size of the current block.

[0232] For example, the weight index may be signaled only when the current block uses dual prediction according to an inter-prediction indicator (inter_pred_idc). The weight index may be signaled only when there is no weight corresponding to the reference picture according to a flag indicating the presence / absence of weights in the L0 direction / L1 direction. The weight index may be signaled only when the size of the current block is greater than or equal to a specific threshold. Here, the size of the current block may be represented by the width and height of the current block, the product of the width and height, or the minimum (or maximum) value of the width and height, and the threshold may be 16, 32, 64, 128, or 256.

[0233] Figure 8 An explicit weighted prediction method in a decoding device according to the present disclosure is illustrated.

[0234] Reference Figure 8 , the weighted prediction information of explicit weighted prediction can be obtained (S800).

[0235] The weighted prediction information may include at least one of weight common information, weight quantity information, a flag indicating whether a weight exists, weight increment information, or offset information.

[0236] [Table 3]

[0237]

[0238]

[0239] Referring to Table 3, weight common information may first be signaled in an encoding device. The weight common information may specify a weight reference value commonly used when deriving weights for explicit weighted prediction. The weight common information may be commonly used to derive weights w0 in the L0 direction and weights w1 in the L1 direction. The weight common information may be signaled for each of the luminance component and the chrominance component (luma_log2_weight_denom, delta_chroma_log2_weight_denom). In this article, the weight common information of the chrominance component may be encoded by using the difference between the weight reference value of the luminance component and the weight reference value of the chrominance component.

[0240] Weighted prediction information other than weighted common information may be signaled in each of the L0 direction and the L1 direction. Herein, the weighted prediction information in the L0 direction may be used for reference pictures of a reference picture list (or an L0 reference picture list) of a P slice, and the weighted prediction information in the L1 direction may be used for reference pictures of a reference picture list (or an L1 reference picture list) of a B slice.

[0241] First, with respect to the weight prediction information in the L0 direction, weight quantity information (num_10_weight) specifying the number of weights signaled in the L0 direction may be signaled. However, the weight quantity information may be adaptively signaled based on a flag (wp_info_in_ph_flag, hereinafter referred to as the first flag) that specifies the location where the weighted prediction information is signaled. In this article, the first flag may specify whether the weighted prediction information exists in a picture header or in a slice header. For example, when the value of the first flag is 1, it may indicate that the weighted prediction information may exist in a picture header but not in a slice header. On the other hand, when the value of the first flag is 0, it may indicate that the weighted prediction information does not exist in a picture header but may exist in a slice header.

[0242] The flag indicating whether there is a weight in the L0 direction is signaled by the amount based on the weight amount information and can be signaled in each of the luma component and the chroma component (luma_weight_l0_flag, chroma_weight_l0_flag, hereinafter referred to as the second flag).

[0243] Based on the second flag, the weight increment information and the offset information in the L0 direction may be adaptively signaled. In this article, the weight increment information may specify the difference between the weight of the explicit weighted prediction and the aforementioned weight reference value. When the value of the second flag is 1, the weight increment information and the offset information in the L0 direction may be signaled, and when the value of the second flag is 0, the weight increment information and the offset information in the L0 direction may not be signaled and may be derived as 0. When the second flag is 1, the value of the weight increment information in the L0 direction should be in the range of -128 to 127. The aforementioned weight increment information and the offset information may be signaled for each of the luminance component and the chrominance component.

[0244] Next, regarding the weight prediction information in the L1 direction, weight quantity information (num_11_weight) specifying the number of weights signaled in the L1 direction may be signaled. However, the weight quantity information may be adaptively signaled based on at least one of a flag (wp_info_in_ph_flag) that specifies the location where the weighted prediction information is signaled or a flag (pps_weighted_bipred_flag) that indicates whether explicit weighted prediction is applied to the B slice. Herein, when the value of pps_weighted_bipred_flag is 1, it may indicate that explicit weighted prediction is applied. When the value of pps_weighted_bipred_flag is 0, it may indicate that explicit weighted prediction is not applied. Instead, default weighted prediction may be applied.

[0245] For example, when weighted prediction information is signaled in the picture header (ie, wp_info_in_ph_flag = 1) and explicit weighted prediction is applied to B slices (ie, pps_weighted_bipred_flag = 1), weighted amount information may be signaled. On the other hand, when weighted prediction information is signaled in the picture header but explicit weighted prediction is not applied to B slices (ie, pps_weighted_bipred_flag = 0), weighted amount information may not be signaled but may be derived as 0.

[0246] Alternatively, the weight quantity information may be adaptively signaled by considering only the flag (wp_info_in_ph_flag) that specifies the location where the weighted prediction information is signaled, regardless of the flag (pps_weighted_bipred_flag) indicating whether explicit weighted prediction is applied to the B slice. However, according to pps_weighted_bipred_flag, when explicit weighted prediction is not applied to the B slice, the weight quantity information may be forced to always be 0.

[0247] In addition, the weight quantity information may be signaled by further considering the number of reference pictures belonging to the L1 reference picture list. For example, the weight quantity information may be signaled only for a case where the number of reference pictures belonging to the L1 reference picture list is greater than a specific threshold quantity. Herein, the threshold quantity is a value predefined in the decoding device and may be 0, 1, or 2. However, the present disclosure is not limited thereto, and the threshold quantity may be an integer greater than 2.

[0248] As described above, when pps_weighted_bipred_flag is not considered when the weight quantity information in the L1 direction is signaled, the encoding device encodes the weighted prediction information in the L1 direction, although it is a case where explicit weighted prediction is applied only to P slices. For example, even when explicit weighted prediction is not applied to B slices (i.e., pps_weighted_bipred_flag=0), there may be a case where the encoding device encodes the weight quantity information (num_l1_weight) as a value greater than 0. However, when explicit weighted prediction is not applied to B slices, this means that it is not necessary to signal the weighted prediction information in the L1 direction. Therefore, encoding redundancy can be removed by omitting encoding the weighted prediction information in the L1 direction. In addition, when explicit weighted prediction is not applied to B slices, this means that the weighted prediction of the current block does not require the weighted prediction information in the L1 direction. Therefore, decoding efficiency can be improved by adaptively decoding the weighted prediction information in the L1 direction in consideration of pps_weighted_bipred_flag.

[0249] The flag indicating whether there is a weight in the L1 direction is signaled by a quantity based on the weight quantity information and may be signaled in each of the luma component and the chroma component (luma_weight_l1_flag, chroma_weight_l1_flag, referred to as a third flag).

[0250] Based on the third flag, the weight increment information and the offset information in the L1 direction may be adaptively signaled. In this article, the weight increment information may specify the difference between the weight of the explicit weighted prediction and the aforementioned weight reference value. When the value of the third flag is 1, the weight increment information and the offset information in the L1 direction may be signaled, and when the value of the third flag is 0, the weight increment information and the offset information in the L1 direction may not be signaled and may be derived as 0. When the third flag is 1, the value of the weight increment information in the L1 direction should be in the range of -128 to 127. The aforementioned weight increment information and the offset information may be signaled for each of the luminance component and the chrominance component.

[0251] Reference Figure 8 , at least one of a weight or an offset of explicit weighted prediction of the current block may be derived by using the above-mentioned weighted prediction information (S810).

[0252] For example, when at least one of the following conditions is satisfied, the weight and / or offset of the weighted prediction of the current block may be derived by using at least one of the weighted prediction information signaled in the L0 direction.

[0253] (Condition 1) Weighted prediction information exists in the picture header, explicit weighted prediction is applied to P slices, and the slice type of the current slice to which the current block belongs is a P slice.

[0254] (Condition 2) Weighted prediction information exists in the picture header, explicit weighted prediction is applied to B slices, and the slice type of the current slice to which the current block belongs is a B slice.

[0255] Alternatively, when at least one of the following conditions is satisfied, the weight and / or offset of the weighted prediction of the current block may be derived by using at least one of the weighted prediction information signaled in the L0 direction. That is, when the weighted prediction information in the L0 direction is used, whether the weighted prediction information is present in the picture header may not be considered according to wp_info_in_ph_flag.

[0256] (Condition 1) Explicit weighted prediction is applied to a P slice, and the slice type of the current slice to which the current block belongs is a P slice.

[0257] (Condition 2) Explicit weighted prediction is applied to the B slice, and the slice type of the current slice to which the current block belongs is applied to the B slice.

[0258] For example, when weighted prediction information exists in a picture header, explicit weighted prediction is applied to a B slice, and the slice type of the current slice to which the current block belongs is a B slice, the weights and / or offsets of the weighted prediction of the current block can be derived by using at least one of the weighted prediction information signaled in the L1 direction.

[0259] Alternatively, when explicit weighted prediction is applied to a B slice and the slice type of the current slice to which the current block belongs is a B slice, the weights and / or offsets of the weighted prediction of the current block can be derived by using at least one of the weighted prediction information signaled in the L1 direction. That is, when using the weighted prediction information in the L1 direction, it is not necessary to consider whether the weighted prediction information exists in the picture header according to the wp_info_in_ph_flag.

[0260] Weights and offsets are derived for each of the luminance component and the chrominance component. Hereinafter, the methods for deriving weights and offsets for each component will be described in detail.

[0261] First, the weights of the luminance component are derived by using weight common information and weight increment information, and can be derived, for example, as shown in Equation 6 below.

[0262] [Equation 6]

[0263] w0 = LumaWeightL0[refIdxL0]

[0264] w1 = LumaWeightL1[refIdxL1]

[0265] In Equation 6, w0 can represent the weight in the L0 direction, and w1 can represent the weight in the L1 direction. LumaWeightL0[i] can be derived as ((1 << luma_log2_weight_denom) + delta_luma_weight_l0[i]), and LumaWeightL1[i] can be derived as ((1 << luma_log2_weight_denom) + delta_luma_weight_l1[i]). refIdxL0 and refIdxL1 can respectively represent the reference picture index in the L0 direction and the reference picture index in the L1 direction of the current block. That is, the weight in the L0 direction can be derived by using the weight common information and the weight increment information corresponding to the reference picture index (refIdxL0) in the L0 direction of the current block. Similarly, the weight in the L1 direction can be derived by using the weight common information and the weight increment information corresponding to the reference picture index (refIdxL1) in the L1 direction of the current block.

[0266] However, when the value of the flag indicating whether there is a weight in the L0 direction is 0, the weight in the L0 direction can be derived by using only the weight common information, and the weight in the L0 direction can be derived as 2luma_log2_weight_denom. Similarly, when the value of the flag indicating whether there is a weight in the L1 direction is 0, the weight in the L1 direction can be derived by using only the weight common information, and the weight in the L1 direction can be derived as 2luma_log2_weight_denom.

[0267] The offset of the luma component is derived by using the offset information, and may be derived, for example, as shown in the following Equation 7.

[0268] [Formula 7]

[0269] o0=luma_offset_l0[refIdxL0]<<(bitDepth-8)

[0270] o1=luma_offset_l1[refIdxL1]<<(bitDepth-8)

[0271] In Equation 7, o0 may represent an offset in the L0 direction, and o1 may represent an offset in the L1 direction. luma_offset_l0 and luma_offset_l1 correspond to offset information, and specifically, may represent offset information corresponding to reference picture indexes refIdxL0 and refIdxL1 of the current block among offset information signaled by a number depending on weight quantity information.

[0272] The weight of the chroma component is derived by using the weight common information and the weight delta information, and may be derived, for example, as shown in the following Equation 8.

[0273] [Formula 8]

[0274] w0=ChromaWeightL0[refIdxL0]

[0275] w1=ChromaWeightL1[refIdxL1]

[0276] In Equation 8, w0 may represent the weight in the L0 direction, and w1 may represent the weight in the L1 direction. ChromaWeightL0[i] can be derived as ((1 << ChromaLog2WeightDenom) + delta_chroma_weight_l0[i]), and ChromaWeightL1[i] can be derived as ((1 << ChromaLog2WeightDenom) + delta_chroma_weight_l1[i]). In this document, the variable ChromaLog2WeightDenom can be derived as the sum of the aforementioned weighted common information signaled for each of the luminance component and the chrominance components (i.e., luma_log2_weight_denom + delta_chroma_log2_weight_denom). refIdxL0 and refIdxL1 may respectively represent the reference picture index in the L0 direction and the reference picture index in the L1 direction of the current block. That is, the weight in the L0 direction can be derived by using the weighted common information signaled for the luminance component / chrominance component and the weight increment information corresponding to the reference picture index (refIdxL0) in the L0 direction of the current block. Similarly, the weight in the L1 direction can be derived by using the weighted common information signaled for the luminance component / chrominance component and the weight increment information corresponding to the reference picture index (refIdxL1) in the L1 direction of the current block.

[0277] However, when the value of the flag indicating whether there is a weight in the L0 direction is 0, the weight in the L0 direction can be derived by using only the weighted common information, and the weight in the L0 direction can be derived as 2 ChromaLog2WeightDenom . Similarly, when the value of the flag indicating whether there is a weight in the L1 direction is 0, the weight in the L1 direction can be derived by using only the weighted common information, and the weight in the L1 direction can be derived as 2 ChromaLog2WeightDenom .

[0278] The offset of the chrominance component is derived by using the offset information and can be derived, for example, as shown in the following Equation 9 and Equation 10.

[0279] [Equation 9]

[0280] o0 = ChromaOffsetL0[refIdxL0] << (bitDepth - 8)

[0281] o1 = ChromaOffsetL1[refIdxL1] << (bitDepth - 8)

[0282] In Equation 9, o0 may represent an offset in the L0 direction, and o1 may represent an offset in the L1 direction. refIdxL0 and refIdxL1 may represent a reference picture index in the L0 direction and a reference picture index in the L1 direction of the current block, respectively. Herein, variables ChromaOffsetL0 and ChromaOffsetL1 may be derived based on at least one of offset information of the chroma component, a pre-derived weight, and a variable ChromaLog2WeightDenom, and may be derived, for example, as shown in the following Equation 10.

[0283] [Formula 10]

[0284] ChromaOffsetL0[i]=Clip3(-128,127,(128+delta_chroma_offset_l0[i]-((128*ChromaWeightL0[i])>>ChromaLog2WeightDenom)))

[0285] ChromaOffsetL1[i]=Clip3(-128,127,(128+delta_chroma_offset_l1[i]-((128*ChromaWeightL1[i])>>ChromaLog2WeightDenom)))

[0286] Reference Figure 8 , weighted prediction of the current block may be performed based on the derived weights and offsets (S820).

[0287] Specifically, explicit weighted prediction may be performed by considering whether the current block performs L0 prediction (predFlagL0) and whether the current block performs L1 prediction (predFlagL1).

[0288] (Case 1) When predFlagL0=1 and predFlagL1=0

[0289] This is the case where the current block performs only L0 prediction and can obtain only L0 prediction blocks for the current block. In this case, the prediction block of the current block can be obtained by applying specific weights and offsets to the L0 prediction blocks obtained in advance, as shown in the following formula 11.

[0290] [Formula 11]

[0291] pbSamples[x][y]=Clip3(0,(1< <bitDepth)-1,((predSamplesL0[x][y]*w0+2 log2Wd -1)>>

[0292] log2Wd)+o0)

[0293] In Formula 11, pbSamples may represent a prediction block of the current block (ie, a prediction block of weighted prediction), and predSamplesL0 may represent an L0 prediction block of the current block. In this article, the variable log2Wd may be derived as (luma_log2_weight_denom+shift1), and the variable shift1 may be derived as Max(2,14-bitDepth).

[0294] (Case 2) When predFlagL0=0 and predFlagL1=1

[0295] This is the case where the current block performs only L1 prediction and only L1 prediction blocks can be obtained for the current block. In this case, the prediction block of the current block can be obtained by applying specific weights and offsets to the L1 prediction blocks obtained in advance, as shown in the following formula 12.

[0296] [Formula 12]

[0297] pbSamples[x][y]=Clip3(0,(1< <bitDepth)-1,((predSamplesL1[x][y]*w0+2 log2Wd -1)>>log2Wd)+o0)

[0298] In Equation 12, predSamplesL1 may represent an L1 prediction block of the current block. In addition, pbSamples and a variable log2Wd are the same as those described in Equation 11, and a redundant description thereof will be omitted.

[0299] (Case 3) When predFlagL0=1 and predFlagL1=1

[0300] This is the case where the current block performs L0 prediction and L1 prediction and can obtain L0 prediction block and L1 prediction block for the current block. In this case, the prediction block of the current block can be obtained by applying specific weights and offsets to the L1 prediction block obtained in advance, as shown in the following formula 13.

[0301] [Formula 13]

[0302] pbSamples[x][y]=Clip3(0,(1< <bitDepth)-1,(predSamplesL0[x][y]*w0+predSamplesL1[x][y]*w1+((o0+o1+1)<<log2Wd))> >(log2Wd+1))

[0303] In Equation 13, predSamples, predSamplesL0, predSamplesL1, and a variable log2Wd are the same as those described in Equations 11 and 12, and a redundant description thereof will be omitted.

[0304] Fig. 9 The structure of the inter-frame predictor 332 in the decoding device according to the present disclosure is schematically illustrated.

[0305] Reference Fig. 9 , the inter predictor 332 may include an inter prediction mode determiner 900 , a motion information deriver 910 , and a prediction block obtainer 920 .

[0306] The inter-frame prediction mode determiner 900 may determine at least one of a plurality of inter-frame prediction modes predefined in the decoding device as the inter-frame prediction mode of the current block. In this article, the plurality of inter-frame prediction modes may include various modes such as skip mode, merge mode, motion vector prediction (MVP) mode, sub-block merge mode, affine mode, merge with MVD (MMVD) mode, inter-frame and intra-frame combined prediction (CIIP) mode, etc. Affine mode may be referred to as affine motion prediction mode. MVP mode may be referred to as advanced motion vector prediction (AMVP) mode. In addition, decoder-side motion vector refinement (DMVR) mode, adaptive motion vector resolution (AMVR) mode, bidirectional optical flow (BDOF), etc. may also be used additionally or alternatively as additional modes.

[0307] The inter-frame prediction mode determiner 900 may determine the inter-frame prediction mode of the current block based on the prediction mode information received from the encoding device, which is similar to the above reference Figure 4 In this article, the redundant description will be omitted.

[0308] The motion information deriver 910 may derive the motion information of the current block based on the determined inter-frame prediction mode. When the inter-frame prediction mode of the current block is determined to be the merge mode, the motion information may be derived based on the motion information of the merge candidate selected by the selection information (e.g., the merge index) in the merge candidate list, which is similar to the above reference Figure 4 In this article, the redundant description will be omitted.

[0309] The prediction block obtainer 920 may obtain a prediction block of the current block based on the derived motion information.

[0310] The prediction block may include prediction samples (prediction sample array) of the current block. When the motion vector of the current block indicates a fractional sample unit, an interpolation process may be performed so that the prediction samples of the current block may be derived based on reference samples in fractional sample units within a reference picture. When affine inter prediction is applied to the current block, the prediction block may be obtained based on the motion vector in a sample unit or a sub-block unit.

[0311] In addition, an L0 prediction block obtained for the current block by L0 prediction or an L1 prediction block obtained by L1 prediction may be used as a prediction block. Alternatively, a prediction block may be obtained by applying weighted prediction to at least one of the L0 prediction block and the L1 prediction block of the current block. In this document, weighted prediction is roughly divided into explicit weighted prediction and default weighted prediction, which is similar to the above reference. Figure 4 , Figure 8 It is the same as described in Table 3. Therefore, its redundant description will be omitted.

[0312] Fig.10 The structure of the prediction block obtainer 920 in the inter-frame predictor 332 according to the present disclosure is schematically illustrated.

[0313] Reference Fig.10 , the prediction block obtainer 920 may include a weighted prediction parameter deriver 1000 and a weighted predictor 1010 .

[0314] The weighted prediction parameter deriver 1000 may derive weighted prediction parameters of explicit weighted prediction of the current block by using weighted prediction information. Herein, the weighted prediction information may include at least one of the aforementioned weights or offsets of the explicit weighted prediction.

[0315] The weighted prediction information can be obtained by entropy decoding in the entropy decoder 310 of the decoding device, and can be sent to the weighted prediction parameter deriver 1000. The weighted prediction information is the same as described with reference to Table 2, and the method of deriving the weighted prediction parameters based on the weighted prediction information is the same as described with reference to Table 2. Figure 8 Same as described.

[0316] The weighted predictor 1010 may perform weighted prediction on the current block based on the weighted prediction parameters derived in the weighted prediction parameter deriver 1000. The weighted prediction is performed by considering whether the current block performs L0 prediction (predFlagL0) and whether the current block performs L1 prediction (predFlagL1), which is consistent with the reference Figure 8 Same as described.

[0317] Fig.11 An inter-frame prediction method in an encoding device according to the present disclosure is illustrated.

[0318] Reference Fig.11, the inter-frame prediction mode of the current block can be determined (S1100).

[0319] At least one of the plurality of inter prediction modes predefined in the decoding device may be determined as the inter prediction mode of the current block. In this article, the plurality of inter prediction modes may include various modes such as skip mode, merge mode, motion vector prediction (MVP) mode, sub-block merge mode, affine mode, merge with MVD (MMVD) mode, inter-frame and intra-frame combined prediction (CIIP) mode, etc. In addition, decoder-side motion vector refinement (DMVR) mode, adaptive motion vector resolution (AMVR) mode, bidirectional optical flow (BDOF), etc. may also be used as additional modes in addition or alternatively.

[0320] The encoding device may encode prediction mode information indicating the inter prediction mode of the current block and may signal the prediction mode information to the decoding device. The prediction mode information may include index information indicating one of a plurality of candidate modes. Alternatively, the inter prediction mode may be indicated by hierarchical signaling of flag information. In this case, the prediction mode information may include one or more flags. The prediction mode information related to the inter prediction mode is related to the reference signal. Figure 4 The detailed description is the same. In this article, the detailed description will be omitted.

[0321] Reference Fig.11 , motion information of the current block can be derived based on the determined inter-frame prediction mode (S1110).

[0322] The encoding device may derive the optimal motion information of the current block through motion estimation. The motion information may include at least one of a motion vector (mv), a reference picture index (refIdx), and a prediction direction flag (predFlagL0, predFlagL1), as described above with reference to Figure 4 For example, the encoding device may derive motion information by searching for a similar reference block having high correlation in units of fractional pixels within a predetermined search range in the reference picture using the original block in the original picture for the current block.

[0323] The similarity of the blocks can be derived based on the difference of the sampling values ​​based on the phase. For example, the similarity of the blocks can be calculated based on the SAD between the current block (or the template of the current block) and the reference block (or the template of the reference block). In this case, the motion information can be derived based on the reference block with the minimum SAD in the search area. The derived motion information can be signaled to the decoding device according to various methods based on the predefined inter-frame prediction mode.

[0324] The encoding device may search for a merge candidate block for deriving motion information of the current block to perform a merge mode. For example, up to five merge candidate blocks may be used, but the embodiments of the present specification are not limited thereto. In addition, the maximum number of merge candidate blocks may be sent in at least one of a video parameter set, a sequence parameter set, a picture parameter set, a picture header, a slice header, and a tile group header, but the embodiments of the present specification are not limited thereto.

[0325] After finding the merge candidate block, the encoder can generate a merge candidate list consisting of multiple merge candidates based on the found merge candidate block, and can select the merge candidate with the smallest cost as the final merge candidate for deriving the motion information of the current block. The merge index specifying the selected final merge candidate is encoded, and this can be notified to the decoding device with a signal.

[0326] The merge candidate list includes at least one of a spatial merge candidate, a temporal merge candidate, a history-based merge candidate, an average merge candidate, or a zero vector merge candidate. Figure 4 The descriptions are the same, so the detailed description will be omitted in this article.

[0327] The motion information of the selected merge candidate can be used as the motion information of the current block. Alternatively, the motion information of the selected merge candidate can be used as the motion information of the current block. Figure 7 The motion vector of the selected merge candidate is corrected using a motion vector difference (MVD) having a specific length and direction, and the motion vector corrected based on the MVD can be used as the motion vector of the current block.

[0328] The encoding device may additionally search for a reference block based on a predefined MVD length (MmvdDistance) as shown in Table 1 and a predefined MVD direction (MmvdSign) as shown in Table 2, and may select each of the length and direction of the MVD corresponding to the optimal reference block. The MVD may be derived based on the selected MVD length and MVD direction. Based on Tables 1 and 2 predefined in the encoding device, the selected MVD length and MVD direction may be encoded as mmvd_distance_idx and mmvd_direction_idx, respectively. This is consistent with the reference block. Figure 4 The detailed description is the same, and its detailed description will be omitted herein.

[0329] Reference Fig.11 , the weighted prediction information of the weighted prediction of the current block can be obtained (S1120).

[0330] The weighted prediction may be any one of the aforementioned explicit weighted prediction and the default weighted prediction. The weighted prediction information may be obtained for at least one of the L0 prediction block and the L1 prediction block of the current block. In this article, the L0 / L1 prediction block may be obtained based on the motion information derived in the above S1110.

[0331] The weighted prediction information can be obtained based on a specific weighted prediction coefficient (ie, at least one of a specific weight or offset). Figure 8 A method for deriving weights and offsets based on weighted prediction information is described. The weighted prediction information can be obtained based on the weighted prediction coefficients by the reverse process of the method. In this article, the weighted prediction coefficients can be determined based on the L0 prediction block / L1 prediction block of the current block, or the weighted prediction coefficients can be determined based on the L0 reference picture / L1 reference picture of the current block.

[0332] The weighted prediction information may include at least one of weight common information, weight quantity information, a flag indicating whether a weight exists, weight increment information, or offset information. The weighted prediction information may be encoded in an encoding device and signaled to a decoding device, and the weighted prediction information other than the weight common information may be encoded for each of the L0 direction and the L1 direction.

[0333] Specifically, in the case of weighted prediction information in the L0 direction, when the value of the flag (wp_info_in_ph_flag) specifying the position where the weighted prediction information is encoded is 1, the weight quantity information can be encoded. The flag indicating whether the weight exists can be encoded based on the number of the weight quantity information. The weight increment information and the offset information can also be encoded based on the number of the weight quantity information, and can be encoded only when the value of the flag indicating whether the weight exists is 1.

[0334] In the case of weighted prediction information in the L1 direction, when the value of the flag (wp_info_in_ph_flag) specifying the position where the weighted prediction information is encoded is 1, the weight quantity information can be encoded. In addition, the weighted prediction information can be encoded when the value of the flag (pps_weighted_bipred_flag) indicating whether explicit weighted prediction is applied to the B slice is 1. However, the weighted prediction information can be limited only when the number of reference pictures belonging to the L1 reference picture list is greater than a threshold number predefined in the encoding device. In this article, the threshold number can be 0, 1, or 2. The flag indicating whether the weight exists can be encoded by the number based on the weight quantity information. The weight increment information and the offset information can also be encoded by the number based on the weight quantity information, and can be encoded only when the value of the flag indicating whether the weight exists is 1.

[0335] In addition, the encoding device may derive residual samples of the current block from the prediction samples of the prediction block obtained based on the weighted prediction coefficient, and may signal residual information about the residual samples to the decoding device.

[0336] Fig.12 The structure of the inter-frame predictor 221 in the encoding device according to the present disclosure is schematically illustrated.

[0337] Reference Fig.12 , the inter-frame predictor 221 may include an inter-frame prediction mode determiner 1200 , a motion information deriver 1210 , and a weighted prediction information obtainer 1220 .

[0338] The inter-frame prediction mode determiner 1200 may determine at least one of a plurality of inter-frame prediction modes predefined in the decoding device as the inter-frame prediction mode of the current block. Herein, the plurality of inter-frame prediction modes may include various modes such as skip mode, merge mode, motion vector prediction (MVP) mode, sub-block merge mode, affine mode, merge with MVD (MMVD) mode, inter-frame and intra-frame combined prediction (CIIP) mode, etc. In addition, decoder-side motion vector refinement (DMVR) mode, adaptive motion vector resolution (AMVR) mode, bidirectional optical flow (BDOF), etc. may also be used as additional modes in addition or alternatively.

[0339] Prediction mode information indicating the determined inter-frame prediction mode may be encoded by the entropy encoder 240 and the prediction mode information may be signaled to the decoding device. The prediction mode information may include index information indicating one of a plurality of candidate modes. Alternatively, the inter-frame prediction mode may be indicated by hierarchical signaling of flag information. In this case, the prediction mode information may include one or more flags. The prediction mode information related to the inter-frame prediction mode is related to the reference signal. Figure 4 The detailed description is the same. In this article, the detailed description will be omitted.

[0340] The motion information deriver 1210 may derive motion information of the current block based on the determined inter prediction mode.

[0341] The motion information deriver 1210 may derive the optimal motion information of the current block by motion estimation. The motion information may include at least one of a motion vector (mv), a reference picture index (refIdx), and a prediction direction flag (predFlagL0, predFlagL1), as described above with reference to Figure 4 For example, the motion information deriver 1210 may derive motion information by searching for a similar reference block having high correlation in units of several pixels within a predetermined search range in the reference picture using the original block in the original picture for the current block.

[0342] The similarity of the blocks can be derived based on the difference of the sample values ​​based on the phase. For example, the similarity of the blocks can be calculated based on the SAD between the current block (or the template of the current block) and the reference block (or the template of the reference block). In this case, the motion information can be derived based on the reference block with the minimum SAD in the search area. The derived motion information can be signaled to the decoding device according to various methods based on the predefined inter-frame prediction mode.

[0343] The motion information deriver 1210 may search for a merge candidate block for deriving motion information of the current block to perform a merge mode. For example, up to five merge candidate blocks may be used, but the embodiments of the present specification are not limited thereto. In addition, the maximum number of merge candidate blocks may be sent in at least one of a video parameter set, a sequence parameter set, a picture parameter set, a picture header, a slice header, and a tile group header, but the embodiments of the present specification are not limited thereto.

[0344] After finding the merge candidate block, the motion information deriver 1210 can generate a merge candidate list consisting of multiple merge candidates based on the found merge candidate block, and can select the merge candidate with the minimum cost as the final merge candidate for deriving the motion information of the current block. The merge index specifying the selected final merge candidate can be encoded by the entropy encoder 240, and this can be notified to the decoding device with a signal.

[0345] The merge candidate list includes at least one of a spatial merge candidate, a temporal merge candidate, a history-based merge candidate, an average merge candidate, or a zero vector merge candidate. Figure 4 The descriptions are the same, so the detailed description will be omitted in this article.

[0346] The motion information deriver 1210 may derive the motion information of the selected merge candidate as the motion information of the current block. Alternatively, the motion vector of the selected merge candidate may be corrected by using a motion vector difference (MVD) having a specific length and direction, and the corrected motion vector may be derived as the motion vector of the current block.

[0347] To this end, the motion information deriver 1210 may additionally search for a reference block based on a predefined MVD length (MmvdDistance) as shown in Table 1 and a predefined MVD direction (MmvdSign) as shown in Table 2, and may select each of a length and a direction of the MVD corresponding to the optimal reference block. The motion information deriver 1210 may derive the MVD based on the selected MVD length and MVD direction.

[0348] In addition, the motion information deriver 1210 may derive mmvd_distance_idx and mmvd_direction_idx according to the length and direction of the selected MVD, which may be encoded in the entropy encoder 240, respectively. Figure 4 The detailed description is the same, and its detailed description will be omitted herein.

[0349] The weighted prediction information obtainer 1220 may obtain weighted prediction information of the L0 prediction block / L1 prediction block obtained in the motion information deriver 1210. Herein, the L0 / L1 prediction block may be obtained based on the motion information derived in the motion information deriver 1210. The weighted prediction may be any one of explicit weighted prediction and default weighted prediction.

[0350] The weighted prediction information obtainer 1220 may obtain the weighted prediction information based on a specific weighted prediction coefficient (ie, at least one of a weight or an offset). Figure 8 A method for deriving weights and offsets based on weighted prediction information is described. The weighted prediction information can be obtained based on the weighted prediction coefficients by the reverse process of the method. In this article, the weighted prediction coefficients can be determined based on the L0 prediction block / L1 prediction block of the current block, or the weighted prediction coefficients can be determined based on the L0 reference picture / L1 reference picture of the current block.

[0351] The weighted prediction information may include at least one of weight common information, weight quantity information, a flag indicating whether a weight exists, weight increment information, or offset information. The obtained weighted prediction information may be encoded by the entropy encoder 240, which is consistent with the reference Fig.11 The descriptions are the same, so redundant descriptions thereof will be omitted.

[0352] The embodiments described in this document may be implemented and executed on a processor, a microprocessor, a controller, or a chip. For example, the functional units shown in each figure may be implemented and executed on a computer, a processor, a microprocessor, a controller, or a chip. In this case, information (e.g., information about instructions) or algorithms for the embodiments may be stored in a digital storage medium.

[0353] In addition, the decoding device and the encoding device of the embodiment of the present specification can be included in a multimedia broadcast transceiver, a mobile communication terminal, a home theater video device, a digital theater video device, a surveillance camera, a video chat device, a real-time communication device such as video communication, a mobile streaming device, a storage medium, a portable camera, a video on demand (VoD) service provider, an over-the-top (OTT) video device, an Internet streaming service provider, a three-dimensional (3D) video device, a virtual reality (VR) device, an augmented reality (AR) device, a video phone video device, a transportation device terminal (e.g., a vehicle terminal, an aircraft terminal, a ship terminal, etc.) and a medical video device, and can be used to process a video signal or a data signal. For example, an over-the-top (OTT) video device may include a game console, a Blu-ray player, an Internet access TV, a home theater system, a smart phone, a tablet PC, a digital video recorder (DVR), etc.

[0354] In addition, the processing method of the embodiment of the present specification can be generated in the form of a program executed by a computer and can be stored in a computer-readable recording medium. The multimedia data with a data structure according to the embodiment of the present specification can also be stored in a computer-readable recording medium. The computer-readable recording medium includes all types of storage devices and distributed storage devices storing computer-readable data. The computer-readable recording medium may include, for example, a Blu-ray disc (BD), a universal serial bus (USB), a ROM, a PROM, an EPROM, an EEPROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device. In addition, the computer-readable recording medium includes a medium implemented in the form of a carrier wave (e.g., transmission via the Internet). In addition, the bit stream generated by the encoding method can be stored in a computer-readable recording medium or sent via a wired or wireless communication network.

[0355] In addition, the embodiments of the present specification may be implemented as a computer program product through program codes, and the program codes may be executed on a computer through the embodiments of the present specification. The program codes may be stored on a computer-readable carrier.

[0356] A content streaming system to which embodiments of this document are applied may mainly include an encoding server, a streaming server, a network server, a media storage section, a user device, and a multimedia input device.

[0357] The encoding server compresses content input from a multimedia input device such as a smartphone, a camera, a camcorder, etc. into digital data to generate a bitstream and transmits the bitstream to the streaming server. As another example, when a multimedia input device such as a smartphone, a camera, a camcorder, etc. directly generates a bitstream, the encoding server may be omitted.

[0358] A bitstream may be generated by an encoding method or a bitstream generating method to which an embodiment of the present specification is applied, and a streaming server may temporarily store the bitstream in the process of transmitting or receiving the bitstream.

[0359] The streaming server sends multimedia data to the user device through the network server based on the user request, and the network server is used as a medium to notify the user of the service. When the user requests the required service from the network server, the network server passes the request to the streaming server, and the streaming server sends the multimedia data to the user. In this case, the content streaming system may include a separate control server. In this case, the control server is used to control the command / response between the devices within the content streaming system.

[0360] The streaming server can receive content from the media storage unit and / or the encoding server. For example, when receiving content from the encoding server, the content can be received in real time. In this case, in order to provide a stable streaming service, the streaming server can store the bit stream for a predetermined time.

[0361] Examples of user devices may include mobile phones, smart phones, laptop computers, digital broadcast terminals, personal digital assistants (PDAs), portable multimedia players (PMPs), navigators, touch screen PCs, tablet PCs, ultrabooks, wearable devices (e.g., smart watches, smart glasses, and head-mounted displays), digital TVs, desktop computers, digital signage, etc.

[0362] Each server within the content streaming system may operate as a distributed server, in which case data received from each server may be distributed.

[0363] Industrial Applicability

[0364] The present disclosure may be used to encode / decode video signals.

Claims

1. A device, comprising: Memory; as well as at least one processor, the at least one processor connected to the memory, the at least one processor configured to: Determining an inter prediction mode for a current block; deriving motion information of the current block based on the determined inter-frame prediction mode; and Obtain a prediction block of the current block based on the derived motion information, The prediction block is obtained based on weighted prediction information for explicit weighted prediction of the current block, The weighted prediction information includes at least one of weight common information, weight quantity information, a first flag indicating whether a weight exists, weight increment information, or offset information. The weight quantity information includes L0 weight quantity information and L1 weight quantity information. wherein the L0 weight quantity information is adaptively signaled based on a second flag that specifies a location where the weighted prediction information can exist, wherein the L1 weight amount information is adaptively signaled based on the second flag and a third flag indicating whether the explicit weighted prediction is applied to a bi-predicted B slice, and In response to the second flag or the third flag being equal to 0, the L1 weight quantity information is not signaled, and the L1 weight quantity information is derived to be 0.

2. The device according to claim 1, wherein: The motion information of the current block is derived based on a merge candidate list, and The merge candidate list includes at least one of a spatial merge candidate, a temporal merge candidate, a history-based merge candidate or an average merge candidate.

3. The device according to claim 2, wherein: The at least one processor is further configured to modify a motion vector in the derived motion information based on a motion vector difference MVD, and The MVD is derived based on at least one of a length of the MVD, a direction of the MVD, or a picture order count (POC) difference between a reference picture of the current block and a current picture including the current block.

4. The device according to claim 1, wherein: The prediction block of the current block is obtained based on the following operations: Obtaining the weighted prediction information for the explicit weighted prediction of the current block; deriving at least one of a weight or an offset for the explicit weighted prediction of the current block based on the weighted prediction information; as well as Weighted prediction of the current block is performed based on at least one of the weight or the offset.

5. The device according to claim 1, wherein: The second flag being equal to 1 specifies that the weighted prediction information is not present in a slice header, and the second flag being equal to 0 specifies that the weighted prediction information is not present in a picture header, and Therein, the third flag equal to 1 specifies that the explicit weighted prediction is applied to the B slice and the third flag equal to 0 specifies that the explicit weighted prediction is not applied to the B slice.

6. The device according to claim 5, wherein: Based on the second flag and the third flag both being equal to 1, the L1 weight quantity information is signaled.

7. A device, comprising: Memory; as well as at least one processor, the at least one processor connected to the memory, the at least one processor configured to: Determining an inter prediction mode for a current block; deriving motion information of the current block based on the determined inter-frame prediction mode; and obtaining weighted prediction information for explicit weighted prediction of the current block, The weighted prediction information includes at least one of weight common information, weight quantity information, a first flag indicating whether a weight exists, weight increment information, or offset information. The weight quantity information includes L0 weight quantity information and L1 weight quantity information. wherein the L0 weight quantity information is adaptively encoded based on a second flag that specifies a location where the weighted prediction information can exist, wherein the L1 weight amount information is adaptively encoded based on the second flag and a third flag indicating whether the explicit weighted prediction is applied to the bi-predicted B slice, and Wherein, based on the second flag or the third flag being equal to 0, the L1 weight quantity information is not encoded, and the L1 weight quantity information is derived to be 0.

8. The device according to claim 7, wherein: The motion information of the current block is derived based on a merge candidate list, and The merge candidate list includes at least one of a spatial merge candidate, a temporal merge candidate, a history-based merge candidate or an average merge candidate.

9. The device according to claim 8, wherein: The at least one processor is further configured to modify a motion vector in the derived motion information based on a motion vector difference MVD, and The MVD is derived based on at least one of a length of the MVD, a direction of the MVD, or a picture order count (POC) difference between a reference picture of the current block and a current picture including the current block.

10. The device according to claim 7, wherein: The weighted prediction information for the explicit weighted prediction of the current block is obtained based on at least one of a weight or an offset for the explicit weighted prediction of the current block.

11. The device according to claim 7, wherein: The second flag being equal to 1 specifies that the weighted prediction information is not present in a slice header, and the second flag being equal to 0 specifies that the weighted prediction information is not present in a picture header, and Therein, the third flag equal to 1 specifies that the explicit weighted prediction is applied to the B slice and the third flag equal to 0 specifies that the explicit weighted prediction is not applied to the B slice.

12. The device according to claim 11, wherein Based on the second flag and the third flag both being equal to 1, the L1 weight amount information is encoded.

13. A device comprising: at least one processor, the at least one processor being configured to: Determining an inter prediction mode for a current block; Derivation of motion information of the current block based on the determined inter-frame prediction mode; Obtaining weighted prediction information for explicit weighted prediction of the current block; and encoding the weighted prediction information to generate a bitstream; and a transmitter configured to transmit data comprising the bit stream, The weighted prediction information includes at least one of weight common information, weight quantity information, a first flag indicating whether a weight exists, weight increment information, or offset information. The weight quantity information includes L0 weight quantity information and L1 weight quantity information. wherein the L0 weight quantity information is adaptively encoded based on a second flag that specifies a location where the weighted prediction information can exist, wherein the L1 weight amount information is adaptively encoded based on the second flag and a third flag indicating whether the explicit weighted prediction is applied to the bi-predicted B slice, and Wherein, based on the second flag or the third flag being equal to 0, the L1 weight quantity information is not encoded, and the L1 weight quantity information is derived to be 0.