Video decoding methods, video encoding methods, and compressed video data transmission devices.

VN128527APending Publication Date: 2026-09-03KT CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
VN1202603045
Authority / Receiving Office
VN · VN
Patent Type
Applications
Current Assignee / Owner
Priority Date
2017-08-29
Filing Date
2018-08-27
Publication Date
2026-09-03

AI Technical Summary

Technical Problem

As high-resolution and high-quality video data increases, existing video compression technologies face challenges in efficiently compressing and transmitting video signals, leading to higher transmission and storage costs, and there is a need for improved methods in inter prediction during video encoding and decoding, especially for three-dimensional video content.

Method used

The method involves obtaining an initial motion vector for a current block, deriving refined motion vectors for search points, and selecting the most suitable one to enhance motion information update, with options for refinement modes like bidirectional or template matching, and determining search patterns based on block characteristics.

Benefits of technology

This approach efficiently performs inter prediction and updates motion information, increasing encoding/decoding efficiency by variably determining search patterns, thereby reducing costs and improving the handling of high-resolution video data, including stereoscopic content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure VN1202603045_0
    Figure VN1202603045_0
Patent Text Reader

Abstract

The invention relates to a method for decoding video comprising: a step for acquiring the initial motion vector of the current block; a step for acquiring a finely tuned motion vector for each of the search points based on the initial motion vector; and a step for acquiring the motion vector of the current block based on the finely tuned motion vector of any one of the search points. The invention also relates to a method for encoding video, a video decoding device, and a video encoding device.
Need to check novelty before this filing date? Find Prior Art

Description

Video signal processing method and device

[0001] The present invention relates to a video signal processing method and apparatus.

[0002] Recently, the demand for high-resolution, high-quality video, such as HD (High Definition) and UHD (Ultra High Definition) video, has been increasing across various application fields. As video data becomes higher in resolution and quality, the relative volume of data increases compared to conventional video data; consequently, transmission and storage costs increase when video data is transmitted using existing wired or wireless broadband lines or stored using conventional storage media. To address these issues arising from the increase in video data resolution and quality, high-efficiency video compression technologies can be utilized.

[0003] Various video compression technologies exist, such as inter-frame prediction technology that predicts pixel values ​​in the current picture from previous or subsequent pictures, intra-frame prediction technology that predicts pixel values ​​in the current picture using pixel information within the current picture, and entropy coding technology that assigns short codes to values ​​with high frequency and long codes to values ​​with low frequency; by utilizing these video compression technologies, video data can be effectively compressed for transmission or storage.

[0004] Meanwhile, along with the increasing demand for high-resolution video, the demand for stereoscopic video content as a new video service is also rising. Discussions are underway regarding video compression technologies to effectively provide high-resolution and ultra-high-resolution stereoscopic video content.

[0005] The present invention aims to provide a method and apparatus capable of efficiently performing inter-prediction on a block to be encoded / decoded when encoding / decoding a video signal.

[0006] The present invention aims to provide a method and apparatus for updating motion information of a current block in encoding / decoding a video signal.

[0007] The present invention aims to provide a method and apparatus for variably determining search points used to update motion information of a current block in encoding / decoding a video signal.

[0008] The technical problems to be solved by the present invention are not limited to those mentioned above, and other technical problems not mentioned will be clearly understood by those skilled in the art to which the present invention belongs from the description below.

[0009] The video signal decoding method and apparatus according to the present invention can obtain an initial motion vector of a current block, derive a refined motion vector of each of a plurality of search points based on the initial motion vector, and obtain a motion vector of the current block based on a refined motion vector of any one of the plurality of search points.

[0010] A video signal encoding method and apparatus according to the present invention can obtain an initial motion vector of a current block, derive a refined motion vector of each of a plurality of search points based on the initial motion vector, and obtain a motion vector of the current block based on a refined motion vector of any one of the plurality of search points.

[0011] In the video signal encoding / decoding method and apparatus according to the present invention, the initial motion vector may be obtained based on the merge candidate or motion vector candidate of the current block.

[0012] In the video signal encoding / decoding method and apparatus according to the present invention, the method further comprises the step of selecting a refinement mode of the current block, wherein the refinement mode may include at least one of bidirectional matching or template matching.

[0013] In the video signal encoding / decoding method and apparatus according to the present invention, the refinement mode may be determined based on whether the prediction direction of the current block is bidirectional.

[0014] In the video signal encoding / decoding method and apparatus according to the present invention, when the refinement mode is bidirectional matching, the cost of the search point can be calculated by comparing a first prediction block obtained based on the initial motion vector and a second prediction block obtained based on the refined motion vector.

[0015] In the video signal encoding / decoding method and apparatus according to the present invention, when the refinement mode is template matching, the cost of the search point can be calculated by comparing a template adjacent to the current block with a template adjacent to a reference block specified by the refine motion vector.

[0016] In a video signal encoding / decoding method and apparatus according to the present invention, the method further includes the step of determining a search pattern of the current block, and by the determined search pattern, at least one of the number of search points, the location, or the search order among the plurality of search points may be determined.

[0017] In the video signal encoding / decoding method and apparatus according to the present invention, the search pattern of the current block may be determined based on at least one of the size, shape, inter-prediction mode, or refinement mode of the current block.

[0018] The features briefly summarized above regarding the present invention are merely exemplary aspects of the detailed description of the present invention that follows and do not limit the scope of the present invention.

[0019] According to the present invention, inter-prediction can be efficiently performed on a block to be encoded / decoded.

[0020] According to the present invention, by updating the movement information of the current block, there is an advantage in that the efficiency of inter prediction can be increased.

[0021] According to the present invention, by variably determining the search pattern, there is an advantage in that the efficiency of inter prediction can be increased.

[0022] The effects obtainable from the present invention are not limited to those mentioned above, and other unmentioned effects will be clearly understood by those skilled in the art from the description below.

[0023] FIG. 1 is a block diagram showing an image encoding device according to an embodiment of the present invention.

[0024] FIG. 2 is a block diagram showing an image decoding device according to an embodiment of the present invention.

[0025] FIG. 3 illustrates an example of hierarchically dividing coding blocks based on a tree structure as an embodiment to which the present invention is applied.

[0026] FIG. 4 is a diagram showing a partition shape that allows binary tree-based partitioning as an embodiment to which the present invention is applied.

[0027] FIG. 5 is a diagram illustrating an example in which the present invention is applied, wherein only a specific type of binary tree-based partitioning is allowed.

[0028] FIG. 6 is a diagram illustrating an example in which information related to the number of times a binary tree is allowed is encoded / decoded as an embodiment to which the present invention is applied.

[0029] FIG. 7 is a diagram illustrating a partition mode that can be applied to a coding block as an embodiment to which the present invention is applied.

[0030] FIG. 8 is a flowchart illustrating an inter prediction method as an embodiment to which the present invention is applied.

[0031] Figure 9 is a diagram illustrating the process of inducing movement information of the current block when a merge mode is applied to the current block.

[0032] Figure 10 is a diagram showing an example of spatially adjacent blocks.

[0033] Figure 11 is a diagram illustrating an example of deriving motion vectors of temporal merge candidates.

[0034] FIG. 12 is a diagram showing the locations of candidate blocks that can be used as collocated blocks.

[0035] Figure 13 is a diagram illustrating the process of inducing movement information of the current block when the AMVP mode is applied to the current block.

[0036] FIG. 14 is a diagram illustrating a method for updating the motion vector of a current block according to an embodiment of the present invention.

[0037] Figure 15 is a drawing showing a diamond pattern.

[0038] Figure 16 is a diagram showing an adaptive cross pattern.

[0039] Figure 17 is a diagram showing a star pattern.

[0040] Figure 18 is a drawing showing a hexagon pattern.

[0041] FIG. 19 is a diagram illustrating the derivation of a refined motion vector for a search point.

[0042] FIG. 20 is a diagram illustrating an example of measuring the cost at a search point when the refinement mode is bidirectional matching.

[0043] Figure 21 is a diagram illustrating an example of measuring the cost at a search point when the refinement mode is template matching.

[0044] The present invention is susceptible to various modifications and may have various embodiments; specific embodiments are illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the invention to specific embodiments, and it should be understood that the invention includes all modifications, equivalents, and substitutions that fall within the spirit and scope of the invention. Similar reference numerals have been used for similar components in the description of each drawing.

[0045] Terms such as "first," "second," etc., may be used to describe various components, but said components should not be limited by said terms. These terms are used solely for the purpose of distinguishing one component from another. For example, without departing from the scope of the present invention, the first component may be named the second component, and similarly, the second component may be named the first component. The term "and / or" includes a combination of a plurality of related described items or any of a plurality of related described items.

[0046] When it is stated that one component is "connected" or "connected" to another component, it should be understood that while it may be directly connected or connected to that other component, there may also be other components in between. On the other hand, when it is stated that one component is "directly connected" or "directly connected" to another component, it should be understood that there are no other components in between.

[0047] The terms used in this application are used merely to describe specific embodiments and are not intended to limit the invention. The singular expression includes the plural expression unless the context clearly indicates otherwise. In this application, terms such as "comprising" or "having" are intended to specify the presence of the features, numbers, steps, actions, components, parts, or combinations thereof described in the specification, and should be understood as not precluding the existence or addition of one or more other features, numbers, steps, actions, components, parts, or combinations thereof.

[0048] Hereinafter, preferred embodiments of the present invention will be described in more detail with reference to the attached drawings. Hereinafter, the same reference numerals are used for identical components in the drawings, and redundant descriptions of identical components are omitted.

[0049]

[0050] FIG. 1 is a block diagram showing an image encoding device according to an embodiment of the present invention.

[0051] Referring to FIG. 1, the image encoding device (100) may include a picture splitting unit (110), a prediction unit (120, 125), a conversion unit (130), a quantization unit (135), a reordering unit (160), an entropy encoding unit (165), an inverse quantization unit (140), an inverse conversion unit (145), a filter unit (150), and a memory (155).

[0052] Each component shown in FIG. 1 is depicted independently to represent different characteristic functions of the image encoding device and does not imply that each component consists of separate hardware or a single software unit. That is, each component is listed and included as a separate component for the convenience of explanation, but at least two of the components may be combined to form a single component, or a single component may be divided into multiple components to perform functions, and such integrated and separated embodiments of each component are included within the scope of the present invention as long as they do not deviate from the essence of the present invention.

[0053] Furthermore, some components may not be essential components performing an essential function in the present invention, but merely optional components for enhancing performance. The present invention may be implemented by including only the components essential for realizing the essence of the present invention, excluding components used solely for performance enhancement, and a structure including only the essential components, excluding optional components used solely for performance enhancement, is also included within the scope of the rights of the present invention.

[0054] The picture segmentation unit (110) can divide an input picture into at least one processing unit. At this time, the processing unit may be a Prediction Unit (PU), a Transform Unit (TU), or a Coding Unit (CU). The picture segmentation unit (110) can divide a picture into a combination of multiple coding units, prediction units, and transformation units, and can encode the picture by selecting one combination of coding units, prediction units, and transformation units based on a predetermined criterion (e.g., a cost function).

[0055] For example, a single picture can be divided into multiple coding units. To divide coding units within a picture, a recursive tree structure such as a Quad Tree Structure can be used. A coding unit divided into other coding units, with a single image or the largest coding unit as the root, can have as many child nodes as there are divided coding units. A coding unit that can no longer be divided according to certain limits becomes a leaf node. That is, assuming that only square division is possible for a single coding unit, a single coding unit can be divided into up to four different coding units.

[0056] In the following embodiments of the present invention, the encoding unit may be used to mean a unit that performs encoding, or a unit that performs decoding.

[0057] A prediction unit may be divided into at least one shape, such as a square or rectangle, of the same size within a single encoding unit, or one of the prediction units divided within a single encoding unit may be divided such that any one prediction unit has a different shape and / or size from another prediction unit.

[0058] When generating a prediction unit that performs intra prediction based on a coding unit, if it is not the minimum coding unit, intra prediction can be performed without dividing it into multiple prediction units NxN.

[0059] The prediction unit (120, 125) may include an inter prediction unit (120) that performs inter prediction and an intra prediction unit (125) that performs intra prediction. It may determine whether to use inter prediction or perform intra prediction for a prediction unit, and determine specific information (e.g., intra prediction mode, motion vector, reference picture, etc.) according to each prediction method. At this time, the processing unit in which the prediction is performed and the processing unit in which the prediction method and specific details are determined may be different. For example, the prediction method and prediction mode, etc. may be determined in the prediction unit, and the prediction may be performed in the transformation unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transformation unit (130). In addition, the prediction mode information, motion vector information, etc. used for prediction may be encoded together with the residual value in the entropy encoding unit (165) and transmitted to the decoder. When using a specific encoding mode, it is also possible to encode the original block as is and transmit it to the decoding unit without generating a prediction block through the prediction unit (120, 125).

[0060] The inter prediction unit (120) may predict a prediction unit based on information of at least one picture among the previous picture or the subsequent picture of the current picture, and in some cases, may predict a prediction unit based on information of a partially encoded area within the current picture. The inter prediction unit (120) may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.

[0061] In the reference picture interpolation unit, reference picture information is received from memory (155), and pixel information of integer pixels or less can be generated from the reference picture. In the case of luminance pixels, a DCT-based 8-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 4 pixel units. In the case of chrominance signals, a DCT-based 4-tap interpolation filter with different filter coefficients can be used to generate pixel information of integer pixels or less in 1 / 8 pixel units.

[0062] The motion prediction unit can perform motion prediction based on a reference picture interpolated by the reference picture interpolation unit. Various methods such as FBMA (Full search-based Block Matching Algorithm), TSS (Three Step Search), and NTS (New Three-Step Search Algorithm) can be used to calculate motion vectors. Based on the interpolated pixels, the motion vector can have motion vector values ​​in units of 1 / 2 or 1 / 4 pixels. The motion prediction unit can predict the current prediction unit by using different motion prediction methods. Various motion prediction methods such as the Skip method, Merge method, AMVP (Advanced Motion Vector Prediction) method, and Intra Block Copy method can be used.

[0063] The intra prediction unit (125) can generate a prediction unit based on reference pixel information around the current block, which is pixel information within the current picture. If the surrounding block of the current prediction unit is a block that has performed inter prediction, and the reference pixel is a pixel that has performed inter prediction, the reference pixel included in the block that has performed inter prediction can be replaced with the reference pixel information of the surrounding intra prediction block. That is, if the reference pixel is not available, the unavailable reference pixel information can be replaced with at least one of the available reference pixels.

[0064] In intra-prediction, the prediction mode may include a directional prediction mode that uses reference pixel information according to the prediction direction, and a non-directional mode that does not use directional information when performing the prediction. The mode for predicting luminance information and the mode for predicting chrominance information may be different, and the intra-prediction mode information used to predict luminance information or the predicted luminance signal information may be utilized to predict chrominance information.

[0065] When performing intra prediction, if the size of the prediction unit and the size of the transform unit are the same, intra prediction for the prediction unit can be performed based on the pixels to the left, the pixels at the top left, and the pixels at the top of the prediction unit. However, when performing intra prediction, if the size of the prediction unit and the size of the transform unit are different, intra prediction can be performed using reference pixels based on the transform unit. Additionally, intra prediction using NxN partitioning can be used only for the minimum encoding unit.

[0066] The intra prediction method can generate a prediction block after applying an Adaptive Intra Smoothing (AIS) filter to a reference pixel according to the prediction mode. The type of AIS filter applied to the reference pixel may vary. To perform the intra prediction method, the intra prediction mode of the current prediction unit can be predicted from the intra prediction modes of prediction units existing in the vicinity of the current prediction unit. When predicting the prediction mode of the current prediction unit using mode information predicted from neighboring prediction units, if the intra prediction modes of the current prediction unit and the neighboring prediction units are the same, information indicating that the prediction modes of the current prediction unit and the neighboring prediction units are the same can be transmitted using predetermined flag information; if the prediction modes of the current prediction unit and the neighboring prediction units are different, entropy coding can be performed to encode the prediction mode information of the current block.

[0067] Additionally, a residual block can be generated that includes residual value information, which is the difference between the prediction unit that performed the prediction based on the prediction unit generated in the prediction unit (120, 125) and the original block of the prediction unit. The generated residual block can be input to the conversion unit (130).

[0068] In the transformation unit (130), the residual block containing residual value information of the prediction unit generated through the original block and the prediction unit (120, 125) can be transformed using a transformation method such as DCT (Discrete Cosine Transform), DST (Discrete Sine Transform), or KLT. Whether to apply DCT, DST, or KLT to transform the residual block can be determined based on the intra-prediction mode information of the prediction unit used to generate the residual block.

[0069] The quantization unit (135) can quantize the values ​​converted into the frequency domain in the conversion unit (130). The quantization coefficient may vary depending on the block or the importance of the image. The values ​​produced by the quantization unit (135) may be provided to the inverse quantization unit (140) and the reordering unit (160).

[0070] The reordering unit (160) can perform reordering of coefficient values ​​for quantized residual values.

[0071] The reordering unit (160) can convert two-dimensional block-shaped coefficients into one-dimensional vector forms through a coefficient scanning method. For example, the reordering unit (160) can convert the coefficients from DC to high-frequency range coefficients into one-dimensional vector forms by scanning using a Zig-Zag Scan method. Depending on the size of the conversion unit and the intra-prediction mode, a vertical scan that scans two-dimensional block-shaped coefficients in the column direction or a horizontal scan that scans two-dimensional block-shaped coefficients in the row direction may be used instead of the Zig-Zag Scan. That is, depending on the size of the conversion unit and the intra-prediction mode, it can be determined whether to use a Zig-Zag Scan, a vertical scan, or a horizontal scan.

[0072] The entropy encoding unit (165) can perform entropy encoding based on the values ​​calculated by the reordering unit (160). Entropy encoding can use various encoding methods, such as, for example, Exponential Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC).

[0073] The entropy encoding unit (165) can encode various information from the reordering unit (160) and the prediction unit (120, 125), such as residual value coefficient information of the encoding unit, block type information, prediction mode information, division unit information, prediction unit information and transmission unit information, motion vector information, reference frame information, block interpolation information, and filtering information.

[0074] The entropy encoding unit (165) can entropy-encode the coefficient value of the encoding unit input from the rearrangement unit (160).

[0075] In the inverse quantization unit (140) and inverse transformation unit (145), the values ​​quantized in the quantization unit (135) are inverse quantized, and the values ​​transformed in the transformation unit (130) are inverse transformed. The residual value generated in the inverse quantization unit (140) and inverse transformation unit (145) can be combined with the prediction unit predicted through the motion estimation unit, motion compensation unit, and intra prediction unit included in the prediction unit (120, 125) to generate a reconstructed block.

[0076] The filter section (150) may include at least one of a deblocking filter, an offset correction section, and an ALF (Adaptive Loop Filter).

[0077] The deblocking filter can remove block distortion caused by boundaries between blocks in the restored picture. To determine whether to perform deblocking, the decision to apply the deblocking filter to the current block can be made based on the pixels contained in a certain number of columns or rows within the block. When applying the deblocking filter to a block, a Strong Filter or a Weak Filter can be applied depending on the required deblocking filtering strength. Additionally, when applying the deblocking filter, horizontal and vertical filtering can be processed in parallel.

[0078] The offset correction unit can correct the offset from the original image on a pixel-by-pixel basis for the image that has undergone deblocking. To perform offset correction for a specific picture, a method can be used in which pixels included in the image are divided into a certain number of regions, the region to be offset is determined, and the offset is applied to that region, or a method can be used in which the offset is applied by considering the edge information of each pixel.

[0079] Adaptive Loop Filtering (ALF) can be performed based on a comparison between the filtered restored image and the original image. After dividing the pixels included in the image into predetermined groups, a single filter to be applied to each group can be determined, allowing for differential filtering for each group. Information regarding whether to apply ALF can be transmitted per coding unit (CU), and the shape and filter coefficients of the ALF filter to be applied may vary depending on each block. Additionally, an ALF filter of the same form (fixed form) may be applied regardless of the characteristics of the block to be applied.

[0080] The memory (155) can store a restored block or picture produced through the filter unit (150), and the stored restored block or picture can be provided to the prediction unit (120, 125) when performing inter-prediction.

[0081]

[0082] FIG. 2 is a block diagram showing an image decoding device according to an embodiment of the present invention.

[0083] Referring to FIG. 2, the image decoder (200) may include an entropy decoder (210), a reordering unit (215), an inverse quantization unit (220), an inverse transformation unit (225), a prediction unit (230, 235), a filter unit (240), and a memory (245).

[0084] When a video bitstream is input to a video encoder, the input bitstream can be decoded using the reverse procedure of the video encoder.

[0085] The entropy decoding unit (210) can perform entropy decoding in the opposite procedure to that which the entropy encoding unit of the image encoder performed. For example, various methods such as Exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding) can be applied in correspondence with the method performed in the image encoder.

[0086] The entropy decoding unit (210) can decode information related to intra-prediction and inter-prediction performed in the encoder.

[0087] The reordering unit (215) can perform reordering based on the method of reordering the entropy-decoded bitstream in the encoding unit in the entropy decoding unit (210). It can reorder by restoring the coefficients expressed in the form of a one-dimensional vector back into coefficients in the form of a two-dimensional block. The reordering unit (215) can perform reordering by receiving information related to the coefficient scanning performed in the encoding unit and scanning in reverse based on the scanning order performed in the encoding unit.

[0088] The inverse quantization unit (220) can perform inverse quantization based on the coefficient values ​​of the rearranged block and the quantization parameters provided by the encoder.

[0089] The inverse transform unit (225) can perform inverse transforms, i.e., inverse DCT, inverse DST, and inverse KLT, on the transforms, i.e., DCT, DST, and KLT, performed by the transform unit on the quantization result performed by the image encoder. The inverse transform can be performed based on the transmission unit determined by the image encoder. In the inverse transform unit (225) of the image decoder, a transformation technique (e.g., DCT, DST, KLT) can be selectively performed according to multiple pieces of information such as a prediction method, the size of the current block, and the prediction direction.

[0090] The prediction unit (230, 235) can generate a prediction block based on the prediction block generation information provided by the entropy decoding unit (210) and the previously decoded block or picture information provided by the memory (245).

[0091] As described above, when performing intra prediction identical to the operation in the video encoder, if the size of the prediction unit and the size of the transform unit are the same, intra prediction for the prediction unit is performed based on the pixels to the left, the pixels to the top left, and the pixels to the top of the prediction unit; however, if the size of the prediction unit and the size of the transform unit are different when performing intra prediction, intra prediction can be performed using reference pixels based on the transform unit. Additionally, intra prediction using NxN partitioning only for the minimum encoding unit may also be used.

[0092] The prediction unit (230, 235) may include a prediction unit determination unit, an inter prediction unit, and an intra prediction unit. The prediction unit determination unit receives various information, such as prediction unit information input from the entropy decoding unit (210), prediction mode information of the intra prediction method, and motion prediction related information of the inter prediction method, distinguishes the prediction unit from the current encoding unit, and determines whether the prediction unit performs inter prediction or intra prediction. The inter prediction unit (230) may perform inter prediction for the current prediction unit based on information included in at least one picture, either the previous picture or the subsequent picture, of the current picture containing the current prediction unit, using information required for inter prediction of the current prediction unit provided by the video encoder. Alternatively, it may perform inter prediction based on information of a partially restored area within the current picture containing the current prediction unit.

[0093] To perform inter-prediction, based on the encoding unit, it is possible to determine whether the motion prediction method of the prediction unit included in the corresponding encoding unit is Skip Mode, Merge Mode, AMVP Mode, or Intra-Block Copy Mode.

[0094] The intra prediction unit (235) can generate a prediction block based on pixel information within the current picture. If the prediction unit is a prediction unit that has performed intra prediction, it can perform intra prediction based on the intra prediction mode information of the prediction unit provided by the image encoder. The intra prediction unit (235) may include an Adaptive Intra Smoothing (AIS) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter is a part that performs filtering on the reference pixel of the current block, and can determine whether to apply the filter based on the prediction mode of the current prediction unit. AIS filtering can be performed on the reference pixel of the current block using the prediction mode of the prediction unit and the AIS filter information provided by the image encoder. If the prediction mode of the current block is a mode that does not perform AIS filtering, the AIS filter may not be applied.

[0095] The reference pixel interpolation unit can generate a reference pixel of an integer value or less by interpolating the reference pixel when the prediction mode of the prediction unit is a prediction unit that performs intra-prediction based on the pixel value interpolated from the reference pixel. If the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating the reference pixel, the reference pixel may not be interpolated. The DC filter can generate a prediction block through filtering when the prediction mode of the current block is DC mode.

[0096] The restored block or picture may be provided to a filter unit (240). The filter unit (240) may include a deblocking filter, an offset correction unit, and an ALF.

[0097] Information regarding whether a deblocking filter has been applied to the corresponding block or picture can be received from the video encoder, and if a deblocking filter has been applied, information regarding whether a strong filter or a weak filter has been applied. The deblocking filter of the video decoder receives information related to the deblocking filter provided by the video encoder and can perform deblocking filtering on the corresponding block.

[0098] The offset correction unit can perform offset correction on the restored image based on the type of offset correction and offset value information applied to the image during encoding.

[0099] ALF can be applied to the encoding unit based on information on whether to apply ALF, ALF coefficient information, etc., provided by the encoder. This ALF information can be provided included in a specific parameter set.

[0100] The memory (245) can store the restored picture or block so that it can be used as a reference picture or reference block, and can also provide the restored picture to the output unit.

[0101] As described above, in the embodiments of the present invention below, for convenience of explanation, the term "Coding Unit" is used as "encoding unit," but it may be a unit that performs not only encoding but also decoding.

[0102] Additionally, the current block represents a block to be encoded / decoded, and depending on the encoding / decoding stage, it may represent a coding tree block (or coding tree unit), an encoding block (or encoding unit), a conversion block (or conversion unit), or a prediction block (or prediction unit), etc.

[0103]

[0104] A picture can be divided into square or non-square base blocks for encoding / decoding. In this case, the base block may be referred to as a Coding Tree Unit. A Coding Tree Unit may be defined as the largest encoding unit allowed in a sequence or slice. Information regarding whether a Coding Tree Unit is square or non-square, or the size of the Coding Tree Unit, may be signaled through a sequence parameter set, a picture parameter set, or a slice header. A Coding Tree Unit may be divided into smaller partitions. In this case, if the partition created by dividing a Coding Tree Unit is denoted as depth 1, the partition created by dividing a depth 1 partition may be defined as depth 2. That is, the partition created by dividing a depth k partition within a Coding Tree Unit may be defined as having depth k+1.

[0105] A partition of arbitrary size generated as a coding tree unit is divided can be defined as a coding unit. A coding unit may be recursively divided or divided into basic units for performing prediction, quantization, transformation, or in-loop filtering. For example, a partition of arbitrary size generated as a coding unit is divided can be defined as a coding unit, or as a transformation unit or a prediction unit, which is a basic unit for performing prediction, quantization, transformation, or in-loop filtering.

[0106] Partitioning of a coding tree unit or a coding unit may be performed based on at least one of a vertical line or a horizontal line. Additionally, the number of vertical lines or horizontal lines partitioning the coding tree unit or a coding unit may be at least one. For example, a coding tree unit or a coding unit may be divided into two partitions using one vertical line or one horizontal line, or a coding tree unit or a coding unit may be divided into three partitions using two vertical lines or two horizontal lines. Alternatively, a coding tree unit or a coding unit may be divided into four partitions with a length and width of 1 / 2 using one vertical line and one horizontal line.

[0107] When a coding tree unit or a coding unit is divided into multiple partitions using at least one vertical line or at least one horizontal line, the partitions may have a uniform size or different sizes. Alternatively, one partition may have a different size from the remaining partitions.

[0108] In the embodiments described below, it is assumed that the coding tree unit or coding unit is divided into a quad tree, triple tree, or binary tree structure. However, division of the coding tree unit or coding unit using a greater number of vertical lines or a greater number of horizontal lines is also possible.

[0109] FIG. 3 illustrates an example of hierarchically dividing coding blocks based on a tree structure as an embodiment to which the present invention is applied.

[0110] The input video signal is decoded in predetermined block units, and the basic unit for decoding the input video signal in this way is called a coding block. A coding block can be a unit that performs intra / inter prediction, transformation, and quantization. In addition, a prediction mode (e.g., intra-frame prediction mode or inter-frame prediction mode) is determined in units of coding blocks, and prediction blocks included in the coding block can share the determined prediction mode. A coding block may be a square or non-square block of any size within the range of 8x8 to 64x64, or a square or non-square block of 128x128, 256x256, or larger.

[0111] Specifically, coding blocks may be hierarchically partitioned based on at least one of a quad tree, a triple tree, and a binary tree. Here, quad tree-based partitioning may mean a method in which a 2Nx2N coding block is partitioned into 4 NxN coding blocks, triple tree-based partitioning may mean a method in which a single coding block is partitioned into 3 coding blocks, and binary tree-based partitioning may mean a method in which a single coding block is partitioned into 2 coding blocks. Even if triple tree partitioning or binary tree-based partitioning is performed, square coding blocks may exist in lower depths. Alternatively, after triple tree partitioning or binary tree-based partitioning is performed, the generation of square coding blocks in lower depths may be restricted.

[0112] Binary tree-based partitioning may be performed symmetrically or asymmetrically. Coding blocks partitioned based on a binary tree may be square blocks or non-square blocks such as rectangles. For example, partition types that allow binary tree-based partitioning may include at least one of symmetric 2NxN (horizontal non-square coding units) or Nx2N (vertical non-square coding units), and asymmetric nLx2N, nRx2N, 2NxnU, or 2NxnD, as shown in the example in FIG. 4.

[0113] Binary tree-based partitioning may restrictively allow only one of symmetric or asymmetric partitions. In this case, configuring the coding tree units into square blocks corresponds to quad tree CU partitioning, and configuring the coding tree units into symmetric non-square blocks corresponds to binary tree partitioning. configuring the coding tree units into square blocks and symmetric non-square blocks corresponds to quad and binary tree CU partitioning.

[0114] Binary tree-based splitting can be performed on coding blocks where quad tree-based splitting is no longer performed. For coding blocks split based on binary trees, at least one of quad tree-based splitting, triple tree-based splitting, or binary tree-based splitting can be configured so that it is no longer performed.

[0115] Alternatively, for coding blocks partitioned based on a binary tree, triple tree-based partitioning or binary tree-based partitioning may be allowed, but only one of horizontal or vertical partitioning may be allowed restrictively.

[0116] For example, depending on the location, index, shape, and additional partitioning shape of neighboring partitions of the coding blocks partitioned based on a binary tree, additional partitioning or additional partitioning directions may be restricted for the coding blocks partitioned based on a binary tree. For example, when the index of the coding block with the earlier coding order among two coding blocks created by binary tree-based partitioning is 0 (hereinafter, coding block index 0) and the index of the coding block with the later coding order is 1 (hereinafter, coding block index 1), if binary tree-based partitioning is applied to both the coding blocks with coding block index 0 and coding block index 1, the binary tree-based partitioning direction of the coding block with coding block index 1 may be determined according to the binary tree-based partitioning direction of the coding block with coding block index 0. Specifically, if the binary tree-based partitioning direction of a coding block with a coding block index of 0 is to partition the coding block with a coding block index of 0 into square partitions, the binary tree-based partitioning of a coding block with a coding block index of 1 may be restricted to have a different direction from the binary tree-based partitioning of the coding block with a coding block index of 1. That is, it may be restricted for both coding blocks with a coding block index of 0 and coding block index of 1 to be partitioned into square partitions. In this case, the encoding / decoding of information indicating the binary tree partitioning direction of the coding block with a coding block index of 1 may be omitted. This is because partitioning both coding blocks with a coding block index of 0 and coding block index of 1 into square partitions has the same effect as partitioning the upper depth block based on a quad tree, and allowing both coding block index of 0 and coding block index of 1 to be partitioned into square partitions is not desirable in terms of encoding efficiency.

[0117] Triple tree-based partitioning refers to dividing a coding block into three partitions in a horizontal or vertical direction. All three partitions created by triple tree-based partitioning may have different sizes. Alternatively, two of the partitions created by triple tree-based partitioning may have the same size, while the remaining one has a different size. For example, the width or height ratio of the partitions created as the coding block is divided may be set to 1:n:1, 1:1:n, n:1:1, or m:n:1 depending on the direction of division. Here, m and n can be real numbers greater than 1 or integers such as 2.

[0118] Triple tree-based splitting can be performed on coding blocks where quad tree-based splitting is no longer performed. For coding blocks split based on triple trees, at least one of quad tree-based splitting, triple tree-based splitting, or binary tree-based splitting can be configured so that it is no longer performed.

[0119] Alternatively, for coding blocks partitioned based on a triple tree, triple tree-based partitioning or binary tree-based partitioning may be allowed, but only one of horizontal or vertical partitioning may be allowed restrictively.

[0120] For example, depending on the location, index, shape, size, and additional splitting form of neighboring partitions of the coding blocks partitioned based on a triple tree, additional splitting or additional splitting directions for the coding blocks partitioned based on a triple tree may be restricted. For example, for the largest partition among the coding blocks generated by the triple tree-based partitioning, either horizontal splitting or vertical splitting may be restricted. Specifically, for the largest partition among the coding blocks generated by the triple tree-based partitioning, binary tree splitting in the same direction as the triple tree splitting direction of the upper depth partition or triple tree splitting in the same direction may not be allowed. In this case, for the largest partition among the coding blocks partitioned based on a triple tree, the encoding / decoding of information indicating the binary tree splitting direction or the triple tree splitting direction may be omitted.

[0121] Binary tree or triple tree-based partitioning may be restricted depending on the size or shape of the current block. Here, the size of the current block may be expressed based on at least one of the current block's width, height, minimum / maximum value of width / height, the sum of the width and height, the product of the width and height, or the number of samples included in the current block. For example, if at least one of the current block's width or height is greater than a predefined value, binary tree or triple tree-based partitioning may not be allowed. Here, the predefined value may be an integer such as 16, 32, 64, or 128. For another example, if the ratio of the current block's width to height is greater than a predefined value or smaller than a predefined value, binary tree or triple tree-based partitioning may not be allowed. If the predefined value is 1, binary tree or triple tree-based partitioning may be allowed only if the current block is a square block with equal width and height.

[0122] The partitioning of lower depths may be determined dependently on the partitioning form of upper depths. For example, if binary tree-based partitioning is allowed in two or more depths, only binary tree-based partitioning of the same form as the binary tree partitioning form of upper depths may be allowed in lower depths. For instance, if binary tree-based partitioning of a 2NxN form is performed in upper depths, binary tree-based partitioning of a 2NxN form may also be performed in lower depths. Alternatively, if binary tree-based partitioning of an Nx2N form is performed in upper depths, binary tree-based partitioning of an Nx2N form may also be allowed in lower depths.

[0123] Conversely, at lower depths, it is also possible to allow only binary tree-based partitions that are different from the binary tree partitioning form at higher depths.

[0124] For a sequence, slice, coding tree unit, or coding unit, it may be restricted so that only specific forms of binary tree-based partitioning or specific forms of triple tree-based partitioning are used. For example, for a coding tree unit, it may be restricted so that only 2NxN or Nx2N forms of binary tree-based partitioning are allowed. The allowed partition forms may be predefined in the encoder or decoder, or information regarding the allowed or disallowed partition forms may be encoded and signaled through the bitstream.

[0125] FIG. 5 is a diagram showing an example where only specific forms of binary tree-based partitioning are allowed. FIG. 5(a) shows an example where only Nx2N forms of binary tree-based partitioning are allowed, and FIG. 5(b) shows an example where only 2NxN forms of binary tree-based partitioning are allowed. To implement the quad tree or binary tree-based adaptive partitioning, information indicating quad tree-based partitioning, information regarding the size / depth of coding blocks where quad tree-based partitioning is allowed, information indicating binary tree-based partitioning, information regarding the size / depth of coding blocks where binary tree-based partitioning is allowed, information regarding the size / depth of coding blocks where binary tree-based partitioning is not allowed, or information regarding whether the binary tree-based partitioning is vertical or horizontal may be used.

[0126] In addition, for a coding tree unit or a predetermined coding unit, the number of times binary tree splitting / triple tree splitting is allowed, the depth at which binary tree splitting / triple tree splitting is allowed, or the number of depths at which binary tree splitting / triple tree splitting is allowed can be obtained. The above information can be encoded in units of coding tree units or coding units and transmitted to a decoder via a bitstream.

[0127] For example, the syntax 'max_binary_depth_idx_minus1', which indicates the maximum depth at which binary tree splitting is allowed, can be encoded / decoded through the bitstream. In this case, max_binary_depth_idx_minus1+1 may indicate the maximum depth at which binary tree splitting is allowed.

[0128] Looking at the example illustrated in FIG. 6, it is shown that binary tree splitting is performed for a coding unit of depth 2 and a coding unit of depth 3. Accordingly, at least one of information indicating the number of times binary tree splitting is performed within a coding tree unit (2 times), information indicating the maximum depth (depth 3) at which binary tree splitting is allowed within a coding tree unit, or information indicating the number of depths (2, depth 2 and depth 3) at which binary tree splitting is allowed within a coding tree unit can be encoded / decoded through a bitstream.

[0129] As another example, at least one of the number of times binary tree splitting / triple tree splitting is allowed, the depth at which binary tree splitting / triple tree splitting is allowed, or the number of depths at which binary tree splitting / triple tree splitting is allowed may be obtained per sequence, picture, or slice. For example, the information may be encoded per sequence, picture, or slice and transmitted via a bitstream. Alternatively, the depth at which binary tree splitting / triple tree splitting is allowed or the number of depths at which binary tree splitting / triple tree splitting is allowed may be predefined per sequence, picture, or slice. Accordingly, at least one of the number of binary tree / triple tree splitting, the maximum depth at which binary tree / triple tree splitting is allowed, or the number of depths at which binary tree / triple tree splitting is allowed may differ between the first slice and the second slice. For example, in the first slice, binary tree splitting is allowed at only one depth, whereas in the second slice, binary tree splitting may be allowed at two depths.

[0130] As another example, at least one of the number of times binary tree / triple tree splitting is allowed, the depth at which binary tree / triple tree splitting is allowed, or the number of depths at which binary tree / triple tree splitting is allowed may be set differently depending on the Temporal ID of the slice or picture. Here, the Temporal ID is intended to identify each of multiple layers of an image having at least one scalability among view, spatial, temporal, or quality.

[0131] As illustrated in FIG. 3, a first coding block 300 with a split depth of k can be divided into a plurality of second coding blocks based on a quad tree. For example, the second coding blocks 310 to 340 are square blocks with a size half the width and height of the first coding block, and the split depth of the second coding blocks can be increased to k+1.

[0132] A second coding block 310 with a division depth of k+1 can be divided into a plurality of third coding blocks with a division depth of k+2. The division of the second coding block 310 can be performed by selectively using either a quad tree or a binary tree depending on the division method. Here, the division method can be determined based on at least one of information indicating division based on a quad tree or information indicating division based on a binary tree.

[0133] When the second coding block 310 is divided based on a quotate tree, the second coding block 310 is divided into four third coding blocks 310a, each having half the width and height of the second coding block, and the division depth of the third coding blocks 310a can be increased to k+2. On the other hand, when the second coding block 310 is divided based on a binary tree, the second coding block 310 can be divided into two third coding blocks. In this case, each of the two third coding blocks is a non-square block having half the width or height of the second coding block, and the division depth can be increased to k+2. The second coding block can be determined as a horizontal or vertical non-square block depending on the division direction, and the division direction can be determined based on information regarding whether the binary tree-based division is vertical or horizontal.

[0134] Meanwhile, the second coding block 310 may be determined as a terminal coding block that is no longer divided based on a quad tree or a binary tree, and in this case, the coding block may be used as a prediction block or a transformation block.

[0135] The third coding block 310a may be determined as a terminal coding block, similar to the division of the second coding block 310, or may be further divided based on a quad tree or a binary tree.

[0136] Meanwhile, the third coding block 310b, which is divided based on a binary tree, may be further divided into a vertical coding block (310b-2) or a horizontal coding block (310b-3) based on a binary tree, and the division depth of the coding block may be increased to k+3. Alternatively, the third coding block 310b may be determined as a terminal coding block (310b-1) that is no longer divided based on a binary tree, in which case the coding block (310b-1) may be used as a prediction block or a transformation block. However, the above-described division process may be performed restrictively based on at least one of information regarding the size / depth of a coding block that allows quad tree-based division, information regarding the size / depth of a coding block that allows binary tree-based division, or information regarding the size / depth of a coding block that does not allow binary tree-based division.

[0137] The size that a coding block may have may be limited to a predetermined number, or the size of a coding block within a predetermined unit may have a fixed value. For example, the size of a coding block within a sequence or the size of a coding block within a picture may be limited to 256x256, 128x128, or 32x32. Information indicating the size of a coding block within a sequence or picture may be signaled through a sequence header or a picture header.

[0138] As a result of partitioning based on quad trees, binary trees, and triple trees, the coding unit can take the form of a square or a rectangle of arbitrary size.

[0139]

[0140] A coding block can be encoded / decoded using at least one of a skip mode, intra-frame prediction, inter-frame prediction, or skip method.

[0141] As another example, intra-prediction or inter-prediction can be performed in units of the same size as or smaller than the coding block through the partitioning of the coding block. To this end, once the coding block is determined, the prediction block can be determined through the prediction partitioning of the coding block. The prediction partitioning of the coding block can be performed by a Part_mode that indicates the form of the coding block's partitioning. The size or shape of the prediction block can be determined according to the coding block's Part_mode. For example, the size of the prediction block determined by the Part_mode can have a value equal to or smaller than the size of the coding block.

[0142] Figure 7 is a diagram illustrating a partition mode that can be applied to a coding block when the coding block is encoded by cross-frame prediction.

[0143] When a coding block is encoded by cross-frame prediction, any one of the eight partition modes may be applied to the coding block, as in the example shown in FIG. 7.

[0144] If a coding block is encoded by in-screen prediction, the coding block may have a partition mode PART_2Nx2N or PART_NxN applied.

[0145] PART_NxN may be applied when the coding block has a minimum size. Here, the minimum size of the coding block may be predefined in the encoder and decoder. Alternatively, information regarding the minimum size of the coding block may be signaled via a bitstream. For example, the minimum size of the coding block may be signaled via a slice header, and accordingly, the minimum size of the coding block may be defined per slice.

[0146] Generally, the size of the prediction block can range from 64x64 to 4x4. However, if the coding block is encoded as an inter-frame prediction, the prediction block may not have a size of 4x4 in order to reduce memory bandwidth when performing motion compensation.

[0147]

[0148] FIG. 8 is a flowchart illustrating an inter prediction method as an embodiment to which the present invention is applied.

[0149] Referring to FIG. 8, movement information of the current block can be determined (S810). The movement information of the current block may include at least one of a movement vector for the current block, a reference picture index of the current block, or an inter-prediction direction of the current block.

[0150] The movement information of the current block can be obtained based on at least one of the information signaled through the bitstream or the movement information of a neighboring block adjacent to the current block.

[0151] Figure 9 is a diagram illustrating the process of inducing movement information of the current block when a merge mode is applied to the current block.

[0152] Merge mode represents a method of deriving movement information of the current block from surrounding blocks.

[0153] When a merge mode is applied to the current block, spatial merge candidates can be derived from spatial neighbor blocks of the current block (S910). Spatial neighbor blocks may include at least one of blocks adjacent to the top, left, or corner of the current block (e.g., at least one of the top left corner, top right corner, or bottom left corner).

[0154] Figure 10 is a diagram showing an example of spatially adjacent blocks.

[0155] As shown in the example illustrated in FIG. 10, the spatial neighbor block may include at least one of a neighbor block (A1) adjacent to the left of the current block, a neighbor block (B1) adjacent to the top of the current block, a neighbor block (A0) adjacent to the bottom left corner of the current block, a neighbor block (B0) adjacent to the top right corner of the current block, and a neighbor block (B2) adjacent to the top left corner of the current block.

[0156] Extending the embodiment of FIG. 10 further, at least one of the blocks adjacent to the upper left sample of the current block, the blocks adjacent to the upper center sample, or the blocks adjacent to the upper right sample of the current block may be defined as the blocks adjacent to the top of the current block, and at least one of the blocks adjacent to the upper left sample of the current block, the blocks adjacent to the upper left sample, or the blocks adjacent to the lower left sample of the current block may be defined as the blocks adjacent to the left of the current block.

[0157] Additionally, spatial merge candidates may be derived from spatially non-neighboring blocks that are not adjacent to the current block. For example, spatial merge candidates for the current block may be derived by using at least one of blocks located on the same vertical line as a block adjacent to the top, top-right, or top-left corner of the current block; blocks located on the same horizontal line as a block adjacent to the left, bottom-left, or top-left corner of the current block; or blocks located on the same diagonal line as a block adjacent to a corner of the current block. As a specific example, if an adjacent block to the current block cannot be used as a merge candidate, a block not adjacent to the current block may be used as a merge candidate for the current block.

[0158] The movement information of a spatial merge candidate can be set to be identical to the movement information of a spatial neighbor block.

[0159] Spatial merge candidates can be determined by searching neighboring blocks in a predetermined order. For example, a search for determining spatial merge candidates can be performed in the order of blocks A1, B1, B0, A0, and B2. In this case, block B2 may be used when at least one of the remaining blocks (i.e., A1, B1, B0, and A0) is missing or at least one is encoded in intra-prediction mode.

[0160] The search order of spatial merge candidates may be predefined in the encoder / decoder. Alternatively, the search order of spatial merge candidates may be adaptively determined based on the size or shape of the current block. Alternatively, the search order of spatial merge candidates may be determined based on information signaled through the bitstream.

[0161] Temporal merge candidates can be derived from temporal neighbor blocks of the current block (S920). Temporal neighbor blocks may refer to co-located blocks (collected blocks) included in the collected picture. The collected picture has a different temporal order (Picture Order Count, POC) from the current picture containing the current block. The collected picture may be determined as a picture having a predefined index within the reference picture list or as the picture with the smallest difference in output order (POC) from the current picture. Alternatively, the collected picture may be determined by information signaled from a bitstream. The information signaled from the bitstream may include at least one of information pointing to a reference picture list containing the collected picture (e.g., L0 reference picture list or L1 reference picture list) and / or an index pointing to the collected picture within the reference picture list. Information for determining a collocated picture can be signaled at least one of a picture parameter set, a slice header, or a block level.

[0162]

[0163] The motion information of a temporal merge candidate can be determined based on the motion information of a collocated block. For example, the motion vector of a temporal merge candidate can be determined based on the motion vector of a collocated block. For instance, the motion vector of a temporal merge candidate can be set to be identical to the motion vector of a collocated block. Alternatively, the motion vector of a temporal merge candidate can be derived by scaling the motion vector of a collocated block based on the difference in output order (POC) between the current picture and the reference picture of the current block and / or the difference in output order (POC) between a collocated picture and the reference picture of a collocated picture.

[0164] Figure 11 is a diagram illustrating an example of deriving motion vectors of temporal merge candidates.

[0165] In the example illustrated in FIG. 11, tb represents the difference in POC between the current picture (curr_pic) and the reference picture of the current picture (curr_ref), and td represents the difference in POC between the collocated picture (col_pic) and the reference picture of the collocated block (col_ref). The motion vector of the temporal merge candidate can be derived by scaling the motion vector of the collocated block (col_PU) based on tb and / or td.

[0166] Alternatively, considering the availability of collocated blocks, both the motion vector of the collocated block and the motion vector scaled therefrom can be used as motion vectors for temporal merge candidates. For example, the motion vector of the collocated block can be set as the motion vector of the first temporal merge candidate, and the scaled value of the motion vector of the collocated block can be set as the motion vector of the second temporal merge candidate.

[0167] The inter-prediction direction of a temporal merge candidate can be set to be the same as the inter-prediction direction of a temporal neighbor block. However, the reference picture index of the temporal merge candidate may have a fixed value. For example, the reference picture index of the temporal merge candidate may be set to '0'. Alternatively, the reference picture index of the temporal merge candidate may be adaptively determined based on at least one of the reference picture index of the spatial merge candidate and the reference picture index of the current picture.

[0168] A collocated block can be determined as any block within a block having the same location and size as the current block within the collocated picture, or as a block adjacent to a block having the same location and size as the current block.

[0169] FIG. 12 is a diagram showing the locations of candidate blocks that can be used as collocated blocks.

[0170] The candidate block may include at least one of a block adjacent to the top-left corner position of the current block in the collocated picture, a block adjacent to the center sample position of the current block, or a block adjacent to the bottom-left corner position of the current block.

[0171] For example, a candidate block may include at least one of a block (TL) containing the top-left sample location of the current block in the collocated picture, a block (BR) containing the bottom-right sample location of the current block, a block (H) adjacent to the bottom-right corner of the current block, a block (C3) containing the center sample location of the current block, or a block adjacent to the center sample of the current block (e.g., a block containing a sample location spaced (-1, -1) away from the center sample of the current block) (C0).

[0172] Not limited to the example shown in FIG. 12, a block including the location of a neighbor block adjacent to a predetermined boundary of the current block within the collocated picture may also be selected as the collocated block.

[0173] The number of temporal merge candidates may be one or more. For example, one or more temporal merge candidates may be derived based on one or more collocated blocks.

[0174] Information regarding the maximum number of temporal merge candidates can be encoded and signaled by an encoder. Alternatively, the maximum number of temporal merge candidates may be derived based on the maximum number of merge candidates that can be included in the merge candidate list and / or the maximum number of spatial merge candidates. Alternatively, the maximum number of temporal merge candidates may be determined based on the number of available collocated blocks.

[0175] The availability of candidate blocks is determined according to a predetermined priority, and at least one collocated block can be determined based on the determination and the maximum number of temporal merge candidates. For example, if a block (C3) containing the central sample location of the current block and a block (H) adjacent to the bottom-right corner of the current block are candidate blocks, either the C3 block or the H block can be determined as the collocated block. If the H block is available, the H block can be determined as the collocated block. On the other hand, if the H block is unavailable (e.g., if the H block is encoded by in-frame prediction, if the H block is unavailable, or if the H block is located outside the Largest Coding Unit (LCU), etc.), the C3 block can be determined as the collocated block.

[0176] As another example, if at least one of a plurality of blocks adjacent to the bottom-right corner position of the current block in the collocated picture is unavailable (e.g., H block and / or BR block), the unavailable block may be replaced with another available block. The other block replacing the unavailable block may include at least one of a block adjacent to the center sample position of the current block in the collocated picture (e.g., C0 and / or C3) or a block adjacent to the top-left corner position of the current block (e.g., TL).

[0177] Even if at least one of a plurality of blocks adjacent to the central sample position of the current block in the collocated picture is unavailable, or at least one of a plurality of blocks adjacent to the upper-left corner position of the current block in the collocated picture is unavailable, the unavailable block can be replaced with another available block.

[0178] Afterwards, a merge candidate list including spatial merge candidates and temporal merge candidates can be generated (S930).

[0179] Information regarding the maximum number of merge candidates can be signaled via a bitstream. For example, information indicating the maximum number of merge candidates can be signaled via a sequence parameter or a picture parameter. For example, if the maximum number of merge candidates is 5, 5 can be selected by combining spatial merge candidates and temporal merge candidates. For instance, 4 of the 5 spatial merge candidates and 1 of the 2 temporal merge candidates can be selected. If the number of merge candidates included in the merge candidate list is less than the maximum number of merge candidates, a combined merge candidate formed by combining two or more merge candidates, or a merge candidate having a (0,0) motion vector (zero motion vector), may be included in the merge candidate list.

[0180] Merge candidates may be included in the merge candidate list according to a predefined priority. The higher the priority, the smaller the index assigned to the merge candidate may be. For example, spatial merge candidates may be added to the merge candidate list before temporal merge candidates. Additionally, spatial merge candidates may be added to the merge candidate list in the order of spatial merge candidates of the left neighbor block, spatial merge candidates of the top neighbor block, spatial merge candidates of the block adjacent to the top right corner, spatial merge candidates of the block adjacent to the bottom left corner, and spatial merge candidates of the block adjacent to the top left corner. Alternatively, it is also possible to set the spatial merge candidate derived from the neighbor block adjacent to the top left corner of the current block (B2 in FIG. 10) to be added to the merge candidate list with a lower priority than the temporal merge candidate.

[0181] As another example, the priority among merge candidates can be determined based on the size or shape of the current block. For instance, if the current block is a rectangular shape where the width is greater than the height, a spatial merge candidate from the left neighbor block may be added to the merge candidate list before a spatial merge candidate from the top neighbor block. Conversely, if the current block is a rectangular shape where the height is greater than the width, a spatial merge candidate from the top neighbor block may be added to the merge candidate list before a spatial merge candidate from the left neighbor block.

[0182] As another example, the priority among merge candidates can be determined based on the movement information of each candidate. For instance, a merge candidate with bidirectional movement information may have a higher priority than a merge candidate with unidirectional movement information. Accordingly, a merge candidate with bidirectional movement information may be added to the merge candidate list before a merge candidate with unidirectional movement information.

[0183] As another example, a list of merge candidates may be generated according to predefined priorities, and then the merge candidates may be rearranged. The rearrangement may be performed based on the motion information of the merge candidates. For example, the rearrangement may be performed based on at least one of whether the merge candidate has bidirectional motion information, the magnitude of the motion vector, or the temporal order (POC) between the current picture and the reference picture of the merge candidate. Specifically, the rearrangement may be performed so that merge candidates with unidirectional motion information have a higher priority than merge candidates with bidirectional motion information.

[0184] When a merge candidate list is generated, at least one of the merge candidates included in the merge candidate list can be specified based on the merge candidate index (S940).

[0185] The movement information of the current block can be set to be the same as the movement information of the merge candidate specified by the merge candidate index (S950). For example, if a spatial merge candidate is selected by the merge candidate index, the movement information of the current block can be set to be the same as the movement information of the spatial neighbor block. Alternatively, if a temporal merge candidate is selected by the merge candidate index, the movement information of the current block can be set to be the same as the movement information of the temporal neighbor block.

[0186] Figure 13 is a diagram illustrating the process of inducing movement information of the current block when the AMVP mode is applied to the current block.

[0187] When AMVP mode is applied to the current block, at least one of the inter-prediction direction or reference picture index of the current block can be decoded from the bitstream (S1310). That is, when AMVP mode is applied, at least one of the inter-prediction direction or reference picture index of the current block can be determined based on information encoded through the bitstream.

[0188] Based on the motion vectors of spatial neighbor blocks of the current block, spatial motion vector candidates can be determined (S1320). The spatial motion vector candidates may include at least one of a first spatial motion vector candidate derived from the top neighbor block of the current block or a second spatial motion vector candidate derived from the left neighbor block of the current block. Here, the top neighbor block includes at least one of a block adjacent to the top or top right corner of the current block, and the left neighbor block of the current block may include at least one of a block adjacent to the left or bottom left corner of the current block. A block adjacent to the top left corner of the current block may be treated as a top neighbor block or as a left neighbor block.

[0189] Alternatively, candidates for spatial motion vectors may be derived from spatially non-neighboring blocks that are not adjacent to the current block. For example, candidates for spatial motion vectors of the current block may be derived using at least one of blocks located on the same vertical line as a block adjacent to the top, top-right, or top-left corner of the current block; blocks located on the same horizontal line as a block adjacent to the left, bottom-left, or top-left corner of the current block; or blocks located on the same diagonal line as a block adjacent to a corner of the current block. Candidates for spatial motion vectors may be derived using spatially non-neighboring blocks when spatially neighboring blocks are unavailable.

[0190] As another example, two or more spatial motion vector candidates may be derived using spatial neighbor blocks and spatial non-neighbor blocks. For example, a first spatial motion vector candidate and a second spatial motion vector candidate may be derived based on neighbor blocks adjacent to the current block, while a third spatial motion vector candidate and / or a fourth spatial motion vector candidate may be derived based on neighbor blocks that are not adjacent to the current block but are adjacent to the neighbor blocks.

[0191] If the reference picture between the current block and the spatial neighbor block is different, the spatial motion vector may be obtained by scaling the motion vector of the spatial neighbor block. Based on the motion vector of the temporal neighbor block of the current block, a candidate temporal motion vector may be determined (S1330). If the reference picture between the current block and the temporal neighbor block is different, the temporal motion vector may be obtained by scaling the motion vector of the temporal neighbor block. In this case, a candidate temporal motion vector may be derived only when the number of candidates for spatial motion vectors is less than or equal to a predetermined number.

[0192] A list of motion vector candidates including spatial motion vector candidates and temporal motion vector candidates can be generated (S1340).

[0193] When a list of motion vector candidates is generated, at least one of the motion vector candidates included in the list of motion vector candidates can be specified based on information specifying at least one of the motion vector candidates (S1350).

[0194] A motion vector candidate specified by the above information can be set as the motion vector prediction value of the current block, and the motion vector difference value can be added to the motion vector prediction value to obtain the motion vector of the current block (S1360). At this time, the motion vector difference value can be parsed through a bitstream.

[0195] When motion information of the current block is obtained, motion compensation for the current block can be performed based on the obtained motion information (S820). Specifically, motion compensation for the current block can be performed based on the inter-prediction direction of the current block, the reference picture index, and the motion vector.

[0196] When a prediction sample is obtained as a result of performing motion compensation, the current block can be restored based on the generated prediction sample. Specifically, a restoration sample can be obtained by combining the prediction sample and the residual sample of the current block.

[0197]

[0198] Updated motion information of the current block can be obtained by updating motion information of a merge candidate or by updating motion information of the current block obtained based on a merge candidate or motion vector candidate. For example, under merge mode, motion information of a spatial merge candidate or a temporal merge candidate can be updated, or motion information of the current block derived from motion information of a spatial merge candidate or a temporal merge candidate can be updated. Here, the motion information to be updated may include a motion vector. In addition to the motion vector, at least one of a reference picture index or a prediction direction may also be updated.

[0199] The update of motion information can be performed in the same way in the encoding device and the decoder. As the decoder performs the update in the same way as the encoding device, the encoding of information representing the difference between the motion information before and after the update may be omitted.

[0200] As such, the process by which the decoder updates the motion information of a merge candidate in the same way as the encoder can be called Decoder Side Merge Refinement (DMCR), and the process by which the decoder updates the motion information of the current block in the same way as the encoder can be called Decoder Side Motion Vector Refinement (DMVR).

[0201] Whether to perform DMCR or DMVR may be determined based on at least one of the following: the size and shape (square / non-square), block level (coding block / sub-block), inter-prediction mode, whether merge candidates with identical motion information exist, or whether bidirectional prediction is performed. For example, DMCR may be configured to be performed only for merge candidates with bidirectional prediction directions, or only for merge candidates with identical motion information. Alternatively, DMVR may not be performed when the current block's inter-prediction mode is AMVP mode, whereas at least one of DMCR or DMVR may be performed when the current block's inter-prediction mode is merge mode. Conversely to the example described above, DMVR may be configured to be performed when the current block's inter-prediction mode is AMVP mode.

[0202] Alternatively, information indicating whether to perform DMCR or DMVR may be signaled via a bitstream. The information may be signaled at least one of a block level, a slice level, or a picture level.

[0203] The decoding device can update the motion vector of the current block or merge candidate in the same way as the encoding device.

[0204] For example, to update the motion vector of the current block, the initial motion vector of the current block can be derived, and then a refined motion vector (Refined MV) for surrounding search points can be derived based on the initial motion vector of the current block. Here, the initial motion vector of the current block may be derived based on the one having the lowest cost among merge candidates or motion vector candidates. The decoder can select the merge candidate or motion vector candidate having the lowest cost based on index information. Once the refined motion vector for surrounding search points is derived, the motion vector of the current block can be determined based on the derived refined motion vector. Specifically, among the refined motion vectors for multiple search points, the motion vector having the minimum cost (e.g., minimum RD-cost) can be searched, and the searched motion vector having the minimum cost can be used as the motion vector of the current block.

[0205] As another example, to update the motion vector of a merge candidate, a refined motion vector (Refined MV) for a neighboring search point can be derived based on the motion vector of the merge candidate. Once the refined motion vector for the neighboring search point is derived, the motion vector of the merge candidate can be determined based on the derived refined motion vector. Specifically, among the refined motion vectors for multiple search points, the motion vector with the minimum cost (e.g., minimum RD-cost) can be searched, and the searched motion vector with the minimum cost can be used as the motion vector of the merge candidate.

[0206] Hereinafter, with reference to the drawings, a method for updating the motion information of the current block will be described in detail. For the convenience of explanation, it is assumed that the motion information being updated is a motion vector.

[0207] FIG. 14 is a diagram illustrating a method for updating the motion vector of a current block according to an embodiment of the present invention.

[0208] To update the motion vector of the current block, a refinement mode for the current block can be determined (S1410). The refinement mode may represent at least one of bilateral matching or template matching.

[0209] Bidirectional matching is a method that assumes that the bidirectional motion vector of the current block exists on the same motion trajectory and searches for motion vectors and reference blocks that follow the motion trajectory of the bidirectional motion vector. When using bidirectional matching, the motion vector of the current block can be updated based on a bidirectional template calculated by the bidirectional motion vector of the current block. Specifically, by measuring the RD cost between the bidirectional template and the reference blocks that follow the motion trajectory of the current block's bidirectional motion vector, the reference blocks with the minimum RD cost and the motion vectors indicating them can be searched.

[0210] Template matching is a method for deriving movement information of the current block by searching for the area that best matches the template adjacent to the current block within a reference picture. Specifically, after searching for the area with the lowest cost relative to the template adjacent to the current block within the reference picture, the target block adjacent to the searched area can be set as the reference block of the current block.

[0211] Bidirectional matching and template matching will be described later through FIGS. 20 and FIGS. 21.

[0212] Information regarding the search points of the current block can be determined (S1420). The information regarding the search points of the current block may include at least one of the number of search points, the location of the search points, or the search order between search points. The information regarding the search points may be stored in a predefined format in the encoder and decoder. At this time, the predefined search point-related format may be referred to as a Search Pattern or a Decoder Side Merge Refinement Search Pattern.

[0213] Search patterns may include diamond patterns, adaptive cross patterns, star patterns and / or hexagon patterns, etc. Each search pattern may differ in at least one of the number of search points, the location of the search points, or the search order of the search points.

[0214] The encoder and decoder can select at least one of a plurality of search pattern candidates and determine at least one of the number, location, or search order of search points based on the selected search pattern.

[0215] FIGS. 15 to 18 are drawings showing a diamond pattern, an adaptive cross pattern, a star pattern, and a hexagon pattern, respectively.

[0216] The diamond pattern represents search points arranged in a diamond shape around a reference block specified by an initial motion vector. For example, if the top-left coordinate of the reference block is (0, 0), the diamond pattern may include search points such as (0, 4), (2, 2), (4, 0), (2, -2), (0, -4), (-2, -2), (-4, 0), and (-2, 2).

[0217] The adaptive cross pattern represents search points arranged in a diamond shape around a reference block specified by an initial motion vector. For example, if the top-left coordinate of the reference block is (0, 0), the adaptive cross pattern may include search points such as (0, 2), (2, 0), (0, -2), (-2, 0), (0, 1), (1, 0), (0, -1), (-1, 0).

[0218] A star pattern represents search points arranged in a star shape around a reference block specified by an initial motion vector. For example, if the top-left coordinate of the reference block is (0, 0), the star pattern may include search points such as (0, 4), (1, 1), (4, 0), (1, -1), (0, -4), (-1, -1), (-4, 0), and (-1, 1).

[0219] The hexagon pattern represents search points arranged in a hexagonal shape around a reference block specified by an initial motion vector. For example, if the top-left coordinate of the reference block is (0, 0), the hexagon pattern may include search points such as (0, 2), (2, 2), (4, 0), (2, -2), (0, -2), (-2, -2), (-4, 0), (-2, 2).

[0220] The examples illustrated in FIGS. 15 to 18 merely illustrate an embodiment of the present invention and do not limit the invention. That is, it is also possible to update the motion vector of the current block using a search pattern different from that illustrated in FIGS. 15 to 18.

[0221] In addition, the motion vector of the current block may be updated by modifying the search pattern illustrated in FIGS. 15 to 18. For example, the motion vector of the current block may be updated by using a search pattern in which the number, location, or search order of the search points in the example illustrated in FIGS. 15 to 18 is partially changed.

[0222] As another example, the locations of search points included in the search pattern may be adaptively determined based on at least one of the size and shape of the current block or the difference in output order between the current picture and the reference picture. For example, when the size of the current block is greater than a predetermined size, the search points shown in FIG. 15 may be used, whereas when the size of the current block is smaller than a predetermined size, search points having half the coordinate values ​​of the search points shown in FIG. 15 may be used.

[0223] The decoder can perform decoder-side merge refinement using the same search pattern as the encoder. In order for the decoder to use the same search pattern as the encoder, information for specifying the search pattern used in the encoder can be signaled via a bitstream. The information may be index information specifying any one of a plurality of search patterns.

[0224] Alternatively, the search pattern of the current block can be determined based on at least one of the size and shape of the current block (e.g., whether the current block is square or non-square), the block level (e.g., whether the current block is a coding block or a sub-block), the inter-prediction mode (e.g., merge mode, AMVP mode, or skip mode), or the refinement mode. For example, a diamond search can be selected at the coding block level, while a sub-adaptive cross search can be selected at the sub-coding block level. Alternatively, a star search or a hexagon search can be selected at the coding block level.

[0225] Alternatively, it may be determined whether information for specifying the search pattern used in the encoder is signaled based on at least one of the current block size, shape, block level, inter-prediction mode, or refinement mode.

[0226] When the search pattern of the current block is determined, a refined motion vector for the search point can be determined (S1430).

[0227] The refined motion vector can be derived based on the initial motion vector of the current block and / or the difference in the Proof of Context (POC) between the current picture and the reference picture. Specifically, when the reference block specified by the initial motion vector of the current block is moved to the position of the search point, the distance between the current block and the moved reference block can be set as the refined motion vector for the search point. Accordingly, the refined motion vector can be derived by adding or subtracting a multiple of N to the coordinate value corresponding to the position of the search point or to the coordinate value in relation to the initial motion vector of the current block.

[0228] FIG. 19 is a diagram illustrating the derivation of a refined motion vector for a search point.

[0229] For convenience of explanation, it is assumed that the initial L0 motion vector of the current block is (1, 1) and the initial L1 motion vector is (-1, -1). Additionally, it is assumed that the output order difference TD0 between the current picture and the L0 reference picture (Ref0) and the output order difference TD1 between the current picture and the L1 reference picture (Ref1) are the same.

[0230] Based on the motion trajectory of the current block's bidirectional motion vector, a refined motion vector for the search point can be derived. Specifically, when reference blocks specified by the current block's bidirectional motion vector are moved by the coordinate values ​​of the search point, the distance between the current block and the moved reference blocks can be derived as a refined motion vector.

[0231] For example, the refine L0 motion vector of a search point at position (0, 1) can be set to (0, 1), and the refine L1 motion vector can be set to (-1, 0). That is, the refine motion vector of the search point can be derived by adding the coordinate value of the search point to the initial motion vector of the current block.

[0232] In this case, the refined L0 motion vector and the refined L1 motion vector of the search point can be determined in proportion to TD0 and TD1, respectively. For example, when TD0 and TD1 are in a ratio of 1:N, the refined L0 motion vector of the search point is derived by adding or subtracting the search point's coordinate values ​​(x, y) to the current block's L0 motion vector (MVx0, MVy0) (i.e., (MVx0+x, MVy0+y) or (MVx0-x, MVy0-y)), while the refined L1 motion vector of the search point can be derived by adding or subtracting a value (Nx, Ny) obtained by applying a multiple of N to the search point's coordinate values ​​to the current block's L1 motion vector (MVx1, MVy1) (i.e., (MVx1+Nx, MVy1+Ny) or (MVx1-Nx, MVy1-Ny)). Conversely, when TD0 and TD1 are in a ratio of N:1, the refined L0 motion vector of the search point is derived by adding or subtracting a value (Nx, Ny) obtained by applying a multiple of N to the search point's coordinate values ​​to the current block's L0 motion vector (MVx0, MVy0) (i.e., (MVx0+Nx, MVy0+Ny) or (MVx0-Nx, MVy0-Ny)), while the refined L1 motion vector of the search point can be derived by adding or subtracting the search point's coordinate values ​​(x, y) to the current block's L1 motion vector (MVx1, MVy1) (i.e., (MVx1+x, MVy1+y) or (MVx1-x, MVy1-y)).

[0233] Consequently, the refined motion vector for a specific location sample can be determined by considering the time difference between the current picture and the reference picture.

[0234] When a refined motion vector for a search point is derived, the cost at the search point can be measured based on the derived refined motion vector (S1440).

[0235] FIG. 20 is a diagram illustrating an example of measuring the cost at a search point when the refinement mode is bidirectional matching.

[0236] When the refinement mode of the current block is bidirectional matching, the RD cost between the initial prediction block (or initial bidirectional template) derived based on the initial motion vector of the current block and the refined prediction block (or refined bidirectional template) derived based on the refined motion vector can be measured.

[0237] Specifically, when the L0 reference block and the L1 reference block are identified by the L0 motion vector (MV0) and the L1 motion vector (MV1) of the current block, the initial predicted block of the current block can be obtained through a weighted sum operation of the L0 reference block and the L1 reference block.

[0238] In addition, when the Refine L0 reference block and the Refine L1 reference block are specified by the Refine L0 motion vector (MV0') and the Refine L1 motion vector (MV1') at the search point, the Refine prediction block can be obtained through the weighted sum operation of the Refine L0 reference block and the Refine L1 reference block.

[0239] When the initial prediction block and the refined prediction block are obtained, the RD cost between the initial prediction block and the refined prediction block can be calculated to calculate the cost at the search point.

[0240] Figure 21 is a diagram illustrating an example of measuring the cost at a search point when the refinement mode is template matching.

[0241] When the refinement mode of the current block is template matching, the RD cost between the templates adjacent to the current block (i.e., neighbor templates) and the templates adjacent to the refine prediction block derived based on the refine motion vector (i.e., refine neighbor templates) can be measured.

[0242] The neighbor template may include at least one of an upper region or a left region adjacent to the current block (Cur Block), and the refine neighbor template may include at least one of an upper region or a left region adjacent to the refine prediction block. Here, the upper region or the left region may be an area containing a block of a predetermined size or a predetermined number of lines (rows or columns). The size or shape of the template may be variably determined based on at least one of the size, shape, motion vector, or difference in output order between the current picture and the reference picture of the current block.

[0243] Once the neighbor template and the refine neighbor template are determined, the cost at the search point can be calculated by measuring the RD cost between the neighbor template and the refine neighbor template.

[0244] As another example, template matching may be performed by searching for the area most similar to the current block's neighbor template within the search area of ​​the reference picture. When the area most similar to the current block's neighbor template within a given area is found, the distance between the current block and the block adjacent to the found area can be set as the refined motion vector. For example, if the neighbor template is an area adjacent to the top of the current block or to the left of the current block, the distance between the current block and the block adjacent to the bottom or right of the area with the lowest cost relative to the neighbor template within the search area can be set as the refined motion vector.

[0245] The refinement mode of the current block may be determined based on at least one of the size, shape, inter-prediction mode, bidirectional prediction status, motion vector magnitude, or availability of neighboring blocks of the current block. For example, if the initial motion vector of the current block is unidirectional, template matching may be selected as the refinement mode of the current block. On the other hand, if the initial motion vector of the current block is bidirectional, bidirectional matching may be selected as the refinement mode of the current block.

[0246] Alternatively, information specifying the refinement mode can be signaled via the bitstream.

[0247] Alternatively, it may be determined whether to signal the information based on at least one of the current block's size, shape, inter-prediction mode, whether bidirectional prediction is performed, motion vector size, or the availability of neighboring blocks. For example, if the current block's initial motion vector is bidirectional prediction, the information may be signaled, whereas if the current block's initial motion vector is unidirectional prediction, the information may not be signaled, and a predefined refinement mode may be selected.

[0248] The encoder and decoder may repeatedly perform steps S1430 and S1440 for all search points specified by the search pattern (S1450, S1460). If a search point is unavailable, the unavailable search point may be replaced with an available search point, or steps S1430 and S1440 may not be performed for the unavailable search point. For example, a search point may be determined to be unavailable if it is outside the picture.

[0249] Subsequently, the refined motion vector of the search point with the lowest cost among multiple search points can be determined as the motion vector of the current block (S1470). That is, the initial motion vector of the current block can be updated with the refined motion vector of the search point with the lowest cost. Once the motion vector of the current block is updated, motion compensation can be performed based on the updated motion vector.

[0250] Figure 14 describes a method for updating the motion vector of the current block at a search point. DMCR can also be performed in the same way as described in Figure 14. Specifically, after determining the refinement mode and search pattern for each merge candidate, a refine motion vector for the search point is derived based on the motion vector of each merge candidate, and the cost of the search point can be calculated based on the derived refine motion vector. Subsequently, the refine motion vector of the search point with the lowest cost among multiple search points can be determined as the motion vector of the merge candidate.

[0251] The refinement mode and / or search pattern may be set identically for all merge candidates, or any one merge candidate may have a different refinement mode and / or search pattern from other merge candidates.

[0252] In addition to merge candidates, it is also possible to update motion vector candidates under AMVP mode. That is, the motion vectors of the spatial neighbor blocks and / or temporal neighbor blocks of the current block can be updated, and motion vector candidates can be derived based on the updated motion vectors. In the example described above, it was explained that since the decoder updates the motion vectors in the same way as the encoder, it is unnecessary to signal information regarding the difference values ​​of the motion vectors before and after the update.

[0253] As another example, to update the motion vector of the current block, information regarding the update may be encoded and signaled via a bitstream. Here, the information regarding the update may include at least one of information indicating the search point with the lowest cost (e.g., the index or location of the search point) or information indicating the difference value of the motion vectors before and after the update.

[0254] In FIG. 14, the motion vector of the current block is shown to be updated in a predetermined order. However, the present invention is not limited to the order shown in FIG. 14. For example, an embodiment in which some of the order shown in FIG. 14 is omitted or the order of some of the steps is changed may also be included within the scope of the present invention. For example, an embodiment in which either the refinement mode selection step (S1410) and the search pattern selection step (S1420) is omitted or the order thereof is changed may also be included within the scope of the present invention.

[0255]

[0256] The above-described embodiments are described based on a series of steps or flowcharts, but this does not limit the chronological order of the invention and may be performed simultaneously or in a different order as necessary. Additionally, each component constituting the block diagram in the above-described embodiments (e.g., units, modules, etc.) may be implemented as a hardware device or software, or a plurality of components may be combined to be implemented as a single hardware device or software. The above-described embodiments may be implemented in the form of program instructions that can be executed through various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program instructions, data files, data structures, etc., either individually or in combination. Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes; optical recording media such as CD-ROMs and DVDs; magneto-optical media such as floptical disks; and hardware devices specifically configured to store and execute program instructions, such as ROM, RAM, and flash memory. The above hardware device may be configured to operate as one or more software modules to perform processing according to the present invention, and vice versa.

[0257] The present invention can be applied to an electronic device capable of encoding / decoding images.

Claims

1. Step of obtaining the initial motion vector of the current block; A step of deriving a refined motion vector of each of the plurality of search points based on the initial motion vector; and An image decoding method comprising a step of obtaining a motion vector of the current block based on a refined motion vector of any one of the plurality of search points.

2. In paragraph 1, An image decoding method, characterized in that the initial motion vector is obtained based on a merge candidate or a motion vector candidate of the current block.

3. In paragraph 1, Further comprising the step of selecting a refinement mode of the current block, A method for decoding an image, characterized in that the above refinement mode includes at least one of bidirectional matching or template matching.

4. In paragraph 3, An image decoding method, characterized in that the above refinement mode is determined based on whether the prediction direction of the current block is bidirectional.

5. In paragraph 3, If the above refinement mode is a two-way matching, A video decoding method, characterized in that the cost of the search point is calculated by comparing a first prediction block obtained based on the initial motion vector and a second prediction block obtained based on the refined motion vector.

6. In paragraph 3, If the above refinement mode is template matching, A video decoding method, characterized in that the cost of the search point is calculated by comparing a template neighboring the current block with a template neighboring the reference block specified by the refine motion vector.

7. In paragraph 1, Further comprising a step of determining a search pattern of the current block, A video decoding method, characterized in that at least one of the number of search points, the location, or the search order among the plurality of search points is determined by the determined search pattern.

8. In paragraph 7, An image decoding method, characterized in that the search pattern of the current block is determined based on at least one of the size, shape, inter prediction mode, or refinement mode of the current block.

9. Step of obtaining the initial motion vector of the current block; A step of deriving a refined motion vector of each of the plurality of search points based on the initial motion vector; and An image encoding method comprising a step of obtaining a motion vector of the current block based on a refined motion vector of any one of the plurality of search points.

10. In paragraph 9, A video encoding method, characterized in that the initial motion vector is obtained based on a merge candidate or a motion vector candidate of the current block.

11. In paragraph 9, Further comprising the step of selecting a refinement mode of the current block, A video encoding method, characterized in that the above refinement mode includes at least one of bidirectional matching or template matching.

12. In paragraph 11, A video encoding method, characterized in that the above refinement mode is determined based on whether the prediction direction of the current block is bidirectional.

13. In paragraph 9, Further comprising a step of determining a search pattern of the current block, A video encoding method, characterized in that at least one of the number of search points, the location, or the search order among the plurality of search points is determined by the determined search pattern.

14. An image decoding device including an inter prediction unit that obtains an initial motion vector of a current block, derives a refined motion vector of each of a plurality of search points based on the initial motion vector, and obtains a motion vector of the current block based on the refined motion vector of any one of the plurality of search points.

15. A video encoding device including an inter prediction unit that obtains an initial motion vector of a current block, derives a refined motion vector of each of a plurality of search points based on the initial motion vector, and obtains a motion vector of the current block based on the refined motion vector of any one of the plurality of search points.