Image encoding / decoding method and apparatus based on AMVP merge mode, and recording medium storing bit stream

By using the amvpMerge mode and fallback merge candidate list in image encoding/decoding, the problem of low high-resolution image encoding/decoding efficiency is solved, and more efficient image transmission and storage is achieved.

CN119497989APending Publication Date: 2025-02-21LG ELECTRONICS INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380051842.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-07-11
Filing Date
2023-07-05
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

The prior art is difficult to effectively improve the encoding/decoding efficiency of high resolution and high-quality images, resulting in increased transmission and storage costs.

Method used

The image encoding/decoding method based on the amvpMerge mode is adopted to construct a fallback merge candidate list to improve the encoding/decoding efficiency.

Benefits of technology

Improved encoding/decoding efficiency is achieved, transmission and storage costs are reduced, and the bitstream generated is supported.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119497989A_ABST
    Figure CN119497989A_ABST
Patent Text Reader

Abstract

An image encoding / decoding method and apparatus are provided. An image decoding method disclosed herein may comprise the steps of: determining prediction modes respectively applied to a prediction direction of a current block, the prediction modes including an AMVP mode and a merge mode; forming an AMVP candidate list and a merge candidate list based on the prediction mode; and generating a prediction block of the current block based on the AMVP candidate list and a merge candidate list, where the merge candidate list includes a fallback candidate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to an image encoding / decoding method and device and a recording medium for storing a bit stream, and more specifically, to an image encoding and decoding method and device based on an amvpMerge mode and a recording medium for storing a bit stream generated by the image encoding method / device of the present disclosure. Background Art

[0002] Recently, the demand for high-resolution and high-quality images, such as high-definition (HD) images and ultra-high-definition (UHD) images, is increasing in various fields. As the resolution and quality of image data are improved, the amount of information or bit volume transmitted is relatively increased compared to existing image data. The increase in the amount of information or bit volume transmitted leads to an increase in transmission cost and storage cost.

[0003] Therefore, efficient image compression technology is needed to effectively transmit, store, and reproduce information about high-resolution and high-quality images. Summary of the invention

[0004] Technical issues

[0005] An object of the present disclosure is to provide an image encoding / decoding method and apparatus with improved encoding / decoding efficiency.

[0006] In addition, an object of the present disclosure is to provide an image encoding / decoding method and device that performs an amvpMerge mode.

[0007] In addition, an object of the present disclosure is to provide an image encoding / decoding method and device for constructing fallback merge candidates in amvpMerge mode.

[0008] In addition, an object of the present disclosure is to provide a non-transitory computer-readable recording medium storing a bit stream generated by the image encoding method or apparatus according to the present disclosure.

[0009] In addition, an object of the present disclosure is to provide a non-transitory computer-readable recording medium storing a bit stream received and decoded by the image decoding device according to the present disclosure and used to reconstruct an image.

[0010] In addition, an object of the present disclosure is to provide a method of transmitting a bit stream generated by the image encoding method or apparatus according to the present disclosure.

[0011] The technical problems solved by the present disclosure are not limited to the above-mentioned technical problems, and other technical problems not described here will be clear to those skilled in the art through the following description.

[0012] Technical Solution

[0013] According to an embodiment of the present disclosure, an image decoding method performed by an image decoding device may include the following steps: determining prediction modes respectively applied to prediction directions of a current block, the prediction modes including an AMVP mode and a merge mode; constructing an AMVP candidate list and a merge candidate list based on the prediction mode; and generating a prediction block of the current block based on the AMVP candidate list and the merge candidate list. The merge candidate list includes a fallback candidate.

[0014] According to an embodiment of the present disclosure, based on the fact that the number of merge candidates included in the merge candidate list is less than the maximum number of merge candidates, a fallback candidate may be included in the merge candidate list.

[0015] According to an embodiment of the present disclosure, based on the number of reference pictures included in the merge reference picture list being less than a predetermined value, a fallback candidate may be included in the merge candidate list.

[0016] According to an embodiment of the present disclosure, the predetermined value may be a smaller value between the number of reference pictures included in the merged reference picture list and the number of reference pictures included in the AMVP reference picture list.

[0017] According to an embodiment of the present disclosure, the predetermined value may be the number of reference pictures included in the merged reference picture list.

[0018] According to an embodiment of the present disclosure, based on the availability of reference pictures of the fallback candidates, the fallback candidates may be included in the merge candidate list.

[0019] According to an embodiment of the present disclosure, based on the number of merge candidates included in the merge candidate list being less than or equal to a predefined value, a fallback candidate may be included in the merge candidate list.

[0020] According to an embodiment of the present disclosure, an image encoding method performed by an image encoding device may include the following steps: determining prediction modes respectively applied to prediction directions of a current block, the prediction modes including an AMVP mode and a merge mode; constructing an AMVP candidate list and a merge candidate list based on the prediction mode; and generating a prediction block of the current block based on the AMVP candidate list and the merge candidate list. The merge candidate list may include a fallback candidate.

[0021] According to an embodiment of the present disclosure, in a method for transmitting a bitstream generated by an image encoding method, the image encoding method may include the following steps: determining prediction modes respectively applied to prediction directions of a current block, the prediction modes including an AMVP mode and a merge mode; constructing an AMVP candidate list and a merge candidate list based on the prediction mode; and generating a prediction block of the current block based on the AMVP candidate list and the merge candidate list. The merge candidate list may include a fallback candidate.

[0022] Beneficial Effects

[0023] According to the present disclosure, an image encoding / decoding method and apparatus with improved encoding / decoding efficiency may be provided.

[0024] In addition, according to the present disclosure, an image encoding / decoding method and apparatus for performing an amvpMerge mode may be provided.

[0025] In addition, according to the present disclosure, an image encoding / decoding method and device for constructing a fallback merge candidate in an amvpMerge mode may be provided.

[0026] In addition, according to the present disclosure, a non-transitory computer-readable recording medium storing a bit stream generated by the image encoding method or apparatus according to the present disclosure may be provided.

[0027] In addition, according to the present disclosure, there may be provided a non-transitory computer-readable recording medium storing a bit stream received and decoded by the image decoding apparatus according to the present disclosure and used to reconstruct an image.

[0028] In addition, according to the present disclosure, a method of transmitting a bit stream generated by the image encoding method or apparatus according to the present disclosure may be provided.

[0029] Those skilled in the art will understand that the effects that can be achieved through the present disclosure are not limited to what has been specifically described above, and other advantages of the present disclosure will be more clearly understood from the detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 FIG. 4 is a diagram schematically illustrating a video encoding system to which an embodiment of the present disclosure is applicable.

[0031] Figure 2 is a view schematically illustrating an image encoding device to which an embodiment of the present disclosure is applicable.

[0032] Figure 3 is a view schematically illustrating an image decoding device to which an embodiment of the present disclosure is applicable.

[0033] Figure 4 is a diagram schematically showing an inter-frame prediction unit of an image encoding device.

[0034] Figure 5 is a flowchart illustrating a method for encoding an image based on inter-frame prediction.

[0035] Figure 6 is a diagram schematically showing an inter-frame prediction unit of an image decoding device.

[0036] Figure 7is a flowchart illustrating a method of decoding an image based on inter-frame prediction.

[0037] Figure 8 is a flowchart illustrating an inter-frame prediction method.

[0038] Fig. 9 is a flowchart illustrating an image encoding method according to an embodiment of the present disclosure.

[0039] 10A to 10C are flowcharts illustrating a method of constructing a merge candidate list according to an embodiment of the present disclosure.

[0040] 11A to 11C are flowcharts illustrating a method of constructing a merge candidate list according to an embodiment of the present disclosure.

[0041] 12A to 12C are flowcharts illustrating a method of constructing a merge candidate list according to one embodiment of the present disclosure.

[0042] Fig.13 The present invention is a flowchart of a method for constructing fallback merge candidates according to an embodiment of the present disclosure.

[0043] Fig.14 is a diagram illustrating a content streaming system to which an embodiment of the present disclosure is applicable. DETAILED DESCRIPTION

[0044] Hereinafter, the embodiments of the present disclosure will be described in detail with reference to the accompanying drawings to facilitate implementation by those skilled in the art. However, the present disclosure can be implemented in various forms and is not limited to the embodiments described herein.

[0045] When describing the present disclosure, if it is determined that the detailed description of related known functions or configurations makes the scope of the present disclosure unnecessarily ambiguous, the detailed description thereof will be omitted. In the drawings, parts irrelevant to the description of the present disclosure are omitted, and like reference numerals are given to like parts.

[0046] In the present disclosure, when a component is "connected", "coupled" or "linked" to another component, it may include not only a direct connection relationship but also an indirect connection relationship with intermediate components. In addition, when a component "includes" or "has" other components, unless otherwise specified, it means that other components may also be included, rather than excluding other components.

[0047] In the present disclosure, the terms first, second, etc. are used only for the purpose of distinguishing one component from other components, and do not limit the order or importance of the components unless otherwise specified. Accordingly, within the scope of the present disclosure, a first component in one embodiment may be referred to as a second component in another embodiment, and similarly, a second component in one embodiment may be referred to as a first component in another embodiment.

[0048] In the present disclosure, components that are distinguished from each other are intended to clearly describe each feature and do not mean that the components must be separated. That is, multiple components can be integrated and implemented in one hardware or software unit, or one component can be distributed and implemented in multiple hardware or software units. Therefore, even if not specifically stated, implementations in which these components are integrated or distributed are also included in the scope of the present disclosure.

[0049] In the present disclosure, the components described in each embodiment are not necessarily indispensable components, and some components may be optional components. Therefore, the embodiments consisting of a subset of the components described in the embodiments are also included in the scope of the present disclosure. In addition, the embodiments including other components in addition to the components described in the various embodiments are included in the scope of the present disclosure.

[0050] The present disclosure relates to encoding and decoding of images. Unless otherwise defined in the present disclosure, terms used in the present disclosure may have general meanings commonly used in the technical field to which the present disclosure belongs.

[0051] In this disclosure, "video" may mean a collection of images over time.

[0052] In the present disclosure, a "picture" generally refers to a unit representing an image within a specific time period, and a slice / tile is a coding unit constituting a part of a picture, and a picture may be composed of one or more slices / tiles. In addition, a slice / tile may include one or more coding tree units (CTUs).

[0053] In the present disclosure, "pixel" or "pel" may refer to 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 pixel value, or may represent only a pixel / pixel value of a luminance component or only a pixel / pixel value of a chrominance component.

[0054] In the present disclosure, a "unit" may refer to a basic unit of image processing. The unit may include at least one of a specific area of ​​a picture and information related to the area. In some cases, the unit may be used interchangeably with terms such as "sample array", "block" or "area". In general, an M×N block may include M columns and N rows of samples (or sample arrays) or a set (or array) of transform coefficients.

[0055] In the present disclosure, "current block" may mean one of "current coding block", "current coding unit", "coding target block", "decoding target block" or "processing target block". When prediction is performed, "current block" may mean "current prediction block" or "prediction target block". When transform (inverse transform) / quantization (dequantization) is performed, "current block" may mean "current transform block" or "transform target block". When filtering is performed, "current block" may mean "filtering target block".

[0056] In addition, in the present disclosure, unless explicitly stated as a chroma block, a "current block" may mean a block including both a luma component block and a chroma component block or a "luma block of the current block". The luma component block of the current block may be represented by an explicit description including a luma component block such as "luma block" or "current luma block". In addition, a "chroma component block of the current block" may be represented by an explicit description including a chroma component block such as "chroma block" or "current chroma block".

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

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

[0059] In the present disclosure, "at least one of A, B, and C" may mean "only A", "only B", "only C", or "any and all combinations of A, B, and C". In addition, "at least one of A, B, or C" or "at least one of A, B and / or C" may mean "at least one of A, B, and C".

[0060] The brackets used in the present disclosure may mean "for example". For example, if "prediction (intra-frame prediction)" is indicated, "intra-frame prediction" may be proposed as an example of "prediction". In other words, "prediction" in the present disclosure is not limited to "intra-frame prediction", and "intra-frame prediction" may be proposed as an example of "prediction". In addition, even when "prediction (i.e., intra-frame prediction)" is indicated, "intra-frame prediction" may be proposed as an example of "prediction".

[0061] Overview of Video Coding Systems

[0062] Figure 1 is a diagram showing a video encoding system to which an embodiment of the present disclosure is applicable.

[0063] The video encoding system according to the embodiment may include an encoding device 10 and a decoding device 20. The encoding device 10 may deliver the encoded video and / or image information or data to the decoding device 20 via a digital storage medium or a network in the form of a file or a stream.

[0064] The encoding device 10 according to the embodiment may include a video source generator 11, an encoding unit (encoder) 12, and a transmitter 13. The decoding device 20 according to the embodiment may include a receiver 21, a decoding unit (decoder) 22, and a renderer 23. The encoding unit 12 may be referred to as a video / image encoding device, and the decoding unit 22 may be referred to as a video / image decoding device. The transmitter 13 may be included in the encoding unit 12. The receiver 21 may be included in the decoding unit 22. The renderer 23 may include a display and the display may be configured as a separate device or an external component.

[0065] The video source generator 11 can obtain the video / image by the process of capturing, synthesizing or generating the video / image. The video source generator 11 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 generate the video / image (electronically). 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 a process of generating relevant data.

[0066] The encoding unit 12 may encode the input video / image. For compression and encoding efficiency, the encoding unit 12 may perform a series of processes such as prediction, transformation, and quantization. The encoding unit 12 may output encoded data (encoded video / image information) in the form of a bitstream.

[0067] The transmitter 13 can obtain the coded video / image information or data output in the form of a bit stream in the form of a file or stream through a digital storage medium or a network and forward it to the receiver 21 of the decoding device 20 or another external object. The digital storage medium may include various storage media, such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, etc. The transmitter 13 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 transmitter 13 may be provided as a transmitting device separated from the encoding device 10, and in this case, the transmitting device may include at least one processor that obtains the coded video / image information or data output in the form of a bit stream and a transmitting unit that transmits it in the form of a file or stream. The receiver 21 may extract / receive the bit stream from the storage medium or the network and transmit the bit stream to the decoding unit 22.

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

[0069] The renderer 23 may render the decoded video / image. The rendered video / image may be displayed through a display.

[0070] Overview of Image Coding Equipment

[0071] Figure 2 is a view schematically showing an image encoding device to which an embodiment of the present disclosure is applicable.

[0072] like Figure 2 As shown, the image encoding device 100 may include an image segmenter 110, a subtractor 115, a transformer 120, a quantizer 130, a dequantizer 140, an inverse transformer 150, an adder 155, a filter 160, a memory 170, an inter-frame prediction unit 180, an intra-frame prediction unit 185, and an entropy encoder 190. The inter-frame prediction unit 180 and the intra-frame prediction unit 185 may be collectively referred to as a "prediction unit". The transformer 120, the quantizer 130, the dequantizer 140, and the inverse transformer 150 may be included in a residual processor. The residual processor may also include a subtractor 115.

[0073] In some embodiments, all or at least some of the components configuring the image encoding apparatus 100 may be configured by one hardware component (eg, an encoder or a processor). In addition, the memory 170 may include a decoded picture buffer (DPB) and may be configured by a digital storage medium.

[0074] The image segmenter 110 may segment the input image (or picture or frame) input to the image encoding device 100 into one or more processing units. For example, the processing unit may be referred to as a coding unit (CU). The coding unit may be obtained by recursively segmenting a coding tree unit (CTU) or a maximum coding unit (LCU) according to a quadtree binary tree ternary tree (QT / BT / TT) structure. For example, a coding unit may be segmented into a plurality of coding units of a deeper depth based on a quadtree structure, a binary tree structure, and / or a ternary tree structure. For the segmentation of the coding unit, the quadtree structure may be applied first, and then the binary tree structure and / or the ternary tree structure may be applied. The encoding process according to the present disclosure may be performed based on the final coding unit that is no longer segmented. The maximum coding unit may be used as the final coding unit, and the coding unit of a deeper depth obtained by segmenting the maximum coding unit may also be used as the final coding unit. Here, the encoding process may include the prediction, transformation, and reconstruction processes described later. As another example, the processing unit of the encoding process may be a prediction unit (PU) or a transformation unit (TU). The prediction unit and the transform unit may be divided or partitioned from the final coding unit. The prediction unit may be a sample prediction unit, and the transform unit may be a unit for deriving a transform coefficient and / or a unit for deriving a residual signal from the transform coefficient.

[0075] The prediction unit (inter prediction unit 180 or intra prediction unit 185) may perform prediction on the block to be processed (current block) and generate a prediction block including prediction samples of the current block. The prediction unit may determine whether to apply intra prediction or inter prediction based on the current block or CU. The prediction unit may generate various information related to the prediction of the current block and transmit the generated information to the entropy encoder 190. The information about the prediction may be encoded in the entropy encoder 190 and output in the form of a bitstream.

[0076] The intra prediction unit (intra predictor) 185 can predict the current block by referring to the samples in the current picture. Depending on the intra prediction mode and / or intra prediction technology, the reference samples can be located in the neighbors of the current block or can be placed separately. The intra prediction mode may include multiple non-directional modes and multiple 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 according to the settings. The intra prediction unit 185 may determine the prediction mode applied to the current block by using the prediction mode applied to the neighboring blocks.

[0077] The inter prediction unit (inter predictor) 180 may derive a prediction block of the current block based on a reference block (reference sample array) specified by a motion vector on a reference picture. In this case, in order to reduce the amount of motion information transmitted in the inter prediction mode, the motion information 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 prediction direction (L0 prediction, L1 prediction, dual prediction, etc.) information. In the case of inter prediction, the neighboring blocks may include spatial neighboring blocks present in the current picture and temporal neighboring blocks present in the reference picture. The reference picture including the reference block and the reference picture including the temporal neighboring block may be the same or different. The temporal neighboring block may be referred to as a collocated reference block, a collocated CU (colCU), etc. The reference picture including the temporal neighboring block may be referred to as a collocated picture (colPic). For example, the inter prediction unit 180 may construct 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 prediction may be performed based on various prediction modes. For example, in the case of skip mode and merge mode, the inter prediction unit 180 may use the motion information of the neighboring block as the motion information of the current block. In the case of skip mode, unlike the merge mode, the residual signal may not be transmitted. In the case of motion vector prediction (MVP) mode, the motion vector of the neighboring block may be used as a motion vector predictor, and the motion vector of the current block may be signaled by encoding the motion vector difference and an indicator of the motion vector predictor. The motion vector difference may mean the difference between the motion vector of the current block and the motion vector predictor.

[0078] The prediction unit may generate a prediction signal based on various prediction methods and prediction techniques described below. For example, the prediction unit may not only apply intra prediction or inter prediction, but may also apply intra prediction and inter prediction simultaneously to predict the current block. The prediction method of applying both intra prediction and inter prediction simultaneously to predict the current block may be referred to as combined inter and intra prediction (CIIP). In addition, the prediction unit may perform intra block copying (IBC) to predict the current block. Intra block copying may be used for content image / video encoding of games, etc., such as screen content coding (SCC). IBC is a method of predicting the current picture using a previously reconstructed reference block in the current picture at a position separated by a predetermined distance from the current block. When IBC is applied, the position of the reference block in the current picture may be encoded as a vector (block vector) corresponding to a predetermined distance. IBC basically performs prediction in the current picture, but may be performed similarly to inter prediction because the reference block is derived within the current picture. That is, IBC may use at least one inter prediction technique described in the present disclosure.

[0079] The prediction signal generated by the prediction unit can be used to generate a reconstruction signal or to generate a residual signal. The subtractor 115 can generate a residual signal (residual block or residual sample array) by subtracting the prediction signal (prediction block or prediction sample array) output from the prediction unit from the input image signal (original block or original sample array). The generated residual signal can be transmitted to the transformer 120.

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

[0081] The quantizer 130 may quantize the transform coefficients and transmit them to the entropy encoder 190. The entropy encoder 190 may encode the quantized signal (information about the quantized transform coefficients) and output a bitstream. The information about the quantized transform coefficients may be referred to as residual information. The quantizer 130 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.

[0082] The entropy encoder 190 may perform various encoding methods, such as exponential Golomb, context adaptive variable length coding (CAVLC), context adaptive binary arithmetic coding (CABAC), etc. The entropy encoder 190 may encode information required for video / image reconstruction other than quantized transform coefficients together or separately (e.g., values ​​of syntax elements, etc.). The encoded information (e.g., encoded video / image information) may be transmitted or stored in units of a network abstraction layer (NAL) in the form of a bitstream. The video / image information may also include information about various parameter sets, such as an adaptive parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). In addition, the video / image information may also include general constraint information. The signaled information, transmitted information, and / or syntax elements described in the present disclosure may be encoded and included in a bitstream through the above-described encoding process.

[0083] The bitstream may be transmitted over a network or may be stored in a digital storage medium. The network may include a broadcast network and / or a communication network, 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) for transmitting a signal output from the entropy encoder 190 and / or a storage unit (not shown) for storing the signal may be included as an internal / external element of the image encoding device 100. Alternatively, a transmitter may be provided as a component of the entropy encoder 190.

[0084] The quantized transform coefficients output from the quantizer 130 may be used to generate a residual signal. For example, the residual signal (residual block or residual sample) may be reconstructed by applying dequantization and inverse transformation to the quantized transform coefficients through the dequantizer 140 and the inverse transformer 150.

[0085] The adder 155 adds the reconstructed residual signal to the prediction signal output from the inter-frame prediction unit 180 or the intra-frame prediction unit 185 to generate a reconstructed signal (reconstructed picture, reconstructed block, reconstructed sample array). If the block to be processed has no residual, such as when the skip mode is applied, the prediction block can be used as a reconstructed block. The adder 155 can be called a reconstructor or a reconstructed block generator. The generated reconstructed signal can be used for intra-frame prediction of the next block to be processed in the current picture, and can be used for inter-frame prediction of the next picture by filtering as described below.

[0086] Furthermore, luminance mapping with chroma scaling (LMCS) is applied during picture coding and / or reconstruction.

[0087] The filter 160 can improve the subjective / objective image quality by applying filtering to the reconstructed signal. For example, the filter 160 can generate a modified reconstructed picture by applying various filtering methods to the reconstructed picture, and store the modified reconstructed picture in the memory 170, specifically, in the DPB of the memory 170. Various filtering methods may include, for example, deblocking filtering, sample adaptive offset, adaptive loop filtering, bilateral filtering, etc. The filter 160 can generate various information related to filtering and transmit the generated information to the entropy encoder 190, as described later in the description of each filtering method. The information related to filtering can be encoded by the entropy encoder 190 and output in the form of a bit stream.

[0088] The modified reconstructed picture transferred to the memory 170 may be used as a reference picture in the inter prediction unit 180. When inter prediction is applied by the image encoding apparatus 100, prediction mismatch between the image encoding apparatus 100 and the image decoding apparatus may be avoided and encoding efficiency may be improved.

[0089] The DPB of the memory 170 may store the modified reconstructed picture for use as a reference picture in the inter-frame prediction unit 180. The memory 170 may store the motion information of the block from which the motion information in the current picture is derived (or encoded) and / or the motion information of the reconstructed block in the picture. The stored motion information may be transmitted to the inter-frame prediction unit 180 and used as the motion information of the spatial neighboring block or the motion information of the temporal neighboring block. The memory 170 may store the reconstructed samples of the reconstructed blocks in the current picture and may transmit the reconstructed samples to the intra-frame prediction unit 185.

[0090] Overview of Image Decoding Equipment

[0091] Figure 3 is a view schematically showing an image decoding device to which an embodiment of the present disclosure is applicable.

[0092] like Figure 3 As shown, the image decoding device 200 may include an entropy decoder 210, a dequantizer 220, an inverse transformer 230, an adder 235, a filter 240, a memory 250, an inter-frame prediction unit 260, and an intra-frame prediction unit 265. The inter-frame prediction unit (inter-frame predictor) 260 and the intra-frame prediction unit (intra-frame predictor) 265 may be collectively referred to as a "prediction unit (predictor)". The dequantizer 220 and the inverse transformer 230 may be included in a residual processor.

[0093] According to an embodiment, all or at least some of the plurality of components configuring the image decoding apparatus 200 may be configured by hardware components (eg, a decoder or a processor). In addition, the memory 250 may include a decoded picture buffer (DPB) or may be configured by a digital storage medium.

[0094] The image decoding device 200 having received a bit stream including video / image information may perform the same Figure 2 The image encoding device 100 may reconstruct the image by processing corresponding to the processing performed by the image encoding device 100. For example, the image decoding device 200 may perform decoding using a processing unit applied in the image encoding device. Therefore, the processing unit of decoding may be, for example, a coding unit. The coding unit may be obtained by partitioning the coding tree unit or the maximum coding unit. The reconstructed image signal decoded and output by the image decoding device 200 may be reproduced by a reproduction device (not shown).

[0095] The image decoding device 200 may receive the image in the form of a bit stream from Figure 2The received signal may be decoded by the entropy decoder 210. For example, the entropy decoder 210 may 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 an adaptive parameter set (APS), a picture parameter set (PPS), a sequence parameter set (SPS), or a video parameter set (VPS). In addition, the video / image information may also include general constraint information. The image decoding device may also decode the picture based on the information about the parameter set and / or the general constraint information. The information and / or syntax elements signaled / received described in the present disclosure may be decoded and obtained from the bitstream through a decoding process. For example, the entropy decoder 210 may decode the information in the bitstream based on a coding method such as exponential Golomb coding, CAVLC, or CABAC, and output the values ​​of the syntax elements required for image reconstruction and the quantized values ​​of the transform coefficients of the residual. More specifically, the CABAC entropy decoding method can receive a bin corresponding to each syntax element in the bitstream, use the decoding target syntax element information, the decoding information of the neighboring block and the decoding target block, or the information of the symbol / bin decoded in the previous stage to determine the context model, perform arithmetic decoding on the bin by predicting the probability of occurrence of the bin according to the determined context model, and generate a symbol corresponding to the value of each syntax element. In this case, the CABAC entropy decoding method can update the context model by using the information of the decoded symbol / bin for the context model of the next symbol / bin after determining the context model. The information related to the prediction in the information decoded by the entropy decoder 210 can be provided to the prediction unit (inter-frame prediction unit 260 and intra-frame prediction unit 265), and the residual value of the entropy decoding performed on it in the entropy decoder 210, that is, the quantized transform coefficient and the related parameter information can be input to the dequantizer 220. In addition, the information about filtering in the information decoded by the entropy decoder 210 can be provided to the filter 240. In addition, a receiver (not shown) for receiving a signal output from the image encoding apparatus may be further configured as an internal / external element of the image decoding apparatus 200 , or the receiver may be a component of the entropy decoder 210 .

[0096] In addition, the image decoding device according to the present disclosure may be referred to as a video / image / picture decoding device. The image 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 an entropy decoder 210. The sample decoder may include a dequantizer 220, an inverse transformer 230, an adder 235, a filter 240, a memory 250, an inter-frame prediction unit 260, or at least one of an intra-frame prediction unit 265.

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

[0098] The inverse transformer 230 may inversely transform the transform coefficients to obtain a residual signal (residual block, residual sample array).

[0099] The prediction unit may perform prediction on the current block and generate a prediction block including prediction samples of the current block. The prediction unit may determine whether to apply intra prediction or inter prediction to the current block based on the information about prediction output from the entropy decoder 210, and may determine a specific intra / inter prediction mode (prediction technique).

[0100] The same as described in the prediction unit of the image encoding device 100 , the prediction unit can generate a prediction signal based on various prediction methods (techniques) described later.

[0101] The intra prediction unit 265 may predict the current block by referring to samples in the current picture. The description of the intra prediction unit 185 is also applicable to the intra prediction unit 265.

[0102] The inter-frame prediction unit 260 can derive the prediction block of the current block based on the reference block (reference sample array) specified by the motion vector on the reference picture. In this case, in order to reduce the amount of motion information transmitted in the inter-frame prediction mode, the motion information can be predicted in units of blocks, sub-blocks or samples based on the correlation of the motion information between the neighboring blocks and the current block. The motion information may include a motion vector and a reference picture index. The motion information may also include inter-frame prediction direction (L0 prediction, L1 prediction, 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 prediction unit 260 may configure a motion information candidate list based on the neighboring blocks, and derive the motion vector and / or reference picture index of the current block based on the received candidate selection information. Inter-frame prediction may be performed based on various prediction modes, and information about the prediction may include information indicating the inter-frame prediction mode of the current block.

[0103] The adder 235 can generate a reconstruction 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 prediction unit (including the inter-frame prediction unit 260 and / or the intra-frame prediction unit 265). If the block to be processed has no residual (for example, when the skip mode is applied), the prediction block can be used as a reconstructed block. The description of the adder 155 also applies to the adder 235. The adder 235 can be called a reconstructor or a reconstructed block generator. The generated reconstruction signal can be used for intra-frame prediction of the next block to be processed in the current picture, and can be used for inter-frame prediction of the next picture by filtering as described below.

[0104] The filter 240 can improve the subjective / objective image quality by applying filtering to the reconstructed signal. For example, the filter 240 can generate a modified reconstructed picture by applying various filtering methods to the reconstructed picture, and store the modified reconstructed picture in the memory 250, specifically, in the DPB of the memory 250. The various filtering methods may include, for example, deblocking filtering, sample adaptive offset, adaptive loop filtering, bilateral filtering, etc.

[0105] The (modified) reconstructed picture stored in the DPB of the memory 250 may be used as a reference picture in the inter-frame prediction unit 260. The memory 250 may store the motion information of the block from which the motion information in the current picture is derived (or decoded) and / or the motion information of the reconstructed block in the picture. The stored motion information may be transmitted to the inter-frame prediction unit 260 to be used as the motion information of the spatial neighboring block or the motion information of the temporal neighboring block. The memory 250 may store the reconstructed samples of the reconstructed block in the current picture and transmit the reconstructed samples to the intra-frame prediction unit 265.

[0106] In the present disclosure, the implementations described in the filter 160, the inter-frame prediction unit 180 and the intra-frame prediction unit 185 of the image encoding device 100 can be equally or correspondingly applied to the filter 240, the inter-frame prediction unit 260 and the intra-frame prediction unit 265 of the image decoding device 200.

[0107] Inter prediction

[0108] The prediction unit of the image encoding device 100 and the image decoding device 200 may derive a prediction sample by performing inter-frame prediction on a per-block basis. Inter-frame prediction may be a prediction derived in a manner that depends on data elements (e.g., sample values ​​or motion information) of a picture other than the current picture. When inter-frame prediction is applied to the current block, a prediction block (prediction sample array) of 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. Herein, in order to reduce the amount of motion information transmitted in the inter-frame prediction mode, the motion information of the current block may be predicted on a per-block, sub-block, or sample basis 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. When inter-frame prediction is applied, the neighboring blocks may include spatial neighboring blocks present in the current picture and temporal neighboring blocks present in the reference picture. The reference picture including the reference block and the reference picture including the temporal neighboring block may be the same or different. The temporal neighboring block may be referred to as a collocated reference block or collocated CU (colCU). A reference picture including temporally neighboring blocks may be referred to as a collocated picture (colPic). For example, a motion information candidate list may be constructed based on neighboring blocks of the current block. A flag or index information indicating which candidate is selected (used) to derive a motion vector and / or a reference picture index may be signaled. Inter-frame prediction may be performed based on various prediction modes. For example, in the case of 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, unlike merge mode, a residual signal may not be sent. In the case of motion information prediction (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.

[0109] According to the inter-frame prediction type (L0 prediction, L1 prediction, dual prediction, etc.), the motion information may include L0 motion information and / or L1 motion information. The motion vector in the L0 direction may be referred to as the L0 motion vector or MVL0, and the motion vector in the L1 direction 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. Prediction based on both the L0 motion vector and the L1 motion vector may be referred to as dual prediction. Herein, the L0 motion vector may refer to a motion vector (L0) associated with the reference picture list L0, and the L1 motion vector may refer to a motion vector (L1) associated with the reference picture list L1. The reference picture list L0 may include a picture before the current picture according to the output order as a reference picture. The reference picture list L1 may include a picture after the current picture according to the output order as a reference picture. The previous picture may be referred to as a forward (reference) picture, and the subsequent picture may be referred to as a backward (reference) picture. The reference picture list L0 may also include a picture after the current picture according to the output order as a reference picture. In this case, within the reference picture list L0, the preceding picture may be indexed first, and the succeeding picture may be indexed next. 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, within the reference picture list 1, the succeeding picture may be indexed first, and the preceding picture may be indexed next. Herein, the output order may correspond to a picture order count (POC) order.

[0110] Figure 4 is a diagram schematically showing an inter-frame prediction unit 180 of the image encoding device 100, Figure 5 is a flowchart illustrating a method for encoding an image based on inter-frame prediction.

[0111] The image encoding device 100 may perform inter prediction on the current block (S510). The image encoding device 100 may derive the inter prediction mode and motion information of the current block, and may generate a prediction sample of the current block. Herein, the processes of inter prediction mode determination, motion information derivation, and prediction sample generation may be performed simultaneously, or any one process may be performed before the other processes. For example, the inter prediction unit 180 of the image encoding device 100 may include a prediction mode determination unit 181, a motion information derivation unit 182, and a prediction sample derivation unit 183. The prediction mode determination unit 181 may determine the prediction mode of the current block. The motion information derivation unit 182 may derive the motion information of the current block. The prediction sample derivation unit 183 may derive the prediction sample of the current block. For example, the inter prediction unit 180 of the image encoding device 100 may search for a block similar to the current block in a predetermined area (search area) of the reference picture through motion estimation, and may derive a reference block having the smallest difference with the current block or less than or equal to a predetermined standard. Based on this, a reference picture index indicating a reference picture in which a reference block is located can be derived, and a motion vector can be derived based on a position difference between the reference block and the current block. The image encoding apparatus 100 can determine a mode applied to the current block among various prediction modes. The image encoding apparatus 100 can compare RD costs for various prediction modes, and can determine an optimal prediction mode for the current block.

[0112] For example, when the skip mode or merge mode is applied to the current block, the image encoding device 100 may construct a merge candidate list described later, and may derive a reference block having the smallest difference with the current block or less than or equal to a predetermined standard among the reference blocks indicated by the merge candidates included in the merge candidate list. In this case, a merge candidate associated with 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.

[0113] As another example, when the (A)MVP mode is applied to the current block, the image encoding device 100 may construct an (A)MVP candidate list described later, and may use the motion vector of the MVP candidate selected from among the motion vector predictor (MVP) candidates included in the (A)MVP candidate list as the MVP of the current block. In this case, for example, a motion vector indicating a reference block derived by the above-mentioned motion estimation may be used as the motion vector of the current block. Among the MVP candidates, the MVP candidate having a motion vector with the smallest difference from the motion vector of the current block may be the selected MVP candidate. A motion vector difference (MVD) as a difference obtained by subtracting the MVP from the motion vector of the current block may be derived. In this case, information about the MVD may be notified to the image decoding device 200 by a signal. In addition, when the (A)MVP mode is applied, the value of the reference picture index may be constructed as reference picture index information, and may be separately notified to the image decoding device 200 by a signal.

[0114] The image encoding apparatus 100 may induce a residual sample based on the prediction sample (S520). The image encoding apparatus 100 may compare the prediction sample with an original sample of the current block to induce the residual sample.

[0115] The image encoding device 100 may encode the image information including prediction information and residual information (S530). The image encoding device may output the encoded image information in the form of a bitstream. The prediction information is information related to the prediction process, and may include prediction mode information (e.g., a skip flag, a merge flag, or a mode index) and information about motion information. The information about the motion information may include candidate selection information (e.g., a merge index, an mvp flag, or an mvp index) as information for deriving a motion vector. In addition, the information about the motion information may include the above-mentioned information about the MVD and / or the reference picture index information. In addition, the information about the motion information may include information indicating whether L0 prediction, L1 prediction, or dual prediction is applied. The residual information is information about the residual sample. The residual information may include information about the quantized transform coefficients used for the residual sample.

[0116] The output bit stream may be stored in a (digital) storage medium and transmitted to the decoding device, or may be transmitted to the image decoding device 200 via a network.

[0117] In addition, as described above, the image encoding device 100 may generate a reconstructed picture (including a reconstructed sample and a reconstructed block) based on the reference sample and the residual sample. This is to derive the same prediction result as the prediction result performed in the image decoding device 200 by the image encoding device 100, thereby increasing the encoding efficiency. Therefore, the image encoding device 100 may store the reconstructed picture (or reconstructed sample, reconstructed block) in a memory, and may use it as a reference picture for inter-frame prediction. As described above, the in-loop filtering process may also be applied to the reconstructed picture.

[0118] Figure 6 is a diagram schematically showing an inter-frame prediction unit 260 of the image decoding apparatus 200, Figure 7 is a flowchart illustrating a method of decoding an image based on inter-frame prediction.

[0119] The image decoding apparatus 200 may perform an operation corresponding to the operation performed by the image encoding apparatus 100. The image decoding apparatus 200 may perform prediction on the current block based on the received prediction information and may derive a prediction sample.

[0120] Specifically, the image decoding apparatus 200 may determine a prediction mode of a current block based on the received prediction information (S710). The image decoding apparatus 200 may determine which inter prediction mode is applied to the current block based on prediction mode information in the prediction information.

[0121] For example, based on the merge flag, it can be determined whether to apply the merge mode to the current block or to determine the (A) MVP mode. Alternatively, one of the various inter-frame prediction mode candidates can be selected based on the mode index. The inter-frame prediction mode candidates may include a skip mode, a merge mode, and / or an (A) MVP mode or may include various inter-frame prediction modes described later.

[0122] The image decoding device 200 may derive motion information of the current block based on the determined inter prediction mode (S720). For example, when the skip mode or merge mode is applied to the current block, the image decoding device 200 may construct a merge candidate list described later, and may select a merge candidate from the merge candidates included in the merge candidate list. The selection may be performed based on the above-mentioned selection information (merge index). The motion information of the selected merge candidate may be used to derive the motion information of the current block. The motion information of the selected merge candidate may be used as the motion information of the current block.

[0123] As another example, when the (A)MVP mode is applied to the current block, the image decoding device 200 may construct the (A)MVP candidate list described later, and may use the motion vector of the MVP candidate selected from the MVP candidates included in the (A)MVP candidate list as the motion vector predictor (MVP) of the current block. The selection may be performed based on the above-mentioned selection information (MVP flag or MVP index). In this case, the MVD of the current block may be derived based on the information about the MVD, and the motion vector of the current block may be derived based on the MVP and MVD of the current block. In addition, the reference picture index of the current block may be derived based on the reference picture index information. The picture indicated by the reference picture index in the reference picture list related to the current block may be derived as the reference picture referenced by the inter-frame prediction of the current block.

[0124] In addition, as will be described later, the motion information of the current block can be derived without constructing a candidate list. In this case, the motion information of the current block can be derived according to the process described in the prediction mode described later. In this case, the candidate list configuration as described above can be omitted.

[0125] The image decoding apparatus 200 may generate a prediction sample of the current block based on the motion information of the current block (S730). In this case, a reference picture may be derived based on a reference picture index of the current block, and a sample of the reference block indicated by a motion vector of the current block on the reference picture may be used to derive the prediction sample of the current block. In this case, as described later, in some cases, a prediction sample filtering process may also be performed on all or some of the prediction samples of the current block.

[0126] For example, the inter prediction unit 260 of the image decoding device 200 may include a prediction mode determination unit 261, a motion information derivation unit 262, and a prediction sample derivation unit 263. The prediction mode determination unit 181 may determine the prediction mode of the current block based on the received prediction mode information. The motion information derivation unit 182 may derive motion information (motion vector and / or reference picture index) of the current block based on the received information about the motion information. The prediction sample derivation unit 183 may derive the prediction sample of the current block.

[0127] The image decoding device 200 may generate a residual sample of the current block based on the received residual information (S740). The image decoding device 200 may generate a reconstructed sample of the current block based on the predicted sample and the residual sample, and may generate a reconstructed picture based thereon (S750). Thereafter, as described above, an in-loop filtering process may be further applied to the reconstructed picture.

[0128] Reference Figure 8The inter-frame prediction process may include the steps of determining an inter-frame prediction mode (S810), deriving motion information according to the determined prediction mode (S810), and performing prediction (generating prediction samples) based on the derived motion information (S830). As described above, the inter-frame prediction process may be performed in the image encoding apparatus 100 and the image decoding apparatus 200.

[0129] Inter prediction mode determination

[0130] Various inter prediction modes can be used for the prediction of the current block in the picture. For example, various modes such as merge mode, skip mode, motion vector prediction (MVP) mode, affine mode, sub-block merge mode, and merge with MVD (MMVD) mode can be used. Decoder-side motion vector refinement (DMVR) mode, adaptive motion vector resolution (AMVR) mode, dual prediction with CU-level weights (BCW), bidirectional optical flow (BDOF), etc. can also be used in addition or alternatively as additional modes. Affine mode can be referred to as affine motion prediction mode. MVP mode can be referred to as advanced motion vector prediction (AMVP) mode. In this document, some modes and / or motion information candidates derived by some modes can be included as one of the motion information candidates of other modes. For example, an HMVP candidate can be added as a merge candidate in merge / skip mode, or can be added as an MVP candidate in MVP mode.

[0131] Prediction mode information indicating the inter prediction mode of the current block may be signaled from the image encoding device 100 to the image decoding device 200. The prediction mode information may be included in a bitstream and received by the image decoding device 200. The prediction mode information may include index information indicating one of a plurality of candidate modes. Alternatively, the inter prediction mode may be indicated by hierarchical signaling of flag information. In this case, the prediction mode information may include one or more flags. For example, a skip flag may be signaled to indicate whether the skip mode is applied, and if the skip mode is not applied, a merge flag may be signaled to indicate whether the merge mode is applied, and if the merge mode is not applied, an MVP mode may be indicated to be applied or a flag for additional classification may be further signaled. The affine mode may be signaled in an independent mode, or may be signaled in a mode depending on the merge mode or the MVP mode. For example, the affine mode may include an affine merge mode and an affine MVP mode.

[0132] Derivation of motion information

[0133] Inter-frame prediction can be performed using the motion information of the current block. The image encoding device 100 can derive the optimal motion information of the current block through a motion estimation process. For example, the image encoding device 100 can use the original block in the original picture of the current block to search for a similar reference block with high correlation in units of partial pixels within a predetermined search range in the reference picture, thereby deriving motion information. The similarity of the blocks can be derived based on the difference in sample values ​​based on the phase. For example, the similarity of the blocks can be calculated based on the SAD between the current block (or the template of the current block) and the reference block (or the template of the reference block). In this case, the motion information can be derived based on the reference block with the minimum SAD in the search area. The derived motion information can be signaled to the image decoding device 200 according to various methods based on the inter-frame prediction mode.

[0134] Generation of prediction samples

[0135] The prediction block of the current block may be derived based on the motion information derived according to the prediction mode. The prediction block may include prediction samples (prediction sample array) of the current block. When the motion vector of the current block indicates a partial sample unit, an interpolation process may be performed, whereby the prediction sample of the current block may be derived based on the reference sample of the partial sample unit within the reference picture. When affine inter prediction is applied to the current block, the prediction sample may be generated based on the sample / sub-block unit MV. When bi-prediction is applied, the prediction sample derived by weighting or weighted averaging (according to the phase) of the prediction sample derived based on the L0 prediction (i.e., prediction using the reference picture in the reference picture list L0 and MVL0) and the prediction sample derived based on the L1 prediction (i.e., prediction using the reference picture in the reference picture list L1 and MVL1) may be used as the prediction sample of the current block. When bi-prediction is applied, if the reference picture for L0 prediction and the reference picture for L1 prediction are located in different time directions relative to the current picture (i.e., bi-prediction and bi-directional prediction), it may be referred to as true bi-prediction.

[0136] As described above, 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.

[0137] Template Matching(TM)

[0138] Fig. 9 2 is a diagram for explaining an encoding / decoding method based on template matching according to the present disclosure.

[0139] Template matching (TM) is a motion vector derivation method performed at the decoder stage, and is a method of refining motion information of a current block by finding a template (hereinafter referred to as a "reference template") that is most similar to a template (hereinafter referred to as a "current template") adjacent to a current block (e.g., a current coding unit, a current CU) in a reference picture. The current template may be an upper neighboring block and / or a left neighboring block of the current block, or may be some of these neighboring blocks. In addition, the reference template may be determined to have the same size as the current template.

[0140] like Fig. 9 As shown, when the initial motion vector of the current block is derived, a search for a better motion vector can be performed in the surrounding area of ​​the initial motion vector. For example, the range of the surrounding area where the search is performed can be within a [-8, +8] pixel search area centered on the initial motion vector. In addition, the size of the search step for performing the search can be determined based on the AMVR mode of the current block. In addition, template matching can be continuously performed in a bilateral matching process in a merge mode.

[0141] If the prediction mode of the current block is the AMVP mode, a motion vector predictor candidate (MVP candidate) may be determined based on a template matching error. For example, a motion vector predictor candidate (MVP candidate) that minimizes an error between a current template and a reference template may be selected. Thereafter, template matching for refining a motion vector may be performed on the selected motion vector predictor candidate. At this time, template matching for refining a motion vector may not be performed on unselected motion vector predictor candidates.

[0142] More specifically, the refinement of the selected motion vector predictor candidate can use an iterative diamond search starting from full pixel (integer pixel) precision within the [–8, +8] pixel search area. Alternatively, in the case of a 4-pixel AMVR mode, it can start from 4-pixel precision. Thereafter, a search with half-pixel and / or quarter-pixel precision can be performed according to the AMVR mode. According to the search process, the motion vector predictor candidate can maintain the same motion vector precision indicated by the AMVR mode even after the template matching process. During the iterative search process, if the difference between the previous minimum cost and the current minimum cost is less than an arbitrary threshold, the search process terminates. The threshold can be equal to the area of ​​the block, that is, the number of samples in the block. Table 1 shows an example of a search pattern according to the AMVR mode and the merge mode accompanying the AMVR.

[0143] [Table 1]

[0144]

[0145] If the prediction mode of the current block is the merge mode, a similar search method can be applied to the merge candidate indicated by the merge index. As shown in Table 1 above, template matching can be performed up to 1 / 8 pixel accuracy, or half-pixel accuracy or lower can be skipped, which can be determined according to whether an alternative interpolation filter is used based on the merged motion information. In this case, the alternative interpolation filter can be the filter used when the AMVR is in half-pixel mode. In addition, if template matching is available, depending on whether bilateral matching (BM) is available, template matching can be operated as an independent process, or can be operated as an additional motion vector refinement process between block-based bilateral matching and sub-block-based bilateral matching. Whether template matching is available and / or whether bilateral matching is available can be determined based on an availability condition check. In the above, the accuracy of the motion vector may refer to the accuracy of the motion vector difference (MVD).

[0146] Hereinafter, an image encoding / decoding method according to various embodiments of the present disclosure will be described in detail.

[0147] The present disclosure relates to amvpMerge, and more particularly, to a method for constructing a fallback candidate in a merge candidate list in an amvpMerge mode. Here, the amvpMerge mode may be a mode in which AMVP (Advanced Motion Vector Prediction) is performed on a current block for any prediction direction, and prediction is performed in a merge mode for any opposite prediction direction to generate a prediction block.

[0148] According to one embodiment of the present disclosure, when prediction is performed in amvpMerge mode, the image encoding device 100 and / or the image decoding device 200 may construct a fallback candidate. The image encoding device 100 and / or the image decoding device 200 may construct a merge candidate list for any direction in which prediction is performed in merge mode. In this case, the present disclosure may be a method for constructing one or more fallback candidates by traversing all reference pictures of a merge reference picture list in the process of constructing the merge candidate list. By constructing one or more fallback candidates as necessary, the present disclosure can prevent a situation where motion information is not derived in amvpMerge mode. Therefore, the present disclosure can prevent a situation where decoding is not performed in the image decoding device 200.

[0149] Implementation Method 1

[0150] According to one embodiment of the present disclosure, in the process of generating a prediction block using two or more reference pictures, for any prediction direction, motion information can be derived by constructing an AMVP prediction candidate. In addition, for the opposite prediction direction, motion information can be derived by constructing a merge prediction candidate. That is, AMVP prediction can be performed for any direction, and merge prediction can be performed for the opposite direction to generate a final prediction block of the current block.

[0151] In the case where motion information is derived as an arbitrary prediction direction of an AMVP prediction candidate, if certain conditions are met, the motion information can be derived without explicitly signaling the MVD. On the other hand, if the certain conditions are not met, the motion information can be derived by explicitly signaling the MVD (motion vector difference) for refining the motion information in the AMVP prediction direction in the bitstream in the same manner as the motion information is derived by the conventional AMVP prediction method.

[0152] According to one embodiment of the present disclosure, the amvpMerge mode may be applied even when the reference picture list consists of only POCs having values ​​smaller than the POC of a picture including the current slice or when it consists of larger values.

[0153] In the present disclosure, it is possible to determine whether to perform amvpMerge prediction at the slice header level. In particular, when the reference picture of the reference picture list of the slice meets a specific condition, an amvpMerge prediction candidate can be constructed with the CU (coding unit) or PU (prediction unit) of the corresponding slice to derive motion information. The implementation according to the present disclosure can be implemented on a slice-by-slice basis. That is, when a picture consists of multiple slices, whether to perform the amvpMerge prediction method can be determined on a slice-by-slice basis.

[0154] According to one embodiment of the present disclosure, when the slice type allows two or more pieces of motion information, the slice can determine the availability of amvpMerge by considering the presence of reference pictures that can perform the amvpMerge mode. For example, when all reference pictures constructed in the reference picture list of the current slice are before or after the current picture, the image decoding device 200 can check whether they can be the reference picture set of amvpMerge. That is, when the POCs of the reference pictures constructed in the reference picture list of the current slice are all smaller than or all larger than the POC of the current picture, the image decoding device 200 can check whether they can be the reference picture set of amvpMerge.

[0155] In addition, if the reference picture satisfies a specific condition, the amvpMerge mode may be performed for the corresponding slice. Here, the specific condition may be condition 1 and / or condition 2. Condition 1 may be specified as a case where all or one or more of the following conditions are satisfied.

[0156] - If the reference picture corresponding to refIdxListX is not RPR

[0157] - If the reference picture corresponding to refIdxListY is not RPR

[0158] - If the reference picture corresponding to refIdxListX is not a long-term reference picture

[0159] - If the reference picture corresponding to refIdxListY is not a long-term reference picture

[0160] - If the weight of the weighted prediction of the reference picture corresponding to refIdxListX is not signaled

[0161] - If the weight of the weighted prediction of the reference picture corresponding to refIdxListY is not signaled

[0162] Here, refIdxListX may mean the reference picture index of the reference picture list in the X direction. X may have a value of 0 or 1, and may respectively mean the L0 reference picture list and the L1 reference picture list. refIdxListY means the list in the opposite direction of any prediction direction X, and the Y value may be derived by calculating (1-X). RPR means reference picture resampling, and may indicate a case where the resolution of the reference picture is different from the resolution of the current picture.

[0163] In addition, condition 2 may specify a case where the POC of one reference picture is smaller than the POC of the current picture and the POC of another reference picture is larger than the POC of the current picture. That is, condition 2 may be the following equation 1.

[0164] [Formula 1]

[0165] (pocLX-curPOC)×(pocLY-curPOC)<0

[0166] Here, the POC of the reference picture corresponding to refIdxLX may be defined as pocLX, the POC of the reference picture corresponding to refIdxLY may be defined as pocLY, and the POC of the current picture may be denoted as curPOC.

[0167] Hereinafter, a method of constructing a merge prediction candidate list for the amvpMerge mode will be described.

[0168] Implementation Method 2

[0169] According to one embodiment of the present disclosure, the image encoding device 100 and / or the image decoding device 200 may construct a merge candidate list in the process of deriving motion information using the amvpMerge mode. In particular, the present disclosure may be a method for constructing fallback candidates for a situation where the merge candidate list does not have as many merge candidates as the required number to be constructed. Specifically, the image encoding device 100 and / or the image decoding device 200 may check whether the amvpMerge mode is an available reference picture while traversing all reference pictures in the merged reference picture list so as to have a merged reference picture on which prediction can be performed in the amvpMerge mode. If the amvpMerge mode is an available reference picture, the image encoding device 100 and / or the image decoding device 200 may construct a fallback candidate by referring to the corresponding reference picture.

[0170] According to one embodiment of the present disclosure, when the current slice is a B slice, the number of L0 reference pictures and L1 reference pictures is checked, and only the minimum reference picture index among the number of reference pictures in the L0 reference picture list and the L1 reference picture list is considered to construct a fallback candidate. For example, when the number of reference pictures included in the L0 reference picture list is 3 and the number of reference pictures included in the L1 reference picture list is 1, numRefIdx may be 1. If amvpMerge can be performed on the reference picture indicated by reference index 0, the corresponding reference picture can be considered to construct the fallback candidate as a 0 vector in the list. However, if the reference picture indicated by reference index 0 is a reference picture on which amvpMerge is not performed, the corresponding candidate cannot be constructed as a fallback candidate. In this case, since numRefIdx is 1, a new fallback candidate cannot be constructed.

[0171] For example, it can be assumed that the POC of the current picture is 16, the reference pictures included in the L0 reference picture list are POC-32, POC-48, POC-0 in order, and the reference pictures included in the L1 reference picture list are POC-32 in order. If amvpMergeModeFlag[0] is true, a merge candidate list can be constructed for the L0 prediction direction. In addition, numRefIdx is 1, and POC-32 with an L0 reference picture index of 0 may not have a reference picture on which amvpMerge can be performed because the same reference picture does not exist in the L1 reference picture list. That is, since amvpMergeValidRefIdx[REF_PIC_LIST_0][0] is false, mergeRefIdx 0 is invalid and cannot be constructed as a candidate, and the process of constructing a fallback candidate can be terminated. Here, amvpMergeValidRefIdx[REF_PIC_LIST_0][0] may indicate whether a reference picture corresponding to reference index 0 of the L0 reference picture list is a reference picture from which motion information of the amvpMerge mode may be derived.

[0172] According to another embodiment of the present disclosure, in order to prevent the fallback candidate construction process from being terminated without constructing a fallback candidate, the fallback candidate can be constructed by considering the number of reference pictures included in the merged reference picture list of amvpMerge. In this case, since only the number of reference pictures included in the merged reference picture list is considered, numRefIdx can be 3 in the above example. In addition, since mergeRefIdx 0, 1, and 2 are all traversed, fallback candidates can be constructed while traversing POC-32, POC-48, and POC-0. Since the POC of the current picture is POC-16, the image encoding device 100 or the image decoding device 200 can construct a fallback candidate with reference to a reference picture set including a POC-0 reference picture in the L0 direction and a POC-32 reference picture in the L1 direction.

[0173] According to another embodiment of the present disclosure, the number of fallback candidates can be predefined. That is, in the present disclosure, only a predefined number of fallback candidates can be generated. Specifically, instead of generating fallback candidates until MaxNumMergeCand candidates are constructed, a predefined number N of fallback candidates can be constructed. In this case, the number of merge candidates that have been constructed can also be considered. Here, MaxNumMergeCand can mean the maximum number of merge candidates.

[0174] For example, if the value of N is defined as 0, if one or more merge candidates constructed before constructing the fallback candidate already exist, the fallback candidate may not be constructed. On the other hand, if the number of pre-constructed merge candidates is 0, one fallback candidate may be added. Here, N may be an integer and may have a value less than or equal to maxNumMergCand. Hereinafter, an embodiment according to the present disclosure will be described with reference to FIGS. 10 , 11 , and 12 .

[0175] 10A, 10B, and 10C are flowcharts illustrating a method for constructing a merge candidate list according to an embodiment of the present disclosure. According to one embodiment of the present disclosure, the image decoding device 200 may check tmMergeFlag (S1001). Here, tmMergeFlag may be a flag indicating whether to perform merge prediction based on template matching.

[0176] When template matching-based merge prediction is performed (S1001 is yes), the image decoding device 200 may set a threshold based on the number of pixels in the picture (S1002). In this case, the image decoding device 200 may check useAML() (S1004). Here, useAML() may be a syntax indicating whether AML is used. When AML is used (S1004 is yes), the value of maxNumMergeCand may be set to TM_MRG_MAX_NUM_CAND (S1005). On the other hand, when AML is not used (S1004 is no), the value of maxNumMergeCand may be set to the maximum number of TM merge candidates signaled in SPS / PPS / PH / SH (S1006). Here, AML means an adaptive merge list, and maxNumMergeCand may mean the maximum number of merge candidates that can be included in the merge candidate list.

[0177] In addition, when template matching-based merge prediction is not performed (step S1001 is No), the threshold may be set to 1 (S1003). In this case, the value of maxNumMergeCand may be set to the maximum number of TM merge candidates signaled in SPS / PPS / PH / SH (S1007).

[0178] Thereafter, the image decoding apparatus 200 may check amvpMergeFlag (S1008). Here, amvpMergeFlag may be a flag indicating whether the amvpMerge mode is applied to the current block. If the amvpMerge mode is applied to the current block (yes in step S1008), the image decoding apparatus 200 may check amvpMergeModeFlag[0] (S1009). Here, amvpMergeModeFlag[0] may be a flag indicating whether the prediction mode applied to the L0 prediction direction is the merge mode.

[0179] If the prediction mode applied to the L0 prediction direction is the merge mode (yes in step S1009), the image decoding device 200 can generate an amvp reference picture list for the L1 direction (amvpRefList=REF_PIC_LIST_1) and a merged reference picture list for the L0 direction (mergeRefList=REF_PIC_LIST_0), and can assign 1 to the index indicating the merge direction (mergeDir) (S1010).

[0180] On the other hand, if the prediction mode applied to the L0 prediction direction is not the merge mode (step S1009 is No), the image decoding device 200 can generate an amvp reference picture list for the L0 direction (amvpRefList=REF_PIC_LIST_0) and a merged reference picture list for the L1 direction (mergeRefList=REF_PIC_LIST_1), and can assign 2 to the index indicating the merge direction (mergeDir) (S1011).

[0181] The image decoding device 200 may generate a merge candidate list (S1012). Even if the amvpMerge mode is not applied to the current block (step S1008 is No), the image decoding device 200 may generate a merge candidate list (S1012). At this time, the merge candidates included in the merge candidate list may be motion information of spatially adjacent blocks (spatial), motion information of temporally adjacent blocks (temporal), motion information of spatially non-adjacent blocks (non-adjacent spatial), HMVP (history-based motion vector prediction), paired and affine HMVP.

[0182] After generating the merge candidates included in the merge candidate list, the image decoding device 200 may check whether the maximum number of merge candidates (maxNumMergeCand) is greater than the index (count) indicating the merge candidates included in the current merge candidate list (S1021). If the maximum number of merge candidates is not greater than the index (count) indicating the merge candidates included in the current merge candidate list (step S1021 is no), that is, if the maximum number of merge candidates is less than or equal to the index (count) indicating the merge candidates included in the current merge candidate list, the image decoding device 200 may check whether the slice including the current block is a B slice (S1027).

[0183] If the maximum number of merge candidates is greater than the index (count) indicating the merge candidates included in the current merge candidate list (yes in step S1021), the image decoding device 200 may check the isValidAmvpMerge syntax (S1022). Here, isValidAmvpMerge may be a syntax indicating whether the reference picture indicated by the motion information of the corresponding merge candidate is available for amvpMerge. If the reference picture indicated by the motion information of the corresponding merge candidate is not available for the amvpMerge mode, the image decoding device 200 may return to step S1012 without adding the corresponding merge candidate to the amvpMerge candidate list. In this case, the image decoding device 200 may perform steps S1021 to S1026 again for another merge candidate.

[0184] On the other hand, if the reference picture indicated by the motion information of the corresponding merge candidate is available for the amvpMerge mode (yes in step S1022), the image decoding device 200 may check the amvpMergeFlag (S1023). Here, the amvpMergeFlag may be a flag indicating whether the amvpMerge mode is applied to the current block. If the amvpMergeFlag indicates that the amvpMerge mode is applied to the current block (yes in step S1023), the image decoding device 200 may assign the value of mergeDir to candidate[count].interDir, and may assign (0,0,NOT_VALID) to candidate[count].mv[amvpRefList] (S1024). That is, in order to perform the subsequent step S1025 using only the motion information of the merge candidate list, the image decoding device 200 may reset the interDir and the motion information of the amvp candidate list.

[0185] Thereafter, the image decoding device 200 may check checkSimilarity(candidate[count])(S1025). Here, checkSimilarity(candidate[count]) may indicate whether the similarity between the corresponding merge candidate and the candidate previously added to the merge candidate list is similar to the threshold determined in step S1002 or step S1003. If the corresponding merge candidate is similar to the candidate previously added to the merge candidate list, the image decoding device 200 may return to step S1012 without adding the corresponding merge candidate to the amvpMerge candidate list. In this case, the image decoding device 200 may perform steps S1021 to S1026 on another merge candidate. On the other hand, if the merge candidate is not similar to the candidate previously added to the merge candidate list (yes in step S1025), the image decoding device 200 may add the merge candidate to the merge candidate list of amvpMerge and add 1 to the Count value (S1026).

[0186] For the count increased by 1, steps S1021 to S1027 may be performed again. If the index of the merge candidate included in the merge candidate list becomes equal to the maximum number of merge candidates (step S1021 is No), the image decoding device 200 may check whether the slice including the current block is a B slice (S1027). That is, after performing steps S1021 to S1026 for all merge candidates included in the merge candidate list, the image decoding device 200 may check whether the slice including the current block is a B slice.

[0187] If the slice including the current block is a B slice (Yes in step S1027), the image decoding apparatus 200 may assign the minimum value of the number of reference pictures in the reference picture list in the L0 direction and the number of reference pictures in the reference picture list in the L1 direction to numRefIdx (S1031). If the slice including the current block is not a B slice (No in step S1027), the image decoding apparatus may assign the number of reference pictures in the reference picture list in the L0 direction to numRefIdx (S1032).

[0188] The image decoding device 200 may check amvpMergeFlag (S1033). Here, amvpMergeFlag may be a flag indicating whether amvpMerge mode prediction is applied to the current block. If amvpMerge mode prediction is applied to the current block (yes in step S1033), the image decoding device 200 may assign 0 to mergeRefIdx (S1034). The image decoding device 200 may check whether the maximum value of the number of merge candidates is greater than the number of merge candidates included in the merge candidate list and whether the value of numRefIdx is greater than the value of mergeRdfIdx (S1035). If the maximum number of merge candidates is less than or equal to the number of merge candidates included in the merge candidate list, or if the value of numRefIdx is less than or equal to the value of mergeRefIdx (no in step S1035), the image decoding device 200 may terminate the process.

[0189] On the other hand, if the maximum value of the number of merge candidates is greater than the number of merge candidates included in the merge candidate list, or the value of numRefIdx is greater than the value of mergeRefIdx (yes in step S1035), the image decoding device 200 may assign (0,0,mergeRefIdx) to candidate[Count].mv[mergeRefList] (S1036). That is, the image decoding device 200 may reset the motion information of the merge candidate. Specifically, the motion information of the merge candidate indicated by Count may be set to (0,0,mergeRefList). Here, mergeRefList may mean a reference picture list referenced by the corresponding candidate.

[0190] The image decoding device 200 may check isValidAmvpMerge(candidate) (S1037). Here, isValidAmvpMerge(candidate) may be a syntax indicating whether the reference picture indicated by the motion information of the corresponding merge candidate is available for amvpMerge. If the reference picture indicated by the motion information of the corresponding merge candidate is available for amvpMerge mode (yes in step S1037), the image decoding device 200 may add the corresponding merge candidate as a fallback candidate to the amvpMerge candidate list and add 1 to Count (S1038). In addition, the image decoding device 200 may add 1 to mergeRefIdx (S1039). Thereafter, the image decoding device 200 may repeatedly perform steps S1035 to S1039 on all merge candidates.

[0191] If the reference picture indicated by the motion information of the corresponding merge candidate is not available for the amvpMerge mode (No in S1037), the image decoding device 200 may immediately add 1 to mergeRefIdx (S1039). Thereafter, the image decoding device 200 may repeatedly perform steps S1036 to S1039 on the merge candidates that meet the conditions of S1035.

[0192] According to another embodiment of the present disclosure, if amvpMerge mode prediction is not applied to the current block (No in S1033), the image decoding device 200 may check whether the maximum number of merge candidates is greater than Count (S1051). If the maximum number of merge candidates is less than or equal to Count (No in S1051), the image decoding device 200 may terminate the process.

[0193] On the other hand, if the maximum number of merge candidates is greater than Count (Yes in step S1051), the image decoding apparatus 200 may assign (0, 0, refIdx) to candidate[Count].mv[0] and candidate[Count].mv[1] (S1052). That is, a 0 vector may be assigned to each of the merge candidates in the L0 direction and the L1 direction.

[0194] The image decoding device 200 may add the candidate assigned with the 0 vector in step S1052 to the amvpMerge candidate list (S1053). In addition, the image decoding device 200 may add 1 to refIdx (S1054). Step S1051 may be performed again using the value obtained by adding 1 to refIdx. The image decoding device 200 may repeatedly perform steps S1052 to S1054 on the merge candidate satisfying the condition of S1051. Figures 10A, 10B, and 10C may be sequential processes linked to each other, or may be independent processes.

[0195] 11A, 11B, and 11C are flowcharts illustrating a method for constructing a merge candidate list according to an embodiment of the present disclosure. According to one embodiment of the present disclosure, the image decoding device 200 may check tmMergeFlag (S1101). Here, tmMergeFlag may be a flag indicating whether to perform merge prediction based on template matching.

[0196] When template matching-based merge prediction is performed (Yes in S1101), the image decoding device 200 may set a threshold based on the number of pixels in the picture (S1102). In this case, the image decoding device 200 may check useAML() (S1104). Here, useAML() may be a syntax indicating whether AML is used. When AML is used (Yes in S1104), the value of maxNumMergeCand may be set to TM_MRG_MAX_NUM_CAND (S1105). On the other hand, when AML is not used (No in S1104), the value of maxNumMergeCand may be set to the maximum number of TM merge candidates signaled in SPS / PPS / PH / SH (S1106). Here, maxNumMergeCand may mean the maximum number of merge candidates that may be included in the merge candidate list.

[0197] In addition, when template matching-based merge prediction is not performed (step S1101 is No), the threshold may be set to 1 (S1103). In this case, the value of maxNumMergeCand may be set to the maximum number of TM merge candidates signaled in SPS / PPS / PH / SH (S1107).

[0198] Thereafter, the image decoding apparatus 200 may check amvpMergeFlag (S1108). Here, amvpMergeFlag may be a flag indicating whether the amvpMerge mode is applied to the current block. If the amvpMerge mode is applied to the current block (yes in step S1108), the image decoding apparatus 200 may check amvpMergeModeFlag[0] (S1109). Here, amvpMergeModeFlag[0] may be a flag indicating whether the prediction mode applied to the L0 prediction direction is the merge mode.

[0199] If the prediction mode applied to the L0 prediction direction is the merge mode (yes in step S1109), the image decoding device 200 can generate an amvp reference picture list for the L1 direction (amvpRefList=REF_PIC_LIST_1) and a merged reference picture list for the L0 direction (mergeRefList=REF_PIC_LIST_0), and can assign 1 to the index indicating the merge direction (mergeDir) (S1110).

[0200] On the other hand, if the prediction mode applied to the L0 prediction direction is not the merge mode (step S1109 is No), the image decoding device 200 can generate an amvp reference picture list for the L0 direction (amvpRefList=REF_PIC_LIST_0) and a merged reference picture list for the L1 direction (mergeRefList=REF_PIC_LIST_1), and can assign 2 to the index indicating the merge direction (mergeDir) (S1111).

[0201] The image decoding device 200 may generate a merge candidate list (S1112). Even if the amvpMerge mode is not applied to the current block (step S1108 is No), the image decoding device 200 may generate a merge candidate list (S1112). At this time, the merge candidates included in the merge candidate list may be motion information of spatially adjacent blocks (spatial), motion information of temporally adjacent blocks (temporal), motion information of spatially non-adjacent blocks (non-adjacent spatial), HMVP (history-based motion vector prediction), paired and affine HMVP.

[0202] After generating the merge candidates included in the merge candidate list, the image decoding device 200 may check whether the maximum number of merge candidates (maxNumMergeCand) is greater than the index (count) indicating the merge candidates included in the current merge candidate list (S1121). If the maximum number of merge candidates is not greater than the index (count) indicating the merge candidates included in the current merge candidate list (step S1121 is no), that is, if the maximum number of merge candidates is less than or equal to the index (count) indicating the merge candidates included in the current merge candidate list, the image decoding device 200 may check whether the slice including the current block is a B slice (S1127).

[0203] If the maximum number of merge candidates is greater than the index (count) indicating the merge candidates included in the current merge candidate list (yes in step S1121), the image decoding device 200 may check the isValidAmvpMerge syntax (S1122). Here, isValidAmvpMerge may be a syntax indicating whether the reference picture indicated by the motion information of the corresponding merge candidate is available for amvpMerge. If the reference picture indicated by the motion information of the corresponding merge candidate is not available for the amvpMerge mode, the image decoding device 200 may perform step S1112 again without adding the corresponding merge candidate to the amvpMerge candidate list. In this case, the image decoding device 200 may perform steps S1121 to S1126 for another merge candidate.

[0204] On the other hand, if the reference picture indicated by the motion information of the corresponding merge candidate is available for the amvpMerge mode (yes in step S1122), the image decoding device 200 may check the amvpMergeFlag (S1123). Here, the amvpMergeFlag may be a flag indicating whether the amvpMerge mode is applied to the current block. If the amvpMergeFlag indicates that the amvpMerge mode is applied to the current block (yes in step S1123), the image decoding device 200 may assign the value of mergeDir to candidate[count].interDir and may assign (0,0,NOT_VALID) to candidate[count].mv[amvpRefList] (S1124). That is, in order to perform the subsequent step S1125 using only the motion information of the merge candidate list, the image decoding device 200 may reset the interDir and the motion information of the amvp candidate list.

[0205] Thereafter, the image decoding device 200 may check checkSimilarity(candidate[count]) (S1125). Here, checkSimilarity(candidate[count]) may indicate whether the similarity between the corresponding merge candidate and the candidate previously added to the merge candidate list is similar to the threshold value determined in step S1102 or step S1103. If the corresponding merge candidate is similar to the candidate previously added to the merge candidate list, the image decoding device 200 may perform step S1112 again without adding the corresponding merge candidate to the amvpMerge candidate list. In this case, the image decoding device 200 may perform steps S1121 to S1126 for another merge candidate. On the other hand, if the merge candidate is not similar to the candidate previously added to the merge candidate list (yes in step S1125), the image decoding device 200 may add the merge candidate to the merge candidate list of amvpMerge and add 1 to the Count value (S1126).

[0206] For the count increased by 1, steps S1121 to S1127 may be performed again. If the index of the merge candidate included in the merge candidate list becomes equal to the maximum number of merge candidates (step S1121 is No), the image decoding device 200 may check whether the slice including the current block is a B slice (S1127). That is, after performing steps S1121 to S1126 for all merge candidates included in the merge candidate list, the image decoding device 200 may check whether the slice including the current block is a B slice.

[0207] If the slice including the current block is a B slice (Yes in step S1127), the image decoding apparatus 200 may assign the minimum value of the number of reference pictures in the reference picture list in the L0 direction and the number of reference pictures in the reference picture list in the L1 direction to numRefIdx (S1131). If the slice including the current block is not a B slice (No in step S1127), the image decoding apparatus may assign the number of reference pictures in the reference picture list in the L0 direction to numRefIdx (S1132).

[0208] The image decoding apparatus 200 may check amvpMergeFlag (S1133). Here, amvpMergeFlag may be a flag indicating whether amvpMerge mode prediction is applied to the current block. If amvpMerge mode prediction is applied to the current block (yes in step S1133), the image decoding apparatus 200 may assign the number of reference pictures included in the merge reference picture list to numRefIdx (S1134). This may be to check whether all merge candidates included in the merge candidate list can be merge candidates of the amvpMerge mode.

[0209] The image decoding device 200 may assign 0 to mergeRefIdx (S1135). The image decoding device 200 may check whether the maximum value of the number of merge candidates is greater than the number of merge candidates included in the merge candidate list and whether the value of numRefIdx is greater than the value of mergeRdfIdx (S1136). If the maximum value of the number of merge candidates is less than or equal to the number of merge candidates included in the merge candidate list or the value of numRefIdx is less than or equal to the value of mergeRefIdx (No in step S1136), the image decoding device 200 may terminate the process.

[0210] On the other hand, if the maximum value of the number of merge candidates is greater than the number of merge candidates included in the merge candidate list or the value of numRefIdx is greater than the value of mergeRefIdx (yes in step S1136), the image decoding device 200 may assign (0,0,mergeRefIdx) to candidate[Count].mv[mergeRefList] (S1137). That is, the image decoding device 200 may reset the motion information of the merge candidate. Specifically, the motion information of the merge candidate indicated by Count may be set to (0,0,mergeRefList). Here, mergeRefList may mean a reference picture list referenced by the corresponding candidate.

[0211] The image decoding device 200 may check isValidAmvpMerge(candidate) (S1138). Here, isValidAmvpMerge(candidate) may be a syntax indicating whether the reference picture indicated by the motion information of the corresponding merge candidate is available for amvpMerge. If the reference picture indicated by the motion information of the corresponding merge candidate is available for amvpMerge mode (yes in step S1138), the image decoding device 200 may add the corresponding merge candidate as a fallback candidate to the amvpMerge candidate list and add 1 to Count (S1139). In addition, the image decoding device 200 may add 1 to mergeRefIdx (S1140). Thereafter, the image decoding device 200 may repeatedly perform steps S1136 to S1140 for all merge candidates.

[0212] If the reference picture indicated by the motion information of the corresponding merge candidate is not available for the amvpMerge mode (No in S1138), the image decoding device 200 may immediately add 1 to mergeRefIdx (S1140). Thereafter, the image decoding device 200 may return to step S1136 and repeatedly perform steps S1136 to S1140 for all merge candidates.

[0213] According to another embodiment of the present disclosure, if the amvpMerge mode prediction is not applied to the current block (step S1133 is no), the image decoding device 200 may check whether the maximum number of merge candidates is greater than Count (S1151). If the maximum number of merge candidates is less than or equal to Count (step S1151 is no), the image decoding device 200 may terminate the process.

[0214] On the other hand, if the maximum number of merge candidates is greater than Count (Yes in step S1151), the image decoding apparatus 200 may assign (0, 0, refIdx) to candidate[Count].mv[0] and candidate[Count].mv[1] (S1152). That is, a 0 vector may be assigned to each of the merge candidates in the L0 direction and the L1 direction.

[0215] The image decoding device 200 may add the candidate assigned with the 0 vector in step S1152 to the amvpMerge candidate list (S1153). In addition, the image decoding device 200 may add 1 to refIdx (S1154). Step S1151 may be performed again using the value obtained by adding 1 to refIdx. The image decoding device 200 may repeatedly perform steps S1151 to S1154 for all merge candidates. FIG. 11A, FIG. 11B, and FIG. 11C may be sequential processes linked to each other, or may be independent processes.

[0216] 12A, 12B and 12C are flowcharts illustrating a method of constructing a merge candidate list according to an embodiment of the present disclosure. According to one embodiment of the present disclosure, fallback candidates may be constructed by considering the number of reference pictures included in the merge reference picture list.

[0217] According to one embodiment of the present disclosure, the image decoding apparatus 200 may check tmMergeFlag (S1201). Here, tmMergeFlag may be a flag indicating whether to perform merge prediction based on template matching.

[0218] When template matching-based merge prediction is performed (Yes in S1201), the image decoding device 200 may set a threshold based on the number of pixels in the picture (S1202). In this case, the image decoding device 200 may check useAML() (S1204). Here, useAML() may be a syntax indicating whether AML is used. When AML is used (Yes in S1204), the value of maxNumMergeCand may be set to TM_MRG_MAX_NUM_CAND (S1205). On the other hand, when AML is not used (No in S1204), the value of maxNumMergeCand may be set to the maximum number of TM merge candidates signaled in the SPS / PPS / PH / SH (S1206). Here, maxNumMergeCand may mean the maximum number of merge candidates that may be included in the merge candidate list.

[0219] In addition, when template matching-based merge prediction is not performed (step S1201 is No), the threshold may be set to 1 (S1203). In this case, the value of maxNumMergeCand may be set to the maximum number of TM merge candidates signaled in SPS / PPS / PH / SH (S1207).

[0220] Thereafter, the image decoding apparatus 200 may check amvpMergeFlag (S1208). Here, amvpMergeFlag may be a flag indicating whether the amvpMerge mode is applied to the current block. If the amvpMerge mode is applied to the current block (yes in step S1208), the image decoding apparatus 200 may check amvpMergeModeFlag[0] (S1209). Here, amvpMergeModeFlag[0] may be a flag indicating whether the prediction mode applied to the L0 prediction direction is the merge mode.

[0221] If the prediction mode applied to the L0 prediction direction is the merge mode (yes in step S1209), the image decoding device 200 can generate an amvp reference picture list for the L1 direction (amvpRefList=REF_PIC_LIST_1) and a merged reference picture list for the L0 direction (mergeRefList=REF_PIC_LIST_0), and can assign 1 to the index indicating the merge direction (mergeDir) (S1210).

[0222] On the other hand, if the prediction mode applied to the L0 prediction direction is not the merge mode (step S1209 is No), the image decoding device 200 can generate an amvp reference picture list for the L0 direction (amvpRefList=REF_PIC_LIST_0) and a merged reference picture list for the L1 direction (mergeRefList=REF_PIC_LIST_1), and can assign 2 to the index indicating the merge direction (mergeDir) (S1211).

[0223] The image decoding device 200 may generate a merge candidate list (S1212). Even if the amvpMerge mode is not applied to the current block (step S1208 is No), the image decoding device 200 may generate a merge candidate list (S1212). At this time, the merge candidates included in the merge candidate list may be motion information of spatially adjacent blocks (spatial), motion information of temporally adjacent blocks (temporal), motion information of spatially non-adjacent blocks (non-adjacent spatial), HMVP (history-based motion vector prediction), paired and affine HMVP.

[0224] After generating the merge candidates included in the merge candidate list, the image decoding device 200 may check whether the maximum number of merge candidates (maxNumMergeCand) is greater than the index (count) indicating the merge candidates included in the current merge candidate list (S1221). If the maximum number of merge candidates is not greater than the index (count) indicating the merge candidates included in the current merge candidate list (step S1221 is no), that is, if the maximum number of merge candidates is less than or equal to the index (count) indicating the merge candidates included in the current merge candidate list, the image decoding device 200 may check whether the slice including the current block is a B slice (S1227).

[0225] If the maximum number of merge candidates is greater than the index (count) indicating the merge candidates included in the current merge candidate list (yes in step S1221), the image decoding device 200 may check the isValidAmvpMerge syntax (S1222). Here, isValidAmvpMerge may be a syntax indicating whether the reference picture indicated by the motion information of the corresponding merge candidate is available for amvpMerge. If the reference picture indicated by the motion information of the corresponding merge candidate is not available for the amvpMerge mode, the image decoding device 200 may perform step S1212 again without adding the corresponding merge candidate to the amvpMerge candidate list. In this case, the image decoding device 200 may perform steps S1221 to S1226 for another merge candidate.

[0226] On the other hand, if the reference picture indicated by the motion information of the corresponding merge candidate is available for the amvpMerge mode (yes in step S1222), the image decoding device 200 may check the amvpMergeFlag (S1223). Here, the amvpMergeFlag may be a flag indicating whether the amvpMerge mode is applied to the current block. If the amvpMergeFlag indicates that the amvpMerge mode is applied to the current block (yes in step S1223), the image decoding device 200 may assign the value of mergeDir to candidate[count].interDir and may assign (0,0,NOT_VALID) to candidate[count].mv[amvpRefList] (S1224). That is, in order to perform the subsequent step S1225 using only the motion information of the merge candidate list, the image decoding device 200 may reset interDir and the motion information of the amvp candidate list.

[0227] Thereafter, the image decoding device 200 may check checkSimilarity(candidate[count]) (S1225). Here, checkSimilarity(candidate[count]) may indicate whether the similarity between the corresponding merge candidate and the candidate previously added to the merge candidate list is similar to the threshold value determined in step S1202 or step S1203. If the corresponding merge candidate is similar to the candidate previously added to the merge candidate list, the image decoding device 200 may perform step S1212 again without adding the corresponding merge candidate to the amvpMerge candidate list. In this case, the image decoding device 200 may perform steps S1221 to S1226 for another merge candidate. On the other hand, if the merge candidate is not similar to the candidate previously added to the merge candidate list (yes in step S1225), the image decoding device 200 may add the merge candidate to the merge candidate list of amvpMerge and add 1 to the Count value (S1226).

[0228] For the count increased by 1, steps S1221 to S1227 may be performed again. If the index of the merge candidate included in the merge candidate list becomes equal to the maximum number of merge candidates (step S1221 is No), the image decoding device 200 may check whether the slice including the current block is a B slice (S1227). That is, after performing steps S1221 to S1226 for all merge candidates included in the merge candidate list, the image decoding device 200 may check whether the slice including the current block is a B slice.

[0229] If the slice including the current block is a B slice (Yes in step S1227), the image decoding apparatus 200 may assign the minimum value of the number of reference pictures in the reference picture list in the L0 direction and the number of reference pictures in the reference picture list in the L1 direction to numRefIdx (S1231). If the slice including the current block is not a B slice (No in step S1227), the image decoding apparatus may assign the number of reference pictures in the reference picture list in the L0 direction to numRefIdx (S1232).

[0230] The image decoding apparatus 200 may check amvpMergeFlag (S1233). Here, amvpMergeFlag may be a flag indicating whether amvpMerge mode prediction is applied to the current block. If amvpMerge mode prediction is applied to the current block (Yes in step S1233), the image decoding apparatus 200 may assign the number of reference pictures included in the merged reference picture list to numRefIdx (S1234).

[0231] In addition, the image decoding device 200 may assign 0 to mergeRefIdx (S1235). The image decoding device 200 may check whether the predefined arbitrary N is greater than or equal to the index indicating the merge candidate included in the merge candidate list and whether the value of numRefIdx is greater than the value of mergeRdfIdx (S1236). If the predefined arbitrary N is less than the number of merge candidates included in the merge candidate list or the value of numRefIdx is less than or equal to the value of mergeRefIdx (step S1236 is no), the image decoding device 200 may terminate the process.

[0232] On the other hand, if the predefined arbitrary N is greater than or equal to the number of merge candidates included in the merge candidate list or the value of numRefIdx is greater than the value of mergeRefIdx (step S1236 is yes), the image decoding device 200 may assign (0,0,mergeRefIdx) to candidate[Count].mv[mergeRefList] (S1237). That is, the image decoding device 200 may reset the motion information of the merge candidate. Specifically, the motion information of the merge candidate indicated by Count may be set to (0,0,mergeRefList). Here, mergeRefList may mean a reference picture list referenced by the corresponding candidate.

[0233] The image decoding device 200 may check isValidAmvpMerge(candidate) (S1238). Here, isValidAmvpMerge(candidate) may be a syntax indicating whether the reference picture indicated by the motion information of the corresponding merge candidate is available for amvpMerge. If the reference picture indicated by the motion information of the corresponding merge candidate is available for amvpMerge mode (yes in step S1238), the image decoding device 200 may add the corresponding merge candidate as a fallback candidate to the amvpMerge candidate list and add 1 to Count (S1239). In addition, the image decoding device 200 may add 1 to mergeRefIdx (S1240). Thereafter, the image decoding device 200 may repeatedly perform steps S1236 to S1240 on the merge candidate that satisfies the condition of S1236.

[0234] If the reference picture indicated by the motion information of the corresponding merge candidate is not available for the amvpMerge mode (No in S1238), the image decoding device 200 may immediately add 1 to mergeRefIdx (S1240). Thereafter, the image decoding device 200 may return to step S1236 and repeatedly perform steps S1236 to S1240 on the merge candidate satisfying the condition of S1236.

[0235] According to another embodiment of the present disclosure, if the amvpMerge mode prediction is not applied to the current block (step S1233 is no), the image decoding device 200 may check whether the maximum number of merge candidates is greater than Count (S1251). If the maximum number of merge candidates is less than or equal to Count (step S1251 is no), the image decoding device 200 may terminate the process.

[0236] On the other hand, if the maximum number of merge candidates is greater than Count (Yes in step S1251), the image decoding apparatus 200 may assign (0, 0, refIdx) to candidate[Count].mv[0] and candidate[Count].mv[1] (S1252). That is, a 0 vector may be assigned to each of the merge candidates in the L0 direction and the L1 direction.

[0237] The image decoding device 200 may add the candidate assigned with the 0 vector in step S1252 to the amvpMerge candidate list (S1253). In addition, the image decoding device 200 may add 1 to refIdx (S1254). Step S1251 may be performed again using the value obtained by adding 1 to refIdx. The image decoding device 200 may repeatedly perform steps S1251 to S1254 on the merge candidate satisfying the condition of S1251. Figures 12A, 12B, and 12C may be sequential processes linked to each other, or may be independent processes.

[0238] Fig.13 is a flowchart of a fallback merge candidate construction method according to an embodiment of the present disclosure. Fig.13 The subject is described as the image decoding device 200, but it is obvious that the subject may be the image encoding device 100.

[0239] According to one embodiment of the present disclosure, the image decoding apparatus 200 may determine a prediction mode applied to each prediction direction of the current block (S1310). At this time, each prediction mode may include an AMVP mode and / or a merge mode.

[0240] The image decoding device 200 may construct an AMVP candidate list and a merge candidate list (S1320). That is, the AMVP candidate list and the merge candidate list may be constructed based on the determined prediction mode. At this time, the merge candidate list may include a fallback candidate. Based on the fact that the number of merge candidates included in the merge candidate list is less than the maximum number of merge candidates, a fallback candidate may be included in the merge candidate list.

[0241] Alternatively, based on the number of reference pictures included in the merged reference picture list being less than a predetermined value, a fallback candidate may be included in the merge candidate list. Here, the predetermined value may be a smaller value between the number of reference pictures included in the merged reference picture list and the number of reference pictures included in the amvp reference picture list. Alternatively, the predetermined value may be the number of reference pictures included in the merged reference picture list.

[0242] Alternatively, based on the reference picture of the fallback candidate being available in amvpMerge mode, the fallback candidate may be included in the merge candidate list. Alternatively, based on the number of merge candidates included in the merge candidate list being less than or equal to a predefined value, the fallback candidate may be included in the merge candidate list.

[0243] The image decoding apparatus 200 may generate a prediction block of the current block (S1330). Specifically, the prediction block of the current block may be generated based on the AMVP candidate list and the merge candidate list.

[0244] Although for the sake of clarity of description, the exemplary method of the present disclosure described above is represented as a series of operations, it is not intended to limit the order of executing the steps, and these steps can be performed simultaneously or in different orders when necessary. In order to implement the method according to the present invention, the steps described may further include other steps, may include the remaining steps except some steps, or may include other additional steps except some steps.

[0245] In the present disclosure, an image encoding device or an image decoding device that performs a predetermined operation (step) may perform an operation (step) of confirming an execution condition or situation of the corresponding operation (step). For example, if it is described that a predetermined operation is performed when a predetermined condition is met, the image encoding device or the image decoding device may perform the predetermined operation after determining whether the predetermined condition is met.

[0246] The various embodiments of the present disclosure are not a list of all possible combinations and are intended to describe representative aspects of the present disclosure, and matters described in the various embodiments may be applied independently or in combination of two or more.

[0247] Various embodiments of the present disclosure may be implemented in hardware, firmware, software or a combination thereof. In the case of implementing the present disclosure in hardware, the present disclosure may be implemented in an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a general purpose processor, a controller, a microcontroller, a microprocessor, etc.

[0248] In addition, the image decoding device and the image encoding device to which the embodiments of the present disclosure are applied may be included in a multimedia broadcast transmission and reception device, a mobile communication terminal, a home theater video device, a digital theater video device, a surveillance camera, a video chat device, a real-time communication device such as video communication, a mobile streaming device, a storage medium, a camera, a video on demand (VoD) service provider, an OTT video (over the top video) device, an Internet streaming service provider, a three-dimensional (3D) video device, a video phone video device, a medical video device, etc., and may be used to process a video signal or a data signal. For example, an OTT video device may include a game console, a Blu-ray player, an Internet access TV, a home theater system, a smart phone, a tablet PC, a digital video recorder (DVR), etc.

[0249] Fig.14 is a diagram showing a content streaming system to which an embodiment of the present disclosure is applicable.

[0250] like Fig.14 As shown in , a content streaming system to which the embodiments of the present disclosure are applied may mainly include an encoding server, a streaming server, a network server, a media storage device, a user device, and a multimedia input device.

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

[0252] The bitstream may be generated by the image encoding method or the image encoding device to which the embodiments of the present disclosure are applied, and the streaming server may temporarily store the bitstream in the process of transmitting or receiving the bitstream.

[0253] The streaming server sends multimedia data to the user device based on the user's request through the network server, and the network server is used as a medium to inform the user of the service. When the user requests the required service from the network server, the network server can deliver it to the streaming server, and the streaming server can send 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.

[0254] The streaming server may receive content from a media storage device and / or an encoding server. For example, when receiving content from an encoding server, the content may be received in real time. In this case, in order to provide a smooth streaming service, the streaming server may store the bitstream within a predetermined time.

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

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

[0257] The scope of the present disclosure includes software or machine-executable commands (e.g., operating systems, applications, firmware, programs, etc.) for enabling operations of methods according to various embodiments to be performed on a device or computer, and non-transitory computer-readable media having such software or commands stored thereon and executable on a device or computer.

[0258] Industrial Applicability

[0259] The embodiments of the present disclosure may be used to encode or decode an image.

Claims

1. An image decoding method performed by an image decoding device, the image decoding method comprising the following steps: Determine prediction modes respectively applied to prediction directions of the current block, the prediction modes including an AMVP mode and a merge mode; Constructing an AMVP candidate list and a merged candidate list based on the prediction mode; as well as Generate a prediction block of the current block based on the AMVP candidate list and the merge candidate list, The merge candidate list includes fallback candidates.

2. The image decoding method according to claim 1, wherein: Based on the number of merge candidates included in the merge candidate list being less than the maximum number of merge candidates, the fallback candidate is included in the merge candidate list.

3. The image decoding method according to claim 1, wherein: Based on the number of reference pictures included in the merge reference picture list being less than a predetermined value, the fallback candidate is included in the merge candidate list.

4. The image decoding method according to claim 3, wherein: The predetermined value is a smaller value between the number of reference pictures included in the merged reference picture list and the number of reference pictures included in the AMVP reference picture list.

5. The image decoding method according to claim 3, wherein: The predetermined value is the number of reference pictures included in the merged reference picture list.

6. The image decoding method according to claim 3, wherein: Based on that a reference picture of the fallback candidate is available, the fallback candidate is included in the merge candidate list.

7. The image decoding method according to claim 1, wherein: Based on the number of merge candidates included in the merge candidate list being less than or equal to a predefined value, the fallback candidate is included in the merge candidate list.

8. An image encoding method performed by an image encoding device, the image encoding method comprising the following steps: Determine prediction modes respectively applied to prediction directions of the current block, the prediction modes including an AMVP mode and a merge mode; Constructing an AMVP candidate list and a merged candidate list based on the prediction mode; as well as Generate a prediction block of the current block based on the AMVP candidate list and the merge candidate list, The merge candidate list includes fallback candidates.

9. A method for transmitting a bit stream generated by an image encoding method, the image encoding method comprising the following steps: Determine prediction modes respectively applied to prediction directions of the current block, the prediction modes including an AMVP mode and a merge mode; Constructing an AMVP candidate list and a merged candidate list based on the prediction mode; as well as Generate a prediction block of the current block based on the AMVP candidate list and the merge candidate list, The merge candidate list includes fallback candidates.