Video encoding and decoding method and recording medium for storing bit stream

CN121533024APending Publication Date: 2026-02-13ELECTRONICS & TELECOMM RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202480044818.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-10-06
Filing Date
2024-07-02
Publication Date
2026-02-13

Smart Images

  • Figure CN121533024A_ABST
    Figure CN121533024A_ABST
Patent Text Reader

Abstract

A video encoding method according to the present disclosure comprises the steps of: constructing a block vector candidate list of a current block; deriving a block vector of the current block based on the block vector candidate list; and deriving a first prediction block of the current block based on the block vector. The block vector candidate list may include template matching block vector candidates derived by template matching.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The disclosure relates to a method, an apparatus, and a recording medium for image encoding / decoding. BACKGROUND

[0002] With the continuous development of the information and communication industry, broadcast services supporting high definition (HD) resolution have been popularized all over the world. Through this popularization, a large number of users have been accustomed to high resolution and high definition images and / or videos.

[0003] To meet the users' demand for high definition, many institutions have accelerated the development of next-generation imaging devices. The users' interest in UHDTV having a resolution four times higher than that of a full HD (FHD) TV, as well as high definition TV (HDTV) and FHD TV, has increased. As the interest in it increases, there is a current need for image encoding / decoding technology for images having higher resolution and higher definition.

[0004] As an image compression technology, there are various technologies, such as an inter prediction technology, an intra prediction technology, a transform, a quantization technology, a filtering technology, and an entropy encoding technology.

[0005] The inter prediction technology is a technology for predicting the value of a pixel included in a current picture using a picture before the current picture and / or a picture after the current picture. The intra prediction technology is a technology for predicting the value of a pixel included in a current picture using information about the pixel in the current picture. The transform and quantization technology can be a technology for compressing the energy of a residual signal. The entropy encoding technology is a technology for allocating a short code word to a frequently occurring value and a long code word to a less frequently occurring value.

[0006] By utilizing such an image compression technology, data about an image can be efficiently compressed, transmitted, and stored. SUMMARY

[0007] TECHNICAL PROBLEM The disclosure aims to provide an encoding / decoding method, an apparatus, and a recording medium for improving a block vector of a current block.

[0008] The disclosure aims to provide an encoding / decoding method, an apparatus, and a recording medium for improving a block vector based on template matching at a decoder side.

[0009] The disclosure aims to provide an encoding / decoding method, an apparatus, and a recording medium for deriving a block vector candidate based on template matching at a decoder side.

[0010] The disclosure aims to provide an encoding / decoding method, an apparatus, and a recording medium for determining an offset vector for improving a block vector by using simplified index information.

[0011] The present disclosure aims to provide an encoding / decoding method, apparatus, and recording medium for variably setting resolution of a block vector.

[0012] The present disclosure aims to provide an encoding / decoding method, apparatus, and recording medium for additionally performing intra prediction on a block to which a block vector is applied.

[0013] Technical Solution A video decoding method according to the present disclosure can include constructing a block vector candidate list of a current block, deriving a block vector of the current block based on the block vector candidate list, and deriving a first prediction block of the current block based on the block vector. In this case, the block vector candidate list can include a template matching block vector candidate derived through template matching.

[0014] In the video decoding method according to the present disclosure, at least one reference template can be selected according to a template matching cost of a current template set around the current block in a search range of a current picture, and the template matching block vector candidate has a block vector representing a position difference between the current template and the reference template.

[0015] In the video decoding method according to the present disclosure, the block vector candidate list can further include a spatial block vector candidate derived from a neighboring block belonging to the same picture as the current block.

[0016] In the video decoding method according to the present disclosure, when the neighboring block is encoded through inter prediction, a motion vector of the neighboring block can be converted into a block vector to derive the spatial block vector candidate.

[0017] In the video decoding method according to the present disclosure, the block vector of the spatial block vector candidate can be derived by scaling the motion vector based on a scaling factor, and the scaling factor can be derived based on a picture order count (POC) difference between a reference picture indicated by a reference picture index of the neighboring block and a current picture to which the current block belongs.

[0018] In the video decoding method according to the present disclosure, when a position of a block vector of the neighboring block spaced apart from the current block is not available, the neighboring block can be set as unavailable for deriving the spatial block vector candidate.

[0019] In the video decoding method according to the present disclosure, the position is determined as unavailable when the position is outside a boundary of a predetermined processing unit, or when at least a part of a block including the position overlaps the current block.

[0020] In the video decoding method according to the present disclosure, the block vector candidates in the block vector candidate list can be re-ordered according to the template matching cost.

[0021] In the video decoding method according to the disclosure, a block vector of a current block can be derived by adding an offset vector to a block vector indicated by a block vector candidate in a block vector candidate list, and the offset vector can be characterized by being defined by size information and direction information.

[0022] In the video decoding method according to the disclosure, the size information can indicate one of a plurality of fractional position candidates between an initial integer position indicated by the block vector candidate and a neighboring integer position neighboring the initial integer position.

[0023] In the video decoding method according to the disclosure, the direction information can indicate one of a plurality of direction information candidates, a template matching cost can be derived for each of neighboring integer positions located in a direction indicated by each of the plurality of direction information candidates, and one of the plurality of direction information candidates can be selected by comparing the template matching costs of the plurality of neighboring integer positions.

[0024] In the video decoding method according to the disclosure, the size information and the direction information can be explicitly signaled through a bitstream.

[0025] In the video decoding method according to the disclosure, a shape of a search range is determined based on index information indicating one of shape candidates, and a first shape candidate among the shape candidates has a rectangular shape and a second shape candidate has a diamond shape.

[0026] In the video decoding method according to the disclosure, when at least a part of a region to be set as the search range overlaps the current block, a remaining region except for the region overlapping the current block can be set as the search range.

[0027] In the video decoding method according to the disclosure, the block vector candidate list can be configured by extracting only a predefined number of block vector candidates in ascending order of template costs from an initial block vector candidate list.

[0028] In the video decoding method according to the disclosure, the method further includes deriving an intra prediction mode of the current block, and obtaining a second prediction block of the current block based on the intra prediction mode, wherein a final prediction block of the current block can be obtained based on a weighted sum operation of the first prediction block and the second prediction block.

[0029] In the video decoding method according to the disclosure, the intra prediction mode can be derived as an intra prediction mode stored in a reference block indicated by a block vector of the current block.

[0030] In the video decoding method according to the disclosure, when there are a plurality of intra prediction modes in the reference block, an intra prediction mode having the highest frequency among the plurality of intra prediction modes can be determined as the intra prediction mode of the current block.

[0031] The image encoding method according to the present disclosure can include configuring a block vector candidate list of a current block, deriving a block vector of the current block based on the block vector candidate list, and deriving a first prediction block of the current block based on the block vector. In this case, the block vector candidate list can include a template matching block vector candidate derived by template matching.

[0032] In the present disclosure, a recording medium recording a bitstream generated by an image encoding method can be provided.

[0033] Technical Effects According to the present disclosure, an encoding / decoding method, apparatus, and recording medium for improving a block vector of a current block can be provided.

[0034] According to the present disclosure, an encoding / decoding method, apparatus, and recording medium for deriving a block vector candidate based on template matching by itself on a decoder side can be provided.

[0035] According to the present disclosure, an encoding / decoding method, apparatus, and recording medium for improving a block vector based on template matching on a decoder side can be provided.

[0036] According to the present disclosure, an encoding / decoding method, apparatus, and recording medium for determining an offset vector for improving a block vector by using simplified index information can be provided.

[0037] According to the present disclosure, an encoding / decoding method, apparatus, and recording medium for variably setting a resolution of a block vector can be provided.

[0038] According to the present disclosure, an encoding / decoding method, apparatus, and recording medium for additionally performing intra prediction on a block to which a block vector is applied can be provided. BRIEF DESCRIPTION OF DRAWINGS

[0039] Figure 1 FIG. 1 is a block diagram illustrating a configuration of an embodiment of an encoding apparatus to which the present disclosure is applied.

[0040] Figure 2 FIG. 2 is a block diagram illustrating a configuration of an embodiment of a decoding apparatus to which the present disclosure is applied.

[0041] Figure 3 FIG. 3 is a diagram schematically illustrating a partition structure of an image when the image is encoded and decoded.

[0042] Figure 4 FIG. 4 is a diagram illustrating a form of a prediction unit (PU) which a coding unit (CU) can include.

[0043] Figure 5 FIG. 5 is a diagram illustrating a form of a transform unit (TU) which can be included in a CU.

[0044] Figure 6 A partitioning of a block according to an example is shown.

[0045] Figure 7 is a diagram for explaining an embodiment of an intra prediction process.

[0046] Figure 8 is a diagram showing reference samples used in an intra prediction process.

[0047] Figure 9 is a diagram for explaining an embodiment of an inter prediction process.

[0048] Figure 10 A spatial candidate according to an embodiment is shown.

[0049] Figure 11 An order of adding motion information of spatial candidates to a merge list according to an embodiment is shown.

[0050] Figure 12 A transform and quantization process according to an example is shown.

[0051] Figure 13 A diagonal scan according to an example is shown.

[0052] Figure 14 A horizontal scan according to an example is shown.

[0053] Figure 15 A vertical scan according to an example is shown.

[0054] Figure 16 is a configuration diagram of an encoding device according to an embodiment.

[0055] Figure 17 is a configuration diagram of a decoding device according to an embodiment.

[0056] Figure 18 An example of determining a reference block based on a block vector of a current block is shown.

[0057] Figure 19 is a flowchart of a method for encoding a current block in an intra block copy mode, an intra template matching prediction mode, or an inter prediction mode.

[0058] Figure 20 is a flowchart of a method for decoding a current block in an intra block copy mode, an intra template matching prediction mode, or an inter prediction mode.

[0059] Figure 21 Neighboring blocks used for deriving a block vector candidate are shown.

[0060] Figure 22 An example of a neighboring block adjacent to a current block deriving a block vector candidate is shown.

[0061] Figure 23 An example showing a uni-directional motion vector of a neighboring block is modified to a block vector.

[0062] Figure 24 An example showing a bi-directional motion vector of a neighboring block is modified to a block vector.

[0063] Figures 25 to 28 An example showing a block vector is derived from a bi-directional motion vector of a neighboring block according to directionality of each of L0 prediction and L1 prediction.

[0064] Figure 29 An example showing a uni-directional block vector of a neighboring block is modified to a motion vector.

[0065] Figure 30 An example showing a bi-directional block vector of a neighboring block is modified / improved to a bi-directional motion vector.

[0066] Figure 31 An example showing a spatial block used for deriving a block vector candidate.

[0067] Figure 32 An example showing neighboring blocks beyond a preset region including a current block are set as unavailable.

[0068] Figure 33 An example showing a pattern is adaptively determined according to a shape of a current block.

[0069] Figure 34 An example showing a pattern is configured based on a position of a current block.

[0070] Figure 35 And Figure 36 An example showing a pattern is determined based on at least one of a number or a position of referenceable blocks.

[0071] Figure 37 An example showing a neighboring region of a current block is partitioned into multiple regions.

[0072] Figure 38 An example for describing a pattern is adaptively determined based on a coding parameter of a neighboring block.

[0073] Figure 39 An example showing whether a neighboring block is available is determined according to a position of the neighboring block.

[0074] Figure 40 And Figure 41 An example showing whether a neighboring block is available is determined according to a size of the neighboring block.

[0075] Figure 42An example showing that the block vector of a block coded / decoded in the intra block copy mode and the block vector of a block coded / decoded by template matching are stored in one history block vector buffer.

[0076] Figure 43 An example showing that the history block vector buffer storing the block vector of a block coded / decoded in the intra block copy mode and the history block vector buffer storing the block vector of a block coded / decoded by template matching are managed separately.

[0077] Figure 44 and Figure 45 An example showing a configuration of a block vector candidate list of a current block.

[0078] Figures 46 to 48 An example showing that a pair-wise average block vector candidate is added to a block vector candidate list.

[0079] Figures 49 to 51 An example showing that a pair-wise average motion vector is added to a motion vector candidate list.

[0080] Figure 52 An example for describing that a block vector candidate is improved by applying template matching.

[0081] Figure 53 and Figure 54 An example showing that a block vector candidate is updated.

[0082] Figure 55 and Figure 56 An example showing that a block vector candidate within a block vector candidate list is reordered.

[0083] Figure 57 An example showing a form of a filter.

[0084] Figure 58 A list consisting of nodes including mode information and parameter information is illustrated.

[0085] Figure 59 An example showing that an element is derived from a reference region.

[0086] Figure 60 A diagram for describing an intra template matching prediction method.

[0087] Figure 61 A diagram for describing an example of referring to a block vector derived by an intra template matching prediction method in a current block applying an intra block copy mode.

[0088] Figure 62 A diagram for describing an intra template matching prediction method.

[0089] Figure 63 and Figure 64An example of configuring an intra template matching block vector candidate list is shown.

[0090] Figures 65 to 67 An example of configuring an intra block copy block vector candidate list when the block vector candidate list selected for the current block is an intra block copy block vector candidate list is shown.

[0091] Figure 68 And Figure 69 An example of configuring a consolidated block vector candidate list is shown.

[0092] Figures 70 to 73 is a diagram for describing an offset vector.

[0093] Figure 74 An example of a block vector candidate list derived based on an upper layer block shared with a lower layer block is shown.

[0094] Figure 75 is an example for describing a block vector candidate not available for a lower layer block.

[0095] Figure 76 An example of a configuration including a set of integer sample unit candidates is shown.

[0096] Figure 77 is a diagram for describing an example of deriving an intra prediction mode of a current block based on TIMD.

[0097] Figure 78 is a diagram for describing an example of deriving an intra prediction mode of a current block based on DIMD.

[0098] Figure 79 An example of deriving an intra prediction mode of a current block from a reference block indicated by a block vector is shown.

[0099] Figure 80 An example of a shape of a template region is shown.

[0100] Figure 81 An example of excluding a reconstructed region not included in a current CTU from a template region is shown.

[0101] Figure 82 Various forms of a template derived from a template region of a current block are shown.

[0102] Figure 83 An example of configuring a template by subsampling a template region is shown.

[0103] Figures 84 to 87 An example of setting a search start position is shown.

[0104] Figures 88 to 95 is a diagram for describing a template search range.

[0105] Figure 96 is a diagram for describing an example of template matching search execution processing within a template matching search range.

[0106] Figure 97 shows an example of applying different weights to each line in a template.

[0107] Figure 98 shows an example of deriving a temporal prediction block vector.

[0108] Figure 99 shows an example of applying a sub-block based block vector prediction method.

[0109] Figure 100 is a diagram for describing an example of restricting the range of a block vector.

[0110] Figure 101 is a diagram for describing the position of a reference block.

[0111] Figure 102 is a diagram for describing a reference region buffer.

[0112] Figure 103 shows an example of setting coordinates based on the center position of a reference region.

[0113] Figure 104 shows a configuration example of a reference region buffer.

[0114] Figures 105 to 108 shows aspects of updating a reference region buffer when a CTB is encoded / decoded.

[0115] Figure 109 shows an example of deriving a block vector for each sub-block after a current chroma block is partitioned into a plurality of sub-blocks.

[0116] Figure 110 shows a sample at a predefined position.

[0117] Figure 111 for describing an example in which a reference block indicated by a block vector is set as a prediction block.

[0118] Figure 112 and Figure 113 is a diagram for describing an embodiment of deriving a residual block of a current chroma component block. DETAILED DESCRIPTION

[0119] The present application can be varied and can have various embodiments, and a specific embodiment will be described in detail below with reference to the accompanying drawings. However, it should be understood that those embodiments are not intended to limit the present application to a particular disclosed form, and they include all changes, equivalents or modifications included in the spirit and scope of the present application.

[0120] A detailed description of exemplary embodiments will be made with reference to the accompanying drawings, in which specific embodiments are shown. The described embodiments are described so that those skilled in the art having ordinary knowledge in the technical field to which the present disclosure belongs can easily practice the embodiments. It should be noted that various embodiments differ from each other but do not need to be mutually exclusive from each other. For example, the specific shapes, structures, and characteristics described herein can be implemented as other embodiments without departing from the spirit and scope of the embodiments related to the embodiments. In addition, it should be understood that the position or arrangement of each component in each disclosed embodiment can be changed without departing from the spirit and scope of the embodiments. Therefore, the accompanying detailed description is not intended to limit the scope of the present disclosure, and the scope of the exemplary embodiments is limited only by the appended claims and their equivalents, as long as they are properly described.

[0121] In the drawings, like reference numerals are used to designate the same or similar functions in various aspects. The shape, size, etc. of components in the drawings can be exaggerated so that the description is clear.

[0122] Terms such as "first" and "second" can be used to describe various components, but the components are not limited by the terms. The terms are used only to distinguish one component from another component. For example, the first component can be named the second component without departing from the scope of the present specification. Likewise, the second component can be named the first component. The term "and / or" can include a combination of a plurality of related description items or any one of a plurality of related description items.

[0123] It will be understood that when a component is referred to as being "connected" or "coupled" to another component, two components can be directly connected or coupled to each other, or an intermediate component can be present between the two components. On the other hand, it will be understood that when a component is referred to as being "directly connected or coupled", there is no intermediate component between the two components.

[0124] In addition, components described in the embodiments are independently shown in order to indicate different characteristic functions, but this does not mean that each of the components is formed of a separate hardware or software. That is, the components are arranged and included separately for the convenience of description. For example, at least two of the components can be integrated into a single component. Conversely, one component can be divided into a plurality of components. Embodiments in which components are integrated or embodiments in which some components are separated are included in the scope of the present specification, as long as it does not depart from the essence of the present specification.

[0125] The terms used in the embodiments are merely used to describe specific embodiments and are not intended to limit the present application. Unless specifically defined otherwise in the context of a description, singular expressions include plural expressions. In the embodiments, it is to be understood that terms such as "include" or "has" are merely intended to indicate that there is existence of the features, numbers, steps, operations, components, parts, or combinations thereof, and are not intended to exclude the possibility of existence or addition of one or more other features, numbers, steps, operations, components, parts, or combinations thereof. That is, in the embodiments, the expression that a component "includes" a specific component means that another component can be included in the scope of the present application or the technical spirit of the present application, but does not exclude existence of components other than the specific component.

[0126] In the embodiments, the term "at least one" can mean one of 1 or more numbers, such as 1, 2, 3, and 4. In the embodiments, the term "a plurality of" can mean one of 2 or more numbers, such as 2, 3, and 4.

[0127] Some of the components of the embodiments are not essential components for performing essential functions, but can be optional components for improving performance only. The embodiments can be implemented using only essential components for implementing the nature of the embodiments. For example, a structure including only essential components without including optional components used only for improving performance is also included in the scope of the embodiments.

[0128] The embodiments will be described in detail below with reference to the accompanying drawings so that those having ordinary knowledge in the technical field to which the embodiments belong can easily practice the embodiments. In the following description of the embodiments, detailed descriptions of known functions or configurations which are considered to make the gist of the present specification ambiguous will be omitted. Also, the same components will be designated by the same reference numerals throughout the drawings, and repeated descriptions thereof will be omitted.

[0129] Hereinafter, "image" can mean a single picture constituting a video, or can mean a video itself. For example, "encoding and / or decoding of an image" can mean "encoding and / or decoding of a video", and can also mean "encoding and / or decoding of any one of the images constituting a video".

[0130] Hereinafter, the terms "video" and "moving picture" can be used as having the same meaning, and can be used interchangeably with each other.

[0131] Hereinafter, a target image can be an encoding target image that is a target to be encoded and / or a decoding target image that is a target to be decoded. Also, the target image can be an input image input to an encoding apparatus or an input image input to a decoding apparatus. Also, the target image can be a current image, that is, a target to be currently encoded and / or decoded. For example, the terms "target image" and "current image" can be used as having the same meaning, and can be used interchangeably with each other.

[0132] Hereinafter, the terms "image", "picture", "frame", and "screen" can be used with the same meaning and can be used interchangeably with each other.

[0133] Hereinafter, a target block can be a coding target block (i.e., a target to be coded) and / or a decoding target block (i.e., a target to be decoded). Also, a target block can be a current block, i.e., a target to be currently coded and / or decoded. Here, the terms "target block" and "current block" can be used with the same meaning and can be used interchangeably with each other. A current block can denote a coding target block as a coding target during coding and / or a decoding target block as a decoding target during decoding. Also, a current block can be at least one of a coding block, a prediction block, a residual block, and a transform block.

[0134] Hereinafter, the terms "block" and "unit" can be used with the same meaning and can be used interchangeably with each other. Alternatively, a "block" can denote a specific unit.

[0135] Hereinafter, the terms "region" and "segment" can be used interchangeably with each other.

[0136] In the following embodiments, specific information, data, flags, indices, elements, and attributes can have their respective values. A value "0" corresponding to each of the information, data, flags, indices, elements, and attributes can indicate false, logical false, or a first predefined value. In other words, the values "0", false, logical false, and the first predefined value can be used interchangeably with each other. A value "1" corresponding to each of the information, data, flags, indices, elements, and attributes can indicate true, logical true, or a second predefined value. In other words, the values "1", true, logical true, and the second predefined value can be used interchangeably with each other.

[0137] When a variable such as i or j is used to indicate a row, a column, or an index, a value of i can be an integer of 0 or more or can be an integer of 1 or more. In other words, in embodiments, each of rows, columns, and indices can be counted from 0 or can be counted from 1.

[0138] In embodiments, the term "one or more" or the term "at least one" can denote the term "a plurality of". The term "one or more" or the term "at least one" can be used interchangeably with "a plurality of".

[0139] Hereinafter, terms to be used in embodiments will be described.

[0140] Encoder: An encoder denotes an apparatus for performing encoding. That is, an encoder can mean an encoding device.

[0141] Decoder: A decoder denotes an apparatus for performing decoding. That is, a decoder can mean a decoding device.

[0142] Unit: A unit can mean a unit of image encoding and decoding. The terms "unit" and "block" can be used with the same meaning and can be used interchangeably with each other.

[0143] - A unit can be an MxN array of samples. Each of M and N can be a positive integer. A unit can generally mean a sample array in a two-dimensional form.

[0144] - In encoding and decoding of an image, a "unit" can be a region generated by partitioning one image. In other words, a "unit" can be a region designated in one image. A single image can be partitioned into a plurality of units. Alternatively, one image can be partitioned into subparts, and a unit can mean each partitioned subpart when encoding or decoding is performed on the partitioned subparts.

[0145] - In encoding and decoding of an image, a predefined process can be performed on each unit according to a type of the unit.

[0146] - According to a function, a unit type can be classified as a macro unit, a coding unit (CU), a prediction unit (PU), a residual unit, a transform unit (TU), etc. Alternatively, according to a function, a unit can mean a block, a macroblock, a coding tree unit, a coding tree block, a coding unit, a coding block, a prediction unit, a prediction block, a residual unit, a residual block, a transform unit, a transform block, etc. For example, a target unit, which is a target of encoding and / or decoding, can be at least one of a CU, a PU, a residual unit, and a TU.

[0147] - The term "unit" can mean information including a block of a luma component, a block of a chroma component corresponding to the block of the luma component, and syntax elements for the respective blocks, such that the unit is designated to be distinguished from the blocks.

[0148] - A size and a shape of a unit can be implemented in various ways. Also, a unit can have any one of various sizes and shapes. In particular, a shape of a unit can include not only a square but also geometric figures that can be expressed in two dimensions (2D), such as a rectangle, a trapezoid, a triangle, and a pentagon.

[0149] - Also, unit information can include one or more of a type of a unit, a size of a unit, a depth of a unit, an encoding order of a unit, and a decoding order of a unit, etc. For example, a type of a unit can indicate one of a CU, a PU, a residual unit, and a TU.

[0150] - One unit can be partitioned into sub-units, each of which has a size smaller than that of the related unit.

[0151] Depth: Depth can mean the degree to which a unit is partitioned. Also, the depth of a unit can indicate the level at which the corresponding unit exists when the unit(s) is represented by a tree structure.

[0152] - The unit partition information can include a depth indicating the depth of the unit. The depth can indicate the number of times the unit is partitioned and / or the degree to which the unit is partitioned.

[0153] - In the tree structure, the root node can be considered to have the minimum depth, and the leaf node can be considered to have the maximum depth. The root node can be the highest (top) node. The leaf node can be the lowest node.

[0154] - A single unit can be hierarchically partitioned into a plurality of sub-units while having depth information based on a tree structure. In other words, the unit and the sub-units generated by partitioning the unit can correspond to nodes and child nodes of the nodes, respectively. Each of the partitioned sub-units can have a unit depth. Since the depth indicates the number of times the unit is partitioned and / or the degree to which the unit is partitioned, the partition information of the sub-units can include information about the size of the sub-units.

[0155] - In the tree structure, the top node can correspond to an initial node before partitioning. The top node can be referred to as a "root node". Also, the root node can have a minimum depth value. Here, the top node can have a depth of level "0".

[0156] - A node having a depth of level "1" can represent a unit generated when the initial unit is partitioned once. A node having a depth of level "2" can represent a unit generated when the initial unit is partitioned twice.

[0157] - A leaf node having a depth of level "n" can represent a unit generated when the initial unit has been partitioned n times.

[0158] - The leaf node can be a bottom node that cannot be further partitioned. The depth of the leaf node can be a maximum level. For example, a predefined value of the maximum level can be 3.

[0159] - The QT depth can represent a depth for quad-partitioning. The BT depth can represent a depth for binary-partitioning. The TT depth can represent a depth for ternary-partitioning.

[0160] Sample: A sample can be a basic unit constituting a block. Depending on a bit depth (Bd), values from 0 to 2 Bd -1 can represent a sample.

[0161] - The sample can be a pixel or a pixel value.

[0162] - Hereinafter, the terms "pixel" and "sample" can be used as having the same meaning and can be used interchangeably with each other.

[0163] Coding Tree Unit (CTU): A CTU can consist of a single luma component (Y) coding tree block and two chroma component (Cb, Cr) coding tree blocks related to the luma component coding tree block. Further, a CTU can mean information including the above blocks and syntax elements for each of the blocks.

[0164] - Each coding tree unit (CTU) can be partitioned using one or more partitioning methods such as quad tree (QT), binary tree (BT), and ternary tree (TT) in order to configure sub-units such as coding units, prediction units, and transform units. A quad tree can mean a quad-tree. Further, each coding tree unit can be partitioned using multi-type tree (MTT) using one or more partitioning methods.

[0165] - "CTU" can be used as a term designating a pixel block which is a processing unit in an image decoding and encoding process, as in the case of partitioning of an input image.

[0166] Coding Tree Block (CTB): "CTB" can be used as a term designating any one of a Y coding tree block, a Cb coding tree block, and a Cr coding tree block.

[0167] Neighbor block: A neighbor block (or neighboring block) can mean a block adjacent to a target block. A neighbor block can mean a reconstructed neighbor block.

[0168] - Hereinafter, the terms "neighbor block" and "adjacent block" can be used as having the same meaning and can be used interchangeably with each other.

[0169] - A neighbor block can mean a reconstructed neighbor block.

[0170] Spatial neighbor block: A spatial neighbor block can be a block spatially adjacent to a target block. A neighbor block can include a spatial neighbor block.

[0171] - A target block and a spatial neighbor block can be included in a target picture.

[0172] - A spatial neighbor block can mean a block whose boundary is in contact with a target block, or a block located within a predetermined distance from the target block.

[0173] - A spatial neighbor block can mean a block adjacent to a vertex of a target block. Here, a block adjacent to a vertex of a target block can mean a block vertically adjacent to a neighbor block horizontally adjacent to the target block or a block horizontally adjacent to a neighbor block vertically adjacent to the target block.

[0174] Temporal neighbor block: A temporal neighbor block can be a block temporally adjacent to a target block. A neighbor block can include a temporal neighbor block.

[0175] - The temporal neighboring block can include a collocated block (col block).

[0176] - The col block can be a block in a collocated picture (col picture) that is previously reconstructed. The position of the col block in the col picture can correspond to the position of the target block in the target picture. Alternatively, the position of the col block in the col picture can be equal to the position of the target block in the target picture. The col picture can be a picture included in a reference picture list.

[0177] - The temporal neighboring block can be a block that is adjacent in time to a spatial neighboring block of the target block.

[0178] - The prediction mode can be information indicating a mode used for intra prediction, or a mode used for inter prediction.

[0179] - The prediction unit can be a basic unit for prediction such as inter prediction, intra prediction, inter compensation, intra compensation, and motion compensation.

[0180] - A single prediction unit can be divided into a plurality of partitions or sub-prediction units having a smaller size. The plurality of partitions can also be a basic unit in the execution of prediction or compensation. The partitions generated by dividing the prediction unit can also be prediction units.

[0181] - The prediction unit partition can be a shape into which the prediction unit is divided.

[0182] - The reconstructed neighboring unit can be a unit that is already decoded and reconstructed, which is adjacent to the target unit.

[0183] - The reconstructed neighboring unit can be a unit that is adjacent to the target unit in space or adjacent to the target unit in time.

[0184] - The reconstructed spatial neighboring unit can be a unit included in the target picture and already reconstructed through encoding and / or decoding.

[0185] - The reconstructed temporal neighboring unit can be a unit included in a reference picture and already reconstructed through encoding and / or decoding. The position of the reconstructed temporal neighboring unit in the reference picture can be the same as or can correspond to the position of the target unit in the target picture. In addition, the reconstructed temporal neighboring unit can be a block that is adjacent to a corresponding block in the reference picture. Here, the position of the corresponding block in the reference picture can correspond to the position of the target block in the target picture. Here, the fact that the positions of the blocks correspond to each other can mean that the positions of the blocks are the same, can mean that one block is included in the other block, or can mean that one block occupies a specific position in the other block.

[0186] Sub-picture: A picture can be divided into one or more sub-pictures. A sub-picture can consist of one or more parallel block rows and one or more parallel block columns.

[0187] - A sub-picture can be a region in a picture having a square shape or a rectangular (i.e., non-square rectangular) shape. In addition, a sub-picture can include one or more CTUs.

[0188] - A sub-picture can be a rectangular region of one or more slices in a picture.

[0189] - A sub-picture can include one or more parallel blocks, one or more tiles, and / or one or more slices.

[0190] Parallel block: A parallel block can be a region in a picture having a square shape or a rectangular (i.e., non-square rectangular) shape.

[0191] - A parallel block can include one or more CTUs.

[0192] - A parallel block can be partitioned into one or more tiles.

[0193] Tile: A tile can represent one or more CTU rows in a parallel block.

[0194] - A parallel block can be partitioned into one or more tiles. Each tile can include one or more CTU rows.

[0195] - A parallel block that is not partitioned into two parts can also represent a tile.

[0196] Slice: A slice can include one or more parallel blocks in a picture. Alternatively, a slice can include one or more tiles in a parallel block.

[0197] - A sub-picture can contain one or more slices that collectively cover a rectangular region of a picture. Thus, each sub-picture boundary is also always a slice boundary, and each vertical sub-picture boundary is also always a vertical parallel block boundary.

[0198] Parameter set: A parameter set can correspond to header information in an internal structure of a bitstream.

[0199] A parameter set can include at least one of a video parameter set (VPS), a sequence parameter set (SPS), a picture parameter set (PPS), an adaptation parameter set (APS), a decoding parameter set (DPS), and / or the like.

[0200] - The information signaled by each parameter set can be applied to pictures referring to the corresponding parameter set. For example, the information in a VPS can be applied to pictures referring to the VPS. The information in an SPS can be applied to pictures referring to the SPS. The information in a PPS can be applied to pictures referring to the PPS.

[0201] - Each parameter set can refer to a higher parameter set. For example, a PPS can refer to an SPS. An SPS can refer to a VPS.

[0202] - In addition, a parameter set can include a parallel block group, a slice header information, and a parallel block header information. A parallel block group can be a group including a plurality of parallel blocks. In addition, the meaning of "parallel block group" can be the same as the meaning of "slice".

[0203] Rate-distortion optimization: An encoding device can use rate-distortion optimization in order to provide high coding efficiency by utilizing a combination of a size of a coding unit (CU), a prediction mode, a size of a prediction unit (PU), motion information, and a size of a transform unit (TU).

[0204] - A rate-distortion optimization scheme can calculate a rate-distortion cost of each combination in order to select an optimal combination from the combinations. The rate-distortion cost can be calculated using the equation "D + ( × R )". Generally, a combination that can minimize the rate-distortion cost can be selected as an optimal combination in the rate-distortion optimization scheme.

[0205] - D can represent distortion. D can be a mean of squares of differences between original transform coefficients and reconstructed transform coefficients in a transform unit (i.e., mean square error).

[0206] - R can represent rate, which can represent a bit rate using relevant context information.

[0207] - λ represents a Lagrange multiplier. R can include not only coding parameter information such as a prediction mode, motion information, and a coding block flag, but also bits generated due to encoding of transform coefficients.

[0208] - An encoding device can perform processes such as inter prediction and / or intra prediction, transform, quantization, entropy encoding, inverse quantization (dequantization), and / or inverse transform in order to calculate accurate D and R. These processes can greatly increase the complexity of the encoding device.

[0209] - Bitstream: A bitstream can represent a stream including bits of encoded image information.

[0210] Parsing: Parsing can be a decision of values of syntax elements made by performing entropy decoding on a bitstream. Alternatively, the term "parsing" can mean the entropy decoding itself.

[0211] Symbol: A symbol can be at least one of a syntax element, a coding parameter, and a transform coefficient of a coding target unit and / or a decoding target unit. In addition, a symbol can be a target of entropy coding or a result of entropy decoding.

[0212] Reference picture: A reference picture can be an image referred by a unit to perform inter prediction or motion compensation. Alternatively, a reference picture can be an image including a reference unit referred by a target unit to perform inter prediction or motion compensation.

[0213] Hereinafter, the terms "reference picture" and "reference image" can be used with the same meaning and can be used interchangeably with each other.

[0214] Reference picture list: A reference picture list can be a list including one or more reference pictures for inter prediction or motion compensation.

[0215] - A type of a reference picture list can include a list combination (LC), a list 0 (L0), a list 1 (L1), a list 2 (L2), a list 3 (L3), etc.

[0216] - For inter prediction, one or more reference picture lists can be used.

[0217] Inter prediction indicator: An inter prediction indicator can indicate an inter prediction direction for a target unit. Inter prediction can be one of a uni-prediction and a bi-prediction. Alternatively, an inter prediction indicator can represent a number of reference pictures used to generate a prediction unit of a target unit. Alternatively, an inter prediction indicator can represent a number of prediction blocks used for inter prediction or motion compensation of a target unit.

[0218] Prediction list utilization flag: A prediction list utilization flag can indicate whether at least one reference picture in a specific reference picture list is used to generate a prediction unit.

[0219] - A prediction list utilization flag can be used to derive an inter prediction indicator. Conversely, an inter prediction indicator can be used to derive a prediction list utilization flag. For example, a case where a prediction list utilization flag indicates "0" as a first value can indicate that a prediction block is not generated using a reference picture in a reference picture list for a target unit. A case where a prediction list utilization flag indicates "1" as a second value can indicate that a prediction unit is generated using a reference picture list for a target unit.

[0220] Reference picture index: A reference picture index can be an index indicating a specific reference picture in a reference picture list.

[0221] Picture order count (POC): A POC value of a picture can represent an order in which a corresponding picture is displayed.

[0222] Motion Vector (MV): A motion vector can be a 2D vector used for inter prediction or motion compensation. A motion vector can mean a shift between a target picture and a reference picture.

[0223] - For example, an MV can be expressed in a form such as (mv x , mv y ). mv x may indicate a horizontal component, and mv y may indicate a vertical component.

[0224] - Search Range: A search range can be a 2D region in which a search for an MV is performed during inter prediction. For example, a size of a search range can be MxN. M and N can be respective positive integers.

[0225] Motion Vector Candidate: A motion vector candidate can be a block that is a prediction candidate when a motion vector is predicted or a motion vector of a block that is a prediction candidate.

[0226] - A motion vector candidate can be included in a motion vector candidate list.

[0227] Motion Vector Candidate List: A motion vector candidate list can be a list configured using one or more motion vector candidates.

[0228] Motion Vector Candidate Index: A motion vector candidate index can be an indicator for indicating a motion vector candidate in a motion vector candidate list. Alternatively, a motion vector candidate index can be an index of a motion vector predictor.

[0229] Motion Information: Motion information can be information including at least one of a reference picture list, a reference picture, a motion vector candidate, a motion vector candidate index, a merge candidate, and a merge index, and a motion vector, a reference picture index, and an inter prediction indicator.

[0230] Merge Candidate List: A merge candidate list can be a list configured using one or more merge candidates.

[0231] Merge Candidate: A merge candidate can be a spatial merge candidate, a temporal merge candidate, a combined merge candidate, a combined bi-predictive merge candidate, a history-based candidate, a candidate based on an average of two candidates, a zero merge candidate, etc. A merge candidate can include an inter prediction indicator, and can include motion information such as prediction type information, a reference picture index of each list, a motion vector, a prediction list utilization flag, and an inter prediction indicator.

[0232] Merge Index: A merge index can be an indicator for indicating a merge candidate in a merge candidate list.

[0233] - The merge index can indicate a reconstructed unit for deriving a merge candidate between a reconstructed unit adjacent to the target unit in a spatial direction and a reconstructed unit adjacent to the target unit in a temporal direction.

[0234] - The merge index can indicate at least one of a plurality of pieces of motion information of the merge candidate.

[0235] Transform unit: A transform unit can be a basic unit of residual signal encoding and / or residual signal decoding (such as transform, inverse transform, quantization, inverse quantization, transform coefficient encoding, and transform coefficient decoding). A single transform unit can be partitioned into a plurality of sub-transform units having a smaller size. Here, the transform can include one or more of a primary transform and a secondary transform, and the inverse transform can include one or more of a primary inverse transform and a secondary inverse transform.

[0236] Scaling: Scaling can mean a process for multiplying a factor to a transform coefficient level.

[0237] - As a result of scaling of the transform coefficient level, a transform coefficient can be generated. Scaling can also be referred to as "dequantization".

[0238] Quantization parameter (QP): A quantization parameter can be a value used to generate a transform coefficient level for a transform coefficient in quantization. Alternatively, the quantization parameter can also be a value used to generate a transform coefficient by scaling a transform coefficient level in dequantization. Alternatively, the quantization parameter can be a value mapped to a quantization step size.

[0239] Delta quantization parameter: A delta quantization parameter can mean a difference value between a predicted quantization parameter and a quantization parameter of a target unit.

[0240] Scan: Scan can mean a method for aligning the order of coefficients in a unit, a block, or a matrix. For example, a method for aligning a 2D array in the form of a 1D array can be referred to as "scan". Alternatively, a method for aligning a 1D array in the form of a 2D array can also be referred to as "scan" or "inverse scan".

[0241] Transform coefficient: A transform coefficient can be a coefficient value generated when a coding device performs a transform. Alternatively, a transform coefficient can be a coefficient value generated when a decoding device performs at least one of entropy decoding and inverse quantization.

[0242] - A quantization level or a quantized transform coefficient level generated by applying quantization to a transform coefficient or a residual signal can also be included in the meaning of the term "transform coefficient".

[0243] Quantization level: A quantization level can be a value generated when a coding device performs quantization on a transform coefficient or a residual signal. Alternatively, a quantization level can be a value targeted for inverse quantization when a decoding device performs inverse quantization.

[0244] - Quantized transform coefficient levels resulting from the transform and quantization can also be included in the meaning of quantized levels.

[0245] Non-zero transform coefficient: A non-zero transform coefficient can be a transform coefficient having a value other than 0 or a transform coefficient level having a value other than 0. Alternatively, a non-zero transform coefficient can be a transform coefficient whose value has a magnitude other than 0 or a transform coefficient level whose value has a magnitude other than 0.

[0246] Quantization matrix: A quantization matrix can be a matrix used in a quantization process or a dequantization process to improve subjective image quality or objective image quality of an image. The quantization matrix can also be referred to as a "scaling list".

[0247] Quantization matrix coefficient: A quantization matrix coefficient can be each element in a quantization matrix. The quantization matrix coefficient can also be referred to as a "matrix coefficient".

[0248] Default matrix: A default matrix can be a quantization matrix predefined by an encoding apparatus and a decoding apparatus.

[0249] Non-default matrix: A non-default matrix can be a quantization matrix not predefined by an encoding apparatus and a decoding apparatus. The non-default matrix can mean a quantization matrix signaled from the encoding apparatus to the decoding apparatus by a user.

[0250] Most probable mode (MPM): The MPM can mean an intra prediction mode having a high probability of being used for intra prediction of a target block.

[0251] - The encoding apparatus and the decoding apparatus can determine one or more MPMs based on an encoding parameter related to the target block and an attribute of an entity related to the target block.

[0252] - The encoding apparatus and the decoding apparatus can determine one or more MPMs based on an intra prediction mode of a reference block. The reference block can include a plurality of reference blocks. The plurality of reference blocks can include a spatial neighboring block adjacent to a left side of the target block and a spatial neighboring block adjacent to a top of the target block. In other words, depending on which intra prediction modes have been used for the reference blocks, one or more different MPMs can be determined.

[0253] - One or more MPMs can be determined in the same way in the encoding apparatus and the decoding apparatus. That is, the encoding apparatus and the decoding apparatus can share the same MPM list including one or more MPMs.

[0254] MPM list: The MPM list can be a list including one or more MPMs. The number of one or more MPMs in the MPM list can be predefined.

[0255] MPM indicator: An MPM indicator can indicate an MPM among one or more MPMs in an MPM list to be used for intra prediction of a target block. For example, the MPM indicator can be an index to the MPM list.

[0256] - Since the MPM list is determined in the same way in the encoding device and the decoding device, it can not be necessary to transmit the MPM list itself from the encoding device to the decoding device.

[0257] - An MPM indicator can be signaled from the encoding device to the decoding device. When the MPM indicator is signaled, the decoding device can determine an MPM among the MPMs in the MPM list to be used for intra prediction of a target block.

[0258] MPM usage indicator: An MPM usage indicator can indicate whether an MPM usage mode is to be used for prediction of a target block. The MPM usage mode can be a mode of using the MPM list to determine an MPM to be used for intra prediction of a target block.

[0259] - An MPM usage indicator can be signaled from the encoding device to the decoding device.

[0260] Signaling: Signaling can mean that information is transmitted from an encoding device to a decoding device. Alternatively, signaling can mean that information is included in a bitstream or a recording medium by an encoding device. Information signaled by an encoding device can be used by a decoding device.

[0261] - An encoding device can generate encoded information by performing encoding on information to be signaled. The encoded information can be transmitted from the encoding device to the decoding device. The decoding device can obtain the information by decoding the transmitted encoded information. Here, the encoding can be entropy encoding, and the decoding can be entropy decoding.

[0262] Selective signaling: Information can be selectively signaled. Selective signaling of information can mean that an encoding device selectively includes information in a bitstream or a recording medium (according to a certain condition). Selective signaling of information can mean that a decoding device selectively extracts information from a bitstream (according to a certain condition).

[0263] Omission of signaling: Signaling of information can be omitted. Omission of signaling of information can mean that an encoding device does not include information in a bitstream or a recording medium (according to a certain condition). Omission of signaling of information can mean that a decoding device does not extract information from a bitstream (according to a certain condition).

[0264] Statistical value: A variable, an encoding parameter, a constant, etc. can have a computable value. The statistical value can be a value generated by performing a calculation (operation) on a value of a designated target. For example, the statistical value can indicate one or more of an average value, a weighted average value, a weighted sum, a minimum value, a maximum value, a modulo value, a median value, and an interpolation value of a value of a particular variable, a particular encoding parameter, a particular constant, etc.

[0265] Figure 1 FIG. 1 is a block diagram illustrating a configuration of an encoding apparatus according to an embodiment of the disclosure.

[0266] The encoding apparatus 100 can be an encoder, a video encoding apparatus, or an image encoding apparatus. A video can include one or more images. The encoding apparatus 100 can sequentially encode one or more images of the video.

[0267] Referring to Figure 1 The encoding apparatus 100 includes an inter prediction unit 110, an intra prediction unit 120, a switch 115, a subtractor 125, a transform unit 130, a quantization unit 140, an entropy encoding unit 150, a dequantization unit 160, an inverse transform unit 170, an adder 175, a filter unit 180, and a reference picture buffer 190.

[0268] The encoding apparatus 100 can perform encoding on a target image using an intra mode and / or an inter mode. In other words, a prediction mode for a target block can be one of an intra mode and an inter mode.

[0269] Hereinafter, the terms "intra mode", "intra prediction mode", "in-picture mode", and "in-picture prediction mode" can be used to have the same meaning and can be used interchangeably with each other.

[0270] Hereinafter, the terms "inter mode", "inter prediction mode", "inter-picture mode", and "inter-picture prediction mode" can be used to have the same meaning and can be used interchangeably with each other.

[0271] Hereinafter, the term "image" can indicate only a part of an image, or can indicate a block. In addition, processing of an "image" can indicate sequential processing of a plurality of blocks.

[0272] In addition, the encoding apparatus 100 can generate a bitstream including encoding information via encoding of a target image, and can output and store the generated bitstream. The generated bitstream can be stored in a computer-readable storage medium and can be streamed through a wired and / or wireless transmission medium.

[0273] When the intra mode is used as a prediction mode, the switch 115 can be switched to the intra mode. When the inter mode is used as a prediction mode, the switch 115 can be switched to the inter mode.

[0274] The encoding apparatus 100 can generate a prediction block of the target block. Further, after generating the prediction block, the encoding apparatus 100 can encode a residual block of the target block using a residual between the target block and the prediction block.

[0275] When the prediction mode is the intra mode, the intra prediction unit 120 can use pixels of previously encoded / decoded neighboring blocks adjacent to the target block as reference samples. The intra prediction unit 120 can perform spatial prediction on the target block using the reference samples, and can generate prediction samples for the target block via the spatial prediction. The prediction samples can mean samples in the prediction block.

[0276] The inter prediction unit 110 can include a motion prediction unit and a motion compensation unit.

[0277] When the prediction mode is the inter mode, the motion prediction unit can search for a region that most closely matches the target block in a reference image in a motion prediction process, and can derive a motion vector for the target block and the found region based on the found region. Here, the motion prediction unit can use a search range as a target region for the search.

[0278] The reference image can be stored in the reference picture buffer 190. More specifically, when encoding and / or decoding of the reference image has been processed, the encoded and / or decoded reference image can be stored in the reference picture buffer 190.

[0279] Since the decoded picture is stored, the reference picture buffer 190 can be a decoded picture buffer (DPB).

[0280] The motion compensation unit can generate a prediction block for the target block by performing motion compensation using the motion vector. Here, the motion vector can be a two-dimensional (2D) vector for inter prediction. Further, the motion vector can indicate an offset between the target image and the reference image.

[0281] When the motion vector has a value other than an integer, the motion prediction unit and the motion compensation unit can generate the prediction block by applying an interpolation filter to a partial region of the reference image. To perform inter prediction or motion compensation, it can be determined which one of a skip mode, a merge mode, an advanced motion vector prediction (AMVP) mode, and a current picture reference mode corresponds to a method for predicting and compensating for motion of a PU included in a CU based on the CU, and inter prediction or motion compensation can be performed according to the mode.

[0282] The subtracter 125 can generate a residual block, which is a difference between the target block and the prediction block. The residual block can also be referred to as a "residual signal".

[0283] The residual signal can be a difference between the original signal and the prediction signal. Alternatively, the residual signal can be a signal generated by transforming or quantizing a difference between the original signal and the prediction signal or by transforming and quantizing the difference. The residual block can be a residual signal for a block unit.

[0284] The transformation unit 130 can generate transform coefficients by transforming the residual block, and can output the generated transform coefficients. Here, the transform coefficients can be coefficient values generated by transforming the residual block.

[0285] The transformation unit 130 can use one of a plurality of predefined transformation methods when performing the transformation.

[0286] The plurality of predefined transformation methods can include a discrete cosine transform (DCT), a discrete sine transform (DST), a Karhunen-Loeve transform (KLT), etc.

[0287] The transformation method for transforming the residual block can be determined according to at least one of the encoding parameters for the target block and / or the neighboring block. For example, the transformation method can be determined based on at least one of an inter prediction mode for the PU, an intra prediction mode for the PU, a size of the TU, and a shape of the TU. Alternatively, transformation information indicating the transformation method can be signaled from the encoding device 100 to the decoding device 200.

[0288] When the transform skip mode is used, the transformation unit 130 can omit the transformation of the residual block.

[0289] By applying quantization to the transform coefficients, a quantized transform coefficient level or a quantized level can be generated. Hereinafter, in embodiments, each of the quantized transform coefficient level and the quantized level can also be referred to as a "transform coefficient".

[0290] The quantization unit 140 can generate a quantized transform coefficient level (i.e., a quantized level or a quantized coefficient) by quantizing the transform coefficients according to a quantization parameter. The quantization unit 140 can output the generated quantized transform coefficient level. In this case, the quantization unit 140 can quantize the transform coefficients using a quantization matrix.

[0291] The entropy encoding unit 150 can generate a bitstream by performing probability distribution-based entropy encoding based on values calculated by the quantization unit 140 and / or encoding parameter values calculated in the encoding process. The entropy encoding unit 150 can output the generated bitstream.

[0292] The entropy encoding unit 150 can perform entropy encoding on information about pixels of an image and information required to decode the image. For example, the information required to decode the image can include a syntax element, etc.

[0293] When entropy coding is applied, fewer bits can be allocated to more frequently occurring symbols, and more bits can be allocated to less frequently occurring symbols. Since symbols are represented by the allocation, the size of the bit string of the target symbol to be coded can be reduced. Accordingly, the compression performance of video coding can be improved by entropy coding.

[0294] Furthermore, for entropy coding, the entropy coding unit 150 can use an encoding method such as exponential Golomb, context adaptive variable length coding (CAVLC), or context adaptive binary arithmetic coding (CABAC). For example, the entropy coding unit 150 can perform entropy coding using a variable length coding / code (VLC) table. For example, the entropy coding unit 150 can derive a binarization method for a target symbol. Furthermore, the entropy coding unit 150 can derive a probability model for a target symbol / bin. The entropy coding unit 150 can perform arithmetic coding using the derived binarization method, probability model, and context model.

[0295] The entropy coding unit 150 can transform coefficients in the form of a 2D block into the form of a 1D vector through a transform coefficient scanning method, in order to encode quantized transform coefficient levels.

[0296] The coding parameters can be information required for encoding and / or decoding. The coding parameters can include information encoded by the encoding device 100 and transmitted from the encoding device 100 to the decoding device, and can also include information that can be derived in the encoding or decoding process. For example, the information transmitted to the decoding device can include syntax elements.

[0297] The coding parameters can include not only information (or flags or indices) coded by the encoding device and signaled to the decoding device, such as syntax elements, but also information derived in the encoding or decoding process. Furthermore, the coding parameters can include information required for encoding or decoding an image. For example, the coding parameters can include at least one value, combination, or statistic of the following: size of a unit / block, shape / form of a unit / block, depth of a unit / block, partition information of a unit / block, partition structure of a unit / block, information indicating whether a unit / block is partitioned in a quad-tree structure, information indicating whether a unit / block is partitioned in a binary-tree structure, partition direction (horizontal or vertical) of a binary-tree structure, partition form (symmetric partition or asymmetric partition) of a binary-tree structure, information indicating whether a unit / block is partitioned in a ternary-tree structure, partition direction (horizontal or vertical) of a ternary-tree structure, partition form (symmetric partition or asymmetric partition, etc.) of a ternary-tree structure, information indicating whether a unit / block is partitioned in a multi-type tree structure, combination and direction (horizontal or vertical, etc.) of partitioning of a multi-type tree structure, partition form (symmetric partition or asymmetric partition, etc.) of a multi-type tree structure, partition tree (binary tree or ternary tree) of a multi-type tree form, type of prediction (intra prediction or inter prediction), intra prediction mode / direction, intra luma prediction mode / direction, intra chroma prediction mode / direction, intra partition information, inter partition information, coding block partition flag, prediction block partition flag, transform block partition flag, reference sample filtering method, reference sample filter tap, reference sample filter coefficient, prediction block filtering method, prediction block filter tap, prediction block filter coefficient, prediction block boundary filtering method, prediction block boundary filter tap, prediction block boundary filter coefficient, inter prediction mode, motion information, motion vector, motion vector difference, reference picture index, inter prediction direction, inter prediction indicator, prediction list utilization flag, reference picture list, reference image, POC, motion vector predictor, motion vector prediction index, motion vector prediction candidate, motion vector candidate list, information indicating whether to use merge mode, merge index, merge candidate, merge candidate list, information indicating whether to use skip mode, type of interpolation filter, tap of interpolation filter, filter coefficient of interpolation filter, size of motion vector, precision of motion vector representation, transform type, transform size, information indicating whether to use first transform, information indicating whether to use additional (secondary) transform, first transform selection information (or first transform index), secondary transform selection information (or secondary transform index), information indicating presence or absence of residual signal, coding block mode, coding block flag, quantization parameter, residual quantization parameter, quantization matrix, information about in-loop filter, information indicating whether to apply in-loop filter, coefficient of in-loop filter, tap of in-loop filter, shape / form of in-loop filter, information indicating whether to apply deblocking filter, coefficient of deblocking filter,Tap of deblocking filter, strength of deblocking filter, shape / form of deblocking filter, information indicating whether to apply adaptive sample offset, value of adaptive sample offset, category of adaptive sample offset, type of adaptive sample offset, information indicating whether to apply adaptive in-loop filter, coefficient of adaptive in-loop filter, tap of adaptive in-loop filter, shape / form of adaptive in-loop filter, binarization / debinarization method, context model, context model determination method, context model update method, information indicating whether to perform regular mode, information whether to perform bypass mode, significant coefficient flag, last significant coefficient flag, coding flag for coefficient group, position of last significant coefficient, information indicating whether value of coefficient is greater than 1, information indicating whether value of coefficient is greater than 2, information indicating whether value of coefficient is greater than 3, residual coefficient value information, sign information, reconstructed luma sample, reconstructed chroma sample, context bin, bypass bin, residual luma sample, residual chroma sample, transform coefficient, luma transform coefficient, chroma transform coefficient, quantization level, luma quantization level, chroma quantization level, transform coefficient level, transform coefficient level scanning method, size of motion vector search region on decoder side, shape / form of motion vector search region on decoder side, number of motion vector searches on decoder side, size of CTU, minimum block size, maximum block size, maximum block depth, minimum block depth, picture display / output order, slice identification information, slice type, slice partition information, parallel tile group identification information, parallel tile group type, parallel tile group partition information, parallel tile identification information, parallel tile type, parallel tile partition information, picture type, bit depth, input sample bit depth, reconstructed sample bit depth, residual sample bit depth, transform coefficient bit depth, quantization level bit depth, information on luma signal, information on chroma signal, color space of target block and color space of residual block. Furthermore, the above-mentioned encoding parameter related information can be included in the encoding parameter. Information used for calculating and / or deriving the above-mentioned encoding parameter can be included in the encoding parameter. Information calculated or derived using the above-mentioned encoding parameter can be included in the encoding parameter.

[0298] The first transform selection information can indicate a first transform applied to the target block.

[0299] The secondary transform selection information can indicate a secondary transform applied to the target block.

[0300] The residual signal can represent a difference between the original signal and the prediction signal. Alternatively, the residual signal can be a signal generated by transforming a difference between the original signal and the prediction signal. Alternatively, the residual signal can be a signal generated by transforming and quantizing a difference between the original signal and the prediction signal. The residual block can be a residual signal of a block.

[0301] Here, signaling information can mean that the encoding apparatus 100 includes entropy coded information generated by performing entropy coding on a flag or an index in a bitstream, and the decoding apparatus 200 acquires information by performing entropy decoding on the entropy coded information extracted from the bitstream. Here, the information can include a flag, an index, or the like.

[0302] A signal can mean information to be signaled. Hereinafter, information for an image and a block can be referred to as a signal. Also, hereinafter, the terms "information" and "signal" can be used as having the same meaning, and can be used interchangeably with each other. For example, a certain signal can be a signal representing a certain block. An original signal can be a signal representing a target block. A prediction signal can be a signal representing a prediction block. A residual signal can be a signal representing a residual block.

[0303] A bitstream can include information based on a certain syntax. The encoding apparatus 100 can generate a bitstream including information according to the certain syntax. The decoding apparatus 200 can acquire information from a bitstream according to the certain syntax.

[0304] Since the encoding apparatus 100 performs encoding via inter prediction, an encoded target image can be used as a reference image for another image(s) to be processed later. Accordingly, the encoding apparatus 100 can reconstruct or decode the encoded target image, and store the reconstructed or decoded image in the reference picture buffer 190 as a reference image. For decoding, inverse quantization and inverse transformation on the encoded target image can be processed.

[0305] A quantization level can be inverse quantized by the inverse quantization unit 160, and can be inverse transformed by the inverse transformation unit 170. The inverse quantization unit 160 can generate inverse quantized coefficients by performing inverse quantization on the quantization level. The inverse transformation unit 170 can generate inverse quantized and inverse transformed coefficients by performing inverse transformation on the inverse quantized coefficients.

[0306] The inverse quantized and inverse transformed coefficients can be added to a prediction block by the adder 175. The inverse quantized and inverse transformed coefficients are added to the prediction block, and then a reconstructed block can be generated. Here, the inverse quantized and / or inverse transformed coefficients can mean coefficients on which one or more of inverse quantization and inverse transformation are performed, and can also mean a reconstructed residual block. Here, the reconstructed block can mean a restored block or a decoded block.

[0307] The reconstructed block can be filtered by the filter unit 180. The filter unit 180 can apply one or more of a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), and a non-local filter (NLF) to a reconstructed sample, a reconstructed block, or a reconstructed picture. The filter unit 180 can also be referred to as an "in-loop filter."

[0308] A deblocking filter can remove blocking distortion occurring at boundaries between blocks in a reconstructed picture. To determine whether to apply a deblocking filter, a number of rows or columns included in a block and including a pixel(s) for determining whether to apply a deblocking filter to a target block can be decided.

[0309] When a deblocking filter is applied to a target block, the applied filter can differ according to the strength of deblocking filtering required. In other words, among different filters, a filter decided considering the strength of deblocking filtering can be applied to a target block. When a deblocking filter is applied to a target block, one or more filters among a long tap filter, a strong filter, a weak filter, and a Gaussian filter can be applied to the target block according to the strength of deblocking filtering required.

[0310] In addition, when vertical filtering and horizontal filtering are performed on a target block, horizontal filtering and vertical filtering can be processed in parallel.

[0311] SAO can add a suitable offset to a value of a pixel to compensate for encoding error. SAO can perform correction using an offset of a difference between an original image and a deblocked image on a pixel basis for an image to which deblocking is applied. To perform offset correction on an image, a method for dividing pixels included in an image into a certain number of regions, determining a region to which an offset is to be applied among the divided regions, and applying an offset to the determined region can be used, and a method for applying an offset considering edge information of each pixel can also be used.

[0312] ALF can perform filtering based on a value obtained by comparing a reconstructed image with an original image. After pixels included in an image have been divided into a predetermined number of groups, a filter to be applied to each group can be determined, and filtering can be performed differently for each group. Information related to whether to apply an adaptive loop filter can be signaled for each CU. Such information can be signaled for a luma signal. The shape of an ALF to be applied to each block and filter coefficients can differ for each block. Alternatively, an ALF having a fixed form can be applied to a block regardless of the characteristics of the block.

[0313] A non-local filter can perform filtering based on a reconstructed block similar to a target block. A region similar to a target block can be selected from a reconstructed picture, and filtering of the target block can be performed using statistical properties of the selected similar region. Information about whether to apply a non-local filter can be signaled for a coding unit (CU). Further, the shape of a non-local filter to be applied to a block and filter coefficients can differ according to the block.

[0314] The reconstructed block or the reconstructed picture filtered by the filter unit 180 can be stored in the reference picture buffer 190 as a reference picture. The reconstructed block filtered by the filter unit 180 can be a part of the reference picture. In other words, the reference picture can be a reconstructed picture composed of the reconstructed blocks filtered by the filter unit 180. The stored reference picture can be subsequently used for inter prediction or motion compensation.

[0315] Figure 2 FIG. 1 is a block diagram illustrating a configuration of an encoding apparatus according to an embodiment of the disclosure.

[0316] The decoding apparatus 200 can be a decoder, a video decoding apparatus, or an image decoding apparatus.

[0317] Referring to Figure 2 The decoding apparatus 200 can include an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra prediction unit 240, an inter prediction unit 250, a switch 245, an adder 255, a filter unit 260, and a reference picture buffer 270.

[0318] The decoding apparatus 200 can receive a bitstream output from the encoding apparatus 100. The decoding apparatus 200 can receive a bitstream stored in a computer-readable storage medium, and can receive a bitstream streamed through a wired / wireless transmission medium.

[0319] The decoding apparatus 200 can perform decoding on the bitstream in an intra mode and / or an inter mode. Also, the decoding apparatus 200 can generate a reconstructed picture or a decoded picture via decoding, and can output the reconstructed picture or the decoded picture.

[0320] For example, switching to the intra mode or the inter mode based on the prediction mode for decoding can be performed by the switch 245. When the prediction mode for decoding is the intra mode, the switch 245 can be operated to switch to the intra mode. When the prediction mode for decoding is the inter mode, the switch 245 can be operated to switch to the inter mode.

[0321] The decoding apparatus 200 can acquire a reconstructed residual block by decoding the input bitstream, and can generate a prediction block. When the reconstructed residual block and the prediction block are acquired, the decoding apparatus 200 can generate a reconstructed block, which is a target to be decoded, by adding the reconstructed residual block and the prediction block.

[0322] The entropy decoding unit 210 can generate a symbol by performing entropy decoding on the bitstream based on a probability distribution of the bitstream. The generated symbol can include a symbol in the form of a quantized transform coefficient level (i.e., a quantized level or a quantized coefficient). Here, the entropy decoding method can be similar to the above-described entropy encoding method. That is, the entropy decoding method can be an inverse process of the above-described entropy encoding method.

[0323] The entropy decoding unit 210 can change the coefficients having a one-dimensional (1D) vector form into a 2D block shape by a transform coefficient scanning method, in order to decode quantized transform coefficient levels.

[0324] For example, the coefficients of a block can be changed into a 2D block shape by scanning the block coefficients using a right-up diagonal scanning. Alternatively, which one of the right-up diagonal scanning, vertical scanning, and horizontal scanning will be used can be determined according to a size of a corresponding block and / or an intra prediction mode.

[0325] The quantized coefficients can be inverse quantized by the inverse quantization unit 220. The inverse quantization unit 220 can generate inverse quantized coefficients by performing inverse quantization on the quantized coefficients. Further, the inverse quantized coefficients can be inverse transformed by the inverse transform unit 230. The inverse transform unit 230 can generate a reconstructed residual block by performing inverse transform on the inverse quantized coefficients. As a result of performing inverse quantization and inverse transform on the quantized coefficients, the reconstructed residual block can be generated. Here, the inverse quantization unit 220 can apply a quantization matrix to the quantized coefficients when generating the reconstructed residual block.

[0326] When the intra mode is used, the intra prediction unit 240 can generate a prediction block by performing spatial prediction using pixel values of previously decoded neighboring blocks adjacent to the target block for the target block.

[0327] The inter prediction unit 250 can include a motion compensation unit. Alternatively, the inter prediction unit 250 can be designated as a "motion compensation unit".

[0328] When the inter mode is used, the motion compensation unit can generate a prediction block by performing motion compensation using a motion vector and a reference image stored in the reference picture buffer 270 for the target block.

[0329] The motion compensation unit can apply an interpolation filter to a partial region of the reference image when the motion vector has a value other than an integer, and can generate the prediction block using the reference image to which the interpolation filter is applied. To perform the motion compensation, the motion compensation unit can determine which one of a skip mode, a merge mode, an advanced motion vector prediction (AMVP) mode, and a current picture reference mode corresponds to a motion compensation method used for a PU included in a CU based on the CU, and can perform the motion compensation according to the determined mode.

[0330] The reconstructed residual block and the prediction block can be added to each other by the adder 255. The adder 255 can generate a reconstructed block by adding the reconstructed residual block and the prediction block.

[0331] The reconstructed blocks can be filtered by the filter unit 260. The filter unit 260 can apply at least one of a deblocking filter, an SAO filter, an ALF, and an NLF to the reconstructed blocks or the reconstructed picture. The reconstructed picture can be a picture including the reconstructed blocks.

[0332] The filter unit can output the reconstructed picture.

[0333] The reconstructed picture and / or the reconstructed blocks filtered by the filter unit 260 can be stored in the reference picture buffer 270 as a reference picture. The reconstructed blocks filtered by the filter unit 260 can be a part of the reference picture. In other words, the reference picture can be a picture composed of the reconstructed blocks filtered by the filter unit 260. The stored reference picture can be subsequently used for inter prediction or motion compensation.

[0334] Figure 3 FIG. 1 is a diagram schematically illustrating a partition structure of a picture when the picture is encoded and decoded.

[0335] Figure 3 An example in which a single unit is partitioned into a plurality of sub-units can be schematically illustrated.

[0336] In order to effectively partition a picture, a coding unit (CU) can be used in encoding and decoding. The term "unit" can be used to collectively designate 1) a block including picture samples and 2) syntax elements. For example, "partitioning of a unit" can mean "partitioning of a block corresponding to the unit."

[0337] The CU can be used as a basic unit for image encoding / decoding. The CU can be used as a unit to which one mode selected from an intra mode and an inter mode is applied in image encoding / decoding. In other words, in image encoding / decoding, which one of the intra mode and the inter mode is applied to each CU can be determined.

[0338] In addition, the CU can be a basic unit in prediction of transform coefficients, transformation, quantization, inverse transformation, dequantization, and encoding / decoding.

[0339] Referring to Figure 3 The picture 300 can be sequentially partitioned into units corresponding to largest coding units (LCUs), and a partition structure can be determined for each LCU. Here, the LCU can be used to have the same meaning as a coding tree unit (CTU).

[0340] The partitioning of a unit can mean partitioning of a block corresponding to the unit. The block partitioning information can include depth information about a depth of the unit. The depth information can indicate a number of times the unit is partitioned and / or a degree to which the unit is partitioned. A single unit can be hierarchically partitioned into a plurality of sub-units with depth information based on a tree structure.

[0341] Each of the sub-units of the partitioning can have depth information. The depth information can be information indicating a size of the CU. The depth information can be stored for each of the CUs.

[0342] Each of the CUs can have depth information. When the CUs are partitioned, the CUs generated by the partitioning can have a depth increased by 1 from the depth of the CUs being partitioned.

[0343] The partitioning structure can mean a distribution of coding units (CUs) in the LCU 310 for efficiently encoding an image. Such a distribution can be determined according to whether a single CU will be partitioned into a plurality of CUs. The number of the CUs generated by the partitioning can be a positive integer of 2 or more, including 2, 3, 4, 8, 16, etc.

[0344] According to the number of the CUs generated by the partitioning, the horizontal size and the vertical size of each of the CUs generated by the partitioning can be smaller than the horizontal size and the vertical size of the CU before being partitioned. For example, the horizontal size and the vertical size of each of the CUs generated by the partitioning can be half of the horizontal size and the vertical size of the CU before being partitioned.

[0345] Each of the partitioned CUs can be recursively partitioned into four CUs in the same manner. Via the recursive partitioning, at least one of the horizontal size and the vertical size of each of the partitioned CUs can be reduced compared to at least one of the horizontal size and the vertical size of the CU before being partitioned.

[0346] The partitioning of the CUs can be recursively performed until a pre-defined depth or a pre-defined size.

[0347] For example, the depth of the CUs can have a value ranging from 0 to 3. According to the depth of the CUs, the size of the CUs can range from a size of 64x64 to a size of 8x8.

[0348] For example, the depth of the LCU 310 can be 0, and the depth of the smallest coding unit (SCU) can be a pre-defined maximum depth. Here, as described above, the LCU can be a CU having a maximum coding unit size, and the SCU can be a CU having a minimum coding unit size.

[0349] The partitioning can start from the LCU 310, and the depth of the CUs can increase by 1 whenever the horizontal and / or vertical size of the CUs is reduced by the partitioning.

[0350] For example, for each depth, a CU not partitioned can have a size of 2Nx2N. Also, in the case where the CU is partitioned, the CU having a size of 2Nx2N can be partitioned into four CUs each having a size of NxN. Whenever the depth increases by 1, the value of N can be halved.

[0351] Referring to Figure 3 An LCU having a depth of 0 can have 64x64 pixels or 64x64 blocks. 0 can be a minimum depth. An SCU having a depth of 3 can have 8x8 pixels or 8x8 blocks. 3 can be a maximum depth. Here, a CU having 64x64 blocks as an LCU can be represented by a depth 0. A CU having 32x32 blocks can be represented by a depth 1. A CU having 16x16 blocks can be represented by a depth 2. A CU having 8x8 blocks as an SCU can be represented by a depth 3.

[0352] Information on whether a corresponding CU is partitioned can be represented by partition information of the CU. The partition information can be 1-bit information. All CUs except for SCUs can include the partition information. For example, a value of the partition information of a CU which is not partitioned can be a first value. A value of the partition information of a CU which is partitioned can be a second value. When the partition information indicates whether the CU is partitioned, the first value can be "0" and the second value can be "1".

[0353] For example, when a single CU is partitioned into four CUs, a horizontal size and a vertical size of each of the four CUs generated by the partitioning can be half of a horizontal size and a vertical size of the CU before being partitioned. When a CU having a 32x32 size is partitioned into four CUs, a size of each of the four partitioned CUs can be 16x16. When a single CU is partitioned into four CUs, it can be considered that the CU has been partitioned in a quad-tree structure. In other words, it can be considered that a quad-tree partitioning has been applied to the CU.

[0354] For example, when a single CU is partitioned into two CUs, a horizontal size or a vertical size of each of the two CUs generated by the partitioning can be half of a horizontal size or a vertical size of the CU before being partitioned. When a CU having a 32x32 size is partitioned into two CUs vertically, a size of each of the two partitioned CUs can be 16x32. When a CU having a 32x32 size is partitioned into two CUs horizontally, a size of each of the two partitioned CUs can be 32x16. When a single CU is partitioned into two CUs, it can be considered that the CU has been partitioned in a binary-tree structure. In other words, it can be considered that a binary-tree partitioning has been applied to the CU.

[0355] For example, when a single CU is partitioned (or split) into three CUs, the original CU before being partitioned is partitioned such that its horizontal size or vertical size is divided in a 1:2:1 ratio, thus enabling three sub-CUs to be generated. For example, when a CU having a size of 16x32 is horizontally partitioned into three sub-CUs, the three sub-CUs generated by the partitioning can have sizes of 16x8, 16x16, and 16x8, respectively, in a direction from top to bottom. For example, when a CU having a size of 32x32 is vertically partitioned into three sub-CUs, the three sub-CUs generated by the partitioning can have sizes of 8x32, 16x32, and 8x32, respectively, in a direction from left to right. When a single CU is partitioned into three CUs, the CU can be considered to be partitioned in a ternary tree form. In other words, it can be considered that ternary tree partitioning has been applied to the CU.

[0356] Both the quad-tree partitioning and the binary tree partitioning are applied to Figure 3 LCU 310 of FIG. 1.

[0357] In the encoding apparatus 100, a coding tree unit (CTU) having a size of 64x64 can be partitioned into a plurality of smaller CUs through a recursive quad-tree structure. A single CU can be partitioned into four CUs having the same size. Each of the CUs can be recursively partitioned and can have a quad-tree structure.

[0358] Through the recursive partitioning of the CUs, an optimal partitioning method that results in a minimum rate-distortion cost can be selected.

[0359] Figure 3 The coding tree unit (CTU) 320 of FIG. 3 is an example of a CTU to which all of the quad-tree partitioning, the binary tree partitioning, and the ternary tree partitioning are applied.

[0360] As described above, in order to partition a CTU, at least one of the quad-tree partitioning, the binary tree partitioning, and the ternary tree partitioning can be applied to the CTU. The partitioning can be applied based on a certain priority.

[0361] For example, the quad-tree partitioning can be preferentially applied to the CTU. A CU that cannot be further partitioned in a quad-tree form can correspond to a leaf node of the quad-tree. The CU corresponding to the leaf node of the quad-tree can be a root node of a binary tree and / or a ternary tree. That is, the CU corresponding to the leaf node of the quad-tree can be partitioned in a binary tree form or a ternary tree form, or can not be further partitioned. In this case, it is prevented that each of the CUs generated by applying the binary tree partitioning or the ternary tree partitioning to the CU corresponding to the leaf node of the quad-tree is subjected to the quad-tree partitioning again, thereby efficiently performing partitioning of blocks and / or signaling of block partitioning information.

[0362] The quad partition information can be used to signal partition of a CU corresponding to each node of the quad tree. The quad partition information having a first value (e.g., "1") can indicate that the corresponding CU is partitioned in the form of the quad tree. The quad partition information having a second value (e.g., "0") can indicate that the corresponding CU is not partitioned in the form of the quad tree. The quad partition information can be a flag having a specific length (e.g., 1 bit).

[0363] There can be no priority between the binary tree partition and the ternary tree partition. That is, a CU corresponding to a leaf node of the quad tree can be partitioned in the form of a binary tree or a ternary tree. Also, a CU generated by the binary tree partition or the ternary tree partition can be further partitioned in the form of a binary tree or a ternary tree, or can not be further partitioned.

[0364] The partition performed when there is no priority between the binary tree partition and the ternary tree partition can be referred to as "multi-type tree partition". That is, a CU corresponding to a leaf node of the quad tree can be a root node of a multi-type tree. Partition of a CU corresponding to each node of the multi-type tree can be signaled using at least one of information indicating whether the CU is partitioned in the multi-type tree, partition direction information, and partition tree information. For partition of the CU corresponding to each node of the multi-type tree, the information indicating whether the partition in the multi-type tree is performed, the partition direction information, and the partition tree information can be sequentially signaled.

[0365] For example, information indicating whether a CU is partitioned in a multi-type tree and having a first value (e.g., "1") can indicate that the corresponding CU is partitioned in the form of the multi-type tree. Information indicating whether the CU is partitioned in the multi-type tree and having a second value (e.g., "0") can indicate that the corresponding CU is not partitioned in the form of the multi-type tree.

[0366] When the CU corresponding to each node of the multi-type tree is partitioned in the form of the multi-type tree, the corresponding CU can further include partition direction information.

[0367] The partition direction information can indicate a partition direction of the multi-type tree partition. The partition direction information having a first value (e.g., "1") can indicate that the corresponding CU is partitioned in a vertical direction. The partition direction information having a second value (e.g., "0") can indicate that the corresponding CU is partitioned in a horizontal direction.

[0368] When the CU corresponding to each node of the multi-type tree is partitioned in the form of the multi-type tree, the corresponding CU can further include partition tree information. The partition tree information can indicate a tree used for the multi-type tree partition.

[0369] For example, the partition tree information having a first value (e.g., "1") can indicate that the corresponding CU is partitioned in a binary tree form. The partition tree information having a second value (e.g., "0") can indicate that the corresponding CU is partitioned in a ternary tree form.

[0370] Here, each of the information indicating whether to perform partitioning in a multi-type tree, the partition tree information, and the partition direction information described above can be a flag having a specific length (e.g., 1 bit).

[0371] At least one of the quad partition information, the information indicating whether to perform partitioning in a multi-type tree, the partition direction information, and the partition tree information described above can be entropy encoded and / or entropy decoded. To perform the entropy encoding / decoding of such information, information of a neighboring CU adjacent to the target CU can be used.

[0372] For example, it can be considered that a probability that a partition form (i.e., partitioning / non-partitioning, a partition tree, and / or a partition direction) of a left CU and / or an upper CU and a partition form of the target CU will be similar to each other is high. Accordingly, based on the information of the neighboring CU, context information for the entropy encoding and / or the entropy decoding of the information of the target CU can be derived. Here, the information of the neighboring CU can include at least one of 1) quad partition information of the neighboring CU, 2) information indicating whether the neighboring CU is partitioned in a multi-type tree, 3) partition direction information of the neighboring CU, and 4) partition tree information of the neighboring CU.

[0373] In another embodiment, in the binary tree partitioning and the ternary tree partitioning, the binary tree partitioning can be preferentially performed. That is, the binary tree partitioning can be first applied, and then a CU corresponding to a leaf node of the binary tree can be set as a root node of the ternary tree. In this case, the quad tree partitioning or the binary tree partitioning can not be performed on a CU corresponding to a node of the ternary tree.

[0374] A CU which is not further partitioned by the quad tree partitioning, the binary tree partitioning, and / or the ternary tree partitioning can be a unit of encoding, prediction, and / or transformation. That is, the CU can not be further partitioned for prediction and / or transformation. Accordingly, a partition structure for partitioning the CU into a prediction unit (PU) and / or a transform unit (TU), partition information thereof, etc. can not exist in a bitstream.

[0375] However, when a size of a CU which is a unit of partitioning is greater than a size of a maximum transform block, the CU can be recursively partitioned until the size of the CU becomes less than or equal to the size of the maximum transform block. For example, when the size of the CU is 64x64 and the size of the maximum transform block is 32x32, the CU can be partitioned into four 32x32 blocks in order to perform transformation. For example, when the size of the CU is 32x64 and the size of the maximum transform block is 32x32, the CU can be partitioned into two 32x32 blocks.

[0376] In this case, information indicating whether the CU is partitioned for transform can not be signaled separately. In the case of not being signaled, whether the CU is partitioned can be determined via a comparison between a horizontal size (and / or a vertical size) of the CU and a horizontal size (and / or a vertical size) of a maximum transform block. For example, when the horizontal size of the CU is greater than the horizontal size of the maximum transform block, the CU can be vertically bisected. Also, when the vertical size of the CU is greater than the vertical size of the maximum transform block, the CU can be horizontally bisected.

[0377] Information on a maximum size and / or a minimum size of the CU and information on a maximum size and / or a minimum size of a transform block can be signaled or determined at a level higher than a level of the CU. For example, the higher level can be a sequence level, a picture level, a parallel block level, a parallel block group level, or a slice level. For example, the minimum size of the CU can be set to 4x4. For example, the maximum size of the transform block can be set to 64x64. For example, the maximum size of the transform block can be set to 4x4.

[0378] Information on a minimum size of a CU corresponding to a leaf node of a quad tree (i.e., a minimum size of the quad tree) and / or information on a maximum depth of a path from a root node to a leaf node of a multi-type tree (i.e., a maximum depth of the multi-type tree) can be signaled or determined at a level higher than a level of the CU corresponding to the leaf node of the quad tree. For example, the higher level can be a sequence level, a picture level, a slice level, a parallel block group level, or a parallel block level. The information on the minimum size of the quad tree and / or the information on the maximum depth of the multi-type tree can be signaled or determined separately at each of an intra-slice level and an inter-slice level.

[0379] Information on a difference between a size of a CTU and a maximum size of a transform block can be signaled or determined at a level higher than a level of the CU. For example, the higher level can be a sequence level, a picture level, a slice level, a parallel block group level, or a parallel block level. Information on a maximum size of a CU corresponding to each node of a binary tree (i.e., a maximum size of the binary tree) can be determined based on the size of the CTU and the difference information. A maximum size of a CU corresponding to each node of a ternary tree (i.e., a maximum size of the ternary tree) can have different values depending on a type of a slice. For example, the maximum size of the ternary tree at an intra-slice level can be 32x32. For example, the maximum size of the ternary tree at an inter-slice level can be 128x128. For example, a minimum size of the CU corresponding to each node of the binary tree (i.e., a minimum size of the binary tree) and / or a minimum size of the CU corresponding to each node of the ternary tree (i.e., a minimum size of the ternary tree) can be set to a minimum size of the CU.

[0380] In another example, the maximum size of the binary tree and / or the maximum size of the ternary tree can be signaled or determined at the slice level. In addition, the minimum size of the binary tree and / or the minimum size of the ternary tree can be signaled or determined at the slice level.

[0381] Based on the various block sizes and depths described above, the quad-tree information, the information indicating whether to perform the partitioning with the multi-type tree, the partition tree information, and / or the partition direction information can or can not be present in the bitstream.

[0382] For example, when the size of the CU is not greater than the minimum size of the quad-tree, the CU can not include the quad-tree information, and the quad-tree information of the CU can be inferred to be the second value.

[0383] For example, when the size (horizontal size and vertical size) of the CU corresponding to each node of the multi-type tree is greater than the maximum size (horizontal size and vertical size) of the binary tree and / or the maximum size (horizontal size and vertical size) of the ternary tree, the CU can not be partitioned in the form of the binary tree and / or the ternary tree. By virtue of this determination manner, the information indicating whether to perform the partitioning with the multi-type tree can not be signaled, but can be inferred to be the second value.

[0384] Alternatively, when the size (horizontal size and vertical size) of the CU corresponding to each node of the multi-type tree is equal to the minimum size (horizontal size and vertical size) of the binary tree, or when the size (horizontal size and vertical size) of the CU is equal to twice the minimum size (horizontal size and vertical size) of the ternary tree, the CU can not be partitioned in the form of the binary tree and / or the ternary tree. By virtue of this determination manner, the information indicating whether to perform the partitioning with the multi-type tree can not be signaled, but can be inferred to be the second value. The reason is that when the CU is partitioned in the form of the binary tree and / or the ternary tree, a CU smaller than the minimum size of the binary tree and / or the minimum size of the ternary tree is generated.

[0385] Alternatively, the binary tree partitioning or the ternary tree partitioning can be limited based on the size of the virtual pipeline data unit (i.e., the size of the pipeline buffer). For example, when the CU is partitioned into sub-CUs that do not fit into the size of the pipeline buffer by the binary tree partitioning or the ternary tree partitioning, the binary tree partitioning or the ternary tree partitioning can be limited. The size of the pipeline buffer can be equal to the maximum size of the transform block (e.g., 64x64).

[0386] For example, when the size of the pipeline buffer is 64x64, the following partitioning can be limited.

[0387] - The ternary tree partitioning of an NxM CU (where N and / or M is 128) - The horizontal binary tree partitioning of a 128xN CU (where N<=64) - vertical binary tree partitioning of Nx128 CUs (where N <= 64) Optionally, the information indicating whether partitioning of the multi-type tree is performed can not be signaled, but can be inferred as the second value, when the depth of the CU corresponding to each node of the multi-type tree is equal to the maximum depth of the multi-type tree. By means of this determination, the information indicating whether partitioning of the multi-type tree is performed can not be signaled, but can be inferred as the second value.

[0388] Optionally, the information indicating whether partitioning of the multi-type tree is performed can be signaled only when at least one of vertical binary tree partitioning, horizontal binary tree partitioning, vertical triple tree partitioning and horizontal triple tree partitioning is possible for the CU corresponding to each node of the multi-type tree. Otherwise, the CU can not be partitioned in binary tree form and / or triple tree form. By means of this determination, the information indicating whether partitioning of the multi-type tree is performed can not be signaled, but can be inferred as the second value.

[0389] Optionally, the partition direction information can not be signaled, but can be inferred as a value indicating the direction in which the CU can be partitioned, when both vertical binary tree partitioning and horizontal binary tree partitioning are possible or when both vertical triple tree partitioning and horizontal triple tree partitioning are possible for the CU corresponding to each node of the multi-type tree. Otherwise, the partition direction information can be signaled.

[0390] Optionally, the partition tree information can not be signaled, but can be inferred as a value indicating the tree to which partitioning of the CU can be applied, when both vertical binary tree partitioning and vertical triple tree partitioning are possible or when both horizontal binary tree partitioning and horizontal triple tree partitioning are possible for the CU corresponding to each node of the multi-type tree. Otherwise, the partition tree information can be signaled.

[0391] Figure 4 is a diagram showing forms of prediction units that a coding unit can comprise.

[0392] Among the CUs partitioned out of the LCU, CUs that are not further partitioned can be divided into one or more prediction units (PUs).

[0393] A PU can be a basic unit for prediction. A PU can be encoded and decoded in any one of a skip mode, an inter mode, and an intra mode. A PU can be partitioned into various shapes according to the respective modes. For example, the target blocks described above with reference to Figure 1 and the target blocks described above with reference to Figure 2 may each be a PU.

[0394] A CU can not be split into PUs. When a CU is not split into PUs, the size of the CU and the size of the PU can be equal to each other.

[0395] In the skip mode, no partitioning can be present in the CU. In the skip mode, a 2Nx2N mode 410 can be supported without partitioning, where the size of the PU and the CU are the same as each other in the 2Nx2N mode 410.

[0396] In the inter mode, eight types of partition shapes can be present in the CU. For example, in the inter mode, a 2Nx2N mode 410, a 2NxN mode 415, an Nx2N mode 420, an NxN mode 425, a 2NxnU mode 430, a 2NxnD mode 435, an nLx2N mode 440, and an nRx2N mode 445 can be supported.

[0397] In the intra mode, a 2Nx2N mode 410 and an NxN mode 425 can be supported.

[0398] In the 2Nx2N mode 410, a PU having a 2Nx2N size can be encoded. The PU having the 2Nx2N size can mean a PU having the same size as that of the CU. For example, the PU having the 2Nx2N size can have a size of 64x64, 32x32, 16x16, or 8x8.

[0399] In the NxN mode 425, a PU having an NxN size can be encoded.

[0400] For example, in intra prediction, when the size of the PU is 8x8, four partitioned PUs can be encoded. The size of each of the partitioned PUs can be 4x4.

[0401] When the PU is encoded in the intra mode, any one of a plurality of intra prediction modes can be used to encode the PU. For example, the HEVC technique can provide 35 intra prediction modes, and the PU can be encoded in any one of the 35 intra prediction modes.

[0402] Which one of the 2Nx2N mode 410 and the NxN mode 425 is to be used to encode the PU can be determined based on a rate-distortion cost.

[0403] The encoding device 100 can perform an encoding operation on the PU having the size of 2Nx2N. Here, the encoding operation can be an operation of encoding the PU in each of a plurality of intra prediction modes that can be used by the encoding device 100. Through the encoding operation, an optimal intra prediction mode for the PU having the size of 2Nx2N can be derived. The optimal intra prediction mode can be an intra prediction mode, among the plurality of intra prediction modes that can be used by the encoding device 100, that incurs a minimum rate-distortion cost when the PU having the size of 2Nx2N is encoded.

[0404] Furthermore, the encoding apparatus 100 can sequentially perform an encoding operation on each PU obtained from the NxN partition. Here, the encoding operation can be an operation of encoding the PU in each of a plurality of intra prediction modes that can be used by the encoding apparatus 100. Through the encoding operation, an optimal intra prediction mode for the PU of the size NxN can be derived. The optimal intra prediction mode can be an intra prediction mode that results in a minimum rate-distortion cost when the PU of the size NxN is encoded among the plurality of intra prediction modes that can be used by the encoding apparatus 100.

[0405] The encoding apparatus 100 can determine which one of the PU of the size 2Nx2N and the PU of the size NxN will be encoded based on a comparison of a rate-distortion cost of the PU of the size 2Nx2N and a rate-distortion cost of the PU of the size NxN.

[0406] A single CU can be partitioned into one or more PUs, and a PU can be partitioned into a plurality of PUs.

[0407] For example, when a single PU is partitioned into four PUs, a horizontal size and a vertical size of each of the four PUs generated through the partitioning can be half of a horizontal size and a vertical size of the PU before being partitioned. When a PU of the size 32x32 is partitioned into four PUs, a size of each of the four partitioned PUs can be 16x16. When a single PU is partitioned into four PUs, the PU can be considered to have been partitioned in a quad-tree structure.

[0408] For example, when a single PU is partitioned into two PUs, a horizontal size or a vertical size of each of the two PUs generated through the partitioning can be half of a horizontal size or a vertical size of the PU before being partitioned. When a PU of the size 32x32 is vertically partitioned into two PUs, a size of each of the two partitioned PUs can be 16x32. When a PU of the size 32x32 is horizontally partitioned into two PUs, a size of each of the two partitioned PUs can be 32x16. When a single PU is partitioned into two PUs, the PU can be considered to have been partitioned in a binary tree structure.

[0409] Figure 5 is a diagram illustrating a form of a transform unit that can be included in a coding unit.

[0410] A transform unit (TU) can have a basic unit for processes such as transform, quantization, inverse transform, dequantization, entropy encoding, and entropy decoding in a CU.

[0411] A TU can have a square shape or a rectangular shape. The shape of a TU can be determined based on a size and / or a shape of a CU.

[0412] In a CU partitioned from an LCU, a CU not further partitioned into CUs can be partitioned into one or more TUs. Here, the partitioning structure of a TU can be a quad-tree structure. For example, as shown in FIG. 5, a single CU 510 can be partitioned one or more times according to a quad-tree structure. By means of such partitioning, the single CU 510 can be composed of TUs having various sizes. Figure 5

[0413] It can be considered that, when a single CU is split two or more times, the CU is recursively split. By splitting, a single CU can be composed of transform units (TUs) having various sizes.

[0414] Alternatively, a single CU can be split into one or more TUs based on the number of vertical lines and / or horizontal lines partitioning the CU.

[0415] A CU can be split into symmetric TUs or asymmetric TUs. To be split into asymmetric TUs, information about the size and / or shape of each TU can be signaled from the encoding apparatus 100 to the decoding apparatus 200. Alternatively, the size and / or shape of each TU can be derived from information about the size and / or shape of the CU.

[0416] A CU can not be split into TUs. When a CU is not partitioned into TUs, the size of the CU and the size of the TUs can be equal to each other.

[0417] A single CU can be partitioned into one or more TUs, and a TU can be partitioned into multiple TUs.

[0418] For example, when a single TU is partitioned into four TUs, the horizontal size and the vertical size of each of the four TUs generated by the partitioning can be half of the horizontal size and the vertical size of the TU before being partitioned. When a TU having a size of 32x32 is partitioned into four TUs, the size of each of the four partitioned TUs can be 16x16. When a single TU is partitioned into four TUs, it can be considered that the TU has been partitioned in a quad-tree structure.

[0419] For example, when a single TU is partitioned into two TUs, the horizontal size or the vertical size of each of the two TUs generated by the partitioning can be half of the horizontal size or the vertical size of the TU before being partitioned. When a TU having a size of 32x32 is vertically partitioned into two TUs, the size of each of the two partitioned TUs can be 16x32. When a TU having a size of 32x32 is horizontally partitioned into two TUs, the size of each of the two partitioned TUs can be 32x16. When a single TU is partitioned into two TUs, it can be considered that the TU has been partitioned in a binary-tree structure.

[0420] The partitioning of a TU can be performed in a different manner from Figure 5 ​The CU is split in the illustrated manner.

[0421] For example, a single CU can be split into three CUs. The horizontal or vertical size of the three CUs generated from the split can be 1 / 4, 1 / 2, and 1 / 4, respectively, of the horizontal or vertical size of the original CU before being split.

[0422] For example, when a CU having a size of 32x32 is vertically split into three CUs, the sizes of the three CUs generated from the split can be 8x32, 16x32, and 8x32, respectively. In this manner, when a single CU is split into three CUs, the CUs can be considered to be split in the form of a ternary tree.

[0423] One of the exemplary split forms (i.e., quadtree split, binary tree split, and ternary tree split) can be applied to the split of a CU, and a plurality of split schemes can be combined and used together for the split of a CU. Here, the case where a plurality of split schemes are combined and used together can be referred to as "complex tree format split".

[0424] Figure 6 A split of a block according to an example is illustrated.

[0425] In a video encoding and / or decoding process, a target block can be split as illustrated. Figure 6 For example, the target block can be a CU.

[0426] For the split of the target block, an indicator indicating split information can be signaled from the encoding device 100 to the decoding device 200. The split information can be information indicating how the target block is split.

[0427] The split information can be one or more of a split flag (hereinafter referred to as "split_flag"), a quad-binary flag (hereinafter referred to as "QB_flag"), a quadtree flag (hereinafter referred to as "quadtree_flag"), a binary tree flag (hereinafter referred to as "binarytree_flag"), and a binary type flag (hereinafter referred to as "Btype_flag").

[0428] The "split_flag" can be a flag indicating whether a block is split. For example, a split_flag value of 1 can indicate that the corresponding block is split. A split_flag value of 0 can indicate that the corresponding block is not split.

[0429] The "QB_flag" can be a flag indicating which one of the quad-tree form and the binary-tree form corresponds to a shape in which a block is split. For example, a QB_flag value of 0 can indicate that a block is split in the quad-tree form. A QB_flag value of 1 can indicate that a block is split in the binary-tree form. Alternatively, a QB_flag value of 0 can indicate that a block is split in the binary-tree form. A QB_flag value of 1 can indicate that a block is split in the quad-tree form.

[0430] The "quadtree_flag" can be a flag indicating whether a block is split in the quad-tree form. For example, a quadtree_flag value of 1 can indicate that a block is split in the quad-tree form. A quadtree_flag value of 0 can indicate that a block is not split in the quad-tree form.

[0431] The "binarytree_flag" can be a flag indicating whether a block is split in the binary-tree form. For example, a binarytree_flag value of 1 can indicate that a block is split in the binary-tree form. A binarytree_flag value of 0 can indicate that a block is not split in the binary-tree form.

[0432] The "Btype_flag" can be a flag indicating which one of the vertical division and the horizontal division corresponds to a division direction when a block is split in the binary-tree form. For example, a Btype_flag value of 0 can indicate that a block is split in the horizontal direction. A Btype_flag value of 1 can indicate that a block is split in the vertical direction. Alternatively, a Btype_flag value of 0 can indicate that a block is split in the vertical direction. A Btype_flag value of 1 can indicate that a block is split in the horizontal direction.

[0433] For example, as shown in Table 1 below, the split information of a block in Figure 6 may be derived by signaling at least one of the quadtree_flag, the binarytree_flag, and the Btype_flag.

[0434]

Table 1

[0435] For example, as shown in Table 2 below, the split information of a block in Figure 6 may be derived by signaling at least one of the split_flag, the QB_flag, and the Btype_flag.

[0436]

Table 2

[0437] According to the size and / or shape of the block, the partitioning method can be limited to a quad-tree or a binary tree. When the limitation is applied, the split_flag can be a flag indicating whether the block is partitioned in a quad-tree form or a flag indicating whether the block is partitioned in a binary tree form. The size and shape of the block can be derived from depth information of the block, and the depth information can be signaled from the encoding apparatus 100 to the decoding apparatus 200.

[0438] When the size of the block falls within a certain range, partitioning in only a quad-tree form can be possible. For example, the certain range can be defined by at least one of a maximum block size and a minimum block size, where, at the maximum block size and the minimum block size, partitioning in only a quad-tree form is possible.

[0439] Information indicating the maximum block size and the minimum block size at which partitioning in only a quad-tree form is possible can be signaled from the encoding apparatus 100 to the decoding apparatus 200 through a bitstream. Further, the information can be signaled with respect to at least one of units such as a video, a sequence, a picture, a parameter, a parallel block group, and a slice (or segment).

[0440] Alternatively, the maximum block size and / or the minimum block size can be a fixed size predefined by the encoding apparatus 100 and the decoding apparatus 200. For example, when the size of the block is above 64x64 and below 256x256, partitioning in only a quad-tree form can be possible. In this case, the split_flag can be a flag indicating whether partitioning in a quad-tree form is performed.

[0441] When the size of the block is greater than a maximum size of a transform block, partitioning in only a quad-tree form can be possible. Here, the sub-block generated by the partitioning can be at least one of a CU and a TU.

[0442] In this case, the split_flag can be a flag indicating whether the CU is partitioned in a quad-tree form.

[0443] When the size of the block falls within a certain range, partitioning in only a binary tree form or a ternary tree form can be possible. For example, the certain range can be defined by at least one of a maximum block size and a minimum block size, where, at the maximum block size and the minimum block size, partitioning in only a binary tree form or a ternary tree form is possible.

[0444] Information indicating the maximum block size and / or the minimum block size at which partitioning in only a binary tree form or partitioning in a ternary tree form is possible can be signaled from the encoding apparatus 100 to the decoding apparatus 200 through a bitstream. Further, the information can be signaled with respect to at least one of units such as a sequence, a picture, and a slice (or segment).

[0445] Optionally, the maximum block size and / or the minimum block size can be a fixed size predefined by the encoding apparatus 100 and the decoding apparatus 200. For example, when the size of the block is above 8x8 and below 16x16, it can be possible to split only in binary tree form. In this case, the split_flag can be a flag indicating whether to perform splitting in binary tree form or ternary tree form.

[0446] The above description regarding the partitioning in quad tree form can be equally applied to binary tree form and / or ternary tree form.

[0447] The partitioning of the block can be restricted by a previous partitioning. For example, when the block is partitioned in a certain binary tree form and then a plurality of sub-blocks are generated from the partitioning, each of the sub-blocks can be further partitioned only in a certain tree form. Here, the certain tree form can be at least one of binary tree form, ternary tree form, and quad tree form.

[0448] When the horizontal size or the vertical size of the partitioned block is a size that cannot be further split, the above-described indicator can not be signaled.

[0449] Figure 7 is a diagram for explaining an embodiment of an intra prediction process.

[0450] Figure 7 The arrows extending radially from the center of the diagram in indicate the prediction directions of the intra prediction modes. Further, the numbers appearing in the vicinity of the arrows indicate examples of the mode values assigned to the intra prediction modes or the prediction directions of the intra prediction modes.

[0451] In Figure 7 In, the number 0 can denote a Planar mode as a non-directional intra prediction mode. The number 1 can denote a DC mode as a non-directional intra prediction mode.

[0452] The intra encoding and / or decoding can be performed using reference samples of neighboring blocks of the target block. The neighboring blocks can be reconstructed neighboring blocks. The reference samples can mean neighboring samples.

[0453] For example, the intra encoding and / or decoding can be performed using values of the reference samples included in the reconstructed neighboring blocks or encoding parameters of the reconstructed neighboring blocks.

[0454] Encoding device 100 and / or decoding device 200 can generate a prediction block by performing intra-frame prediction on the target block based on information about samples in the target image. When performing intra-frame prediction, encoding device 100 and / or decoding device 200 can generate a prediction block for the target block by performing intra-frame prediction based on information about samples in the target image. When performing intra-frame prediction, encoding device 100 and / or decoding device 200 can perform directional prediction and / or non-directional prediction based on at least one reconstructed reference sample.

[0455] A prediction block can be a block generated as a result of performing intra-frame prediction. A prediction block can correspond to at least one of CU, PU, ​​and TU.

[0456] The cells of the prediction block may have a size corresponding to at least one of CU, PU, ​​and TU. The prediction block may have a square shape with a size of 2N×2N or N×N. The N×N size may include sizes such as 4×4, 8×8, 16×16, 32×32, 64×64, etc.

[0457] Optionally, the prediction block can be a square block with a size of 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, etc., or a rectangular block with a size of 2×8, 4×8, 2×16, 4×16, 8×16, etc.

[0458] Intra-prediction can be performed using intra-prediction modes for the target block. The number of intra-prediction modes that a target block can have can be a predefined fixed value, or it can be a value determined differently based on the attributes of the prediction block. For example, the attributes of the prediction block can include the size of the prediction block, the type of the prediction block, etc. In addition, the attributes of the prediction block can indicate the coding parameters for the prediction block.

[0459] For example, the number of intra-prediction modes can be fixed at N, regardless of the size of the prediction block. Alternatively, the number of intra-prediction modes can be, for example, 3, 5, 9, 17, 34, 35, 36, 65, 67, or 95.

[0460] Intra-frame prediction mode can be either non-directional or directional.

[0461] For example, intra-frame prediction modes may include... Figure 7 The numbers 0 to 66 shown correspond to two non-directional patterns and 65 directional patterns.

[0462] For example, when using a specific intra-prediction method, the intra-prediction mode may include... Figure 7 The numbers -14 to 80 shown correspond to the two non-directional patterns and 93 directional patterns.

[0463] The two non-directional modes can include DC mode and planar mode.

[0464] The directional mode can be a prediction mode having a specific direction or a specific angle. The directional mode can also be referred to as an "angular mode".

[0465] The intra prediction mode can be represented by at least one of a mode number, a mode value, a mode angle, and a mode direction. In other words, the terms "a (mode) number of the intra prediction mode", "a (mode) value of the intra prediction mode", "a (mode) angle of the intra prediction mode", and "a (mode) direction of the intra prediction mode" can be used as having the same meaning and can be used interchangeably with each other.

[0466] The number of the intra prediction modes can be M. The value of M can be 1 or more. In other words, the number of the intra prediction modes can be M, which includes the number of the non-directional modes and the number of the directional modes.

[0467] The number of the intra prediction modes can be fixed to M regardless of the size of the block and / or the color component. For example, the number of the intra prediction modes can be fixed to any one of 35 and 67 regardless of the size of the block.

[0468] Optionally, the number of the intra prediction modes can be different according to the shape, the size of the block, and / or the type of the color component.

[0469] For example, in the case of the non-directional mode, the number of the intra prediction modes can be different according to the size of the block. Figure 7 In the case of the directional mode, the number of the intra prediction modes can be different according to the size of the block.

[0470] For example, the larger the size of the block, the larger the number of the intra prediction modes. Optionally, the larger the size of the block, the smaller the number of the intra prediction modes. When the size of the block is 4x4 or 8x8, the number of the intra prediction modes can be 67. When the size of the block is 16x16, the number of the intra prediction modes can be 35. When the size of the block is 32x32, the number of the intra prediction modes can be 19. When the size of the block is 64x64, the number of the intra prediction modes can be 7.

[0471] For example, the number of the intra prediction modes can be different according to whether the color component is a luma signal or a chroma signal. Optionally, the number of the intra prediction modes corresponding to a luma component block can be greater than the number of the intra prediction modes corresponding to a chroma component block.

[0472] For example, in the vertical mode having a mode value of 50, prediction can be performed in a vertical direction based on pixel values of reference samples. For example, in the horizontal mode having a mode value of 18, prediction can be performed in a horizontal direction based on pixel values of reference samples.

[0473] Even in the direction mode other than the above-described modes, the encoding apparatus 100 and the decoding apparatus 200 can perform intra prediction on the target unit using the reference samples according to the angle corresponding to the direction mode.

[0474] The intra prediction mode located to the right with respect to the vertical mode can be referred to as a "vertical-right mode". The intra prediction mode located below the horizontal mode can be referred to as a "horizontal-down mode". For example, in the case where the mode value is one of 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, and 66, the intra prediction mode can be the vertical-right mode. In the case where the mode value is one of 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, and 17, the intra prediction mode can be the horizontal-down mode. Figure 7

[0475] The non-directional mode can include a DC mode and a planar mode. For example, the value of the DC mode can be 1. The value of the planar mode can be 0.

[0476] The directional mode can include an angular mode. Among the plurality of intra prediction modes, the remaining modes other than the DC mode and the planar mode can be the directional mode.

[0477] When the intra prediction mode is the DC mode, the prediction block can be generated based on an average of pixel values of a plurality of reference pixels. For example, the value of a pixel of the prediction block can be determined based on the average of the pixel values of the plurality of reference pixels.

[0478] The number of the above-described intra prediction modes and the mode values of the respective intra prediction modes are merely exemplary. The number of the above-described intra prediction modes and the mode values of the respective intra prediction modes can be defined differently according to embodiments, implementations, and / or requirements.

[0479] In order to perform intra prediction on the target block, a step of checking whether or not the samples included in the reconstructed neighboring blocks can be used as the reference samples of the target block can be performed. When there is a sample that cannot be used as the reference sample of the target block among the samples in the neighboring blocks, a value generated via copying and / or interpolation using at least one sample value included in the samples in the reconstructed neighboring blocks can replace the sample value of the sample that cannot be used as the reference sample. When the sample value of the existing sample is replaced by the value generated via the copying and / or the interpolation, the sample can be used as the reference sample of the target block.

[0480] When the intra prediction is used, a filter can be applied to at least one of the reference samples and the prediction samples based on at least one of the intra prediction mode and the size of the target block.

[0481] ​A type of filter to be applied to at least one of the reference samples and the prediction samples can be different according to at least one of an intra prediction mode of the target block, a size of the target block, and a shape of the target block. The type of filter can be classified according to one or more of a length of a filter tap, a value of a filter coefficient, and a filter strength. The length of the filter tap can mean a number of filter taps. In addition, the number of filter taps can mean a length of the filter.

[0482] When the intra prediction mode is the planar mode, when a prediction block of the target block is generated, a weighted sum of an above reference sample of the target block, a left reference sample of the target block, a top-right reference sample of the target block, and a bottom-left reference sample of the target block can be used to generate a sample value of the prediction target block according to a position of the prediction target sample in the prediction block.

[0483] When the intra prediction mode is the DC mode, when a prediction block of the target block is generated, an average of a reference sample above the target block and a reference sample left of the target block can be used. In addition, filtering using a value of a reference sample can be performed on a certain row or a certain column in the target block. The certain row can be one or more above rows adjacent to the reference sample. The certain column can be one or more left columns adjacent to the reference sample.

[0484] When the intra prediction mode is the directional mode, the prediction block can be generated using an above reference sample of the target block, a left reference sample, a top-right reference sample, and / or a bottom-left reference sample of the target block.

[0485] In order to generate the above-described prediction sample, real number-based interpolation can be performed.

[0486] The intra prediction mode of the target block can be predicted from an intra prediction mode of a neighboring block adjacent to the target block, and information for the prediction can be entropy encoded / decoded.

[0487] For example, when the intra prediction modes of the target block and the neighboring block are the same as each other, the intra prediction modes of the target block and the neighboring block can be signaled using a pre-defined flag.

[0488] For example, an indicator for indicating an intra prediction mode that is the same as the intra prediction mode of the target block among intra prediction modes of a plurality of neighboring blocks can be signaled.

[0489] When the intra prediction modes of the target block and the neighboring block are different from each other, information about the intra prediction mode of the target block can be encoded and / or decoded using entropy encoding and / or decoding.

[0490] Figure 8 is a diagram illustrating reference samples used in an intra prediction process.

[0491] The reconstructed reference samples for the intra prediction of the target block can include a left-bottom reference sample, a left-side reference sample, a left-top corner reference sample, an upper reference sample, and a right-top corner reference sample.

[0492] For example, the left-side reference sample can mean a reconstructed reference pixel neighboring a left side of the target block. The upper reference sample can mean a reconstructed reference pixel neighboring a top of the target block. The left-top corner reference sample can mean a reconstructed reference pixel located at a left-top corner of the target block. The left-bottom reference sample can mean a reference sample located below a left-side sample line consisting of the left-side reference sample, among samples located on a same line as the left-side sample line. The right-top corner reference sample can mean a reference sample located right of an upper sample line consisting of the upper reference sample, among samples located on a same line as the upper sample line.

[0493] When a size of the target block is N x N, the number of the left-bottom reference sample, the left-side reference sample, the upper reference sample, and the right-top corner reference sample can each be N.

[0494] By performing the intra prediction on the target block, a prediction block can be generated. The generating the prediction block can include determining values of pixels in the prediction block. The target block and the prediction block can have equal sizes.

[0495] The reference samples for the intra prediction of the target block can vary according to an intra prediction mode of the target block. A direction of the intra prediction mode can represent a dependency between the reference samples and the pixels of the prediction block. For example, a value of a specified reference sample can be used as a value of one or more specified pixels in the prediction block. In this case, the specified reference sample and the one or more specified pixels in the prediction block can be samples and pixels located on a straight line in a direction of the intra prediction mode. In other words, the value of the specified reference sample can be copied as a value of a pixel located in a direction opposite to the direction of the intra prediction mode. Alternatively, a value of a pixel in the prediction block can be a value of a reference sample located in the direction of the intra prediction mode with respect to a position of the pixel.

[0496] In an example, when the intra prediction mode of the target block is a vertical mode, the upper reference sample can be used for the intra prediction. When the intra prediction mode is the vertical mode, a value of a pixel in the prediction block can be a value of a reference sample vertically located above a position of the pixel. Accordingly, the upper reference sample neighboring the top of the target block can be used for the intra prediction. Further, values of pixels in a line of the prediction block can be the same as values of the above-described reference sample.

[0497] In an example, when the intra prediction mode of the target block is a horizontal mode, the left side reference samples can be used for the intra prediction. When the intra prediction mode is the horizontal mode, the value of a pixel in the prediction block can be the value of the reference sample horizontally located at the left side of the position of the pixel. Thus, the left side reference samples neighboring the left side of the target block can be used for the intra prediction. Further, the value of a pixel in a column of the prediction block can be the same as the value of the left side reference sample.

[0498] In an example, when the mode value of the intra prediction mode of the current block is 34, at least some of the left side reference samples, the top left corner reference sample, and at least some of the above reference samples can be used for the intra prediction. When the mode value of the intra prediction mode is 34, the value of a pixel in the prediction block can be the value of the reference sample diagonally located at the top left corner of the position of the pixel.

[0499] Further, in the case of the intra prediction mode whose mode value is a value in the range of 52 to 66, at least a part of the top right corner reference samples can be used for the intra prediction.

[0500] Further, in the case of the intra prediction mode whose mode value is a value in the range of 2 to 17, at least a part of the bottom left corner reference samples can be used for the intra prediction.

[0501] Further, in the case of the intra prediction mode whose mode value is a value in the range of 19 to 49, the top left corner reference sample can be used for the intra prediction.

[0502] The number of the reference samples used for determining the pixel value of one pixel in the prediction block can be 1 or 2 or more.

[0503] As described above, the pixel value of a pixel in the prediction block can be determined according to the position of the pixel and the position of the reference sample indicated by the direction of the intra prediction mode. When the position of the pixel and the position of the reference sample indicated by the direction of the intra prediction mode are integer positions, the value of one reference sample indicated by the integer position can be used for determining the pixel value of the pixel in the prediction block.

[0504] When the position of the pixel and the position of the reference sample indicated by the direction of the intra prediction mode are not integer positions, an interpolated reference sample based on two reference samples closest to the positions of the reference samples can be generated. The value of the interpolated reference sample can be used for determining the pixel value of the pixel in the prediction block. In other words, when the position of the pixel in the prediction block and the position of the reference sample indicated by the direction of the intra prediction mode indicate a position between two reference samples, an interpolation based on the values of the two samples can be generated.

[0505] The prediction block generated via the prediction can not be the same as the original target block. In other words, there can be a prediction error as a difference between the target block and the prediction block, and there can also be a prediction error between the pixels of the target block and the pixels of the prediction block.

[0506] Hereinafter, the terms "difference", "error" and "residual" can be used with the same meaning and can be used interchangeably with each other.

[0507] For example, in the case of directional intra prediction, the longer the distance between the pixels of the prediction block and the reference samples, the greater the prediction error that can occur. Such a prediction error can cause discontinuity between the generated prediction block and the neighboring blocks.

[0508] To reduce the prediction error, filtering for the prediction block can be used. The filtering can be configured to adaptively apply a filter to a region of the prediction block that is considered to have a large prediction error. For example, the region that is considered to have a large prediction error can be a boundary of the prediction block. In addition, the region of the prediction block that is considered to have a large prediction error can differ according to the intra prediction mode, and the characteristics of the filter can also differ according to the intra prediction mode.

[0509] As shown in FIG. 1A, for intra prediction of a target block, at least one of reference line 0 to reference line 3 can be used. Figure 8

[0510] Figure 8 Each of the reference lines can indicate a reference sample line including one or more reference samples. The closer the line of the reference samples can be indicated as the smaller the number of the reference line.

[0511] The samples in section A and section F can be acquired by padding using the samples in section B and section E that are closest to the target block, rather than from the reconstructed neighboring blocks.

[0512] Index information indicating the reference sample line to be used for intra prediction of the target block can be signaled. The index information can indicate the reference sample line among a plurality of reference sample lines to be used for intra prediction of the target block. For example, the index information can have a value corresponding to any one of 0 to 3.

[0513] When the top boundary of the target block is a boundary of the CTU, only reference sample line 0 can be available. Accordingly, in this case, the index information can not be signaled. When an additional reference sample line other than reference sample line 0 is used, the filtering of the prediction block that will be described later can not be performed.

[0514] In the case of inter-color intra prediction, a prediction block for a target block of a second color component can be generated based on a corresponding reconstructed block of a first color component.

[0515] For example, the first color component can be a luma component, and the second color component can be a chroma component.

[0516] ​To perform inter-color intra prediction, parameters for a linear model between the first color component and the second color component can be derived based on a template.

[0517] The template can include reference samples above the target block (above reference samples) and / or reference samples left of the target block (left reference samples), and can include above reference samples and / or left reference samples of the reconstructed block of the first color component that correspond to the reference samples.

[0518] For example, the parameters for the linear model can be derived using 1) a value of a sample of the first color component having a maximum value among the samples in the template, 2) a value of a sample of the second color component corresponding to the sample of the first color component, 3) a value of a sample of the first color component having a minimum value among the samples in the template, and 4) a value of a sample of the second color component corresponding to the sample of the first color component.

[0519] When the parameters for the linear model are derived, a prediction block for the target block can be generated by applying the corresponding reconstructed block to the linear model.

[0520] According to an image format, sub-sampling can be performed on samples neighboring the reconstructed block of the first color component and the corresponding reconstructed block of the first color component. For example, when one sample of the second color component corresponds to four samples of the first color component, one corresponding sample can be calculated by performing sub-sampling on the four samples of the first color component. When sub-sampling is performed, derivation of the parameters for the linear model and inter-color intra prediction can be performed based on the sub-sampled corresponding sample.

[0521] Information about whether to perform inter-color intra prediction and / or a range of the template can be signaled in an intra prediction mode.

[0522] The target block can be partitioned into two or four sub-blocks in a horizontal direction and / or a vertical direction.

[0523] The sub-blocks generated by the partitioning can be sequentially reconstructed. That is, when intra prediction is performed on each sub-block, a sub-prediction block for the sub-block can be generated. Further, when dequantization (inverse quantization) and / or inverse transformation is performed on each sub-block, a sub-residual block for the corresponding sub-block can be generated. The reconstructed sub-block can be generated by adding the sub-prediction block and the sub-residual block. The reconstructed sub-block can be used as a reference sample for intra prediction of a sub-block having a next priority.

[0524] The sub-block can be a block including a certain number (e.g., 16) of samples or more. For example, when the target block is an 8x4 block or a 4x8 block, the target block can be partitioned into two sub-blocks. Further, when the target block is a 4x4 block, the target block cannot be partitioned into sub-blocks. When the target block has another size, the target block can be partitioned into four sub-blocks.

[0525] Information about whether to perform intra-frame prediction based on such sub-blocks and / or about the partitioning direction (horizontal or vertical) can be sent using signals.

[0526] Such sub-block-based intra-prediction can be restricted so that it is performed only when reference sample line 0 is used. When performing sub-block-based intra-prediction, filtering of the prediction block, which will be described below, may be omitted.

[0527] The final prediction block can be generated by filtering the prediction block generated via intra-frame prediction.

[0528] Filtering can be performed by applying specific weights to the target sample, the left reference sample, the top reference sample, and / or the top-left reference sample, where the target sample is the target to be filtered.

[0529] The weights and / or reference samples used for filtering (e.g., the range of reference samples, the location of reference samples, etc.) can be determined based on at least one of the block size, intra-prediction mode, and the location of the target filter sample in the prediction block.

[0530] For example, filtering can be performed only in specific intra-frame prediction modes (e.g., DC mode, planar mode, vertical mode, horizontal mode, diagonal mode, and / or adjacent diagonal mode).

[0531] Adjacent diagonal patterns can be patterns with numbers obtained by adding k to the diagonal pattern's number, or patterns with numbers obtained by subtracting k from the diagonal pattern's number. In other words, the number of an adjacent diagonal pattern can be the sum of the diagonal pattern's number and k, or it can be the difference between the diagonal pattern's number and k. For example, k can be a positive integer of 8 or less.

[0532] The intra prediction mode of the target block can be derived using the intra prediction modes of neighboring blocks that exist near the target block, and the derived intra prediction mode can be entropy encoded and / or entropy decoded.

[0533] For example, when the intra prediction mode of the target block is the same as that of the neighboring blocks, specific flag information can be used to send a signal indicating that the intra prediction mode of the target block is the same as that of the neighboring blocks.

[0534] Alternatively, for example, an indicator message can be sent for a neighboring block in an intra prediction mode that is the same as the intra prediction mode of the target block in an intra prediction mode with multiple neighboring blocks.

[0535] For example, when the intra prediction mode of the target block is different from the intra prediction mode of the neighboring block, the information on the intra prediction mode of the target block can be entropy encoded and / or entropy decoded by performing entropy encoding and / or entropy decoding based on the intra prediction mode of the neighboring block.

[0536] Figure 9 is a diagram for explaining an embodiment of an inter prediction process.

[0537] Figure 9 The rectangles shown in the Figure 9 In the

[0538] According to the encoding type, the pictures can be classified into an intra picture (I picture), a single prediction picture or a predictive encoding picture (P picture), and a bi-directional prediction picture or a bi-directional predictive encoding picture (B picture). Each picture can be encoded and / or decoded according to its encoding type.

[0539] When the target picture, which is a target to be encoded, is an I picture, the target picture can be encoded using data contained in the picture itself without inter prediction referring to other pictures. For example, the I picture can be encoded only via intra prediction.

[0540] When the target picture is a P picture, the target picture can be encoded via inter prediction using a reference picture existing in one direction. Here, the one direction can be a forward direction or a backward direction.

[0541] When the target picture is a B picture, the picture can be encoded via inter prediction using reference pictures existing in two directions, or can be encoded via inter prediction using a reference picture existing in one of a forward direction and a backward direction. Here, the two directions can be the forward direction and the backward direction.

[0542] The P picture and the B picture, which are encoded and / or decoded using the reference picture, can be regarded as pictures using inter prediction.

[0543] Hereinafter, inter prediction in an inter mode according to an embodiment will be described in detail.

[0544] Inter prediction or motion compensation can be performed using a reference picture and motion information.

[0545] In the inter mode, the encoding apparatus 100 can perform inter prediction and / or motion compensation on a target block. The decoding apparatus 200 can perform inter prediction and / or motion compensation corresponding to the inter prediction and / or motion compensation performed by the encoding apparatus 100 on the target block.

[0546] During inter prediction, motion information of a target block can be derived by the encoding device 100 and the decoding device 200 individually. The motion information can be derived using motion information of a reconstructed neighboring block, motion information of the col block, and / or motion information of a block neighboring the col block.

[0547] For example, the encoding device 100 or the decoding device 200 can perform prediction and / or motion compensation by using motion information of a spatial candidate and / or a temporal candidate as motion information of a target block. The target block can mean a PU and / or a PU partition.

[0548] The spatial candidate can be a reconstructed block spatially neighboring the target block.

[0549] The temporal candidate can be a reconstructed block corresponding to the target block in a previously reconstructed col picture.

[0550] In inter prediction, the encoding device 100 and the decoding device 200 can improve encoding efficiency and decoding efficiency by utilizing motion information of a spatial candidate and / or a temporal candidate. The motion information of the spatial candidate can be referred to as "spatial motion information". The motion information of the temporal candidate can be referred to as "temporal motion information".

[0551] Hereinafter, the motion information of the spatial candidate can be motion information of a PU including the spatial candidate. The motion information of the temporal candidate can be motion information of a PU including the temporal candidate. The motion information of the candidate block can be motion information of a PU including the candidate block.

[0552] Inter prediction can be performed using a reference picture.

[0553] The reference picture can be at least one of a picture before a target picture and a picture after the target picture. The reference picture can be an image used for prediction of a target block.

[0554] In inter prediction, a region in a reference picture can be specified by utilizing a reference picture index (or refIdx) indicating the reference picture, a motion vector (to be described later), and / or the like. Here, the region specified in the reference picture can indicate a reference block.

[0555] Inter prediction can select a reference picture, and can also select a reference block corresponding to a target block from the reference picture. In addition, inter prediction can generate a prediction block for the target block using the selected reference block.

[0556] Motion information can be derived by each of the encoding device 100 and the decoding device 200 during inter prediction.

[0557] The spatial candidate can be a block that satisfies the following: 1) exists in the target picture, 2) has been previously reconstructed via encoding and / or decoding, and 3) is adjacent to or located at a corner of the target block. Here, the "block located at a corner of the target block" can be a block that is adjacent to a neighboring block adjacent to the target block in a horizontal direction in a vertical direction, or can be a block that is adjacent to a neighboring block adjacent to the target block in a vertical direction in a horizontal direction. Further, the "block located at a corner of the target block" can have the same meaning as the "block adjacent to a corner of the target block". The meaning of the "block located at a corner of the target block" can be included in the meaning of the "block adjacent to the target block".

[0558] For example, the spatial candidate can be a reconstructed block located to the left of the target block, a reconstructed block located above the target block, a reconstructed block located at the lower left corner of the target block, a reconstructed block located at the upper right corner of the target block, or a reconstructed block located at the upper left corner of the target block.

[0559] Each of the encoding apparatus 100 and the decoding apparatus 200 can identify a block existing at a position in the col picture spatially corresponding to the target block. The position of the target block in the target picture and the position of the identified block in the col picture can correspond to each other.

[0560] Each of the encoding apparatus 100 and the decoding apparatus 200 can determine a col block existing at a pre-defined relative position with respect to the identified block as a temporal candidate. The pre-defined relative position can be a position existing inside and / or outside the identified block.

[0561] For example, the col block can include a first col block and a second col block. When the coordinates of the identified block are (xP, yP) and the size of the identified block is represented by (nPSW, nPSH), the first col block can be a block located at coordinates (xP + nPSW, yP + nPSH). The second col block can be a block located at coordinates (xP + (nPSW>>1), yP + (nPSH>>1)). When the first col block is not available, the second col block can be selectively used.

[0562] The motion vector of the target block can be determined based on the motion vector of the col block. Each of the encoding apparatus 100 and the decoding apparatus 200 can scale the motion vector of the col block. The scaled motion vector of the col block can be used as the motion vector of the target block. Further, the motion vector of the motion information for the temporal candidate stored in the list can be the scaled motion vector.

[0563] The ratio of the motion vector of the target block to the motion vector of the col block can be the same as the ratio of the first time distance to the second time distance. The first time distance can be the distance between the reference frame and the target frame of the target block. The second time distance can be the distance between the reference frame and the col frame of the col block.

[0564] The scheme used to derive motion information can be changed depending on the inter-frame prediction mode of the target block. For example, inter-frame prediction modes applied to inter-frame prediction may include Advanced Motion Vector Prediction (AMVP) mode, merge mode, skip mode, merge mode with motion vector difference, sub-block merge mode, triangle partitioning mode, inter-frame / intra-frame combined prediction mode, affine inter-frame mode, and current frame reference mode. The merge mode can also be called "motion merge mode." The following provides a detailed explanation of each mode.

[0565] 1) AMVP mode When using AMVP mode, the encoding device 100 can search for similar blocks in the neighborhood of the target block. The encoding device 100 can obtain a predicted block by performing a prediction on the target block using the motion information of the found similar blocks. The encoding device 100 can encode a residual block, where the residual block is the difference between the target block and the predicted block.

[0566] 1-1) Creation of the list of candidate motion vectors for prediction When the AMVP mode is used as the prediction mode, each of the encoding device 100 and the decoding device 200 can create a prediction motion vector candidate list using spatial candidate motion vectors, temporal candidate motion vectors, and zero vectors. The prediction motion vector candidate list may include one or more prediction motion vector candidates. At least one of the spatial candidate motion vectors, temporal candidate motion vectors, and zero vectors can be determined and used as a prediction motion vector candidate.

[0567] In the following text, the terms “predicted motion vector (candidate)” and “motion vector (candidate)” may be used as having the same meaning and may be used interchangeably with each other.

[0568] In the following text, the terms “predicted motion vector candidate” and “AMVP candidate” may be used as having the same meaning and may be used interchangeably.

[0569] In the following text, the terms “predicted motion vector candidate list” and “AMVP candidate list” may be used as having the same meaning and may be used interchangeably.

[0570] Spatial candidates can include reconstructed spatial neighbor blocks. In other words, the motion vectors of the reconstructed neighbor blocks can be referred to as "spatial prediction motion vector candidates".

[0571] The temporal candidate can include a col-block and a block adjacent to the col-block. In other words, a motion vector of the col-block or a motion vector of a block adjacent to the col-block can be referred to as a "temporal prediction motion vector candidate."

[0572] The zero vector can be a (0, 0) motion vector.

[0573] The prediction motion vector candidate can be a motion vector predictor for a prediction motion vector. Also, in the encoding apparatus 100, each prediction motion vector candidate can be an initial search location for a motion vector.

[0574] 1-2) Searching for motion vectors using a list of predicted motion vector candidates The encoding apparatus 100 can determine a motion vector to be used for encoding the target block within a search range using a list of the prediction motion vector candidates. Also, the encoding apparatus 100 can determine a prediction motion vector candidate to be used as a prediction motion vector of the target block among the prediction motion vector candidates existing in the list of the prediction motion vector candidates.

[0575] The motion vector to be used for encoding the target block can be a motion vector that can be encoded with a minimum cost.

[0576] Also, the encoding apparatus 100 can determine whether to encode the target block using the AMVP mode.

[0577] 1-3) Transmission of inter-frame prediction information The encoding apparatus 100 can generate a bitstream including inter prediction information required for inter prediction. The decoding apparatus 200 can perform inter prediction on the target block using the inter prediction information of the bitstream.

[0578] The inter prediction information can include 1) mode information indicating whether to use the AMVP mode, 2) a prediction motion vector index, 3) a motion vector difference (MVD), 4) a reference direction, and 5) a reference picture index.

[0579] Hereinafter, the terms "prediction motion vector index" and "AMVP index" can be used as having the same meaning and can be used interchangeably with each other.

[0580] Also, the inter prediction information can include a residual signal.

[0581] When the mode information indicates to use the AMVP mode, the decoding apparatus 200 can acquire the prediction motion vector index, the MVD, the reference direction, and the reference picture index from the bitstream through entropy decoding.

[0582] The prediction motion vector index can indicate a prediction motion vector candidate to be used for prediction of the target block among the prediction motion vector candidates included in the list of the prediction motion vector candidates.

[0583] 1-4) Inter-frame prediction in AMVP mode using inter-frame prediction information The decoding device 200 can derive the prediction motion vector candidate using the prediction motion vector candidate list, and can determine the motion information of the target block based on the derived prediction motion vector candidate.

[0584] The decoding device 200 can determine the motion vector candidate for the target block using the prediction motion vector index among the prediction motion vector candidates included in the prediction motion vector candidate list. The decoding device 200 can select the prediction motion vector candidate indicated by the prediction motion vector index from among the prediction motion vector candidates included in the prediction motion vector candidate list as the prediction motion vector of the target block.

[0585] The encoding device 100 can generate the entropy-encoded prediction motion vector index by applying entropy encoding to the prediction motion vector index, and can generate the bitstream including the entropy-encoded prediction motion vector index. The entropy-encoded prediction motion vector index can be signaled from the encoding device 100 to the decoding device 200 through the bitstream. The decoding device 200 can extract the entropy-encoded prediction motion vector index from the bitstream, and can acquire the prediction motion vector index by applying entropy decoding to the entropy-encoded prediction motion vector index.

[0586] The motion vector to be actually used for inter prediction of the target block can not match the prediction motion vector. In order to indicate the difference between the motion vector to be actually used for inter prediction of the target block and the prediction motion vector, the MVD can be used. The encoding device 100 can derive the prediction motion vector similar to the motion vector to be actually used for inter prediction of the target block in order to use the smallest MVD as possible.

[0587] The motion vector difference (MVD) can be the difference between the motion vector of the target block and the prediction motion vector. The encoding device 100 can calculate the MVD, and can generate the entropy-encoded MVD by applying entropy encoding to the MVD. The encoding device 100 can generate the bitstream including the entropy-encoded MVD.

[0588] The MVD can be transmitted from the encoding device 100 to the decoding device 200 through the bitstream. The decoding device 200 can extract the entropy-encoded MVD from the bitstream, and can acquire the MVD by applying entropy decoding to the entropy-encoded MVD.

[0589] The decoding device 200 can derive the motion vector of the target block by summing the MVD and the prediction motion vector. In other words, the motion vector of the target block derived by the decoding device 200 can be the sum of the MVD and the motion vector candidate.

[0590] Further, the encoding apparatus 100 can generate entropy-encoded MVD resolution information by applying entropy encoding to the calculated MVD resolution information, and can generate a bitstream including the entropy-encoded MVD resolution information. The decoding apparatus 200 can extract the entropy-encoded MVD resolution information from the bitstream, and can acquire the MVD resolution information by applying entropy decoding to the entropy-encoded MVD resolution information. The decoding apparatus 200 can use the MVD resolution information to adjust the resolution of the MVD.

[0591] In addition, the encoding apparatus 100 can calculate the MVD based on an affine model. The decoding apparatus 200 can derive an affine control motion vector of the target block by the sum of the MVD and the affine control motion vector candidate, and can use the affine control motion vector to derive motion vectors of sub-blocks.

[0592] The reference direction can indicate a list of reference pictures to be used for prediction of the target block. For example, the reference direction can indicate one of a reference picture list L0 and a reference picture list L1.

[0593] The reference direction indicates only a list of reference pictures to be used for prediction of the target block, and can not mean that the direction of the reference picture is restricted to a forward direction or a backward direction. In other words, each of the reference picture list L0 and the reference picture list L1 can include pictures in the forward direction and / or the backward direction.

[0594] The reference direction being unidirectional can mean that a single reference picture list is used. The reference direction being bidirectional can mean that two reference picture lists are used. In other words, the reference direction can indicate one of a case where only the reference picture list L0 is used, a case where only the reference picture list L1 is used, and a case where two reference picture lists are used.

[0595] The reference picture index can indicate a reference picture used for prediction of the target block among reference pictures existing in a reference picture list. The encoding apparatus 100 can generate entropy-encoded reference picture index by applying entropy encoding to the reference picture index, and can generate a bitstream including the entropy-encoded reference picture index. The entropy-encoded reference picture index can be signaled from the encoding apparatus 100 to the decoding apparatus 200 through the bitstream. The decoding apparatus 200 can extract the entropy-encoded reference picture index from the bitstream, and can acquire the reference picture index by applying entropy decoding to the entropy-encoded reference picture index.

[0596] When the target block is predicted using two reference picture lists, a single reference picture index and a single motion vector can be used for each of the reference picture lists. Further, when the target block is predicted using two reference picture lists, two prediction blocks can be specified for the target block. For example, a (final) prediction block of the target block can be generated using an average or a weighted sum of the two prediction blocks of the target block.

[0597] The motion vector of the target block can be derived by the predicted motion vector index, the MVD, the reference direction, and the reference picture index.

[0598] The decoding device 200 can generate a prediction block for the target block based on the derived motion vector and the reference picture index. For example, the prediction block can be a reference block in the reference picture indicated by the reference picture index, indicated by the derived motion vector.

[0599] Since the predicted motion vector index and the MVD are encoded without encoding the motion vector of the target block itself, the number of bits transmitted from the encoding device 100 to the decoding device 200 can be reduced, and the encoding efficiency can be improved.

[0600] For the target block, the motion information of the reconstructed neighboring block can be used. In a certain inter prediction mode, the encoding device 100 can not encode the actual motion information of the target block separately. Instead of encoding the motion information of the target block, additional information that enables the motion information of the target block to be derived using the motion information of the reconstructed neighboring block can be encoded. Since the additional information is encoded, the number of bits transmitted to the decoding device 200 can be reduced, and the encoding efficiency can be improved.

[0601] For example, as the inter prediction mode in which the motion information of the target block is not directly encoded, there can be a skip mode and / or a merge mode. Here, each of the encoding device 100 and the decoding device 200 can use an identifier and / or an index indicating a unit in the reconstructed neighboring unit whose motion information is to be used as the motion information of the target unit.

[0602] 2) Merge Mode As a scheme of deriving the motion information of the target block, there is a merge. The term "merge" can mean a merge of the motion of a plurality of blocks. The "merge" can mean that the motion information of one block is also applied to other blocks. In other words, the merge mode can be a mode in which the motion information of the target block is derived from the motion information of the neighboring block.

[0603] When the merge mode is used, the encoding device 100 can predict the motion information of the target block using the motion information of a spatial candidate and / or the motion information of a temporal candidate. The spatial candidate can include a reconstructed spatial neighboring block that is spatially adjacent to the target block. The spatial neighboring block can include a left neighboring block and an above neighboring block. The temporal candidate can include a col block. The terms "spatial candidate" and "spatial merge candidate" can be used to have the same meaning and can be used interchangeably with each other. The terms "temporal candidate" and "temporal merge candidate" can be used to have the same meaning and can be used interchangeably with each other.

[0604] The encoding apparatus 100 can acquire a prediction block via prediction. The encoding apparatus 100 can encode a residual block, wherein the residual block is a difference between the target block and the prediction block.

[0605] 2-1) Creation of the merged candidate list When using the merge mode, each of the encoding apparatus 100 and the decoding apparatus 200 can create a merge candidate list using motion information of a spatial candidate and / or motion information of a temporal candidate. The motion information can include 1) a motion vector, 2) a reference picture index, and 3) a reference direction. The reference direction can be uni-directional or bi-directional. The reference direction can mean an inter prediction indicator.

[0606] The merge candidate list can include a merge candidate. The merge candidate can be motion information. In other words, the merge candidate list can be a list in which a plurality of pieces of motion information are stored.

[0607] The merge candidate can be a plurality of pieces of motion information of a temporal candidate and / or a spatial candidate. In other words, the merge candidate list can include motion information of a temporal candidate and / or a spatial candidate, etc.

[0608] In addition, the merge candidate list can include a new merge candidate generated by a combination of the merge candidates already existing in the merge candidate list. In other words, the merge candidate list can include new motion information generated by a combination of a plurality of pieces of motion information previously existing in the merge candidate list.

[0609] In addition, the merge candidate list can include a history-based merge candidate. The history-based merge candidate can be motion information of a block encoded and / or decoded before the target block.

[0610] In addition, the merge candidate list can include a merge candidate based on an average of two merge candidates.

[0611] The merge candidate can be a specific mode of deriving inter prediction information. The merge candidate can be information indicating a specific mode of deriving inter prediction information. The inter prediction information of the target block can be derived according to the specific mode indicated by the merge candidate. In addition, the specific mode can include a process of deriving a series of inter prediction information. The specific mode can be an inter prediction information derivation mode or a motion information derivation mode.

[0612] The inter prediction information of the target block can be derived according to a mode indicated by a merge candidate selected by a merge index among the merge candidates in the merge candidate list.

[0613] For example, the motion information derivation mode in the merge candidate list can be at least one of 1) a motion information derivation mode for a sub-block unit and 2) an affine motion information derivation mode.

[0614] In addition, the merge candidate list can include motion information of a zero vector. The zero vector can also be referred to as a "zero merge candidate."

[0615] In other words, the plurality of pieces of motion information in the merge candidate list can be at least one of 1) motion information of a spatial candidate, 2) motion information of a temporal candidate, 3) motion information generated by a combination of previously existing pieces of motion information in the merge candidate list, and 4) a zero vector.

[0616] The motion information can include 1) a motion vector, 2) a reference picture index, and 3) a reference direction. The reference direction can also be referred to as an "inter prediction indicator." The reference direction can be unidirectional or bidirectional. The unidirectional reference direction can indicate L0 prediction or L1 prediction.

[0617] The merge candidate list can be created before performing prediction in the merge mode.

[0618] The number of merge candidates in the merge candidate list can be predefined. Each of the encoding apparatus 100 and the decoding apparatus 200 can add merge candidates to the merge candidate list according to a predefined scheme and a predefined priority, such that the merge candidate list has a predefined number of merge candidates. The merge candidate list of the encoding apparatus 100 and the merge candidate list of the decoding apparatus 200 can be made identical to each other using the predefined scheme and the predefined priority.

[0619] Merge can be applied on a CU or PU basis. When performing merge on a CU basis or on a PU basis, the encoding apparatus 100 can transmit a bitstream including predefined information to the decoding apparatus 200. For example, the predefined information can include 1) information indicating whether merge is performed for each block partition, and 2) information about blocks among blocks that are spatial candidates and / or temporal candidates for a target block, with which merge is to be performed.

[0620] 2-2) Search for motion vectors using a merged candidate list The encoding apparatus 100 can determine a merge candidate to be used for encoding a target block. For example, the encoding apparatus 100 can perform prediction on the target block using a merge candidate in the merge candidate list, and can generate a residual block for the merge candidate. The encoding apparatus 100 can encode the target block using a merge candidate that causes the least cost in prediction and encoding of the residual block.

[0621] In addition, the encoding apparatus 100 can determine whether to encode a target block using the merge mode.

[0622] 2-3) Transmission of inter-frame prediction information The encoding apparatus 100 can generate a bitstream including inter prediction information required for inter prediction. The encoding apparatus 100 can generate entropy-encoded inter prediction information by performing entropy encoding on the inter prediction information, and can transmit the bitstream including the entropy-encoded inter prediction information to the decoding apparatus 200. The entropy-encoded inter prediction information can be signaled by the encoding apparatus 100 to the decoding apparatus 200 through the bitstream. The decoding apparatus 200 can extract the entropy-encoded inter prediction information from the bitstream, and can acquire the inter prediction information by applying entropy decoding to the entropy-encoded inter prediction information.

[0623] The decoding apparatus 200 can perform inter prediction on the target block using the inter prediction information of the bitstream.

[0624] The inter prediction information can include 1) mode information indicating whether to use a merge mode, 2) a merge index, and 3) correction information.

[0625] In addition, the inter prediction information can include a residual signal.

[0626] The decoding apparatus 200 can acquire the merge index from the bitstream only when the mode information indicates that the merge mode is used.

[0627] The mode information can be a merge flag. A unit of the mode information can be a block. Information about a block can include the mode information, and the mode information can indicate whether the merge mode is applied to the block.

[0628] The merge index can indicate a merge candidate to be used for prediction of the target block among merge candidates included in a merge candidate list. Alternatively, the merge index can indicate a block to which the target block is to be merged among neighboring blocks adjacent to the target block in space or time.

[0629] The encoding apparatus 100 can select a merge candidate having the highest encoding performance among the merge candidates included in the merge candidate list, and set a value of the merge index to indicate the selected merge candidate.

[0630] The correction information can be information for correcting a motion vector. The encoding apparatus 100 can generate the correction information. The decoding apparatus 200 can correct the motion vector of the merge candidate selected by the merge index based on the correction information.

[0631] The correction information can include at least one of information indicating whether to perform correction, correction direction information, and correction size information. A prediction mode in which a motion vector is corrected based on the signaled correction information can be referred to as a "merge mode with a motion vector difference."

[0632] 2-4) Inter-frame prediction using merging mode with inter-frame prediction information The decoding apparatus 200 can perform prediction on the target block using a merge candidate indicated by the merge index among the merge candidates included in the merge candidate list.

[0633] The motion vector of the target block can be specified by the motion vector, the reference picture index, and the reference direction of the merge candidate indicated by the merge index.

[0634] 3) Skip Mode The skip mode can be a mode in which the motion information of the spatial candidate or the motion information of the temporal candidate is applied to the target block without change. In addition, the skip mode can be a mode in which a residual signal is not used. In other words, when the skip mode is used, the reconstructed block can be identical to the predicted block.

[0635] The difference between the merge mode and the skip mode is whether a residual signal is transmitted or used. That is, the skip mode can be similar to the merge mode except that the residual signal is not transmitted or used.

[0636] When the skip mode is used, the encoding apparatus 100 can transmit information about a block, among blocks that are spatial candidates or temporal candidates, whose motion information is to be used as the motion information of the target block, to the decoding apparatus 200 through a bitstream. The encoding apparatus 100 can generate entropy-encoded information by performing entropy encoding on the information, and can signal the entropy-encoded information to the decoding apparatus 200 through the bitstream. The decoding apparatus 200 can extract the entropy-encoded information from the bitstream, and can acquire the information by applying entropy decoding to the entropy-encoded information.

[0637] In addition, when the skip mode is used, the encoding apparatus 100 can not transmit other syntax information, such as an MVD, to the decoding apparatus 200. For example, when the skip mode is used, the encoding apparatus 100 can not signal syntax elements related to at least one of an MVD, a coded block flag, and a transform coefficient level, to the decoding apparatus 200.

[0638] 3-1) Creation of the merged candidate list The skip mode can also use a merge candidate list. In other words, the merge candidate list can be used in both the merge mode and the skip mode. In this regard, the merge candidate list can also be referred to as a "skip candidate list" or a "merge / skip candidate list."

[0639] Alternatively, the skip mode can use an additional candidate list that is different from the merge candidate list of the merge mode. In this case, in the following description, the merge candidate list and the merge candidate can be replaced with a skip candidate list and a skip candidate, respectively.

[0640] The merge candidate list can be created before performing prediction in the skip mode.

[0641] The skip mode can be a mode in which the motion information of the spatial candidate or the motion information of the temporal candidate is applied to the target block without change. In addition, the skip mode can be a mode in which a residual signal is not used. In other words, when the skip mode is used, the reconstructed block can be identical to the predicted block.

[0635] The difference between the merge mode and the skip mode is whether a residual signal is transmitted or used. That is, the skip mode can be similar to the merge mode except that the residual signal is not transmitted or used.

[0636] When the skip mode is used, the encoding apparatus 100 can transmit information about a block, among blocks that are spatial candidates or temporal candidates, whose motion information is to be used as the motion information of the target block, to the decoding apparatus 200 through a bitstream. The encoding apparatus 100 can generate entropy-encoded information by performing entropy encoding on the information, and can signal the entropy-encoded information to the decoding apparatus 200 through the bitstream. The decoding apparatus 200 can extract the entropy-encoded information from the bitstream, and can acquire the information by applying entropy decoding to the entropy-encoded information.

[0637] In addition, when the skip mode is used, the encoding apparatus 100 can not transmit other syntax information, such as an MVD, to the decoding apparatus 200. For example, when the skip mode is used, the encoding apparatus 100 can not signal syntax elements related to at least one of an MVD, a coded block flag, and a transform coefficient level, to the decoding apparatus 200.

[0638] 3-1) Creation of the merged candidate list The skip mode can also use a merge candidate list. In other words, the merge candidate list can be used in both the merge mode and the skip mode. In this regard, the merge candidate list can also be referred to as a "skip candidate list" or a "merge / skip candidate list."

[0639] Alternatively, the skip mode can use an additional candidate list that is different from the merge candidate list of the merge mode. In this case, in the following description, the merge candidate list and the merge candidate can be replaced with a skip candidate list and a skip candidate, respectively.

[0640] The merge candidate list can be created before performing prediction in the skip mode.

[0641] 3-2) Search for motion vectors using a merged candidate list The encoding apparatus 100 can determine a merge candidate to be used for encoding the target block. For example, the encoding apparatus 100 can perform prediction on the target block using a merge candidate in a merge candidate list. The encoding apparatus 100 can encode the target block using a merge candidate that results in a minimum cost in the prediction.

[0642] In addition, the encoding apparatus 100 can determine whether to encode the target block using a skip mode.

[0643] 3-3) Transmission of inter-frame prediction information The encoding apparatus 100 can generate a bitstream including inter prediction information required for inter prediction. The decoding apparatus 200 can perform inter prediction on the target block using the inter prediction information in the bitstream.

[0644] The inter prediction information can include 1) mode information indicating whether to use a skip mode, and 2) a skip index.

[0645] The skip index can be the same as the above-described merge index.

[0646] When the skip mode is used, the target block can be encoded without using a residual signal. The inter prediction information can not include the residual signal. Alternatively, the bitstream can not include the residual signal.

[0647] The decoding apparatus 200 can acquire the skip index from the bitstream only when the mode information indicates that the skip mode is used. As described above, the merge index and the skip index can be the same as each other. The decoding apparatus 200 can acquire the skip index from the bitstream only when the mode information indicates that the merge mode or the skip mode is used.

[0648] The skip index can indicate a merge candidate, among merge candidates included in the merge candidate list, to be used for prediction of the target block.

[0649] 3-4) Inter-frame prediction in skip mode using inter-frame prediction information The decoding apparatus 200 can perform prediction on the target block using the merge candidate indicated by the skip index, among the merge candidates included in the merge candidate list.

[0650] A motion vector of the target block can be specified by a motion vector, a reference picture index, and a reference direction of the merge candidate indicated by the skip index.

[0651] 4) Current screen reference mode The current picture reference mode can represent a prediction mode using a previously reconstructed region in a target picture to which the target block belongs.

[0652] A motion vector used to specify a previously reconstructed region can be used. A reference picture index of the target block can be used to determine whether the target block has been coded in the current picture reference mode.

[0653] A flag or index indicating whether the target block is a block coded in the current picture reference mode can be signaled by the encoding device 100 to the decoding device 200. Alternatively, whether the target block is a block coded in the current picture reference mode can be inferred by the reference picture index of the target block.

[0654] When the target block is coded in the current picture reference mode, the target picture can exist in a fixed position or an arbitrary position in the reference picture list for the target block.

[0655] For example, the fixed position can be a position with a value of 0 or a last position of the reference picture index.

[0656] When the target picture exists in an arbitrary position in the reference picture list, an additional reference picture index indicating such an arbitrary position can be signaled by the encoding device 100 to the decoding device 200.

[0657] 5) Sub-block merging mode The sub-block merge mode can be a mode of deriving motion information from sub-blocks of a CU.

[0658] When the sub-block merge mode is applied, a motion information of a collocated sub-block (col sub-block) of the target sub-block in the reference image (i.e., a sub-block based temporal merge candidate) and / or an affine control point motion vector merge candidate can be used to generate a sub-block merge candidate list.

[0659] 6) Triangle partitioning mode In the triangle partition mode, the target block can be partitioned in diagonal directions, and sub-target blocks generated by the partitioning can be generated. For each sub-target block, motion information of the corresponding sub-target block can be derived, and prediction samples for each sub-target block can be derived using the derived motion information. Prediction samples of the target block can be derived by a weighted sum of the prediction samples of the sub-target blocks generated by the partitioning.

[0660] 7) Combined inter-frame and intra-frame prediction modes The combined inter-intra prediction mode can be a mode of deriving prediction samples of the target block using a weighted sum of prediction samples generated via inter prediction and prediction samples generated via intra prediction.

[0661] In the above-described mode, the decoding device 200 can autonomously correct the derived motion information. For example, the decoding device 200 can search for motion information having a minimum sum of absolute difference (SAD) in a certain region based on a reference block indicated by the derived motion information, and can derive the found motion information as the corrected motion information.

[0662] In the above-described mode, the decoding device 200 can use the optical flow to compensate for the prediction samples derived via inter prediction.

[0663] In the above-described AMVP mode, merge mode, skip mode, etc., the index information of the list can be used to specify the motion information to be used for prediction of the target block among the plurality of pieces of motion information in the list.

[0664] To improve coding efficiency, the encoding device 100 can signal only an index of an element among the elements in the list that incurs a minimum cost in inter prediction of the target block. The encoding device 100 can code the index, and can signal the coded index.

[0665] Therefore, the above-described list (i.e., the prediction motion vector candidate list and the merge candidate list) must be able to be derived by the encoding device 100 and the decoding device 200 based on the same data using the same scheme. Here, the same data can include the reconstructed picture and the reconstructed block. Furthermore, to specify the elements using the index, the order of the elements in the list must be fixed.

[0666] Figure 10 A spatial candidate according to an embodiment is shown.

[0667] In Figure 10 A position of the spatial candidate is shown.

[0668] A large block in the center of the figure can represent a target block. Five small blocks can represent spatial candidates.

[0669] A coordinate of the target block can be (xP, yP), and a size of the target block can be represented by (nPSW, nPSH).

[0670] The spatial candidate A0 can be a block adjacent to a lower left corner of the target block. A0 can be a block occupying pixels located at coordinates (xP - 1, yP + nPSH).

[0671] The spatial candidate A1 can be a block adjacent to a left side of the target block. A1 can be a lowermost block among blocks adjacent to the left side of the target block. Alternatively, A1 can be a block adjacent to a top of A0. A1 can be a block occupying pixels located at coordinates (xP - 1, yP + nPSH - 1).

[0672] The spatial candidate B0 can be a block adjacent to the top-left corner of the target block. B0 can be a block that occupies the pixel located at the coordinates (xP, yP).

[0673] The spatial candidate B1 can be a block adjacent to the top of the target block. B1 can be the rightmost block among the blocks adjacent to the top of the target block. Alternatively, B1 can be a block adjacent to the left of B0. B1 can be a block that occupies the pixel located at the coordinates (xP + nPSW - 1, yP - 1).

[0674] The spatial candidate B2 can be a block adjacent to the top-left corner of the target block. B2 can be a block that occupies the pixel located at the coordinates (xP - 1, yP - 1).

[0675] Determining the availability of spatial and temporal candidates To include the motion information of the spatial candidate or the motion information of the temporal candidate in the list, it is necessary to determine whether the motion information of the spatial candidate or the motion information of the temporal candidate is available.

[0676] Hereinafter, the candidate block can include the spatial candidate and the temporal candidate.

[0677] For example, the determination can be performed by sequentially applying the following steps 1) to 4).

[0678] Step 1) When the PU including the candidate block is outside the boundary of the picture, the availability of the candidate block can be set to "false". The expression "the availability is set to false" can have the same meaning as "is set to be unavailable".

[0679] Step 2) When the PU including the candidate block is outside the boundary of the slice, the availability of the candidate block can be set to "false". When the target block and the candidate block are located in different slices, the availability of the candidate block can be set to "false".

[0680] Step 3) When the PU including the candidate block is outside the boundary of the parallel block, the availability of the candidate block can be set to "false". When the target block and the candidate block are located in different parallel blocks, the availability of the candidate block can be set to "false".

[0681] Step 4) When the prediction mode of the PU including the candidate block is an intra prediction mode, the availability of the candidate block can be set to "false". When the PU including the candidate block does not use inter prediction, the availability of the candidate block can be set to "false".

[0682] Figure 11 An order of adding the motion information of the spatial candidate to the merge list according to an embodiment is shown.

[0683] As Figure 11As shown in FIG. 1, the order of A1, B1, B0, A0, and B2 can be used when adding the pieces of motion information of the spatial candidates to the merge list. That is, the pieces of motion information of the available spatial candidates can be added to the merge list in the order of A1, B1, B0, A0, and B2.

[0684] Methods for deriving merge lists in merge mode and skip mode As described above, the maximum number of merge candidates in the merge list can be set. The set maximum number is indicated by "N". The set number can be transmitted from the encoding apparatus 100 to the decoding apparatus 200. The slice header of a slice can include N. In other words, the maximum number of merge candidates in the merge list for a target block of a slice can be set through the slice header. For example, the value of N can be substantially 5.

[0685] The pieces of motion information (i.e., merge candidates) can be added to the merge list in the order of the following steps 1) to 4).

[0686] Step 1) In the spatial candidates, the available spatial candidates can be added to the merge list. The pieces of motion information of the available spatial candidates can be added to the merge list in the order shown in FIG. 1. Figure 11 The pieces of motion information of the available spatial candidates can be added to the merge list in the order shown in FIG. 1. Here, when the motion information of the available spatial candidate overlaps with other motion information already existing in the merge list, the motion information can not be added to the merge list. The operation of checking whether the corresponding motion information overlaps with other motion information existing in the list can be simply referred to as "overlap check".

[0687] The maximum number of added pieces of motion information can be N.

[0688] Step 2) When the number of pieces of motion information in the merge list is less than N and the temporal candidate is available, the motion information of the temporal candidate can be added to the merge list. Here, when the motion information of the available temporal candidate overlaps with other motion information already existing in the merge list, the motion information can not be added to the merge list.

[0689] Step 3) When the number of pieces of motion information in the merge list is less than N and the type of the target slice is "B", the combined motion information generated by combining bi-prediction (bi-pred) can be added to the merge list.

[0690] The target slice can be a slice including a target block.

[0691] The combined motion information can be a combination of L0 motion information and L1 motion information. The L0 motion information can be motion information that refers to only a reference picture list L0. The L1 motion information can be motion information that refers to only a reference picture list L1.

[0692] In the merge list, there can be one or more pieces of L0 motion information. Also, in the merge list, there can be one or more pieces of L1 motion information.

[0693] The combined motion information can include one or more pieces of combined motion information. When the combined motion information is generated, one or more pieces of L0 motion information and one or more pieces of L1 motion information that will be used for generation can be predefined among the L0 motion information and the L1 motion information in the merge list. The one or more pieces of combined motion information can be generated in a predefined order via combined bi-prediction that uses a pair of different motion information in the merge list. One of the pair of different motion information can be L0 motion information, and the other of the pair can be L1 motion information.

[0694] For example, the combined motion information added with the highest priority can be a combination of L0 motion information having a merge index 0 and L1 motion information having a merge index 1. When the motion information having the merge index 0 is not L0 motion information or when the motion information having the merge index 1 is not L1 motion information, the combined motion information can not be generated or added. Next, the combined motion information added with the next priority can be a combination of L0 motion information having a merge index 1 and L1 motion information having a merge index 0. Subsequent detailed combinations can conform to other combinations in the field of video encoding / decoding.

[0695] Here, when the combined motion information overlaps other motion information already existing in the merge list, the combined motion information can not be added to the merge list.

[0696] Step 4) When the number of pieces of motion information in the merge list is less than N, motion information of a zero vector can be added to the merge list.

[0697] The zero vector motion information can be motion information in which a motion vector is a zero vector.

[0698] The number of pieces of zero vector motion information can be one or more. Reference picture indexes of the one or more pieces of zero vector motion information can be different from each other. For example, a value of a reference picture index of first zero vector motion information can be 0. A value of a reference picture index of second zero vector motion information can be 1.

[0699] The number of pieces of zero vector motion information can be the same as the number of reference pictures in a reference picture list.

[0700] The reference direction of the zero vector motion information can be bi-directional. Two of the motion vectors can be zero vectors. The number of the zero vector motion information can be the smaller one of the number of reference pictures in the reference picture list L0 and the number of reference pictures in the reference picture list L1. Alternatively, when the number of reference pictures in the reference picture list L0 and the number of reference pictures in the reference picture list L1 are not the same as each other, the reference direction as unidirectional can be used for the reference picture index which can be applied to only a single reference picture list.

[0701] The encoding apparatus 100 and / or the decoding apparatus 200 can sequentially add the zero vector motion information to the merge list while changing the reference picture index.

[0702] When the zero vector motion information overlaps with other motion information already existing in the merge list, the zero vector motion information can not be added to the merge list.

[0703] The order of the above steps 1) to 4) is merely exemplary and can be changed. In addition, some of the above steps can be omitted according to a predefined condition.

[0704] A method for deriving a candidate list of predicted motion vectors in AMVP mode The maximum number of the prediction motion vector candidates in the prediction motion vector candidate list can be predefined. The predefined maximum number is indicated by N. For example, the predefined maximum number can be 2.

[0705] The multiple pieces of motion information (i.e., prediction motion vector candidates) can be added to the prediction motion vector candidate list in the order of the following steps 1) to 3).

[0706] Step 1) The available spatial candidates among the spatial candidates can be added to the prediction motion vector candidate list. The spatial candidates can include a first spatial candidate and a second spatial candidate.

[0707] The first spatial candidate can be one of A0, A1, scaled A0, and scaled A1. The second spatial candidate can be one of B0, B1, B2, scaled B0, scaled B1, and scaled B2.

[0708] The multiple pieces of motion information of the available spatial candidates can be added to the prediction motion vector candidate list in the order of the first spatial candidate and the second spatial candidate. In this case, when the motion information of the available spatial candidates overlaps with other motion information already existing in the prediction motion vector candidate list, the motion information can not be added to the prediction motion vector candidate list. In other words, when the value of N is 2, if the motion information of the second spatial candidate is the same as that of the first spatial candidate, the motion information of the second spatial candidate can not be added to the prediction motion vector candidate list.

[0709] The maximum number of motion information added can be N.

[0710] Step 2) When the number of motion information in the prediction motion vector candidate list is less than N and a temporal candidate is available, the motion information of the temporal candidate can be added to the prediction motion vector candidate list. In this case, when the motion information of the available temporal candidate overlaps with other motion information already existing in the prediction motion vector candidate list, the motion information can not be added to the prediction motion vector candidate list.

[0711] Step 3) When the number of motion information in the prediction motion vector candidate list is less than N, zero vector motion information can be added to the prediction motion vector candidate list.

[0712] The zero vector motion information can include one or more pieces of zero vector motion information. The reference picture indexes of the one or more pieces of zero vector motion information can be different from each other.

[0713] The encoding apparatus 100 and / or the decoding apparatus 200 can sequentially add the plurality of pieces of zero vector motion information to the prediction motion vector candidate list while changing the reference picture index.

[0714] When the zero vector motion information overlaps with other motion information already existing in the prediction motion vector candidate list, the zero vector motion information can not be added to the prediction motion vector candidate list.

[0715] The description of the zero vector motion information made above in connection with the merge list can also be applied to the zero vector motion information. Repetitive description thereof will be omitted.

[0716] The order of the above-described steps 1) to 3) is merely exemplary and can be changed. Furthermore, some of the steps can be omitted according to a pre-defined condition.

[0717] Figure 12 A transform and quantization process according to an example is illustrated.

[0718] As Figure 12 indicated, a quantization level can be generated by performing a transform and / or quantization process on a residual signal.

[0719] The residual signal can be generated as a difference between an original block and a prediction block. Here, the prediction block can be a block generated via intra prediction or inter prediction.

[0720] The residual signal can be transformed into a signal in a frequency domain through a transform process as a part of a quantization process.

[0721] A transform kernel used for the transform can include various DCT kernels such as a discrete cosine transform (DCT) type 2 (DCT-II) and a discrete sine transform (DST) kernel.

[0722] The transform cores can perform a separable transform or a two-dimensional (2D) non-separable transform on the residual signal. The separable transform can refer to performing a one-dimensional (1D) transform on the residual signal in each of a horizontal direction and a vertical direction.

[0723] The DCT types and the DST types adaptively used for the 1D transform can include DCT-V, DCT-VIII, DST-I, and DST-VII in addition to DCT-II, as shown in each of Table 3 below and Table 4 below.

[0724]

Table 3

[0725]

Table 4

[0726] As shown in Table 3 and Table 4, when a DCT type or a DST type to be used for a transform is derived, a transform set can be used. Each transform set can include a plurality of transform candidates. Each transform candidate can be a DCT type or a DST type.

[0727] Table 5 below shows an example of a transform set to be applied to a horizontal direction and a transform set to be applied to a vertical direction according to an intra prediction mode.

[0728]

Table 5

[0729] In Table 5, the number of vertical transform sets and horizontal transform sets to be applied to a residual signal according to an intra prediction mode of a target block is indicated.

[0730] As exemplified in Table 5, a transform set to be applied to a horizontal direction and a vertical direction can be predefined according to an intra prediction mode of a target block. The encoding device 100 can perform a transform and an inverse transform on a residual signal using a transform included in a transform set corresponding to the intra prediction mode of the target block. Also, the decoding device 200 can perform an inverse transform on a residual signal using a transform included in a transform set corresponding to the intra prediction mode of the target block.

[0731] In the transform and the inverse transform, a transform set to be applied to a residual signal can be determined as exemplified in Table 3, 4, and 5, and can not be signaled. Transform indication information can be signaled from the encoding device 100 to the decoding device 200. The transform indication information can be information indicating which of a plurality of transform candidates included in a transform set to be applied to a residual signal is used.

[0732] For example, when the size of the target block is 64x64 or less, a transform set having three transforms can be respectively configured according to the intra prediction mode. A best transform method can be selected from a total of nine multi-transform methods generated by a combination of three transforms in the horizontal direction and three transforms in the vertical direction. Through such a best transform method, a residual signal can be encoded and / or decoded, and thus coding efficiency can be improved.

[0733] Here, information indicating which one of the transforms belonging to each transform set has been used for at least one of the vertical transform and the horizontal transform can be entropy encoded and / or decoded. Here, truncated unary binarization can be used to encode and / or decode such information.

[0734] As described above, the method of using various transforms can be applied to a residual signal generated via intra prediction or inter prediction.

[0735] The transform can include at least one of a primary transform and a secondary transform. A transform coefficient can be generated by performing the primary transform on the residual signal, and a secondary transform coefficient can be generated by performing the secondary transform on the transform coefficient.

[0736] The primary transform can be referred to as a "primary transform." Also, the primary transform can be referred to as an "adaptive multi-transform (AMT) scheme." The AMT can mean that different transforms are applied to each 1D direction (i.e., the vertical direction and the horizontal direction) as described above.

[0737] The secondary transform can be a transform for improving the concentration of energy on the transform coefficient generated by the primary transform. Like the primary transform, the secondary transform can be a separable transform or a non-separable transform. Such a non-separable transform can be a non-separable secondary transform (NSST).

[0738] The primary transform can be performed using at least one of a plurality of predefined transform methods. For example, the plurality of predefined transform methods can include a discrete cosine transform (DCT), a discrete sine transform (DST), a Karhunen-Loeve transform (KLT), etc.

[0739] Also, the primary transform can be a transform in which a kernel function defining a discrete cosine transform (DCT) or a discrete sine transform (DST) has various transform types.

[0740] For example, the transform type can be determined based on at least one of 1) a prediction mode of the target block (e.g., one of intra prediction and inter prediction), 2) a size of the target block, 3) a shape of the target block, 4) an intra prediction mode of the target block, 5) a component of the target block (e.g., one of a luma component and a chroma component), and 6) a partition type applied to the target block (e.g., one of a quad tree, a binary tree, and a ternary tree).

[0741] For example, according to the transform kernel presented in Table 6 below, the first transform can include transforms such as DCT-2, DCT-5, DCT-7, DST-7, DST-1, DST-8, and DCT-8. In Table 6 below, various transform types and transform kernel functions for multi-transform selection (MTS) are exemplified.

[0742] The MTS can refer to selection of a combination of one or more DCT and / or DST kernels in order to transform a residual signal in a horizontal and / or vertical direction.

[0743]

Table 6

[0744] In Table 6, i and j can be integer values equal to or greater than 0 and less than or equal to N-1.

[0745] A secondary transform can be performed on the transform coefficients generated by performing the first transform.

[0746] As in the first transform, a transform set can also be defined in the secondary transform. The method for deriving and / or determining the above-described transform set can be applied not only to the first transform but also to the secondary transform.

[0747] The first transform and the secondary transform can be determined for a specific target.

[0748] For example, the first transform and the secondary transform can be applied to a signal component corresponding to one or more of a luma component and a chroma component. Whether to apply the first transform and / or the secondary transform can be determined according to at least one of an encoding parameter for a target block and / or a neighboring block. For example, whether to apply the first transform and / or the secondary transform can be determined according to a size and / or a shape of the target block.

[0749] In the encoding apparatus 100 and the decoding apparatus 200, transform information indicating a transform method to be used for a target can be derived by utilizing the specification information.

[0750] For example, the transform information can include a transform index to be used for a primary transform and / or a secondary transform. Alternatively, the transform information can indicate that the primary transform and / or the secondary transform is not used.

[0751] For example, when the target of the primary transform and the secondary transform is a target block, the transform method(s) to be applied to the primary transform and / or the secondary transform indicated by the transform information can be determined according to at least one of an encoding parameter for the target block and / or a block neighboring the target block.

[0752] Alternatively, the transform information indicating the transform method for a specific target can be transmitted from the encoding apparatus 100 to the decoding apparatus 200.

[0753] For example, for a single CU, whether to use a primary transform, an index indicating the primary transform, whether to use a secondary transform, and an index indicating the secondary transform can be derived by the decoding device 200 as the transform information. Alternatively, for a single CU, the transform information indicating whether to use a primary transform, an index indicating the primary transform, whether to use a secondary transform, and an index indicating the secondary transform can be signaled.

[0754] Quantized transform coefficients (i.e., quantization levels) can be generated by performing quantization on a result generated by performing a primary transform and / or a secondary transform, or performing quantization on a residual signal.

[0755] Figure 13 A diagonal scan according to an example is shown.

[0756] Figure 14 A horizontal scan according to an example is shown.

[0757] Figure 15 A vertical scan according to an example is shown.

[0758] Quantized transform coefficients can be scanned via at least one of a (top right) diagonal scan, a vertical scan, and a horizontal scan according to at least one of an intra prediction mode, a block size, and a block shape. The block can be a transform unit (TU).

[0759] Each scan can be initiated at a certain starting point and can be terminated at a certain ending point.

[0760] For example, by scanning the coefficients of a block using a diagonal scan of Figure 13 , the quantized transform coefficients can be changed into a 1D vector form. Alternatively, instead of a diagonal scan, a horizontal scan of Figure 14 or a vertical scan of Figure 15 may be used according to the size of the block and / or the intra prediction mode.

[0761] The vertical scan can be an operation of scanning 2D block type coefficients in a column direction. The horizontal scan can be an operation of scanning 2D block type coefficients in a row direction.

[0762] In other words, which one of the diagonal scan, the vertical scan, and the horizontal scan is to be used can be determined according to the size of the block and / or the inter prediction mode.

[0763] As shown in Figure 13 , Figure 14 and Figure 15 , the quantized transform coefficients can be scanned along a diagonal direction, a horizontal direction, or a vertical direction.

[0764] The quantized transform coefficients can be represented by a block shape. Each block can include a plurality of sub-blocks. Each sub-block can be defined according to a minimum block size or a minimum block shape.

[0765] In the scanning, a scan order according to a type or a direction of the scan can be mainly applied to the sub-blocks. In addition, a scan sequence according to a direction of the scan can be applied to the quantized transform coefficients in each sub-block.

[0766] For example, as shown in Figure 13 , Figure 14 and Figure 15 , when a size of a target block is 8x8, the quantized transform coefficients can be generated by a primary transform, a secondary transform, and quantization of a residual signal of the target block. Accordingly, one of three types of scan sequences can be applied to four 4x4 sub-blocks, and the quantized transform coefficients can also be scanned for each 4x4 sub-block according to the scan sequence.

[0767] The encoding apparatus 100 can generate entropy-encoded quantized transform coefficients by performing entropy encoding on the scanned quantized transform coefficients, and can generate a bitstream including the entropy-encoded quantized transform coefficients.

[0768] The decoding apparatus 200 can extract the entropy-encoded quantized transform coefficients from the bitstream, and can generate quantized transform coefficients by performing entropy decoding on the entropy-encoded quantized transform coefficients. The quantized transform coefficients can be aligned in the form of 2D blocks via inverse scanning. Here, as a method of inverse scanning, at least one of a right-up diagonal scan, a vertical scan, and a horizontal scan can be performed.

[0769] In the decoding apparatus 200, dequantization of the quantized transform coefficients can be performed. A result generated by performing the dequantization can be subjected to a secondary inverse transform according to whether the secondary inverse transform is performed. In addition, a result generated by performing the secondary inverse transform can be subjected to a primary inverse transform according to whether the primary inverse transform is to be performed. A reconstructed residual signal can be generated by performing the primary inverse transform on a result generated by performing the secondary inverse transform.

[0770] For a luma component reconstructed via intra prediction or inter prediction, inverse mapping with a dynamic range can be performed before in-loop filtering.

[0771] The dynamic range can be divided into 16 equal segments, and a mapping function for each segment can be signaled. Such a mapping function can be signaled at a slice level or a parallel block group level.

[0772] An inverse mapping function for performing the inverse mapping can be derived based on the mapping function.

[0773] In-loop filtering, storage of a reference picture, and motion compensation can be performed in the inverse mapping region.

[0774] A prediction block generated via inter prediction can be changed to a mapped region by using a mapping of a mapping function, and the changed prediction block can be used to generate a reconstructed block. However, since intra prediction is performed in the mapped region, a prediction block generated via intra prediction can be used to generate a reconstructed block without the need for mapping and / or inverse mapping.

[0775] For example, when the target block is a residual block of a chroma component, the residual block can be changed to an inverse mapped region by scaling the chroma component of the mapped region.

[0776] Whether scaling is available can be signaled at a slice level or a parallel block group level.

[0777] For example, scaling can be applied only to a case where mapping is available for a luma component and partitions of the luma component and partitions of a chroma component follow the same tree structure.

[0778] Scaling can be performed based on an average value of values of samples in a luma prediction block, where the luma prediction block corresponds to a chroma prediction block. Here, when the target block uses inter prediction, the luma prediction block can mean a mapped luma prediction block.

[0779] A lookup table can be referred to by using an index of a bin to which an average value of sample values of the luma prediction block belongs to derive a value required for scaling.

[0780] A residual block can be changed to an inverse mapped region by scaling the residual block using the finally derived value. Thereafter, for a block of a chroma component, reconstruction, intra prediction, inter prediction, in-loop filtering, and storage of a reference picture can be performed in the inverse mapped region.

[0781] For example, information indicating whether mapping and / or inverse mapping of a luma component and a chroma component is available can be signaled by a sequence parameter set.

[0782] A prediction block for a target block can be generated based on a block vector. The block vector can indicate a displacement between the target block and a reference block. The reference block can be a block in a target image.

[0783] In this way, a prediction mode in which a prediction block is generated by referring to a target image can be referred to as an "intra block copy (IBC) mode".

[0784] The IBC mode can be applied to a CU having a certain size. For example, the IBC mode can be applied to an M×N CU. Here, M and N can be less than or equal to 64.

[0785] The IBC mode can include a skip mode, a merge mode, an AMVP mode, etc. In the case of the skip mode or the merge mode, a merge candidate list can be configured, and a merge index is signaled, and thus a single merge candidate can be designated among the merge candidates present in the merge candidate list. A block vector of the designated merge candidate can be used as a block vector of the target block.

[0786] In the case of the AMVP mode, a differential block vector can be signaled. In addition, a prediction block vector can be derived from a left neighboring block and an above neighboring block of the target block. In addition, an index indicating which neighboring block will be used can be signaled.

[0787] The prediction block in the IBC mode can be included in a target CTU or a left CTU, and can be limited to a block within a previously reconstructed region. For example, a value of a block vector can be limited such that the prediction block of the target block is located in a certain region. The certain region can be a region defined by three 64x64 blocks that are coded and / or decoded before a 64x64 block including the target block. In this way, the value of the block vector is limited, and thus memory consumption and device complexity caused by implementation of the IBC mode can be reduced.

[0788] Figure 16 is a configuration diagram of an encoding apparatus according to an embodiment.

[0789] The encoding apparatus 1600 can correspond to the encoding apparatus 100 described above.

[0790] The encoding apparatus 1600 can include a processing unit 1610, a memory 1630, a user interface (UI) input device 1650, a UI output device 1660, and a storage device 1640, which communicate with each other through a bus 1690. The encoding apparatus 1600 can further include a communication unit 1620 coupled to a network 1699.

[0791] The processing unit 1610 can be a central processing unit (CPU) or a semiconductor device for executing processing instructions stored in the memory 1630 or the storage device 1640. The processing unit 1610 can be at least one hardware processor.

[0792] The processing unit 1610 can generate and process signals, data, or information input to, output from, or used in the encoding apparatus 1600, and can perform checks, comparisons, determinations, etc. related to the signals, data, or information. In other words, in an embodiment, the generation and processing of data or information and the checks, comparisons, and determinations related to the data or information can be performed by the processing unit 1610.

[0793] The processing unit 1610 can include an inter prediction unit 110, an intra prediction unit 120, a switcher 115, a subtractor 125, a transform unit 130, a quantization unit 140, an entropy encoding unit 150, a dequantization unit 160, an inverse transform unit 170, an adder 175, a filter unit 180, and a reference picture buffer 190.

[0794] At least some of the inter prediction unit 110, the intra prediction unit 120, the switcher 115, the subtractor 125, the transform unit 130, the quantization unit 140, the entropy encoding unit 150, the dequantization unit 160, the inverse transform unit 170, the adder 175, the filter unit 180, and the reference picture buffer 190 can be program modules, and can communicate with an external device or system. The program modules can be included in the encoding device 1600 in the form of an operating system, an application program module, or other program modules.

[0795] At least some of the program modules can also be stored in a remote storage device capable of communicating with the encoding device 1600.

[0796] The program modules can include, but are not limited to, routines, sub-routines, programs, objects, components, and data structures for performing functions or operations according to embodiments or for implementing abstract data types according to embodiments.

[0797] The program modules can be implemented using instructions or codes executed by at least one processor of the encoding device 1600.

[0798] The processing unit 1610 can execute instructions or codes in the inter prediction unit 110, the intra prediction unit 120, the switcher 115, the subtractor 125, the transform unit 130, the quantization unit 140, the entropy encoding unit 150, the dequantization unit 160, the inverse transform unit 170, the adder 175, the filter unit 180, and the reference picture buffer 190.

[0799] The storage unit can represent the memory 1630 and / or the storage 1640. Each of the memory 1630 and the storage 1640 can be any one of various types of volatile or non-volatile storage media. For example, the memory 1630 can include at least one of a Read Only Memory (ROM) 1631 and a Random Access Memory (RAM) 1632.

[0800] The storage unit can store data or information for operations of the encoding device 1600. In an embodiment, data or information of the encoding device 1600 can be stored in the storage unit.

[0801] For example, the storage unit can store a picture, a block, a list, motion information, inter prediction information, a bitstream, etc.

[0802] The encoding apparatus 1600 can be implemented in a computer system including a computer readable storage medium.

[0803] The storage medium can store at least one module required for the operation of the encoding apparatus 1600. The memory 1630 can store at least one module and can be configured such that at least one module is executed by the processing unit 1610.

[0804] The communication related to the data or information of the encoding apparatus 1600 can be performed by the communication unit 1620.

[0805] For example, the communication unit 1620 can transmit a bitstream to a decoding apparatus 1600 to be described later.

[0806] Figure 17 is a configuration diagram of a decoding apparatus according to an embodiment.

[0807] The decoding apparatus 1700 can correspond to the decoding apparatus 200 described above.

[0808] The decoding apparatus 1700 can include a processing unit 1710, a memory 1730, a user interface (UI) input device 1750, a UI output device 1760, and a storage device 1740, which communicate with each other through a bus 1790. The decoding apparatus 1700 can further include a communication unit 1720 coupled to a network 1799.

[0809] The processing unit 1710 can be a central processing unit (CPU) or a semiconductor device for executing processing instructions stored in the memory 1730 or the storage device 1740. The processing unit 1710 can be at least one hardware processor.

[0810] The processing unit 1710 can generate and process signals, data, or information input to the decoding apparatus 1700, output from the decoding apparatus 1700, or used in the decoding apparatus 1700, and can perform checking, comparing, determining, etc. related to the signals, data, or information. In other words, in an embodiment, the generation and processing of data or information and the checking, comparing, and determining related to the data or information can be performed by the processing unit 1710.

[0811] The processing unit 1710 can include an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra prediction unit 240, an inter prediction unit 250, a switch 245, an adder 255, a filter unit 260, and a reference picture buffer 270.

[0812] At least some of the entropy decoding unit 210, the inverse quantization unit 220, the inverse transform unit 230, the intra prediction unit 240, the inter prediction unit 250, the adder 255, the switch 245, the filter unit 260, and the reference picture buffer 270 of the decoding device 200 can be program modules, and can communicate with external devices or systems. The program modules can be included in the decoding device 1700 in the form of operating systems, application programs, or other program modules.

[0813] The program modules can be physically stored in various types of well-known storage devices. Also, at least some of the program modules can be stored in remote storage devices capable of communicating with the decoding device 1700.

[0814] The program modules can include, but are not limited to, routines, sub-routines, programs, objects, components, and data structures for performing functions or operations according to embodiments or for implementing abstract data types according to embodiments.

[0815] The program modules can be implemented using instructions or codes executed by at least one processor of the decoding device 1700.

[0816] The processing unit 1710 can execute instructions or codes in the entropy decoding unit 210, the inverse quantization unit 220, the inverse transform unit 230, the intra prediction unit 240, the inter prediction unit 250, the switch 245, the adder 255, the filter unit 260, and the reference picture buffer 270.

[0817] The storage unit can represent the memory 1730 and / or the storage 1740. Each of the memory 1730 and the storage 1740 can be any one of various types of volatile storage media or non-volatile storage media. For example, the memory 1730 can include at least one of a ROM 1731 and a RAM 1732.

[0818] The storage unit can store data or information for operations of the decoding device 1700. In an embodiment, the data or information of the decoding device 1700 can be stored in the storage unit.

[0819] For example, the storage unit can store pictures, blocks, lists, motion information, inter prediction information, bitstreams, etc.

[0820] The decoding device 1700 can be implemented in a computer system including a computer readable storage medium.

[0821] The storage medium can store at least one module required for operations of the decoding device 1700. The memory 1730 can store the at least one module, and can be configured such that the at least one module is executed by the processing unit 1710.

[0822] The communication related to the data or information of the decoding apparatus 1700 can be performed through the communication unit 1720.

[0823] For example, the communication unit 1720 can receive a bitstream from the encoding apparatus 1700.

[0824] Hereinafter, the processing unit can denote the processing unit 1610 of the encoding apparatus 1600 and / or the processing unit 1710 of the decoding apparatus 1700. For example, with respect to the function related to prediction, the processing unit can denote the switcher 115 and / or the switcher 245. With respect to the function related to inter prediction, the processing unit can denote the inter prediction unit 110, the subtractor 125, and the adder 175, and can denote the inter prediction unit 250 and the adder 255. With respect to the function related to intra prediction, the processing unit can denote the intra prediction unit 120, the subtractor 125, and the adder 175, and can denote the intra prediction unit 240 and the adder 255. With respect to the function related to transform, the processing unit can denote the transform unit 130 and the inverse transform unit 170, and can denote the inverse transform unit 230. With respect to the function related to quantization, the processing unit can denote the quantization unit 140 and the inverse quantization unit 160, and can denote the inverse quantization unit 220. With respect to the function related to entropy encoding and / or entropy decoding, the processing unit can denote the entropy encoding unit 150 and / or the entropy decoding unit 210. With respect to the function related to filtering, the processing unit can denote the filter unit 180 and / or the filter unit 260. With respect to the function related to reference picture, the processing unit can denote the reference picture buffer 190 and / or the reference picture buffer 270.

[0825] With reference to the above description, embodiments of the image encoding / decoding method and apparatus for performing intra block copy or intra template matching and the recording medium storing a bitstream proposed in the disclosure will be described.

[0826] One picture can be encoded / decoded based on at least one of an intra prediction mode, an inter prediction mode, an intra block copy mode, or an intra template matching prediction mode.

[0827] In addition, one block can be encoded / decoded based on at least one of an intra prediction mode, an inter prediction mode, an intra block copy mode, or an intra template matching prediction mode.

[0828] The encoding / decoding method based on intra block copy prediction or the encoding / decoding method based on intra template matching prediction can be used in at least one of a case where a luma component and a chroma component have independent block partition structures (i.e., a dual tree structure) or a case where the luma component and the chroma component have the same block partition structure (i.e., a single tree structure).

[0829] The intra block copy prediction mode can be a method for deriving a prediction block from a pre-encoded / decoded region within the same picture using a block vector (BV). The same picture can refer to a picture including a current block as a prediction target, i.e., a current picture. The current block denotes a current encoding / decoding target block.

[0830] The block vector can also be referred to as an intra block vector.

[0831] The intra template matching prediction (Intra TMP) mode can set a block pre-encoded / decoded around a current block as a template, and derive a prediction block of the current block by using the template. Specifically, in a pre-encoded / decoded region within a current picture, a reference template having a lowest template matching cost with the template of the current block can be searched, and the current block can be derived using a reference block corresponding to the searched reference template as a prediction block of the current block. Further, a position difference between the current block and the reference block can be referred to as a block vector. Further, the block vector can also be referred to as an intra block vector.

[0832] Optionally, the intra template matching prediction (Intra TMP) mode can be used to derive a block vector of the current block. As an example, when the intra template matching prediction mode is applied, a template of the current block can be used to configure a template matching candidate list including at least one (e.g., N) template matching block vector candidate from a pre-encoded / decoded region in the current picture according to a template cost. Then, a template matching block vector candidate included in the template matching candidate list can be selected, and information indicating an index of the selected candidate can be encoded. In a decoder, a block vector of the current block can be derived from the template matching block vector candidate indicated by the index.

[0833] The pre-encoded / decoded region in the current picture can also be referred to as a region in a reconstructed image or a region in a decoded image of the current picture. The region in the reconstructed image can refer to a pre-reconstructed region in the current picture, and the region in the decoded image can refer to a pre-decoded region in the current picture.

[0834] Here, the pre-encoded / decoded region in the current picture can be a region to which at least one in-loop filter is not applied. The in-loop filter can include at least one of chroma scaling and luma mapping, deblocking filtering, adaptive sample offset, or adaptive in-loop filtering. In other words, the intra block copy prediction mode can refer to a non-reconstructed region in which at least one of chroma scaling and luma mapping, deblocking filtering, adaptive sample offset, or adaptive in-loop filtering in the current picture is not performed.

[0835] Optionally, on the contrary, a pre-encoded / decoded region in the current picture to which at least one in-loop filter is applied can be used to derive a prediction block based on the intra block copy prediction mode.

[0836] In the embodiments described below, it should be understood that applying the embodiments described in terms of block vector or motion vector to the intra template matching prediction method is also included in the spirit of the present application.

[0837] As an example, the method for configuring a block vector candidate list or the method for encoding / decoding resolution information of a block vector disclosed in the embodiments described below can be applied to a method for configuring a template matching candidate list or a method for encoding / decoding resolution information of a block vector derived from a template matching candidate.

[0838] In addition, in the embodiments below, a block vector can be derived based on an intra block copy mode or a block vector can be derived based on an intra template matching prediction mode. Alternatively, the block vector can be a motion vector derived based on an inter prediction mode.

[0839] In addition, the intra template matching prediction mode can also be referred to as template matching prediction, template matching mode, intra template matching, intra template matching mode, or intra template matching prediction.

[0840] In addition, the intra prediction mode of a block to which the intra template matching prediction mode, the intra block copy mode, or the inter prediction is applied can be stored as a template-based intra mode derivation (TIMD) or a decoder-side intra mode derivation (DIMD) intra prediction mode.

[0841] When a current block is encoded / decoded in the intra block copy mode, a block vector of the current block can be derived. When the block vector derived for the current block is (x, y), a reference block having the same size as the current block including samples that are x apart from the current block in the horizontal direction (specifically, samples that are x apart in the right horizontal direction when x is a positive integer, and samples that are -x apart in the left horizontal direction when x is a negative integer) and samples that are y apart in the vertical direction (specifically, samples that are y apart in the lower vertical direction when y is a positive integer, and samples that are -y apart in the upper vertical direction when y is a negative integer) can be used as a prediction block of the current block. In this case, the reference block can exist in a pre-encoded / decoded area in the current picture.

[0842] Figure 18 An example of determining a reference block based on a block vector of a current block is shown.

[0843] As in the example shown in Figure 18 When the x component and the y component of the block vector are both negative integers and the top-left sample position of the current block is (x0, y0), a reference block whose top-left sample position is (x0+x, y0+y) can be selected.

[0844] The sign of the block vector and the sample position described in the above embodiments can be applied in reverse. For example, when x of the block vector is a positive integer, a sample x apart in the left horizontal direction can be selected, and when x is a negative integer, a sample -x apart in the right horizontal direction can be selected. Also, when y is a positive integer, a sample y apart in the upper horizontal direction can be selected, and when y is a negative integer, a sample -y apart in the lower horizontal direction can be selected.

[0845] Unlike the above embodiments, the size of the reference block can be different from the size of the current block. For example, the size of the current block can be reduced by performing down-sampling or sub-sampling on the current block. A reference block having the same size as the reduced-size current block is determined by the block vector of the current block. Thereafter, the prediction block of the current block can be derived by performing up-sampling or interpolation on the determined reference block.

[0846] At least one of the size of the current block or the size of the reference block can be adaptively determined according to at least one of the coding parameters of the current block / CTB / CTU.

[0847] When the prediction using the intra block copy mode is applied to the luma component block, the luma component block can be encoded / decoded using one of the following methods.

[0848] - Skip mode: Like the skip mode in the inter prediction mode, the block vector of the current block can be derived from the block vector of the block encoded / decoded before the current block. Also, when the skip mode is applied, the residual block of the current block can not be entropy encoded / decoded. In other words, the prediction block derived by the intra block copy mode can become the reconstructed block of the current block.

[0849] - Merge mode: Like the merge mode in the inter prediction mode, the block vector of the current block can be derived from the block vector of the block encoded / decoded before the current block. Also, when the merge mode is applied, the residual block of the current block can be entropy encoded / decoded.

[0850] - Intra block copy AMVP mode: Like the advanced motion vector prediction (AMVP) mode in the inter prediction mode, the block vector can be encoded / decoded. Specifically, one of the block vector prediction candidates included in the block vector prediction list can be selected, and the selected block vector prediction candidate can be set as the block vector prediction value. Also, the block vector difference showing the difference between the block vector and the block vector prediction value can be explicitly encoded / decoded. The decoder can derive the block vector of the current block by adding the block vector prediction value and the block vector difference.

[0851] Also, in the intra block copy mode, similar to the adaptive motion vector resolution (AMVR) mode in the inter prediction mode, one of at least one resolution can be selected and the block vector can be encoded / decoded at the selected resolution. The AMVR mode in the intra block copy mode can be referred to as an intra block copy AMVR mode.

[0852] Also, the intra block copy mode can be used as one of a plurality of modes configuring a multi-hypothesis mode. As an example, the multi-hypothesis mode can be to obtain a final prediction block of a current block by performing a weighted sum on a plurality of prediction blocks derived using a plurality of prediction modes. In this case, at least one of the plurality of prediction modes for the multi-hypothesis mode can be the intra block copy mode.

[0853] As an example, a final prediction block of a current block can be obtained based on a weighted sum operation of a first prediction block derived according to the intra block copy mode and a second prediction block derived based on at least one of an intra prediction mode, an inter prediction mode, or an intra block copy mode.

[0854] Also, when the multi-hypothesis mode is applied, instead of performing a weighted sum on a plurality of prediction blocks, a final prediction block of a current block can be derived based on a statistical value of the plurality of prediction blocks.

[0855] Information indicating whether at least one of the intra block copy skip mode, the intra block copy merge mode, the intra block copy AMVP mode, the intra block copy AMVR mode, or the multi-hypothesis intra block copy mode is used can be encoded / decoded. As an example, a flag indicating whether one of the listed modes is used can be encoded.

[0856] Also, the information can be entropy encoded / decoded according to at least one of an encoding parameter of a current block / CTB (or CTU) or a neighboring block / CTB adjacent to the current block / CTB.

[0857] Whether to perform a deblocking filter at a boundary of a current block can be determined depending on whether the intra block copy mode or the intra template matching prediction mode is performed.

[0858] For example, when at least one of neighboring blocks adjacent to a boundary of a current block is encoded / decoded in the intra block copy mode or the intra template matching prediction mode, the boundary of the current block can be set as a boundary of a target block on which the deblocking filter is to be performed. Accordingly, the deblocking filter can be performed on a boundary between the current block and the neighboring block.

[0859] As another example, when all of the neighboring blocks adjacent to the boundary of the current block are not coded / decoded in the intra block copy mode or the intra template matching prediction mode, the boundary of the current block is not set as the boundary of the target block on which the deblocking filtering is to be performed. Thus, the deblocking filtering can not be performed on the boundary between the current block and the neighboring blocks.

[0860] Further, in determining whether to apply the deblocking filter, the block to which the intra block copy mode or the intra template matching prediction mode is applied can be considered as the block to which the inter prediction mode is applied to determine whether to apply the deblocking filter. As an example, if the boundary of the current block is set as the boundary of the target block on which the deblocking filtering is to be performed when at least one of the neighboring blocks adjacent to the boundary of the current block is applied with the inter prediction mode, the boundary of the current block can be set as the boundary of the target block on which the deblocking filtering is to be performed even when the neighboring blocks adjacent to the boundary of the current block are coded / decoded in the intra block copy mode or the intra template matching prediction mode.

[0861] Optionally, in determining whether to apply the deblocking filter, the block to which the intra block copy mode or the intra template matching prediction mode is applied can be considered as the block to which the intra prediction mode is applied to determine whether to apply the deblocking filter. As an example, if the boundary of the current block is set as the boundary of the target block on which the deblocking filtering is to be performed when at least one of the neighboring blocks adjacent to the boundary of the current block is applied with the intra prediction mode, the boundary of the current block can be set as the boundary of the target block on which the deblocking filtering is to be performed even when the neighboring blocks adjacent to the boundary of the current block are coded / decoded in the intra block copy mode or the intra template matching prediction mode.

[0862] When it is determined to perform the deblocking filtering on the boundary of the current block, the deblocking filtering can be performed on at least a portion of the current block to which the intra block copy mode or the intra template matching prediction mode is applied. Specifically, the deblocking filter in units of 8x8 can be applied to the boundary of the current block.

[0863] At least one of whether to apply the deblocking filter to the boundary of the current block or the filtering strength of the deblocking filter can be determined according to at least one of the coding parameters of the intra block copy mode or the intra template matching prediction mode.

[0864] As an example, when a block vector difference between the current block and the neighboring block adjacent to the boundary of the current block is greater than or equal to a threshold value, the deblocking filter can be set to be applied at the boundary of the current block. Here, the block vector difference can include at least one of a difference in an x-axis component or a difference in a y-axis component.

[0865] According to the above-described coding information, the coding mode of the current luma component block can be determined as follows.

[0866] When the skip mode is applied to the current luma component block and the sub-picture, tile, parallel block, parallel block group, or slice including the current luma component block is of the I type, the coding mode of the current block can be determined as the intra block copy skip mode.

[0867] In the I type, the intra prediction mode and the intra block copy mode can be used, but the inter prediction can not be used. Thus, it can be determined that the intra block copy skip mode is applied to the current luma component block without entropy encoding / decoding the prediction mode information indicating whether the inter prediction is applied to the current luma component block.

[0868] In addition, when the skip mode is applied to the current luma component block and the sub-picture, tile, parallel block, parallel block group, or slice including the current luma component block is not of the I type, the prediction mode information can be entropy encoded / decoded. If it is determined based on the prediction mode information that the intra block copy mode is applied to the current luma component block, the coding mode of the current luma component block can be determined as the intra block copy skip mode. On the other hand, when it is determined based on the prediction mode information that the inter prediction mode is applied to the current luma component block, it can be determined that the inter prediction skip mode is applied to the current luma component block.

[0869] When it is determined based on the prediction mode information that the skip mode is not applied to the current luma component block, but the intra block copy mode is applied to the current luma component block, information indicating whether the merge mode is applied to the current luma component block can be entropy encoded / entropy-decoded.

[0870] In this case, when the information indicating whether the merge mode is applied indicates that the merge mode is applied to the current luma component block, it can be determined that the intra block copy merge mode is applied to the current luma component block.

[0871] Alternatively, it is assumed that the skip mode is not applied to the current luma component block, but the residual block is encoded / decoded with respect to the current luma component block and the current chroma component block. In this case, when it is determined based on the prediction mode information that the intra block copy mode is applied to the current luma component block, information indicating whether the merge mode is applied to the current luma component block can be entropy encoded / entropy-decoded.

[0872] In this case, when the information indicating whether the merge mode is applied indicates that the merge mode is applied to the current luma component block, it can be determined that the intra block copy merge mode is applied to the current luma component block.

[0873] When the information indicating whether to apply the merge mode indicates that the merge mode is not applied, it can be determined that the intra block copy AMVP mode is applied to the current luma component block. In other words, when it is determined that both the skip mode and the merge mode are not applied to the current luma component block and it is determined that the intra block copy mode is applied to the current luma component block, it can be determined that the intra block copy AMVP mode is applied to the current luma component block.

[0874] The coding mode of the current luma component block can be determined / derived based on at least one of the above-described coding information or at least one of coding parameters of the current block / CTB or a neighboring block / CTB adjacent to the current block / CTB.

[0875] In addition, in the disclosure, the intra block copy mode can refer to at least one of an intra block copy skip mode, an intra block copy merge mode, or an intra block copy AMVP mode.

[0876] Information related to partitioning of the CTU can be encoded / decoded.

[0877] As an example, qtbtt_dual_tree_intra_flag indicates whether root nodes for luma component blocks and chroma component blocks are the same for an I slice. As an example, when qtbtt_dual_tree_intra_flag is a first value (e.g., 0), it can indicate that 64x64 coding units partitioned from a CTU are not used as root nodes for luma components and chroma components. On the other hand, when qtbtt_dual_tree_intra_flag is a second value (e.g., 1), it can indicate that 64x64 coding units partitioned from a CTU are used as root nodes for luma components and chroma components.

[0878] When qtbtt_dual_tree_intra_flag is a first value (e.g., 0), it indicates that a block partition structure of a luma component and a block partition structure of a chroma component are the same. However, depending on a format of the chroma component, block sizes of the luma component and the chroma component can be different from each other. When the block partition structures of the luma component and the chroma component are the same, it can be referred to as a single tree structure. The single tree type can be identified as SINGLE_TREE.

[0879] When the slice type is I slice and qtbtt_dual_tree_intra_flag is a second value (e.g., 1), it indicates that the block partition structure of the luma component and the block partition structure of the chroma component can be different from each other when a 64x64 coding unit is used as a root node. In other words, the block partition structure of the luma component and the block partition structure of the chroma component can be determined independently. When the block partition structure of the luma component and the block partition structure of the chroma component are independent, it can be referred to as a dual tree structure. In the dual tree structure, the tree type of the luma component can be identified as DUAL_TREE_LUMA and the tree type of the chroma component can be identified as DUAL_TREE_CHROMA.

[0880] When the single tree structure is applied, the minimum size of the chroma component block for which the intra block copy mode is applied can be 2x2. In other words, blocks of the chroma component having a size smaller than 2x2 block can not be used. Thus, a 2x2 chroma component block for which the intra block copy mode is used can not be allowed to be partitioned into a size smaller than 2x2.

[0881] Alternatively, when the single tree structure is applied, the minimum size of the chroma component block for which the intra block copy mode is applied can be 4x4. In other words, blocks of the chroma component having a size smaller than 4x4 block (e.g., 2x2 block, 2x4 block, or 4x2 size) can not be used. Thus, a block larger than 2x2, 2x4, or 4x2 for which the intra block copy mode is used can not be allowed to be partitioned into a block of 2x2, 2x4, or 4x2 size.

[0882] Alternatively, when the dual tree structure is applied, the minimum size of the chroma component block for which the intra block copy mode is applied can be 4x4. In other words, blocks of the chroma component having a size smaller than 4x4 block (e.g., 2x2 block, 2x4 block, or 4x2 size) can not be used. Thus, a block larger than 2x2, 2x4, or 4x2 for which the intra block copy mode is used can not be allowed to be partitioned into a block of 2x2, 2x4, or 4x2 size.

[0883] To improve the subjective / objective image quality of an image, an encoder can perform a primary transform on a residual block to generate primary transform coefficients, and perform a secondary transform on the primary transform coefficients to generate secondary transform coefficients. Further, the secondary transform coefficients can be quantized to produce quantized coefficient levels, and the quantized coefficient levels can be entropy coded.

[0884] A decoder can perform entropy decoding on the quantized coefficient levels and dequantize the quantized coefficient levels to generate the secondary transform coefficients. Further, a secondary inverse transform can be performed on the secondary transform coefficients to generate the primary transform coefficients, and a primary inverse transform can be performed on the primary transform coefficients to reconstruct the residual block.

[0885] In the encoder, a secondary transform can be performed between a primary transform and quantization. In the decoder, a secondary inverse transform can be performed between inverse quantization and a primary inverse transform. In this case, the secondary transform can be a simplified secondary transform or a low-frequency non-separable transform (LFNST).

[0886] When the intra block copy mode is applied to the current block, the secondary transform / inverse transform can be applied to the current block. Here, the secondary transform / inverse transform can be performed on at least one of the current luma component block and the current chroma component block.

[0887] In addition, in order to perform the secondary transform / inverse transform, a transform matrix set of the current block can be determined. In this case, when the secondary transform is performed on the current block, a transform matrix index indicating which transform matrix among the transform matrices included in the transform matrix set is to be used for the secondary transform / inverse transform can be entropy encoded / decoded.

[0888] In the encoder / decoder, an encoding mode of the current chroma component block can be derived as follows.

[0889] First, when the luma component and the chroma component have the same block partition structure (i.e., SINGLE_TREE type), an encoding mode of the current chroma component block can be determined as follows.

[0890] A prediction mode of the current chroma component block can be set to be the same as a prediction mode of the corresponding current luma component block. Here, the prediction mode can include at least one of an intra prediction mode, an inter prediction mode, or an intra block copy mode.

[0891] As an example, when the intra block copy skip mode is applied to the current luma component block, encoding / decoding of a residual block can be omitted for the current chroma component block corresponding to the current luma component block, and thus residual block information can not be signaled. In addition, entropy encoding / decoding of information indicating whether the residual block information is signaled (e.g., a coding block flag (cu_cbf or tu_cbf)) can also be omitted. The coding block flag tu_cbf can include information of a chroma component (e.g., at least one of tu_cbf_cb or tu_cbf_cr). The entropy encoding / decoding of the coding block flag can be omitted, and it can be inferred that a value of the coding block flag indicates that the residual block information is not signaled.

[0892] Optionally, when the intra block copy merge mode is applied to the current luma component block, the encoding / decoding of the residual block can be omitted for the current chroma component block corresponding to the current luma component block, and thus the residual block information can not be signaled. In addition, the entropy encoding / decoding of the information (e.g., coding block flag (cu_cbf or tu_cbf)) indicating whether the residual block information is signaled can also be omitted. The coding block flag tu_cbf can include information of chroma components (e.g., at least one of tu_cbf_cb or tu_cbf_cr). The entropy encoding / decoding of the coding block flag can be omitted, and the value of the coding block flag can be inferred to indicate that the residual block information is not signaled.

[0893] When the luma component and the chroma component have the same block partition structure and the intra block copy mode is applied to the current chroma component block, the encoding / decoding information of the current chroma component block corresponding to the current luma component block can be derived from the encoding / decoding information of the current luma component block.

[0894] In this case, the encoding information of the current chroma component block can be derived from the encoding information of the luma component block corresponding to the sample position corresponding to the center of the current chroma component block. Alternatively, the encoding information of the current chroma component block can be derived from the encoding information of the luma component block corresponding to the sample position corresponding to the top-left corner of the current chroma component block.

[0895] The encoding mode of the current chroma component block can be derived based on at least one of the encoding parameters of the current chroma component block / CTB or the luma component block / CTB corresponding to the current chroma component block / CTB.

[0896] When the luma component and the chroma component have independent block partition structures (tree type DUAL_TREE_LUMA or DUAL_TREE_CHROMA for a dual tree structure), the encoding mode information for determining the encoding mode of the current chroma component block can be entropy encoded / decoded. Here, the encoding mode can represent a prediction mode. The encoding mode of the chroma component block can include at least one of an intra prediction mode, an inter prediction mode, or an intra block copy mode in the same manner as the encoding mode of the luma component block.

[0897] As an example, when a syntax element representing the prediction mode information of the current chroma component block has a first value (e.g., 0), the encoding mode of the current chroma component block can be determined as the intra prediction mode. When the syntax element representing the prediction mode information of the current chroma component block has a second value (e.g., 1), the encoding mode of the current chroma component block can be determined as the inter prediction mode. When the syntax element representing the prediction mode information of the current chroma component block has a third value (e.g., 2), the encoding mode of the current chroma component block can be determined as the intra block copy mode.

[0898] Optionally, based on the first prediction mode information (e.g., index, flag, or identifier (e.g., pred_mode_flag)), it can be determined whether the intra prediction mode is applied to the chroma component block. As an example, when the first prediction mode information has a first value (e.g., 1), it indicates that the intra prediction mode is applied to the chroma component block, and when the first prediction mode information has a second value (e.g., 0), it indicates that the intra prediction mode is not applied to the chroma component block.

[0899] When the intra prediction mode is not applied to the chroma component block, the second prediction mode information (e.g., index, flag, or identifier (e.g., pred_mode_ibc_flag)) can be additionally entropy coded / decoded. The second prediction mode information can indicate whether the intra prediction mode or the intra block copy mode is applied to the chroma component block. As an example, when the second prediction mode information has a first value (e.g., 1), it can indicate that the intra block copy mode is applied to the chroma component block. On the other hand, when the second prediction mode information has a second value (e.g., 2), it can indicate that the inter prediction mode is applied to the chroma component block.

[0900] Optionally, the first prediction mode information (e.g., index, flag, or identifier (e.g., pred_mode_flag)) can indicate whether the intra prediction mode or the inter prediction mode is applied to the chroma component block. As an example, when the first prediction mode information is a first value (e.g., 1), it indicates that the intra prediction mode is applied to the chroma component block. On the other hand, when the second prediction mode information has a second value (e.g., 0), it indicates that the inter prediction mode is applied to the chroma component block. The second prediction mode information (e.g., index, flag, or identifier (e.g., pred_mode_ibc_flag)) indicating whether the intra block copy mode is applied can be additionally entropy coded / decoded, or the value of the second prediction mode information can be derived. As an example, when the second prediction mode information is a first value (e.g., 1), it indicates that the intra block copy mode is applied to the chroma component block. On the other hand, when the second prediction mode information is a second value (e.g., 0), it indicates that the intra prediction mode or the inter prediction mode determined in the first prediction mode information is applied to the chroma component block.

[0901] Optionally, when the second prediction mode information is a first value (e.g., 1), it indicates that the intra block copy mode is applied to the chroma component block, and when the second prediction mode information is a second value (e.g., 0), it indicates that the intra prediction mode is applied to the chroma component block.

[0902] When the luma component and the chroma component have independent block partitioning structures and the intra block copy mode is applied to a current chroma component block, information required for encoding / decoding the current chroma component block can be derived from the encoded information of a luma component block corresponding to the current chroma component block (e.g., a block vector).

[0903] In this case, the encoded information of the luma component block corresponding to the sample position corresponding to the center of the current chroma component block can be used. Alternatively, the encoded information of the luma component block corresponding to the sample position corresponding to the upper left of the current chroma component block can be used.

[0904] Hereinafter, an image encoding / decoding process using an intra template matching prediction (Intra TMP) or an inter prediction according to the disclosure will be described in detail.

[0905] In the image encoding / decoding process, one picture can be encoded / decoded based on at least one of an inter prediction, an intra prediction, an intra template matching prediction, and an intra block copy mode. Also, a block in the picture can be encoded / decoded based on at least one of the inter prediction, the intra prediction, the intra template matching prediction, and the intra block copy mode. In this case, the prediction mode available to the block can depend on the prediction mode determined at the picture level.

[0906] As described above, the intra template matching mode can be used in the picture encoding / decoding process.

[0907] The intra template matching can set a portion of a reconstructed area around a current block as a template and search for a region most similar to the template within a search range to derive a prediction block of the current block. Here, the search range can refer to all or a portion of a previously reconstructed area within the same picture, and the same picture can refer to a current picture including the current block. Also, the reconstructed area around the current block that can be set as the template can include at least one of an area located above the current block, an area located to the left, an area located to the upper left, an area located to the lower left, and a previously encoded / decoded area within a CTB including the current block.

[0908] Further, the region most similar to the template can be a region corresponding to a position having a minimum matching cost with the template of the current block (i.e., a position having a minimum template matching cost). The region corresponding to the position having the minimum template matching cost can be set as a reference block or a prediction block of the current block.

[0909] A position difference between the current block and the reference block can be defined as a block vector. In other words, the block vector of the current block can be derived through the intra template matching prediction. The block vector derived through the intra template matching prediction can also be referred to as an intra template matching block vector.

[0910] A reconstructed region around the current block can be set as a template, and a block vector candidate list including I block vector candidates according to error cost within a search range can be configured. As an example, the I block vector candidates can be derived in an ascending order of error cost. I can be an integer greater than 0. As an example, I can be 15 or 19.

[0911] In addition, the template can include at least one of a reconstructed region adjacent to an upper side of the current block and a reconstructed region adjacent to a left side of the current block.

[0912] The block vector candidates included in the block vector candidate list can be ordered / inserted in an ascending or descending order of error cost. In other words, an index assigned to each of the block vector candidates can be determined in an ascending or descending order of error cost.

[0913] An index indicating at least one block vector candidate in the block vector candidate list can be entropy encoded / decoded. In a decoder, a block vector of the block vector candidate indicated by the index can be set as a block vector of the current block. In other words, a reference block of the current block can be derived by the block vector indicated by the index.

[0914] In addition, the block vector can have an integer pixel or sub-pixel resolution. As an example, the block vector of the current block can have an N integer pixel or 1 / N fractional pixel resolution. In this case, N can be at least one of 1, 2, 4, 8, and 16.

[0915] In addition, a search range for template matching can be variably set based on at least one of a width or a height of the current block.

[0916] As an example, the search range can consist of at least one rectangular region not exceeding an upper boundary and a left boundary of a CTB including the current block.

[0917] As an example, a size of the rectangular region configuring the search range can be determined by a width or a height of the current block. As an example, a width of the rectangular region can be M times a width of the current block, and a height of the rectangular region can be N times a height of the current block. Here, M and N can be integers greater than 0, for example, 5.

[0918] In addition, the search range can be limited to a region in which a pre-encoded / decoded pixel value exists within a region included in the at least one rectangular region.

[0919] Optionally, the search range can be limited to a range of block vectors that can be used in an intra block copy mode.

[0920] As another example, the search range can further include a reconstructed region within a CTB including the current block other than one rectangular region. Optionally, the search range can consist of only reconstructed regions within the CTB including the current block.

[0921] Here, the pre-encoding / decoding region within the current picture can be a state in which in-loop filtering is not performed. Here, the in-loop filtering can include at least one of chrominance scaling and luminance mapping, deblocking filtering, adaptive sample offset, adaptive in-loop filtering, or bilateral filtering.

[0922] Alternatively, the pre-encoding / decoding region within the current picture can be a region in which in-loop filtering is performed, or can be a reconstructed region within the current picture in which in-loop filtering is not performed. Further, the pre-encoding / decoding region within the current picture can be a reconstructed / decoded region within the current picture in which at least one of chrominance scaling and luminance mapping, deblocking filtering, adaptive sample offset, adaptive in-loop filtering, and bilateral filtering as in-loop filtering is performed.

[0923] The sample within the reconstructed region can be any one of a prediction sample and a residual sample, or can be a reconstructed sample derived by combining the prediction sample and the residual sample.

[0924] In this case, the prediction sample can be obtained based on at least one of intra prediction, inter prediction, intra block copy, or intra template matching prediction.

[0925] In addition, the sample obtained based on the specific prediction mode within the reconstructed region can not be included in the search range, or can be replaced with a specific value.

[0926] For example, when the reconstructed region is composed of prediction samples, the sample generated through inter prediction can be set not to be included in the reconstructed region.

[0927] For example, when the reconstructed region is composed of prediction samples, the sample encoded / decoded through inter prediction can be replaced with a specific value.

[0928] The specific value can be the same value as the neighboring prediction sample. In other words, the value of the neighboring prediction sample can be filled into the position of the sample encoded / decoded through inter prediction.

[0929] Alternatively, the specific value can be a statistical value of the neighboring prediction sample.

[0930] The encoding / decoding method based on intra template matching prediction can be used in at least one of a dual tree structure or a single tree structure. Here, the dual tree structure indicates that a luminance component and a chrominance component have independent block partition structures, and the single tree structure indicates that the luminance component and the chrominance component have the same block partition structure.

[0931] As an example, under the dual tree structure, the encoding / decoding method based on intra template matching prediction can be used as follows.

[0932] When the dual tree structure is applied, the template matching prediction mode information can be encoded / decoded independently for each of the luma component and the chroma components. Here, the template prediction mode information can be a 1-bit flag (e.g., template matching prediction mode flag).

[0933] In addition, only one template matching prediction mode information can be encoded / decoded for both chroma components (Cb, Cr). According to one template matching prediction mode information, the same mode can be applied to both chroma components.

[0934] Alternatively, the template matching prediction mode information can be encoded / decoded independently for both chroma components (Cb, Cr). In this case, it can be determined independently for each of the two chroma components whether to apply the template matching prediction mode.

[0935] When the template matching prediction is applied to each of the luma component and the chroma component, a template including a reconstructed area around a current block can be configured for each color component. Here, the current block can be a luma block or a chroma (e.g., Cb or Cr) block according to the color component.

[0936] When the intra prediction mode of the current chroma component is the same as the intra prediction mode of the luma component, it can be determined whether the template matching prediction mode is applied to the current chroma component based on whether the template matching prediction mode is applied to the luma component block. As an example, when the luma component block corresponding to the chroma component block is encoded / decoded by using the template matching prediction mode, the template matching prediction mode can also be applied to the current chroma component block. In this case, the template matching prediction mode flag for the chroma component can be omitted to be encoded / decoded. In other words, the template matching prediction mode flag can be encoded / decoded only for the luma component, and can not be encoded / decoded for the chroma component.

[0937] When the intra prediction mode of the current chroma component is the same as the intra prediction mode of the luma component, the intra prediction mode of the current chroma component can be determined based on whether the template matching prediction mode is applied to the luma component block. As an example, when the luma component block corresponding to the chroma component block is encoded / decoded by using the template matching prediction mode, the current chroma component block can be encoded / decoded by intra prediction based on a non-directional mode such as a planar mode or a DC mode. In this case, the template matching prediction mode flag for the chroma component can be omitted to be encoded / decoded.

[0938] For the luma component and the chroma component, when the template matching prediction mode is independently applied, the template matching block vector of each color component can also be independently derived. Accordingly, the template matching block vector of each color component can be the same or different.

[0939] Additionally, when the template matching prediction mode is applied independently to the Cb component and the Cr component, the template matching block vectors of the Cb component and the Cr component can also be derived independently. Thus, the template matching vectors of the Cb component and the Cr component can be the same or different.

[0940] When the template matching prediction mode is applied, the search range of the luma component can be greater than or equal to the search range of the chroma component. Further, the search range of the chroma component can be included in the search range of the luma component. Additionally, the size of the template for the luma component can be equal to or greater than the size of the template for the chroma component.

[0941] Under the single tree structure, the encoding / decoding method based on intra template matching prediction can be used as follows.

[0942] When the single tree structure is applied, the template matching prediction mode information can be encoded / decoded independently for each of the luma component and the chroma component. Here, the template prediction mode information can be a 1-bit flag (e.g., template matching prediction mode flag).

[0943] Additionally, only one template matching prediction mode information can be encoded / decoded for the two chroma components (Cb, Cr). According to one template matching prediction mode information, the same mode can be applied to the two chroma components.

[0944] Alternatively, the template matching prediction mode information can be encoded / decoded independently for the two chroma components (Cb, Cr). In this case, whether to apply the template matching prediction mode can be determined independently for each of the two chroma components.

[0945] As another example, under the single tree structure, only one template matching prediction mode information can be encoded / decoded for the luma component and the chroma component. Based on the single template matching prediction mode information, whether to use the template matching prediction mode can be determined for each of the luma component and the chroma component.

[0946] When the template matching prediction is applied to each of the luma component and the chroma component, a template including a reconstructed area around a current block can be configured for each color component. Here, the current block can be a luma block or a chroma (e.g., Cb or Cr) block according to the color component.

[0947] When the intra prediction mode of the current chroma component is the same as the intra prediction mode of the luma component, whether the template matching prediction mode is applied to the current chroma component can be determined based on whether the template matching prediction mode is applied to the luma component block. As an example, when the luma component block corresponding to the chroma component block is encoded / decoded by using the template matching prediction mode, the template matching prediction mode can also be applied to the current chroma component block. In this case, the template matching prediction mode flag for the chroma component can be omitted to be encoded / decoded. In other words, the template matching prediction mode flag can be encoded / decoded only for the luma component, and can not be encoded / decoded for the chroma component.

[0948] When the intra prediction mode of the current chroma component is the same as the intra prediction mode of the luma component, the intra prediction mode of the current chroma component can be determined based on whether the template matching prediction mode is applied to the luma component block. As an example, when the luma component block corresponding to the chroma component block is encoded / decoded by using the template matching prediction mode, the current chroma component block can be encoded / decoded by intra prediction based on a non-directional mode, such as a planar mode or a DC mode. In this case, the template matching prediction mode flag for the chroma component can be omitted to be encoded / decoded.

[0949] When one template matching prediction mode flag is encoded / decoded for the luma component and the chroma component, the template matching block vector of the chroma component can be set to be the same as the template matching block vector of the luma component. Alternatively, according to the chroma format, the template matching block vector of the luma component can be scaled to derive the template matching block vector of the chroma component.

[0950] As another example, when one template matching prediction mode flag is encoded / decoded for the luma component and the chroma component, the template matching block vector can be derived independently for each of the luma component and the chroma component. Thus, the template matching block vector of each color component can be the same or different.

[0951] As another example, when one template matching prediction mode flag is encoded / decoded for the Cb component and the Cr component, the template matching block vector can be derived independently for each of the Cb component and the Cr component. Thus, the template matching block vector of the Cb component and the Cr component can be the same or different.

[0952] For the luma component and the chroma component, when the template matching prediction mode is applied independently, the template matching block vector of each color component can also be derived independently. Thus, the template matching block vector of each color component can be the same or different.

[0953] Additionally, when the template matching prediction mode is applied independently to the Cb component and the Cr component, the template matching block vectors of the Cb component and the Cr component can also be derived independently. Thus, the template matching vectors of the Cb component and the Cr component can be the same or different.

[0954] When the template matching prediction mode is applied, the search range of the luma component can be greater than or equal to the search range of the chroma component. In addition, the search range of the chroma component can be included in the search range of the luma component. In addition, the size of the template for the luma component can be equal to or greater than the size of the template for the chroma component.

[0955] The template matching block vector determined based on the intra template matching prediction can be stored in a motion information buffer of the current block. The template matching block vector stored in the motion information buffer can be used to derive a block vector of a block coded / decoded after the current block.

[0956] As an example, when the intra block copy mode is applied to a block coded / decoded after the current block, the template matching block vector of the current block stored in the motion information buffer can be added to a block vector candidate list as a block vector candidate.

[0957] Optionally, when the template matching prediction mode is applied to a block coded / decoded after the current block, the template matching block vector of the current block stored in the motion information buffer can be added to a template matching block vector candidate list as a block vector candidate.

[0958] The motion information buffer can refer to a memory storing coded / decoded information, and can also be referred to as a coded / decoded information buffer.

[0959] The block vector candidate list used as the intra block copy mode can be based on the AMVP mode or the merge mode.

[0960] The block vector determined by the intra template matching prediction mode can be stored in sub-block units. Here, the sub-block can be a block having an integer size greater than 0. For example, the sub-block can be a 4x4 size block.

[0961] In this case, the intra template matching block vector can be stored in a memory, a line buffer, an array, etc.

[0962] Optionally, among the intra template matching block vectors of the current block derived / stored in sub-block units, only the intra template matching block vector located in the lowest line of the CTU including the current block can be stored in the line buffer.

[0963] The intra template matching block vector stored in the line buffer can be referred to in deriving the intra block vector of a coding / decoding block within a CTU adjacent to the bottom of the line buffer. As an example, when the intra block copy mode is applied to a coding / decoding block within a CTU at the bottom of the line buffer, the intra template matching block vector stored in the line buffer can be referred to in configuring a block vector candidate list of the corresponding coding / decoding block, and the intra template matching block vector stored in the line buffer can be inserted into the block vector list as a block vector candidate.

[0964] As another example, the intra template matching block vector can be stored in a buffer including a CTU row of the current block.

[0965] The intra template matching block vector can also be stored in a history block vector buffer for intra block copy.

[0966] The history block vector buffer for intra block copy can be referred to in a step of configuring a block vector candidate list for intra block copy. As an example, a block vector stored in the history block vector buffer can be added to a block vector candidate list of a block to which the intra block copy mode is applied as a block vector candidate.

[0967] In configuring a block vector candidate list for intra block copy for intra block copy of a current block, a block vector candidate can be derived from at least one of neighboring blocks adjacent to the current block. As an example, a block vector of a block coded / decoded by intra block copy in the neighboring block can be added to the block vector candidate list as a block vector candidate.

[0968] Optionally, a block vector of a block coded / decoded by intra template matching prediction in the neighboring block can be added to the block vector candidate list as a block vector candidate.

[0969] In other words, a block vector candidate of the current block can be derived by referring to a neighboring block to which the intra block copy mode or the intra template matching prediction mode is applied.

[0970] In addition, the history block vector buffer for intra block copy can be used in configuring a block vector candidate list of the current block. Specifically, at least one vector stored in the history block vector buffer can be added to the block vector candidate list of the current block.

[0971] Further, at least one of a block vector derived by the intra block copy mode or an intra template matching block vector can be stored in the history block vector buffer for intra block copy.

[0972] Based on the description, a method for coding / decoding a current block when an intra block copy mode, an intra template matching prediction mode, or an inter prediction mode is applied to the current block will be described in detail.

[0973] Figure 19 It is a flowchart of a method for encoding the current block in intra-block copy mode, intra-template matching prediction mode, or inter-frame prediction mode.

[0974] Figure 20 It is a flowchart of a method for decoding the current block in intra-block copy mode, intra-template matching prediction mode, or inter-frame prediction mode.

[0975] The following text will describe it in detail. Figure 19 and Figure 20 Each step in the process.

[0976] [E1 / D1] Derive the steps for motion vectors used in inter-frame prediction, or derive the steps for intra-frame template matching prediction. (Intra-frame TMP) or intra-frame block copy prediction of block vector steps; Predictive block vector information used for intra-frame template matching prediction or intra-frame block copy mode prediction may include at least one of the following: block vector, block vector resolution information, and / or information related to the prediction method.

[0977] In this case, the block vector can have a resolution that is an integer multiple of pixels (e.g., 1 or 4 pixels). Alternatively, the block vector can have a subpixel resolution of, for example, 1 / 2, 1 / 4, 1 / 8, or 1 / 16.

[0978] Information related to the prediction method may include information relating to at least one of intra-frame prediction, inter-frame prediction, intra-block copy prediction, local illumination compensation (LIC) prediction, filtered IBC (FIBC), template-match-based intra-block copy merging (IBC-TM merging), intra-template matching prediction (IntraTMP), geometric partitioning prediction, or reconstruction-reordered intra-block copy (RR-IBC, reconstruction-reordered IBC). Here, each piece of information may indicate whether a specific prediction method among the listed multiple prediction methods is performed.

[0979] Information related to the forecasting method may include additional information relevant to the forecasting method. In this case, the additional information may include information necessary for the specific forecasting model to be applied.

[0980] For example, in order to perform prediction based on an intra-prediction mode, information rel...

Claims

1. A method for decoding video, comprising: Construct a candidate list of block vectors for the current block; The block vector of the current block is derived based on the block vector candidate list; as well as The first predicted block of the current block is derived based on the block vector. The block vector candidate list includes template-matched block vector candidates derived through template matching.

2. The method according to claim 1, wherein: Within the search area of ​​the current frame, at least one reference template is selected based on the template matching cost with the current template set around the current block. The template matching block vector candidate has a block vector representing the positional difference between the current template and the reference template.

3. The method according to claim 1, wherein, The block vector candidate list also includes spatial block vector candidates derived from neighboring blocks that belong to the same frame as the current block.

4. The method of claim 3, wherein, When the neighboring blocks are encoded by inter-frame prediction, the motion vectors of the neighboring blocks are transformed into block vectors to derive the spatial block vector candidates.

5. The method according to claim 4, wherein: The candidate block vectors of the spatial block vectors are derived by scaling the motion vectors based on a scaling factor, and The scaling factor is derived based on the difference in screen order count (POC) between the reference screen indicated by the reference screen index of the neighboring block and the current screen including the current block.

6. The method according to claim 3, wherein, When the position of the block vector of the neighboring block separated from the current block is unavailable, the neighboring block is set to be unavailable for deriving the spatial block vector candidate.

7. The method of claim 6, wherein, The location is determined to be unavailable when it is outside the boundary of the predetermined processing unit, or when at least a portion of the block including the location overlaps with the current block.

8. The method according to claim 1, wherein, The block vector candidates in the block vector candidate list are reordered according to the template matching cost.

9. The method according to claim 1, wherein: The block vector of the current block is derived by adding the offset vector to the block vector indicated by the block vector candidate in the block vector candidate list, and The offset vector is defined by size information and direction information.

10. The method of claim 9, wherein, The size information indicates one of a plurality of fractional position candidates between the initial integer position indicated by the block vector candidate and the neighboring integer positions adjacent to the initial integer position.

11. The method according to claim 10, wherein, The direction information indicates one of a plurality of direction information candidates. Wherein, for each derivation template matching cost located at each of the nearest integer positions in the direction indicated by each of the plurality of direction information candidates, and Specifically, one of the multiple directional information candidates is selected by comparing template matching costs for multiple neighboring integer positions.

12. The method of claim 10, wherein, The size information and the orientation information are explicitly transmitted as signals via a bit stream.

13. The method according to claim 1, wherein, The shape of the search range is determined based on index information from one of the shape candidates. The first shape candidate among the shape candidates has a rectangular shape, and the second shape candidate has a rhombus shape.

14. The method according to claim 1, wherein, When at least a portion of the region to be set as the search range overlaps with the current block, the remaining region other than the region overlapping with the current block is set as the search range.

15. The method according to claim 1, wherein, The block vector candidate list is constructed by extracting only a predefined number of block vector candidates from the initial block vector candidate list in ascending order of template cost.

16. The method according to claim 1, wherein, The method further includes: Derive the intra-prediction mode of the current block; and The second prediction block of the current block is obtained based on the intra-frame prediction mode, and The final prediction block of the current block is obtained by weighted summation of the first prediction block and the second prediction block.

17. The method of claim 16, wherein, The intra-prediction mode is derived as an intra-prediction mode stored in a reference block indicated by the block vector of the current block.

18. The method according to claim 17, wherein, When multiple intra-prediction modes exist in the reference block, the intra-prediction mode with the highest frequency among the multiple intra-prediction modes is determined as the intra-prediction mode of the current block.

19. A method for encoding video, comprising: Construct a candidate list of block vectors for the current block; The block vector of the current block is derived based on the block vector candidate list; as well as The first predicted block of the current block is derived based on the block vector. The block vector candidate list includes template-matched block vector candidates derived through template matching.

20. A recording medium for storing a bitstream generated by an image encoding method, wherein, The encoding method includes: Construct a candidate list of block vectors for the current block; The block vector of the current block is derived based on the block vector candidate list; and The first predicted block of the current block is derived based on the block vector. The block vector candidate list includes template-matched block vector candidates derived through template matching.