Methods for encoding / decoding images and storage media that can be read by a computer.

VN126320APending Publication Date: 2026-06-15ELECTRONICS & TELECOMM RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
VN · VN
Patent Type
Applications
Current Assignee / Owner
ELECTRONICS & TELECOMM RES INST
Filing Date
2019-12-19
Publication Date
2026-06-15

AI Technical Summary

Technical Problem

The increasing demand for high-resolution and high-quality video data leads to higher data volumes, resulting in increased transmission and storage costs, necessitating more efficient video encoding and decoding technologies.

Method used

A video encoding/decoding method and device utilizing the Intra Block Copy (IBC) mode, which includes determining the prediction mode of a current block as IBC, deriving a candidate list for the block vector, and using this list to derive the block vector, improving compression efficiency by incorporating spatial and history-based motion vector predictions.

Benefits of technology

The method enhances compression efficiency by effectively predicting pixel values, reducing data volume and thereby lowering transmission and storage costs for high-resolution video data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure VN1202603536_0
    Figure VN1202603536_0
Patent Text Reader

Abstract

The invention relates to a method for decoding images. The method for decoding images according to the invention may include the following steps: determining the prediction mode of the current block as Intra-Block Copy (IBC), inferring a candidate catalog to infer the block vector of the current block, and inferring the block vector of the current block using the candidate catalog, wherein the candidate catalog is inferred based on the size of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

Video encoding / decoding method, device, and recording medium storing a bitstream

[0001] The present invention relates to a method for encoding / decoding an image, an apparatus, and a recording medium storing a bitstream, and more specifically, to a method for encoding / decoding an image using an Intra Block Copy (IBC) mode and a recording medium storing a bitstream.

[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 existing storage media. To address these issues arising from the increase in video data resolution and quality, high-efficiency video encoding and decoding technologies for video with higher resolution and quality are required.

[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, transformation and quantization technology for compressing the energy of residual signals, 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] The present invention aims to provide an image encoding / decoding method and apparatus with improved compression efficiency, and a recording medium storing a bitstream generated by the image encoding method / apparatus of the present invention.

[0005] In addition, the present invention aims to provide a method, apparatus, and a recording medium storing a bitstream that utilizes an Intra Block Copy (IBC) mode to improve the encoding / decoding efficiency of an image.

[0006] The image decoding method according to the present invention comprises the steps of determining the prediction mode of the current block as an IBC mode, deriving a candidate list for deriving the block vector of the current block, and deriving the block vector of the current block using the candidate list, wherein the candidate list may be derived based on the size of the current block.

[0007] The step of deriving the above candidate list may include the step of deriving a spatial candidate of the current block using the spatial surrounding blocks of the current block and the step of adding the spatial candidate to the candidate list.

[0008] The above spatial candidate can be derived only when the size of the above current block exceeds a preset value.

[0009] The step of deriving the spatial candidate includes a step of determining block availability for the spatial surrounding block and a step of determining block vector availability of the spatial surrounding block based on the result of determining block availability, wherein the block vector availability may indicate whether the block vector of the spatial surrounding block can be included in the candidate list of the current block.

[0010] The step of deriving the above candidate list may include the step of deriving a History-based Motion Vector Prediction (HMVP) based candidate for the current block and the step of adding the HMVP-based candidate to the above candidate list.

[0011] The step of deriving the above candidate list may include the step of adding zero vector candidates to the above candidate list until the number of candidates in the above candidate list reaches the above preset value when the number of candidates currently included in the above candidate list is less than the preset value.

[0012] The above preset value can be determined by the signaling information.

[0013] The above candidate list may not include temporal candidates for the above current block.

[0014] The above video decoding method further includes a step of determining a detailed mode for the IBC mode, wherein the detailed mode may be determined as one of an IBC merge mode and an IBC AMVP mode.

[0015] If the detailed mode for the above IBC mode is determined to be the IBC merge mode, the block vector for the current block can be derived using the merge index for the current block.

[0016] The above image decoding method may further include the step of deriving a block vector predictor for the current block using a block vector predictor indicator for the current block when the detailed mode for the IBC mode is determined to be the IBC AMVP mode.

[0017] The block vector for the current block can be derived through the sum of the block vector predictor for the current block and the block vector difference for the current block.

[0018] The image encoding method according to the present invention comprises the steps of determining the prediction mode of a current block as an IBC mode, deriving a candidate list for deriving a block vector of the current block, and deriving a block vector of the current block using the candidate list, wherein the candidate list may be derived based on the size of the current block.

[0019] The step of deriving the above candidate list may include the step of deriving a spatial candidate of the current block using the spatial surrounding blocks of the current block and the step of adding the spatial candidate to the above candidate list.

[0020] The above spatial candidate can be derived only when the size of the above current block exceeds a preset value.

[0021] The step of deriving the above candidate list may include the step of adding zero vector candidates to the above candidate list until the number of candidates in the above candidate list reaches the above preset value when the number of candidates currently included in the above candidate list is less than the preset value.

[0022] The above video encoding method further includes a step of determining a detailed mode for the IBC mode, wherein the detailed mode may be determined as one of an IBC merge mode and an IBC AMVP mode.

[0023] The above video encoding method may further include the step of deriving a merge index for the current block using the candidate list and the step of encoding the merge index when the detailed mode for the IBC mode is determined to be an IBC merge mode.

[0024] The above video encoding method may further include the step of deriving a motion vector predictor indicator for the current block using the candidate list and the step of encoding the motion vector predictor indicator when the detailed mode for the IBC mode is determined to be the IBC AMVP mode.

[0025] A computer-readable recording medium storing a bitstream received by an image decoding device according to the present invention and used to restore a current block included in a current picture, wherein the bitstream includes information regarding the prediction of the current block, the information regarding the prediction is used to determine the prediction mode of the current block as an IBC mode, the information regarding the prediction is used to derive a candidate list for deriving a block vector of the current block, and the candidate list is used to derive a block vector of the current block, wherein the candidate list may be derived based on the size of the current block.

[0026] According to the present invention, an image encoding / decoding method and apparatus with improved compression efficiency, and a recording medium storing a bitstream generated by the image encoding method / apparatus of the present invention may be provided.

[0027] In addition, according to the present invention, an image encoding / decoding method, an apparatus, and a recording medium storing a bitstream that improve compression efficiency using an IBC (Intra block copy) mode may be provided.

[0028] In addition, according to the present invention, a video encoding / decoding method, an apparatus, and a recording medium storing a bitstream that improve compression efficiency using a candidate list may be provided.

[0029] FIG. 1 is a block diagram showing the configuration according to one embodiment of an encoding device to which the present invention is applied.

[0030] FIG. 2 is a block diagram showing the configuration according to one embodiment of a decoding device to which the present invention is applied.

[0031] Figure 3 is a diagram schematically showing the segmentation structure of an image when encoding and decoding an image.

[0032] Figure 4 is a diagram illustrating an example of an in-screen prediction process.

[0033] Figure 5 is a diagram illustrating an example of an inter-frame prediction process.

[0034] Figure 6 is a diagram illustrating the process of transformation and quantization.

[0035] Figure 7 is a diagram illustrating reference samples available for in-screen prediction.

[0036] FIG. 8 is a flowchart illustrating an image encoding / decoding method according to an embodiment of the present invention.

[0037] FIG. 9 is a flowchart illustrating an image encoding / decoding method according to another embodiment of the present invention.

[0038] FIG. 10 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to an embodiment of the present invention.

[0039] FIG. 11 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to another embodiment of the present invention.

[0040] FIG. 12 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to another embodiment of the present invention.

[0041] FIG. 13 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to another embodiment of the present invention.

[0042] FIG. 14 is a drawing for explaining a predetermined range according to some embodiments of the present invention.

[0043] FIG. 15 is another drawing for illustrating a predetermined range according to some embodiments of the present invention.

[0044] FIG. 16 is another drawing for illustrating a predetermined range according to some embodiments of the present invention.

[0045] FIG. 17 is another drawing for illustrating a predetermined range according to some embodiments of the present invention.

[0046] FIG. 18 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to another embodiment of the present invention.

[0047] FIG. 19 is a diagram illustrating a method for deriving an AMVP candidate list for deriving a block vector according to an embodiment of the present invention.

[0048] Figure 20 is a drawing for explaining the surrounding blocks of the current block.

[0049] FIG. 21 is a drawing for explaining a scaling method according to some embodiments of the present invention.

[0050] FIG. 22 is another drawing for illustrating a scaling method according to some embodiments of the present invention.

[0051] FIG. 23 is another drawing for illustrating a scaling method according to some embodiments of the present invention.

[0052] FIG. 24 is another drawing for illustrating a scaling method according to some embodiments of the present invention.

[0053] FIG. 25 is another drawing for illustrating a scaling method according to some embodiments of the present invention.

[0054] FIG. 26 is another drawing for illustrating a scaling method according to some embodiments of the present invention.

[0055] FIG. 27 is a diagram illustrating a method for deriving an AMVP candidate list for block vector derivation according to another embodiment of the present invention.

[0056] FIG. 28 is a diagram illustrating a method for deriving an AMVP candidate list for block vector derivation according to another embodiment of the present invention.

[0057] FIG. 29 is a diagram illustrating a method for deriving an AMVP candidate list for block vector derivation according to another embodiment of the present invention.

[0058] FIG. 30 is a diagram illustrating a method for deriving an AMVP candidate list for block vector derivation according to another embodiment of the present invention.

[0059] FIG. 31 is a flowchart illustrating an image encoding / decoding method according to another embodiment of the present invention.

[0060] FIG. 32 is a flowchart illustrating an image encoding / decoding method according to another embodiment of the present invention.

[0061] FIG. 33 is a drawing for illustrating a referenceable left CTU according to some embodiments of the present invention.

[0062] 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 in the drawings refer to the same or similar functions across various aspects. The shapes and sizes of elements in the drawings may be exaggerated for clearer explanation. The detailed description of exemplary embodiments described below refers to the accompanying drawings, which illustrate specific embodiments as examples. These embodiments are described in sufficient detail to enable those skilled in the art to practice the embodiments. It should be understood that various embodiments are different but need not be mutually exclusive. For example, specific shapes, structures, and characteristics described herein may be implemented in other embodiments without departing from the spirit and scope of the invention in relation to one embodiment. Furthermore, it should be understood that the location or arrangement of individual components within each disclosed embodiment may be changed without departing from the spirit and scope of the embodiment. Accordingly, the following detailed description is not intended to be taken in a limiting sense, and the scope of exemplary embodiments is limited only by the appended claims, together with all equivalents to those claimed therein, provided they are properly described.

[0063] In the present invention, 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.

[0064] When it is stated that a component of the present invention is “connected” or “connected” to another component, it should be understood that it may be directly connected to or connected to the other component, or that other components may exist in between. On the other hand, when it is stated that a component is “directly connected” or “directly connected” to another component, it should be understood that no other components exist in between.

[0065] The components shown in the embodiments of the present invention are illustrated independently to represent different characteristic functions and do 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; however, 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 a function, 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 invention.

[0066] The terms used in this invention are used merely to describe specific embodiments and are not intended to limit the invention. Singular expressions include plural expressions unless the context clearly indicates otherwise. In this invention, terms such as "comprising" or "having" are intended to specify the existence 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. That is, the description in this invention that a specific configuration "comprising" does not exclude configurations other than that configuration, but means that additional configurations may be included within the scope of the practice or technical concept of this invention.

[0067] Some components of the present invention may not be essential components performing an essential function in the present invention, but may be optional components merely 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 merely for performance enhancement, and a structure including only the essential components, excluding optional components used merely for performance enhancement, is also included within the scope of the rights of the present invention.

[0068] Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In describing the embodiments of this specification, if it is determined that a detailed description of related known configurations or functions may obscure the gist of this specification, such detailed description is omitted; similar reference numerals are used for identical components in the drawings, and redundant descriptions of identical components are omitted.

[0069] In the following, "image" may refer to a single picture constituting a video, or it may refer to the video itself. For example, "encoding and / or decoding of an image" may mean "encoding and / or decoding of an image," and may also mean "encoding and / or decoding of one of the images constituting the video."

[0070] In the following, the terms "video" and "video" may be used interchangeably with the same meaning.

[0071] In the following, the target image may be an image to be encoded and / or an image to be decoded. Additionally, the target image may be an input image input to an encoding device and an input image input to a decoding device. Here, the target image may have the same meaning as the current image.

[0072] In the following, the terms "image," "picture," "frame," and "screen" may be used interchangeably with the same meaning.

[0073] In the following, the target block may be an encoding target block that is the target of encoding and / or a decoding target block that is the target of decoding. Additionally, the target block may be a current block that is the target of current encoding and / or decoding. For example, the terms "target block" and "current block" may be used interchangeably with the same meaning.

[0074] In the following, the terms "block" and "unit" may be used interchangeably with the same meaning. Alternatively, "block" may refer to a specific unit.

[0075] In the following, the terms "region" and "segment" may be used interchangeably.

[0076] In the following, a specific signal may be a signal representing a specific block. For example, the original signal may be a signal representing the target block. The prediction signal may be a signal representing the prediction block. The residual signal may be a signal representing the residual block.

[0077] In the embodiments, each of the specified information, data, flag, index and element, attribute, etc., may have a value. A value "0" of the information, data, flag, index and element, attribute, etc., may represent logical false or a first predefined value. That is to say, the value "0", false, logical false, and the first predefined value may be used interchangeably. A value "1" of the information, data, flag, index and element, attribute, etc., may represent logical true or a second predefined value. That is to say, the value "1", true, logical true, and the second predefined value may be used interchangeably.

[0078] When a variable such as i or j is used to represent a row, column, or index, the value of i may be an integer greater than or equal to 0, or an integer greater than or equal to 1. That is to say, in the embodiments, the row, column, and index, etc. may be counted from 0, or from 1.

[0079] Glossary of Terms

[0080] Encoder: Refers to a device that performs encoding. In other words, it can mean an encoding device.

[0081] Decoder: Refers to a device that performs decoding. In other words, it can mean a decoding device.

[0082] Block: An MxN array of samples. Here, M and N may represent positive integer values, and a block may commonly represent a two-dimensional array of samples. A block may represent a unit. The current block may represent a block to be encoded during encoding, or a block to be decoded during decoding. Additionally, the current block may be at least one of an encoding block, a prediction block, a residual block, or a transformation block.

[0083] Sample: The basic unit that makes up a block. Bit depth (B d From 0 to 2 depending on ) Bd - It can be expressed as a value up to 1. In the present invention, the term "sample" can be used interchangeably with "pixel" or "pixel." That is, "sample," "pixel," and "pixel" can have the same meaning.

[0084] Unit: This may refer to a unit of image encoding and decoding. In image encoding and decoding, a unit may be a region into which a single image is divided. Additionally, when an image is divided into subdivided units for encoding or decoding, a unit may refer to the divided unit. In other words, a single image can be divided into multiple units. In image encoding and decoding, predefined processing may be performed for each unit. A single unit may be further subdivided into sub-units that have a smaller size than the unit. Depending on the function, a unit may refer to a Block, Macroblock, Coding Tree Unit, Coding Tree Block, Coding Unit, Coding Block, Prediction Unit, Prediction Block, Residual Unit, Residual Block, Transform Unit, Transform Block, etc. Additionally, to distinguish it from a block, a unit may refer to a block of luminance (Luma) components, a corresponding block of chroma (Chroma) components, and syntactic elements for each block. A unit may have various sizes and shapes, and in particular, the shape of a unit may include not only squares but also geometric shapes that can be represented in two dimensions, such as rectangles, trapezoids, triangles, and pentagons. Additionally, unit information may include at least one of the following: the type of unit indicating an encoding unit, a prediction unit, a residual unit, a transformation unit, etc., the size of the unit, the depth of the unit, and the encoding and decoding order of the unit.

[0085] Coding Tree Unit: Consists of a single luminance component (Y) coding tree block and two chrominance component (Cb, Cr) coding tree blocks associated with it. It may also refer to the blocks and the syntactic elements for each block. Each coding tree unit may be partitioned using one or more partitioning methods, such as a quad tree, binary tree, or ternary tree, to form sub-units such as a coding unit, a prediction unit, and a transform unit. It may be used as a term to refer to a sample block that serves as a processing unit in the image decoding process, such as the partitioning of an input image. Here, a quad tree may refer to a quaternary tree.

[0086] If the size of the encoding block falls within a predetermined range, it may be possible to split it into quadtrees only. Here, the predetermined range may be defined as at least one of the maximum and minimum sizes of the encoding block that can be split into quadtrees only. Information indicating the maximum / minimum size of the encoding block for which quadtree-type splitting is allowed may be signaled via a bitstream, and such information may be signaled in at least one unit among a sequence, picture parameter, tile group, or slice (segment). Alternatively, the maximum / minimum size of the encoding block may be a fixed size pre-set in the encoder / decoder. For example, if the size of the encoding block corresponds to 256x256 to 64x64, it may be possible to split it into quadtrees only. Or, if the size of the encoding block is larger than the maximum size of the conversion block, it may be possible to split it into quadtrees only. In this case, the block being split may be at least one of the encoding block or the conversion block. In such cases, information indicating the splitting of the encoding block (e.g., split_flag) may be a flag indicating whether to split into quadtrees. If the size of the encoding block falls within a predetermined range, it may be possible to divide it into a binary tree or a triad tree. In this case, the above description regarding the quad tree may be applied equally to the binary tree or the triad tree.

[0087] Coding Tree Block: This term may be used to refer to any one of the Y coding tree block, Cb coding tree block, or Cr coding tree block.

[0088] Neighbor block: This may refer to a block adjacent to the current block. A block adjacent to the current block may refer to a block whose boundary meets the current block or a block located within a certain distance from the current block. A neighbor block may refer to a block adjacent to a vertex of the current block. Here, a block adjacent to a vertex of the current block may be a block vertically adjacent to a neighbor block horizontally adjacent to the current block, or a block horizontally adjacent to a neighbor block vertically adjacent to the current block. A neighbor block may also refer to a restored neighbor block.

[0089] Reconstructed Neighbor Block: This may refer to a neighbor block that has already been encoded or decoded spatially or temporally around the current block. In this case, a reconstructed neighbor block may refer to a reconstructed neighbor unit. A reconstructed spatial neighbor block may be a block within the current picture that has already been reconstructed through encoding and / or decoding. A reconstructed temporal neighbor block may be a reconstructed block or its neighbor block located at a position corresponding to the current block of the current picture within the reference image.

[0090] Unit Depth: This refers to the degree to which a unit is divided. In a tree structure, the topmost node (Root Node) corresponds to the initial, undivided unit. This topmost node can be referred to as the root node. Additionally, the topmost node can have a minimum depth value. In this case, the topmost node can have a depth of Level 0. A node with a depth of Level 1 can represent a unit created as the initial unit is divided once. A node with a depth of Level 2 can represent a unit created as the initial unit is divided twice. A node with a depth of Level n can represent a unit created as the initial unit is divided n times. A Leaf Node can be the lowest node and can be a node that cannot be further divided. The depth of a Leaf Node can be the maximum level. For example, the predefined value for the maximum level can be 3. It can be said that the Root Node has the shallowest depth, and the Leaf Node has the deepest depth. Additionally, when units are represented as a tree structure, the level at which a unit exists can represent the unit depth.

[0091] Bitstream: Can refer to a sequence of bits containing encoded image information.

[0092] Parameter Set: This corresponds to header information within the structure of the bitstream. At least one of the video parameter set, sequence parameter set, picture parameter set, and adaptation parameter set may be included in the parameter set. Additionally, the parameter set may include tile group, slice header, and tile header information. Furthermore, the tile group may refer to a group containing multiple tiles and may have the same meaning as a slice.

[0093] An adaptive parameter set may refer to a set of parameters that can be referenced and shared across different pictures, subpictures, slices, tile groups, tiles, or bricks. Additionally, subpictures, slices, tile groups, tiles, or bricks within a picture may reference different adaptive parameter sets to utilize information within those sets.

[0094] Additionally, within a picture, different adaptation parameter sets can be referenced using identifiers of different adaptation parameter sets in subpictures, slices, tile groups, tiles, or bricks.

[0095] Additionally, within a slice, tile group, tile, or brick in a subpicture, different adaptation parameter sets can be referenced using the identifiers of different adaptation parameter sets.

[0096] Additionally, an adaptive parameter set can refer to different adaptive parameter sets within a tile or brick using the identifier of a different adaptive parameter set.

[0097] Additionally, within a brick in a tile, different adaptation parameter sets can be referenced using the identifiers of different adaptation parameter sets.

[0098] Information regarding an adaptive parameter set identifier is included in the parameter set or header of the above subpicture, so that an adaptive parameter set corresponding to the adaptive parameter set identifier can be used in the subpicture.

[0099] Information regarding an adaptive parameter set identifier is included in the parameter set or header of the above tile, so that an adaptive parameter set corresponding to the adaptive parameter set identifier can be used in the tile.

[0100] The header of the above brick includes information regarding an adaptive parameter set identifier, so that an adaptive parameter set corresponding to the adaptive parameter set identifier can be used in the brick.

[0101] The above picture can be divided into one or more rows of tiles and one or more columns of tiles.

[0102] The above subpicture may be divided into one or more tile rows and one or more tile columns within the picture. The above subpicture is an area having a rectangular / square shape within the picture and may include one or more CTUs. Additionally, at least one tile / brick / slice may be included within a single subpicture.

[0103] The above tile is an area within the picture that has a rectangular or square shape and may include one or more CTUs. Additionally, the tile may be divided into one or more bricks.

[0104] The above brick may refer to one or more CTU rows within a tile. A tile may be divided into one or more bricks, and each brick may have at least one CTU row. A tile that is not divided into two or more may also refer to a brick.

[0105] The above slice may include one or more tiles within the picture and one or more bricks within the tile.

[0106] Parsing: This refers to determining the value of a syntax element by entropy decoding a bitstream, or it may refer to entropy decoding itself.

[0107] Symbol: May represent at least one of the following: a syntactic element of the unit to be encoded / decoded, a coding parameter, or a value of a transform coefficient. Additionally, the symbol may represent the target of entropy encoding or the result of entropy decoding.

[0108] Prediction Mode: This may be information indicating a mode of encoding / decoding by intra-frame prediction or a mode of encoding / decoding by inter-frame prediction.

[0109] Prediction Unit: This refers to the basic unit used when performing predictions, such as cross-frame prediction, intra-frame prediction, cross-frame reward, intra-frame reward, and motion reward. A single prediction unit may be divided into multiple partitions or multiple sub-prediction units of smaller sizes. Multiple partitions may also serve as basic units for performing prediction or reward. A partition created by the division of a prediction unit may also be a prediction unit.

[0110] Prediction Unit Partition: This can refer to a form in which prediction units are divided.

[0111] Reference Picture List: This may refer to a list containing one or more reference pictures used for cross-frame prediction or motion compensation. The types of reference picture lists may include LC (List Combined), L0 (List 0), L1 (List 1), L2 (List 2), L3 (List 3), etc., and one or more reference picture lists may be used for cross-frame prediction.

[0112] Inter Prediction Indicator: May indicate the inter-frame prediction direction (unidirectional prediction, bidirectional prediction, etc.) of the current block. Alternatively, it may indicate the number of reference images used when generating the prediction blocks for the current block. Alternatively, it may indicate the number of prediction blocks used when performing inter-frame prediction or motion compensation for the current block.

[0113] Prediction list utilization flag: Indicates whether a prediction block is generated using at least one reference image within a specific reference image list. A prediction list utilization flag can be used to derive a prediction indicator between frames, and conversely, a prediction list utilization flag can be used to derive a prediction indicator between frames. For example, if the prediction list utilization flag indicates a first value of 0, it may indicate that a prediction block is not generated using a reference image within the reference image list, and if it indicates a second value of 1, it may indicate that a prediction block can be generated using the reference image list.

[0114] Reference Picture Index: This can refer to an index in a reference picture list that points to a specific reference picture.

[0115] Reference Picture: This may refer to an image referenced by a specific block for inter-frame prediction or motion compensation. Alternatively, the reference picture may be an image containing a reference block referenced by the current block for inter-frame prediction or motion compensation. Hereinafter, the terms "reference picture" and "reference image" may be used interchangeably with the same meaning.

[0116] Motion Vector: This can be a 2D vector used for cross-frame prediction or motion compensation. A motion vector can represent the offset between the block to be encoded / decoded and the reference block. For example, (mvX, mvY) can represent a motion vector. mvX can represent the horizontal component, and mvY can represent the vertical component.

[0117] Search Range: The search range may be a 2-dimensional area where a search for motion vectors takes place during cross-frame prediction. For example, the size of the search range may be MxN. M and N may each be positive integers.

[0118] Motion Vector Candidate: This may refer to a block that serves as a prediction candidate when predicting a motion vector, or the motion vector of that block. Additionally, a motion vector candidate may be included in the motion vector candidate list.

[0119] Motion Vector Candidate List: This can refer to a list composed of one or more motion vector candidates.

[0120] Motion Vector Candidate Index: May refer to an indicator pointing to a motion vector candidate within the motion vector candidate list. May be the index of a Motion Vector Predictor.

[0121] Motion Information: This may refer to information including at least one of motion vectors, reference image indices, cross-frame prediction indicators, as well as prediction list utilization flags, reference image list information, reference images, motion vector candidates, motion vector candidate indices, merge candidates, merge indices, etc.

[0122] Merge Candidate List: Can refer to a list composed of one or more merge candidates.

[0123] Merge Candidate: This may refer to spatial merge candidates, temporal merge candidates, combined merge candidates, combined positive prediction merge candidates, zero merge candidates, etc. A merge candidate may include motion information such as cross-frame prediction indicators, reference image indices for each list, motion vectors, prediction list utilization flags, and cross-frame prediction indicators.

[0124] Merge Index: This may refer to an indicator pointing to a merge candidate within a merge candidate list. Additionally, the merge index may indicate the block that induced the merge candidate among the blocks restored spatially or temporally adjacent to the current block. Furthermore, the merge index may indicate at least one of the movement information possessed by the merge candidate.

[0125] Transform Unit: This may refer to a basic unit for performing residual signal encoding / decoding, such as transform, inverse transform, quantization, inverse quantization, and transform coefficient encoding / decoding. A single transform unit may be divided into multiple sub-transform units of smaller sizes. Here, the transform / inverse transform may include at least one of a first-order transform / inverse transform and a second-order transform / inverse transform.

[0126] Scaling: This can refer to the process of multiplying a factor by a quantized level. Transformation coefficients can be generated as a result of scaling the quantized level. Scaling can also be called dequantization.

[0127] Quantization Parameter: This may refer to a value used to generate a quantized level using a transform factor in quantization. Alternatively, it may refer to a value used to generate a transform factor by scaling the quantized level in inverse quantization. The quantization parameter may be a value mapped to the quantization step size.

[0128] Delta Quantization Parameter: This may refer to the difference between the predicted quantization parameter and the quantization parameter of the unit to be encoded / decoded.

[0129] Scan: This can refer to a method of sorting the order of units, blocks, or coefficients within a matrix. For example, sorting a 2D array into a 1D array is called a scan. Alternatively, sorting a 1D array into a 2D array can also be called a scan or inverse scan.

[0130] Transform Coefficient: This may refer to the coefficient value generated after performing a transformation in the encoder. Alternatively, it may refer to the coefficient value generated after performing at least one of entropy decoding and inverse quantization in the decoder. Quantized levels or quantized transform coefficient levels obtained by applying quantization to the transform coefficient or residual signal may also be included in the meaning of transform coefficient.

[0131] Quantized Level: This may refer to a value generated by performing quantization on transform coefficients or residual signals in an encoder. Alternatively, it may refer to the value subject to inverse quantization before it is performed in a decoder. Similarly, the quantized transform coefficient level resulting from transform and quantization may also be included within the meaning of quantized level.

[0132] Non-zero Transform Coefficient: This may refer to a transform coefficient whose magnitude is not zero, a transform coefficient level whose magnitude is not zero, or a quantized level.

[0133] Quantization Matrix: This refers to a matrix used in the quantization or inverse quantization process to improve the subjective or objective quality of an image. A quantization matrix can also be called a scaling list.

[0134] Quantization Matrix Coefficient: This can refer to each element within the quantization matrix. Quantization matrix coefficients can also be called matrix coefficients.

[0135] Default Matrix: This may refer to a predetermined quantization matrix predefined in the encoder and decoder.

[0136] Non-default Matrix: This can refer to a quantization matrix that is not predefined in the encoder and decoder and is signaled by the user.

[0137] Statistic value: A statistical value for at least one variable, encoding parameter, constant, etc., having specific values ​​that can be computed, may be at least one of the average value, weighted average value, weighted sum value, minimum value, maximum value, mode, median value, and interpolation value of said specific values.

[0138] FIG. 1 is a block diagram showing the configuration according to one embodiment of an encoding device to which the present invention is applied.

[0139] The encoding device (100) may be an encoder, a video encoding device, or an image encoding device. The video may include one or more images. The encoding device (100) may sequentially encode one or more images.

[0140] Referring to FIG. 1, the encoding device (100) may include a motion prediction unit (111), a motion compensation unit (112), an intra prediction unit (120), a switch (115), a subtractor (125), a converter (130), a quantization unit (140), an entropy encoding unit (150), an inverse quantization unit (160), an inverse converter (170), an adder (175), a filter unit (180), and a reference picture buffer (190).

[0141] The encoding device (100) can perform encoding on an input image in intra mode and / or inter mode. Additionally, the encoding device (100) can generate a bitstream containing encoded information through encoding of the input image and can output the generated bitstream. The generated bitstream can be stored on a computer-readable recording medium or streamed via a wired / wireless transmission medium. When intra mode is used as the prediction mode, the switch (115) can be switched to intra, and when inter mode is used as the prediction mode, the switch (115) can be switched to inter. Here, intra mode may refer to an intra-frame prediction mode, and inter mode may refer to an inter-frame prediction mode. The encoding device (100) can generate a prediction block for an input block of the input image. Additionally, after the prediction block is generated, the encoding device (100) can encode a residual block using the difference (residual) of the input block and the prediction block. The input image may be referred to as the current image that is the target of the current encoding. The input block may be referred to as the current block or the block to be encoded, which is the target of the current encoding.

[0142] When the prediction mode is an intra mode, the intra prediction unit (120) may use a sample of a block that has already been encoded / decoded around the current block as a reference sample. The intra prediction unit (120) may perform spatial prediction for the current block using the reference sample and generate prediction samples for the input block through spatial prediction. Here, intra prediction may mean intra-frame prediction.

[0143] When the prediction mode is an inter mode, the motion prediction unit (111) can search for the region that best matches the input block from the reference image during the motion prediction process and derive a motion vector using the searched region. At this time, the search region can be used as the region. The reference image can be stored in the reference picture buffer (190). Here, the reference image can be stored in the reference picture buffer (190) when encoding / decoding of the reference image is processed.

[0144] The motion compensation unit (112) can generate a prediction block for the current block by performing motion compensation using a motion vector. Here, inter-prediction may mean inter-frame prediction or motion compensation.

[0145] The motion prediction unit (111) and motion compensation unit (112) can generate a prediction block by applying an interpolation filter to a portion of the reference image when the value of the motion vector does not have an integer value. To perform inter-frame prediction or motion compensation, based on the encoding unit, it can determine whether the motion prediction and motion compensation method of the prediction unit included in the corresponding encoding unit is a Skip Mode, Merge Mode, Advanced Motion Vector Prediction (AMVP) Mode, or Current Picture Reference Mode, and can perform inter-frame prediction or motion compensation according to each mode.

[0146] The subtractor (125) can generate a residual block using the difference between the input block and the prediction block. The residual block may also be referred to as a residual signal. The residual signal may represent the difference between the original signal and the prediction signal. Alternatively, the residual signal may be a signal generated by transforming, quantizing, or transforming and quantizing the difference between the original signal and the prediction signal. The residual block may be a residual signal in block units.

[0147] The transformation unit (130) can generate a transform coefficient by performing a transform on the remaining block and output the generated transform coefficient. Here, the transform coefficient may be a coefficient value generated by performing a transform on the remaining block. When a transform skip mode is applied, the transformation unit (130) may skip the transform on the remaining block.

[0148] A quantized level can be generated by applying quantization to a conversion coefficient or a residual signal. In the following embodiments, the quantized level may also be referred to as a conversion coefficient.

[0149] The quantization unit (140) can generate a quantized level by quantizing a transformation coefficient or residual signal according to a quantization parameter, and can output the generated quantized level. At this time, the quantization unit (140) can quantize the transformation coefficient using a quantization matrix.

[0150] The entropy encoding unit (150) can generate a bitstream and output a bitstream by performing entropy encoding according to a probability distribution on values ​​calculated by the quantization unit (140) or coding parameter values ​​calculated during the encoding process. The entropy encoding unit (150) can perform entropy encoding on information regarding a sample of an image and information for decoding an image. For example, information for decoding an image may include syntax elements, etc.

[0151] When entropy coding is applied, a small number of bits are allocated to symbols with a high probability of occurrence and a large number of bits are allocated to symbols with a low probability of occurrence, thereby representing the symbols and reducing the size of the bit sequence for the symbols to be encoded. The entropy coding unit (150) may use encoding methods such as exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding) for entropy coding. For example, the entropy coding unit (150) may perform entropy coding using a Variable Length Coding (VLC) table. Additionally, the entropy encoding unit (150) may perform arithmetic encoding using the derived binarization method, probability model, and context model after deriving a binarization method of the target symbol and a probability model of the target symbol / bin.

[0152] The entropy encoding unit (150) can convert a 2-dimensional block form coefficient into a 1-dimensional vector form through a transform coefficient scanning method to encode a transform coefficient level (quantized level).

[0153] Coding parameters may include not only information (flags, indices, etc.) that is encoded in the encoder and signaled to the decoder, such as syntax elements, but also information derived during the encoding or decoding process, and may refer to information required when encoding or decoding images. For example, unit / block size, unit / block depth, unit / block partitioning information, unit / block shape, unit / block partitioning structure, whether to partition in quadtree form, whether to partition in binary tree form, binary tree partitioning direction (horizontal or vertical), binary tree partitioning type (symmetrical or asymmetrical), whether to partition in triad tree form, triad tree partitioning direction (horizontal or vertical), triad tree partitioning type (symmetrical or asymmetrical), whether to partition in complex tree form, complex tree partitioning direction (horizontal or vertical), complex tree partitioning type (symmetrical or asymmetrical), complex tree partitioning tree (binary tree or triad tree), prediction mode (intra-frame prediction or inter-frame prediction), intra-frame luminance prediction mode / direction, intra-frame chrominance prediction mode / direction, intra-frame partitioning information, inter-frame partitioning information, encoded block partitioning flag, predicted block partitioning flag, transform block partitioning flag, reference sample filtering method, reference sample filter tab, reference sample filter coefficients, predicted block filtering method, predicted block filter tab, predicted block Filter coefficients, prediction block boundary filtering method, prediction block boundary filter tab, prediction block boundary filter coefficients, intra-frame prediction mode, inter-frame prediction mode, motion information, motion vector, motion vector difference, reference image index, inter-frame prediction direction, inter-frame prediction indicator, prediction list utilization flag, reference image list, reference image, motion vector prediction index, motion vector prediction candidate, motion vector candidate list, whether to use merge mode, merge index, merge candidate, merge candidate list, whether to use skip mode,Interpolation filter type, Interpolation filter tab, Interpolation filter coefficients, Motion vector magnitude, Motion vector representation accuracy, Transform type, Transform magnitude, Info on whether to use 1st-order transform, Info on whether to use 2nd-order transform, 1st-order transform index, 2nd-order transform index, Info on presence of residual signal, Coded Block Pattern, Coded Block Flag, Quantization parameters, Residual quantization parameters, Quantization matrix, In-frame loop filter application status, In-frame loop filter coefficients, In-frame loop filter tab, In-frame loop filter shape / form, Deblocking filter application status, Deblocking filter coefficients, Deblocking filter tab, Deblocking filter strength, Deblocking filter shape / form, Adaptive sample offset application status, Adaptive sample offset value, Adaptive sample offset category, Adaptive sample offset type, Adaptive loop filter application status, Adaptive loop filter coefficients, Adaptive loop filter tab, Adaptive loop filter shape / form, Binarization / Debinarization method, Context model determination method, Context model update method, Regular mode execution status, Bypass mode execution Status, Context Bin, Bypass Bin, Important Factor Flag, Last Important Factor Flag, Factor Group Unit Encoding Flag, Last Important Factor Position, Flag for whether the factor value is greater than 1, Flag for whether the factor value is greater than 2, Flag for whether the factor value is greater than 3, Remaining Factor Value Information, Sign Information, Recovered Luminance Sample, Recovered Chromaticity Sample, Residual Luminance Sample, Residual Chromaticity Sample, Luminance Conversion Factor, Chromaticity Conversion Factor, Luminance Quantized Level, Chromaticity Quantized Level, Conversion Factor Level Scanning Method, Size of Decoder Side Motion Vector Search Area, Shape of Decoder Side Motion Vector Search Area, Number of Decoder Side Motion Vector Searches, CTU Size Information, Minimum Block Size Information, Maximum Block Size Information, Maximum Block Depth Information, Minimum Block Depth Information, Image Display / Output Order, Slice Identification Information, Slice Type,At least one value or a combination of slice splitting information, tile group identification information, tile group type, tile group splitting information, tile identification information, tile type, tile splitting information, picture type, input sample bit depth, restored sample bit depth, residual sample bit depth, transform factor bit depth, quantized level bit depth, information about the luminance signal, and information about the chrominance signal may be included in the encoding parameter.

[0154] Here, signaling a flag or index may mean that in an encoder, the corresponding flag or index is entropy encoded and included in a bitstream, and in a decoder, the corresponding flag or index is entropy decoded from the bitstream.

[0155] When the encoding device (100) performs encoding through inter-prediction, the encoded current image can be used as a reference image for another image to be processed later. Accordingly, the encoding device (100) can restore or decode the encoded current image again, and can store the restored or decoded image as a reference image in the reference picture buffer (190).

[0156] The quantized level can be dequantized in the dequantization unit (160) and inverse transformed in the inverse transform unit (170). The dequantized and / or inverse transformed coefficients can be added to the prediction block through the adder (175). A reconstructed block can be generated by adding the dequantized and / or inverse transformed coefficients and the prediction block. Here, the dequantized and / or inverse transformed coefficients refer to coefficients for which at least one of dequantization and inverse transformation has been performed, and may refer to the reconstructed residual block.

[0157] The restoration block may pass through a filter section (180). The filter section (180) may apply at least one of a deblocking filter, a Sample Adaptive Offset (SAO), an Adaptive Loop Filter (ALF), etc., to the restoration sample, restoration block, or restoration image. The filter section (180) may also be referred to as an in-loop filter.

[0158] Deblocking filters can remove block distortion occurring at the boundaries between blocks. To determine whether to perform deblocking, the decision to apply the filter to the current block can be made based on samples contained in a few columns or rows within the block. When applying a deblocking filter to a block, different filters can be applied depending on the required deblocking filtering intensity.

[0159] To compensate for encoding errors using a sample adaptive offset, an appropriate offset value can be added to the sample value. The sample adaptive offset can correct the offset from the original image on a sample-by-sample basis for the deblocked image. One method may be to divide the samples included in the image into a certain number of regions, determine the region to be offset, and apply the offset to that region, or to apply the offset by considering the edge information of each sample.

[0160] An adaptive loop filter can perform filtering based on a comparison of the reconstructed image and the original image. After dividing the samples included in the image into predetermined groups, a filter to be applied to each group can be determined, thereby performing filtering differently for each group. Information regarding whether to apply an adaptive loop filter can be signaled per coding unit (CU), and the shape and filter coefficients of the adaptive loop filter to be applied may vary depending on each block.

[0161] The restored block or restored image that has passed through the filter unit (180) can be stored in the reference picture buffer (190). The restored block that has passed through the filter unit (180) may be part of the reference image. That is to say, the reference image may be a restored image composed of the restored blocks that have passed through the filter unit (180). The stored reference image may subsequently be used for inter-frame prediction or motion compensation.

[0162] FIG. 2 is a block diagram showing the configuration according to one embodiment of a decoding device to which the present invention is applied.

[0163] The decoding device (200) may be a decoder, a video decoding device, or an image decoding device.

[0164] Referring to FIG. 2, the decoding device (200) may include an entropy decoding unit (210), an inverse quantization unit (220), an inverse transformation unit (230), an intra prediction unit (240), a motion compensation unit (250), an adder (255), a filter unit (260), and a reference picture buffer (270).

[0165] The decoding device (200) can receive a bitstream output from the encoding device (100). The decoding device (200) can receive a bitstream stored in a computer-readable recording medium or a bitstream stream streamed through a wired / wireless transmission medium. The decoding device (200) can perform decoding on the bitstream in intra mode or inter mode. Additionally, the decoding device (200) can generate a restored image or a decoded image through decoding and can output the restored image or the decoded image.

[0166] If the prediction mode used for decoding is intra mode, the switch can be switched to intra. If the prediction mode used for decoding is inter mode, the switch can be switched to inter.

[0167] The decoding device (200) can decode the input bitstream to obtain a reconstructed residual block and generate a prediction block. Once the reconstructed residual block and the prediction block are obtained, the decoding device (200) can generate a reconstructed block to be decoded by adding the reconstructed residual block and the prediction block. The block to be decoded may be referred to as the current block.

[0168] The entropy decoding unit (210) can generate symbols by performing entropy decoding according to the probability distribution of the bitstream. The generated symbols may include symbols in the form of quantized levels. Here, the entropy decoding method may be the inverse process of the entropy encoding method described above.

[0169] The entropy decoding unit (210) can convert a one-dimensional vector-shaped coefficient into a two-dimensional block-shaped coefficient through a conversion coefficient scanning method to decode a conversion coefficient level (quantized level).

[0170] The quantized level can be inversely quantized in the inverse quantization unit (220) and inversely transformed in the inverse transformation unit (230). The quantized level can be generated as a restored residual block as a result of inverse quantization and / or inverse transformation being performed. At this time, the inverse quantization unit (220) can apply a quantization matrix to the quantized level.

[0171] When intra mode is used, the intra prediction unit (240) can generate a prediction block by performing a spatial prediction on the current block using sample values ​​of already decoded blocks around the block to be decoded.

[0172] When an inter mode is used, the motion compensation unit (250) can generate a prediction block by performing motion compensation on the current block using a motion vector and a reference image stored in the reference picture buffer (270). The motion compensation unit (250) can generate a prediction block by applying an interpolation filter to a portion of the reference image when the value of the motion vector does not have an integer value. To perform motion compensation, it can determine whether the motion compensation method of the prediction unit included in the corresponding encoding unit is a skip mode, merge mode, AMVP mode, or current picture reference mode based on the encoding unit, and can perform motion compensation according to each mode.

[0173] The adder (255) can generate a restored block by adding the restored residual block and the prediction block. The filter unit (260) can apply at least one of a deblocking filter, a sample adaptive offset, and an adaptive loop filter to the restored block or the restored image. The filter unit (260) can output the restored image. The restored block or the restored image can be stored in a reference picture buffer (270) and used for inter-prediction. The restored block that has passed through the filter unit (260) may be part of the reference image. That is to say, the reference image may be a restored image composed of the restored blocks that have passed through the filter unit (260). The stored reference image may subsequently be used for inter-frame prediction or motion compensation.

[0174] FIG. 3 is a diagram schematically illustrating the segmentation structure of an image when encoding and decoding an image. FIG. 3 schematically illustrates an embodiment in which a single unit is divided into a plurality of sub-units.

[0175] To efficiently segment the image, a coding unit (CU) may be used in encoding and decoding. The coding unit may be used as the basic unit of image encoding / decoding. Additionally, the coding unit may be used as a unit to distinguish between intra-frame prediction mode and inter-frame prediction mode during image encoding / decoding. The coding unit may be the basic unit used for the processes of prediction, transform, quantization, inverse transform, inverse quantization, or encoding / decoding of transform coefficients.

[0176] Referring to FIG. 3, the image (300) is sequentially divided into Largest Coding Units (LCUs), and the division structure is determined in LCU units. Here, LCU can be used with the same meaning as Coding Tree Unit (CTU). The division of a unit may refer to the division of a block corresponding to the unit. The block division information may include information regarding the depth of the unit. The depth information may indicate the number and / or degree of division of the unit. A unit may be hierarchically divided into multiple sub-units based on a tree structure and having depth information. That is to say, the unit and the sub-units generated by the division of the unit may correspond to a node and a child node of the node, respectively. Each divided sub-unit may have depth information. The depth information may be information indicating the size of the CU and may be stored for each CU. Since the unit depth indicates the number and / or degree of division of the unit, the division information of the sub-unit may include information regarding the size of the sub-unit.

[0177] The partitioning structure may refer to the distribution of coding units (CUs) within the CTU (310). This distribution may be determined by whether to partition a single CU into multiple CUs (positive integers of 2 or more, including 2, 4, 8, 16, etc.). The width and height of the CUs generated by partitioning may be half the width and height of the CUs before partitioning, respectively, or may have a size smaller than the width and height of the CUs before partitioning, depending on the number of partitions. The CUs may be recursively partitioned into multiple CUs. Through recursive partitioning, at least one of the width and height of the partitioned CUs may be reduced compared to at least one of the width and height of the CUs before partitioning. The partitioning of the CUs may be performed recursively up to a predefined depth or a predefined size. For example, the depth of the CTU may be 0, and the depth of the Smallest Coding Unit (SCU) may be a predefined maximum depth. Here, the CTU may be a coding unit having the maximum coding unit size as described above, and the SCU may be a coding unit having the minimum coding unit size. Division begins from the CTU (310), and the depth of the CU increases by 1 each time the horizontal and / or vertical size of the CU is reduced by division. For example, for each depth, the CU that is not divided may have a size of 2Nx2N. Also, for the CU that is divided, the CU of size 2Nx2N may be divided into 4 CUs of size NxN. The size of N may be reduced by half each time the depth increases by 1.

[0178] Additionally, information regarding whether a CU is divided can be expressed through the division information of the CU. The division information may be 1 bit of information. All CUs except the SCU may include division information. For example, if the value of the division information is a first value, the CU may not be divided, and if the value of the division information is a second value, the CU may be divided.

[0179] Referring to FIG. 3, a CTU with a depth of 0 can be a 64x64 block. 0 can be the minimum depth. A SCU with a depth of 3 can be an 8x8 block. 3 can be the maximum depth. CUs of 32x32 blocks and 16x16 blocks can be represented as depth 1 and depth 2, respectively.

[0180] For example, if a single encoding unit is divided into four encoding units, the width and height of the four divided encoding units may each have half the size of the encoding unit before division. For example, if a 32x32 encoding unit is divided into four encoding units, the four divided encoding units may each have a size of 16x16. When a single encoding unit is divided into four encoding units, the encoding unit can be said to have been divided into a quad-tree form (quad-tree partition).

[0181] For example, if a single encoding unit is divided into two encoding units, the width or height of the two divided encoding units may be half the size of the encoding unit before division. For example, if a 32x32 encoding unit is divided vertically into two encoding units, the two divided encoding units may each have a size of 16x32. For example, if an 8x32 encoding unit is divided horizontally into two encoding units, the two divided encoding units may each have a size of 8x16. When a single encoding unit is divided into two encoding units, the encoding unit can be said to have been partitioned into a binary tree form (binary-tree partition).

[0182] For example, when a single encoding unit is divided into three encoding units, the encoding unit can be divided into three encoding units by dividing the horizontal or vertical dimensions of the encoding unit before division in a ratio of 1:2:1. For example, if a 16x32 encoding unit is divided horizontally into three encoding units, the three divided encoding units may have dimensions of 16x8, 16x16, and 16x8, respectively, starting from the top. For example, if a 32x32 encoding unit is divided vertically into three encoding units, the three divided encoding units may have dimensions of 8x32, 16x32, and 8x32, respectively, starting from the left. When a single encoding unit is divided into three encoding units, the encoding unit can be said to have been partitioned in the form of a ternary-tree (ternary-tree partition).

[0183] The CTU (320) of Fig. 3 is an example of a CTU to which quadtree splitting, binary tree splitting and 3-part tree splitting are all applied.

[0184] As described above, to partition a CTU, at least one of quadtree partitioning, binary tree partitioning, and triad tree partitioning may be applied. Each partitioning may be applied based on a predetermined priority. For example, quadtree partitioning may be applied preferentially to the CTU. A coding unit that can no longer be quadtree partitioned may correspond to a leaf node of a quadtree. A coding unit corresponding to a leaf node of a quadtree may become a root node of a binary tree and / or a triad tree. That is, a coding unit corresponding to a leaf node of a quadtree may be binary tree partitioned, triad tree partitioned, or not partitioned further. At this time, by ensuring that quadtree partitioning is not performed again on the coding unit created by binary tree partitioning or triad tree partitioning of the coding unit corresponding to a leaf node of a quadtree, the partitioning of the block and / or signaling of partitioning information can be effectively performed.

[0185] The division of a coding unit corresponding to each node of a quadtree can be signaled using quad division information. Quad division information having a first value (e.g., '1') can indicate that the corresponding coding unit is quadtree divided. Quad division information having a second value (e.g., '0') can indicate that the corresponding coding unit is not quadtree divided. Quad division information may be a flag having a predetermined length (e.g., 1 bit).

[0186] There may be no priority between binary tree splitting and triad tree splitting. That is, encoding units corresponding to the leaf nodes of a quadtree can be binary tree split or triad tree split. Additionally, encoding units generated by binary tree splitting or triad tree splitting may be binary tree split or triad tree split again, or may not be split any further.

[0187] A partition in which there is no priority between binary tree partitioning and triad tree partitioning can be referred to as a multi-type tree partition. That is, the encoding unit corresponding to the leaf node of a quadtree can become the root node of a multi-type tree. The partition of the encoding unit corresponding to each node of the multi-type tree can be signaled using at least one of the partition status information, partition direction information, and partition tree information of the multi-type tree. For the partition of the encoding unit corresponding to each node of the multi-type tree, the partition status information, partition direction information, and partition tree information may be signaled sequentially.

[0188] Information on whether a composite tree is split with a first value (e.g., '1') may indicate that the corresponding encoding unit is split into a composite tree. Information on whether a composite tree is split with a second value (e.g., '0') may indicate that the corresponding encoding unit is not split into a composite tree.

[0189] When a encoding unit corresponding to each node of a composite tree is split, the corresponding encoding unit may further include splitting direction information. The splitting direction information may indicate the splitting direction of the composite tree split. Splitting direction information having a first value (e.g., '1') may indicate that the corresponding encoding unit is split in the vertical direction. Splitting direction information having a second value (e.g., '0') may indicate that the corresponding encoding unit is split in the horizontal direction.

[0190] When a encoding unit corresponding to each node of a composite tree is partitioned, the encoding unit may further include partition tree information. The partition tree information may indicate the tree used for the composite tree partition. Partition tree information having a first value (e.g., '1') may indicate that the encoding unit is partitioned into a binary tree. Partition tree information having a second value (e.g., '0') may indicate that the encoding unit is partitioned into a triad tree.

[0191] The splitting information, the splitting tree information, and the splitting direction information may each be flags having a predetermined length (e.g., 1 bit).

[0192] At least one of quad splitting information, information on whether a composite tree is split, splitting direction information, and splitting tree information can be entropy encoded / decoded. For the entropy encoding / decoding of the above information, information from a neighboring encoding unit adjacent to the current encoding unit may be used. For example, the splitting form (segmentation status, splitting tree, and / or splitting direction) of the left encoding unit and / or the upper encoding unit is highly likely to be similar to the splitting form of the current encoding unit. Therefore, context information for the entropy encoding / decoding of the information of the current encoding unit can be derived based on the information of the neighboring encoding unit. At this time, the information of the neighboring encoding unit may include at least one of the quad splitting information, information on whether a composite tree is split, splitting direction information, and splitting tree information of the corresponding encoding unit.

[0193] In another embodiment, among binary tree partitioning and three-part tree partitioning, binary tree partitioning may be performed first. That is, binary tree partitioning is applied first, and a encoding unit corresponding to a leaf node of the binary tree may be set as the root node of the three-part tree. In this case, quadtree partitioning and binary tree partitioning may not be performed for the encoding unit corresponding to a node of the three-part tree.

[0194] A encoding unit that is no longer divided by quadtree splitting, binary tree splitting, and / or ternary tree splitting can be a unit of encoding, prediction, and / or conversion. That is, the encoding unit may no longer be divided for prediction and / or conversion. Therefore, a splitting structure, splitting information, etc., for splitting the encoding unit into a prediction unit and / or conversion unit may not exist in the bitstream.

[0195] However, if the size of the encoding unit serving as the unit of division is larger than the size of the maximum conversion block, the encoding unit may be recursively divided until it becomes equal to or smaller than the size of the maximum conversion block. For example, if the size of the encoding unit is 64x64 and the size of the maximum conversion block is 32x32, the encoding unit may be divided into four 32x32 blocks for conversion. For example, if the size of the encoding unit is 32x64 and the size of the maximum conversion block is 32x32, the encoding unit may be divided into two 32x32 blocks for conversion. In this case, whether the encoding unit is divided for conversion is not separately signaled, but may be determined by comparing the width or height of the encoding unit with the width or height of the maximum conversion block. For example, if the width of the encoding unit is larger than the width of the maximum conversion block, the encoding unit may be divided vertically into two. In addition, if the vertical dimension of the encoding unit is greater than the vertical dimension of the maximum conversion block, the encoding unit can be divided horizontally into two halves.

[0196] Information regarding the maximum and / or minimum size of the encoding unit and information regarding the maximum and / or minimum size of the conversion block may be signaled or determined at an upper level of the encoding unit. The upper level may be, for example, a sequence level, a picture level, a tile level, a tile group level, a slice level, etc. For example, the minimum size of the encoding unit may be determined to be 4x4. For example, the maximum size of the conversion block may be determined to be 64x64. For example, the minimum size of the conversion block may be determined to be 4x4.

[0197] Information regarding the minimum size of an encoding unit corresponding to a leaf node of a quadtree (quadtree minimum size) and / or information regarding the maximum depth from the root node to a leaf node of a composite tree (composite tree maximum depth) may be signaled or determined at an upper level of the encoding unit. The upper level may be, for example, a sequence level, a picture level, a slice level, a tile group level, a tile level, etc. Information regarding the quadtree minimum size and / or information regarding the composite tree maximum depth may be signaled or determined for each of the in-frame slice and the inter-frame slice.

[0198] Difference information regarding the size of the CTU and the maximum size of the transform block may be signaled or determined at an upper level of the encoding unit. The upper level may be, for example, a sequence level, a picture level, a slice level, a tile group level, a tile level, etc. Information regarding the maximum size of the encoding unit corresponding to each node of the binary tree (binary tree maximum size) may be determined based on the size of the encoding tree unit and the difference information. The maximum size of the encoding unit corresponding to each node of the triad tree (triad tree maximum size) may have different values ​​depending on the type of slice. For example, in the case of an in-frame slice, the triad tree maximum size may be 32x32. Also, for example, in the case of an inter-frame slice, the triad tree maximum size may be 128x128. For example, the minimum size of the encoding unit corresponding to each node of the binary tree (binary tree minimum size) and / or the minimum size of the encoding unit corresponding to each node of the triad tree (triad tree minimum size) can be set as the minimum size of the encoding block.

[0199] As another example, the maximum size of a binary tree and / or the maximum size of a triad tree can be signaled or determined at the slice level. Also, the minimum size of a binary tree and / or the minimum size of a triad tree can be signaled or determined at the slice level.

[0200] Based on the size and depth information of the various blocks mentioned above, quad splitting information, information on whether a composite tree is split, splitting tree information and / or splitting direction information, etc., may or may not exist in the bitstream.

[0201] For example, if the size of the encoding unit is not larger than the minimum size of the quadtree, the encoding unit does not include quad splitting information, and the said quad splitting information can be inferred as a second value.

[0202] For example, if the size (width and height) of a encoding unit corresponding to a node of a composite tree is larger than the maximum size (width and height) of a binary tree and / or the maximum size (width and height) of a three-part tree, the encoding unit may not be divided into a binary tree and / or a three-part tree. Accordingly, information on whether the composite tree is divided is not signaled and can be inferred as a second value.

[0203] Alternatively, if the size (width and height) of the encoding unit corresponding to the node of the composite tree is equal to the minimum size (width and height) of the binary tree, or if the size (width and height) of the encoding unit is equal to twice the minimum size (width and height) of the 3-partition tree, the encoding unit may not be divided into a binary tree and / or a 3-partition tree. Accordingly, information regarding whether the composite tree is divided is not signaled and can be inferred as a second value. This is because if the encoding unit is divided into a binary tree and / or a 3-partition tree, an encoding unit smaller than the minimum size of the binary tree and / or the minimum size of the 3-partition tree is generated.

[0204] Alternatively, binary tree splitting or three-part tree splitting may be limited based on the size of a virtual pipeline data unit (hereinafter referred to as the pipeline buffer size). For example, if a encoding unit is divided into sub-coding units that are not suitable for the pipeline buffer size by binary tree splitting or three-part tree splitting, said binary tree splitting or three-part tree splitting may be limited. The pipeline buffer size may be the size of a maximum transform block (e.g., 64X64). For example, when the pipeline buffer size is 64X64, the following splitting may be limited.

[0205] - 3-partition tree partitioning for NxM (N and / or M are 128) encoding units

[0206] - Horizontal binary tree partitioning for 128xN (N <= 64) encoding units

[0207] - Vertical binary tree partitioning for Nx128 (N <= 64) encoding units

[0208] Alternatively, if the depth of the encoding unit within the composite tree corresponding to the node of the composite tree is equal to the maximum depth of the composite tree, the encoding unit may not be divided into a binary tree and / or a three-way tree. Accordingly, information regarding whether the composite tree is divided is not signaled and can be inferred as a second value.

[0209] Alternatively, information on whether the composite tree is divided can be signaled only when at least one of vertical binary tree splitting, horizontal binary tree splitting, vertical three-way splitting, and horizontal three-way splitting is possible for the encoding unit corresponding to the node of the composite tree. Otherwise, the encoding unit may not be divided into a binary tree and / or a three-way splitting. Accordingly, information on whether the composite tree is divided is not signaled and can be inferred as a second value.

[0210] Alternatively, the division direction information may be signaled only when both vertical binary tree division and horizontal binary tree division are possible for the encoding unit corresponding to the node of the composite tree, or when both vertical 3-division tree division and horizontal 3-division tree division are possible. Otherwise, the division direction information is not signaled and may be inferred as a value indicating a direction in which division is possible.

[0211] Alternatively, the split tree information may be signaled only when both vertical binary tree splitting and vertical triad tree splitting are possible for the encoding unit corresponding to the node of the composite tree, or when both horizontal binary tree splitting and horizontal triad tree splitting are possible. Otherwise, the split tree information is not signaled and may be inferred as a value indicating a splittable tree.

[0212] Figure 4 is a diagram illustrating an example of an in-screen prediction process.

[0213] The arrows from the center to the outer edge of Fig. 4 may indicate the prediction directions of the prediction modes within the screen.

[0214] In-frame encoding and / or decoding may be performed using reference samples from neighboring blocks of the current block. Neighboring blocks may be restored neighboring blocks. For example, in-frame encoding and / or decoding may be performed using the values ​​of reference samples or encoding parameters contained in the restored neighboring blocks.

[0215] A prediction block may refer to a block generated as a result of performing a prediction within the screen. A prediction block may correspond to at least one of CU, PU, ​​and TU. The unit of a prediction block may be at least one of the sizes of CU, PU, ​​and TU. A prediction block may be a square-shaped block with sizes such as 2x2, 4x4, 16x16, 32x32, or 64x64, or a rectangular-shaped block with sizes such as 2x8, 4x8, 2x16, 4x16, and 8x16.

[0216] In-frame prediction can be performed according to the in-frame prediction mode for the current block. The number of in-frame prediction modes that the current block may have can be a predefined fixed value or a value determined differently based on the attributes of the prediction block. For example, the attributes of the prediction block may include the size and shape of the prediction block.

[0217] The number of in-screen prediction modes may be fixed at N regardless of the block size. Or, for example, the number of in-screen prediction modes may be 3, 5, 9, 17, 34, 35, 36, 65, or 67. Or, the number of in-screen prediction modes may vary depending on the block size and / or the type of color component. For example, the number of in-screen prediction modes may differ depending on whether the color component is a luminance signal or a chroma signal. For example, as the block size increases, the number of in-screen prediction modes may increase. Or, the number of in-screen prediction modes for a luminance component block may be greater than the number of in-screen prediction modes for a chroma component block.

[0218] The in-frame prediction mode may be a non-directional mode or a directional mode. The non-directional mode may be a DC mode or a Planar mode, and the angular mode may be a prediction mode having a specific direction or angle. The in-frame prediction mode may be represented by at least one of a mode number, a mode value, a mode number, a mode angle, or a mode direction. The number of in-frame prediction modes may be one or more M, including the non-directional and directional modes. A step of checking whether samples included in the restored surrounding blocks can be used as reference samples for the current block to predict the current block in-frame may be performed. If there are samples that cannot be used as reference samples for the current block, the sample value of the sample that cannot be used as a reference sample may be replaced with a value obtained by copying and / or interpolating at least one sample value among the samples included in the restored surrounding blocks, and then used as a reference sample for the current block.

[0219] Figure 7 is a diagram illustrating reference samples available for in-screen prediction.

[0220] As illustrated in FIG. 7, at least one of reference sample lines 0 to 3 may be used for in-frame prediction of the current block. In FIG. 7, samples of segment A and segment F may be padded with the nearest samples of segment B and segment E, respectively, instead of being taken from restored neighboring blocks. Index information indicating the reference sample line to be used for in-frame prediction of the current block may be signaled. If the top boundary of the current block is the boundary of the CTU, only reference sample line 0 may be available. Therefore, in this case, the index information may not be signaled. If a reference sample line other than reference sample line 0 is used, filtering for the prediction block described below may not be performed.

[0221] When making an in-screen prediction, a filter may be applied to at least one of the reference sample or the prediction sample based on at least one of the in-screen prediction mode and the size of the current block.

[0222] In Planner mode, when generating a prediction block for the current block, the sample value of the target sample can be generated using the weighted sum of the top and left reference samples of the current sample and the top-right and bottom-left reference samples of the current block, depending on the position of the target sample within the prediction block. Additionally, in DC mode, when generating a prediction block for the current block, the average value of the top and left reference samples of the current block can be used. Furthermore, in Directional mode, a prediction block can be generated using the top, left, top-right, and / or bottom-left reference samples of the current block. Real-valued interpolation may also be performed to generate the prediction sample value.

[0223] In the case of in-frame prediction between color components, a prediction block for the current block of the second color component can be generated based on the corresponding restoration block of the first color component. For example, the first color component may be a luminance component, and the second color component may be a chrominance component. For in-frame prediction between color components, parameters of a linear model between the first color component and the second color component may be derived based on a template. The template may include upper and / or left peripheral samples of the current block and corresponding upper and / or left peripheral samples of the restoration block of the first color component. For example, the parameters of the linear model may be derived using the sample value of the first color component having the maximum value among the samples in the template and the corresponding sample value of the second color component, and the sample value of the first color component having the minimum value among the samples in the template and the corresponding sample value of the second color component. Once the parameters of the linear model are derived, the corresponding restoration block can be applied to the linear model to generate a prediction block for the current block. Depending on the image format, subsampling may be performed on the peripheral samples of the restoration block of the first color component and the corresponding restoration block. For example, if one sample of the second color component corresponds to four samples of the first color component, one corresponding sample can be calculated by subsampling the four samples of the first color component. In this case, parameter derivation of the linear model and intra-frame prediction between color components can be performed based on the subsampled corresponding sample. Whether to perform intra-frame prediction between color components and / or the range of the template can be signaled as an intra-frame prediction mode.

[0224] The current block can be divided into two or four sub-blocks in the horizontal or vertical direction. The divided sub-blocks can be restored sequentially. That is, an in-frame prediction can be performed on the sub-blocks to generate sub-predicted blocks. Additionally, inverse quantization and / or inverse transformation can be performed on the sub-blocks to generate sub-residual blocks. A restored sub-block can be generated by adding the sub-predicted block to the sub-residual block. The restored sub-block can be used as a reference sample for the in-frame prediction of the lower-ranked sub-blocks. A sub-block may be a block containing a predetermined number (e.g., 16) or more samples. Thus, for example, if the current block is an 8x4 block or a 4x8 block, the current block can be divided into two sub-blocks. Also, if the current block is a 4x4 block, the current block cannot be divided into sub-blocks. If the current block has other sizes, the current block can be divided into four sub-blocks. Information regarding whether the sub-block-based in-screen prediction is performed and / or the division direction (horizontal or vertical) may be signaled. The sub-block-based in-screen prediction may be restricted to be performed only when using reference sample line 0. When the sub-block-based in-screen prediction is performed, filtering for the prediction block described below may not be performed.

[0225] A final prediction block can be generated by performing filtering on the predicted prediction blocks within the screen. The filtering can be performed by applying a predetermined weight to the filtering target sample, the left reference sample, the top reference sample, and / or the top-left reference sample. The weight and / or reference samples (range, position, etc.) used for the filtering can be determined based on at least one of the block size, the prediction mode within the screen, and the position of the filtering target sample within the prediction block. The filtering can be performed only in the case of a predetermined prediction mode within the screen (e.g., DC, planar, vertical, horizontal, diagonal, and / or adjacent diagonal mode). The adjacent diagonal mode may be a mode obtained by adding or subtracting k from the diagonal mode. For example, k may be a positive integer less than or equal to 8.

[0226] The in-frame prediction mode of the current block can be entropy encoded / decoded by predicting it from the in-frame prediction mode of blocks existing in the vicinity of the current block. If the in-frame prediction modes of the current block and the surrounding blocks are identical, information indicating that the in-frame prediction modes of the current block and the surrounding blocks are identical can be signaled using predetermined flag information. Additionally, indicator information regarding the in-frame prediction mode that is identical to the in-frame prediction mode of the current block among multiple in-frame prediction modes of surrounding blocks can be signaled. If the in-frame prediction modes of the current block and the surrounding blocks are different, the in-frame prediction mode information of the current block can be entropy encoded / decoded by performing entropy encoding / decoding based on the in-frame prediction modes of the surrounding blocks.

[0227] Figure 5 is a diagram illustrating an example of an inter-frame prediction process.

[0228] The rectangle shown in Fig. 5 can represent an image. Additionally, the arrow in Fig. 5 can indicate the prediction direction. Each image can be classified into I-picture (Intra Picture), P-picture (Predictive Picture), B-picture (Bi-predictive Picture), etc., depending on the encoding type.

[0229] Picture I can be encoded / decoded through intra-frame prediction without inter-frame prediction. Picture P can be encoded / decoded through inter-frame prediction using only reference images existing in a unidirectional direction (e.g., forward or reverse). Picture B can be encoded / decoded through inter-frame prediction using reference images existing in both directions (e.g., forward and reverse). Additionally, in the case of Picture B, it can be encoded / decoded through inter-frame prediction using reference images existing in both directions, or through inter-frame prediction using reference images existing in either the forward or reverse direction. Here, the bidirectional direction may be the forward and reverse directions. Here, when inter-frame prediction is used, the encoder may perform inter-frame prediction or motion compensation, and the decoder may perform corresponding motion compensation.

[0230] Below, the inter-screen prediction according to the embodiment is described in detail.

[0231] Inter-frame prediction or motion compensation can be performed using reference images and motion information.

[0232] Motion information for the current block can be derived during inter-frame prediction by each of the encoding device (100) and the decoding device (200). Motion information can be derived using motion information of restored surrounding blocks, motion information of a collocated block, and / or a block adjacent to the collocated block. A collocated block may be a block corresponding to the spatial position of the current block within an already restored collocated picture. Here, the collocated picture may be one picture among at least one reference picture included in a reference picture list.

[0233] The method of deriving motion information may vary depending on the prediction mode of the current block. For example, prediction modes applied for inter-frame prediction may include AMVP mode, merge mode, skip mode, merge mode with motion vector difference, sub-block merge mode, triangulation mode, inter-intra combined prediction mode, and affine inter mode. Here, the merge mode can be referred to as the motion merge mode.

[0234] For example, when AMVP is applied as a prediction mode, a motion vector candidate list can be generated by determining at least one of the motion vector of a restored surrounding block, the motion vector of a call block, the motion vector of a block adjacent to the call block, and the (0, 0) motion vector as a motion vector candidate. Motion vector candidates can be derived using the generated motion vector candidate list. Motion information of the current block can be determined based on the derived motion vector candidates. Here, the motion vector of the call block or the motion vector of a block adjacent to the call block can be referred to as a temporal motion vector candidate, and the motion vector of a restored surrounding block can be referred to as a spatial motion vector candidate.

[0235] The encoding device (100) can calculate the Motion Vector Difference (MVD) between the motion vector of the current block and a motion vector candidate, and can entropy-encode the MVD. Additionally, the encoding device (100) can generate a bitstream by entropy-encoding a motion vector candidate index. The motion vector candidate index can indicate the optimal motion vector candidate selected from among the motion vector candidates included in the motion vector candidate list. The decoding device (200) entropy-decodes the motion vector candidate index from the bitstream and can select a motion vector candidate for the block to be decoded from among the motion vector candidates included in the motion vector candidate list using the entropy-decoded motion vector candidate index. Additionally, the decoding device (200) can derive the motion vector of the block to be decoded through the sum of the entropy-decoded MVD and the motion vector candidate.

[0236] Meanwhile, the encoding device (100) can entropy-encode the resolution information of the calculated MVD. The decoding device (200) can adjust the resolution of the entropy-decoded MVD using the MVD resolution information.

[0237] Meanwhile, the encoding device (100) can calculate the Motion Vector Difference (MVD) between the motion vector of the current block and motion vector candidates based on an affine model, and can entropy encode the MVD. The decoding device (200) can derive the affine control motion vector of the block to be decoded by deriving the affine control motion vector of the block to be decoded through the sum of the entropy decoded MVD and the affine control motion vector candidates, thereby deriving motion vectors in sub-block units.

[0238] The bitstream may include a reference image index indicating a reference image. The reference image index may be entropy encoded and signaled from the encoding device (100) to the decoding device (200) via the bitstream. The decoding device (200) may generate a prediction block for a block to be decoded based on the induced motion vector and the reference image index information.

[0239] Another example of a method for deriving motion information is merge mode. Merge mode may refer to the merging of motions for multiple blocks. Merge mode may refer to a mode in which motion information of the current block is derived from the motion information of surrounding blocks. When merge mode is applied, a merge candidate list can be generated using the restored motion information of surrounding blocks and / or the motion information of the call block. Motion information may include at least one of 1) a motion vector, 2) a reference image index, and 3) an inter-frame prediction indicator. The prediction indicator may be unidirectional (L0 prediction, L1 prediction) or bidirectional.

[0240] The merge candidate list may represent a list in which motion information is stored. The motion information stored in the merge candidate list may be at least one of motion information of neighboring blocks adjacent to the current block (spatial merge candidate), motion information of a block collocated with the current block in a reference image (temporal merge candidate), new motion information generated by a combination of motion information already existing in the merge candidate list, motion information of a block encoded / decoded prior to the current block (history-based merge candidate), and zero merge candidate.

[0241] The encoding device (100) can generate a bitstream by entropy encoding at least one of a merge flag and a merge index and then signal it to the decoding device (200). The merge flag may be information indicating whether to perform a merge mode on a block-by-block basis, and the merge index may be information regarding which block among the surrounding blocks adjacent to the current block will be merged with. For example, the surrounding blocks of the current block may include at least one of the left adjacent block, the top adjacent block, and the temporally adjacent block of the current block.

[0242] Meanwhile, the encoding device (100) can entropy-encode correction information for correcting the motion vector among the motion information of the merge candidate and signal it to the decoding device (200). The decoding device (200) can correct the motion vector of the merge candidate selected by the merge index based on the correction information. Here, the correction information may include at least one of correction status information, correction direction information, and correction magnitude information. As described above, the prediction mode for correcting the motion vector of the merge candidate based on the signaled correction information can be referred to as a merge mode having a motion vector difference.

[0243] Skip mode may be a mode that applies the motion information of surrounding blocks directly to the current block. When skip mode is used, the encoding device (100) may entropy-encode information regarding which block's motion information to use as the motion information of the current block and signal it to the decoding device (200) via a bitstream. At this time, the encoding device (100) may not signal to the decoding device (200) any syntax elements regarding at least one of motion vector difference information, encoding block flags, and transform coefficient levels (quantized levels).

[0244] The subblock merge mode may refer to a mode that derives motion information at the subblock level of a coding block (CU). When the subblock merge mode is applied, a subblock merge candidate list may be generated using motion information of the subblock collocated to the current subblock in the reference image (subblock-based temporal merge candidate) and / or affine control point motion vector merge candidate.

[0245] The triangle partition mode may refer to a mode in which the current block is divided diagonally to derive movement information for each, each prediction sample is derived using the derived movement information, and each prediction sample is derived by weighted summing the derived prediction samples to derive the prediction sample of the current block.

[0246] The inter-intra combined prediction mode may refer to a mode that derives the prediction sample of the current block by weighting the prediction sample generated by inter-frame prediction and the prediction sample generated by intra-frame prediction.

[0247] The decoding device (200) can self-correct the derived motion information. The decoding device (200) can derive the motion information having the minimum SAD into corrected motion information by searching a predefined area based on the reference block indicated by the derived motion information.

[0248] The decoding device (200) can compensate for prediction samples derived through inter-frame prediction using optical flow.

[0249] Figure 6 is a diagram illustrating the process of transformation and quantization.

[0250] As illustrated in FIG. 6, a quantized level may be generated by performing a transformation and / or quantization process on the residual signal. The residual signal may be generated as the difference between the original block and the prediction block (in-frame prediction block or inter-frame prediction block). Here, the prediction block may be a block generated by in-frame prediction or inter-frame prediction. Here, the transformation may include at least one of a first transformation and a second transformation. Transformation coefficients may be generated by performing a first transformation on the residual signal, and second transformation coefficients may be generated by performing a second transformation on the transformation coefficients.

[0251] The primary transform may be performed using at least one of a plurality of predefined transform methods. For example, the plurality of predefined transform methods may include a Discrete Cosine Transform (DCT), a Discrete Sine Transform (DST), or a Karhunen-Loeve Transform (KLT)-based transform. A secondary transform may be performed on the transform coefficients generated after the primary transform is performed. The transform method applied during the primary transform and / or secondary transform may be determined based on at least one of the encoding parameters of the current block and / or surrounding blocks. Alternatively, transform information indicating the transform method may be signaled. The DCT-based transform may include, for example, DCT2, DCT-8, etc. The DST-based transform may include, for example, DST-7.

[0252] Quantized levels can be generated by performing quantization on the result of a first transformation and / or a second transformation, or on the residual signal. The quantized levels can be scanned according to at least one of an up-right diagonal scan, a vertical scan, and a horizontal scan based on at least one of an in-frame prediction mode or a block size / shape. For example, the coefficients of a block can be converted into a one-dimensional vector form by scanning them using an up-right diagonal scan. Depending on the size of the transformed block and / or the in-frame prediction mode, a vertical scan that scans the two-dimensional block shape coefficients in the column direction, or a horizontal scan that scans the two-dimensional block shape coefficients in the row direction, may be used instead of an up-right diagonal scan. The scanned quantized levels can be entropy-encoded and included in a bitstream.

[0253] In the decoder, the bitstream can be entropy decoded to generate quantized levels. The quantized levels can be inverse scanned and aligned into a two-dimensional block shape. At this time, at least one of an upper-right diagonal scan, a vertical scan, and a horizontal scan can be performed as a method of inverse scanning.

[0254] Inverse quantization can be performed on the quantized level, and depending on whether a second inverse transform is performed, a second inverse transform can be performed, and depending on whether a first inverse transform is performed on the result of the second inverse transform, a first inverse transform can be performed to generate a restored residual signal.

[0255] Inverse mapping of the dynamic range can be performed on the luminance component restored through intra-frame prediction or inter-frame prediction before in-loop filtering. The dynamic range can be divided into 16 equal pieces, and a mapping function for each piece can be signaled. The mapping function can be signaled at the slice level or the tile group level. An inverse mapping function for performing the inverse mapping can be derived based on the mapping function. In-loop filtering, saving of the reference picture, and motion compensation are performed in the inversely mapped area, and the prediction block generated through inter-frame prediction can be used to generate the restoration block after being converted to the mapped area by mapping using the mapping function. However, since intra-frame prediction is performed in the mapped area, the prediction block generated by intra-frame prediction can be used to generate the restoration block without mapping / inverse mapping.

[0256] If the current block is a residual block of a chrominance component, the residual block can be converted into an inversely mapped area by performing scaling on the chrominance component of the mapped area. The availability of the scaling can be signaled at the slice level or the tile group level. The scaling may be applied only when the mapping for the luminance component is available and the partitioning of the luminance component and the partitioning of the chrominance component follow the same tree structure. The scaling may be performed based on the average of the sample values ​​of the luminance prediction block corresponding to the chrominance block. In this case, if the current block uses cross-frame prediction, the luminance prediction block may refer to the mapped luminance prediction block. By referencing a lookup table using the index of the piece to which the average of the sample values ​​of the luminance prediction block belongs, the value required for the scaling can be derived. Finally, by scaling the residual block using the derived value, the residual block can be converted into an inversely mapped area. Subsequent restoration of color difference component blocks, intra-frame prediction, inter-frame prediction, in-loop filtering, and saving of the reference picture can be performed in the inversely mapped area.

[0257] Information indicating whether mapping / inverse mapping of the above luminance component and color difference component is available can be signaled through a sequence parameter set.

[0258] The predicted block of the current block can be generated based on a block vector representing the displacement between the current block and the reference block within the current picture. In this way, the prediction mode that generates the predicted block by referencing the current picture can be named the Intra Block Copy (IBC) mode. The IBC mode can be applied to an MxN (M <= 64, N <= 64) encoding unit. The IBC mode may include skip mode, merge mode, AMVP mode, etc. In the case of skip mode or merge mode, a merge candidate list is constructed, and a merge index is signaled to identify a single merge candidate. The block vector of the identified merge candidate can be used as the block vector of the current block. The merge candidate list may include at least one of the following: a spatial candidate, a history-based candidate, a candidate based on the average of two candidates, or a zero-merge candidate. In the case of AMVP mode, a difference block vector may be signaled. Additionally, the predicted block vector can be derived from the left neighbor block and the top neighbor block of the current block. An index regarding which neighbor block to use can be signaled. The predicted block in IBC mode may be limited to a block within a previously restored area that is included in the current CTU or the left CTU. For example, the value of the block vector may be restricted so that the predicted block of the current block is located within the three 64x64 block areas that precede the 64x64 block to which the current block belongs in terms of encoding / decoding order. By restricting the value of the block vector in this way, memory consumption and device complexity associated with the implementation of IBC mode can be reduced.

[0259] The following terms may be used in the specifications below.

[0260] A block vector can be a vector that specifies the location of a reference block in IBC mode.

[0261] Current Picture Referencing may be another expression for IBC.

[0262] Pairwise average can mean Pairwise average or combined bi-predictive.

[0263] Skip mode may refer to a mode that uses the block vector of surrounding blocks but does not transmit residual video signals.

[0264] MERGE mode may refer to a mode that uses the block vectors of neighboring blocks and transmits residual video signals. As another example, MERGE mode may refer to a mode that uses the block vectors of neighboring blocks regardless of whether residual video signals are transmitted. In this case, MERGE mode can be used to encompass Skip mode, Regular MERGE mode, Sub-block based MERGE mode, Triangulation MERGE mode, and Combined In-frame to Inter-frame modes.

[0265] The merge candidate list may refer to the set of merge candidates used by the aforementioned merge mode.

[0266] The predicted block vector may refer to the motion vectors of the temporal or spatial surrounding blocks of the current block, and the residual block vector may refer to the difference vector between the predicted block vector and the current block vector. Additionally, block vector information may refer to information composed of the predicted block vector and the residual block vector.

[0267] The reference image index may be information indicating the image (or slice, tile) referenced by the current block. If the reference image index indicates the image containing the current block, the prediction mode of the current block may be Block Vector Prediction Mode or IBC Mode. Additionally, if the reference image index indicates the image not containing the current block, the prediction mode of the current block may be Inter-Frame Prediction Mode.

[0268] The syntax element availableN may be a value indicating whether the surrounding blocks (N) of the current block are available. Here, N may be A_k or B_k, where k may be one of 0, 1, and 2.

[0269] Hereinafter, a method for encoding / decoding an image using an IBC (Intra block copy) mode according to one embodiment of the present invention will be described in detail.

[0270] An image can be encoded / decoded according to at least one or a combination of at least one of the following embodiments. By using the following embodiments, the reference block for the current block can be efficiently determined during the image encoding / decoding process, thereby improving the encoding efficiency of the image encoder and the decoding efficiency of the image decoder.

[0271] FIG. 8 is a flowchart illustrating an image encoding method according to one embodiment of the present invention, and FIG. 9 is a flowchart illustrating an image decoding method according to one embodiment of the present invention.

[0272] Referring to FIG. 8, an image encoding or decoding method according to one embodiment of the present invention may include a step of determining the prediction mode of the current block as an IBC (Intra block copy) mode (S810), a step of deriving a merge candidate list to derive the block vector of the current block (S820), and a step of determining the block vector of the current block using the merge candidate list (S830).

[0273] The block vector of the current block above can be derived based on at least one of the merge index (merge_idx) for the merge candidate list, a referenceable movement vector, a referenceable block vector, and a default vector.

[0274] Referring to FIG. 9, an image encoding or decoding method according to one embodiment of the present invention may include a step of determining the prediction mode of the current block as an IBC (Intra block copy) mode (S910), a step of deriving an AMVP candidate list for deriving the block vector of the current block (S920), and a step of deriving the block vector of the current block using the AMVP candidate list.

[0275] The block vector of the current block above can be derived based on at least one of the MVP index (mvp_idx) for the AMVP candidate list, a referenced motion vector, a referenced block vector, a default vector, and syntax elements abs_mvd_greater0_flag, abs_mvd_greater1_flag, mvd_sign_flag, and abs_mvd_minus2.

[0276] At this time, the merge candidate list or AMVP candidate list can be derived based on at least one of the encoding parameters, picture information, slice information, quantization parameters (QP), encoding block flag (CBF), block size, block depth, block shape, entropy encoding or decoding method, prediction mode of neighboring blocks, and temporal hierarchy level for the current block.

[0277] Below, we will examine each step illustrated in FIGS. 8 and FIGS. 9 in detail.

[0278] First, the step (S820) of deriving a merge candidate list for deriving block vectors is described.

[0279] A merge candidate list for deriving block vectors can be derived based on at least one of a referenceable motion vector, a referenceable block vector, or a default vector.

[0280] For example, a referenceable motion vector may include at least one of the motion vector of the spatial neighboring block of the current block, the motion vector of the temporal neighboring block, the motion vector based on HMVP (History based motion vector prediction), and the motion vector based on pairwise average.

[0281] Additionally, for example, a referenceable block vector may include at least one of a block vector of spatial neighbor blocks of the current block, a block vector of temporal neighbor blocks, an HMVP-based block vector, and a pairwise average-based block vector.

[0282] In addition, for example, a basic vector can be a zero vector with a value of (0,0).

[0283] FIG. 10 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to an embodiment of the present invention.

[0284] According to FIG. 10, the encoder or decoder may add spatial merge candidates to the merge candidate list. The maximum number of spatial merge candidates added to the merge candidate list may be pre-set. For example, the maximum number of spatial merge candidates may be a positive integer greater than or equal to 1. For instance, the maximum number of spatial merge candidates may be 2 or 5. If there are duplicate candidates in the merge candidate list, the encoder or decoder may delete the duplicate candidates.

[0285] An encoder or decoder may add temporal candidates to the merge candidate list. The maximum number of temporal candidates added to the merge candidate list may be pre-set. For example, the maximum number of temporal merge candidates may be a positive integer greater than or equal to 1. For instance, the maximum number of temporal candidates may be 1.

[0286] An encoder or decoder may add HMVP candidates and pair prediction candidates to the merge candidate list. Next, the encoder or decoder may determine whether the number of candidates currently added to the merge candidate list is less than a preset value, and based on this determination, add zero vector candidates to the merge candidate list. At this time, the encoder or decoder may add zero vector candidates to the merge candidate list until the total number of candidates included in the merge candidate list becomes equal to the preset value. For example, the preset value may be a positive integer greater than or equal to 1. For instance, the preset value may be 7.

[0287] As another example, a merge candidate list for deriving a block vector can be derived based on at least one of a motion vector pointing to a referenceable predetermined range, a block vector pointing to a referenceable predetermined range, and a base vector.

[0288] The motion vector here may be an unscaled motion vector. That is, it may be a motion vector pointing within a predetermined range without scaling.

[0289] Meanwhile, for example, when generating a merge candidate list for deriving a block vector, the referenceable motion vector may be at least one of a motion vector of a spatial neighbor block pointing within a predetermined range, a motion vector of a temporal neighbor block pointing within a predetermined range, and an HMVP-based motion vector pointing within a predetermined range.

[0290] As another example, when generating a merge candidate list for deriving a block vector, the referenceable block vector may be at least one of a block vector of a spatial neighbor block pointing within a predetermined range, a block vector of a temporal neighbor block pointing within a predetermined range, and an HMVP-based block vector pointing within a predetermined range.

[0291] As another example, a motion vector pointing within a predetermined range or a block vector pointing within a predetermined range may be included in the merge candidate list for deriving the block vector. On the other hand, a motion vector pointing outside the predetermined range or a block vector pointing outside the predetermined range may not be included in the merge candidate list.

[0292] As another example, when generating a merge candidate list for deriving block vectors, spatially neighboring blocks located outside a predetermined range may not be referenced.

[0293] For example, a predetermined range may be the current CTU including the current block.

[0294] As another example, the predetermined range may be at least one of the area of ​​the current CTU containing the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU containing the current block and the surrounding CTU area of ​​the current CTU. As yet another example, the predetermined range may be the current CTU and the left CTU of the current CTU. As yet another example, the predetermined range may be the restored area of ​​the current CTU and a portion of the left CTU of the current CTU.

[0295] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0296] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0297] The base vector can be at least one of a predefined vector or a zero vector (0,0). The predefined vector value can be signaled at at least one level of SPS, PPS, Slice, NAL, and Brick.

[0298] For example, a predefined vector value may be one of (-4*width, 0), (-2*width, 0), (-width, 0), (0,-4*height), (0,-2*height), (0,-height), (-2*width,-2*height), and (-width,-height). Here, width may be the width of a predetermined size or the current block, and height may be the height of a predetermined size block or the current block. Additionally, width may be a portion of the width of a predetermined size block or the current block, and height may be a portion of the height of a predetermined size block or the current block. For example, width may be half the width of the current CTU, and height may be half the height of the current CTU.

[0299] FIG. 11 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to another embodiment of the present invention.

[0300] According to one embodiment of the present invention, when generating a merge candidate list for block vector derivation, a motion vector candidate pointing outside a predetermined range or a block vector candidate pointing outside a predetermined range can be removed from the merge candidate list for block vector derivation.

[0301] For example, a predetermined range may be the current CTU including the current block.

[0302] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0303] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0304] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0305] The encoder or decoder can examine the merge candidate list whenever a merge candidate is added to the merge candidate list for block vector derivation, and remove motion vector candidates pointing outside a predetermined range or block vector candidates pointing outside a predetermined range from the merge candidate list.

[0306] The flowchart of FIG. 11 may be a flowchart in which the step of deleting unavailable block vector candidates from the merge candidate list is added to the flowchart of FIG. 10. After a new candidate is added to the merge candidate list, the encoder or decoder may determine whether the current block is encoded in IBC mode. If the encoder or decoder determines that the current block is encoded in IBC mode, it may remove unavailable block vector candidates from the merge candidate list. The determination of IBC mode and the removal of unavailable block vector candidates may be performed after the addition of at least one of the spatial candidate, temporal candidate, HMVP-based candidate, and paired prediction candidate of the current block.

[0307] FIG. 12 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to another embodiment of the present invention.

[0308] According to another embodiment of the present invention, when generating a merge candidate list for block vector derivation, a motion vector candidate pointing outside a predetermined range or a block vector candidate pointing outside a predetermined range can be removed from the merge candidate list for block vector derivation.

[0309] For example, a predetermined range may be the current CTU including the current block.

[0310] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0311] As another example, the specified range may be the current CTU and the CTU to the left of the current CTU. As another example, the specified range may be the restored area of ​​the current CTU and a portion of the area of ​​the CTU to the left of the current CTU.

[0312] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0313] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0314] The encoder or decoder may examine the merge candidate list before a base vector is added to the merge candidate list for block vector derivation, and remove motion vector candidates pointing outside a predetermined range or block vector candidates pointing outside a predetermined range from the merge candidate list.

[0315] The flowchart of FIG. 12 may be a flowchart in which the step of removing unavailable block vector candidates from the merge candidate list is included only before the addition of the base vector. The encoder or decoder may determine whether the current block is encoded in IBC mode before the base vector is included in the merge candidate list. If the encoder or decoder determines that the current block is encoded in IBC mode, it may remove unavailable block vector candidates from the merge candidate list.

[0316] According to another embodiment of the present invention, when generating a merge candidate list for deriving a block vector, blocks located outside a predetermined range may not be referenced.

[0317] For example, a predetermined range may be the current CTU including the current block.

[0318] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0319] As another example, the specified range may be the current CTU and the CTU to the left of the current CTU. As another example, the specified range may be the restored area of ​​the current CTU and a portion of the area of ​​the CTU to the left of the current CTU.

[0320] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0321] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0322] Additionally, for example, blocks outside the current CTU may not be used when generating a merge candidate list for deriving block vectors. That is, the encoder or decoder may determine that the motion vector of a block located outside the current CTU or the block vector of a block located outside the current CTU is unavailable and may not use it when deriving the merge candidate list.

[0323] As another example, blocks located outside the current CTU and its left CTU may not be used when generating the merge candidate list for block vectors. That is, the encoder or decoder may determine that the motion vectors of blocks located outside the current CTU and its left CTU, or the block vectors of blocks located outside the current CTU and its left CTU, are unavailable and may not use them when deriving the merge candidate list.

[0324] As another example, blocks located outside the current CTU and multiple CTUs to the left of the current CTU may not be used when generating the merge candidate list for block vectors. That is, the encoder or decoder may determine that the motion vector of a block located outside the current CTU and multiple CTUs to the left of the current CTU, or the block vector of a block located outside the current CTU and multiple CTUs to the left of the current CTU, is unavailable and may not use it when deriving the merge candidate list.

[0325] FIG. 13 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to another embodiment of the present invention.

[0326] According to another embodiment of the present invention, when generating a merge candidate list for deriving a block vector, spatially surrounding blocks located outside a predetermined range may not be referenced.

[0327] For example, a predetermined range may be the current CTU including the current block.

[0328] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0329] As another example, the specified range may be the current CTU and the CTU to the left of the current CTU. As another example, the specified range may be the restored area of ​​the current CTU and a portion of the area of ​​the CTU to the left of the current CTU.

[0330] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0331] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0332] The flowchart of FIG. 13 illustrates a method for adding spatial candidate units to a merge candidate list. In FIG. 13, S may represent a predetermined area as described above, and A1, B1, B0, A0, and B2 may represent surrounding blocks of the current block. An encoder or decoder may determine whether the spatial surrounding blocks are included in a predetermined range and add the block vector or motion vector of the corresponding spatial surrounding blocks to the merge candidate list.

[0333] According to another embodiment of the present invention, when generating a merge candidate list for block vector derivation, spatially surrounding blocks located outside a predetermined range may not be referenced.

[0334] For example, a predetermined range may be the current CTU including the current block.

[0335] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0336] As another example, the specified range may be the current CTU and the CTU to the left of the current CTU. As another example, the specified range may be the restored area of ​​the current CTU and a portion of the area of ​​the CTU to the left of the current CTU.

[0337] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0338] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0339] For example, if a spatial neighbor block A_k or B_k does not fall within a predetermined range, availableA_k or availableB_k of the corresponding block vector may be determined to be false. On the other hand, if a spatial neighbor block A_k or B_k falls within a predetermined range, availableA_k or availableB_k of the corresponding block vector may be determined to be true, where the spatially adjacent spatial neighbor blocks may be at least one of A1, B1, B0, A0, and B2.

[0340] That is, if a candidate A_k is located outside a predetermined range, availableA_k of the block vector can be determined to be false. Also, if a candidate B_k is located outside a predetermined range, availableB_k of the block vector can be determined to be false. Here, k can be one of 0, 1, or 2.

[0341] As another example, if the spatially neighboring blocks do not fall within a predetermined range, the availableN of the corresponding block vector may be determined to be false. Conversely, if the spatially neighboring blocks fall within a predetermined range, the availableN of the block vector may be determined to be true. Here, the spatially neighboring blocks may be at least one of A1, B1, B0, A0, and B2, and N may be A_k or B_k.

[0342] FIG. 14 is a drawing for explaining a predetermined range according to some embodiments of the present invention.

[0343] In the above-described embodiment, the predetermined range may be at least one of regions a, b, c, d, e, f, g, and h of FIG. 14.

[0344] For example, if the current CTU is quadtree partitioned, the predetermined range may be as follows depending on the location of the current block.

[0345] For example, if the current block location is e, the predetermined range may be at least one of b, c, d, and e. For example, if the current block location is f, the predetermined range may be at least one of c, d, e, and f. Also, for example, if the current block location is g, the predetermined range may be at least one of d, e, f, and g. Also, for example, if the current block location is h, the predetermined range may be at least one of e, f, g, and h.

[0346] As another example, if the current CTU is partitioned into a binary tree, the predetermined range may be as follows depending on the position of the current block.

[0347] For example, if the current block location is e, the predetermined range may be at least one of c, b, d, and e. For example, if the current block location is g, the predetermined range may be at least one of b, d, e, and g. For example, if the current block location is f, the predetermined range may be at least one of d, e, g, and f. For example, when the current block location is h, the predetermined range may be at least one of e, g, f, and h.

[0348] FIGS. 15 to 17 are drawings for illustrating a predetermined range according to some embodiments of the present invention.

[0349] In the above-described embodiment, the predetermined range may be at least one of regions a to n of FIGS. 15 to 17.

[0350] For example, depending on the current size of the CTU, the predetermined range may be as follows.

[0351] For example, in FIG. 15, if the current CTU position is d and the current CTU size is 64x64, the predetermined range may be at least one of a, b, and c. That is, the predetermined range may be at least one of the three CTU regions to the left of the current CTU.

[0352] As another example, in FIG. 16, if the current CTU position is p and the current CTU size is 32x32, the predetermined range may be at least one of a, b, c, d, e, f, g, h, i, j, k, l, m, n, o. That is, the predetermined range may be at least one of the 15 CTU regions to the left of the current CTU.

[0353] As another example, in FIG. 17, if the current CTU position is n and the current CTU size is 16x16, the predetermined range may be at least one of a, b, c, d, e, f, g, h, i, …, n-2, n-1. Here, there may be a total of 63 CTU regions in the regions from a to n-1. That is, the predetermined range may be at least one of the 63 CTU regions to the left of the current CTU.

[0354] According to another embodiment of the present invention, when generating a merge candidate list for deriving a block vector, at least one of the motion vector of a temporal neighbor block or the block vector of a temporal neighbor block may be excluded. That is, the encoder or decoder may not add at least one of the motion vector of a temporal neighbor block or the block vector of a temporal neighbor block to the merge candidate list. The encoder or decoder may generate a merge candidate list excluding the temporal neighbor block.

[0355] In this case, the motion vector may be a motion vector to which scaling has not been applied. That is, the motion vector may be a motion vector pointing within a predetermined range to which scaling has not been applied.

[0356] According to the present embodiment, an encoder or a decoder can generate a merge candidate list using at least one of the motion vector of a spatial neighbor block, an HMVP-based motion vector, a pairwise-average-based motion vector, a block vector of a spatial neighbor block, an HMVP-based block vector, and a pairwise-average-based block vector.

[0357] FIG. 18 is a diagram illustrating a method for deriving a merge candidate list for deriving a block vector according to another embodiment of the present invention.

[0358] According to FIG. 18, the encoder or decoder determines whether the current block is encoded in IBC mode and, depending on the determination result, can include the motion vector or block vector of the temporal neighboring block in the merge candidate list.

[0359] Next, the step (S920) of deriving the AMVP candidate list of block vectors is described.

[0360] The AMVP candidate list for deriving block vectors can be derived based on at least one of a referenceable motion vector, a referenceable block vector, or a default vector.

[0361] For example, a referenceable motion vector may include at least one of the motion vector of the spatial neighboring block of the current block, the motion vector of the temporal neighboring block, the motion vector based on HMVP (History based motion vector prediction), and the motion vector based on pairwise average.

[0362] Additionally, for example, a referenceable block vector may include at least one of a block vector of spatial neighbor blocks of the current block, a block vector of temporal neighbor blocks, an HMVP-based block vector, and a pairwise average-based block vector.

[0363] In addition, for example, a basic vector can be a zero vector with a value of (0,0).

[0364] FIG. 19 is a diagram illustrating a method for deriving an AMVP candidate list for deriving a block vector according to an embodiment of the present invention.

[0365] According to FIG. 19, the encoder or decoder may add spatial candidates to the AMVP candidate list. The maximum number of spatial candidates added to the AMVP candidate list may be pre-set. For example, the pre-set value may be a positive integer greater than or equal to 1. For instance, the maximum number of spatial candidates may be 2. If there are duplicate candidates in the AMVP candidate list, the encoder or decoder may delete the duplicate candidates.

[0366] An encoder or decoder may add temporal candidates to the AMVP candidate list. The maximum number of spatial candidates added to the AMVP candidate list may be pre-set. For example, the pre-set value may be a positive integer greater than or equal to 1. For instance, the maximum number of spatial candidates may be 1.

[0367] Next, the encoder or decoder can add HMVP candidates or base vectors to the AMVP candidate list.

[0368] An encoder or decoder may determine whether the number of candidates currently added to the AMVP candidate list is less than a preset value, and based on this determination, determine whether to derive additional candidates. If the AMVP candidate list already contains the preset number of candidates, the encoder or decoder may not derive additional candidates or add candidates. For example, the preset value may be a positive number greater than or equal to 1. For instance, the preset value may be 2.

[0369] For example, the process of determining whether the number of currently added candidates is less than a preset value can be performed after adding spatial candidates. Also, for example, the process of determining whether the number of currently added candidates is less than a preset value can be performed before temporal candidates, HMVP candidates, and primitive vectors are added to the AMVP candidate list, respectively.

[0370] The motion vector here may be a motion vector without scaling applied. That is, it may be a motion vector pointing within a predetermined range without scaling applied. Additionally, as another example, the motion vector here may be a motion vector after scaling has been applied. That is, it may be a motion vector pointing within a predetermined range with scaling applied.

[0371] Meanwhile, for example, when generating an AMVP candidate list for deriving a block vector, the referenceable motion vector may be at least one of a motion vector of a spatial neighbor block pointing within a predetermined range, a motion vector of a temporal neighbor block pointing within a predetermined range, and an HMVP-based motion vector pointing within a predetermined range.

[0372] As another example, when generating an AMVP candidate list for deriving a block vector, the referenceable block vector may be at least one of a block vector of a spatial neighbor block pointing within a predetermined range, a block vector of a temporal neighbor block pointing within a predetermined range, and an HMVP-based block vector pointing within a predetermined range.

[0373] As another example, a motion vector pointing within a predetermined range or a block vector pointing within a predetermined range may be included in the AMVP candidate list for deriving the block vector. On the other hand, a motion vector pointing outside a predetermined range or a block vector pointing outside a predetermined range may not be included in the AMVP candidate list.

[0374] For example, when deriving a candidate for the predicted motion vector (MVP) of the current block, if the motion vector (or block vector) of the temporal or spatial reference block indicates a range outside of a predetermined range, the encoder or decoder may not use the said motion vector (or block vector) as a candidate for the predicted motion vector of the current block.

[0375] In addition, for example, when deriving a candidate for a predicted motion vector of the current block, if the motion vector (or block vector) of a temporal or spatial reference block indicates a range outside of a predetermined range, the encoder or decoder may exclude the said motion vector (or block vector) from the candidate for a predicted motion vector of the current block.

[0376] In addition, for example, when deriving a candidate predicted motion vector for the current block, if the motion vector (or block vector) of the temporal or spatial reference block indicates a range outside of a predetermined range, the encoder or decoder may determine that the motion vector (or block vector) of the said temporal or spatial reference block is a motion vector (or block vector) that is not available for reference.

[0377] Meanwhile, when generating an AMVP candidate list for block vector derivation, spatially neighboring blocks located outside a predetermined range may not be referenced.

[0378] For example, a predetermined range may be the current CTU including the current block.

[0379] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0380] As another example, the specified range may be the current CTU and the CTU to the left of the current CTU. As another example, the specified range may be the restored area of ​​the current CTU and a portion of the area of ​​the CTU to the left of the current CTU.

[0381] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0382] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0383] The base vector can be at least one of a predefined vector or a zero vector (0,0). The predefined vector value can be signaled at at least one level of SPS, PPS, Slice, NAL, and Brick.

[0384] For example, a predefined vector value may be one of (-4*width, 0), (-2*width, 0), (-width, 0), (0,-4*height), (0,-2*height), (0,-height), (-2*width,-2*height), and (-width,-height). Here, width may be the width of a predetermined size or the current block, and height may be the height of a predetermined size block or the current block. Additionally, width may be a portion of the width of a predetermined size block or the current block, and height may be a portion of the height of a predetermined size block or the current block. For example, width may be half the width of the current CTU, and height may be half the height of the current CTU.

[0385] On the other hand, for example, if the current block is encoded in IBC mode, the AMVP candidate derivation process through scaling may not be performed. That is, if the current block is not encoded in IBC mode, the AMVP candidate derivation process through scaling may be performed.

[0386] For example, if DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, the AMVP candidate derivation process through scaling may not be performed. That is, if DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is not 0, the AMVP candidate derivation process through scaling may be performed. Scaling methods that can be used in AMVP mode will be described later.

[0387] As another example, if the current block is encoded in IBC mode, and the motion vector (or block vector) of a temporal or spatial reference block indicates an area outside a predetermined range, the encoder or decoder can change the motion vector (or block vector) of the said spatial or temporal reference block to within a predetermined range and derive the changed motion vector (or block vector) as an AMVP candidate.

[0388] Meanwhile, the following terms or definitions may be used in the specifications below.

[0389] Figure 20 is a drawing for explaining the surrounding blocks of the current block.

[0390] The surrounding blocks of the current block can be defined as shown in FIG. 20. For example, the left block may be at least one of blocks A0 and A1. Also, the top block may be at least one of blocks B0, B1, and B2.

[0391] In addition, the following syntax elements may be defined.

[0392] isScaledFlagLX can indicate that at least one of A0 and A1 is referenced.

[0393] availableA_k indicates whether block A_k is available for reference, where k can be 0 or 1. On the other hand, availableB_k indicates whether block B_k is available for reference, where k can be 0, 1, or 2. availableFlagLXA indicates that a motion vector can be derived from A0 or A1 of the LX reference list, where X can be 0 or 1. On the other hand, availableFlagLXB indicates that a motion vector can be derived from B0, B2, or B1 of the LX reference list, where X can be 0 or 1.

[0394] PredFlagLX[ xNbA_k ][ yNbA_k ] can indicate that the A_k position block used a motion vector from the LX reference list.

[0395] currPic may indicate the POC of the image containing the current block, and (xCtb, yCtb) may represent the top-left coordinates of the CTB to which the current block belongs. CtbSizeY may represent the size of the CTB, and (xCb, yCb) may represent the top-left coordinates of the current block.

[0396] mvLXA represents an AMVP candidate motion vector obtained from block A_k, and mvLXB represents an AMVP candidate motion vector obtained from block B_k.

[0397] Additionally, xMvLXA represents the x-coordinate component of the motion vector mvLXA, and yMvLXA may represent the y-coordinate component of the motion vector mvLXA. xMvLXB represents the x-coordinate component of the motion vector mvLXB, and yMvLXB may represent the y-coordinate component of the motion vector mvLXB.

[0398] log2_ctu_size_minus2 may indicate the value obtained by taking the logarithm of the CTU's luma CTB size and subtracting 2. CtbLog2SizeY may indicate the value obtained by adding 2 to the above log2_ctu_size_minus2 value. numLeftCTUs may indicate the number of left CTUs that the current block can reference. nCbS may represent the size of the current luma block.

[0399] Below, a vector scaling method that can be utilized to derive the AMVP candidate list for block vector derivation is explained in detail.

[0400] According to one embodiment of the present invention, a scaling method for the motion vector or block vector of the left reference block of the current block can be performed as follows.

[0401] If availableA_k is true and availableFlagLXA is 0, the following operation may be performed. That is, if the motion vector of the left block (A_k) is available but not included in the AMVP candidate list, the AMVP candidate may be added to the AMVP candidate list through the following operation.

[0402] If PredFlagLX[ xNbA_k ][ yNbA_k ] is 1, availableFlagLXA is set to 1 and an operation according to the following Equation 1 can be performed. That is, if the reference image list (List X) of the left block is the same as the reference image list (List X) of the current block, an operation according to the following Equation 1 can be performed.

[0403] [Mathematical Formula 1]

[0404] mvLXA = MvLX[xNbA_k][yNbA_k]

[0405] refIdxA = RefIdxLX[xNbA_k][yNbA_k]

[0406] refPicListA = RefPicListX

[0407] On the other hand, if PredFlagLY[ xNbA_k ][ yNbA_k ] is 1 (X != Y), availableFlagLXA is set to 1, and an operation according to Equation 2 below can be performed. That is, if the reference image list of the left block (List Y) is different from the reference image list of the current block (List X), an operation according to Equation 2 below can be performed.

[0408] [Mathematical Formula 2]

[0409] mvLXA = MvLY[xNbA_k][yNbA_k]

[0410] refIdxA = RefIdxLY[xNbA_k][yNbA_k]

[0411] refPicListA = RefPicListY

[0412] Meanwhile, if availableFlagLXA is 1 and DiffPicOrderCnt( refPicListA[ refIdxA ], RefPicListX[ refIdxLX ] ) is not 0, mvLXA can be derived according to Equation 3 below. That is, if a referenceable motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are not the same, mvLXA can be derived according to Equation 3 below.

[0413] [Mathematical Formula 3]

[0414] tx = ( 16384 + ( Abs( td ) >> 1 ) ) / td

[0415] distScaleFactor = Clip3( -4096, 4095, ( tb * tx + 32 ) >> 6 )

[0416] mvLXA = Clip3(-32768, 32767, Sign( distScaleFactor * mvLXA ) * ((Abs( distScaleFactor * mvLXA ) + 127 ) >> 8 ))

[0417] td = Clip3( -128, 127, DiffPicOrderCnt(currPic, refPicListA[ refIdxA ]))

[0418] tb = Clip3( -128, 127, DiffPicOrderCnt(currPic, RefPicListX[ refIdxLX ]))

[0419] According to another embodiment of the present invention, a scaling method for the motion vector or block vector of the left reference block of the current block can be performed as follows.

[0420] If availableA_k is true and availableFlagLXA is 0, and the current block is not in IBC mode, the following operation may be performed. That is, if the motion vector of the left block (A_k) is available but is not included in the AMVP candidate list, and the reference image of the current block is not the current image (e.g., if DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ]) is not 0), the AMVP candidate may be added to the AMVP candidate list through the following operation.

[0421] If PredFlagLX[ xNbA_k ][ yNbA_k ] is 1, availableFlagLXA is set to 1 and an operation according to Equation 4 below can be performed. That is, if the reference image list (List X) of the left block is the same as the reference image list (List X) of the current block, an operation according to Equation 4 below can be performed.

[0422] [Mathematical Formula 4]

[0423] mvLXA = MvLX[xNbA_k][yNbA_k]

[0424] refIdxA = RefIdxLX[xNbA_k][yNbA_k]

[0425] refPicListA = RefPicListX

[0426] On the other hand, if PredFlagLY[ xNbA_k ][ yNbA_k ] is 1 (X != Y), availableFlagLXA is set to 1, and an operation according to Equation 5 below can be performed. That is, if the reference image list of the left block (List Y) is different from the reference image list of the current block (List X), an operation according to Equation 5 below can be performed.

[0427] [Mathematical Formula 5]

[0428] mvLXA = MvLY[xNbA_k][yNbA_k]

[0429] refIdxA = RefIdxLY[xNbA_k][yNbA_k]

[0430] refPicListA = RefPicListY

[0431] Meanwhile, if availableFlagLXA is 1 and DiffPicOrderCnt( refPicListA[ refIdxA ], RefPicListX[ refIdxLX ] ) is not 0, mvLXA can be derived according to Equation 6 below. That is, if a referenceable motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are not the same, mvLXA can be derived according to Equation 6 below.

[0432] [Mathematical Formula 6]

[0433] tx = ( 16384 + ( Abs( td ) >> 1 ) ) / td

[0434] distScaleFactor = Clip3( -4096, 4095, ( tb * tx + 32 ) >> 6 )

[0435] mvLXA = Clip3(-32768, 32767, Sign( distScaleFactor * mvLXA ) * ((Abs( distScaleFactor * mvLXA ) + 127 ) >> 8 ))

[0436] td = Clip3( -128, 127, DiffPicOrderCnt(currPic, refPicListA[ refIdxA ]))

[0437] tb = Clip3( -128, 127, DiffPicOrderCnt(currPic, RefPicListX[ refIdxLX ]))

[0438] Meanwhile, according to another embodiment of the present invention, a scaling method for the motion vector or block vector of the left reference block of the current block can be performed as follows.

[0439] If availableA_k is true and availableFlagLXA is 0, the following operation may be performed. That is, if the motion vector of the left block (A_k) is available but not included in the AMVP candidate list, the AMVP candidate may be added to the AMVP candidate list through the following operation.

[0440] If PredFlagLX[ xNbA_k ][ yNbA_k ] is 1, availableFlagLXA is set to 1 and the operation according to Equation 7 below can be performed. That is, if the reference image list (List X) of the left block is the same as the reference image list (List X) of the current block, the operation according to Equation 7 below can be performed.

[0441] [Mathematical Formula 7]

[0442] mvLXA = MvLX[xNbA_k][yNbA_k]

[0443] refIdxA = RefIdxLX[xNbA_k][yNbA_k]

[0444] refPicListA = RefPicListX

[0445] On the other hand, if PredFlagLY[ xNbA_k ][ yNbA_k ] is 1 (X != Y), availableFlagLXA is set to 1, and an operation according to Equation 8 below can be performed. That is, if the reference image list of the left block (List Y) is different from the reference image list of the current block (List X), an operation according to Equation 8 below can be performed.

[0446] [Mathematical Formula 8]

[0447] mvLXA = MvLY[xNbA_k][yNbA_k]

[0448] refIdxA = RefIdxLY[xNbA_k][yNbA_k]

[0449] refPicListA = RefPicListY

[0450] Meanwhile, if availableFlagLXA is 1, DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is not 0, and DiffPicOrderCnt( refPicListA[ refIdxA ], RefPicListX[ refIdxLX ] ) is not 0, or if availableFlagLXA is 1, the current block is not encoded in IBC mode, and DiffPicOrderCnt( refPicListA[ refIdxA ], RefPicListX[ refIdxLX ] ) is not 0, mvLXA can be derived according to Equation 9 below. That is, if a referenceable motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are not the same, mvLXA can be derived according to Equation 9 below.

[0451] [Mathematical Formula 9]

[0452] tx = ( 16384 + ( Abs( td ) >> 1 ) ) / td

[0453] distScaleFactor = Clip3( -4096, 4095, ( tb * tx + 32 ) >> 6 )

[0454] mvLXA = Clip3(-32768, 32767, Sign( distScaleFactor * mvLXA ) * ((Abs( distScaleFactor * mvLXA ) + 127 ) >> 8 ))

[0455] td = Clip3( -128, 127, DiffPicOrderCnt(currPic, refPicListA[ refIdxA ]))

[0456] tb = Clip3( -128, 127, DiffPicOrderCnt(currPic, RefPicListX[ refIdxLX ]))

[0457] Meanwhile, if CtuLog2SizeY < 8 and availableFlagLXA is 1 and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if CtuLog2SizeY < 8 and availableFlagLXA is 1 and the current block is encoded in IBC mode, mvLXA can be derived according to Equation 10 below. That is, if a referenceable motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are the same, mvLXA can be derived according to Equation 10 below.

[0458] [Mathematical Formula 10]

[0459] numLeftCTUs = (1 << (( 7-CtuSizeLog2) << 1 )) - (( CtuSizeLog2 < 7 ) ? 1 : 0 )

[0460] xMVLXA = Clip3(-( xCb - xCtb ) - CtbSizeY *numLeftCTUs, CubSizeY - ((xCb - xCtb) + nCbS ), xMVLXA)

[0461] yMvLXA = Clip3( yCtb - yCb, yCtb + CtbSizeY - yCb-1, yMvLXA )

[0462] According to one embodiment of the present invention, a scaling method for the motion vector or block vector of the upper reference block of the current block can be performed as follows.

[0463] If isScaledFlagLX is 0, availableFlagLXB is set to 0, and the following operation can be performed. That is, if the motion vector of the left block (A_k) is unavailable, availableFlagLXB is set to 0, and the predicted motion vector can be added to the AMVP candidate list through the following process.

[0464] If availableB_k is true and availableFlagLXB is 0, the following operations can be performed. That is, if the motion vector of the top block is available for reference, a scaling process can be performed.

[0465] If PredFlagLX[ xNbB_k ][ yNbB_k ] is 1, availableFlagLXB is set to 1, and an operation according to Equation 11 below can be performed. That is, if the reference image list (List X) of the upper block is the same as the reference image list (List X) of the current block, an operation according to Equation 11 below can be performed.

[0466] [Mathematical Formula 11]

[0467] mvLXB = MvLX[xNbB_k][yNbB_k]

[0468] refIdxB = RefIdxLX[xNbB_k][yNbB_k]

[0469] refPicListB = RefPicListX

[0470] On the other hand, if PredFlagLY[ xNbB_k ][ yNbB_k ] is 1 (X != Y), availableFlagLXB is set to 1, and an operation according to Equation 12 below can be performed. That is, if the reference image list (List Y) of the upper block is different from the reference image list (List X) of the current block, an operation according to Equation 12 below can be performed.

[0471] [Mathematical Formula 12]

[0472] mvLXB = MvLY[xNbBk][yNbBk]

[0473] refIdxB = RefIdxLY[xNbBk][yNbBk]

[0474] refPicListB = RefPicListY

[0475] Meanwhile, if availableFlagLXB is 1 and DiffPicOrderCnt( refPicListB[ refIdxB ], RefPicListX[ refIdxLX ] ) is not 0, mvLXB can be derived according to Equation 13 below. That is, if a referenceable motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are not the same, mvLXB can be derived according to Equation 13 below.

[0476] [Mathematical Formula 13]

[0477] tx = ( 16384 + ( Abs( td ) >> 1 ) ) / td

[0478] distScaleFactor = Clip3( -4096, 4095, ( tb * tx + 32 ) >> 6 )

[0479] mvLXB = Clip3( -32768, 32767, Sign( distScaleFactor * mvLXB ) * ( ( Abs( distScaleFactor * mvLXB ) + 127 ) >> 8 ) )

[0480] td = Clip3( -128, 127, DiffPicOrderCnt(currPic, refPicListB[ refIdxB ]))

[0481] tb = Clip3( -128, 127, DiffPicOrderCnt(currPic, RefPicListX[ refIdxLX ]))

[0482] According to another embodiment of the present invention, a scaling method for the motion vector or block vector of the upper reference block of the current block can be performed as follows.

[0483] If isScaledFlagLX is 0, availableFlagLXB is set to 0, and the following operation can be performed. That is, if the motion vector of the left block (A_k) is unavailable, availableFlagLXB is set to 0, and the predicted motion vector can be added to the AMVP candidate list through the following process.

[0484] If availableB_k is true and availableFlagLXB is 0, and the current block is not encoded in IBC mode, the following operation may be performed. That is, if the motion vector of the upper block is available for reference and the reference image of the current block and the reference image of the predicted motion vector are not the same, the following operation may be performed.

[0485] For example, if availableB_k is true and availableFlagLXB is 0 and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ]) is not 0, the following process can be performed. That is, if the motion vector of the top block is available for reference and the reference image of the current block is not the current image, the following process can be performed.

[0486] If PredFlagLX[ xNbB_k ][ yNbB_k ] is 1, availableFlagLXB is set to 1, and an operation according to Equation 14 below can be performed. That is, if the reference image list (List X) of the upper block is the same as the reference image list (List X) of the current block, an operation according to Equation 14 below can be performed.

[0487] [Mathematical Formula 14]

[0488] mvLXB = MvLX[xNbB_k][yNbB_k]

[0489] refIdxB = RefIdxLX[xNbB_k][yNbB_k]

[0490] refPicListB = RefPicListX

[0491] On the other hand, if PredFlagLY[ xNbB_k ][ yNbB_k ] is 1 (X != Y), availableFlagLXB is set to 1, and an operation according to Equation 15 below can be performed. That is, if the reference image list (List Y) of the upper block is different from the reference image list (List X) of the current block, an operation according to Equation 15 below can be performed.

[0492] [Mathematical Formula 15]

[0493] mvLXB = MvLY[xNbBk][yNbBk]

[0494] refIdxB = RefIdxLY[xNbBk][yNbBk]

[0495] refPicListB = RefPicListY

[0496] Meanwhile, if availableFlagLXB is 1 and DiffPicOrderCnt( refPicListB[ refIdxB ], RefPicListX[ refIdxLX ] ) is not 0, or if availableFlagLXB is 1 and the current block is not encoded in IBC mode, mvLXB can be derived according to Equation 16 below. That is, if a referenced motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are not the same, mvLXB can be derived according to Equation 16 below.

[0497] [Mathematical Formula 16]

[0498] tx = ( 16384 + ( Abs( td ) >> 1 ) ) / td

[0499] distScaleFactor = Clip3( -4096, 4095, ( tb * tx + 32 ) >> 6 )

[0500] mvLXB = Clip3( -32768, 32767, Sign( distScaleFactor * mvLXB ) * ( ( Abs( distScaleFactor * mvLXB ) + 127 ) >> 8 ) )

[0501] td = Clip3( -128, 127, DiffPicOrderCnt(currPic, refPicListB[ refIdxB ]))

[0502] tb = Clip3( -128, 127, DiffPicOrderCnt(currPic, RefPicListX[ refIdxLX ]))

[0503] According to another embodiment of the present invention, a scaling method for the motion vector or block vector of the upper reference block of the current block can be performed as follows.

[0504] If isScaledFlagLX is 0, availableFlagLXB is set to 0, and the following operation can be performed. That is, if the motion vector of the left block (A_k) is unavailable, availableFlagLXB is set to 0, and the predicted motion vector can be added to the AMVP candidate list through the following operation.

[0505] If availableB_k is true and availableFlagLXB is 0, the following process can be performed. That is, if the motion vector of the top block is available for reference and the reference image of the current block is not the current image, the following scaling process can be performed.

[0506] If PredFlagLX[ xNbB_k ][ yNbB_k ] is 1, availableFlagLXB is set to 1, and an operation according to Equation 17 below can be performed. That is, if the reference image list (List X) of the upper block is the same as the reference image list (List X) of the current block, an operation according to Equation 17 below can be performed.

[0507] [Mathematical Formula 17]

[0508] mvLXB = MvLX[xNbB_k][yNbB_k]

[0509] refIdxB = RefIdxLX[xNbB_k][yNbB_k]

[0510] refPicListB = RefPicListX

[0511] On the other hand, if PredFlagLY[ xNbB_k ][ yNbB_k ] is 1 (X != Y), availableFlagLXB is set to 1, and an operation according to Equation 18 below can be performed. That is, if the reference image list (List Y) of the upper block is different from the reference image list (List X) of the current block, an operation according to Equation 18 below can be performed.

[0512] [Mathematical Formula 18]

[0513] mvLXB = MvLY[xNbBk][yNbBk]

[0514] refIdxB = RefIdxLY[xNbBk][yNbBk]

[0515] refPicListB = RefPicListY

[0516] Meanwhile, if availableFlagLXB is 1, DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is not 0, and DiffPicOrderCnt( refPicListB[ refIdxB ], RefPicListX[ refIdxLX ] ) is not 0, or if availableFlagLXB is 1, the current block is not encoded in IBC mode, and DiffPicOrderCnt( refPicListB[ refIdxB ], RefPicListX[ refIdxLX ] ) is not 0, mvLXB can be derived according to Equation 19 below. That is, if a referenceable motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are not the same, mvLXB can be derived according to Equation 19 below.

[0517] [Mathematical Formula 19]

[0518] tx = ( 16384 + ( Abs( td ) >> 1 ) ) / td

[0519] distScaleFactor = Clip3( -4096, 4095, ( tb * tx + 32 ) >> 6 )

[0520] mvLXB = Clip3( -32768, 32767, Sign( distScaleFactor * mvLXB ) * ( ( Abs( distScaleFactor * mvLXB ) + 127 ) >> 8 ) )

[0521] td = Clip3( -128, 127, DiffPicOrderCnt(currPic, refPicListB[ refIdxB ]))

[0522] tb = Clip3( -128, 127, DiffPicOrderCnt(currPic, RefPicListX[ refIdxLX ])) Meanwhile,

[0523] Meanwhile, if CtuLog2SizeY < 8 and availableFlagLXB is 1 and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if CtuLog2SizeY < 8 and availableFlagLXB is 1 and the current block is encoded in IBC mode, mvLXB can be derived according to Equation 20 below. That is, if a referenceable motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are the same, mvLXB can be derived according to Equation 20 below.

[0524] [Mathematical Formula 20]

[0525] numLeftCTUs = (1 << (( 7-CtuSizeLog2) << 1 )) - (( CtuSizeLog2 < 7 ) ? 1 : 0 )

[0526] xMVLXB = Clip3(-( xCb - xCtb ) - CtbSizeY *numLeftCTUs, CubSizeY - ((xCb - xCtb) + nCbS ), xMVLXB)

[0527] yMvLXB = Clip3( yCtb - yCb, yCtb + CtbSizeY - yCb-1, yMvLXB )

[0528] FIGS. 21 to 26 are drawings for explaining a scaling method according to some embodiments of the present invention.

[0529] Referring to FIGS. 21 to 26, a method for performing scaling when the current block is encoded in IBC mode will be explained in detail.

[0530] If the current block is encoded in IBC mode, the encoder or decoder may perform scaling on the block vector or the predicted motion vector according to the above-described Equation 10 or Equation 20. For convenience, Equation 10 is explained below as an example. The following explanation can be applied equally to Equation 20.

[0531] According to mathematical formula 10, the x-component xMvLXA' of the scaled block vector or predicted motion vector can be expressed as Clip3(-A, B, xMvLXA). That is, if xMvLXA is less than -A, xMvLXA' is set to -A(=-( xCb - xCtb ) - CtbSizeY * numLeftCTUs), and if xMvLXA is greater than B, xMvLXA' is set to B(=CubSizeY - ((xCb - xCtb) + nCbS).

[0532] Additionally, the scaled block vector or predicted motion vector yMvLXA' can be expressed as Clip3(-C, D, yMvLXA). That is, if yMvLXA is less than -C, yMvLXA' is set to -C(=-(yCtb - yCb), and if yMvLXA is greater than D, yMvLXA' is set to D(=yCtb+CtbSizeY - yCb-1).

[0533] Below, we will explain in detail the availability check method that can be used to derive a merge candidate list or an AMVP candidate list for deriving block vectors.

[0534] According to one embodiment of the present invention, a method for determining availability of a left reference block or an upper reference block of a current block can be performed as follows.

[0535] The availability determination for the left reference block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) at the location (xNbA_k, yNbA_k), and the partition index partIdx. Accordingly, the encoder or decoder can derive the availability indicator availableA_k for the left reference block.

[0536] For example, the availability determination for a left reference block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of a neighboring Luma prediction block (xNbY, yNbY) having the location (xNbA_0, yNbA_0), and the partition index partIdx. Accordingly, the encoder or decoder can derive the availability indicator availableA_0.

[0537] As another example, the availability determination for a left reference block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of a neighboring Luma prediction block (xNbY, yNbY) having the location (xNbA_1, yNbA_1), and the partition index partIdx. Accordingly, the encoder or decoder can derive an availability indicator availableA_1 for the left reference block.

[0538] Meanwhile, if at least one of availableA0 or availableA1 is true, isScaledFlagLX can be set to 1, where X can be either 0 or 1.

[0539] The availability determination for the top reference block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbB_k, yNbB_k), and the partition index partIdx. Accordingly, the encoder or decoder can derive availableB_k for the availability indicator top reference block.

[0540] For example, the availability determination for the top reference block can be determined based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbB_0, yNbB_0), and the partition index partIdx. Accordingly, the encoder or decoder can derive availableB_0 for the availability indicator top reference block.

[0541] As another example, the availability determination for the top reference block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbB_1, yNbB_1), and the partition index partIdx. Accordingly, the encoder or decoder can derive availableB_1 for the availability indicator top reference block.

[0542] As another example, the availability determination for the top reference block can be determined based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbB_2, yNbB_2), and the partition index partIdx. Accordingly, the encoder or decoder can derive availableB_2 for the availability indicator top reference block.

[0543] Availability determination can be performed according to the following operation. In the following, the variable sameCb may indicate whether the current luma prediction block is the same luma encoding block as the neighboring luma prediction block. In this case, sameCb may be determined to be true if all conditions of the following Equation 21 are satisfied, and sameCb may be determined to be false if at least one of the conditions of Equation 21 is not satisfied.

[0544] [Mathematical Formula 21]

[0545] xCb ≤ xNbY,

[0546] yCb ≤ yNbY,

[0547] ( xCb + nCbS ) ≤ xNbY,

[0548] ( yCb + nCbS ) ≤ yNbY,

[0549] In this case, the availability indicator availableN of the neighboring reference block can be derived according to the following operation.

[0550] For example, if sameCb is false, the availability indicator can be determined by the z-scan sequence block availability determination process.

[0551] Meanwhile, if samcCb is true and all conditions of Equation 22 below are satisfied, availableN can be determined to be false. On the other hand, if sameCb is false or at least one of the conditions of Equation 22 is not satisfied, availableN can be determined to be true.

[0552] [Mathematical Formula 22]

[0553] ( nPbW << 1 ) == nCbS,

[0554] ( nPbH << 1 ) == nCbS,

[0555] partIdx == 1

[0556] ( yCb + nPbH) ≤ yNbY

[0557] ( xCb + nPbW) ≤ xNbY

[0558] Meanwhile, if availableN is true and CuPredMode[ xNbY ][ yNbY ] is MODE_INTRA, availableN can be determined to be false.

[0559] Meanwhile, if the neighbor reference block is available (availableN is true) but the prediction mode of the neighbor reference block and the prediction mode of the current block are not the same (CuPredMode[xNbY][yNbY] != CuPredMode[xCb][yCb]), the availability (availableN) of the neighbor reference block may be determined to be false.

[0560] According to another embodiment of the present invention, a method for determining availability for a left reference block or an upper reference block of a current block may be performed as follows.

[0561] The availability determination for the left reference block is determined based on at least one of the following: the current Luma block position (xCb, yCb), the current Luma block size (nCbS), the current Luma prediction block position (xPb, yPb), the current Luma prediction block width (nPbW), the current Luma prediction block height (nPbH), the position of the neighbor Luma prediction block (xNbY, yNbY) having the position (xNbA_k, yNbA_k), the partition index partIdx, the top-left coordinates (xCtb, yCtb) of the CTB to which the current luma block belongs, the size of the CTB (CtbSizeY), the difference in POC (Picture Order Count) between the image to which the current block belongs and the reference image of the current block (DiffPicOrderCnt), and the motion vector MvN (xMvN, yMvN) of the neighbor luma block (N) if the neighbor luma block (N) is MODE_INTER. It is possible. Accordingly, the encoder or decoder can derive the availability indicator availableA_k for the left reference block.

[0562] For example, the availability determination for the left reference block is at least one of the following: the current Luma block position (xCb, yCb), the current Luma block size (nCbS), the current Luma prediction block position (xPb, yPb), the current Luma prediction block width (nPbW), the current Luma prediction block height (nPbH), the position of the neighbor Luma prediction block at (xNbY, yNbY) (xNbA_0, yNbA_0), the partition index partIdx, the top-left coordinates of the CTB to which the current luma block belongs (xCtb, yCtb), the size of the CTB (CtbSizeY), the difference in POC (Picture Order Count) between the image to which the current block belongs and the reference image of the current block (DiffPicOrderCnt), and the motion vector MvN(xMvN, yMvN) of the neighbor luma block (N) if the neighbor luma block (N) is MODE_INTER. It can be determined based on. Accordingly, the encoder or decoder can derive the availability indicator availableA_0 for the left reference block.

[0563] As another example, the availability determination for the left reference block is based on at least one of the following: the current Luma block position (xCb, yCb), the current Luma block size (nCbS), the current Luma prediction block position (xPb, yPb), the current Luma prediction block width (nPbW), the current Luma prediction block height (nPbH), the position of the neighbor Luma prediction block at (xNbY, yNbY) (xNbA_1, yNbA_1), the partition index partIdx, the top-left coordinates of the CTB to which the current luma block belongs (xCtb, yCtb), the size of the CTB (CtbSizeY), the difference in POC (Picture Order Count) between the image to which the current block belongs and the reference image of the current block (DiffPicOrderCnt), and the motion vector MvN (xMvN, yMvN) of the neighbor luma block (N) if the neighbor luma block (N) is MODE_INTER. It can be determined. Accordingly, the encoder or decoder can derive the availability indicator availableA_1 for the left reference block.

[0564] Meanwhile, if at least one of availableA0 or availableA1 is true, isScaledFlagLX can be set to 1, where X can be either 0 or 1.

[0565] The availability determination for the top reference block can be based on at least one of the following: the current Luma block position (xCb, yCb), the current Luma block size (nCbS), the current Luma prediction block position (xPb, yPb), the current Luma prediction block width (nPbW), the current Luma prediction block height (nPbH), the position of the neighbor Luma prediction block (xNbY, yNbY) having the position (xNbB_k, yNbB_k), the partition index partIdx, the top-left coordinates of the CTB to which the current luma block belongs (xCtb, yCtb), the size of the CTB (CtbSizeY), the difference in POC (Picture Order Count) between the image to which the current block belongs and the reference image of the current block (DiffPicOrderCnt), and the motion vector MvN (xMvN, yMvN) of the neighbor luma block (N) if the neighbor luma block (N) is MODE_INTER. There is. Accordingly, the encoder or decoder can derive the availability indicator availableB_k for the left reference block.

[0566] For example, the availability determination for the top reference block is at least one of the following: the current Luma block position (xCb, yCb), the current Luma block size (nCbS), the current Luma prediction block position (xPb, yPb), the current Luma prediction block width (nPbW), the current Luma prediction block height (nPbH), the position of the neighbor Luma prediction block at (xNbY, yNbY) (xNbB_0, yNbB_0), the partition index partIdx, the top-left coordinates of the CTB to which the current luma block belongs (xCtb, yCtb), the size of the CTB (CtbSizeY), the difference in POC (Picture Order Count) between the image to which the current block belongs and the reference image of the current block (DiffPicOrderCnt), and the motion vector MvN(xMvN, yMvN) of the neighbor luma block (N) if the neighbor luma block (N) is MODE_INTER. It can be determined based on. Accordingly, the encoder or decoder can derive the availability indicator availableB_0 for the left reference block.

[0567] As another example, the availability determination for the top reference block is based on at least one of the following: the current Luma block position (xCb, yCb), the current Luma block size (nCbS), the current Luma prediction block position (xPb, yPb), the current Luma prediction block width (nPbW), the current Luma prediction block height (nPbH), the position of the neighbor Luma prediction block at (xNbY, yNbY) (xNbB_1, yNbB_1), the partition index partIdx, the top-left coordinates of the CTB to which the current luma block belongs (xCtb, yCtb), the size of the CTB (CtbSizeY), the difference in POC (Picture Order Count) between the image to which the current block belongs and the reference image of the current block (DiffPicOrderCnt), and the motion vector MvN (xMvN, yMvN) of the neighbor luma block (N) if the neighbor luma block (N) is MODE_INTER. It can be determined. Accordingly, the encoder or decoder can derive the availability indicator availableB_1 for the left reference block.

[0568] As another example, the availability determination for the top reference block is at least one of the following: the current Luma block position (xCb, yCb), the current Luma block size (nCbS), the current Luma prediction block position (xPb, yPb), the current Luma prediction block width (nPbW), the current Luma prediction block height (nPbH), the position of the neighbor Luma prediction block at (xNbY, yNbY) having the position (xNbB_2, yNbB_2), the partition index partIdx, the top-left coordinates of the CTB to which the current luma block belongs (xCtb, yCtb), the size of the CTB (CtbSizeY), the difference in POC (Picture Order Count) between the image to which the current block belongs and the reference image of the current block (DiffPicOrderCnt), and the motion vector MvN(xMvN, yMvN) of the neighbor luma block (N) if the neighbor luma block (N) is MODE_INTER. It can be determined based on. Accordingly, the encoder or decoder can derive the availability indicator availableB_2 for the left reference block.

[0569] For example, availability determination can be performed according to the following operation. In the following, the variable sameCb may indicate whether the current luma prediction block is the same luma encoding block as the neighboring luma prediction block. Additionally, the variable numLeftCTUs may indicate the number of available CTUs among the CTUs to the left of the current CTU. In this case, sameCb may be determined to be true if all conditions of the following Equation 23 are satisfied, and sameCb may be determined to be false if at least one of the conditions of Equation 23 is not satisfied.

[0570] [Mathematical Formula 23]

[0571] xCb ≤ xNbY,

[0572] yCb ≤ yNbY,

[0573] ( xCb + nCbS ) ≤ xNbY,

[0574] ( yCb + nCbS ) ≤ yNbY,

[0575] In this case, the availability indicator availableN of the neighboring reference block can be derived according to the following operation.

[0576] For example, if sameCb is false, the availability indicator can be determined by the z-scan sequence block availability determination process.

[0577] Meanwhile, if samcCb is true and all conditions of Equation 24 below are satisfied, availableN can be determined to be false. On the other hand, if sameCb is false or at least one of the conditions of Equation 24 is not satisfied, availableN can be determined to be true.

[0578] [Mathematical Formula 24]

[0579] ( nPbW << 1 ) == nCbS,

[0580] ( nPbH << 1 ) == nCbS,

[0581] partIdx == 1

[0582] ( yCb + nPbH) ≤ yNbY

[0583] ( xCb + nPbW) ≤ xNbY

[0584] Meanwhile, if availableN is true and CuPredMode[ xNbY ][ yNbY ] is MODE_INTRA, availableN can be determined to be false.

[0585] Meanwhile, if the neighbor reference block is available (availableN is true) but the prediction mode of the neighbor reference block and the prediction mode of the current block are not the same (CuPredMode[xNbY][yNbY] != CuPredMode[xCb][yCb]), the availability (availableN) of the neighbor reference block may be determined to be false.

[0586] At this time, numLeftCTUs can be determined according to the following mathematical formula 25.

[0587] [Mathematical Formula 25]

[0588] numLeftCTUs = (1 << (( 7-CtuSizeLog2) << 1 )) - (( CtuSizeLog2 < 7 ) ? 1 : 0 )

[0589] Meanwhile, if availableN is true, DiffPicOrderCnt is 0, and CuPredMode[ xNbY ][ yNbY ] is MODE_INTER, availableN may be determined to be false if at least one of the conditions in [Equation 26] below is satisfied.

[0590] [Mathematical Formula 26]

[0591] (xPb + xMvN) < -(xCtb*numLeftCTUs)

[0592] (xPb + xMvN) ≥ xCtb + CtbSizeY

[0593] ( yPb + yMvN ) < yCtb

[0594] (yPb + yMvN) ≥ yCtb + CtbSizeY

[0595] In addition, if availableN is true, DiffPicOrderCnt is 0, and CuPredMode[ xNbY ][ yNbY ] is MODE_INTER, availableN can be determined to be true if all conditions of the following Equation 27 are satisfied.

[0596] [Mathematical Formula 27]

[0597] (xPb + xMvN) < -(xCtb*numLeftCTUs)

[0598] (xPb + xMvN) < xCtb + CtbSizeY

[0599] ( yPb + yMvN ) ≥ yCtb

[0600] (yPb + yMvN) < yCtb + CtbSizeY

[0601] As another example, availability determination can be performed according to the following operations.

[0602] In the following, availableIBCA_k may indicate whether the motion vector or block vector of A_k block is available in IBC mode. That is, availableIBCA_k may indicate whether the motion vector or block vector of A_k block indicates within a specified range.

[0603] The availability determination for the left block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbA_k, yNbA_k), and the partition index partIdx. Accordingly, the encoder or decoder can derive the availability indicator availableA_k for the left reference block.

[0604] For example, the availability determination for the left block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbA_0, yNbA_0), and the partition index partIdx. Accordingly, the encoder or decoder can derive the availability indicator availableA_0 for the left reference block.

[0605] As another example, the availability determination for the left block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbA_1, yNbA_1), and the partition index partIdx. Accordingly, the encoder or decoder can derive the availability indicator availableA_1 for the left reference block.

[0606] Meanwhile, for example, if availableA_0 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableA_0 is true and the current block is encoded in IBC mode, availableIBCA_0 may be determined to be false if at least one of the conditions of Equation 28 below is satisfied. On the other hand, if the above conditions are not satisfied, availableIBCA_0 may be determined to be true.

[0607] [Mathematical Formula 28]

[0608] MvA0 (xMvA0, yMvA0) represents the motion vector of the neighbor block (A0).

[0609] (xPb + xMvA0) < - (xCtb * numLeftCTUs)

[0610] (xPb + xMvA0) ≥ xCtb + CtbSizeY

[0611] ( yPb + yMvA0 ) < yCtb

[0612] (yPb + yMvA0) ≥ yCtb + CtbSizeY

[0613] As another example, availableIBCA_0 may be determined to be true if availableA_0 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableA_0 is true and the current block is encoded in IBC mode, and all conditions of the following Equation 29 are satisfied. On the other hand, if the above conditions are not satisfied, availableIBCA_0 may be determined to be false.

[0614] [Mathematical Formula 29]

[0615] (xPb + xMvA0) ≥ (xCtb * numLeftCTUs)

[0616] (xPb + xMvA0) < xCtb + CtbSizeY

[0617] ( yPb + yMvA0 ) ≥ yCtb

[0618] (yPb + yMvA0) < yCtb + CtbSizeY

[0619] As another example, if availableA_1 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableA_0 is true and the current block is encoded in IBC mode, availableIBCA_1 may be determined to be false if at least one of the conditions in Equation 30 below is satisfied. On the other hand, if the above conditions are not satisfied, availableIBCA_1 may be determined to be true.

[0620] [Mathematical Formula 30]

[0621] (xPb + xMvA1) < - (xCtb * numLeftCTUs)

[0622] (xPb + xMvA1) ≥ xCtb + CtbSizeY

[0623] ( yPb + yMvA1 ) < yCtb

[0624] (yPb + yMvA1) ≥ yCtb + CtbSizeY

[0625] As another example, availableIBCA_1 can be determined to be true if availableA_1 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableA_0 is true and the current block is encoded in IBC mode, and all the conditions of the following Equation 31 are satisfied. On the other hand, if the above conditions are not satisfied, availableIBCA_0 can be determined to be false.

[0626] Meanwhile, if at least one of availableA0 or availableA1 is true, isScaledFlagLX can be set to 1, where X can be either 0 or 1. Also, if isScaledFlagLX is 1 and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, and both availableIBCA_0 and availableIBCA_1 are FALSE, isScaledFlagLX can be determined to be 0.

[0627] According to another embodiment of the present invention, scaling of a block vector or a predicted motion vector can be performed according to the following operation.

[0628] Scaling of the block vector or predicted motion vector can be performed based on at least one value among availableA_k, availableFlagLXA, and availableIBCA_k.

[0629] For example, if the current block is not encoded in IBC mode, or if DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) != 0, availableA_k is true, and availableFlagLXA is 0, the following operation may be performed. That is, if the motion vector of the left block (A_k) is referenced and the reference image of the current block is not the current image, the following operation may be performed.

[0630] In addition, if the current block is encoded in IBC mode, or if DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] )== 0, and availableIBCA_k is true and availableFlagLXA is 0, the following operation may be performed. That is, if the motion vector of the left block (A_k) is available for reference, the reference image of the current block is the current image, the motion vector indicates within a predetermined range, and availableFlagLXA is 0, the following operation may be performed.

[0631] As another example, if availableA_k is true and availableFlagLXA is 0 and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ]) is not 0, if availableA_k is true and availableFlagLXA is 0 and the current block is not encoded in IBC mode, or if availableIBCA_k is true and availableFlagLXA is 0, the following operations may be performed.

[0632] Meanwhile, if PredFlagLX[ xNbA_k ][ yNbA_k ] is 1, availableFlagLXA is set to 1 and an operation according to Equation 31 below can be performed. That is, if the reference image list (List X) of the left block is the same as the reference image list (List X) of the current block, an operation according to Equation 31 below can be performed.

[0633] [Mathematical Formula 31]

[0634] mvLXA = MvLX[xNbA_k][yNbA_k]

[0635] refIdxA = RefIdxLX[xNbA_k][yNbA_k]

[0636] refPicListA = RefPicListX

[0637] On the other hand, if PredFlagLY[ xNbA_k ][ yNbA_k ] is 1 (X != Y), availableFlagLXA is set to 1, and an operation according to Equation 32 below can be performed. That is, if the reference image list (List Y) of the left block is different from the reference image list (List X) of the current block, an operation according to Equation 32 below can be performed.

[0638] [Mathematical Formula 32]

[0639] mvLXA = MvLY[xNbA_k][yNbA_k]

[0640] refIdxA = RefIdxLY[xNbA_k][yNbA_k]

[0641] refPicListA = RefPicListY

[0642] Meanwhile, if availableFlagLXA is 1 and DiffPicOrderCnt( refPicListA[ refIdxA ], RefPicListX[ refIdxLX ] ) is not 0, mvLXA can be derived according to Equation 33 below. That is, if a referenceable motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are not the same, mvLXA can be derived according to Equation 33 below.

[0643] [Mathematical Formula 33]

[0644] tx = ( 16384 + ( Abs( td ) >> 1 ) ) / td

[0645] distScaleFactor = Clip3( -4096, 4095, ( tb * tx + 32 ) >> 6 )

[0646] mvLXA = Clip3(-32768, 32767, Sign( distScaleFactor * mvLXA ) * ((Abs( distScaleFactor * mvLXA ) + 127 ) >> 8 ))

[0647] td = Clip3( -128, 127, DiffPicOrderCnt(currPic, refPicListA[ refIdxA ]))

[0648] tb = Clip3( -128, 127, DiffPicOrderCnt(currPic, RefPicListX[ refIdxLX ]))

[0649] As another example, availability determination can be performed according to the following operation. In the following, availableIBCB_k may indicate whether the motion vector or block vector of block B_k is available in IBC mode. That is, availableIBCB_k may indicate whether the motion vector or block vector of block A_k indicates within a specified range.

[0650] The availability determination for the top block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbB_k, yNbB_k), and the partition index partIdx. Accordingly, the encoder or decoder can derive the availability indicator availableB_k for the left reference block.

[0651] For example, the availability determination for the top block can be determined based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbB_0, yNbB_0), and the partition index partIdx. Accordingly, the encoder or decoder can derive the availability indicator availableB_0 for the left reference block.

[0652] As another example, the availability determination for the top block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbB_1, yNbB_1), and the partition index partIdx. Accordingly, the encoder or decoder can derive the availability indicator availableB_1 for the left reference block.

[0653] As another example, the availability determination for the top block can be based on at least one of the following: the location of the current Luma block (xCb, yCb), the size of the current Luma block (nCbS), the location of the current Luma prediction block (xPb, yPb), the width of the current Luma prediction block (nPbW), the height of the current Luma prediction block (nPbH), the location of the neighboring Luma prediction block (xNbY, yNbY) having the location (xNbB_2, yNbB_2), and the partition index partIdx. Accordingly, the encoder or decoder can derive the availability indicator availableB_2 for the left reference block.

[0654] Meanwhile, for example, if availableB_0 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableB_0 is true and the current block is encoded in IBC mode, availableIBCB_0 may be determined to be false if at least one of the conditions in Equation 34 below is satisfied. On the other hand, if the above conditions are not satisfied, availableIBCB_0 may be determined to be true.

[0655] [Mathematical Formula 34]

[0656] (xPb + xMvB0) < - (xCtb * numLeftCTUs)

[0657] (xPb + xMvB0) ≥ xCtb + CtbSizeY

[0658] ( yPb + yMvB0 ) < yCtb

[0659] (yPb + yMvB0) ≥ yCtb + CtbSizeY

[0660] Additionally, availableIBCB_0 may be determined to be true if availableB_0 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableB_0 is true and the current block is encoded in IBC mode, and all conditions of the following Equation 35 are satisfied. On the other hand, if the above conditions are not satisfied, availableIBCB_0 may be determined to be false.

[0661] [Mathematical Formula 35]

[0662] (xPb + xMvB0) ≥ - (xCtb * numLeftCTUs)

[0663] (xPb + xMvB0) < xCtb + CtbSizeY

[0664] ( yPb + yMvB0 ) ≥ yCtb

[0665] (yPb + yMvB0) < yCtb + CtbSizeY

[0666] As another example, availableIBCB_1 may be determined to be false if availableB_1 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableB_1 is true and the current block is encoded in IBC mode, at least one of the conditions in Equation 36 below is satisfied. On the other hand, if the above conditions are not satisfied, availableIBCB_1 may be determined to be true.

[0667] [Mathematical Formula 36]

[0668] (xPb + xMvB1) < - (xCtb * numLeftCTUs)

[0669] (xPb + xMvB1) ≥ xCtb + CtbSizeY

[0670] ( yPb + yMvB1 ) < yCtb

[0671] (yPb + yMvB1) ≥ yCtb + CtbSizeY

[0672] As another example, availableIBCB_1 may be determined to be true if availableB_1 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableB_1 is true and the current block is encoded in IBC mode, and all conditions of the following Equation 37 are satisfied. On the other hand, if the above conditions are not satisfied, availableIBCB_1 may be determined to be false.

[0673] [Mathematical Formula 37]

[0674] (xPb + xMvB1) ≥ - (xCtb * numLeftCTUs)

[0675] (xPb + xMvB1) < xCtb + CtbSizeY

[0676] ( yPb + yMvB1 ) ≥ yCtb

[0677] (yPb + yMvB1) < yCtb + CtbSizeY

[0678] As another example, availableIBCB_2 may be determined to be false if availableB_2 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableB_2 is true and the current block is encoded in IBC mode, and at least one of the conditions in Equation 38 below is satisfied. On the other hand, if the above conditions are not satisfied, availableIBCB_2 may be determined to be true.

[0679] [Mathematical Formula 38]

[0680] (xPb + xMvB2) < - (xCtb * numLeftCTUs)

[0681] (xPb + xMvB2) ≥ xCtb + CtbSizeY

[0682] ( yPb + yMvB2 ) < yCtb

[0683] (yPb + yMvB2) ≥ yCtb + CtbSizeY

[0684] As another example, availableIBCB_2 may be determined to be true if availableB_2 is true and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) is 0, or if availableB_2 is true and the current block is encoded in IBC mode, and all conditions of the following Equation 39 are satisfied. On the other hand, if the above conditions are not satisfied, availableIBCB_2 may be determined to be false.

[0685] [Mathematical Formula 39]

[0686] (xPb + xMvB2) ≥ - (xCtb * numLeftCTUs)

[0687] (xPb + xMvB2) < xCtb + CtbSizeY

[0688] ( yPb + yMvB2 ) ≥ yCtb

[0689] (yPb + yMvB2) < yCtb + CtbSizeY

[0690] According to another embodiment of the present invention, scaling of a block vector or a predicted motion vector can be performed according to the following operation.

[0691] If isScaledFlagLX is 0, availableFlagLXB is set to 0 and the following operation can be performed. That is, if the motion vector of the left block (A_k) is unavailable, availableFlagLXB is set to 0 and the predicted motion vector can be added to the AMVP candidate list through the following operation.

[0692] Scaling of the block vector or predicted motion vector can be performed based on at least one value among available B_k, availableFlagLXB, and availableIBCB_k.

[0693] For example, if the current block is not encoded in IBC mode, or if DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] ) != 0, availableB_k is true, and availableFlagLXB is 0, the following operation may be performed. That is, if the motion vector of the upper block (B_k) is referenced and the reference image of the current block is not the current image, the following operation may be performed.

[0694] Additionally, if the current block is encoded in IBC mode, or if DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ] )== 0, and availableIBCB_k is true and availableFlagLXB is 0, the following operation may be performed. That is, if the motion vector of the upper block (B_k) is available for reference, the reference image of the current block is the current image, the motion vector indicates within a predetermined range, and availableFlagLXA is 0, the following operation may be performed.

[0695] As another example, if availableB_k is true and availableFlagLXB is 0 and DiffPicOrderCnt( currPic, RefPicListX[ refIdxLX ]) is not 0, if availableB_k is true and availableFlagLXB is 0 and the current block is not encoded in IBC mode, or if availableIBCB_k is true and availableFlagLXB is 0, the following operations may be performed.

[0696] Meanwhile, if PredFlagLX[ xNbB_k ][ yNbB_k ] is 1, availableFlagLXB is set to 1 and an operation according to Equation 40 below can be performed. That is, if the reference image list (List X) of the left block is the same as the reference image list (List X) of the current block, an operation according to Equation 40 below can be performed.

[0697] [Mathematical Formula 40]

[0698] mvLXB = MvLX[xNbB_k][yNbB_k]

[0699] refIdxB = RefIdxLX[xNbB_k][yNbB_k]

[0700] refPicListB = RefPicListX

[0701] On the other hand, if PredFlagLY[ xNbB_k ][ yNbB_k ] is 1 (X != Y), availableFlagLXB is set to 1, and an operation according to Equation 41 below can be performed. That is, if the reference image list of the left block (List Y) is different from the reference image list of the current block (List X), an operation according to Equation 41 below can be performed.

[0702] [Mathematical Formula 41]

[0703] mvLXB = MvLY[xNbB_k][yNbB_k]

[0704] refIdxB = RefIdxLY[xNbB_k][yNbB_k]

[0705] refPicListB = RefPicListY

[0706] Meanwhile, if availableFlagLXB is 1 and DiffPicOrderCnt( refPicListB[ refIdxB ], RefPicListX[ refIdxLX ] ) is not 0, mvLXB can be derived according to Equation 42 below. That is, if a referenceable motion vector exists and the reference image of the current block and the reference image of the predicted motion vector are not the same, mvLXB can be derived according to Equation 42 below.

[0707] [Mathematical Formula 42]

[0708] tx = ( 16384 + ( Abs( td ) >> 1 ) ) / td

[0709] distScaleFactor = Clip3( -4096, 4095, ( tb * tx + 32 ) >> 6 )

[0710] mvLXB = Clip3(-32768, 32767, Sign( distScaleFactor * mvLXB ) * ((Abs( distScaleFactor * mvLXB ) + 127 ) >> 8 ))

[0711] td = Clip3( -128, 127, DiffPicOrderCnt(currPic, refPicListB[ refIdxB ]))

[0712] tb = Clip3( -128, 127, DiffPicOrderCnt(currPic, RefPicListX[ refIdxLX ]))

[0713] FIG. 27 is a diagram illustrating a method for deriving an AMVP candidate list for block vector derivation according to another embodiment of the present invention.

[0714] According to another embodiment of the present invention, when generating an AMVP candidate list for block vector derivation, motion vector candidates pointing outside a predetermined range or block vector candidates pointing outside a predetermined range can be removed from the AMVP candidate list for block vector derivation.

[0715] For example, a predetermined range may be the current CTU including the current block.

[0716] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0717] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0718] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0719] The encoder or decoder can examine the AMVP candidate list whenever an AMVP candidate is added to the AMVP candidate list for block vector derivation, and remove motion vector candidates pointing outside a predetermined range or block vector candidates pointing outside a predetermined range from the AMVP candidate list.

[0720] The flowchart of FIG. 27 may be a flowchart of FIG. 19 with the addition of a step to remove unavailable block vector candidates from the AMVP candidate list. After a new candidate is added to the AMVP candidate list, the encoder or decoder may determine whether the current block is encoded in IBC mode. If the encoder or decoder determines that the current block is encoded in IBC mode, it may remove unavailable block vector candidates from the AMVP candidate list. The determination of IBC mode and the removal of unavailable block vector candidates may be performed after the addition of at least one of the spatial candidate, temporal candidate, HMVP-based candidate, and paired prediction candidate of the current block.

[0721] FIG. 28 is a diagram illustrating a method for deriving an AMVP candidate list for block vector derivation according to another embodiment of the present invention.

[0722] According to another embodiment of the present invention, when generating an AMVP candidate list for block vector derivation, motion vector candidates pointing outside a predetermined range or block vector candidates pointing outside a predetermined range can be removed from the AMVP candidate list for block vector derivation.

[0723] For example, a predetermined range may be the current CTU including the current block.

[0724] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0725] As another example, the specified range may be the current CTU and the CTU to the left of the current CTU. As another example, the specified range may be the restored area of ​​the current CTU and a portion of the area of ​​the CTU to the left of the current CTU.

[0726] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0727] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0728] The encoder or decoder may examine the AMVP candidate list before a base vector is added to the AMVP candidate list for block vector derivation, and remove motion vector candidates pointing outside a predetermined range or block vector candidates pointing outside a predetermined range from the AMVP candidate list.

[0729] The flowchart of FIG. 28 may be a flowchart in which, when compared with the flowchart of FIG. 19, the step of removing unavailable block vector candidates from the AMVP candidate list is included only before the addition of the base vector. The encoder or decoder may determine whether the current block is encoded in IBC mode before the base vector is included in the AMVP candidate list. If the encoder or decoder determines that the current block is encoded in IBC mode, it may remove unavailable block vector candidates from the AMVP candidate list.

[0730] According to another embodiment of the present invention, when generating an AMVP candidate list for deriving a block vector, blocks located outside a predetermined range may not be referenced.

[0731] For example, a predetermined range may be the current CTU including the current block.

[0732] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0733] As another example, the specified range may be the current CTU and the CTU to the left of the current CTU. As another example, the specified range may be the restored area of ​​the current CTU and a portion of the area of ​​the CTU to the left of the current CTU.

[0734] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0735] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0736] Additionally, for example, blocks outside the current CTU may not be used when generating the AMVP candidate list for deriving block vectors. That is, the encoder or decoder may determine that the motion vector or block vector of a block located outside the current CTU is unavailable and may not use it when deriving the AMVP candidate list.

[0737] As another example, blocks located outside the current CTU and its left CTU may not be used when generating the AMVP candidate list for block vectors. That is, the encoder or decoder may determine that the motion vectors of blocks located outside the current CTU and its left CTU, or the block vectors of blocks located outside the current CTU and its left CTU, are unavailable and may not use them when deriving the AMVP candidate list.

[0738] As another example, blocks located outside the current CTU and multiple CTUs to the left of the current CTU may not be used when generating the AMVP candidate list for block vectors. That is, the encoder or decoder may determine that the motion vector of a block located outside the current CTU and multiple CTUs to the left of the current CTU, or the block vector of a block located outside the current CTU and multiple CTUs to the left of the current CTU, is unavailable and may not use it when deriving the AMVP candidate list.

[0739] FIG. 29 is a diagram illustrating a method for deriving an AMVP candidate list for block vector derivation according to another embodiment of the present invention.

[0740] According to another embodiment of the present invention, when generating an AMVP candidate list for deriving a block vector, spatially surrounding blocks located outside a predetermined range may not be referenced.

[0741] For example, a predetermined range may be the current CTU including the current block.

[0742] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0743] As another example, the specified range may be the current CTU and the CTU to the left of the current CTU. As another example, the specified range may be the restored area of ​​the current CTU and a portion of the area of ​​the CTU to the left of the current CTU.

[0744] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0745] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0746] The flowchart of FIG. 29 illustrates a method for adding spatial candidate units to the AMVP candidate list. In FIG. 29, S may represent a predetermined range as described above, and A1, B1, B0, A0, and B2 may represent surrounding blocks of the current block. An encoder or decoder may determine whether the spatial surrounding blocks are included in the predetermined range and add the block vector or motion vector of the corresponding spatial surrounding blocks to the AMVP candidate list.

[0747] According to another embodiment of the present invention, when generating an AMVP candidate list for block vector derivation, spatially surrounding blocks located outside a predetermined range may not be referenced.

[0748] For example, a predetermined range may be the current CTU including the current block.

[0749] As another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block, the left CTU area of ​​the current CTU, the top CTU area of ​​the current CTU, and the top-left CTU area of ​​the current CTU. As yet another example, the predetermined range may be at least one of the area of ​​the current CTU including the current block and the surrounding CTU area of ​​the current CTU.

[0750] As another example, the specified range may be the current CTU and the CTU to the left of the current CTU. As another example, the specified range may be the restored area of ​​the current CTU and a portion of the area of ​​the CTU to the left of the current CTU.

[0751] As another example, the predetermined range may be at least one of the restored area of ​​the current CTU and the CTUs located to the left of the current CTU. For example, if the size of the current CTU is 64x64, the predetermined range may be the current CTU and the three CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 32x32, the predetermined range may be the current CTU and the five CTU areas located to the left of the current CTU. Also, if the size of the current CTU is 16x16, the predetermined range may be the current CTU and the 15 CTU areas located to the left of the current CTU.

[0752] Information regarding the aforementioned predetermined range or the range value of the predetermined range can be signaled at at least one level among SPS, PPS, Slice, tile, tile group, NAL, and Brick.

[0753] For example, if a spatial neighbor block A_k or B_k does not fall within a predetermined range, availableA_k or availableB_k of the corresponding block vector may be determined to be false. On the other hand, if a spatial neighbor block A_k or B_k falls within a predetermined range, availableA_k or availableB_k of the corresponding block vector may be determined to be true, where the spatially adjacent spatial neighbor blocks may be at least one of A1, B1, B0, A0, and B2.

[0754] That is, if a candidate A_k is located outside a predetermined range, availableA_k of the block vector can be determined to be false. Also, if a candidate B_k is located outside a predetermined range, availableB_k of the block vector can be determined to be false. Here, k can be one of 0, 1, or 2.

[0755] As another example, if the spatially neighboring blocks do not fall within a predetermined range, the availableN of the corresponding block vector may be determined to be false. Conversely, if the spatially neighboring blocks fall within a predetermined range, the availableN of the block vector may be determined to be true. Here, the spatially neighboring blocks may be at least one of A1, B1, B0, A0, and B2, and N may be A_k or B_k.

[0756] FIG. 30 is a diagram illustrating a method for deriving an AMVP candidate list for block vector derivation according to another embodiment of the present invention.

[0757] According to another embodiment of the present invention, when generating an AMVP candidate list for block vector derivation, at least one of the motion vector of a temporal neighbor block or the block vector of a temporal neighbor block may be excluded.

[0758] The motion vector here may be a motion vector without scaling applied. That is, it may be a motion vector pointing within a predetermined range without scaling applied. Additionally, as another example, the motion vector here may be a motion vector after scaling has been applied. That is, it may be a motion vector pointing within a predetermined range after scaling has been applied.

[0759] For example, when generating an AMVP candidate list for a block vector, temporal neighbor blocks may be excluded. In other words, temporal neighbor blocks may not be used when generating the AMVP candidate list for a block vector.

[0760] As another example, the AMVP-based block vector candidate list can be generated based on at least one of the spatial neighbor block motion vector, HMVP-based motion vector, pairwise mean-based motion vector, spatial neighbor block block vector, HMVP-based block vector, and pairwise mean-based block vector.

[0761] According to FIG. 30, the encoder or decoder determines whether the current block is encoded in IBC mode, and if it is determined that the current block is encoded in IBC mode, it may not add the block vector of the temporal neighboring block to the AMVP candidate list.

[0762] Below, the signaling method of the residual block vector is explained in detail.

[0763] According to one embodiment of the present invention, the residual block vector can be signaled using at least one of abs_mvd_greater0_flag, abs_mvd_greater1_flag, mvd_sign_flag, and abs_mvd_minus2.

[0764] To indicate the residual block vector value of each axis for the horizontal vector (x-axis) and vertical vector (y-axis), at least one of abs_mvd_greater0_flag, abs_mvd_greater1_flag, mvd_sign_flag, and abs_mvd_minus2 may be signaled for each axis.

[0765] For example, abs_mvd_greater0_flag can indicate whether the size of the residual block vector is 0 or 1 or greater. For instance, if abs_mvd_greater0_flag is the first value, the size of the residual vector may be 0. Meanwhile, if abs_mvd_greater0_flag is the second value, abs_mvd_greater1_flag indicating the size of the block vector may be additionally signaled.

[0766] Meanwhile, abs_mvd_greater1_flag can indicate whether the magnitude of the residual vector is 1 or 2 or more. For example, if abs_mvd_greater1_flag is the first value, the magnitude of the vector may be 1. Meanwhile, if abs_mvd_greater1_flag is the second value, abs_mvd_minus2, which indicates the magnitude of the vector, may be additionally signaled.

[0767] Meanwhile, the size of the residual block vector can be abs_mvd_minus2 + 2. For example, abs_mvd_minus2 can be binarized using the exponential golomb coding method.

[0768] Meanwhile, the sign of the remaining block vector can be indicated by mvd_sign_flag. For example, if mvd_sign_flag is the first value, the sign of the block vector can be positive. On the other hand, if mvd_sign_flag is the second value, the sign of the block vector can be negative.

[0769] For example, abs_mvd_greater0_flag, abs_mvd_greater1_flag, mvd_sign_flag, and abs_mvd_minus2 may be signaled based on the binary tables of Table 1 and Table 2 below. The binary tables of Table 1 and Table 2 are merely examples, and the scope of the present invention is not limited by the tables below.

[0770] [Table 1]

[0771]

[0772] [Table 2]

[0773]

[0774] According to another embodiment of the present invention, at least one of the code of the horizontal component or the code of the vertical component of the residual block vector can be derived in the decoder without separate signaling. For example, the decoder can determine the code of the horizontal component or the code of the vertical component of the block vector to be either positive or negative without separate signaling.

[0775] As another example, information regarding the sign of a block vector can be signaled at at least one level among SPS, PPS, Slice, NAL, and Brick.

[0776] For example, when the code of a block vector is signaled on a slice basis, blocks using intra-block copy mode within that slice can have their block vector codes determined using the code information signaled on a slice basis.

[0777] Meanwhile, for example, mvd_sign_flag can indicate the sign of one axis (component) of the residual block vector (MVD). For instance, if mvd_sign_flag is a first value, the residual block vector may be positive, and if mvd_sign_flag is a second value, the residual block vector may be negative.

[0778] As another example, the sign of the horizontal (x-axis) component of the residual block vector is determined using mvd_sign_flag, and the sign of the vertical (y-axis) component can be determined as a positive number without separate signaling.

[0779] As another example, the sign of the horizontal (x-axis) component of the residual block vector is determined using mvd_sign_flag, while the sign of the vertical (y-axis) component can be determined as a negative number without separate signaling.

[0780] As another example, the sign of the vertical (y-axis) component of the residual block vector is determined using mvd_sign_flag, while the sign of the horizontal (x-axis) component can be determined as a positive number without separate signaling.

[0781] As another example, the sign of the vertical (y-axis) component of the residual block vector is determined using mvd_sign_flag, while the sign of the horizontal (x-axis) component can be determined as a negative number without separate signaling.

[0782] As another example, the sign of the horizontal (x-axis) component of the residual block vector can be determined as positive and the sign of the vertical (y-axis) component can be determined as positive without separate signaling.

[0783] As another example, the sign of the horizontal (x-axis) component of the residual block vector can be determined as positive and the sign of the vertical (y-axis) component as negative without separate signaling.

[0784] As another example, the sign of the horizontal (x-axis) component of the residual block vector can be determined as negative and the sign of the vertical (y-axis) component as positive without separate signaling.

[0785] As another example, the sign of the horizontal (x-axis) component of the residual block vector can be determined as negative and the sign of the vertical (y-axis) component can be determined as negative without separate signaling.

[0786] In other words, the sign of the components of the residual block vector can be determined without separate mvd_sign_flag signaling for the horizontal and vertical components.

[0787] FIG. 31 is a flowchart illustrating an image encoding / decoding method according to another embodiment of the present invention.

[0788] Referring to FIG. 31, a video encoding or decoding method according to another embodiment of the present invention may include a step of determining the prediction mode of the current block to be an IBC mode (S3110), a step of determining the availability of a reference block (S3120), a step of deriving at least one of a merge candidate list or an AMVP candidate list to derive a block vector of the current block based on the availability determination result (S3130), and a step of determining the block vector of the current block using at least one of the merge candidate list or the AMVP candidate list (S3140).

[0789] The above merge candidate list can be derived based on at least one of the merge index (merge_idx), a referenceable motion vector, a referenceable block vector, and a default vector.

[0790] The above AMVP candidate list can be derived based on at least one of the MVP index (mvp_idx) for the above AMVP candidate list, a referenced motion vector, a referenced block vector, a default vector, and syntax elements abs_mvd_greater0_flag, abs_mvd_greater1_flag, mvd_sign_flag, and abs_mvd_minus2.

[0791] The above availability determination may be performed based on at least one of the following: the location of the current block, the location of the neighbor block, whether the current block is in an encoding mode using block vector mode, the prediction mode of the neighbor block, the size of the CTB or CTU containing the current block, and an Offset. For example, if the neighbor block exists outside the current picture, the neighbor block may be determined to be unavailable (availableN = false). For example, if the neighbor block belongs to a slice (or tile) different from the slice (or tile) to which the current block belongs, the neighbor block may be determined to be unavailable (availableN = false). The determined availability of the neighbor block may be changed based on the prediction mode of the neighbor block and the prediction mode of the current block. For example, if the prediction mode of the neighbor block and the prediction mode of the current block are different, the prediction mode of the neighbor block determined to be available may be changed to unavailable. That is, the value of availableN may be changed from true to false.

[0792] FIG. 32 is a flowchart illustrating an image encoding / decoding method according to another embodiment of the present invention.

[0793] Referring to FIG. 32, a video encoding or decoding method according to another embodiment of the present invention may include the step of determining the prediction mode of the current block as an IBC mode (S3210), the step of deriving a candidate list for deriving the block vector of the current block (S3220), the step of determining a block vector index according to a detailed mode for the IBC mode (S3230), and the step of determining the block vector of the current block based on the block vector index and the candidate list (S3240).

[0794] The detailed mode for the above IBC mode may include at least one of the IBC merge mode and the IBC AMVP mode.

[0795] For example, the detailed mode for the IBC mode can be determined by encoding parameters transmitted from the encoder to the decoder. Based on the transmitted encoding parameters, a block vector index can be determined. That is, the block vector index can be determined as either the merge index or the MVP_idx.

[0796] Additionally, for example, the step of deriving the candidate list (S3220) may include the step of deriving a spatial candidate using the spatial surrounding blocks of the current block, and the step of adding the derived spatial candidate to the candidate list. In this case, the spatial candidate may be derived when the size of the current block exceeds a preset value. The size of the current block may be expressed as the product of the width and height of the current block, that is, the area of ​​the current block. For example, the preset value may be one of 8, 16, 32, 64, or 128.

[0797] The step of deriving the spatial candidate above may include a step of determining the availability of spatially surrounding blocks of the current block. The availability determination here may be performed using at least one of the embodiments of the availability determination described above. Additionally, the result of the availability determination for surrounding blocks may be used to determine the block vector availability of the surrounding blocks. Here, the block vector availability of the surrounding blocks may indicate whether the block vector of the surrounding blocks can be included in the candidate list of the current block. That is, the encoder or decoder may add the block vector of the surrounding blocks to the candidate list for deriving the block vector of the current block based on the block vector availability of the surrounding blocks.

[0798] For example, the encoder or decoder may add at least one of a spatial candidate or an HMVP-based candidate to the candidate list. The encoder or decoder may add a spatial candidate or an HMVP-based candidate to the candidate list by using at least one of the embodiments of deriving a merge candidate list or deriving an AMVP candidate list described above. Meanwhile, the encoder or decoder may not derive a temporal candidate for the current block during the process of deriving a candidate list for deriving a block vector.

[0799] Additionally, for example, an encoder or a decoder may add zero vector candidates to a merge candidate list until the number of candidates in the candidate list reaches the preset value when the number of candidates in the candidate list is less than a preset value. For example, the preset value may be one of a value between 1 and 6. Also, for example, the preset value may be determined by a value signaled from the encoder to the decoder.

[0800] For example, if the encoding parameter for a detailed mode for an IBC mode has a first value representing an IBC merge mode, the block vector for the current block can be derived using a merge index. Here, the merge index may indicate a block vector candidate for deriving the block vector of the current block among the block vector candidates included in the candidate list.

[0801] As another example, if the encoding parameter for a detailed mode for an IBC mode has a second value representing the IBC AMVP mode, the encoder or decoder may derive a block vector (motion vector) predictor (BVP(MVP)) for deriving a block vector for the current block using a candidate list. For instance, the block vector predictor for deriving a block vector may be derived using at least one of the MVP_idx or motion vector predictor indicators described above. Here, the MVP_idx or motion vector predictor indicator may indicate a block vector candidate that can be used to derive the block vector of the current block among the block vector (motion vector) candidates included in the candidate list. The encoder may determine the MVP_idx or motion vector predictor indicator using the block vector for the current block and the candidate list. The encoder may encode the determined MVP_idx or motion vector predictor indicator into a bitstream.

[0802] If the encoding parameter for the detailed mode of the IBC mode has a second value representing the IBC AMVP mode, the encoder or decoder can obtain block vector difference information for the current block. For example, block vector difference information can be obtained based on information signaled from the encoder to the decoder. The encoder or decoder can determine the block vector for the current block through the sum of the block vector (motion vector) predictor and the motion vector difference for the current block. The encoder can calculate the block vector difference value by subtracting the block vector predictor from the block vector for the current block. The encoder can encode the calculated block vector difference value into the bitstream as block vector difference information.

[0803] When a block vector for the current block is determined, the encoder or decoder may add the block vector for the current block to the HMVP candidate list. For example, if the size of the current block is larger than a preset value, the encoder or decoder may add the block vector for the current block to the HMVP list. For instance, the preset block size may be one of 8, 16, 32, 64, or 128.

[0804] According to another embodiment of the present invention, when applying a block vector mode or an IBC mode to a current block, whether a neighbor block (N) is available (availableN) can be determined based on at least one of the following: the location of the current block, the location of a neighbor block, whether the current block is an encoding mode using a block vector mode, the prediction mode of the neighbor block, the size of the CTB or CTU containing the current block, and an Offset.

[0805] For example, when encoding or decoding the current block using IBC mode, if the availableN of any neighboring block is true and CuPredMode[ xNbY ][ yNbY ] is not MODE_IBC, the encoder or decoder may determine the availableN for that neighboring block to be false.

[0806] As another example, when encoding or decoding the current block using IBC mode, if availableN is true and CuPredMode[ xNbY ][ yNbY ] is MODE_IBC, the encoder or decoder can determine availableN based on the location of the neighboring luma block.

[0807] FIG. 33 is a drawing for illustrating a referenceable left CTU according to some embodiments of the present invention.

[0808] In the following, numLeftCTUs represents the number of referenced left CTUs, and the value of numLeftCUTs can be determined according to the following mathematical formula 43.

[0809] [Mathematical Formula 43]

[0810] numLeftCTUs = (1 << (( 7-CtuSizeLog2) << 1 )) - (( CtuSizeLog2 < 7 ) ? 1 : 0 )

[0811] For example, if availableN is true and CuPredMode[ xNbY ][ yNbY ] is MODE_IBC, availableN can be determined to be false if at least one of the conditions of Equation 44 below is satisfied.

[0812] [Mathematical Formula 44]

[0813] xNbY < xCtb - (offset * numLeftCTUs)

[0814] yNbY < yCtb

[0815] In the above mathematical formula 44, the offset may be a predetermined size. For example, the offset may be one of the CTU size, 128, 64, 32, 16, 8, 4, 2, 1, or 0.

[0816] In addition, for example, if availableN is true and CuPredMode[ xNbY ][ yNbY ] is MODE_IBC, availableN can be determined to be true if all conditions of the following mathematical formula 45 are satisfied.

[0817] [Mathematical Formula 45]

[0818] xNbY ≥ xCtb - (offset * numLeftCTUs)

[0819] yNbY ≥ yCtb

[0820] In the above mathematical formula, offset can be a predetermined size. For example, offset can be one of the CTU size, 128, 64, 32, 16, 8, 4, 2, 1, or 0.

[0821] The above embodiments can be performed in the same way in the encoder and decoder.

[0822] An image can be encoded / decoded using at least one of the above embodiments or a combination of at least one.

[0823] The order of applying the above embodiments may differ between the encoder and the decoder, and the order of applying the above embodiments may be the same between the encoder and the decoder.

[0824] The above example can be performed for each of the luminance and color difference signals, and the above example can be performed in the same way for the luminance and color difference signals.

[0825] The shape of the block to which the above embodiments of the present invention are applied may be square or non-square.

[0826] The above embodiments of the present invention may be applied according to the size of at least one of an encoding block, a prediction block, a conversion block, a block, a current block, an encoding unit, a prediction unit, a conversion unit, a unit, and a current unit. The size here may be defined as a minimum size and / or a maximum size for the application of the above embodiments, or it may be defined as a fixed size for the application of the above embodiments. Furthermore, the above embodiments may be applied as a first embodiment at a first size, and as a second embodiment at a second size. That is, the above embodiments may be applied in combination according to the size. Additionally, the above embodiments of the present invention may be applied only when the size is greater than or equal to the minimum size and less than or equal to the maximum size. That is, the above embodiments may be applied only when the block size falls within a certain range.

[0827] For example, the above embodiments may be applied only when the current block size is 8x8 or larger. For example, the above embodiments may be applied only when the current block size is 4x4. For example, the above embodiments may be applied only when the current block size is 16x16 or smaller. For example, the above embodiments may be applied only when the current block size is 16x16 or larger and 64x64 or smaller.

[0828] The embodiments of the present invention may be applied according to a temporal layer. A separate identifier is signaled to identify the temporal layer to which the embodiments are applicable, and the embodiments may be applied to the temporal layer specified by the identifier. The identifier may be defined as the lowest layer and / or the highest layer to which the embodiments are applicable, or it may be defined as indicating a specific layer to which the embodiments are applied. Additionally, a fixed temporal layer to which the embodiments are applied may be defined.

[0829] For example, the above embodiments may be applied only when the temporal layer of the current image is the lowest layer. For example, the above embodiments may be applied only when the temporal layer identifier of the current image is 1 or greater. For example, the above embodiments may be applied only when the temporal layer of the current image is the highest layer.

[0830] The slice type or tile group type to which the above embodiments of the present invention are applied is defined, and the above embodiments of the present invention may be applied according to the said slice type or tile group type.

[0831] In the embodiments described above, methods are described based on flowcharts as a series of steps or units; however, the present invention is not limited to the order of the steps, and some steps may occur in a different order or simultaneously with other steps as described above. Furthermore, those skilled in the art will understand that the steps shown in the flowcharts are not exclusive, that other steps may be included, or that one or more steps of the flowcharts may be omitted without affecting the scope of the present invention.

[0832] The embodiments described above include examples of various aspects. While it is not possible to describe all possible combinations for representing various aspects, those skilled in the art will recognize that other combinations are possible. Accordingly, the present invention shall be deemed to include all other substitutions, modifications, and changes falling within the scope of the following claims.

[0833] The embodiments according to the present invention described above 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 alone or in combination. The program instructions recorded on the computer-readable recording medium may be those specifically designed and configured for the present invention, or they may be those known and available to those skilled in the art of computer software. 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. Examples of program instructions include machine code, such as that generated by a compiler, as well as high-level language code that can be executed by a computer using an interpreter, etc. The hardware device may be configured to operate as one or more software modules to perform processing according to the present invention, and vice versa.

[0834] Although the present invention has been described above with specific details such as specific components, limited embodiments, and drawings, this is provided only to aid in a more comprehensive understanding of the invention, and the invention is not limited to the above embodiments, and a person skilled in the art to which the invention belongs can make various modifications and variations from this description.

[0835] Accordingly, the scope of the present invention should not be limited to the embodiments described above, and all modifications equivalent to or equivalent to the claims set forth below, as well as the claims described below, shall be considered to fall within the scope of the concept of the present invention.

[0836] The present invention can be used to encode / decode images.

Claims

1. In the video decryption method, A step of determining the prediction mode of the current block as IBC mode; A step of deriving a candidate list for deriving a block vector of the current block; and Including a step of deriving a block vector of the current block using the above candidate list, A method for decoding an image, characterized in that the candidate list is derived based on the size of the current block.

2. In paragraph 1, The steps for deriving the above candidate list are A step of deriving a spatial candidate of the current block using spatial surrounding blocks of the current block; and An image decoding method, characterized by comprising a step of adding the spatial candidate to the candidate list.

3. In paragraph 2, An image decoding method, characterized in that the spatial candidate is derived only when the size of the current block exceeds a preset value.

4. In paragraph 3, The step of deriving the above spatial candidate is: a step of determining block availability for the spatial surrounding blocks; and A step of determining the block vector availability of the spatial surrounding block based on the above block availability determination result is included. A method for decoding an image, wherein the above block vector availability indicates whether the block vector of the spatial surrounding block can be included in the candidate list of the current block.

5. In paragraph 1, The steps for deriving the above candidate list are: A step of deriving a candidate based on HMVP (History based motion vector prediction) for the current block; and A video decoding method, characterized by comprising a step of adding the HMVP-based candidate to the candidate list.

6. In paragraph 1, The steps for deriving the above candidate list are: An image decoding method, characterized in that it comprises a step of adding a zero vector candidate to the candidate list until the number of candidates in the candidate list reaches the preset value, when the number of candidates currently included in the candidate list is less than a preset value.

7. In paragraph 6, A video decoding method, characterized in that the above preset value is determined by signaled information.

8. In paragraph 1, A method for decoding an image, characterized in that the candidate list does not include a temporal candidate for the current block.

9. In paragraph 1, Further comprising a step of determining a detailed mode for the above IBC mode, A video decoding method, characterized in that the above detailed mode is determined as one of the IBC merge mode and the IBC AMVP mode.

10. In paragraph 9, An image decoding method, characterized in that when the detailed mode for the IBC mode is determined as the IBC merge mode, the block vector for the current block is derived using the merge index for the current block.

11. In paragraph 9, An image decoding method, characterized in that it further includes a step of deriving a block vector predictor for the current block using a block vector predictor indicator for the current block when the detailed mode for the IBC mode is determined as the IBC AMVP mode.

12. In paragraph 11, An image decoding method, characterized in that the block vector for the current block is derived through the sum of the block vector predictor for the current block and the block vector difference for the current block.

13. In the video encoding method, A step of determining the prediction mode of the current block as IBC mode; A step of deriving a candidate list for deriving a block vector of the current block; and Including a step of deriving a block vector of the current block using the above candidate list, A video encoding method, characterized in that the candidate list is derived based on the size of the current block.

14. In paragraph 13, The steps for deriving the above candidate list are A step of deriving a spatial candidate of the current block using spatial surrounding blocks of the current block; and A video encoding method, characterized by comprising a step of adding the spatial candidate to the candidate list.

15. In paragraph 14, A video encoding method, characterized in that the spatial candidate is derived only when the size of the current block exceeds a preset value.

16. In paragraph 13, The steps for deriving the above candidate list are: A video encoding method, characterized in that it comprises a step of adding a zero vector candidate to the candidate list until the number of candidates in the candidate list reaches the preset value, when the number of candidates currently included in the candidate list is less than a preset value.

17. In paragraph 13, Further comprising a step of determining a detailed mode for the above IBC mode, A video encoding method, characterized in that the above detailed mode is determined as one of the IBC merge mode and the IBC AMVP mode.

18. In paragraph 17, When the detailed mode for the IBC mode is determined as the IBC merge mode, a step of deriving a merge index for the current block using the candidate list; and A video encoding method, characterized in that it further comprises a step of encoding the above merge index.

19. In paragraph 17, When the detailed mode for the IBC mode is determined as the IBC AMVP mode, a step of deriving a motion vector predictor indicator for the current block using the candidate list; and A video encoding method, characterized in that it further comprises a step of encoding the motion vector predictor indicator.

20. A computer-readable recording medium storing a bitstream received by a video decoding device and used to restore a current block included in a current picture, The above bitstream contains information about the prediction of the current block, The information about the above prediction is used to determine the prediction mode of the current block as IBC mode, Information about the above prediction is used to derive a candidate list for deriving a block vector of the current block, The above candidate list is used to derive the block vector of the current block, A computer-readable recording medium, characterized in that the candidate list is derived based on the size of the current block.