BDOF-based inter-frame prediction method and device

By employing inter-frame prediction with BDOF and DMVR, the method addresses the high-cost challenge of high-resolution image/video transmission and storage, improving efficiency and reducing complexity in coding processes.

CN119110092APending Publication Date: 2024-12-10LG ELECTRONICS INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411316035.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2019-03-15
Filing Date
2020-02-11
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The increasing demand for high-resolution and high-quality images and videos, such as ultra-high-definition images and immersive media, leads to higher transmission and storage costs due to the increased amount of information, necessitating efficient image and video compression technologies.

Method used

Implementing inter-frame prediction methods using bidirectional optical flow (BDOF) and decoder-side motion vector modification (DMVR) with application conditions to improve coding efficiency, including deriving motion vectors and generating reconstructed samples based on specific luminance weight prediction flag conditions.

Benefits of technology

This approach enhances image/video compression efficiency, reduces computational complexity, and improves overall coding efficiency through optimized application of BDOF and DMVR.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119110092A_ABST
    Figure CN119110092A_ABST
Patent Text Reader

Abstract

The invention relates to an inter-frame prediction method and device based on BDOF. According to this document, an image decoding method includes: deriving an L0 motion vector and an L1 motion vector of a current block; deriving a prediction sample of the current block based on the L0 motion vector and the L1 motion vector; and generating a reconstructed sample of the current block based on the prediction sample, in which the step of deriving the prediction sample includes applying a bidirectional optical flow (BDOF) to the current block based on whether a condition for applying the BDOF to the current block is satisfied, the condition for applying the BDOF including a condition in which values of both L0 luminance weight prediction flag information and L1 luminance weight prediction flag information are zero, and generating a reconstructed sample of the current block based on the reconstructed sample. If the L0 luminance weight prediction flag information value is 0, there is no weight factor for the L0 prediction luminance component, and if the L1 luminance weight prediction flag information value is 0, there is no weight factor for the L1 prediction luminance component.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of a patent application with application number 202080026212.0 (PCT / KR2020 / 001859) filed on September 29, 2021, with an international filing date of February 11, 2020, and the invention name being “Inter-frame prediction method and device based on BDOF”. Technical Field

[0002] The present document relates to image coding technology, and more particularly, to a method and apparatus for performing inter-frame prediction based on bidirectional optical flow (BDOF). Background Art

[0003] Recently, there is an increasing demand for high-resolution and high-quality images and videos such as ultra-high-definition (HUD) images and 4K or 8K or larger videos in various fields. As image and video data become high-resolution and high-quality, the amount of information or the number of bits transmitted relative to existing image and video data increases. Therefore, if a medium such as an existing wired or wireless broadband line is used to transmit image data or an existing storage medium is used to store image and video data, the transmission cost and storage cost increase.

[0004] In addition, there has been an increasing interest and demand for immersive media such as virtual reality (VR), artificial reality (AR) content, or holograms recently. Broadcasting of images and videos such as game images whose image characteristics are different from those of real images is increasing.

[0005] Therefore, in order to effectively compress and transmit or store and play back information of high-resolution and high-quality images and videos having such various characteristics, efficient image and video compression technology is required. Summary of the invention

[0006] Technical issues

[0007] The present disclosure provides a method and apparatus for improving image coding efficiency.

[0008] The present disclosure also provides a method and apparatus for efficient inter-frame prediction.

[0009] The present disclosure also provides methods and apparatus for performing inter-frame prediction based on decoder-side motion vector modification (DMVR).

[0010] The present disclosure also provides a method and apparatus for performing inter-frame prediction based on bidirectional optical flow (BDOF).

[0011] The present disclosure also provides a method and apparatus for improving prediction performance by providing a condition for determining whether to apply DMVR to improve image coding efficiency and / or a condition for determining whether to apply BDOF.

[0012] Technical Solution

[0013] According to an exemplary embodiment of the present document, an image decoding method performed by a decoding device is provided. The method includes: deriving an L0 motion vector and an L1 motion vector of a current block; deriving a prediction sample of the current block based on the L0 motion vector and the L1 motion vector; and generating a reconstructed sample of the current block based on the prediction sample, wherein deriving the prediction sample includes: applying a bidirectional optical flow (BDOF) to the current block based on whether an application condition of the BDOF for the current block is satisfied, and the application condition of the BDOF includes a condition that both the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are equal to 0, wherein the case where the value of the L0 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for the luminance component of the L0 prediction, and the case where the value of the L1 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for the luminance component of the L1 prediction.

[0014] According to another exemplary embodiment of the present document, there is provided an image encoding method performed by an encoding device. The method includes: deriving an L0 motion vector and an L1 motion vector of a current block; deriving a prediction sample of the current block based on the L0 motion vector and the L1 motion vector; deriving a residual sample based on the prediction sample; and encoding image information including information about the residual sample, wherein deriving the prediction sample includes: applying a bidirectional optical flow (BDOF) to the current block based on whether an application condition of the BDOF for the current block is satisfied, and the application condition of the BDOF includes a condition that both the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are equal to 0, wherein the case where the value of the L0 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for the luminance component of the L0 prediction, and the case where the value of the L1 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for the luminance component of the L1 prediction.

[0015] Beneficial Effects

[0016] According to the present disclosure, the overall image / video compression efficiency can be improved.

[0017] According to the present disclosure, through efficient inter-frame prediction, the computational complexity can be reduced and the overall coding efficiency can be improved.

[0018] According to the present disclosure, various application conditions are proposed for applying DMVR and / or BDOF of modified motion information during the motion compensation process to improve efficiency in terms of complexity and performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 An example of a video / image coding system suitable for embodiments of the present document is schematically illustrated.

[0020] Figure 2 It is a diagram schematically illustrating the configuration of a video / image encoding device applicable to an embodiment of the present document.

[0021] Figure 3 It is a diagram schematically illustrating the configuration of a video / image decoding device applicable to an embodiment of the present document.

[0022] Figure 4 is a diagram illustrating an embodiment of a process for performing decoder-side motion vector modification (DMVR) in true bi-prediction.

[0023] Figure 5 is a diagram illustrating an embodiment of a process for performing decoder-side motion vector modification (DMVR) using the sum of absolute differences (SAD).

[0024] Figure 6 An example representing a method for performing a decoding process by checking application conditions of DMVR and BDOF is illustrated.

[0025] Figure 7 and Figure 8 Another example representing a method for performing a decoding process by checking application conditions of DMVR and BDOF is illustrated.

[0026] Fig. 9 This is a diagram shown to explain the concept of BDOF.

[0027] Fig.10 is a flowchart schematically illustrating an encoding method that can be performed by an encoding device according to an embodiment of the present document.

[0028] Fig.11 is a flowchart schematically illustrating a decoding method that can be performed by a decoding device according to an embodiment of the present document.

[0029] Fig.12 An example of a content streaming system to which the embodiments disclosed in this document are applicable is illustrated. DETAILED DESCRIPTION

[0030] The present disclosure can be modified in various ways and can have various embodiments, and specific embodiments will be illustrated in the drawings and described in detail. However, this is not intended to limit the present disclosure to specific embodiments. The terms commonly used in this specification are used to describe specific embodiments rather than to limit the technical spirit of the present disclosure. Unless otherwise clearly indicated in the context, singular expressions include plural expressions. Terms such as "including" or "having" in this specification should be understood to indicate the presence of characteristics, numbers, steps, operations, elements, parts, or combinations thereof described in this specification, without excluding the possibility of the presence or addition of one or more other characteristics, numbers, steps, operations, elements, parts, or combinations thereof.

[0031] In addition, for the convenience of description related to different feature functions, the elements in the drawings described in the present disclosure are illustrated independently. This does not mean that each element is implemented as separate hardware or separate software. For example, at least two elements can be combined to form a single element, or a single element can be divided into multiple elements. Embodiments in which elements are combined and / or separated are also included in the scope of the present disclosure, unless it deviates from the essence of the present disclosure.

[0032] Hereinafter, preferred embodiments of the present disclosure are described in more detail with reference to the accompanying drawings. Hereinafter, in the accompanying drawings, the same reference numerals are used for the same elements, and redundant descriptions of the same elements may be omitted.

[0033] The present disclosure relates to video / image coding. For example, the methods / implementations disclosed in the present disclosure may be applied to methods disclosed in the Versatile Video Coding (VVC), EVC (Basic Video Coding) standard, 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 or H.268, etc.).

[0034] The present disclosure proposes various embodiments of video / image coding, and unless otherwise mentioned, these embodiments may be performed in combination with each other.

[0035] In the present disclosure, a video may refer to a series of images over time. A picture generally refers to a unit representing an image in a specific time region, and a slice / tile is a unit that constitutes a portion of a picture when compiled. A slice / tile may include one or more coding tree units (CTUs). A picture may consist of one or more slices / tiles. A picture may consist of one or more tile groups. A tile group may include one or more tiles. A brick may represent a rectangular area of ​​a CTU row within a tile in a picture. A tile may be divided into a plurality of tiles, each tile consisting of one or more CTU rows within a tile. Tiles that are not divided into a plurality of tiles may also be referred to as tiles. Tile scanning is a specific ordering of CTUs of the following segmented pictures: CTUs may be continuously sorted in tiles by CTU raster scanning, tiles within tiles may be continuously sorted by raster scanning of tiles of tiles, and tiles in a picture may be continuously sorted by raster scanning of tiles of a picture. A tile is a rectangular area of ​​a CTU within a specific tile column and a specific tile row in a picture. A tile column is a rectangular area whose height of the CTU is equal to the height of the picture and whose width is specified by a syntax element in the picture parameter set. A tile row is a rectangular area whose height of the CTU is specified by a syntax element in the picture parameter set and whose width is equal to the width of the picture. Block scanning is a specific order sorting of CTUs of a partitioned picture as follows: CTUs are sorted continuously by a CTU raster scan in a tile, and tiles in a picture are sorted continuously by a raster scan of tiles of a picture. A slice includes an integer number of tiles of a picture that can be exclusively contained in a single NAL unit. A slice may consist of multiple complete tiles or only of a continuous sequence of complete tiles of a tile. In the present disclosure, tile groups and slices may be used interchangeably. For example, in the present disclosure, a tile group / tile group header may be referred to as a slice / slice header.

[0036] A pixel or picture element (pel) may mean the smallest unit constituting a picture (or image). In addition, "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. Alternatively, a sample may mean a pixel value in a spatial domain, and when a pixel value is transformed into a frequency domain, a sample may mean a transform coefficient in a frequency domain.

[0037] 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 related to the area. A unit may include a luminance block and two chrominance (e.g., cb, cr) blocks. In some cases, a unit may be used interchangeably with terms such as a block or an area. In general, an M×N block may include a set (or array) of samples (sample arrays) or transform coefficients of M columns and N rows.

[0038] In the present disclosure, the terms " / " and "," should be interpreted as indicating "and / or". For example, the expression "A / B" may mean "A and / or B". In addition, "A, B" may mean "A and / or B". In addition, "A / B / C" may mean "at least one of A, B, and / or C". In addition, "A, B, C" may mean "at least one of A, B, and / or C".

[0039] In addition, in the present disclosure, the term "or" should be interpreted as indicating "and / or". For example, the expression "A or B" may include 1) only A, 2) only B, and / or 3) both A and B. In other words, the term "or" in the present disclosure should be interpreted as indicating "additionally or alternatively".

[0040] Figure 1 An example of a video / image coding system that may be applicable to an embodiment of the present disclosure is schematically illustrated.

[0041] Reference Figure 1 The video / image coding system may include a first device (source device) and a second device (receiving device). The source device may transmit the encoded 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.

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

[0043] The video source can obtain the video / image by capturing, synthesizing or generating the video / image process. The video source may include a video / image capturing device and / or a video / image generating device. The video / image capturing device may include, for example, one or more cameras, a video / image archive including previously captured videos / images, etc. The video / image generating device may include, for example, 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 capturing process may be replaced by the process of generating the relevant data.

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

[0045] The transmitter may transmit the encoded video / image information or data output in the form of a bit stream to a receiver of a 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 / extracted bit stream to a decoding device.

[0046] The decoding device can decode the video / image by performing a series of processes such as dequantization, inverse transformation, prediction, etc. corresponding to the operation of the encoding device.

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

[0048] Figure 2 Schematically describes the configuration of a video / image encoding device applicable to an embodiment of the present disclosure. Hereinafter, the so-called video encoding device may include an image encoding device.

[0049] Reference Figure 2, the encoding device 200 may include an image segmenter 210, a predictor 220, a residual processor 230, 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 referred to as 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 described above may be composed of one or more hardware components (e.g., an encoder chipset or processor). In addition, the memory 270 may include a decoded picture buffer (DPB) and may be composed of a digital storage medium. The hardware component may also include the memory 270 as an internal / external component.

[0050] The image divider 210 divides the input image (or picture or frame) input to the encoding device 200 into one or more processing units. As an example, the processing unit may be referred to as a coding unit (CU). In this case, starting from a coding tree unit (CTU) or a maximum coding unit (LCU), the coding unit may be recursively divided according to a quadtree binary tree ternary tree (QTBTTT) structure. For example, a coding unit may be divided into a plurality of coding units with a deeper depth based on a quadtree structure, a binary tree structure, and / or a ternary tree structure. In this case, for example, a quadtree structure may be applied first, and then a binary tree structure and / or a ternary tree structure may be applied. Alternatively, a binary tree structure may be applied first. The coding process according to the present disclosure may be performed based on a final coding unit that is not further divided. In this case, based on the coding efficiency according to image characteristics, the maximum coding unit may be directly used as the final coding unit. Alternatively, the coding unit may be recursively divided into coding units with a further deeper depth as needed, so that a coding unit of the best size may be used as the final coding unit. Here, the coding process may include processes such as prediction, transformation, and reconstruction, which will be described later. As another example, the processing unit may also include a prediction unit (PU) or a transformation unit (TU). In this case, the prediction unit and the transformation unit may be divided or partitioned from the above-mentioned final coding unit. The prediction unit may be a unit for sample prediction, and the transformation unit may be a unit for deriving a transformation coefficient and / or a unit for deriving a residual signal based on the transformation coefficient.

[0051] In some cases, the unit and terms such as block, region, etc. may be used interchangeably. 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 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. A sample may be used as a term corresponding to a pixel or a picture element of a picture (or image).

[0052] In the encoding device 200, a prediction signal (prediction block, prediction sample array) output from the inter predictor 221 or the intra predictor 222 is subtracted from the input image signal (original block, original sample array) to generate a residual signal (residual block, residual sample array), and the generated residual signal is sent to the transformer 232. In this case, as shown, the unit that subtracts the prediction signal (prediction block, prediction sample array) from the input image signal (original block, original sample array) in the encoder 200 may be referred to as a subtractor 231. The predictor may perform prediction on a processing target block (hereinafter, referred to as a "current block"), and may generate a prediction block including prediction samples for the current block. The predictor may determine whether intra prediction or inter prediction is applied on a current block or CU basis. As discussed later in the description of each prediction mode, the predictor may generate various information related to prediction such as prediction mode information, and send the generated information to the entropy encoder 240. Information about prediction may be encoded in the entropy encoder 240 and output in the form of a bitstream.

[0053] The intra-frame predictor 222 can predict the current block by referring to the samples in the current picture. Depending on the prediction mode, the reference sample can be located near the current block or separated from the current block. In intra-frame prediction, the prediction mode may include a variety of non-directional modes and a variety of directional modes. The non-directional mode may include, for example, a DC mode and a plane mode. Depending on the level of detail of the prediction direction, the directional mode may include, for example, 33 directional prediction modes or 65 directional prediction modes. However, this is only an example, and more or fewer directional prediction modes may be used depending on the setting. The intra-frame predictor 222 may determine the prediction mode applied to the current block by using the prediction mode applied to the neighboring blocks.

[0054] The inter-frame predictor 221 may derive a prediction block for the current block based on a reference block (reference sample array) specified by a motion vector on a reference picture. At this time, in order to reduce the amount of motion information sent in the inter-frame prediction mode, the motion information may be predicted based on a block, a sub-block, or a sample based on the correlation of the motion information between the neighboring block 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, dual prediction, etc.) information. In the case of inter-frame prediction, the neighboring blocks may include spatial neighboring blocks existing in the current picture and temporal neighboring blocks existing in the reference picture. The reference picture including the reference block and the reference picture including the temporal neighboring block may be the same as or different from each other. The temporal neighboring block may be referred to as a collocated reference block, a collocated 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 can use the motion information of the neighboring block as the motion information of the current block. In the skip mode, unlike the merge mode, the residual signal cannot be sent. In the case of motion information prediction (motion vector prediction, MVP) mode, the motion vector of the neighboring block can be used as a motion vector prediction item, and the motion vector of the current block can be indicated by signaling the motion vector difference.

[0055] The predictor 220 may generate a prediction signal based on various prediction methods. For example, the predictor may apply intra prediction or inter prediction to the prediction of a block, and may also apply intra prediction and inter prediction at the same time. This may be referred to as combined inter and intra prediction (CIIP). In addition, the predictor may be based on an intra block copy (IBC) prediction mode or a palette mode to perform prediction on a block. The IBC prediction mode or the palette mode may be used for content image / video coding of games such as screen content coding (SCC). Although IBC basically performs prediction in the current picture, its execution is similar to inter prediction in that it derives a reference block in the current picture. That is, IBC may use at least one of the inter prediction techniques described in the present disclosure. The palette mode may be considered as an example of intra coding or intra prediction. When the palette mode is applied, the sample values ​​in the picture may be signaled based on information about the palette index and the palette table.

[0056] The prediction signal generated by the predictor (including the inter-frame predictor 221 and / or the intra-frame predictor 222) can be used to generate a reconstruction signal or to generate a residual signal. The transformer 232 can generate a transform coefficient 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, GBT means a transform obtained from a curve graph when the relationship information between pixels is represented by a curve graph. CNT refers to a transform obtained based on a prediction signal generated using all previously reconstructed pixels. In addition, the transform process can be applied to square pixel blocks of the same size, or can be applied to blocks of variable size rather than square blocks.

[0057] 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 the encoded signal in the bitstream. The information about the quantized transform coefficients may be referred to as residual information. The quantizer 233 may rearrange the quantized transform coefficients of the block type 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. The entropy encoder 240 may perform various encoding methods such as, for example, 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 other than the quantized transform coefficients (e.g., the values ​​of syntax elements, etc.) together or separately. The encoded information (e.g., the encoded video / image information) may be transmitted or stored on a unit basis 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 adaptation parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), a video parameter set (VPS), etc. In addition, the video / image information may also include conventional constraint information. In the present disclosure, information and / or syntax elements sent from the encoding device to / signaled to the decoding device may be included in the video / image information. The video / image information may be encoded by the above-mentioned encoding process and included in the bitstream. The bitstream may be transmitted over a network or stored in a digital storage medium. Here, the network may include a broadcast network, a communication network, and / or the like, and the digital storage medium may include various storage media such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, etc. A transmitter (not shown) that transmits a signal output from the entropy encoder 240 or a memory (not shown) that stores it may be configured as an internal / external element of the encoding device 200, or the transmitter may be included in the entropy encoder 240.

[0058] The quantized transform coefficients output from the quantizer 233 can be used to generate a prediction signal. For example, by applying dequantization and inverse transformation to the quantized transform coefficients using the dequantizer 234 and the inverse transformer 235, a residual signal (residual block or residual sample) can be reconstructed. The adder 155 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. When there is no residual for the processing target block as in the case of applying the skip mode, the prediction block can be used as a reconstructed block. The adder 250 can be referred to as a reconstructor or a reconstructed block generator. The generated reconstructed signal can be used for intra-frame prediction of the next processing target block in the current picture, and as described later, can be used for inter-frame prediction of the next picture performed by filtering.

[0059] Furthermore, during the picture encoding and / or reconstruction process, luminance mapping and chrominance scaling (LMCS) may be applied.

[0060] The filter 260 can improve the subjective / objective video quality by applying filtering to the reconstructed signal. For example, the filter 260 can generate a modified reconstructed picture by applying various filtering methods to the reconstructed picture, and the modified reconstructed picture can be stored in the memory 270, especially in the DPB of the memory 270. Various filtering methods may include, for example, deblocking filtering, sample adaptive offset, adaptive loop filter, bilateral filter, etc. As discussed later in the description of each filtering method, the filter 260 can generate various information related to filtering and send the generated information to the entropy encoder 240. Information about filtering can be encoded in the entropy encoder 240 and output in the form of a bitstream.

[0061] The modified reconstructed picture transmitted to the memory 270 may be used as a reference picture in the inter-frame predictor 221. Accordingly, the encoding apparatus can avoid prediction mismatch in the encoding apparatus 100 and the decoding apparatus when applying inter-frame prediction, and can also improve encoding efficiency.

[0062] The memory 270 DPB may store the modified reconstructed picture so as to use it as a reference picture in the inter-frame predictor 221. The memory 270 may store the motion information of the blocks in the current picture from which the motion information has been derived (or encoded) and / or the motion information of the blocks in the reconstructed picture. The stored motion information may be sent to the inter-frame predictor 221 to be used as the motion information of the spatial neighboring blocks or the motion information of the temporal neighboring blocks. The memory 270 may store the reconstructed samples of the reconstructed blocks in the current picture and send them to the intra-frame predictor 222.

[0063] Figure 3is a diagram schematically describing a configuration of a video / image decoding device to which the present disclosure can be applied.

[0064] Reference Figure 3 , the video decoding device 300 may include 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 331 and an intra-frame predictor 332. The residual processor 320 may include a dequantizer 321 and an inverse transformer 322. According to an embodiment, the entropy decoder 310, the residual processor 320, the predictor 330, the adder 340, and the filter 350 described above may be composed of 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 composed of a digital storage medium. The hardware component may also include the memory 360 as an internal / external component.

[0065] When a bit stream including video / image information is input, the decoding device 300 can be used in conjunction with the bit stream already in the Figure 2 The image is reconstructed correspondingly 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 information related to the block segmentation obtained from the bit stream. The decoding device 300 can perform decoding by using the processing unit applied in the encoding device. Therefore, the decoding processing unit can be, for example, a coding unit, which can be divided into a quadtree structure, a binary tree structure and / or a ternary tree structure using a coding tree unit or a maximum coding unit. One or more transform units can be derived from the coding unit. And, the reconstructed image signal decoded and output by the decoding device 300 can be reproduced by a reproducer.

[0066] The decoding device 300 may receive the Figure 2The received signal can be decoded by the entropy decoder 310. For example, the entropy decoder 310 can parse the bitstream to derive information (e.g., video / image information) required for image reconstruction (or picture reconstruction). The video / image information may also include information about various parameter sets such as adaptive parameter set (APS), picture parameter set (PPS), sequence parameter set (SPS), video parameter set (VPS), etc. In addition, the video / image information may also include conventional constraint information. The decoding device may further decode the picture based on the information about the parameter set and / or the conventional constraint information. In the present disclosure, the signaled / received information and / or syntax elements to be described later may be decoded and obtained from the bitstream through a decoding process. For example, the entropy decoder 310 may decode the information in the bitstream based on a coding method such as exponential Golomb coding, CAVLC, CABAC, etc., and may output the values ​​of syntax elements required for image reconstruction and the quantized values ​​of the transform coefficients of the residual. More specifically, the CABAC entropy decoding method may receive a bin corresponding to each syntax element in the bitstream, use the decoded information of the decoding target syntax element information and the decoded information of the neighboring and decoding target blocks or the information of the symbol / bin decoded in the previous step to determine the context model, predict the bin generation probability according to the determined context model, and perform arithmetic decoding on the bin to generate a symbol corresponding to each syntax element value. Here, the CABAC entropy decoding method may update the context model using the information of the symbol / bin decoded by the context model for the next symbol / bin after determining the context model. Information about prediction among the information decoded in the entropy decoder 310 may be provided to the predictor (inter-frame predictor 332 and intra-frame predictor 331), and the residual value (ie, quantized transform coefficient) and the associated parameter information for which entropy decoding has been performed in the entropy decoder 310 may be input to the residual processor 320. The residual processor 320 may derive a residual signal (residual block, residual sample, residual sample array). In addition, information about filtering among the information decoded in the entropy decoder 310 may be provided to the filter 350. In addition, a receiver (not shown) receiving a signal output from the encoding device may also constitute the decoding device 300 as an internal / external element, and the receiver may be a component of the entropy decoder 310. In addition, the decoding device according to the present disclosure may be referred to as a video / image / picture encoding device, and the decoding device may be divided into an information decoder (video / image / picture information decoder) and a sample decoder (video / image / picture sample decoder). The information decoder may include the entropy decoder 310, and the sample decoder may include at least one of the dequantizer 321, the inverse transformer 322, the adder 340, the filter 350, the memory 360, the inter-frame predictor 332, and the intra-frame predictor 331.

[0067] The dequantizer 321 may output the transform coefficient by dequantizing the quantized transform coefficient. The dequantizer 321 may rearrange the quantized transform coefficient into a two-dimensional block form. In this case, the rearrangement may be performed based on the order of coefficient scanning that has been performed in the encoding device. The dequantizer 321 may perform dequantization on the quantized transform coefficient using a quantization parameter (e.g., quantization step size information) and obtain the transform coefficient.

[0068] The inverse transformer 322 obtains a residual signal (residual block, residual sample array) by performing inverse transformation on the transformation coefficients.

[0069] The predictor may perform prediction on the current block and generate a prediction block including prediction samples for 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 may specifically determine an intra / inter prediction mode.

[0070] The predictor 320 may generate a prediction signal based on various prediction methods. For example, the predictor may apply intra prediction or inter prediction to the prediction of a block, and may also apply intra prediction and inter prediction at the same time. This may be referred to as combined inter and intra prediction (CIIP). In addition, the predictor may be based on an intra block copy (IBC) prediction mode or a palette mode to perform prediction on a block. The IBC prediction mode or the palette mode may be used for content image / video coding of games such as screen content coding (SCC). Although IBC basically performs prediction in the current picture, its execution is similar to inter prediction in that it derives a reference block in the current picture. That is, IBC may use at least one of the inter prediction techniques described in the present disclosure. The palette mode may be considered as an example of intra coding or intra prediction. When the palette mode is applied, information about the palette table and the palette index may be included in the video / image information and signaled.

[0071] The intra-frame predictor 331 can predict the current block by referring to samples in the current picture. Depending on the prediction mode, the reference sample can be located near the current block or separated 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 determine the prediction mode applied to the current block by using the prediction mode applied to the neighboring block.

[0072] The inter-frame predictor 332 can derive a prediction block for the current block based on a reference block (reference sample array) specified by a motion vector on a 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 based on a block, a sub-block, or a sample based on the correlation of the motion information between the neighboring block 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, dual prediction, etc.) information. In the case of inter-frame prediction, the neighboring blocks may include spatial neighboring blocks existing in the current picture and temporal neighboring blocks existing in the reference picture. For example, the inter-frame predictor 332 may configure a motion information candidate list based on neighboring blocks, and derive a motion vector and / or a reference picture index of the current block based on the received candidate selection information. Inter-frame prediction may be performed based on various prediction modes, and information about the prediction may include information indicating a mode of inter-frame prediction for the current block.

[0073] The adder 340 can generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array) by adding the obtained residual signal to the prediction signal (prediction block, prediction sample array) output from the predictor (inter-frame predictor 332 and / or intra-frame predictor 331). If there is no residual for the block to be processed, such as when the skip mode is applied, the prediction block can be used as the reconstructed block.

[0074] 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, may be output through filtering as described below, or may be used for inter-frame prediction of the next picture.

[0075] In addition, luma mapping and chroma scaling (LMCS) can be applied to the picture decoding process.

[0076] The filter 350 can improve the subjective / objective image quality by applying filtering to the reconstructed signal. For example, the filter 350 can generate a modified reconstructed picture by applying various filtering methods to the reconstructed picture, and store the modified reconstructed picture in the memory 360, especially in 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.

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

[0078] In the present disclosure, the implementations described in the filter 260, the inter-frame predictor 221, and the intra-frame predictor 222 of the encoding device 200 may be applied to the filter 350, the inter-frame predictor 332, and the intra-frame predictor 331 of the decoding device 300 or accordingly to correspond to the filter 350, the inter-frame predictor 332, and the intra-frame predictor 331 of the decoding device 300.

[0079] As described above, in performing video coding, prediction is performed to improve compression efficiency. Through prediction, a prediction block including prediction samples for a current block as a target coding block can be generated. In this case, the prediction block includes prediction samples in the spatial domain (or pixel domain). The prediction block can be derived identically in the encoding device and the decoding device. The encoding device can improve image coding efficiency by signaling the information (residual information) of the residual between the original block rather than the original sample value of the original block itself and the prediction block to the decoding device. The decoding device can derive a residual block including residual samples based on the residual information, can generate a reconstructed block including reconstructed samples by adding the residual block to the prediction block, and can generate a reconstructed picture including the reconstructed block.

[0080] The residual information may be generated by a transformation and quantization process. For example, the encoding device may derive a residual block between the original block and the prediction block, may derive a transform coefficient by performing a transformation process on the residual samples (residual sample array) included in the residual block, may derive a quantized transform coefficient by performing a quantization process on the transform coefficient, and may signal the relevant residual information to the decoding device (through a bitstream). In this case, the residual information may include information such as value information, position information, transformation scheme, transform kernel, and quantization parameter of the quantized transform coefficient. The decoding device may perform a dequantization / inverse transformation process based on the residual information, and may derive a residual sample (or residual block). The decoding device may generate a reconstructed block based on the prediction block and the residual block. In addition, the encoding device may derive a residual block by dequantizing / inverse transforming the quantized transform coefficient so as to serve as a reference for inter-frame prediction of the next picture, and may generate a reconstructed picture.

[0081] In addition, as described above, when prediction is performed on the current block, intra prediction or inter prediction may be applied. Hereinafter, a case where inter prediction is applied to the current block will be described.

[0082] The predictor (more specifically, the inter-frame predictor) of the encoding / decoding device can derive prediction samples by performing inter-frame prediction in units of blocks. Inter-frame prediction may refer to predictions derived in a method that depends on data elements (e.g., sample values ​​or motion information) of pictures other than the current picture. When inter-frame prediction is applied to the current block, a prediction block (prediction sample array) for the current block may be derived based on a reference block (reference sample array) specified by a motion vector on a reference picture indicated by a reference picture index. In this case, in order to reduce the amount of motion information sent in the inter-frame prediction mode, the motion information of the current block may be predicted in units of blocks, sub-blocks, or samples based on the correlation of motion information between 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 type (L0 prediction, L1 prediction, dual prediction, etc.) information. In the case of applying inter-frame prediction, the neighboring blocks may include spatial neighboring blocks existing in the current picture and temporal neighboring blocks existing in the reference picture. The reference picture including the reference block and the reference picture including the temporal neighboring block may be the same as or different from each other. The temporally neighboring blocks may be referred to as names such as collocated reference blocks, collocated CUs (colCU), etc., and the reference pictures including the temporally neighboring blocks may be referred to as collocated pictures (colPic). For example, a motion information candidate list may be configured based on the neighboring blocks of the current block, and in order to derive the motion vector and / or reference picture index of the current block, a flag or index information indicating which candidate is selected (used) may be signaled. Inter-frame prediction may be performed based on various prediction modes, and for example, in skip mode and merge mode, the motion information of the current block may be the same as the motion information of the selected neighboring block. In the case of skip mode, a residual signal may not be sent as in merge mode. In the case of motion vector prediction (MVP) mode, the motion vector of the selected neighboring block may be used as a motion vector predictor, and the motion vector difference may be signaled. In this case, the motion vector of the current block may be derived using the sum of the motion vector predictor and the motion vector difference.

[0083] According to the inter-frame prediction type (L0 prediction, L1 prediction, dual prediction, etc.), the motion information may also include L0 motion information and / or L1 motion information. The L0 direction motion vector may be referred to as the L0 motion vector or MVL0, and the L1 direction motion vector may be referred to as the L1 motion vector or MVL1. Prediction based on the L0 motion vector may be referred to as the L0 prediction, prediction based on the L1 motion vector may be referred to as the L1 prediction, and prediction based on both the L0 motion vector and the L1 motion vector may be referred to as dual prediction. Here, the L0 motion vector may indicate a motion vector associated with the reference picture list L0, and the L1 motion vector may indicate a motion vector associated with the reference picture list L1. The reference picture list L0 may include pictures before the current picture in output order, and the reference picture list L1 may include pictures after the current picture in output order as reference pictures. The previous picture may be referred to as the preceding (reference) picture, and the subsequent picture may be referred to as the inverted (reference) picture. The reference picture list L0 may also include pictures after the current picture in output order as reference pictures. In this case, the previous picture may be indexed first in the reference picture list L0, and then the subsequent picture may be indexed. The reference picture list L1 may also include a picture preceding the current picture in the output order as a reference picture. In this case, the subsequent picture may be indexed first in the reference picture list L1, and then the previous picture may be indexed. Here, the output order may correspond to a picture order count (POC) order.

[0084] In addition, when inter-frame prediction is applied to the current block, various inter-frame prediction modes can be used. For example, various modes including merge mode, skip mode, motion vector prediction (MVP) mode, affine mode, historical motion vector prediction (HMVP) mode, etc. can be used. Decoder-side motion vector correction (DMVR) mode, adaptive motion vector resolution (AMVR) mode, bidirectional optical flow (BDOF), etc. can also be used as auxiliary modes. Affine mode can be called affine motion prediction mode. MVP mode can be called advanced motion vector prediction (AMVP) mode. In the present disclosure, some modes and / or motion information candidates derived from some modes can be included in one of the motion information related candidates of other modes.

[0085] Prediction mode information indicating the inter-frame prediction mode of the current block may be signaled from the encoding device to the decoding device. In this case, the prediction mode information may be included in the bitstream and received by 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. For example, whether the skip mode is applied may be indicated by signaling a jump flag, whether the merge mode is applied may be indicated by signaling a merge flag when the skip mode is not applied, and indicating the application of the MVP mode or a flag for additional distinction may also be signaled when the merge mode is not applied. The affine mode may be signaled as an independent mode or as a subordinate mode with respect to the merge mode or the MVP mode. For example, the affine mode may include an affine merge mode and an affine MVP mode.

[0086] In addition, the motion information of the current block can be used when applying inter-frame prediction to the current block. The encoding device can derive the best motion information of the current block through a motion estimation process. For example, the encoding device can search for a similar reference block with high correlation in units of fractional pixels within a predetermined search range in the reference picture by using the original block in the original picture of the current block, and derive motion information through the searched reference block. The similarity of the block can be derived based on the difference between the sample values ​​based on the phase. For example, the similarity of the block can be calculated based on the sum of absolute differences (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 inter-frame prediction mode.

[0087] The prediction block of the current block may be derived based on motion information derived according to the inter prediction mode. The prediction block may include prediction samples (prediction sample arrays) of the current block. When the motion vector (MV) of the current block indicates a fractional sample unit, an interpolation process may be performed, and the prediction samples of the current block may be derived based on reference samples of fractional sample units in the reference picture through the interpolation process. When affine inter prediction is applied to the current block, the prediction samples may be generated based on the sample / sub-block unit MV. When dual prediction is applied, the prediction samples derived by the weighted sum or weighted average of the prediction samples derived based on L0 prediction (i.e., prediction using reference pictures in reference picture list L0 and MVL0) and the prediction samples derived based on L1 prediction (i.e., prediction using reference pictures in reference picture list L1 and MVL1) (according to the phase) may be used as the prediction samples of the current block. When dual prediction is applied, if the reference picture for L0 prediction and the reference picture for L1 prediction are located in different time directions based on the current picture (i.e., if the prediction is dual prediction and corresponds to bidirectional prediction), this may be referred to as true dual prediction.

[0088] Reconstructed samples and reconstructed pictures may be generated based on the derived prediction samples, after which processes such as in-loop filtering may be performed as described above.

[0089] In addition, since the motion of the current block is predicted based on the motion vector of the neighboring block without motion vector difference (MVD) in the skip mode and / or merge mode, the skip mode and / or merge mode show the limitation of motion prediction. In order to improve the limitation of the skip mode and / or merge mode, the motion vector may be corrected by applying a decoder-side motion vector correction (DMVR) mode, a bidirectional optical flow (BDOF) mode, etc. The DMVR mode and the BDOF mode may be used when true dual prediction is applied to the current block.

[0090] Figure 4 is a diagram describing an embodiment of a process for performing decoder-side motion vector modification (DMVR) in true pairwise prediction.

[0091] DMVR is a method in which the decoder performs motion prediction by modifying the motion information of neighboring blocks. When DMVR is applied, the decoder can derive the modified motion information through cost comparison based on a template generated by using the motion information of neighboring blocks in merge / skip mode. In this case, the accuracy of motion prediction can be improved, and compression performance can be improved without additional signaling information.

[0092] In this document, for convenience of description, a decoding device is mainly described, but even in an encoding device, DMVR according to an embodiment of this document can be performed in the same method.

[0093] Reference Figure 4 , the decoding device may derive a prediction block (ie, a reference block) identified by the initial motion vectors (or motion information) in the list 0 and list 1 directions (eg, MV0 and MV1), and generate a template (or bilateral template) by a weighted sum (eg, averaging) of the derived prediction samples. Here, the initial motion vectors (MV0 and MV1) may represent motion vectors derived by using motion information of neighboring blocks in merge / skip mode.

[0094] In addition, the decoding device can derive a motion vector (e.g., MV0' and MV1') for minimizing the difference between the template and the sample area of ​​the reference picture through a template matching operation (step 2). Here, the sample area may indicate a neighboring area of ​​the initial prediction block in the reference picture, and the sample area may be referred to as a neighboring area, a reference area, a search area, a search range, a search space, etc. The template matching operation may include an operation of calculating a cost measurement value between the template and the sample area of ​​the reference picture. For example, the sum of absolute differences (SAD) may be used for cost measurement. As an example, a normalized SAD may be used as a cost function. In this case, the matching cost may be given as SAD(T-mean(T), 2×P[x]-2×mean(P[x])). Here, T represents the template and P[x] represents a block in the search area. In addition, the motion vector used to calculate the minimum template cost for each of the two reference pictures may be considered to be an updated motion vector (replacing the initial motion vector). As Figure 8 As illustrated in , the decoding device may generate a final bilateral prediction result (ie, a final bilateral prediction block) by using the updated motion vectors MV0' and MV1'. As an embodiment, multiple iterations for deriving updated (or new) motion vectors may be used to obtain the final bilateral prediction result.

[0095] In an embodiment, the decoding device may call the DMVR process to improve the accuracy of the initial motion compensation prediction (i.e., the motion compensation prediction performed by the conventional merge / skip mode). For example, when the prediction mode of the current block is the merge mode or the skip mode, the decoding device may perform the DMVR process and apply the bilateral dual prediction in which the bilateral reference pictures are located in the opposite direction based on the current picture in the display order to the current block.

[0096] Figure 5 is a diagram illustrating an embodiment of a process of performing decoder side motion vector modification (DMVR) by using the sum of absolute differences (SAD).

[0097] As described above, the decoding device can measure the matching cost by using SAD in performing DMVR. Figure 5In this paper, a method for correcting motion vectors by calculating the mean sum of absolute differences (MRSAD) between prediction samples in two reference pictures without generating a template will be described. In other words, Figure 5 The method shows an embodiment of bilateral matching using MRSAD.

[0098] refer to Figure 5 , the decoding device may derive neighboring pixels of a pixel (sample) indicated by an L0 direction motion vector MV0 on a list 0 (L0) reference picture, and derive neighboring pixels of a pixel (sample) indicated by an L1 direction motion vector MV1 on a list 1 (L1) reference picture. In addition, the decoding device may measure the matching cost by calculating the MRSAD between an L0 prediction block (i.e., an L0 reference block) identified by a motion vector indicating neighboring pixels derived on the L0 reference picture and an L1 prediction block (i.e., an L1 reference block) identified by a motion vector indicating neighboring pixels derived on the L1 reference picture. In this case, the decoding device may select a search point with a minimum cost (i.e., a search area with a minimum SAD between the L0 prediction block and the L1 prediction block) as a modified motion vector pair. In other words, the modified motion vector pair may include a modified L0 motion vector indicating a pixel position (L0 prediction block) with a minimum cost in the L0 reference picture and a modified L1 motion vector indicating a pixel position (L1 prediction block) with a minimum cost in the L1 reference picture.

[0099] As the present embodiment, when calculating the matching cost, after setting the search area of ​​the reference picture, unilateral prediction can be performed by using a conventional 8-tap DCTIF interpolation filter. In addition, as an example, 16-bit precision can be used for the calculation of MRSAD and by considering the internal buffer, before calculating MRSAD, clipping and / or rounding operations may not be applied.

[0100] When true dual prediction is applied to the current block as described above, BDOF may be used in order to correct the dual prediction signal. When dual prediction is applied to the current block, bidirectional optical flow (BDOF) may be used to calculate improved motion information and generate prediction samples based on the calculated motion information. For example, BDOF may be applied at the level of a 4×4 sub-block. In other words, BDOF may be performed in units of 4×4 sub-blocks in the current block. Alternatively, BDOF may be applied only to the luminance component. Alternatively, BDOF may be applied only to the chrominance component, and may be applied to both the luminance component and the chrominance component.

[0101] The BDOF mode is based on the concept of optical flow assuming smooth object motion as indicated by the name of the BDOF mode. The motion correction (vx, vy) can be calculated by minimizing the difference between the L0 prediction sample and the L1 prediction sample of each 4×4 sub-block. In addition, the motion correction can be used to adjust the dual prediction sample values ​​in the 4×4 sub-block.

[0102] Meanwhile, it can be seen that DMVR and BDOF, which are techniques for performing prediction by correcting motion information when applying true double prediction (in this case, true double prediction means a case where motion prediction / compensation is performed in reference pictures in other directions based on a picture of a current block), are correction techniques with a similar concept as assuming that an object in a picture moves in a predetermined direction at a predetermined speed. However, when performing true double prediction, since the conditions for applying DMVR and the conditions for applying BDOF are different from each other, a process of repeatedly checking the conditions for various techniques should be performed multiple times. Therefore, the present document proposes a method that can improve efficiency in terms of decoder complexity and performance by improving the process of checking the conditions when determining a prediction mode applied to the current block.

[0103] Table 1 below shows the conditions for applying DMVR during conventional true dual prediction. DMVR can be applied when all the conditions listed below are met.

[0104] [Table 1]

[0105]

[0106] Referring to Table 1, 1) whether DMVR is applied may be determined based on flag information (e.g., sps_dmvr_enabled_flag) signaled in a sequence parameter set (SPS) syntax. Here, the flag information (e.g., sps_dmvr_enabled_flag) may indicate whether DMVR based on real double prediction is enabled. For example, when sps_dmvr_enabled_flag is 1 (i.e., when DMVR based on real double prediction is enabled), it may be determined that a condition for enabling DMVR is satisfied.

[0107] 2) Whether DMVR is applied may be determined based on flag information (eg, merge_flag) indicating whether inter-frame prediction is performed by using merge mode / skip mode. For example, when merge_flag is 1 (ie, when inter-frame prediction is performed by using merge mode / skip mode), it may be determined that the condition for applying merge mode / skip mode is satisfied.

[0108] 3) Whether DMVR is applied may be determined based on flag information (eg, mmvd_flag) indicating whether inter prediction is performed by using a merge mode with motion vector difference (MMVD) mode together. For example, when mmvd_flag is 0 (ie, when the MMVD mode is not used), it may be determined that the condition for applying the MMVD mode is satisfied.

[0109] 4) Whether to apply DMVR may be determined based on whether bilateral prediction (dual prediction) is used. Here, bilateral prediction may refer to inter-frame prediction performed based on reference pictures existing in different directions based on the current picture. For example, when predFlagL0[0][0]=1 and predFlagL0[1][1]=1, it may be determined that bilateral prediction is applied, and it may be determined whether the conditions for performing bilateral prediction are met.

[0110] 5) Whether to apply DMVR may be determined based on whether true dual prediction is performed and whether the distances between the current picture and the bilateral reference picture are the same as each other. In other words, it may be determined whether the distance between the current picture and the L0 reference picture (i.e., the reference picture in the reference picture list L0) and the distance between the current picture and the L1 reference picture (i.e., the reference picture in the reference picture list L1) are the same as each other. For example, when DiffPicOrderCnt(currPic, RefPicList0[refIdxL0]) - DiffPicOrderCnt(currPic, RefPicList1 [refIdxL1]) = 0, it is determined that true dual prediction is performed and the distances between the current picture and the bilateral reference picture are the same as each other, to determine whether the condition of whether the distances of the bilateral reference pictures are the same as each other is satisfied.

[0111] 6) Whether to apply DMVR can be determined based on whether the height of the current block is greater than a threshold. For example, when the height of the current block is equal to or greater than 8, it can be determined that the current block size (height) condition is met.

[0112] 7) Whether to apply DMVR may be determined based on whether the size of the current block is greater than a threshold. For example, when the size of the current block height×width is equal to or greater than 64, it may be determined that the current block size (height×width) condition is satisfied.

[0113] The decoding device may determine whether to apply DMVR according to whether conditions 1) to 7) of the above Table 1 are satisfied. In other words, when conditions 1) to 7) of the above Table 1 are satisfied, the decoding device may perform true dual prediction by applying DMVR, and when even any one of the conditions of the above Table 1 is not satisfied, the decoding device does not apply DMVR.

[0114] Table 2 below shows the conditions for applying BDOF during conventional true dual prediction. BDOF can be applied when all the conditions listed below are met.

[0115] [Table 2]

[0116]

[0117] Referring to Table 2 above, 1) may determine whether BDOF is applied based on flag information (e.g., sps_bdof_enabled_flag) signaled in a sequence parameter set (SPS) syntax. Here, the flag information (e.g., sps_dmvr_enabled_flag) may indicate whether BDOF based on true double prediction is enabled. For example, when sps_bdof_enabled_flag is 1 (i.e., when BDOF based on true double prediction is enabled), it may be determined that the condition for enabling BDOF is satisfied.

[0118] 2) Whether to apply BDOF can be determined based on whether bilateral prediction is used. Here, bilateral prediction can mean inter-frame prediction performed based on reference pictures existing in different directions based on the current picture. For example, when both predFlagL0 and predFlagL1 are 1, it can be determined that bilateral prediction is applied, and it can be determined whether the conditions for performing bilateral prediction are met.

[0119] 3) Determine whether to apply BDOF based on whether true double prediction is performed. In other words, it can be determined whether the L0 reference picture (i.e., the reference picture in the reference picture list L0) and the L1 reference picture (i.e., the reference picture in the reference picture list L1) are located in different directions in time based on the current picture. For example, when DiffPicOrderCnt(currPic, refPicList0[refIdxL0]) × DiffPicOrderCnt(currPic, refPicList1[refIdxL1]) is less than 0, it is determined that the bilateral reference pictures are located in different directions based on the current picture to determine whether the condition for performing true double prediction is satisfied.

[0120] 4) Whether BDOF is applied can be determined based on whether the affine mode is used. Here, whether the affine mode is used can be determined by deriving MotionModelIdc. For example, when the derived MotionModelIdc is 0, it can be determined that the affine mode is not used, and in this case, it can be determined that the condition for whether the affine mode is applied is satisfied.

[0121] 5) Whether to apply BDOF may be determined based on flag information (eg, merge_subblock_flag) indicating whether inter prediction is performed in units of subblocks. For example, when merge_subblock_flag is 0 (ie, when the merge mode is not applied in units of subblocks), it may be determined that the condition for applying the merge mode in units of subblocks is satisfied.

[0122] 6) Whether BDOF is applied can be determined based on whether GBi exists. Here, whether GBi exists can be determined based on GBi index information (eg, GbiIdx). For example, when GbiIdx is 0 (ie, when GbiIdx is the default), it can be determined that the condition of whether GBi exists is satisfied.

[0123] 7) Whether to apply BDOF may be determined based on whether the current block is a luma block including a luma component. For example, when the index (eg, cIdx) indicating whether the current block is a luma block is 0 (ie, when the current block is a luma block), it may be determined that the condition of whether the current block is a luma block is satisfied.

[0124] The decoding device may determine whether to apply DMVR according to whether conditions 1) to 7) of Table 2 above are met. In other words, when conditions 1) to 7) of Table 2 above are met, the decoding device may perform true double prediction by applying BDOF, and when even any one of the conditions of Table 2 above is not met, the decoding device does not apply BDOF.

[0125] Here, GBi may represent a general dual prediction, in which different weights may be applied to L0 prediction and L1 prediction, and may be represented by using, for example, GbiIdx. GbiIdx may exist in the case of dual prediction and represent a dual prediction weight index. In the present document, motion information may further include GbiIdx. For example, in the case of merge mode, GbiIdx may be derived from a neighboring block or in the case of MVP mode, the decoding device may be signaled from the encoding device through a GbiIdx syntax element (e.g., gbi_idx). As an example, GbiIdx may indicate a weight w applied to L1 prediction, in which case a weight of (1–w) may be applied to L0 prediction. As another example, GbiIdx may indicate a weight w applied to L0 prediction, and in this case a weight (1-w) may be applied to L1 prediction. The weight indicated by GbiIdx may be configured differently and may be configured, for example, as shown in Tables 3 and 4 below.

[0126] [Table 3]

[0127]

[0128] [Table 4]

[0129]

[0130] Referring to Tables 3 and 4 above, the weight of w1 may represent the weight applied to L1 prediction and the GbiIdx value may indicate the weight w1 applied to L1 prediction. For example, according to the embodiment of Table 3, when the value of GbiIdx represents 0, a 1 / 2 weight may be applied to L1 prediction, and a 1 / 2 weight of (1-w1) may be applied to L0 prediction. According to an embodiment, the weight of w1 may represent the weight applied to L0 prediction, and in this case, the GbiIdx value may indicate the weight w1 applied to L0 prediction.

[0131] As described above, some of the application conditions of DMVR and BDOF are the same, while some are similar or different. In conventional schemes, since condition checks are performed for various techniques even when the conditions are the same, the complexity of performing dual prediction increases. Therefore, this document proposes efficient conditions for applying DMVR and BDOF during dual prediction.

[0132] When the merge / skip mode is compared with the AMVP mode, the accuracy of the merge / skip mode is relatively lower than that of the AMVP mode, and as a result, it is effective in terms of performance to correct motion information by using the DMVR method. However, unlike DMVR, in addition to the merge / skip mode, the BDOF mode can be applied even in the AMVP mode, so when BDOF is applied in the AMVP mode, the complexity of performing BDOF increases compared to performance. Therefore, the embodiment proposes a method of applying BDOF even in the merge / skip mode similarly to DMVR.

[0133] In this case, as an embodiment proposed in this document, the application conditions of BDOF may include the conditions presented in Table 5 below.

[0134] [Table 5]

[0135]

[0136] Referring to Table 5 above, whether BDOF is applied can be determined based on flag information (e.g., merge_flag) indicating whether inter-frame prediction is performed by using merge mode / skip mode. For example, when merge_flag is 1 (i.e., when inter-frame prediction is performed by using merge mode / skip mode), it can be determined that the condition for applying merge mode / skip mode is satisfied. Therefore, similar to DMVR, BDOF can also be applied in merge / skip mode.

[0137] In other words, in this embodiment, in combination with the conditions applied in the case of merge / skip mode, whether to apply BDOF can be determined based on the conditions applied when BDOF is enabled, the conditions applied in the case of bilateral prediction, the conditions applied when true double prediction is performed, the conditions applied when affine prediction is used, the conditions applied when sub-block based merge mode is not applied, the conditions applied when the GBi index is default, and the conditions applied when the current block is a luminance block.

[0138] Therefore, the decoding device may determine whether all the conditions listed in Table 5 above are met, and when all the conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any one of the conditions listed in Table 5 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 5 above, and the encoding device may perform true double prediction by a corresponding method performed in the decoding device.

[0139] The method of performing true dual prediction based on the conditions listed in the above Table 5 may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0140] In addition, when the conditions listed in this embodiment are the same as those described in Table 1 and Table 2 above, the detailed operation or meaning is similarly applied, and as a result, the detailed description of each condition will be omitted. In addition, even the repeated contents in the following embodiments will be omitted.

[0141] The encoding / decoding apparatus may be configured by various hardware, and the preference for the ratio of complexity to performance may be different. Therefore, the embodiment proposes a method that can correct motion information by applying DMVR even in AMVP mode in addition to the merge / skip mode.

[0142] In this case, as an embodiment proposed in this document, the application conditions of DMVR may include the conditions presented in Table 6 below.

[0143] [Table 6]

[0144]

[0145] Referring to Table 6 above, the process of determining whether to apply DMVR can be omitted based on flag information (e.g., merge_flag) indicating whether inter-frame prediction is performed by using merge mode / skip mode. In this way, by omitting the condition of whether to apply merge mode / skip mode, DMVR can be applied even in AMVP mode in addition to merge mode / skip mode.

[0146] According to Table 6 above, whether to apply DMVR can be determined based on the conditions applied when DMVR is enabled, the conditions applied when the MMVD mode is not used, the conditions applied in the case of bilateral prediction, the conditions applied in the case of true dual prediction in which the distances between the current picture and the bilateral reference picture are the same as each other, the conditions applied when the height of the current block is equal to or greater than 8, and the conditions applied when the size (height×width) of the current block is equal to or greater than 64.

[0147] In other words, the decoding device may determine whether all conditions listed in Table 6 above are met, and when all conditions are met, the decoding device may perform true dual prediction by applying DMVR. When even any condition listed in Table 6 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 6 above, and the encoding device may perform true dual prediction by a corresponding method in the decoding device.

[0148] The method of performing true dual prediction based on the conditions listed in the above Table 6 may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0149] In addition, as an embodiment of the present document, both DMVR and BDOF can be applied to the normal merge mode. In other words, DMVR and BDOF can be applied when the advanced temporal motion vector prediction (ATMVP) mode is not used, the affine mode is not used, and the CPR is not used. In this case, the application conditions of DMVR may include the conditions presented in Table 7 below.

[0150] [Table 7]

[0151]

[0152] Referring to Table 7 above, it is determined whether the conditions applied when the affine mode is not used (eg, when MotionModelIdc is 0) and the conditions applied when the sub-block based merge mode is not used (eg, when merge_subblock_flag is 0) are satisfied to apply DMVR only in the normal merge mode.

[0153] In addition, in this embodiment, in combination with the condition of whether to use the affine mode and the condition of whether to use the sub-block based merge mode, it can be determined whether to apply DMVR based on the condition applied when DMVR is enabled, the condition applied when the merge mode / skip mode is used, the condition applied when the MMVD mode is not used, the condition applied in the case of bilateral prediction, the condition applied in the case of true dual prediction in which the distances between the current picture and the bilateral reference picture are the same as each other, the condition applied when the height of the current block is equal to or greater than 8, and the condition applied when the size of the current block (height×width) is equal to or greater than 64.

[0154] In other words, the decoding device may determine whether all the conditions listed in Table 7 above are met, and when all the conditions are met, the decoding device may perform true dual prediction by applying DMVR. When even any one of the conditions listed in Table 7 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 7 above, and the encoding device may perform true dual prediction by a corresponding method in the decoding device.

[0155] The condition (e.g., merge_subblock_flag) of whether to apply the sub-block-based merge mode among the application conditions of Table 7 above includes a repeated condition among the conventional DMVR application conditions. Therefore, as an embodiment of the present document, the condition repeated with the condition (e.g., merge_subblock_flag) of whether to apply the sub-block-based merge mode may be removed. In this case, the corresponding condition may be removed as proposed in Table 8 below.

[0156] [Table 8]

[0157]

[0158] Referring to Table 8 above, when the size of the current block is equal to or greater than 8×8, the sub-block-based merge mode may be applied. Therefore, since the condition (e.g., merge_subblock_flag=0) of whether to apply the sub-block-based merge mode includes a condition related to the size of the current block, the condition (e.g., CbHeight and CbHeight*CbWidth) related to the size of the current block among the application conditions of the conventional DMVR may be excluded. For example, the condition of whether the height of the current block is equal to or greater than 8 and the condition of whether the height*width of the current block is equal to or greater than 64 may be omitted, and whether to apply DMVR may be determined by using the remaining conditions listed in Table 8 above.

[0159] In other words, the decoding device may determine whether all the conditions listed in Table 8 above are met, and when all the conditions are met, the decoding device may perform true dual prediction by applying DMVR. When even any one of the conditions listed in Table 8 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 8 above, and the encoding device may perform true dual prediction by a corresponding method in the decoding device.

[0160] The method of performing true dual prediction based on the conditions listed in the above Table 7 or Table 8 may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0161] As an embodiment of the present document, in order to improve the accuracy of the motion vector with low complexity, when the size of the block is small, correction techniques such as DMVR and BDOF may not be applied. In a conventional scheme, the correction technique may be applied when the current block is a block equal to or larger than 8×8, and in the case of the DMVR correction technique, when the size of the current block is large, the correction is applied by dividing the current block into 16×16 units, and as a result, DMVR may not be applied to blocks smaller than 16×16. In this case, the application conditions of DMVR may include the conditions presented in Table 9 below.

[0162] [Table 9]

[0163]

[0164] Referring to Table 9 above, by changing the condition (e.g., CbHeight and CbWidth) associated with the size of the current block, DMVR may not be applied to a block smaller than 16×16. For example, a condition applied when the height (e.g., CbHeight) of the current block is equal to or greater than 16 and a condition applied when the width (e.g., CbWidth) of the current block is equal to or greater than 16 may be used. When the application condition associated with the size of the current block is satisfied (i.e., when the size of the current block is equal to or greater than 16×16), DMVR may be applied, and when the application condition associated with the size of the current block is not satisfied (i.e., when the size of the current block is less than 16×16), DMVR may not be applied.

[0165] In addition, in this embodiment, in combination with the conditions related to the size of the current block (eg, CbHeight and CbWidth), whether to apply DMVR may be determined based on the remaining application conditions listed in Table 9 above.

[0166] In other words, the decoding device may determine whether all the conditions listed in Table 9 above are met, and when all the conditions are met, the decoding device may perform true dual prediction by applying DMVR. When even any one of the conditions listed in Table 9 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 9 above, and the encoding device may perform true dual prediction by a corresponding method in the decoding device.

[0167] As an embodiment of the present document, when the current block is a block smaller than 16×16, in addition to DMVR, BDOF may not be applied. In this case, the application conditions of BDOF may include the conditions presented in Table 10 below.

[0168] [Table 10]

[0169]

[0170] Referring to Table 10 above, by changing the condition related to the size of the current block (e.g., CbHeight and CbWidth), BDOF may not be applied to a block smaller than 16×16. For example, a condition applied when the height of the current block (e.g., CbHeight) is equal to or greater than 16 and a condition applied when the width of the current block (e.g., CbWidth) is equal to or greater than 16 may be used. When the application condition related to the size of the current block is satisfied (i.e., when the size of the current block is equal to or greater than 16×16), BDOF may be applied, and when the application condition related to the size of the current block is not satisfied (i.e., when the size of the current block is less than 16×16), BDOF may not be applied.

[0171] In addition, in this embodiment, in combination with the conditions related to the size of the current block (eg, CbHeight and CbWidth), whether to apply BDOF may be determined based on the remaining application conditions listed in Table 10 above.

[0172] In other words, the decoding device may determine whether all conditions listed in Table 10 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any one of the conditions listed in Table 10 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 10 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0173] The method of performing true dual prediction based on the conditions listed in the above Table 9 or Table 10 may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0174] As described above, when the distances between the current picture and the bilateral reference picture are the same, DMVR is applied, and even if the distances between the current picture and the bilateral reference picture are different from each other, BDOF is continuously applied in the case of true dual prediction. Therefore, the present document proposes a method in which conditions related to the bilateral reference picture distance can be integrally applied to DMVR and BDOF in order to improve coding efficiency.

[0175] As an embodiment proposed in this document, the application conditions of BDOF may include the conditions presented in Table 11 below.

[0176] [Table 11]

[0177]

[0178] Referring to Table 11 above, the conditions related to the reference picture distance among the application conditions of BDOF (e.g., DiffPicOrderCnt) are changed to similarly apply the corresponding conditions to DMVR and BDOF. For example, it is determined whether DiffPicOrderCnt(currPic, RefPicList0[refIdxL0]) - DiffPicOrderCnt(currPic, RefPicList1[refIdxL1]) is 0 to determine whether the distance between the current picture and the L0 reference picture (i.e., the reference picture in reference picture list L0) and the distance between the current picture and the L1 reference picture (i.e., the reference picture in reference picture list L1) are the same as each other. In other words, BDOF can only be applied when the distances between the current picture and the bilateral reference pictures are the same as each other. In this way, with the addition of the conditions that true dual prediction is performed and the bilateral reference picture distances are the same as each other, the scope of BDOF application is limited, thereby saving decoding complexity.

[0179] In addition, in this embodiment, in combination with the condition related to the reference picture distance (eg, DiffPicOrderCnt), whether to apply BDOF may be determined based on the remaining application conditions listed in Table 11 above.

[0180] In other words, the decoding device may determine whether all conditions listed in Table 11 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any one of the conditions listed in Table 11 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 11 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0181] As an embodiment proposed in this document, the application conditions of DMVR may include the conditions presented in Table 12 below.

[0182] [Table 12]

[0183]

[0184] Referring to Table 12 above, the condition related to the reference picture distance among the application conditions of DMVR (e.g., DiffPicOrderCnt) is changed to similarly apply the corresponding condition to DMVR and BDOF. For example, it is determined whether DiffPicOrderCnt(currPic, RefPicList0[refIdxL0]) * DiffPicOrderCnt(currPic, RefPicList1[refIdxL1]) is less than 0 to determine whether to perform true double prediction in which bilateral reference pictures are located in different directions based on the current picture. In other words, DMVR is continuously applied in the case of true double prediction even if the distances between the current picture and the bilateral reference pictures are different from each other. In this way, as the condition of whether to perform true double prediction is applied, the motion vector derived by considering the decoding complexity can be used without scaling even when the bilateral reference picture distances are different.

[0185] In addition, in this embodiment, in combination with the conditions related to the reference picture distance (eg, DiffPicOrderCnt), whether to apply DMVR may be determined based on the remaining application conditions listed in Table 12 above.

[0186] In other words, the decoding device may determine whether all the conditions listed in Table 12 above are met, and when all the conditions are met, the decoding device may perform true dual prediction by applying DMVR. When even any one of the conditions listed in Table 12 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 12 above, and the encoding device may perform true dual prediction by a corresponding method in the decoding device.

[0187] The method of performing true dual prediction based on the conditions listed in the above Table 11 or Table 12 may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0188] Meanwhile, in each reference block, it may happen that motion compensation is performed by weighted sum by the change of light. In this case, since the phenomenon can be determined by GBi or local illumination compensation (LIC), the application conditions of DMVR and BDOF can be determined by considering GBi or LIC conditions.

[0189] As an embodiment of this document, a method of determining whether to apply DMVR by considering GBi and LIC conditions is proposed. In this case, the application conditions of DMVR may include the conditions presented in Table 13 below.

[0190] [Table 13]

[0191]

[0192] Referring to Table 13 above, whether DMVR is applied can be determined by adding GBi conditions (e.g., GbiIdx) and LIC conditions (e.g., LICFlag). For example, when GbiIdx is 0 (i.e., when GbiIdx is the default value), it is determined that the condition of whether GBi exists is satisfied, and when LICFlag is 0 (i.e., when LIC exists), it can be determined that the condition of whether LIC exists is satisfied.

[0193] Furthermore, in this embodiment, in combination with the GBi condition (eg, GbiIdx) and the LIC condition (eg, LICFlag), whether to apply DMVR may be determined based on the remaining application conditions listed in Table 13 above.

[0194] In other words, the decoding device may determine whether all the conditions listed in Table 13 above are met, and when all the conditions are met, the decoding device may perform true dual prediction by applying DMVR. When even any one of the conditions listed in Table 13 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 13 above, and the encoding device may perform true dual prediction by a corresponding method in the decoding device.

[0195] As an embodiment of this document, a method for determining whether to apply BDOF by considering GBi and LIC conditions is proposed. In this case, the application conditions of BDOF may include the conditions presented in Table 14 below.

[0196] [Table 14]

[0197]

[0198] According to the above Table 14, whether BDOF is applied can be determined by adding a LIC condition (e.g., LICFlag) together with a conventional GBi condition (e.g., GbiIdx). For example, when GbiIdx is 0 (i.e., when GbiIdx is the default value), it is determined whether the condition of GBi is satisfied, and when LICFlag is 0 (i.e., when LIC is present), it can be determined whether the condition of LIC is satisfied.

[0199] Therefore, in this embodiment, in combination with the GBi condition (eg, GbiIdx) and the LIC condition (eg, LICFlag), it may be determined whether to apply BDOF based on the remaining application conditions listed in Table 14 above.

[0200] In other words, the decoding device may determine whether all conditions listed in Table 14 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any one of the conditions listed in Table 14 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 14 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0201] The method of performing true dual prediction based on the conditions listed in Table 13 or Table 14 above may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0202] In addition, since DMVR and BDOF derive motion information through a correction process in a decoding device, a decoding complexity problem arises. Therefore, this document proposes a method that can reduce decoding complexity by allowing whether to apply DMVR and BDOF to be determined by using a merge index. In this case, since both DMVR and BDOF perform correction of motion vectors within a limited range, the effect of the correction is reduced when the motion vector is inaccurate. Therefore, this document proposes a method that can restrictively apply DMVR and BDOF only when the value indicating the merge index is small by considering the efficiency of the correction.

[0203] Here, the merge index may be a syntax element signaled from the encoding device to the decoding device. For example, the encoding / decoding device may configure a merge candidate list based on neighboring blocks of the current block when applying a merge mode / skip mode to the current block. In this case, the encoding device may select the best merge candidate among the merge candidates included in the merge candidate list based on the rate-distortion (RD) cost, and signal the merge index information indicating the selected merge candidate to the decoding device. The decoding device may select a merge candidate to be applied to the current block based on the merge candidate list and the merge index information.

[0204] As an embodiment of the present document, a method of determining whether to apply DMVR by using a merge index may include the conditions presented in Table 15 below.

[0205] [Table 15]

[0206]

[0207] Referring to Table 15 above, whether to apply DMVR can be determined by adding a merge index condition (e.g., merge_idx). For example, when the merge index (e.g., merge_idx) is less than 2, it can be determined that the merge index condition is satisfied. Here, the value (threshold) of the merge index can be set to 2, but this is just an example, and the corresponding value can be changed according to the coding efficiency.

[0208] Therefore, in this embodiment, in combination with the merge index condition (eg, merge_idx), whether to apply DMVR may be determined based on the remaining application conditions listed in Table 15 above.

[0209] In other words, the decoding device may determine whether all the conditions listed in Table 15 above are met, and when all the conditions are met, the decoding device may perform true double prediction by applying DMVR. When even any one of the conditions listed in Table 15 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 15 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0210] As an embodiment of the present document, a method of determining whether to apply BDOF by using a merge index may include the conditions presented in Table 16 below.

[0211] [Table 16]

[0212]

[0213] Referring to Table 16 above, whether to apply BDOF can be determined by adding a condition (e.g., merge_flag) of whether to apply merge mode / skip mode and a merge index condition (e.g., merge_idx). For example, when merge_flag is 1 (i.e., when inter-frame prediction is performed by using merge mode / skip mode) and merge_idex is not equal to or greater than 2, it can be determined that the condition for restrictively applying BDOF is met only when the value of the merge index is small. In other words, when merge_flag is 1 (i.e., when inter-frame prediction is performed by using merge mode / skip mode) and merge_idex is less than 2, it can be determined that the merge index condition is met and BDOF can be applied only when the value of the merge index is small. Here, the value (threshold) of the merge index can be set to 2, but this is merely an example and the corresponding value can be changed according to the coding efficiency.

[0214] In other words, in this embodiment, in combination with the condition of whether to apply merge mode / skip mode (eg, merge_flag) and the merge index condition (eg, merge_idx), whether to apply BDOF can be determined based on the remaining application conditions listed in Table 16 above.

[0215] In other words, the decoding device may determine whether all conditions listed in Table 16 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any one of the conditions listed in Table 16 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 16 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0216] The method of performing true dual prediction based on the conditions listed in Table 15 or Table 16 above may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0217] In addition, in merge / skip mode, motion information may be corrected by MMVD, and in this case, DMVR is not performed when MMVD is applied due to increased decoding complexity. However, when DMVR is applied without considering MMVD, DMVR may be applied without MMVD conditions by considering performance enhancement. In this case, according to an embodiment of the present document, the application conditions of DMVR may include the conditions presented in Table 17 below.

[0218] [Table 17]

[0219]

[0220] Referring to Table 17 above, the condition (e.g., mmvd_flag) of whether to apply the MMVD mode among the application conditions of the conventional DMVR can be excluded. In other words, the process of determining whether mmvd_flag is 0 (i.e., whether the MMVD mode is not used) can be omitted, and whether to apply DMVR can be determined based on the conditions listed in Table 17 above.

[0221] In other words, the decoding device may determine whether all conditions listed in Table 17 above are satisfied (excluding the condition of whether the MMVD mode is applied (eg, mmvd_flag)), and when all conditions are satisfied, the decoding device may perform true double prediction by applying DMVR. When even any one of the conditions listed in Table 17 above is not satisfied, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 17 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0222] In addition, contrary to the embodiment of Table 17 above, when motion information is corrected by MMVD in merge / skip mode, whether to perform BDOF can be determined by considering decoding complexity. Therefore, this document proposes a method for determining whether to apply BDOF by considering MMVD conditions. In this case, according to an embodiment of this document, the application conditions of BDOF may include the conditions presented in Table 18 below.

[0223] [Table 18]

[0224]

[0225] Referring to Table 18 above, when the motion information is corrected by MMVD by adding a condition (eg, mmvd_flag) of whether the MMVD mode is applied, BDOF may not be applied. For example, when mmvd_flag is 0 (ie, when the MMVD mode is not used), it may be determined that the condition of whether the MMVD mode is applied is satisfied.

[0226] Therefore, in this embodiment, in combination with the condition of whether to apply the MMVD mode (eg, mmvd_flag), whether to apply BDOF may be determined based on the remaining application conditions listed in Table 18 above.

[0227] In other words, the decoding device may determine whether all conditions listed in Table 18 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any one of the conditions listed in Table 18 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 18 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0228] The method of performing true dual prediction based on the conditions listed in the above Table 17 or Table 18 may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0229] In addition, in the case of AMVP, an adaptive motion vector resolution (AMVR) technique may be applied. In this case, when the resolution of the motion vector is high, that is, when integer pixel rounding or 4 integer pixel rounding is provided, it may not be appropriate to apply the technique in the case of performing modified BDOF in a limited area. Therefore, this document proposes a method for determining the execution of BDOF according to the AMVR condition. In this case, according to an embodiment of this document, the application conditions of BDOF may include the conditions presented in Table 19 below.

[0230] [Table 19]

[0231]

[0232] Referring to Table 19 above, whether BDOF is applied can be determined by adding an AMVR condition (e.g., amvr_flag). Here, amvr_flag can be information indicating the resolution of the motion vector difference (MVD). For example, when amvr_flag is 0, the situation may indicate that the resolution of the MVD is derived in units of 1 / 4 samples (quarter brightness samples), and when amvr_flag is not 0, the situation may indicate that the resolution of the MVD is derived in units of integer brightness samples or four brightness samples. Alternatively, the opposite situation may be determined. According to an embodiment, as presented in Table 19 above, when amvr_flag is not 0, the condition for applying BDOF may be set. In other words, when amvr_flag is 0, it may be restricted to not applying BDOF.

[0233] Therefore, in this embodiment, in combination with the AMVR condition (eg, amvr_flag), it may be determined whether to apply BDOF based on the remaining application conditions listed in Table 19 above.

[0234] In other words, the decoding device may determine whether all conditions listed in Table 19 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any one of the conditions listed in Table 19 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 19 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0235] In addition, DMVR and BDOF may be signaled separately in a sequence parameter set (SPS) syntax. The following Table 20 shows an example of a syntax element indicating whether DMVR signaled through the SPS syntax is enabled and whether BDOF is enabled.

[0236] [Table 20]

[0237]

[0238] Referring to Table 20 above, sps_dmvr_enabled_flag may be signaled in the SPS syntax, and whether DMVR based on real double prediction is enabled may be indicated based on the syntax element. For example, when sps_dmvr_enabled_flag is 1, this may indicate that DMVR based on real double prediction is enabled, and when sps_dmvr_enabled_flag is 0, this may indicate that DMVR based on real double prediction is not enabled.

[0239] In addition, sps_bdof_enabled_flag may be signaled in the SPS syntax, and whether BDOF based on real double prediction is enabled may be indicated based on the syntax element. For example, when sps_bdof_enabled_flag is 1, this may indicate that BDOF based on real double prediction is enabled, and when sps_bdof_enabled_flag is 0, this may indicate that BDOF based on real double prediction is not enabled.

[0240] As shown in Table 20, the application conditions of DMVR and BDOF may be checked by using a syntax element indicating whether DMVR is enabled (eg, sps_dmvr_enabled_flag) and a syntax element indicating whether BDOF is enabled (eg, sps_bdof_enabled_flag).

[0241] Figure 6 An example of a method for performing a decoding process by checking application conditions of DMVR and BDOF is illustrated.

[0242] As shown in Table 20, when a syntax element indicating whether DMVR is enabled (eg, sps_dmvr_enabled_flag) and a syntax element indicating whether BDOF is enabled (eg, sps_bdof_enabled_flag) are used, Figure 6 method.

[0243] Reference Figure 6 , the decoding apparatus may derive motion information (eg, a motion vector, a reference picture index, etc.) for the current block ( S600 ).

[0244] The decoding apparatus may check the application of DMVR (S610). In this case, the application condition of DMVR may be checked based on a syntax element (e.g., sps_dmvr_enabled_flag) indicating whether DMVR is enabled. For example, when DMVR is enabled (e.g., when sps_dmvr_enabled_flag is 1), the application condition of DMVR may be checked.

[0245] The decoding apparatus may determine whether to apply the DMVR process according to whether the application condition of the DMVR is satisfied ( S620 ).

[0246] When all application conditions of DMVR are satisfied, the decoding apparatus may derive the modified motion information by applying the DMVR process (S630). When at least one of the application conditions of DMVR is not satisfied, the decoding apparatus may not apply the DMVR process.

[0247] The decoding apparatus may derive a prediction sample of the current block based on the (uncorrected) motion information derived when DMVR is not applied or the corrected motion information derived when DMVR is applied ( S640 ).

[0248] In addition, the decoding apparatus may check the application condition of BDOF (S650). In this case, the application condition of BDOF DMVR may be checked based on a syntax element (e.g., sps_bdof_enabled_flag) indicating whether BDOF is enabled. For example, when DMVR is enabled (e.g., when sps_bdof_enabled_flag is 1), the application condition of DMVR may be checked.

[0249] When all application conditions of BDOF are met, the decoding apparatus may correct the prediction sample by applying the BDOF process (S670). When at least one of the application conditions of BDOF is not met, the decoding apparatus may not apply the BDOF process.

[0250] The decoding apparatus may derive residual samples of the current block ( S680 ), and derive reconstructed samples based on the residual samples and the corrected prediction samples derived when BDOF is applied and the (uncorrected) prediction samples derived when BDOF is not applied ( S690 ).

[0251] This document proposes various embodiments that can improve coding efficiency and reduce complexity by coordinating the mutual application conditions of DMVR and BDOF when applying DMVR and BDOF as described above. When checking the application conditions of DMVR and BDOF according to the embodiments of this document and applying the application conditions to the decoding process, the corresponding conditions can be checked and applied separately, but the application conditions can be checked at one time to improve coding efficiency. In other words, this document proposes a method that can integrate and check the application conditions of DMVR and BDOF at one time.

[0252] As an embodiment of the present document, information indicating whether to apply the modification in the decoding device in the sequence parameter set (SPS) syntax (e.g., sps_refinement_enabled_flag) is signaled to perform a process of checking the application condition of DMVR / BDOF. Next, Table 21 shows an example of a syntax element (e.g., sps_refinement_enabled_flag) indicating whether the modification is applied in the decoding device, which is signaled through the SPS syntax.

[0253] [Table 21]

[0254]

[0255] Referring to Table 21 above, sps_refinement_enabled_flag may be signaled in the SPS syntax, and whether the modification is applicable in the decoding device may be indicated based on the syntax element. For example, when sps_refinement_enabled_flag is present (ie, when sps_refinement_enabled_flag is true), it may be determined that the modification is applicable in the decoding device. In this case, the decoding device obtains the sps_dmvr_enabled_flag syntax element indicating whether DMVR is enabled and the sps_bdof_enabled_flag syntax element indicating whether BDOF is enabled to determine the application conditions of DMVR and BDOF.

[0256] Figure 7 and Figure 8 Another example illustrating a method of performing a decoding process by checking application conditions of DMVR and BDOF is illustrated.

[0257] When a syntax element indicating whether the modification is applicable to the decoding device (eg, sps_refinement_enabled_flag) is used as shown in Table 21 above, it can be applied Figure 7 Methods and Figure 8 In addition, the above-mentioned Figure 6 Duplicate Figure 7 and Figure 8 Description of the content.

[0258] See also Figure 7 , by comparison Figure 6 As can be seen from the process, without checking the respective application conditions of DMVR and BDOF, the application conditions are checked once in the previous stage. Figure 7 In step S710 of , the decoding device may check the modification application condition. In this case, the modification application condition may be checked based on the sps_refinement_enabled_flag shown in Table 21 above. For example, when sps_refinement_enabled_flag is 1, the decoding device may obtain the sps_dmvr_enabled_flag syntax element indicating whether DMVR is enabled and the sps_bdof_enabled_flag syntax element indicating whether BDOF is enabled, and check the application conditions of DMVR and BDOF based on the obtained syntax elements.

[0259] Further, refer to Figure 8 , through the above Figure 6Compared with the process of , the application condition is checked once in the previous stage without checking the application conditions of DMVR and BDOF respectively, and a simple check process (BDOF application condition) can be performed with respect to different conditions. As an example, in Figure 8 In step S810, the decoding device may check the modified application condition. Figure 8 In step S850, the decoding device may additionally simply check the application condition of the BDOF having a condition different from the modified application condition.

[0260] Meanwhile, when the height or size (height*width) of the current block is less than a specific length or a specific size, the calculation ratio of multiplication / addition for motion compensation increases. Therefore, in an embodiment of the present document, as in the application conditions of DMVR, the application of BDOF may be limited for blocks with a small height or a small size in order to reduce the worst case. In this case, the application conditions of BDOF may include the conditions presented in Table 22 below.

[0261] [Table 22]

[0262]

[0263] Referring to Table 22 above, by adding a condition related to the size of the current block (e.g., CbHeight and CbWidth), BDOF may not be applied to blocks smaller than a certain size. For example, a condition that is applied when the height of the current block (e.g., CbHeight) is equal to or greater than 8 and a condition that is applied when the size of the current block (e.g., CbHeight*CbWidth) is equal to or greater than 64 may be used. When the application condition related to the size of the current block is satisfied (i.e., when the height of the current block is equal to or greater than 8 and the height*width of the current block is equal to or greater than 64), BDOF may be applied, and when the application condition related to the size of the current block is not satisfied, BDOF may not be applied.

[0264] Further, in an embodiment, in combination with the conditions related to the size of the current block (eg, CbHeight and CbHeight*CbWidth), it is determined whether to apply BDOF based on the remaining application conditions listed in Table 22 above.

[0265] In other words, the decoding device may determine whether all conditions listed in Table 22 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any one of the conditions listed in Table 22 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 22 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0266] Meanwhile, when MMVD is applied to the current block, motion information may be derived based on information about MMVD (e.g., mmvd index). Here, the information about MMVD may include an index of a base MV, a distance index, a direction index, and the like. Specifically, a distance index (more specifically, mmvd_distance_index[xCb][yCb]) may be used to represent a distance from a base MV, for example, distance indexes 0 to 7 may be represented as {1 / 4, 1 / 2, 1, 2, 4, 8, 16, 32}, respectively. When determining the correction of motion information in DMVR and BDOF, whether to perform the correction is determined by considering adjacent pixels (adjacent samples), in which case the value of the distance index also increases when the distance between the adjacent pixels and the base MV is far. In this case, considering adjacent pixels is unlikely to contribute to the performance improvement of DMVR and BDOF. Therefore, this document proposes a method for determining whether to apply DMVR and BDOF based on a distance index (more specifically, mmvd_distance_index[xCb][yCb]) value.

[0267] As an embodiment of the present document, whether to apply DMVR may be determined by considering the distance index, in which case the application conditions of DMVR may include the conditions presented in Table 23 below.

[0268] [Table 23]

[0269]

[0270] Referring to Table 23 above, the MMVD-related conditions (e.g., mmvd_flag) among the application conditions of DMVR are changed to restrictively apply DMVR in the MMVD mode. For example, when mmvd_flag is 1 and mmvd_distance_index is greater than 4, it can be determined that the distance index condition of MMVD is satisfied. Therefore, when the MMVD mode is applied, it can be determined whether to apply DMVR according to the distance index (more specifically, mmvd_distance_index[xCb][yCb]) value.

[0271] Here, the value (threshold) of mmvd_distance_index may be set to 4, but this is just an example and the corresponding value may be changed to various values ​​according to performance and coding efficiency.

[0272] Therefore, in this embodiment, in combination with the condition of whether to apply MMVD (eg, mmvd_flag) and the distance index condition of MMVD (eg, mmvd_distance_index), it may be determined whether to apply DMVR based on the remaining application conditions listed in Table 23 above.

[0273] In other words, the decoding device may determine whether all conditions listed in Table 23 above are met, and when all conditions are met, the decoding device may perform true dual prediction by applying DMVR. When even any condition listed in Table 23 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 23 above, and the encoding device may perform true dual prediction by a corresponding method in the decoding device.

[0274] In addition, as an embodiment of the present document, whether to apply BDOF may be determined by considering a distance index, in which case the application conditions of BDOF may include the conditions presented in Table 24 below.

[0275] [Table 24]

[0276]

[0277] With reference to Table 24 above, BDOF may be restrictively applied in MMVD mode by adding a condition (e.g., merge_flag) for whether to apply merge mode / skip mode and a condition related to MMVD (e.g., mmvd_flag and mmvd_distance_index). For example, when merge_flag does not exist (i.e., merge_flag is not 1) or merge_flag is 1, mmvd_flag is 1, and mmvd_distance_index is greater than 4, it may be determined that the condition for restrictively applying BDOF in MMVD mode is met. Therefore, when MMVD mode is applied, it may be determined whether BDOF is applied based on the distance index (e.g., mmvd_distance_index[xCb][yCb]) value.

[0278] Here, the value (threshold) of mmvd_distance_index may be set to 4, but this is just an example, and the corresponding value may be changed to various values ​​according to performance and compilation efficiency.

[0279] Therefore, in this embodiment, in combination with the conditions for whether to apply merge mode / skip mode (e.g., merge_flag) and the conditions related to MMVD (e.g., mmvd_flag, mmvd_distance_index), it can be determined whether to apply BDOF based on the remaining application conditions listed in Table 24 above.

[0280] In other words, the decoding device may determine whether all conditions listed in Table 24 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any condition listed in Table 24 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 24 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0281] The method for performing true dual prediction based on the conditions listed in Table 23 or 24 above may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0282] Meanwhile, as described above, a combined intra-inter prediction (CIIP) mode that performs both intra prediction and inter prediction may be applied to the current block. In this case, a prediction block (inter block) that performs inter prediction is combined with an intra prediction method to ultimately generate a prediction sample value, thereby improving prediction accuracy. However, since DMVR and BDOF are techniques for correcting inter blocks, the CIIP mode may not need to be applied in terms of performance compared to complexity. Therefore, this document proposes a method that can determine whether to apply DMVR and BDOF by considering CIIP.

[0283] As an embodiment of the present document, whether to apply DMVR may be determined by considering CIIP, and in this case, the application conditions of DMVR may include the conditions given in Table 25 below.

[0284] [Table 25]

[0285]

[0286] Referring to Table 25 above, DMVR can be restrictively applied according to whether CIIP is applied by adding a condition (e.g., ciip_flag) for whether CIIP mode is applied. For example, when ciip_flag is 0 (i.e., when CIIP mode is not applied), DMVR can be applied by determining whether the condition for applying CIIP mode is satisfied.

[0287] Therefore, in this embodiment, in combination with the condition for whether to apply the CIIP mode (eg, ciip_flag), whether to apply DMVR may be determined based on the remaining application conditions listed in Table 25 above.

[0288] In other words, the decoding device may determine whether all conditions listed in Table 25 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying DMVR. When even any condition listed in Table 25 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 25 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0289] In addition, as an embodiment of the present document, whether to apply BDOF may be determined by considering CIIP, in which case, the application conditions of BDOF may include the conditions presented in Table 26 below.

[0290] [Table 26]

[0291]

[0292] Referring to Table 26 above, BDOF can be restrictively applied according to whether CIIP is applied by adding a condition (e.g., ciip_flag) of whether CIIP mode is applied. For example, when ciip_flag is 0 (i.e., when CIIP mode is not applied), BDOF can be applied by determining whether the condition of whether CIIP mode is applied is met.

[0293] Therefore, in this embodiment, in combination with the condition for whether to apply the CIIP mode (eg, ciip_flag), whether to apply BDOF may be determined based on the remaining application conditions listed in Table 26 above.

[0294] In other words, the decoding device may determine whether all conditions listed in Table 26 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any condition listed in Table 26 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 26 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0295] The method of performing true dual prediction based on the conditions listed in Table 25 or Table 26 above may be applied to DMVR and BDOF independently, or may be applied under the same conditions for DMVR and BDOF.

[0296] The methods listed in Tables 5 to 26 according to the embodiments of the present document described above may be applied in combination. In other words, whether to apply DMVR and BDOF may be determined by checking the correction application conditions, and the conditions shown in the following Table 27 may be applied.

[0297] [Table 27]

[0298]

[0299] Referring to Table 27 above, conditions for bilateral prediction when DMVR or BDOF is applied, conditions for true dual prediction in which the distances between the current picture and the bilateral reference picture are the same as each other, conditions for application when the MMVD mode is not used, conditions for application when affine prediction is not performed, conditions for application when a sub-block-based merge mode is applied, and conditions for application when the GBi index is default may be used. In other words, whether DMVR or BDOF is applied may be determined based on whether these conditions are met.

[0300] Further, a condition may be added to determine whether to apply the merge mode for DMVR, or to determine whether the current block is a luminance block for BDOF.

[0301] The application conditions listed in the above Table 27 are examples, and it is obvious that the various conditions listed in the above embodiments (embodiments in the above Tables 5 to 26) can be used in combination.

[0302] Meanwhile, in DMVR, the SAD function is adopted as the cost function instead of the mean removal SAD (MRSAD) function, considering the decoding complexity. However, when the GBi index is not the default value (for example, when GbiIdx is not 0), the two reference blocks may have different weighting factors, and therefore, DMVR using SAD may not be preferred. Therefore, the condition of DMVR is fixed by considering the GBi index. According to the experimental results, a 0.00% RD-rate change is shown using 100% encoding and decoding runtime compared to the VVC Test Model (VTM) 4.0.

[0303] In the case of Versatile Video Coding (VVC), the DMVR process can be performed when all conditions listed in the following Table 28 are met.

[0304] [Table 28]

[0305]

[0306] In the current DMVR, unmatched blocks can be searched by comparing with the SAD of a reference block to be weighted and averaged later. In the present document, since the two reference blocks may have different weights, this situation may be considered to determine the conditions for DMVR. According to an embodiment of the present document, DMVR may not be performed on blocks whose GBi index is not the default value. In this case, the application conditions of DMVR are shown in Table 29 below.

[0307] [Table 29]

[0308]

[0309] As shown in Table 29 above, when the value of the GBi index (e.g., GbiIdx) is 0, a condition for performing DMVR may be added. In other words, when the value of the GBi index (e.g., GbiIdx) is not 0, different weights are applied to the two reference blocks (i.e., the reference block of the L0 prediction reference and the reference block of the L1 prediction reference), and as a result, in this case, DMVR may be restricted from being performed.

[0310] Meanwhile, BDOF is performed when the current block (ie, current coding unit; current CU) satisfies the true dual prediction condition. When considering the design of optical flow equations to predict the motion of an object moving at a predetermined speed (ie, momentum), the current true dual prediction condition is not the best condition for applying BDOF. Therefore, the condition of BDOF can be fixed by considering the distance of the reference picture. According to the experimental results, a 0.01% RD-rate change is shown using 100% encoding and decoding runtime compared to VVC Test Model (VTM) 4.0.

[0311] Fig. 9 This is a diagram shown to describe the concept of BDOF.

[0312] As mentioned above, BDOF is designed to enhance the performance of motion compensation by using the concept of optical flow. According to BDOF, Fig. 9 As shown, it can be assumed that the object moves at a predetermined speed (constant motion) and the brightness of each pixel does not change when the object moves. Under the assumption, the optical flow equation can be expressed as the following formula 1.

[0313] [Formula 1]

[0314]

[0315] As described above, when the current CU satisfies the true dual prediction condition, BDOF is performed. However, the true dual prediction condition does not mean that the object moves at a predetermined speed. Therefore, this document proposes a method that can apply BDOF when the object has a predetermined motion and can enhance the performance of motion compensation.

[0316] According to an embodiment of the present document, in the above formula 1, as δt, when the distance L0 reference picture ( Fig. 9 The distance from the reference 0) and the distance from the L1 reference image ( Fig. 9 When the references 1) are the same as each other, BDOF can be applied. In this case, the application conditions of BDOF are changed as shown in Table 30 below.

[0317] [Table 30]

[0318]

[0319] Referring to Table 30 above, among the application conditions of BDOF (e.g., DiffPicOrderCnt), the condition related to the reference picture distance is changed to apply BDOF only when the object has a predetermined motion speed. For example, it is determined whether DiffPicOrderCnt (currPic, RefPicList[ 0 ][ refIdxL0 ]) and DiffPicOrderCnt ( RefPicList[ 1 ][refIdxL1 ], currPic) are the same as each other to determine whether the distance between the current picture and the L0 reference picture (i.e., the reference picture in the reference picture list L0) and the distance between the current picture and the L1 reference picture (i.e., the reference picture in the reference picture list L1) are the same as each other. In other words, BDOF can be applied only when the distance from the L0 reference picture based on the current picture and the distance from the L1 reference picture are the same as each other. In this way, the condition that the bilateral reference picture distance is the same based on the current picture is used to determine whether to perform true dual prediction and whether to include an object moving at a predetermined speed. BDOF is applied to the blocks that meet the conditions to obtain a more enhanced motion information correction result.

[0320] Further, in this embodiment, in combination with the conditions related to the reference picture distance (eg, DiffPicOrderCnt), it may be determined whether to apply BDOF based on the remaining application conditions listed in Table 30 above.

[0321] In other words, the decoding device may determine whether all conditions listed in Table 30 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any condition listed in Table 30 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 30 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0322] Meanwhile, this document proposes a method for determining whether to apply BDOF according to the block size. Table 31 below shows a case where a block size restriction according to an embodiment of this document is included as an application condition.

[0323] [Table 31]

[0324]

[0325] Referring to Table 31 above, when BDOF is applied, the case where the height of the current block (eg, CbHeight) is equal to or greater than 8, the case where the size of the current block (eg, CbHeight*CbWidth) is equal to or greater than 64 may be added as conditions.

[0326] Therefore, in this embodiment, in combination with the condition of whether the height of the current block is equal to or greater than 8 and the condition of whether the height*width of the current block is equal to or greater than 64, whether BDOF is applied can be determined by using the remaining conditions listed in Table 31 above.

[0327] In other words, the decoding device may determine whether all conditions listed in Table 31 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any condition listed in Table 31 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 31 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0328] The DMVR process described in this document can be implemented according to the specifications shown in the following Table 32. The following Table 32 shows an example of a SAD-based motion vector correction process as an embodiment of this document.

[0329] [Table 32]

[0330]

[0331]

[0332] Meanwhile, as described above, in DMVR, the SAD function is adopted as the cost function instead of the mean removed SAD (MRSAD) function, taking into account the decoding complexity. However, when the GBi index is not the default value (for example, when GbiIdx is not 0) and the weighted flag of the explicit weight prediction is not 0, DMVR using SAD may not be preferred. Therefore, the conditions of DMVR are fixed by considering the GBi index and the weighted flag of the explicit weight prediction. In addition, the same conditions can even be applied to BDOF. According to the experimental results, a 0.00% RD-rate change is shown using 100% of the encoding and decoding runtimes compared to the VVC Test Model (VTM) 4.0.

[0333] In the current DMVR, unmatched blocks can be searched by comparing with the SAD of the reference blocks to be weighted and averaged later. In the present document, since the two reference blocks may have different weights, the conditions of DMVR can be determined by considering this situation. According to an embodiment of the present document, DMVR may not be performed on blocks whose GBi index is not the default value. In addition, DMVR may not be performed on blocks whose weight flags of explicit weight prediction are not 0.

[0334] In an embodiment of the present document, a method is proposed that can determine whether to apply DMVR by considering performing weighted dual prediction. In this case, the application conditions of DMVR may include the conditions given in Table 33 below.

[0335] [Table 33]

[0336]

[0337] Referring to Table 33 above, conditions indicating whether weight is explicitly applied to L0 prediction and L1 prediction (e.g., luma_weight_l0_flag and luma_weight_l1_flag) and index conditions indicating weight applied to L0 prediction and L1 prediction (e.g., GbiIdx) are added to determine whether DMVR is applied according to whether weighted dual prediction is performed.

[0338] For example, whether to apply explicit weight prediction to the current block may be determined based on flag information indicating whether the weight is explicitly applied to the L0 prediction (e.g., luma_weight_l0_flag) and flag information indicating whether the weight is explicitly applied to the L1 prediction (e.g., luma_weight_l1_flag). In other words, when the value of luma_weight_l0_flag is 0 and the value of luma_weight_l1_flag is 0, DMVR may be restrictively applied. In other words, when weight prediction is not explicitly applied to the L0 and L1 predictions, it may be determined that DMVR is applied.

[0339] In addition, whether to apply dual prediction (i.e., L0 prediction and L1 prediction) using different weights to the current block may be determined based on the value of a dual prediction weight index (e.g., GbiIdx) indicating weights applied to L0 prediction and L1 prediction. In other words, the case where the value of the dual prediction weight index (e.g., GbiIdx) is 0 may be a default case where different weights are not applied to L0 prediction and L1 prediction as described in the embodiment of Table 3 above. Therefore, when the value of the dual prediction weight index (e.g., GbiIdx) is 0, DMVR may be restrictively applied.

[0340] According to this embodiment, when weight prediction is not explicitly applied to L0 and L1 prediction (when the value of luma_weight_l0_flag is 0 and when the value of luma_weight_l1_flag is 0), information about the dual prediction weight index (e.g., GbiIdx) is further obtained to determine whether the value of the dual prediction weight index (e.g., GbiIdx) is 0.

[0341] In this embodiment, in combination with the conditions indicating whether weights are explicitly applied to L0 prediction and L1 prediction (e.g., luma_weight_l0_flag and luma_weight_l1_flag) and the index condition indicating the weights applied to L0 prediction and L1 prediction (e.g., GbiIdx), whether DMVR is applied can be determined based on the remaining conditions listed in Table 33 above.

[0342] In other words, the decoding device may determine whether all conditions listed in Table 33 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying DMVR. When even any condition listed in Table 33 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 33 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0343] Meanwhile, in the case of BDOF, the GBi index is considered but the weighted flag of the explicit weight prediction is not considered. Therefore, this document proposes a method for determining whether to apply BDOF by considering the GBi index and the weighted flag of the explicit weight prediction.

[0344] As an embodiment of the present document, whether to apply BDOF may be determined by considering whether weighted dual prediction is performed, in which case the application conditions of BDOF may include the conditions presented in the following Table 34.

[0345] [Table 34]

[0346]

[0347] Referring to Table 34 above, conditions indicating whether weights are explicitly applied to L0 prediction and L1 prediction (eg, luma_weight_l0_flag and luma_weight_l1_flag) are added to determine whether BDOF is applied according to whether weighted dual prediction is performed.

[0348] For example, whether to apply explicit weight prediction to the current block may be determined based on flag information indicating whether the weight is explicitly applied to the L0 prediction (e.g., luma_weight_l0_flag) and flag information indicating whether the weight is explicitly applied to the L1 prediction (e.g., luma_weight_l1_flag). In other words, when the value of luma_weight_l0_flag is 0 and the value of luma_weight_l1_flag is 0, BDOF may be restrictively applied. In other words, when weight prediction is not explicitly applied to L0 and L1 predictions, it may be determined that BDOF is applied.

[0349] In this embodiment, in combination with the conditions indicating whether to explicitly apply weights to L0 prediction and L1 prediction (eg, luma_weight_l0_flag and luma_weight_l1_flag), whether to apply BDOF may be determined based on the remaining conditions listed in Table 34 above.

[0350] In other words, the decoding device may determine whether all conditions listed in Table 34 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any condition listed in Table 34 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 34 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0351] The method of performing true dual prediction based on the conditions listed in Table 33 or Table 34 above may be applied to DMVR and BDOF independently, or may be applied under the same conditions used for DMVR and BDOF.

[0352] As described above, in addition to the GBi index, it is also possible to determine whether to apply DMVR and BDOF by considering the weight factor of explicit weight prediction. In this case, in order to determine whether to apply explicit weight prediction, whether to perform weight prediction on the luminance component is considered by using luma_weight_lX_flag (here, X is 0 or 1), but even for the chrominance component, whether to perform weight prediction is considered. Accordingly, the document proposes a method for determining whether to apply DMVR and BDOF by considering the weight factor of the chrominance component in addition to the weight factor of the luminance component.

[0353] As an embodiment of the present document, whether to apply DMVR can be determined by considering the weight factors of the explicit weight prediction of the luminance component and the chrominance component of the current block, in which case the application conditions of DMVR may include the conditions presented in the following Table 35.

[0354] [Table 35]

[0355]

[0356] Referring to Table 35 above, conditions indicating whether weights are explicitly applied to the luma component of the L0 prediction (luminance prediction value) and the luma component of the L1 prediction (luminance prediction value) (e.g., luma_weight_l0_flag, luma_weight_l1_flag), conditions indicating whether weights are explicitly applied to the chroma component of the L0 prediction (chroma prediction value) and the chroma component of the L1 prediction (chroma prediction value) (e.g., chroma_weight_l0_flag, chroma_weight_l1_flag), and index conditions indicating weights applied to the L0 prediction and the L1 prediction (e.g., GbiIdx) are added to restrictively apply DMVR only when weights (i.e., weight factors) are not explicitly applied to both the luma and chroma components.

[0357] For example, whether to apply the weight factor of explicit weight prediction to the luma component of the current block can be determined based on flag information (e.g., luma_weight_l0_flag) indicating whether the weight is explicitly applied to the luma component (luma prediction value) of the L0 prediction and flag information (e.g., luma_weight_l1_flag) indicating whether the weight is explicitly applied to the luma component (luma prediction value) of the L1 prediction.

[0358] In addition, whether to apply the weight factor of the explicit weight prediction to the chroma component of the current block can be determined based on flag information (e.g., chroma_weight_l0_flag) indicating whether the weight is explicitly applied to the chroma component of the L0 prediction (chroma prediction value) and flag information (e.g., chroma_weight_l1_flag) indicating whether the weight is explicitly applied to the chroma component of the L1 prediction (chroma prediction value).

[0359] In other words, when the value of luma_weight_l0_flag is 0 and the value of luma_weight_l1_flag is 0, it can be determined that the weight factor does not explicitly exist for the luma component, and when the value of chroma_weight_l0_flag is 0 and the value of chroma_weight_l1_flag is 0, it can be determined that the weight factor does not explicitly exist for the chroma component. Therefore, when the explicit weight factor does not exist for both the luma component and the chroma component, DMVR can be restrictively applied.

[0360] In addition, whether to apply dual prediction (i.e., L0 prediction and L1 prediction) using different weights to the current block may be determined based on the value of a dual prediction weight index (e.g., GbiIdx) indicating weights applied to L0 prediction and L1 prediction. In other words, the case where the value of the dual prediction weight index (e.g., GbiIdx) is 0 may be a default case where different weights are not applied to L0 prediction and L1 prediction as described in the embodiment of Table 3 above. Therefore, when the value of the dual prediction weight index (e.g., GbiIdx) is 0, DMVR may be restrictively applied.

[0361] According to this embodiment, when weight prediction is not explicitly applied to L0 and L1 predictions of luma components (when the value of luma_weight_l0_flag is 0 and the value of luma_weight_l1_flag is 0) and when weight prediction is not explicitly applied to L0 and L1 predictions of chroma components (when the value of chroma_weight_l0_flag is 0 and the value of chroma_weight_l1_flag is 0), information about a dual prediction weight index (e.g., GbiIdx) is further obtained to determine whether the value of the dual prediction weight index (e.g., GbiIdx) is 0.

[0362] In this embodiment, in combination with the conditions indicating whether weights are explicitly applied to the L0 prediction and L1 prediction of the luminance component (e.g., luma_weight_l0_flag and luma_weight_l1_flag), the conditions indicating whether weights are explicitly applied to the L0 prediction and L1 prediction of the chrominance component, and the index conditions indicating the weights applied to the L0 prediction and L1 prediction (e.g., GbiIdx), whether DMVR is applied can be determined based on the remaining conditions listed in Table 35 above.

[0363] In other words, the decoding device may determine whether all conditions listed in Table 35 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying DMVR. When even any condition listed in Table 35 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 35 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0364] Further, as an embodiment of the present document, whether to apply BDOF can be determined by considering the weight factors of the explicit weight prediction of the luminance component and the chrominance component of the current block. In this case, the application conditions of BDOF may include the conditions presented in Table 36 below.

[0365] [Table 36]

[0366]

[0367] Referring to Table 36 above, conditions (e.g., luma_weight_l0_flag, luma_weight_l1_flag) indicating whether weights are explicitly applied to the luma component (luminance prediction value) of the L0 prediction and the luma component (luminance prediction value) of the L1 prediction and conditions (e.g., chroma_weight_l0_flag, chroma_weight_l1_flag) indicating whether weights are explicitly applied to the chroma component (chroma prediction value) of the L0 prediction and the chroma component (chroma prediction value) of the L1 prediction are added to restrictively apply BDOF only when weights (i.e., weight factors) are not explicitly applied to both the luma and chroma components.

[0368] For example, when the value of the flag information indicating whether the weight is explicitly applied to the luminance component (luminance prediction value) of the L0 prediction (e.g., luma_weight_l0_flag) is 0 and the value of the flag information indicating whether the weight is explicitly applied to the luminance component (luminance prediction value) of the L1 prediction (e.g., luma_weight_l1_flag) is 0, it can be determined that the weight factors of the L0 prediction and L1 prediction of the luminance component of the current block do not explicitly exist.

[0369] Further, when the value of the flag information indicating whether the weight is explicitly applied to the chroma component of the L0 prediction (chroma prediction value) (e.g., chroma_weight_l0_flag) is 0 and the value of the flag information indicating whether the weight is explicitly applied to the chroma component of the L1 prediction (chroma prediction value) (e.g., chroma_weight_l1_flag) is 0, it can be determined that the weight factors of the L0 prediction and L1 prediction of the chroma component of the current block do not explicitly exist.

[0370] Therefore, when the weighting factor does not exist for both the luma component and the chroma component, BDOF may be restrictively applied.

[0371] In this embodiment, in combination with the conditions indicating whether weights are explicitly applied to the L0 prediction and L1 prediction of the luma component (e.g., luma_weight_l0_flag and luma_weight_l1_flag) and the conditions indicating whether weights are explicitly applied to the L0 prediction and L1 prediction of the chroma component (e.g., chroma_weight_l0_flag and chroma_weight_l1_flag), whether BDOF is applied can be determined based on the remaining conditions listed in Table 36 above.

[0372] In other words, the decoding device may determine whether all conditions listed in Table 36 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any condition listed in Table 36 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 36 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0373] The method of performing true dual prediction based on the conditions listed in Table 35 or Table 36 above may be applied to DMVR and BDOF independently, or may be applied under the same conditions used for DMVR and BDOF.

[0374] Meanwhile, as described above, according to an embodiment of the present document, it is possible to determine whether to apply DMVR and BDOF by considering explicit weight prediction. In this case, in order to determine whether to apply explicit weight prediction, the type of slice may be considered. Therefore, the present document proposes a method for determining whether to apply DMVR and BDOF by considering the slice type and determining whether to apply weight prediction accordingly.

[0375] As an embodiment of the present document, whether to apply DMVR and BDOF may be determined according to the type of the current slice by using flag information indicating whether weight prediction is applied. Here, flag information indicating whether weight prediction is applied according to the type of the current slice may be signaled from the encoding device to the decoding device through a picture parameter set (PPS) or sequence parameter set (SPS) syntax. As an example, the following Table 37 shows flag information signaled through the PPS syntax.

[0376] [Table 37]

[0377]

[0378] Referring to Table 37 above, weighted_pred_flag and weighted_bipred_flag may be signaled from the encoding device to the decoding device. Here, weighted_pred_flag may be information indicating whether weight prediction is applied to slice P, and weighted_bipred_flag may be information indicating whether weight prediction is applied to slice B.

[0379] For example, when the value of weighted_pred_flag is 0, it can indicate that weighted prediction is not applied to P slices, and when the value of weighted_pred_flag is 1, it can indicate that weighted prediction is applied to P slices. Further, when the value of weighted_bipred_flag is 0, it can indicate that weighted prediction is not applied to B slices, and when the value of weighted_bipred_flag is 1, it can indicate that weighted prediction is applied to B slices.

[0380] Here, a predicted (P) slice may refer to a slice decoded based on inter-frame prediction using one motion vector and one reference picture index. A bi-predicted (B) slice may refer to a slice decoded based on inter-frame prediction using one or more (e.g., two motion vectors and reference picture indexes).

[0381] As an embodiment of the present document, whether to apply DMVR can be determined based on flag information indicating whether weighted prediction is applied to P slices (e.g., weighted_pred_flag) and flag information indicating whether weighted prediction is applied to B slices (e.g., weighted_bipred_flag). In this case, the application conditions of DMVR may include the conditions presented in Table 38 below.

[0382] [Table 38]

[0383]

[0384] Referring to Table 38 above, a condition indicating whether weighted prediction is applied to P slices (e.g., weighted_pred_flag), a condition indicating whether weighted prediction is applied to B slices (e.g., weighted_bipred_flag), and an index condition indicating the weight applied to L0 prediction and L1 prediction (e.g., GbiIdx) are added to restrictively apply DMVR only when weighted prediction is not applied to P slices and B slices.

[0385] For example, DMVR may be applied when the value of weighted_pred_flag is 1 and the current slice is not a P slice, and when the value of weighted_bipred_flag is 1 and the current slice is not a B slice. In other words, when weighted prediction is not applied to a P slice and weighted prediction is not applied to a B slice, it may be determined that DMVR is applied.

[0386] In addition, whether to apply dual prediction (ie, L0 prediction and L1 prediction) using different weights to the current block may be determined based on the value of a dual prediction weight index (eg, GbiIdx) indicating weights applied to L0 prediction and L1 prediction. In other words, the case where the value of the dual prediction weight index (eg, GbiIdx) is 0 may be a default case where different weights are not applied to L0 prediction and L1 prediction, as described in the embodiment of Table 3 above. Therefore, when the value of the dual prediction weight index (eg, GbiIdx) is 0, DMVR may be restrictively applied.

[0387] In this embodiment, in combination with the condition indicating whether weighted prediction is applied to P slices (e.g., weighted_pred_flag), the condition indicating whether weighted prediction is applied to B slices (e.g., weighted_bipred_flag), and the index condition indicating the weights applied to L0 prediction and L1 prediction (e.g., GbiIdx), whether DMVR is applied can be determined based on the remaining conditions listed in Table 38 above.

[0388] In other words, the decoding device may determine whether all conditions listed in Table 38 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying DMVR. When even any condition listed in Table 38 above is not met, the decoding device may not apply DMVR. The encoding device may also apply the conditions of Table 38 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0389] In addition, as an embodiment of the present document, whether to apply BDOF can be determined based on flag information indicating whether weighted prediction is applied to P slices (e.g., weighted_pred_flag) and flag information indicating whether weighted prediction is applied to B slices (e.g., weighted_bipred_flag). In this case, the application conditions of BDOF may include the conditions presented in Table 39 below.

[0390] [Table 39]

[0391]

[0392] Referring to Table 39 above, a condition indicating whether weighted prediction is applied to a P slice (eg, weighted_pred_flag) and a condition indicating whether weighted prediction is applied to a B slice (eg, weighted_bipred_flag) are added to restrictively apply BDOF only when weighted prediction is not applied to P slices and B slices.

[0393] For example, BDOF may be applied when the value of weighted_pred_flag is 1 and the current slice is not a P slice, and when the value of weighted_bipred_flag is 1 and the current slice is not a B slice. In other words, when weighted prediction is not applied to a P slice and weighted prediction is not applied to a B slice, it may be determined that BDOF is applied.

[0394] In this embodiment, in combination with the condition indicating whether weighted prediction is applied to P slices (e.g., weighted_pred_flag), the condition indicating whether weighted prediction is applied to B slices (e.g., weighted_bipred_flag), and the index condition indicating the weights applied to L0 prediction and L1 prediction (e.g., GbiIdx), whether BDOF is applied can be determined based on the remaining conditions listed in Table 39 above.

[0395] In other words, the decoding device may determine whether all conditions listed in Table 39 above are met, and when all conditions are met, the decoding device may perform true double prediction by applying BDOF. When even any condition listed in Table 39 above is not met, the decoding device may not apply BDOF. The encoding device may also apply the conditions of Table 39 above, and the encoding device may perform true double prediction by a corresponding method in the decoding device.

[0396] The method of performing true dual prediction based on the conditions listed in Table 38 or 39 above may be applied to DMVR and BDOF independently, or may be applied under the same conditions used for DMVR and BDOF.

[0397] In this document, DMVR flag information indicating whether DMVR is applied and BDOF flag information indicating whether BDOF is applied may be derived based on the application conditions of Tables 1 to 39 described above.

[0398] For example, DMVR flag information (e.g., dmvrFlag) may be derived based on an application condition (at least one of the application conditions in Tables 1 to 34 or a combination of the application conditions). In this case, when the value of dmvrFlag is 1 (or true), it may indicate that DMVR is applied, and when the value of dmvrFlag is 0 (or false), it may indicate that DMVR is not applied. In addition, BDOF flag information (e.g., bdofFlag) may be derived based on an application condition of BDOF (at least one of the application conditions in Tables 1 to 34 or a combination of the application conditions). In this case, when the value of bdofFlag is 1 (or true), it may indicate that BDOF is applied, and when the value of bdofFlag is 0 (or false), it may indicate that BDOF is not applied.

[0399] Fig.10is a flowchart schematically illustrating an encoding method that can be performed by an encoding device according to an embodiment of the present document.

[0400] Fig.10 The method disclosed in can be Figure 2 Specifically, Fig.10 Steps S1000 to S1010 may be performed by Figure 2 The predictor 220 and the inter-frame predictor 221 disclosed in Fig.10 Step S1020 may be performed by Figure 2 The residual processor 230 disclosed in Fig.10 Step S1030 may be performed by Figure 2 The entropy encoder 240 disclosed in is executed. Further, Fig.10 The method disclosed in the invention may include the above-mentioned embodiments in this document. Therefore, the above-mentioned embodiments will be omitted or simplified. Fig.10 A detailed description of the contents of the above embodiments is repeated.

[0401] Reference Fig.10 , the encoding apparatus may derive an L0 motion vector and an L1 motion vector of the current block ( S1000 ).

[0402] As an embodiment, in the case of performing inter-frame prediction on the current block, the encoding device can derive motion information (motion vector, reference picture index, etc.) of the current block. For example, the encoding device can search for a block similar to the current block in a predetermined area (search area) of the reference picture through motion estimation, and can derive a reference block having a minimum difference or a difference equal to or lower than a predetermined level with the current block. Based on this, the encoding device can derive a reference picture index indicating the reference picture where the reference block is located, and can derive a motion vector based on the position difference between the reference block and the current block.

[0403] In addition, the encoding device may determine an inter prediction mode applied to the current block among various prediction modes. The encoding device may compare RD costs for various prediction modes with each other, and may determine an optimal prediction mode for the current block.

[0404] For example, the encoding device may determine whether to apply the merge mode as the best prediction mode for the current block. In the case where the merge mode is applied to the current block, the encoding device may configure a merge candidate list based on neighboring blocks of the current block, and may generate merge index information. Specifically, the encoding device may derive a reference block whose difference with the current block is the smallest or equal to or lower than a predetermined level among the reference blocks (i.e., neighboring blocks) indicated by the merge candidates included in the merge candidate list. In this case, a merge candidate related to the derived reference block may be selected, and merge index information indicating the selected merge candidate may be generated and signaled to the decoding device. The motion information of the current block may be derived using the motion information of the selected merge candidate.

[0405] Here, the motion information may include information such as a motion vector, a reference picture index, etc., and may include L0 motion information and / or L1 motion information depending on the inter prediction type (L0 prediction, L1 prediction, Bi prediction, etc.). When dual prediction is applied to the current block, the motion information may include a motion vector in the L0 direction (L0 motion vector) and a motion vector in the L1 direction (L1 motion vector). In addition, the motion information may include an L0 reference picture index and an L0 reference picture indicated by the L0 reference picture index in an L0 reference picture list, and an L1 reference picture index and an L1 reference picture indicated by the L1 reference picture index in an L1 reference picture list.

[0406] That is, when the merge mode is applied, the encoding apparatus may derive the L0 motion vector and the L1 motion vector of the neighboring blocks indicated by the merge index information among the neighboring blocks of the current block, and may use them as the L0 and L1 motion vectors of the current block.

[0407] The encoding apparatus may derive a prediction sample of the current block based on the L0 motion vector and the L1 motion vector ( S1010 ).

[0408] In this case, when deriving the prediction sample, the encoding device may determine whether to apply BDOF to the current block based on the coding efficiency, complexity, and prediction performance. That is, the encoding device may apply BDOF to the current block based on whether the application conditions of BDOF for the current block are met. Here, the application conditions of BDOF may be composed of some (or all) of the various application conditions described in Tables 1 to 39 above or a specific combination thereof. In addition, the encoding device may derive BDOF flag information based on whether the application conditions of BDOF are met. The BDOF flag information may be information related to whether BDOF is applied to the current block (e.g., the above-mentioned bdofFlag).

[0409] As an embodiment, the application condition of BDOF may include a condition that both the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are equal to 0.

[0410] Here, the L0 luminance weight prediction flag information may be luma_weight_l0_flag in Tables 33 to 36 as described above, and may be information related to a weight factor of L0 prediction indicating whether there is a luminance component of the current block. The L1 luminance weight prediction flag information may be luma_weight_l1_flag in Tables 33 to 36 as described above, and may be information related to a weight factor of L1 prediction indicating whether there is a luminance component of the current block. For example, a case where the value of the L0 luminance weight prediction flag information is equal to 0 may indicate that there is no weight factor for the luminance component of the L0 prediction, and a case where the value of the L0 luminance weight prediction flag information is equal to 1 may indicate that there is a weight factor for the luminance component of the L0 prediction. Further, a case where the value of the L1 luminance weight prediction flag information is equal to 0 may indicate that there is no weight factor for the luminance component of the L1 prediction, and a case where the value of the L1 luminance weight prediction flag information is equal to 1 may indicate that there is a weight factor for the luminance component of the L1 prediction.

[0411] That is, if the condition that the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are both equal to 0 is satisfied, the encoding device may derive a value (e.g., 1 or true) related to indicating that BDOF is applied to the current block as the BDOF flag information. If at least one of the L0 luminance weight prediction flag information and the L1 luminance weight prediction flag information is not equal to 0, the encoding device may derive a value (e.g., 0 or false) related to indicating that BDOF is not applied to the current block as the BDOF flag information.

[0412] Further, as an embodiment, the application condition of BDOF may include a condition that the value of the L0 chroma weight prediction flag information and the value of the L1 chroma weight prediction flag information are both equal to 0. Here, the L0 chroma weight prediction flag information may be chroma_weight_l0_flag in Tables 33 to 36 as described above, and may be information related to indicating whether there is a weight factor for L0 prediction of the chroma component of the current block. The L1 chroma weight prediction flag information may be chroma_weight_l1_flag in Tables 33 to 36 as described above, and may be information related to indicating whether there is a weight factor for L1 prediction of the chroma component of the current block. For example, the case where the value of the L0 chroma weight prediction flag information is equal to 0 may indicate that there is no weight factor for the chroma component for L0 prediction, and the case where the value of the L0 chroma weight prediction flag information is equal to 1 may indicate that there is a weight factor for the chroma component for L0 prediction. Further, the case where the value of the L1 chrominance weight prediction flag information is equal to 0 may indicate that there is no weight factor for the chrominance component used for L1 prediction, and the case where the value of the L1 chrominance weight prediction flag information is equal to 1 may indicate that there is a weight factor for the chrominance component used for L1 prediction.

[0413] That is, if the condition that the value of the L0 chroma weight prediction flag information and the value of the L1 chroma weight prediction flag information are both equal to 0 is satisfied, the encoding device may derive a value (e.g., 1 or true) related to indicating that BDOF is applied to the current block as the BDOF flag information. If at least one of the L0 chroma weight prediction flag information and the L1 chroma weight prediction flag information is not equal to 0, the encoding device may derive a value (e.g., 0 or false) related to indicating that BDOF is not applied to the current block as the BDOF flag information.

[0414] In addition, according to an embodiment, the application condition of BDOF may include at least one of the following: 1) a condition that BDOF-based inter prediction is enabled, 2) a condition that dual prediction performed based on an L0 reference picture and an L1 reference picture is applied to the current block, 3) a condition that the difference with the L0 reference picture and the difference with the L1 reference picture based on the current picture are equal to each other, 4) a condition that the value of the dual prediction weight index information of the current block is equal to 0, 5) a condition that the affine mode is not applied to the current block, 6) a condition that the sub-block-based merge mode is not applied to the current block, 7) a condition that the prediction mode combining inter prediction and intra prediction is not applied to the current block, 8) a condition that the height of the current block is equal to or greater than 8, 9) a condition that the width of the current block is equal to or greater than 8, 10) a condition that the height x width of the current block is greater than 8x8, or 11) a condition that the current block is a luminance component. In this case, the encoding device may derive the BDOF flag information based on at least one of the conditions 1) to 11) as described above. For example, if all the conditions from 1) to 11) above (or at least one of 1 to 11 above) are met together with the condition that both the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are equal to 0 and / or the condition that both the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are equal to 0, the encoding device may export the value of the BDOF flag information as true or 1; otherwise, the encoding device may export the value of the BDOF flag information as false or 0.

[0415] Here, when deriving the BDOF flag information, the listed BDOF application conditions are merely exemplary, and the conditions in Tables 1 to 39 as described above may be variously combined and used.

[0416] If the BDOF flag information indicates that BDOF is applied to the current block (eg, if the BDOF flag information is derived as a true or 1 value), the encoding apparatus may derive a prediction sample by applying BDOF to the current block.

[0417] As an embodiment, the encoding device may derive the L0 prediction samples of the current block and the L1 prediction samples of the current block. In addition, the encoding device may derive the gradient for the L0 prediction samples and the gradient for the L1 prediction samples. Further, the encoding device may finally derive the prediction samples of the current block based on the L0 prediction samples, the L1 prediction samples, the gradient of the L0 prediction samples, and the gradient of the L1 prediction samples. Here, the L0 prediction samples may be derived based on the reference samples indicated by the L0 motion vector in the L0 reference picture, and the L1 prediction samples may be derived based on the reference samples indicated by the L1 motion vector in the L1 reference picture.

[0418] According to an embodiment, the encoding device may determine whether to apply DMVR to the current block in consideration of coding efficiency, complexity, and prediction performance. That is, the encoding device may apply DMVR to the L0 motion vector and the L1 motion vector based on whether the application condition of DMVR to the current block is met. Here, the application condition of DMVR may be composed of some (or all) of the various application conditions described in Tables 1 to 39 above or a specific combination thereof. In addition, the encoding device may derive DMVR flag information based on whether the application condition of DMVR is met. The DMVR flag information may be information related to whether DMVR is applied to the current block (e.g., the above-mentioned dmvrFlag).

[0419] As an embodiment, the application condition of DMVR may include a condition that both the value of the L0 luma weight prediction flag information and the value of the L1 luma weight prediction flag information are equal to 0. In this case, as in the application condition of BDOF described above, when the case where the L0 luma weight prediction flag information indicates that there is no weight factor for the luma component of L0 prediction (e.g., luma_weight_l0_flag is equal to 0) and the case where the L1 luma weight prediction flag information indicates that there is no weight factor for the luma component of L1 prediction (e.g., luma_weight_l1_flag is equal to 0) are satisfied, the encoding device may derive a value (e.g., 1 or true) associated with indicating that DMVR is applied to the current block (i.e., the L0 motion vector and the L1 motion vector) as the DMVR flag information. In addition, when at least one of the L0 luma weight prediction flag information and the L1 luma weight prediction flag information is not equal to 0, the encoding device may derive a value (e.g., 0 or false) associated with indicating that DMVR is not applied to the current block as the DMVR flag information.

[0420] Further, as an embodiment, the application condition of DMVR may include a condition that both the value of the L0 chroma weight prediction flag information and the value of the L1 chroma weight prediction flag information are equal to 0. In this case, as in the application condition of BDOF described above, when the L0 chroma weight prediction flag information indicates that there is no weight factor for the chroma component of L0 prediction (e.g., chroma_weight_l0_flag is equal to 0) and the L1 chroma weight prediction flag information indicates that there is no weight factor for the chroma component of L1 prediction (e.g., chroma_weight_l1_flag is equal to 0), the encoding device may derive a value (e.g., 1 or true) related to indicating that DMVR is applied to the current block (i.e., the L0 motion vector and the L1 motion vector) as the DMVR flag information. In addition, when at least one of the L0 chroma weight prediction flag information and the L1 chroma weight prediction flag information is not equal to 0, the encoding device may derive a value (e.g., 0 or false) related to indicating that DMVR is not applied to the current block as the DMVR flag information.

[0421] Further, the application condition of DMVR may include a condition that the value of the dual prediction weight index information of the current block is 0. Here, the dual prediction weight index information may represent the above-mentioned GbiIdx, and if the value of the dual prediction weight index information (e.g., GbiIdx) is equal to 0, it may be a default value that does not apply different weight values ​​to L0 prediction and L1 prediction. For example, as shown in Table 3, the case where the value of the dual prediction weight index information is equal to 0 may be a case where a weight value of 1 / 2 is applied to L0 prediction and L1 prediction, respectively. That is, in this case, if the value of the dual prediction weight index information is equal to 0, the encoding device may derive a value (e.g., 1 or true) associated with an indication that DMVR is applied to the current block (i.e., L0 motion vector and L1 motion vector) as DMVR flag information. In addition, if the value of the dual prediction weight index information is not equal to 0, the encoding device may derive a value (e.g., 0 or false) associated with an indication that DMVR is not applied to the current block as DMVR flag information.

[0422] In addition, according to an embodiment, the application condition of DMVR may include at least one of the following: 1) a condition that DMVR-based inter-frame dual prediction is enabled, 2) a condition that dual prediction performed based on an L0 reference picture and an L1 reference picture is applied to the current block, 3) a condition that the difference with the L0 reference picture and the difference with the L1 reference picture based on the current picture are equal to each other, 4) a condition that a merge mode is applied to the current block, 5) a condition that a merge mode with a motion vector difference (MMVD) mode is not applied to the current block, 6) a condition that a prediction mode combining inter-frame prediction and intra-frame prediction is not applied to the current block, 7) a condition that the height of the current block is equal to or greater than 8, 8) a condition that the width of the current block is equal to or greater than 8, or 9) a condition that the height x width of the current block is greater than 8x8. In this case, the encoding device may derive the DMVR flag information based on at least one of the conditions 1) to 9) as described above. For example, if all of the above conditions 1) to 9) are met (or at least one of the above 1 to 9) together with the condition that both the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are equal to 0, the condition that both the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are equal to 0, and the condition that the value of the dual prediction weight index information is equal to 0, the encoding device may export the value of the DMVR flag information as true or 1; otherwise, the encoding device may export the value of the DMVR flag information as false or 0.

[0423] Here, when exporting DMVR flag information, the listed DMVR application conditions are merely exemplary, and the conditions in Tables 1 to 39 as described above may be variously combined and used.

[0424] If the DMVR flag information indicates that DMVR is applied to the L0 motion vector and the L1 motion vector (eg, if the DMVR flag information is derived as a true or 1 value), the encoding apparatus may derive a modified L0 motion vector and a modified L1 motion vector by applying DMVR to the current block.

[0425] As an embodiment, the encoding device may calculate the minimum sum of absolute differences (SAD) based on the reference samples (i.e., L0 prediction samples) in the L0 reference picture derived based on the L0 motion vector and the reference samples (i.e., L1 prediction samples) in the L1 reference picture derived based on the L1 motion vector. In addition, the encoding device may derive a modified L0 motion vector for the L0 motion vector and a modified L1 motion vector for the L1 motion vector based on the sample position corresponding to the minimum SAD.

[0426] That is, the modified L0 motion vector may be a motion vector associated with a sample position indicating a minimum SAD corresponding to the L0 reference picture, and the modified L1 motion vector may be a motion vector associated with a sample position indicating a minimum SAD corresponding to the L1 reference picture. Figure 4 and 5 The process of deriving a modified motion vector by applying DMVR is described in detail, and its description is omitted hereinafter.

[0427] As described above, in the case where DMVR is applied to the L0 motion vector and the L1 motion vector, the encoding device can derive a prediction sample based on the modified L0 motion vector and the modified L1 motion vector. In addition, depending on whether the application conditions of BDOF are met, the encoding device can even apply BDOF to the prediction sample derived based on the modified L0 motion vector and the modified L1 motion vector.

[0428] The encoding apparatus may derive a residual sample of the current block based on the prediction sample ( S1020 ), and may encode image information including information about the residual sample ( S1030 ).

[0429] That is, the encoding device may derive residual samples based on the original samples for the current block and the predicted samples of the current block. In addition, the encoding device may generate information about the residual samples. Here, the information about the residual samples may include information such as value information of quantized transform coefficients derived by performing transform and quantization on the residual samples, position information, transform scheme, transform kernel, and quantization parameter.

[0430] The encoding device may encode the information about the residual samples to output the encoded information in the form of a bitstream, and may transmit the bitstream to the decoding device through a network or a storage medium.

[0431] In addition, the encoding device may encode the image information derived through the above steps S1000 to S1030, and may output the encoded image information in the form of a bitstream. For example, merge flag information, merge index information, L0 reference picture index, L1 reference picture index, L0 luminance weight prediction flag information, L1 luminance weight prediction flag information, and dual prediction weight index information may be included in the image information to be encoded, and the image information encoded in this way may be signaled to the decoding device.

[0432] Fig.11 is a flowchart schematically illustrating a decoding method performed by a decoding device according to an embodiment of the present document.

[0433] Fig.11 The method disclosed in can be Figure 3 Specifically, Fig.11 Steps S1100 to S1110 may be performed by Figure 3 The predictor 330 and the inter-frame predictor 332 disclosed in Fig.11 Step S1120 may be performed by Figure 3 Further, Fig.11 The method disclosed in the invention may include the above-mentioned embodiments in this document. Therefore, the above-mentioned embodiments will be omitted or simplified. Fig.11 A detailed description of the contents repeated in the above embodiments.

[0434] Reference Fig.11 , the decoding apparatus may derive an L0 motion vector and an L1 motion vector of the current block ( S1100 ).

[0435] As an embodiment, the decoding device may determine the prediction mode of the current block based on the prediction information signaled from the encoding device. In addition, the decoding device may derive motion information (motion vector, reference picture index, etc.) of the current block based on the prediction mode. Here, the prediction mode may include skip mode, merge mode, (A) MVP mode, etc.

[0436] For example, the decoding device may configure a merge candidate list based on neighboring blocks of the current block, and when the merge mode is applied to the current block, one of the merge candidates included in the merge candidate list may be selected. In this case, a merge candidate may be selected from the merge candidate list based on the above-mentioned merge index information (merge index). The decoding device may use the motion information of the selected merge candidate to derive the motion information of the current block. That is, among the merge candidates included in the merge candidate list, the motion information of the merge candidate selected by the merge index may be used as the motion information of the current block.

[0437] Here, the motion information may include information such as a motion vector, a reference picture index, etc., and may include L0 motion information and / or L1 motion information depending on the inter prediction type (L0 prediction, L1 prediction, Bi prediction, etc.). When dual prediction is applied to the current block, the motion information may include a motion vector in the L0 direction (L0 motion vector) and a motion vector in the L1 direction (L1 motion vector). In addition, the motion information may include an L0 reference picture index and an L0 reference picture indicated by the L0 reference picture index in an L0 reference picture list, and an L1 reference picture index and an L1 reference picture indicated by the L1 reference picture index in an L1 reference picture list.

[0438] That is, when the merge mode is applied, the decoding apparatus may derive the L0 motion vector and the L1 motion vector of the neighboring block indicated by the merge index information among the neighboring blocks of the current block, and may use them as the L0 and L1 motion vectors of the current block.

[0439] The decoding apparatus may derive a prediction sample of the current block based on the L0 motion vector and the L1 motion vector ( S1110 ).

[0440] In this case, when deriving the prediction sample, the decoding device may determine whether to apply BDOF to the current block based on the coding efficiency, complexity, and prediction performance. That is, the encoding device may apply BDOF to the current block based on whether the application conditions of BDOF for the current block are met. Here, the application conditions of BDOF may be composed of some (or all) of the various application conditions described in Tables 1 to 39 above or a specific combination thereof. In addition, the decoding device may derive BDOF flag information based on whether the application conditions of BDOF are met. The BDOF flag information may be information related to whether BDOF is applied to the current block (e.g., the above-mentioned bdofFlag).

[0441] As an embodiment, the application condition of BDOF may include a condition that both the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are equal to 0.

[0442] Here, the L0 luminance weight prediction flag information may be luma_weight_l0_flag in Tables 33 to 36 as described above, and may be information related to a weight factor of L0 prediction indicating whether there is a luminance component of the current block. The L1 luminance weight prediction flag information may be luma_weight_l1_flag in Tables 33 to 36 as described above, and may be information related to a weight factor of L1 prediction indicating whether there is a luminance component of the current block. For example, a case where the value of the L0 luminance weight prediction flag information is equal to 0 may indicate that there is no weight factor for the luminance component of the L0 prediction, and a case where the value of the L0 luminance weight prediction flag information is equal to 1 may indicate that there is a weight factor for the luminance component of the L0 prediction. Further, a case where the value of the L1 luminance weight prediction flag information is equal to 0 may indicate that there is no weight factor for the luminance component of the L1 prediction, and a case where the value of the L1 luminance weight prediction flag information is equal to 1 may indicate that there is a weight factor for the luminance component of the L1 prediction.

[0443] That is, if the condition that the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are both equal to 0 is satisfied, the decoding device may derive a value (e.g., 1 or true) related to indicating that BDOF is applied to the current block as the BDOF flag information. If at least one of the L0 luminance weight prediction flag information and the L1 luminance weight prediction flag information is not equal to 0, the decoding device may derive a value (e.g., 0 or false) related to indicating that BDOF is not applied to the current block as the BDOF flag information.

[0444] Further, as an embodiment, the application condition of BDOF may include a condition that both the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are equal to 0.

[0445] Here, the L0 chroma weight prediction flag information may be chroma_weight_l0_flag in Tables 33 to 36 as described above, and may be information related to the weight factor indicating whether there is an L0 prediction of the chroma component of the current block. The L1 chroma weight prediction flag information may be chroma_weight_l1_flag in Tables 33 to 36 as described above, and may be information related to the weight factor indicating whether there is an L1 prediction of the chroma component of the current block. For example, the case where the value of the L0 chroma weight prediction flag information is equal to 0 may indicate that there is no weight factor for the chroma component for L0 prediction, and the case where the value of the L0 chroma weight prediction flag information is equal to 1 may indicate that there is a weight factor for the chroma component for L0 prediction. Further, the case where the value of the L1 chroma weight prediction flag information is equal to 0 may indicate that there is no weight factor for the chroma component for L1 prediction, and the case where the value of the L1 chroma weight prediction flag information is equal to 1 may indicate that there is a weight factor for the chroma component for L1 prediction.

[0446] That is, if the condition that the value of the L0 chroma weight prediction flag information and the value of the L1 chroma weight prediction flag information are both equal to 0 is satisfied, the decoding device may derive a value (e.g., 1 or true) related to indicating that BDOF is applied to the current block as the BDOF flag information. If at least one of the L0 chroma weight prediction flag information and the L1 chroma weight prediction flag information is not equal to 0, the decoding device may derive a value (e.g., 0 or false) related to indicating that BDOF is not applied to the current block as the BDOF flag information.

[0447] In addition, according to an embodiment, the application condition of BDOF may include at least one of the following: 1) a condition that BDOF-based inter prediction is enabled, 2) a condition that dual prediction performed based on an L0 reference picture and an L1 reference picture is applied to the current block, 3) a condition that the difference with the L0 reference picture and the difference with the L1 reference picture based on the current picture are equal to each other, 4) a condition that the value of the dual prediction weight index information of the current block is equal to 0, 5) a condition that the affine mode is not applied to the current block, 6) a condition that the sub-block-based merge mode is not applied to the current block, 7) a condition that the prediction mode combining inter prediction and intra prediction is not applied to the current block, 8) a condition that the height of the current block is equal to or greater than 8, 9) a condition that the width of the current block is equal to or greater than 8, 10) a condition that the height x width of the current block is greater than 8x8, or 11) a condition that the current block is a luminance component. In this case, the decoding device may derive the BDOF flag information based on at least one of the conditions 1) to 11) as described above. For example, if all the conditions 1) to 11) above (or at least one of 1 to 11 above) are met together with the condition that both the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are equal to 0 and / or the condition that both the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are equal to 0, the decoding device may export the value of the BDOF flag information as true or 1; otherwise, the decoding device may export the value of the BDOF flag information as false or 0.

[0448] Here, when deriving the BDOF flag information, the listed BDOF application conditions are merely exemplary, and the conditions in Tables 1 to 39 as described above may be variously combined and used.

[0449] If the BDOF flag information indicates that BDOF is applied to the current block (eg, if the BDOF flag information is derived as a true or 1 value), the decoding apparatus may derive a prediction sample by applying BDOF to the current block.

[0450] As an embodiment, the decoding device may derive the L0 prediction samples of the current block and the L1 prediction samples of the current block. In addition, the decoding device may derive the gradient for the L0 prediction samples and the gradient for the L1 prediction samples. Further, the decoding device may finally derive the prediction samples of the current block based on the L0 prediction samples, the L1 prediction samples, the gradient of the L0 prediction samples, and the gradient of the L1 prediction samples. Here, the L0 prediction samples may be derived based on the reference samples indicated by the L0 motion vector in the L0 reference picture, and the L1 prediction samples may be derived based on the reference samples indicated by the L1 motion vector in the L1 reference picture.

[0451] According to an embodiment, the decoding device may determine whether to apply DMVR to the current block in consideration of coding efficiency, complexity, and prediction performance. That is, the decoding device may apply DMVR to the L0 motion vector and the L1 motion vector based on whether the application condition for applying DMVR to the current block is satisfied. Here, the application condition of DMVR may be composed of some (or all) of the various application conditions described in Tables 1 to 39 above or a specific combination thereof. In addition, the decoding device may derive DMVR flag information based on whether the application condition of DMVR is satisfied. The DMVR flag information may be information related to whether DMVR is applied to the current block (e.g., the above-mentioned dmvrFlag).

[0452] As an embodiment, the application condition of DMVR may include a condition that both the value of the L0 luma weight prediction flag information and the value of the L1 luma weight prediction flag information are equal to 0. In this case, as in the application condition of BDOF described above, when the case where the L0 luma weight prediction flag information indicates that there is no weight factor for the luma component of L0 prediction (e.g., luma_weight_l0_flag is equal to 0) and the case where the L1 luma weight prediction flag information indicates that there is no weight factor for the luma component of L1 prediction (e.g., luma_weight_l1_flag is equal to 0) are satisfied, the decoding device may derive a value (e.g., 1 or true) associated with indicating that DMVR is applied to the current block (i.e., the L0 motion vector and the L1 motion vector) as the DMVR flag information. In addition, when at least one of the L0 luma weight prediction flag information and the L1 luma weight prediction flag information is not equal to 0, the decoding device may derive a value (e.g., 0 or false) associated with indicating that DMVR is not applied to the current block as the DMVR flag information.

[0453] Further, as an embodiment, the application condition of DMVR may include a condition that both the value of the L0 chroma weight prediction flag information and the value of the L1 chroma weight prediction flag information are equal to 0. In this case, as in the application condition of BDOF described above, when the case where the L0 chroma weight prediction flag information indicates that there is no weight factor for the chroma component of L0 prediction (e.g., chroma_weight_l0_flag is equal to 0) and the case where the L1 chroma weight prediction flag information indicates that there is no weight factor for the chroma component of L1 prediction (e.g., chroma_weight_l1_flag is equal to 0) are satisfied, the decoding device may derive a value (e.g., 1 or true) related to an indication that DMVR is applied to the current block (i.e., the L0 motion vector and the L1 motion vector) as the DMVR flag information. In addition, when at least one of the L0 chroma weight prediction flag information and the L1 chroma weight prediction flag information is not equal to 0, the decoding device may derive a value (e.g., 0 or false) related to an indication that DMVR is not applied to the current block as the DMVR flag information.

[0454] Further, the application condition of DMVR may include a condition that the value of the dual prediction weight index information of the current block is 0. Here, the dual prediction weight index information may represent the above-mentioned GbiIdx, and if the value of the dual prediction weight index information (e.g., GbiIdx) is equal to 0, it may be a default value that does not apply different weight values ​​to L0 prediction and L1 prediction. For example, as shown in Table 3, the case where the value of the dual prediction weight index information is equal to 0 may be a case where a weight value of 1 / 2 is applied to L0 prediction and L1 prediction, respectively. That is, in this case, if the value of the dual prediction weight index information is equal to 0, the decoding device may derive a value (e.g., 1 or true) associated with an indication that DMVR is applied to the current block (i.e., L0 motion vector and L1 motion vector) as DMVR flag information. In addition, if the value of the dual prediction weight index information is not equal to 0, the decoding device may derive a value (e.g., 0 or false) associated with an indication that DMVR is not applied to the current block as DMVR flag information.

[0455] In addition, according to an embodiment, the application condition of DMVR may include at least one of the following: 1) a condition that inter-frame dual prediction based on DMVR is enabled, 2) a condition that dual prediction performed based on an L0 reference picture and an L1 reference picture is applied to the current block, 3) a condition that a difference with the L0 reference picture and a difference with the L1 reference picture based on the current picture are equal to each other, 4) a condition that a merge mode is applied to the current block, 5) a condition that a merge mode with a motion vector difference (MMVD) mode is not applied to the current block, 6) a condition that a prediction mode combining inter-frame prediction and intra-frame prediction is not applied to the current block, 7) a condition that a height of the current block is equal to or greater than 8, 8) a condition that a width of the current block is equal to or greater than 8, or 9) a condition that a height x width of the current block is greater than 8x8. In this case, the decoding device may derive DMVR flag information based on at least one of the conditions 1) to 9) as described above. For example, if all of the above conditions 1) to 9) are met (or at least one of the above 1 to 9) together with the condition that both the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are equal to 0, the condition that both the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are equal to 0, and the condition that the value of the dual prediction weight index information is equal to 0, the decoding device can export the value of the DMVR flag information as true or 1; otherwise, the decoding device can export the value of the DMVR flag information as false or 0.

[0456] Here, when exporting DMVR flag information, the listed DMVR application conditions are merely exemplary, and the conditions in Tables 1 to 39 as described above may be variously combined and used.

[0457] If the DMVR flag information indicates that DMVR is applied to the L0 motion vector and the L1 motion vector (eg, if the DMVR flag information is derived as a true or 1 value), the decoding apparatus may derive a modified L0 motion vector and a modified L1 motion vector by applying DMVR to the current block.

[0458] As an embodiment, the decoding device may calculate the minimum sum of absolute differences (SAD) based on the reference samples (i.e., L0 prediction samples) in the L0 reference picture derived based on the L0 motion vector and the reference samples (i.e., L1 prediction samples) in the L1 reference picture derived based on the L1 motion vector. In addition, the decoding device may derive a modified L0 motion vector for the L0 motion vector and a modified L1 motion vector for the L1 motion vector based on the sample position corresponding to the minimum SAD.

[0459] That is, the modified L0 motion vector may be a motion vector associated with a sample position indicating a minimum SAD corresponding to the L0 reference picture, and the modified L1 motion vector may be a motion vector associated with a sample position indicating a minimum SAD corresponding to the L1 reference picture. Figure 4 and 5 The process of deriving a modified motion vector by applying DMVR is described in detail, and its description is omitted hereinafter.

[0460] As described above, in the case where DMVR is applied to the L0 motion vector and the L1 motion vector, the decoding device can derive a prediction sample based on the modified L0 motion vector and the modified L1 motion vector. In addition, depending on whether the application condition of BDOF is met, the decoding device can even apply BDOF to the prediction sample derived based on the modified L0 motion vector and the modified L1 motion vector.

[0461] The decoding apparatus may generate a reconstructed sample for the current block based on the prediction sample ( S1120 ).

[0462] As an embodiment, the decoding device may use the predicted samples directly as reconstructed samples according to the prediction mode, or may generate reconstructed samples by adding residual samples to the predicted samples.

[0463] If the residual sample of the current block exists, the decoding device may receive information about the residual of the current block. The information about the residual may include a transform coefficient about the residual sample. The decoding device may derive the residual sample (or residual sample array) for the current block based on the residual information. The decoding device may generate a reconstructed sample based on the predicted sample and the residual sample, and may derive a reconstructed block or a reconstructed picture based on the reconstructed sample.

[0464] In the above-mentioned embodiments, although these methods have been described based on flowcharts in the form of a series of steps or units, the embodiments of the present disclosure are not limited to the order of these steps, and some of these steps may be performed in an order different from the order of other steps or may be performed simultaneously with other steps. In addition, it will be understood by those skilled in the art that the steps shown in the flowchart are not exclusive, and without affecting the scope of the rights of the present disclosure, these steps may include additional steps or one or more steps in the flowchart may be deleted.

[0465] The above-mentioned method according to the present disclosure may be implemented in the form of software, and the encoding device and / or decoding device according to the present disclosure may be included in a device for performing image processing, such as a TV, a computer, a smart phone, a set-top box, or a display device.

[0466] In the present disclosure, when the embodiments are implemented in software form, the above-mentioned methods can be implemented as modules (programs, functions, etc.) for performing the above-mentioned functions. The modules can be stored in a memory and executed by a processor. The memory can be arranged inside or outside the processor and connected to the processor by various well-known means. The processor may include an application-specific integrated circuit (ASIC), other chipsets, logic circuits, and / or data processing devices. The memory may include a read-only memory (ROM), a random access memory (RAM), a flash memory, a memory card, a storage medium, and / or other storage devices. That is, the embodiments described in the present disclosure can be implemented and executed on a processor, a microprocessor, a controller, or a chip. For example, the functional units illustrated in the figure can 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 such implementation can be stored in a digital storage medium.

[0467] In addition, the decoding device and the encoding device to which the present disclosure is applied may be included in multimedia broadcast sending and receiving devices, mobile communication terminals, home theater video devices, digital theater video devices, surveillance cameras, video chat devices, real-time communication devices such as video communication, mobile streaming devices, storage media, cameras, video on demand (VoD) service providing devices, over-the-top (OTT) video devices, Internet streaming service providing devices, three-dimensional (3D) video devices, virtual reality (VR) devices, augmented reality (AR) devices, video phone devices, transportation means terminals (e.g., vehicle (including autonomous vehicle) terminals, aircraft terminals, and ship terminals) and medical video devices, and may be used to process video signals or data signals. For example, over-the-top (OTT) video devices may include game consoles, Blue-ray players, Internet access TVs, home theater systems, smart phones, tablet PCs, and digital video recorders (DVRs).

[0468] In addition, the processing method of the present disclosure 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 present disclosure can also be stored in a computer-readable recording medium. Computer-readable recording media include all kinds of storage devices storing computer-readable data. Computer-readable recording media may include, for example, Blue-ray discs (BD), universal serial buses (USB), ROMs, PROMs, EPROMs, EEPROMs, RAMs, CD-ROMs, magnetic tapes, floppy disks, and optical data storage devices. In addition, computer-readable recording media include media implemented in the form of carrier waves (e.g., transmitted over the Internet). In addition, the bit stream generated using the encoding method can be stored in a computer-readable recording medium, or can be transmitted over a wired or wireless communication network.

[0469] In addition, the embodiments of the present disclosure may be implemented as a computer program product using program codes. The program codes may be executed by a computer according to the embodiments of the present disclosure. The program codes may be stored on a carrier wave that can be read by a computer.

[0470] Fig.12 An example of a content streaming system to which the embodiments disclosed in this document may be applied is illustrated.

[0471] Reference Fig.12 The content streaming transmission system to which the embodiments of this document are applied may basically include an encoding server, a streaming transmission server, a network server, a media storage, a user device, and a multimedia input device.

[0472] The encoding server compresses the content input from a multimedia input device such as a smart phone, a camera, a camcorder, etc. into digital data to generate a bit stream, and sends the bit stream to the streaming server. As another example, when a multimedia input device such as a smart phone, a camera, a camcorder, etc. directly generates a bit stream, the encoding server can be omitted.

[0473] A bitstream may be generated by applying the encoding method or the bitstream generating method of the embodiment of the present document, and the streaming server may temporarily store the bitstream in the process of transmitting or receiving the bitstream.

[0474] The streaming server sends multimedia data to the user device through the network server based on the user's request, and the network server is used as a medium to inform the user of the service. When the user requests the desired service from the network server, the network server transmits it 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 in the content streaming system.

[0475] The streaming server can receive content from a media storage and / or an encoding server. For example, when receiving content from an 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 bitstream for a predetermined time.

[0476] 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, head-mounted displays), digital TVs, desktop computers, digital signage, etc.

[0477] The various servers in the content streaming system may operate as distributed servers, wherein data received from the various servers may be distributed.

Claims

1. A decoding device for image decoding, the decoding 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: Derive the L0 motion vector and L1 motion vector of the current block; deriving a prediction sample for the current block based on the L0 motion vector and the L1 motion vector; and generating reconstructed samples for the current block based on the predicted samples, Wherein, based on whether the application condition of the decoder-side motion vector correction DMVR is met, the DMVR is applied to the current block, The application conditions of the DMVR include: the condition that the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are both equal to 0, and the condition that the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are both equal to 0, Wherein, based on whether the application condition of the bidirectional optical flow BDOF is met, the BDOF is applied to the current block, Among them, the application conditions of the BDOF include: the condition that the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are both equal to 0, the condition that the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are both equal to 0, the condition that the bidirectional prediction performed based on the L0 reference picture and the L1 reference picture is applied to the current block, the condition that the sub-block based merge mode is not applied to the current block, and the condition that the current block is a luminance component, Wherein, the case where the value of the L0 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for L0 prediction of the luminance component, and the case where the value of the L1 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for L1 prediction of the luminance component, and Among them, the case where the value of the L0 chrominance weight prediction flag information is equal to 0 indicates that there is no weight factor for L0 prediction of the chrominance component, and the case where the value of the L1 chrominance weight prediction flag information is equal to 0 indicates that there is no weight factor for L1 prediction of the chrominance component.

2. A coding device for image coding, the coding 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: Derive the L0 motion vector and L1 motion vector of the current block; deriving a prediction sample for the current block based on the L0 motion vector and the L1 motion vector; deriving residual samples based on the prediction samples; and encoding picture information, the picture information comprising information about the residual samples, Wherein, based on whether the application condition of the decoder-side motion vector correction DMVR is met, the DMVR is applied to the current block, The application conditions of the DMVR include: the condition that the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are both equal to 0, and the condition that the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are both equal to 0, Wherein, based on whether the application condition of the bidirectional optical flow BDOF is met, the BDOF is applied to the current block, Among them, the application conditions of the BDOF include: the condition that the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are both equal to 0, the condition that the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are both equal to 0, the condition that the bidirectional prediction performed based on the L0 reference picture and the L1 reference picture is applied to the current block, the condition that the sub-block based merge mode is not applied to the current block, and the condition that the current block is a luminance component, Wherein, the case where the value of the L0 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for L0 prediction of the luminance component, and the case where the value of the L1 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for L1 prediction of the luminance component, and Among them, the case where the value of the L0 chrominance weight prediction flag information is equal to 0 indicates that there is no weight factor for L0 prediction of the chrominance component, and the case where the value of the L1 chrominance weight prediction flag information is equal to 0 indicates that there is no weight factor for L1 prediction of the chrominance component.

3. A device for transmitting data for image information, the device comprising: at least one processor configured to obtain a bitstream of the image information, wherein the bitstream is generated based on: deriving an L0 motion vector and an L1 motion vector of a current block, deriving a prediction sample for the current block based on the L0 motion vector and the L1 motion vector, deriving a residual sample based on the prediction sample, and encoding the image information, the image information including information about the residual sample; and a transmitter configured to transmit the data including the bit stream, Wherein, based on whether the application condition of the decoder-side motion vector correction DMVR is met, the DMVR is applied to the current block, The application conditions of the DMVR include: the condition that the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are both equal to 0, and the condition that the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are both equal to 0, Wherein, based on whether the application condition of the bidirectional optical flow BDOF is met, the BDOF is applied to the current block, Among them, the application conditions of the BDOF include: the condition that the value of the L0 luminance weight prediction flag information and the value of the L1 luminance weight prediction flag information are both equal to 0, the condition that the value of the L0 chrominance weight prediction flag information and the value of the L1 chrominance weight prediction flag information are both equal to 0, the condition that the bidirectional prediction performed based on the L0 reference picture and the L1 reference picture is applied to the current block, the condition that the sub-block based merge mode is not applied to the current block, and the condition that the current block is a luminance component, Wherein, the case where the value of the L0 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for L0 prediction of the luminance component, and the case where the value of the L1 luminance weight prediction flag information is equal to 0 indicates that there is no weight factor for L1 prediction of the luminance component, and Among them, the case where the value of the L0 chrominance weight prediction flag information is equal to 0 indicates that there is no weight factor for L0 prediction of the chrominance component, and the case where the value of the L1 chrominance weight prediction flag information is equal to 0 indicates that there is no weight factor for L1 prediction of the chrominance component.