Image encoding / decoding method and apparatus

By performing transformation information encoding/decoding at the end of the transformation unit during the image encoding/decoding process, and determining whether to apply secondary inverse transformation based on the block size, the problem of parsing delay and data buffering in image encoding/decoding is solved, and more efficient image processing and better image quality are achieved.

CN119996689APending Publication Date: 2025-05-13ELECTRONICS & TELECOMM RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510223941.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2019-09-23
Filing Date
2020-06-19
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The prior art has problems with parsing delay and data buffering in the image encoding/decoding process, especially in the processing and storage of secondary transformation information.

Method used

By performing transformation information encoding/decoding at the end of the transformation unit, the maximum transform block size and the current block size are determined to determine whether to apply secondary inverse transformation, thereby solving the analytical delay and data buffering problems.

Benefits of technology

This method effectively reduces the analytical delay and data buffering between transform blocks, improves the efficiency of image encoding and decoding, and improves the subjective image quality of the reconstructed picture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119996689A_ABST
    Figure CN119996689A_ABST
Patent Text Reader

Abstract

Provided are an image encoding / decoding method and apparatus. An image decoding method of the present disclosure may comprise the steps of: obtaining maximum transform block size information; deriving a maximum transform block size based on the maximum transform block size information; and determining whether to apply a secondary inverse transform to the current block based on the maximum transform block size and a horizontal size and a vertical size of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with the application date of June 19, 2020, application number "202080037124.0", and invention name "Image encoding / decoding method and device". Technical Field

[0002] The present invention relates to a method and apparatus for image encoding / decoding and a recording medium for storing a bit stream. More specifically, the present invention relates to a transform and quantization method of a residual signal and a method and apparatus for transform coefficient entropy encoding / decoding. Background Art

[0003] Recently, in various applications, the demand for high-resolution and high-quality images (such as high-definition (HD) or ultra-high-definition (UHD) images) has increased. As the resolution and quality of images increase, the amount of data increases accordingly. This is one of the reasons for the increase in transmission cost and storage cost when image data is transmitted through existing transmission media (such as wired or wireless broadband channels) or when image data is stored. In order to solve these problems of high-resolution and high-quality image data, efficient image encoding / decoding technology is required.

[0004] There are various video compression techniques, such as inter-frame prediction techniques that predict the values ​​of pixels within a current picture from the values ​​of pixels within a previous picture or a subsequent picture, intra-frame prediction techniques that predict the values ​​of pixels within an area of ​​the current picture from the values ​​of pixels within another area of ​​the current picture, transformation and quantization techniques for compressing the energy of residual signals, and entropy coding techniques that assign short codes to frequently occurring pixel values ​​and long codes to less frequently occurring pixel values.

[0005] In video encoding, encoding of transform coefficients may be performed to transform a residual signal (i.e., transforming the difference between the original signal and the prediction signal to a different basis and quantizing the corresponding coefficients). In video decoding, such quantized transform coefficients may be decoded and inversely transformed to derive a decoded residual signal, and a decoded signal may be generated by adding the residual signal to the prediction signal.

[0006] After generating final transform coefficients by performing secondary transform on the low frequency domain of the transform coefficients of the primary transform, encoding of quantization levels may be performed by quantizing the corresponding transform coefficients.

[0007] The secondary transform information can be encoded / decoded at the end of the coding unit. When the current coding block is larger than the maximum transform block or video processing and allocation unit (VPDU), the coding unit can be divided into transform block sizes. In this case, the first divided block can be delayed until the final block that is divided to obtain the secondary transform information is processed. In addition, this requires up to four times the data buffering.

[0008] In addition, although the secondary transform can reduce the signaling overhead of the transform coefficients, the subjective image quality may be degraded due to the additional quantization performed on the low frequency domain. Accordingly, for large coding blocks emphasizing the low frequency domain, the subjective image quality may be particularly degraded. Summary of the invention

[0009] Technical issues An object of the present invention is to provide an image encoding / decoding method for solving a parsing delay until a final divided block is processed to obtain secondary transform information generated by secondary transform and solving a data buffering problem in which stored data lasts four times as long.

[0010] Another object of the present invention is to provide a recording medium storing a bit stream generated by the video encoding / decoding method or apparatus of the present invention.

[0011] Technical Solution According to a method for decoding an image of the present invention, the method may include: obtaining maximum transform block size information; deriving the maximum transform block size based on the maximum transform block size information; and determining whether to apply a secondary inverse transform to the current block based on the maximum transform block size and the horizontal size and vertical size of the current block.

[0012] In the method for decoding an image according to the present invention, the step of determining whether to apply the secondary inverse transform comprises: determining whether to apply the secondary inverse transform to the current block based on a larger value of a horizontal size and a vertical size of the current block.

[0013] In the method for decoding an image according to the present invention, the step of determining whether to apply the secondary inverse transform comprises: when a larger value of a horizontal size and a vertical size of the current block is greater than the maximum transform block size, determining not to apply the secondary inverse transform to the current block.

[0014] In the method for decoding an image according to the present invention, the step of determining whether to apply the secondary inverse transform comprises: determining whether to apply the secondary inverse transform to the current block based on primary inverse transform information of the current block.

[0015] In the method for decoding an image according to the present invention, the step of determining whether to apply the secondary inverse transform comprises: when the primary inverse transform information of the current block indicates a primary inverse transform skip mode, determining not to apply the secondary inverse transform to the current block.

[0016] A method for encoding an image according to the present invention may include: determining a maximum transform block size; encoding maximum transform block size information indicating the maximum transform block size; and determining whether to apply a secondary inverse transform to the current block based on the maximum transform block size and the horizontal size and vertical size of the current block.

[0017] In the method for encoding an image according to the present invention, the step of determining whether to apply the secondary inverse transform comprises: determining whether to apply the secondary inverse transform to the current block based on a larger value of a horizontal size and a vertical size of the current block.

[0018] In the method for encoding an image according to the present invention, the step of determining whether to apply the secondary inverse transform comprises: when a larger value of a horizontal size and a vertical size of the current block is greater than the maximum transform block size, determining not to apply the secondary inverse transform to the current block.

[0019] In the method for encoding an image according to the present invention, the step of determining whether to apply the secondary inverse transform comprises: determining whether to apply the secondary inverse transform to the current block based on primary inverse transform information of the current block.

[0020] In the method for encoding an image according to the present invention, the step of determining whether to apply the secondary inverse transform comprises: when the primary inverse transform information of the current block indicates a primary inverse transform skip mode, determining not to apply the secondary inverse transform to the current block.

[0021] The computer-readable recording medium according to the present invention may store a bit stream generated by the image encoding method according to the present invention.

[0022] Beneficial Effects Since the present invention performs transformation information encoding / decoding at the end of the transformation unit so as to solve the parsing delay until the final divided block is processed to obtain the second transformation information generated by the secondary transformation, and solves the data buffering problem of storing data for up to four times, the independence between the transformation blocks can be maintained.

[0023] Even when a single coding block is divided into a plurality of transform blocks, since the present invention can derive secondary transform information of each block and generate independence from other blocks, delay can be prevented and data buffering can be maintained.

[0024] Since the present invention enables encoding / decoding to be performed on only a single piece of secondary transform information in each coding block, encoding complexity or signaling overhead can be reduced.

[0025] Since the present invention limits the secondary transformation of large-size coding blocks, the subjective image quality of the reconstructed picture can be improved.

[0026] When performing sub-transformation on the residual signal, the present invention can minimize data buffering and parsing delays in the sub-transformation by performing efficient entropy encoding / decoding on the sub-transformation.

[0027] In addition, according to the present invention, there can be provided a recording medium for storing a bit stream generated by the image encoding / decoding method or apparatus of the present invention.

[0028] In addition, according to the present invention, image encoding and decoding efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

[0031] Figure 3 is a diagram schematically showing a partition structure of an image when the image is encoded and decoded.

[0032] Figure 4 is a diagram illustrating an intra prediction process.

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

[0034] Figure 6 is a diagram illustrating transform and quantization processing.

[0035] Figure 7 is a diagram showing reference samples that can be used for intra prediction.

[0036] Figure 8 is a diagram illustrating an image encoding apparatus according to an embodiment of the present invention.

[0037] Fig. 9 is a diagram illustrating an image decoding apparatus according to an embodiment of the present invention.

[0038] Fig.10 is a diagram showing an example of a single partition structure when YUV4:2:0.

[0039] Fig.11 is a diagram showing an example of a multi-partition structure when YCbCr4:2:0.

[0040] Fig.12 and Fig.13is a diagram for explaining a method of encoding / decoding a residual signal according to an embodiment of the present invention.

[0041] Fig.14 and Fig.15 is a diagram illustrating an example of a primary transform block.

[0042] Figures 16 to 18 is a diagram illustrating an example of a secondary transform block unit.

[0043] Fig.19 and Fig. 20 is a diagram illustrating an example of a secondary transform block.

[0044] Figure 21 to Figure 23 is a diagram for explaining that the transformation result is reset to zero.

[0045] Figures 24 to 26 is a diagram for explaining encoding and decoding of secondary transform information.

[0046] Figure 27 to Figure 29 is a diagram for explaining determination of whether to perform secondary transform information encoding / decoding.

[0047] Fig.30 is a diagram for explaining transmission and entropy encoding / decoding of an adaptive motion vector resolution index for an AMVP mode.

[0048] Fig.31 is a diagram for explaining transmission and entropy encoding / decoding of an adaptive motion vector resolution index for an affine mode.

[0049] Fig.32 is a diagram for explaining transmission and entropy encoding / decoding of a resolution set for an AMVP mode.

[0050] Fig.33 is a diagram for explaining transmission and entropy encoding / decoding of a resolution set for an affine mode.

[0051] Fig.34 is a diagram illustrating a flowchart of an image decoding method according to an embodiment of the present invention.

[0052] Fig.35 is a flowchart illustrating an image encoding method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The same constituent elements in the drawings are denoted by the same reference numerals, and repeated description of the same elements will be omitted.

[0054] Hereinafter, an image may refer to a picture constituting a video, or may refer to the video itself. For example, "encoding or decoding an image or both encoding and decoding" may refer to "encoding or decoding a moving picture or both encoding and decoding", and may refer to "encoding or decoding one of the images of the moving picture or both encoding and decoding".

[0055] Hereinafter, the terms "motion picture" and "video" may be used as the same meaning and may be replaced with each other.

[0056] Hereinafter, a target image may be an encoding target image as an encoding target and / or a decoding target image as a decoding target. In addition, a target image may be an input image input to an encoding device, and an input image input to a decoding device. Here, the target image may have the same meaning as the current picture.

[0057] Hereinafter, the terms "image", "picture", "frame" and "screen" may be used as the same meaning and may be replaced with each other.

[0058] Hereinafter, the target block may be an encoding target block as an encoding target and / or a decoding target block as a decoding target. In addition, the target block may be a current block as a target of current encoding and / or decoding. For example, the terms "target block" and "current block" may be used as the same meaning and may be replaced with each other.

[0059] Hereinafter, the terms "block" and "unit" may be used as the same meaning and may be replaced with each other. Alternatively, a "block" may refer to a specific unit.

[0060] In the following, the terms "region" and "segment" are used interchangeably.

[0061] Hereinafter, a specific signal may be a signal representing a specific block. For example, an original signal may be a signal representing a target block. A prediction signal may be a signal representing a prediction block. A residual signal may be a signal representing a residual block.

[0062] In an embodiment, each of the specific information, data, flags, indexes, elements, attributes, etc. may have a value. The value of the information, data, flags, indexes, elements, and attributes equal to "0" may represent a logical false or a first predefined value. In other words, the value "0", false, logical false, and the first predefined value may be replaced with each other. The value of the information, data, flags, indexes, elements, and attributes equal to "1" may represent a logical true or a second predefined value. In other words, the value "1", true, logical true, and the second predefined value may be replaced with each other.

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

[0064] Terminology Description Encoder: This refers to the device that performs encoding. In other words, it refers to the encoding device.

[0065] Decoder: refers to a device that performs decoding. In other words, it refers to a decoding device.

[0066] Block: is an M×N array of samples. Here, M and N may represent positive integers, and a block may represent an array of samples in a two-dimensional form. A block may refer to a unit. A current block may represent an encoding target block that becomes a target when encoding, or a decoding target block that becomes a target when decoding. In addition, the current block may be at least one of a coding block, a prediction block, a residual block, and a transform block.

[0067] Sample: It is the basic unit of a block. According to the bit depth (Bd), a sample can be represented as a number from 0 to In the present invention, a sample point may be used as the meaning of a pixel. That is, a sample point, a pel, and a pixel may have the same meaning as each other.

[0068] Unit: may refer to a coding and decoding unit. When encoding and decoding an image, a unit may be a region generated by partitioning a single image. In addition, when a single image is partitioned into sub-partition units during encoding or decoding, a unit may represent a sub-partition unit. That is, an image may be partitioned into a plurality of units. When encoding and decoding an image, a predetermined process for each unit may be performed. A single unit may be partitioned into sub-units having a size smaller than that of the unit. Depending on the function, a unit may represent 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, and the like. In addition, in order to distinguish a unit from a block, a unit may include a luminance component block, a chrominance component block associated with the luminance component block, and a syntax element for each color component block. A unit may have various sizes and shapes, and specifically, the shape of a unit may be a two-dimensional geometric figure such as a square, a rectangle, a trapezoid, a triangle, a pentagon, and the like. In addition, the unit information may include at least one of a unit type indicating a coding unit, a prediction unit, a transformation unit, etc., and a unit size, a unit depth, an order of encoding and decoding of the unit, and the like.

[0069] Coding tree unit: A single coding tree block configured with a luminance component Y and two coding tree blocks associated with chrominance components Cb and Cr. In addition, the coding tree unit may represent a syntax element including a block and each block. Each coding tree unit may be partitioned by using at least one of a quadtree partitioning method, a binary tree partitioning method, and a ternary tree partitioning method to configure a lower-level unit such as a coding unit, a prediction unit, a transform unit, etc. The coding tree unit may be used as a term for specifying a sample block that becomes a processing unit when encoding / decoding an image as an input image. Here, the quadtree may represent a quadtree.

[0070] When the size of the coding block is within a predetermined range, it can be partitioned using only quadtree partitioning. Here, the predetermined range may be defined as at least one of the maximum size and the minimum size of the coding block that can be partitioned using only quadtree partitioning. Information indicating the maximum / minimum size of the coding block that allows quadtree partitioning may be signaled through a bitstream, and the information may be signaled in at least one unit of a sequence, a picture parameter, a parallel block group, or a slice (fragment). Optionally, the maximum / minimum size of the coding block may be a fixed size predetermined in the encoder / decoder. For example, when the size of the coding block corresponds to 256×256 to 64×64, it is possible to partition using only quadtree partitioning. Optionally, when the size of the coding block is larger than the size of the maximum conversion block, it is possible to partition using only quadtree partitioning. Here, the block to be partitioned may be at least one of a coding block and a transform block. In this case, information indicating the partitioning of the coding block (e.g., split_flag) may be a flag indicating whether quadtree partitioning is performed. When the size of the coding block falls within a predetermined range, it is possible to partition using only binary or ternary tree partitioning. In this case, the above description of the quadtree partition may be applied to the binary tree partition or the ternary tree partition in the same manner.

[0071] Coding tree block: may be used as a term used to designate any one of a Y coding tree block, a Cb coding tree block, and a Cr coding tree block.

[0072] Neighboring block: may refer to a block adjacent to the current block. The block adjacent to the current block may refer to a block that touches the boundary of the current block or a block that is located within a predetermined distance from the current block. The neighboring block may refer to a block adjacent to a vertex of the current block. Here, the block adjacent to a vertex of the current block may refer to a block that is vertically adjacent to a neighboring block that is horizontally adjacent to the current block or a block that is horizontally adjacent to a neighboring block that is vertically adjacent to the current block.

[0073] Reconstructed neighboring block: may represent a neighboring block that is adjacent to the current block and has been encoded or decoded in space / time. Here, the reconstructed neighboring block may represent a reconstructed neighboring unit. The reconstructed spatial neighboring block may be a block that is within the current picture and has been reconstructed by encoding or decoding or both encoding and decoding. The reconstructed temporal neighboring block is a block at a position corresponding to the current block of the current picture within the reference picture or a neighboring block of the block.

[0074] Unit depth: can represent the degree of partitioning of a unit. In a tree structure, the highest node (root node) can correspond to the first unit that is not partitioned. In addition, the highest node can have a minimum depth value. In this case, the depth of the highest node can be level 0. A node with a depth of level 1 can represent a unit generated by first partitioning the first unit. A node with a depth of level 2 can represent a unit generated by partitioning the first unit twice. A node with a depth of level n can represent a unit generated by partitioning the first unit n times. A leaf node can be the lowest node and a node that cannot be further partitioned. The depth of a leaf node can be the maximum level. For example, the predefined value of the maximum level can be 3. The depth of the root node can be the lowest, and the depth of the leaf node can be the deepest. In addition, when a unit is represented as a tree structure, the level at which the unit exists can represent the unit depth.

[0075] Bitstream: can represent a stream of bits including coded image information.

[0076] Parameter set: corresponds to header information among the configurations in the bitstream. At least one of a video parameter set, a sequence parameter set, a picture parameter set, and an adaptation parameter set may be included in the parameter set. In addition, the parameter set may include a slice header, a tile group header, and tile header information. The term "tile group" means a group of tiles and has the same meaning as a slice.

[0077] The adaptation parameter set may represent a parameter set that can be shared by reference in different pictures, sub-pictures, slices, tile groups, tiles, or partitions. In addition, information in the adaptation parameter set may be used by referencing different adaptation parameter sets for sub-pictures, slices, tile groups, tiles, or partitions within a picture.

[0078] In addition, regarding adaptation parameter sets, different adaptation parameter sets may be referenced by using identifiers of different adaptation parameter sets for a sub-picture, a slice, a tile group, a tile, or a partition within a picture.

[0079] In addition, regarding the adaptation parameter sets, different adaptation parameter sets may be referenced by using identifiers of different adaptation parameter sets for slices, tile groups, tiles, or partitions within a sub-picture.

[0080] In addition, regarding the adaptation parameter sets, different adaptation parameter sets may be referenced by using identifiers of different adaptation parameter sets for tiles or partitions within a slice.

[0081] In addition, with respect to adaptation parameter sets, different adaptation parameter sets may be referenced by using identifiers of different adaptation parameter sets for partitions within a tile.

[0082] Information about the adaptation parameter set identifier may be included in a parameter set or a header of a sub-picture, and an adaptation parameter set corresponding to the adaptation parameter set identifier may be used for the sub-picture.

[0083] Information about the adaptation parameter set identifier may be included in a parameter set or a header of the tile, and an adaptation parameter set corresponding to the adaptation parameter set identifier may be used for the tile.

[0084] Information about the adaptation parameter set identifier may be included in a header of the tile, and an adaptation parameter set corresponding to the adaptation parameter set identifier may be used for the tile.

[0085] A picture may be partitioned into one or more tile rows and one or more tile columns.

[0086] A sub-picture may be partitioned into one or more parallel block rows and one or more parallel block columns within a picture. A sub-picture may be an area having a rectangular / square form within a picture and may include one or more CTUs. In addition, at least one or more parallel blocks / blocks / strips may be included in one sub-picture.

[0087] A tile may be an area having a rectangular / square form within a picture and may include one or more CTUs. In addition, a tile may be partitioned into one or more partitions.

[0088] A partition may represent one or more CTU rows within a tile. A tile may be partitioned into one or more blocks, and each block may have at least one or more CTU rows. A tile that is not partitioned into two or more may represent a partition.

[0089] A slice may include one or more tiles within a picture, and may include one or more partitions within a tile.

[0090] Parsing: may mean determining the value of a syntax element by performing entropy decoding, or may mean the entropy decoding itself.

[0091] Symbol: At least one of a syntax element, a coding parameter, and a transform coefficient value that can represent a coding / decoding target unit. In addition, the symbol can represent an entropy coding target or an entropy decoding result.

[0092] Prediction mode: may be information indicating a mode for encoding / decoding using intra prediction or a mode for encoding / decoding using inter prediction.

[0093] Prediction unit: may represent a basic unit when performing prediction (such as inter prediction, intra prediction, inter compensation, intra compensation, and motion compensation). A single prediction unit may be partitioned into multiple partitions of smaller size, or may be partitioned into multiple prediction units of lower levels. Multiple partitions may be basic units when performing prediction or compensation. Partitions generated by partitioning a prediction unit may also be prediction units.

[0094] Prediction unit partition: may represent a shape obtained by partitioning a prediction unit.

[0095] A reference picture list may refer to a list including one or more reference pictures used for inter prediction or motion compensation. There are several types of reference picture lists available, including LC (List Combination), L0 (List 0), L1 (List 1), L2 (List 2), L3 (List 3).

[0096] The inter prediction indicator may refer to the direction of inter prediction of the current block (unidirectional prediction, bidirectional prediction, etc.). Alternatively, the inter prediction indicator may refer to the number of reference pictures used to generate the prediction block of the current block. Alternatively, the inter prediction indicator may refer to the number of prediction blocks used when performing inter prediction or motion compensation on the current block.

[0097] The prediction list utilization flag indicates whether at least one reference picture in a specific reference picture list is used to generate a prediction block. The prediction list utilization flag may be used to derive the inter prediction indicator, and conversely, the inter prediction indicator may be used to derive the prediction list utilization flag. For example, when the prediction list utilization flag has a first value of zero (0), it indicates that the reference picture in the reference picture list is not used to generate the prediction block. On the other hand, when the prediction list utilization flag has a second value of one (1), it indicates that the reference picture list is used to generate the prediction block.

[0098] The reference picture index may refer to an index indicating a specific reference picture in a reference picture list.

[0099] A reference picture may refer to a reference picture referenced by a specific block for the purpose of inter-frame prediction or motion compensation of the specific block. Alternatively, a reference picture may be a picture including a reference block referenced by a current block for inter-frame prediction or motion compensation. Hereinafter, the terms "reference picture" and "reference picture" have the same meaning and may be interchangeable.

[0100] A motion vector may be a two-dimensional vector used for inter-frame prediction or motion compensation. A motion vector may represent an offset between a target block for encoding / decoding and a reference block. For example, (mvX, mvY) may represent a motion vector. Here, mvX may represent a horizontal component, and mvY may represent a vertical component.

[0101] The search range may be a two-dimensional area that is searched during inter prediction to retrieve a motion vector. For example, the size of the search range may be M×N. Here, M and N are both integers.

[0102] The motion vector candidate may refer to a prediction candidate block or a motion vector of a prediction candidate block when predicting a motion vector. In addition, the motion vector candidate may be included in a motion vector candidate list.

[0103] The motion vector candidate list may mean a list consisting of one or more motion vector candidates.

[0104] The motion vector candidate index may represent an indicator indicating a motion vector candidate in the motion vector candidate list. Alternatively, it may be an index of a motion vector predictor.

[0105] The motion information may represent information including at least one of a motion vector, a reference picture index, an inter prediction indicator, a prediction list utilization flag, a reference picture list information, a reference picture, a motion vector candidate, a motion vector candidate index, a merge candidate, and a merge index.

[0106] The merge candidate list may refer to a list consisting of one or more merge candidates.

[0107] The merge candidate may represent a spatial merge candidate, a temporal merge candidate, a combined merge candidate, a combined bi-prediction merge candidate, or a zero merge candidate. The merge candidate may include motion information such as an inter prediction indicator, a reference picture index for each list, a motion vector, a prediction list utilization flag, and an inter prediction indicator.

[0108] The merge index may represent an indicator indicating a merge candidate in the merge candidate list. Alternatively, the merge index may indicate a block in a reconstructed block that is spatially / temporally adjacent to the current block, from which the merge candidate has been derived. Alternatively, the merge index may indicate at least one piece of motion information of the merge candidate.

[0109] Transform unit: may represent a basic unit when encoding / decoding (such as transform, inverse transform, quantization, inverse quantization, transform coefficient encoding / decoding) is performed on a residual signal. A single transform unit may be partitioned into a plurality of lower-level transform units having a smaller size. Here, the transform / inverse transform may include at least one of a first transform / a first inverse transform and a second transform / a second inverse transform.

[0110] Scaling: may refer to the process of multiplying the level of quantization by a factor. Transform coefficients may be generated by scaling the level of quantization. Scaling may also be referred to as inverse quantization.

[0111] Quantization parameter: may represent a value used when a transform coefficient is used to generate a quantized level during quantization. The quantization parameter may also represent a value used when a transform coefficient is generated by scaling the quantized level during inverse quantization. The quantization parameter may be a value mapped on a quantization step size.

[0112] Delta quantization parameter: may represent the difference between the predicted quantization parameter and the quantization parameter of the encoding / decoding target unit.

[0113] Scan: can refer to a method of ordering coefficients within a cell, block, or matrix. For example, changing a two-dimensional matrix of coefficients to a one-dimensional matrix can be called scanning, and changing a one-dimensional matrix of coefficients to a two-dimensional matrix can be called scanning or inverse scanning.

[0114] Transform coefficient: may refer to a coefficient value generated after performing a transform in an encoder. A transform coefficient may refer to a coefficient value generated after performing at least one of entropy decoding and inverse quantization in a decoder. A quantization level obtained by quantizing a transform coefficient or a residual signal or a quantized transform coefficient level may also fall within the meaning of a transform coefficient.

[0115] Quantization level: may represent a value generated by quantizing a transform coefficient or a residual signal in an encoder. Alternatively, the quantization level may represent a value that is a dequantization target subjected to dequantization in a decoder. Similarly, the quantized transform coefficient level as a result of transformation and quantization may also fall within the meaning of the quantization level.

[0116] Non-zero transform coefficient: may refer to a transform coefficient having a value other than zero, or a transform coefficient level or quantization level having a value other than zero.

[0117] Quantization matrix: may refer to a matrix used in a quantization process or an inverse quantization process performed to improve subjective image quality or objective image quality. The quantization matrix may also be referred to as a scaling list.

[0118] Quantization matrix coefficients: can represent each element in the quantization matrix. Quantization matrix coefficients can also be called matrix coefficients.

[0119] Default matrix: may represent a predetermined quantization matrix predefined in an encoder or a decoder.

[0120] Non-default matrix: may denote a quantization matrix that is not predefined in the encoder or decoder but is signaled by the user.

[0121] Statistical value: The statistical value for at least one of a variable, a coding parameter, a constant value, etc. having a calculable specific value can be one or more of the average value, summed value, weighted average value, weighted sum value, minimum value, maximum value, most frequently occurring value, median value, and interpolation value of the corresponding specific value.

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

[0123] The encoding device 100 may be an encoder, a video encoding device, or an image encoding device. A video may include at least one image. The encoding device 100 may sequentially encode at least one image.

[0124] Reference Figure 1 , the encoding device 100 may include a motion prediction unit 111, a motion compensation unit 112, an intra-frame prediction unit 120, a switch 115, a subtractor 125, a transform unit 130, a quantization unit 140, an entropy encoding unit 150, an inverse quantization unit 160, an inverse transform unit 170, an adder 175, a filter unit 180 and a reference picture buffer 190.

[0125] The encoding device 100 may perform encoding of an input image by using an intra mode or an inter mode or both an intra mode and an inter mode. In addition, the encoding device 100 may generate a bit stream including encoding information by encoding the input image, and output the generated bit stream. The generated bit stream may be stored in a computer-readable recording medium, or may be streamed through a wired / wireless transmission medium. When the intra mode is used as a prediction mode, the switch 115 may switch to the intra mode. Alternatively, when the inter mode is used as a prediction mode, the switch 115 may switch to the inter mode. Here, the intra mode may represent an intra prediction mode, and the inter mode may represent an inter prediction mode. The encoding device 100 may generate a prediction block for an input block of the input image. In addition, the encoding device 100 may encode the residual block using the residual of the input block and the prediction block after generating the prediction block. The input image may be referred to as the current picture as the current encoding target. The input block may be referred to as the current block as the current encoding target, or may be referred to as the encoding target block.

[0126] When the prediction mode is the intra mode, the intra prediction unit 120 may use samples of a block that has been encoded / decoded and is adjacent to the current block as reference samples. The intra prediction unit 120 may perform spatial prediction on the current block by using the reference samples, or may generate prediction samples of the input block by performing spatial prediction. Here, intra prediction may refer to prediction within a frame.

[0127] When the prediction mode is the inter-frame mode, the motion prediction unit 111 may retrieve the area that best matches the input block from the reference picture when performing motion prediction, and derive the motion vector by using the retrieved area. In this case, the search area may be used as the area. The reference picture may be stored in the reference picture buffer 190. Here, when encoding / decoding of the reference picture is performed, the reference picture may be stored in the reference picture buffer 190.

[0128] The motion compensation unit 112 may generate a prediction block by performing motion compensation on the current block using a motion vector. Here, inter prediction may refer to prediction or motion compensation between frames.

[0129] When the value of the motion vector is not an integer, the motion prediction unit 111 and the motion compensation unit 112 may generate a prediction block by applying an interpolation filter to a partial area of ​​a reference picture. In order to perform inter-picture prediction or motion compensation on a coding unit, it may be determined which mode among the skip mode, merge mode, advanced motion vector prediction (AMVP) mode, and current picture reference mode is used for motion prediction and motion compensation of a prediction unit included in the corresponding coding unit. Then, depending on the determined mode, inter-picture prediction or motion compensation may be performed differently.

[0130] The subtractor 125 may generate a residual block by using the difference between the input block and the prediction block. The residual block may be referred to as a residual signal. The residual signal may represent the difference between the original signal and the prediction signal. In addition, the residual signal may be a signal generated by transforming or quantizing the difference between the original signal and the prediction signal, or by transforming and quantizing the difference between the original signal and the prediction signal. The residual block may be a residual signal of a block unit.

[0131] The transform unit 130 may generate a transform coefficient by performing a transform on the residual block and output the generated transform coefficient. Here, the transform coefficient may be a coefficient value generated by performing a transform on the residual block. When the transform skip mode is applied, the transform unit 130 may skip the transform on the residual block.

[0132] The quantization level may be generated by applying quantization to a transform coefficient or to a residual signal. Hereinafter, the quantization level may also be referred to as a transform coefficient in an embodiment.

[0133] The quantization unit 140 may generate a quantization level by quantizing the transform coefficient or the residual signal according to the parameter and output the generated quantization level. Here, the quantization unit 140 may quantize the transform coefficient by using a quantization matrix.

[0134] The entropy encoding unit 150 may generate a bit stream by performing entropy encoding on the value calculated by the quantization unit 140 or the encoding parameter value calculated when encoding is performed according to the probability distribution, and output the generated bit stream. The entropy encoding unit 150 may perform entropy encoding on sample information of the image and information for decoding the image. For example, the information for decoding the image may include a syntax element.

[0135] When entropy coding is applied, symbols are represented so that a smaller number of bits are allocated to symbols with a high probability of generation, and a larger number of bits are allocated to symbols with a low probability of generation, and therefore, the size of the bit stream for the symbol to be encoded can be reduced. The entropy coding unit 150 may use a coding method for entropy coding such as exponential Golomb, context adaptive variable length coding (CAVLC), context adaptive binary arithmetic coding (CABAC), etc. For example, the entropy coding unit 150 may perform entropy coding by using a variable length coding / code (VLC) table. In addition, the entropy coding unit 150 may derive a binarization method of a target symbol and a probability model of a target symbol / binary bit, and perform arithmetic coding by using the derived binarization method, probability model, and context model.

[0136] In order to encode a transform coefficient level (quantized level), the entropy encoding unit 150 may change a coefficient in a two-dimensional block form into a one-dimensional vector form by using a transform coefficient scanning method.

[0137] The coding parameters may include information such as syntax elements (flags, indexes, etc.) that are encoded in the encoder and sent to the decoder with a signal, as well as information derived when performing encoding or decoding. The coding parameters may represent information required when encoding or decoding an image. For example, at least one value or combination of the following items may be included in the coding parameters: unit / block size, unit / block depth, unit / block partition information, unit / block shape, unit / block partition structure, whether to perform quadtree partitioning, whether to perform binary tree partitioning, binary tree partition direction (horizontal or vertical), binary tree partition form (symmetric partitioning or asymmetric partitioning), whether the current coding unit is partitioned by ternary tree partitioning, the direction of ternary tree partitioning (horizontal or vertical), the type of ternary tree partitioning (symmetric type or asymmetric type), whether the current coding unit is partitioned by multi-type tree partitioning, the direction of multi-type tree partitioning direction (horizontal or vertical), type of multi-type tree partition (symmetric or asymmetric), tree (binary tree or ternary tree) structure of multi-type tree partition, prediction mode (intra-frame prediction or inter-frame prediction), luminance intra-frame prediction mode / direction, chrominance intra-frame prediction mode / direction, intra-frame partition information, inter-frame partition information, coding block partition flag, prediction block partition flag, transform block partition flag, reference sample filtering method, reference sample filter taps, reference sample filter coefficients, prediction block filtering method, prediction block filter taps, prediction block filter coefficients, prediction block boundary filtering method, prediction block boundary filter taps, prediction block boundary filter coefficients, intra-frame prediction mode, Inter prediction mode, motion information, motion vector, motion vector difference, reference picture index, inter prediction angle, inter prediction indicator, prediction list utilization flag, reference picture list, reference picture, motion vector predictor index, motion vector predictor candidate, motion vector candidate list, whether to use merge mode, merge index, merge candidate, merge candidate list, whether to use skip mode, interpolation filter type, interpolation filter tap, interpolation filter coefficient, motion vector size, representation accuracy of motion vector, transform type, transform size, information on whether the primary (first) transform is used, information on whether the secondary transform is used, primary transform index, secondary transform index , information on whether a residual signal exists, coding block pattern, coding block flag (CBF), quantization parameter, quantization parameter residual, quantization matrix, whether to apply an intra-loop filter, intra-loop filter coefficients, intra-loop filter taps, intra-loop filter shape / form, whether to apply a deblocking filter, deblocking filter coefficients, deblocking filter taps, deblocking filter strength, deblocking filter shape / form, whether to apply adaptive sample offset, adaptive sample offset value, adaptive sample offset category, adaptive sample offset type, whether to apply an adaptive intra-loop filter, adaptive intra-loop filter coefficients, adaptive intra-loop filter taps, adaptive intra-loop filter shape / form,Binarization / debinarization method, context model determination method, context model update method, whether to execute normal mode, whether to execute bypass mode, context binary bit, bypass binary bit, valid coefficient flag, last valid coefficient flag, encoding flag for unit of coefficient group, position of last valid coefficient, flag on whether the value of coefficient is greater than 1, flag on whether the value of coefficient is greater than 2, flag on whether the value of coefficient is greater than 3, information on remaining coefficient values, sign information, reconstructed luminance samples, reconstructed chrominance samples, residual luminance samples, residual chrominance samples, luminance transform coefficient, chrominance transform coefficient, quantized luminance level, quantized chrominance level, transform coefficient level scanning method, motion vector search area at decoder side size, shape of a motion vector search area at a decoder side, number of motion vector searches at a decoder side, information about a CTU size, information about a minimum block size, information about a maximum block size, information about a maximum block depth, information about a minimum block depth, image display / output order, slice identification information, slice type, slice partition information, tile identification information, tile type, tile partition information, tile group identification information, tile group type, tile group partition information, picture type, bit depth of input samples, bit depth of reconstructed samples, bit depth of residual samples, bit depth of transform coefficients, bit depth of quantization levels, and information about a luminance signal or information about a chrominance signal.

[0138] Here, signaling a flag or an index may mean entropy encoding the corresponding flag or index by an encoder and including it in a bitstream, and may mean entropy decoding the corresponding flag or index from the bitstream by a decoder.

[0139] When the encoding apparatus 100 performs encoding by inter-frame prediction, the encoded current picture may be used as a reference picture for another image that is subsequently processed. Therefore, the encoding apparatus 100 may reconstruct or decode the encoded current picture, or store the reconstructed or decoded image as a reference picture in the reference picture buffer 190.

[0140] The quantized level may be dequantized in the dequantization unit 160 or may be inversely transformed in the inverse transform unit 170. The dequantized or inversely transformed coefficient or the dequantized and inversely transformed coefficient may be added to the prediction block by the adder 175. A reconstructed block may be generated by adding the dequantized or inversely transformed coefficient or the dequantized and inversely transformed coefficient to the prediction block. Here, the dequantized or inversely transformed coefficient or the dequantized and inversely transformed coefficient may mean a coefficient on which at least one of dequantization and inverse transformation is performed, and may mean a reconstructed residual block.

[0141] The reconstructed block may pass through the filter unit 180. The filter unit 180 may apply at least one of a deblocking filter, a sample adaptive offset (SAO), and an adaptive in-loop filter (ALF) to the reconstructed sample, the reconstructed block, or the reconstructed image. The filter unit 180 may be referred to as an in-loop filter.

[0142] The deblocking filter can remove block distortion generated in the boundary between blocks. In order to determine whether to apply the deblocking filter, it can be determined whether to apply the deblocking filter to the current block based on the samples included in several rows or columns included in the block. When the deblocking filter is applied to the block, different filters can be applied according to the required deblocking filter strength.

[0143] In order to compensate for the coding error, a suitable offset value may be added to the sample value by using sample adaptive offset. Sample adaptive offset can correct the offset of the deblocked image from the original image in units of samples. A method of applying the offset in consideration of edge information about each sample may be used, or a method of partitioning the samples of the image into a predetermined number of regions, determining the region to which the offset is applied, and applying the offset to the determined region may be used.

[0144] The adaptive in-loop filter may perform filtering based on a comparison result of a filtered reconstructed image and an original image. Samples included in an image may be partitioned into predetermined groups, a filter to be applied to each group may be determined, and differential filtering may be performed on each group. Information on whether ALF is applied may be signaled by a coding unit (CU), and the form and coefficient of ALF to be applied to each block may vary.

[0145] The reconstructed block or the reconstructed image that has passed through the filter unit 180 may be stored in the reference picture buffer 190. The reconstructed block processed by the filter unit 180 may be a part of a reference picture. That is, the reference picture is a reconstructed image composed of the reconstructed blocks processed by the filter unit 180. The stored reference picture may be used later in inter-frame prediction or motion compensation.

[0146] Figure 2 is a block diagram showing the configuration of a decoding device according to an embodiment and to which the present invention is applied.

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

[0148] Reference Figure 2 , the decoding device 200 may include an entropy decoding unit 210, a dequantization unit 220, an inverse transform unit 230, an intra-frame prediction unit 240, a motion compensation unit 250, an adder 255, a filter unit 260 and a reference picture buffer 270.

[0149] The decoding device 200 may receive a bit stream output from the encoding device 100. The decoding device 200 may receive a bit stream stored in a computer-readable recording medium, or may receive a bit stream streamed through a wired / wireless transmission medium. The decoding device 200 may decode the bit stream by using an intra-frame mode or an inter-frame mode. In addition, the decoding device 200 may generate a reconstructed image or a decoded image generated by decoding, and output the reconstructed image or the decoded image.

[0150] When the prediction mode used in decoding is the intra mode, the switch may be switched to the intra mode. Alternatively, when the prediction mode used in decoding is the inter mode, the switch may be switched to the inter mode.

[0151] The decoding device 200 can obtain a reconstructed residual block by decoding the input bit stream and generate a prediction block. When the reconstructed residual block and the prediction block are obtained, the decoding device 200 can generate a reconstructed block as a decoding target by adding the reconstructed residual block to the prediction block. The decoding target block may be referred to as a current block.

[0152] The entropy decoding unit 210 may generate symbols by entropy decoding the bit stream according to the probability distribution. The generated symbols may include symbols in the form of quantized levels. Here, the entropy decoding method may be an inverse process of the above entropy encoding method.

[0153] In order to decode the transform coefficient level (quantized level), the entropy decoding unit 210 may change the coefficient in the form of a one-way vector into a two-dimensional block form by using a transform coefficient scanning method.

[0154] The quantized level may be dequantized in the dequantization unit 220, or the quantized level may be inversely transformed in the inverse transform unit 230. The quantized level may be a result of dequantization or inverse transformation or both, and may be generated as a reconstructed residual block. Here, the dequantization unit 220 may apply a quantization matrix to the quantized level.

[0155] When the intra mode is used, the intra prediction unit 240 may generate a predicted block by performing spatial prediction on the current block, wherein the spatial prediction uses sample values ​​of blocks that are adjacent to the decoding target block and have been decoded. When the inter mode is used, the motion compensation unit 250 may generate a prediction block by performing motion compensation on the current block, wherein the motion compensation uses a motion vector and a reference picture stored in the reference picture buffer 270 .

[0156] The adder 225 can generate a reconstructed block by adding the reconstructed residual block to the prediction block. The filter unit 260 can apply at least one of a deblocking filter, a sample adaptive offset, and an adaptive in-loop filter to the reconstructed block or the reconstructed image. The filter unit 260 can output the reconstructed image. The reconstructed block or the reconstructed image can be stored in the reference picture buffer 270 and used when performing inter-frame prediction. The reconstructed block processed by the filter unit 260 can be a part of a reference picture. That is, the reference picture is a reconstructed image composed of the reconstructed blocks processed by the filter unit 260. The stored reference picture can be used later in inter-frame prediction or motion compensation.

[0157] Figure 3 is a diagram schematically showing a partition structure of an image when the image is encoded and decoded. Figure 3 An example of partitioning a single cell into a plurality of lower-level cells is schematically shown.

[0158] In order to efficiently partition an image, a coding unit (CU) may be used when encoding and decoding. A coding unit may be used as a basic unit when encoding / decoding an image. In addition, a coding unit may be used as a unit for distinguishing an intra prediction mode from an inter prediction mode when encoding / decoding an image. A coding unit may be a basic unit for prediction, transformation, quantization, inverse transformation, inverse quantization, or encoding / decoding processing of a transformation coefficient.

[0159] Reference Figure 3 , the image 300 is partitioned sequentially according to the maximum coding unit (LCU), and the LCU unit is determined as a partition structure. Here, the LCU may be used in the same meaning as the coding tree unit (CTU). Unit partitioning may mean partitioning a block associated with the unit. In the block partition information, information about the unit depth may be included. The depth information may indicate the number or degree of the unit being partitioned or both the number and degree of the unit being partitioned. A single unit may be partitioned into a plurality of lower-level units hierarchically associated with the depth information based on a tree structure. In other words, the unit and the lower-level units generated by partitioning the unit may correspond to a node and a child node of the node, respectively. Each of the partitioned lower-level units may have depth information. The depth information may be information indicating the size of a CU and may be stored in each CU. The unit depth indicates the number and / or degree associated with partitioning the unit. Therefore, the partition information of the lower-level unit may include information about the size of the lower-level unit.

[0160] The partition structure may represent the distribution of coding units (CUs) within the LCU 310. Such distribution may be determined according to whether a single CU is partitioned into a plurality of (positive integers equal to or greater than 2, including 2, 4, 8, 16, etc.) CUs. The horizontal size and vertical size of the CU generated by partitioning may be half of the horizontal size and vertical size of the CU before partitioning, respectively, or may have sizes smaller than the horizontal size and vertical size before partitioning according to the number of partitions. The CU may be recursively partitioned into a plurality of CUs. By recursive partitioning, at least one of the height and width of the CU after partitioning may be reduced compared to at least one of the height and width of the CU before partitioning. The partitioning of the CU may be recursively performed until a predetermined depth or a predetermined size. For example, the depth of the LCU may be 0, and the depth of the minimum coding unit (SCU) may be a predetermined maximum depth. Here, as described above, the LCU may be a coding unit having a maximum coding unit size, and the SCU may be a coding unit having a minimum coding unit size. Partitioning starts from the LCU 310, and when the horizontal size or vertical size or both the horizontal size and the vertical size of the CU are reduced by partitioning, the CU depth increases by 1. For example, for each depth, the size of the non-partitioned CU may be 2N×2N. Also, in the case of a partitioned CU, a CU of size 2N×2N may be partitioned into four CUs of size N×N. As the depth increases by 1, the size of N may be halved.

[0161] In addition, information on whether a CU is partitioned may be indicated by using the partition information of the CU. The partition information may be 1-bit information. All CUs except the SCU may include partition information. For example, when the value of the partition information is a first value, the CU may not be partitioned, and when the value of the partition information is a second value, the CU may be partitioned.

[0162] Reference Figure 3 , an LCU with a depth of 0 may be a block of 64×64. 0 may be the minimum depth. An SCU with a depth of 3 may be a block of 8×8. 3 may be the maximum depth. A CU of a block of 32×32 and a CU of a block of 16×16 may be represented as depth 1 and depth 2, respectively.

[0163] For example, when a single coding unit is partitioned into four coding units, the horizontal size and vertical size of the four coding units partitioned may be half the horizontal size and vertical size of the CU before being partitioned. In one embodiment, when a coding unit of size 32×32 is partitioned into four coding units, each of the four coding units partitioned may have a size of 16×16. When a single coding unit is partitioned into four coding units, it can be said that the coding unit can be partitioned into a quadtree form.

[0164] For example, when one coding unit is partitioned into two sub-coding units, the horizontal size or vertical size (width or height) of each of the two sub-coding units may be half of the horizontal size or vertical size of the original coding unit. For example, when a coding unit having a size of 32×32 is partitioned vertically into two sub-coding units, each of the two sub-coding units may have a size of 16×32. For example, when a coding unit having a size of 8×32 is partitioned horizontally into two sub-coding units, each of the two sub-coding units may have a size of 8×16. When one coding unit is partitioned into two sub-coding units, the coding unit may be said to be partitioned into two or partitioned by a binary tree partition structure.

[0165] For example, when one coding unit is partitioned into three sub-coding units, the horizontal size or the vertical size of the coding unit may be partitioned at a ratio of 1:2:1, thereby generating three sub-coding units having a ratio of the horizontal size or the vertical size of 1:2:1. For example, when a coding unit having a size of 16×32 is partitioned horizontally into three sub-coding units, the three sub-coding units may have sizes of 16×8, 16×16, and 16×8, respectively, in order from the uppermost sub-coding unit to the lowermost sub-coding unit. For example, when a coding unit having a size of 32×32 is partitioned vertically into three sub-coding units, the three sub-coding units may have sizes of 8×32, 16×32, and 8×32, respectively, in order from the left sub-coding unit to the right sub-coding unit. When one coding unit is partitioned into three sub-coding units, the coding unit may be said to be partitioned into three sub-coding units or partitioned according to a ternary tree partition structure.

[0166] exist Figure 3 , a coding tree unit (CTU) 320 is an example of a CTU to which a quadtree partition structure, a binary tree partition structure, and a ternary tree partition structure are all applied.

[0167] As described above, in order to partition a CTU, at least one of a quadtree partition structure, a binary tree partition structure, and a ternary tree partition structure may be applied. Various tree partition structures may be sequentially applied to a CTU according to a predetermined priority order. For example, a quadtree partition structure may be preferentially applied to a CTU. Coding units that can no longer be partitioned using a quadtree partition structure may correspond to leaf nodes of a quadtree. Coding units corresponding to leaf nodes of a quadtree may be used as root nodes of a binary and / or ternary tree partition structure. That is, coding units corresponding to leaf nodes of a quadtree may be further partitioned according to a binary tree partition structure or a ternary tree partition structure, or may not be further partitioned. Therefore, by preventing a coding block obtained from a binary tree partition or a ternary tree partition of a coding unit corresponding to a leaf node of a quadtree from undergoing further quadtree partitioning, a block partitioning operation and / or an operation of sending partition information with a signal may be effectively performed.

[0168] The fact that the coding unit corresponding to the node of the quadtree is partitioned may be signaled using the four partition information. The four partition information having a first value (e.g., "1") may indicate that the current coding unit is partitioned according to the quadtree partition structure. The four partition information having a second value (e.g., "0") may indicate that the current coding unit is not partitioned according to the quadtree partition structure. The four partition information may be a flag having a predetermined length (e.g., one bit).

[0169] There may be no priority between binary tree partitioning and ternary tree partitioning. That is, the coding unit corresponding to the leaf node of the quadtree may further undergo any partitioning of the binary tree partitioning and the ternary tree partitioning. In addition, the coding unit generated by the binary tree partitioning or the ternary tree partitioning may undergo further binary tree partitioning or further ternary tree partitioning, or may not be further partitioned.

[0170] A tree structure in which there is no priority between binary tree partitions and ternary tree partitions is called a multi-type tree structure. A coding unit corresponding to a leaf node of a quadtree may be used as a root node of a multi-type tree. At least one of multi-type tree partition indication information, partition direction information, and partition tree information may be used to signal whether to partition a coding unit corresponding to a node of a multi-type tree. In order to partition a coding unit corresponding to a node of a multi-type tree, multi-type tree partition indication information, partition direction information, and partition tree information may be sequentially signaled.

[0171] The multi-type tree partition indication information having a first value (eg, '1') may indicate that the current coding unit will undergo multi-type tree partitioning. The multi-type tree partition indication information having a second value (eg, '0') may indicate that the current coding unit will not undergo multi-type tree partitioning.

[0172] When a coding unit corresponding to a node of a multi-type tree is further partitioned according to a multi-type tree partition structure, the coding unit may include partition direction information. The partition direction information may indicate in which direction the current coding unit will be partitioned for the multi-type tree partition. The partition direction information having a first value (e.g., "1") may indicate that the current coding unit will be partitioned vertically. The partition direction information having a second value (e.g., "0") may indicate that the current coding unit will be partitioned horizontally.

[0173] When a coding unit corresponding to a node of a multi-type tree is further partitioned according to a multi-type tree partition structure, the current coding unit may include partition tree information. The partition tree information may indicate a tree partition structure to be used to partition the nodes of the multi-type tree. The partition tree information having a first value (e.g., "1") may indicate that the current coding unit will be partitioned according to a binary tree partition structure. The partition tree information having a second value (e.g., "0") may indicate that the current coding unit will be partitioned according to a ternary tree partition structure.

[0174] The partition indication information, the partition tree information and the partition direction information may all be flags having a predetermined length (eg, one bit).

[0175] At least any one of the quadtree partition indication information, the multi-type tree partition indication information, the partition direction information, and the partition tree information may be entropy encoded / decoded. In order to entropy encode / decode those types of information, information about neighboring coding units adjacent to the current coding unit may be used. For example, there is a high probability that the partition type (partitioned or not partitioned, partition tree, and / or partition direction) of the left neighboring coding unit and / or the upper neighboring coding unit of the current coding unit is similar to the partition type of the current coding unit. Therefore, context information for entropy encoding / decoding the information about the current coding unit may be derived from the information about the neighboring coding units. The information about the neighboring coding units may include at least any one of the quadtree partition information, the multi-type tree partition indication information, the partition direction information, and the partition tree information.

[0176] As another example, among binary tree partitioning and ternary tree partitioning, binary tree partitioning may be preferentially performed. That is, the current coding unit may first undergo binary tree partitioning, and then the coding unit corresponding to the leaf node of the binary tree may be set as the root node for the ternary tree partitioning. In this case, for the coding unit corresponding to the node of the ternary tree, neither quadtree partitioning nor binary tree partitioning may be performed.

[0177] A coding unit that cannot be partitioned according to a quadtree partition structure, a binary tree partition structure, and / or a ternary tree partition structure becomes a basic unit for encoding, prediction, and / or transformation. That is, the coding unit cannot be further partitioned for prediction and / or transformation. Therefore, partition structure information and partition information for partitioning a coding unit into a prediction unit and / or a transformation unit may not exist in the bitstream.

[0178] However, when the size of the coding unit (ie, the basic unit for partitioning) is larger than the size of the maximum transform block, the coding unit may be recursively partitioned until the size of the coding unit is reduced to be equal to or smaller than the size of the maximum transform block. For example, when the size of the coding unit is 64×64 and when the size of the maximum transform block is 32×32, the coding unit may be partitioned into four 32×32 blocks for transforming. For example, when the size of the coding unit is 32×64 and the size of the maximum transform block is 32×32, the coding unit may be partitioned into two 32×32 blocks for transforming. In this case, the partition of the coding unit for transforming is not separately signaled, and the partition of the coding unit for transforming may be determined by comparison between the horizontal size or vertical size of the coding unit and the horizontal size or vertical size of the maximum transform block. For example, when the horizontal size (width) of the coding unit is larger than the horizontal size (width) of the maximum transform block, the coding unit may be vertically divided into two equal parts. For example, when the vertical size (height) of the coding unit is larger than the vertical size (height) of the maximum transform block, the coding unit may be horizontally divided into two equal parts.

[0179] Information on the maximum and / or minimum size of a coding unit and information on the maximum and / or minimum size of a transform block may be signaled or determined at a higher level of the coding unit. The higher level may be, for example, a sequence level, a picture level, a slice level, a tile group level, a tile level, etc. For example, the minimum size of a coding unit may be determined as 4×4. For example, the maximum size of a transform block may be determined as 64×64. For example, the minimum size of a transform block may be determined as 4×4.

[0180] Information on the minimum size of the coding unit corresponding to the leaf node of the quadtree (quadtree minimum size) and / or information on the maximum depth from the root node of the multi-type tree to the leaf node (maximum tree depth of the multi-type tree) may be signaled or determined at a higher level of the coding unit. For example, the higher level may be a sequence level, a picture level, a slice level, a parallel block group level, a parallel block level, etc. Information on the minimum size of the quadtree and / or information on the maximum depth of the multi-type tree may be signaled or determined for each of the intra-picture slice and the inter-picture slice.

[0181] The difference information between the size of the CTU and the maximum size of the transform block may be signaled or determined at a higher level of the coding unit. For example, the higher level may be a sequence level, a picture level, a slice level, a parallel block group level, a parallel block level, etc. The information of the maximum size of the coding unit corresponding to each node of the binary tree (hereinafter referred to as the maximum size of the binary tree) may be determined based on the size of the coding tree unit and the difference information. The maximum size of the coding unit corresponding to each node of the ternary tree (hereinafter referred to as the maximum size of the ternary tree) may vary depending on the type of the slice. For example, for an intra-picture slice, the maximum size of the ternary tree may be 32×32. For example, for an inter-picture slice, the maximum size of the ternary tree may be 128×128. For example, the minimum size of the coding unit corresponding to each node of the binary tree (hereinafter referred to as the minimum size of the binary tree) and / or the minimum size of the coding unit corresponding to each node of the ternary tree (hereinafter referred to as the minimum size of the ternary tree) may be set to the minimum size of the coding block.

[0182] As another example, the maximum size of the binary tree and / or the maximum size of the ternary tree may be signaled or determined at the slice level. Alternatively, the minimum size of the binary tree and / or the minimum size of the ternary tree may be signaled or determined at the slice level.

[0183] Depending on the sizes and depth information of the above-mentioned various blocks, quad partition information, multi-type tree partition indication information, partition tree information and / or partition direction information may or may not be included in the bitstream.

[0184] For example, when the size of the coding unit is not greater than the minimum size of the quadtree, the coding unit does not include the quad partition information. Therefore, the quad partition information may be inferred as the second value.

[0185] For example, when the size (horizontal size and vertical size) of the coding unit corresponding to the 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 coding unit may not be partitioned by the binary tree or the ternary tree. Accordingly, the multi-type tree partition indication information may not be signaled, but the multi-type tree partition indication information may be inferred as the second value.

[0186] Optionally, when the size (horizontal size and vertical size) of the coding unit corresponding to the node of the multi-type tree is the same as the maximum size (horizontal size and vertical size) of the binary tree and / or is twice as large as the maximum size (horizontal size and vertical size) of the ternary tree, the coding unit may not be further partitioned into two or three partitions. Therefore, the multi-type tree partition indication information may not be sent by a signal, but the multi-type tree partition indication information may be derived from the second value. This is because when the coding unit is partitioned by the binary tree partition structure and / or the ternary tree partition structure, a coding unit smaller than the minimum size of the binary tree and / or the minimum size of the ternary tree is generated.

[0187] Optionally, the binary tree partition or ternary tree partition may be limited based on the size of the virtual pipeline data unit (hereinafter, the pipeline buffer size). For example, when the coding unit is partitioned into sub-coding units that do not fit into the pipeline buffer size by the binary tree partition or ternary tree partition, the corresponding binary tree partition or ternary tree partition may be limited. The pipeline buffer size may be the size of the maximum transform block (eg, 64×64). For example, when the pipeline buffer size is 64×64, the following partition may be limited.

[0188] - N×M (N and / or M is 128) ternary tree partitions for coding units - 128×N (N<=64) binary tree partitions in the horizontal direction for coding units - N×128 (N<=64) binary tree partitions in the vertical direction for coding units Optionally, when the depth of the coding unit corresponding to the node of the multi-type tree is equal to the maximum depth of the multi-type tree, the coding unit may not be further partitioned into two and / or three partitions. Accordingly, the multi-type tree partition indication information may not be sent by a signal, but the multi-type tree partition indication information may be inferred as the second value.

[0189] Optionally, only when at least one of vertical binary tree partitioning, horizontal binary tree partitioning, vertical ternary tree partitioning, and horizontal ternary tree partitioning is possible for a coding unit corresponding to a node of a multi-type tree, a multi-type tree partition indication information may be sent by a signal. Otherwise, the coding unit may not be partitioned into two and / or three partitions. Therefore, the multi-type tree partition indication information may not be sent by a signal, but the multi-type tree partition indication information may be inferred as a second value.

[0190] Optionally, partition direction information may be signaled only when both vertical binary tree partitioning and horizontal binary tree partitioning or both vertical ternary tree partitioning and horizontal ternary tree partitioning are possible for a coding unit corresponding to a node of a multi-type tree. Otherwise, partition direction information may not be signaled, but may be derived from a value indicating a possible partition direction.

[0191] Optionally, the partition tree information may be signaled only when both vertical binary tree partitioning and vertical ternary tree partitioning or both horizontal binary tree partitioning and horizontal ternary tree partitioning are possible for a coding tree corresponding to a node of a multi-type tree. Otherwise, the partition tree information may not be signaled but inferred as a value indicating a possible partition tree structure.

[0192] Figure 4 is a diagram illustrating an intra prediction process.

[0193] Figure 4 The arrows from the center to the outside in FIG. 1 represent the prediction direction of the intra prediction mode.

[0194] Intra-frame encoding and / or decoding may be performed by using reference samples of neighboring blocks of the current block. The neighboring blocks may be reconstructed neighboring blocks. For example, intra-frame encoding and / or decoding may be performed by using encoding parameters or values ​​of reference samples included in the reconstructed neighboring blocks.

[0195] The prediction block may represent a block generated by performing intra prediction. The prediction block may correspond to at least one of a CU, a PU, and a TU. The unit of the prediction block may have a size of one of a CU, a PU, and a TU. The prediction block may be a square block of a size of 2×2, 4×4, 16×16, 32×32, or 64×64, etc., or may be a rectangular block of a size of 2×8, 4×8, 2×16, 4×16, and 8×16, etc.

[0196] Intra-prediction may be performed according to an intra-prediction mode for the current block. The number of intra-prediction modes that the current block may have may be a fixed value, and may be a value determined differently according to properties of the prediction block. For example, the properties of the prediction block may include the size of the prediction block, the shape of the prediction block, and the like.

[0197] Regardless of the block size, the number of intra-frame prediction modes can be fixed to N. Alternatively, the number of intra-frame prediction modes can be 3, 5, 9, 17, 34, 35, 36, 65 or 67, etc. Optionally, the number of intra-frame prediction modes can vary according to the block size or the color component type or both the block size and the color component type. For example, the number of intra-frame prediction modes can vary depending on whether the color component is a luminance signal or a chrominance signal. For example, as the block size becomes larger, the number of intra-frame prediction modes can increase. Optionally, the number of intra-frame prediction modes of the luminance component block can be greater than the number of intra-frame prediction modes of the chrominance component block.

[0198] The intra prediction mode may be a non-angle mode or an angle mode. The non-angle mode may be a DC mode or a planar mode, and the angle mode may be a prediction mode having a specific direction or angle. The intra prediction mode may be represented by at least one of a mode number, a mode value, a mode number, a mode angle, and a mode direction. The number of intra prediction modes may be M, which is greater than 1, including non-angle modes and angle modes. In order to perform intra prediction on the current block, a step of determining whether a sample included in a reconstructed neighboring block can be used as a reference sample of the current block may be performed. When there are samples that cannot be used as reference samples of the current block, a value obtained by copying or interpolating at least one sample value of the samples included in the reconstructed neighboring block, or performing both copying and interpolation, may be used to replace the unavailable sample value of the sample, so that the replaced sample value is used as the reference sample of the current block.

[0199] Figure 7 is a diagram showing reference samples that can be used for intra prediction.

[0200] like Figure 7 As shown, at least one of the reference sample line 0 to the reference sample line 3 can be used for intra prediction of the current block. Figure 7 In , the samples of fragment A and fragment F can be filled with the samples of the closest fragment B and fragment E, respectively, instead of retrieving from the reconstructed neighboring blocks. The index information indicating the reference sample line to be used for intra prediction of the current block can be signaled. For example, in Figure 7 In the example, reference sample line indicators 0, 1, and 2 may be signaled as index information indicating reference sample lines 0, 1, and 2. When the upper boundary of the current block is the boundary of the CTU, only reference sample line 0 may be available. Therefore, in this case, index information may not be signaled. When a reference sample line other than reference sample line 0 is used, filtering for a prediction block to be described later may not be performed.

[0201] When intra prediction is performed, a filter may be applied to at least one of a reference sample and a prediction sample based on at least one of an intra prediction mode and a current block size.

[0202] In the case of the planar mode, when generating the prediction block of the current block, according to the position of the prediction target sample in the prediction block, the sample value of the prediction target sample can be generated by using the weighted sum of the upper reference sample and the left reference sample of the current block and the upper right reference sample and the lower left reference sample of the current block. In addition, in the case of the DC mode, when generating the prediction block of the current block, the average value of the upper reference sample and the left reference sample of the current block can be used. In addition, in the case of the angular mode, the prediction block can be generated by using the upper reference sample, the left reference sample, the upper right reference sample and / or the lower left reference sample of the current block. In order to generate the prediction sample value, interpolation of real number units can be performed.

[0203] In the case of intra prediction between color components, a prediction block of a current block of a second color component may be generated based on a corresponding reconstruction block of a first color component. For example, the first color component may be a luminance component, and the second color component may be a chrominance component. For intra prediction between color components, parameters of a linear model between the first color component and the second color component may be derived based on a template. The template may include the upper and / or left neighboring samples of the current block and the upper and / or left neighboring samples of the reconstruction block of the first color component corresponding thereto. For example, the sample value of the first color component having the maximum value among the samples in the template and the sample value of the second color component corresponding thereto, and the sample value of the first color component having the minimum value among the samples in the template and the sample value of the second color component corresponding thereto may be used to derive the parameters of the linear model. When the parameters of the linear model are derived, the corresponding reconstruction block may be applied to the linear model to generate a prediction block of the current block. Depending on the video format, secondary sampling may be performed on the reconstruction block of the first color component and the neighboring samples of the corresponding reconstruction block. For example, when one sample of the second color component corresponds to four samples of the first color component, the four samples of the first color component may be subsampled to calculate one corresponding sample. In this case, parameter derivation of a linear model and intra prediction between color components may be performed based on samples of the corresponding subsamples. Whether to perform intra prediction between color components and / or the range of a template may be signaled as an intra prediction mode.

[0204] The current block may be partitioned into two sub-blocks or four sub-blocks in the horizontal direction or the vertical direction. The partitioned sub-blocks may be reconstructed sequentially. That is, intra prediction may be performed on the sub-block to generate a sub-prediction block. In addition, inverse quantization and / or inverse transformation may be performed on the sub-block to generate a sub-residual block. The reconstructed sub-block may be generated by adding the sub-prediction block to the sub-residual block. The reconstructed sub-block may be used as a reference sample for intra prediction of the sub-sub-block. The sub-block may be a block including a predetermined number (e.g., 16) or more samples. Thus, for example, when the current block is an 8×4 block or a 4×8 block, the current block may be partitioned into two sub-blocks. In addition, when the current block is a 4×4 block, the current block may not be partitioned into sub-blocks. When the current block has other sizes, the current block may be partitioned into four sub-blocks. Information on whether intra prediction is performed based on sub-blocks and / or partition directions (horizontal or vertical) may be sent by signaling. It may be limited to performing sub-block-based intra prediction only when reference sample line 0 is used. When subblock-based intra prediction is performed, filtering for a prediction block, which will be described later, may not be performed.

[0205] The final prediction block can be generated by performing filtering on the prediction block predicted by the intra-frame. Filtering can be performed by applying predetermined weights to the filtering target samples, the left reference samples, the upper reference samples and / or the upper left reference samples. The weights and / or reference samples (range, position, etc.) used for filtering can be determined based on at least one of the block size, the intra-frame prediction mode and the position of the filtering target samples in the prediction block. Filtering can be performed only in the case of a predetermined intra-frame prediction mode (e.g., DC, plane, vertical, horizontal, diagonal and / or adjacent diagonal mode). The adjacent diagonal mode can be a mode in which k is added to the diagonal mode or k is subtracted from the diagonal mode. For example, k can be a positive integer of 8 or less.

[0206] The intra-frame prediction mode of the current block can be entropy encoded / decoded by predicting the intra-frame prediction mode of the block adjacent to the current block. In the case where the intra-frame prediction mode of the current block is the same as that of the neighboring block, the same information as that of the intra-frame prediction mode of the current block and the neighboring block can be sent by signaling using predetermined flag information. In addition, the indicator information of the intra-frame prediction mode that is the same as the intra-frame prediction mode of the current block among the intra-frame prediction modes of multiple neighboring blocks can be sent by signaling. In the case where the intra-frame prediction mode of the current block and the neighboring block is not the same, the intra-frame prediction mode information of the current block can be entropy encoded / decoded by performing entropy encoding / decoding based on the intra-frame prediction mode of the neighboring block.

[0207] Figure 5 is a diagram illustrating an embodiment of an inter-picture prediction process.

[0208] exist Figure 5 In , a rectangle can represent a picture. Figure 5In FIG. 1 , the arrow indicates the prediction direction. According to the encoding type of the picture, the picture can be classified into an intra picture (I picture), a predicted picture (P picture) and a bi-predicted picture (B picture).

[0209] I pictures may be encoded by intra prediction without the need for inter-picture prediction. P pictures may be encoded by inter-picture prediction using reference pictures that exist in one direction (i.e., forward or backward) for the current block. B pictures may be encoded by inter-picture prediction using reference pictures that exist in two directions (i.e., forward and backward) for the current block. When inter-picture prediction is used, the encoder may perform inter-picture prediction or motion compensation, and the decoder may perform corresponding motion compensation.

[0210] Hereinafter, embodiments of inter prediction will be described in detail.

[0211] Reference pictures and motion information may be used to perform inter-picture prediction or motion compensation.

[0212] The motion information of the current block may be derived during inter-picture prediction by each of the encoding device 100 and the decoding device 200. The motion information of the current block may be derived by using the motion information of a reconstructed neighboring block, the motion information of a co-located block (also referred to as a col block or a co-located block), and / or the motion information of a block adjacent to the co-located block. The co-located block may represent a block in a previously reconstructed co-located picture (also referred to as a col picture or a co-located picture) that is spatially located at the same position as the current block. The co-located picture may be one of the one or more reference pictures included in the reference picture list.

[0213] The derivation method of motion information may be different depending on the prediction mode of the current block. For example, the prediction modes applied to inter prediction include AMVP mode, merge mode, skip mode, merge mode with motion vector difference, sub-block merge mode, geometric partition mode, combined inter-frame intra-frame prediction mode, affine mode, etc. Here, the merge mode may be referred to as motion merge mode.

[0214] For example, when AMVP is used as a prediction mode, at least one of a motion vector of a reconstructed neighboring block, a motion vector of a co-located block, a motion vector of a block adjacent to the co-located block, and a (0,0) motion vector may be determined as a motion vector candidate for the current block, and a motion vector candidate list may be generated by using the motion vector candidate. The motion vector candidate of the current block may be derived by using the generated motion vector candidate list. The motion information of the current block may be determined based on the derived motion vector candidate. The motion vector of the co-located block or the motion vector of the block adjacent to the co-located block may be referred to as a temporal motion vector candidate, and the motion vector of the reconstructed neighboring block may be referred to as a spatial motion vector candidate.

[0215] The encoding device 100 may calculate a motion vector difference (MVD) between a motion vector of a current block and a motion vector candidate, and may perform entropy encoding on the motion vector difference (MVD). In addition, the encoding device 100 may perform entropy encoding on a motion vector candidate index and generate a bitstream. The motion vector candidate index may indicate the best motion vector candidate among the motion vector candidates included in the motion vector candidate list. The decoding device may perform entropy decoding on the motion vector candidate index included in the bitstream, and may select a motion vector candidate for a decoding target block from the motion vector candidates included in the motion vector candidate list by using the entropy-decoded motion vector candidate index. In addition, the decoding device 200 may add the entropy-decoded MVD to the motion vector candidate extracted by entropy decoding, thereby deriving the motion vector of the decoding target block.

[0216] In addition, the encoding apparatus 100 may perform entropy encoding on the resolution information of the calculated MVD. The decoding apparatus 200 may adjust the resolution of the entropy-decoded MVD using the MVD resolution information.

[0217] In addition, the encoding device 100 calculates a motion vector difference (MVD) between a motion vector in a current block and a motion vector candidate based on an affine model, and performs entropy encoding on the MVD. The decoding device 200 derives a motion vector based on each sub-block by deriving an affine controlled motion vector of a decoded target block through the sum of the entropy-decoded MVD and the affine controlled motion vector candidate.

[0218] The bitstream may include a reference picture index indicating a reference picture. The reference picture index may be entropy encoded by the encoding apparatus 100 and then signaled as a bitstream to the decoding apparatus 200. The decoding apparatus 200 may generate a prediction block of a decoding target block based on the derived motion vector and the reference picture index information.

[0219] Another example of a method of deriving motion information of a current block may be a merge mode. The merge mode may indicate a method of merging motions of a plurality of blocks. The merge mode may indicate a mode of deriving motion information of a current block from motion information of a neighboring block. When the merge mode is applied, a merge candidate list may be generated using motion information of reconstructed neighboring blocks and / or motion information of co-located blocks. The motion information may include at least one of a motion vector, a reference picture index, and an inter-picture prediction indicator. The prediction indicator may indicate unidirectional prediction (L0 prediction or L1 prediction) or bidirectional prediction (L0 prediction and L1 prediction).

[0220] The merge candidate list may be a list of stored motion information. The motion information included in the merge candidate list may be at least one of the following: motion information of a neighboring block adjacent to the current block (spatial merge candidate), motion information of a co-located block of the current block in a reference picture (temporal merge candidate), new motion information generated by a combination of motion information present in the merge candidate list, motion information of a block encoded / decoded before the current block (historical-based merge candidate), and a zero merge candidate.

[0221] The encoding device 100 may generate a bitstream by performing entropy encoding on at least one of a merge flag and a merge index, and may signal the bitstream to the decoding device 200. The merge flag may be information indicating whether a merge mode is performed for each block, and the merge index may be information indicating which neighboring block among neighboring blocks of the current block is a merge target block. For example, the neighboring blocks of the current block may include a left neighboring block located on the left side of the current block, an upper neighboring block arranged above the current block, and a temporal neighboring block temporally adjacent to the current block.

[0222] In addition, the encoding device 100 performs entropy encoding on the correction information for correcting the motion vector in the motion information of the merge candidate, and sends it to the decoding device 200 with a signal. The decoding device 200 can correct the motion vector of the merge candidate selected by the merge index based on the correction information. Here, the correction information may include at least one of information on whether to perform correction, correction direction information, and correction size information. As described above, the prediction mode in which the motion vector of the merge candidate is corrected based on the correction information sent with the signal can be referred to as a merge mode with a motion vector difference.

[0223] The skip mode may be a mode in which the motion information of the neighboring blocks is applied to the current block as it is. When the skip mode is applied, the encoding apparatus 100 may perform entropy encoding on information of the fact of which block's motion information is to be used as the motion information of the current block to generate a bitstream, and may signal the bitstream to the decoding apparatus 200. The encoding apparatus 100 may not signal a syntax element regarding at least any one of the motion vector difference information, the coded block flag, and the transform coefficient level to the decoding apparatus 200.

[0224] The subblock merge mode may indicate a mode for deriving motion information in units of subblocks of a coding block (CU). When the subblock merge mode is applied, the subblock merge candidate list may be generated using motion information of a subblock co-located with the current subblock in a reference picture (subblock-based temporal merge candidates) and / or affine control point motion vector merge candidates.

[0225] The geometric partition mode may denote a mode of deriving motion information by partitioning the current block into predefined directions, deriving each prediction sample using each of the derived motion information, and deriving the prediction sample of the current block by weighting each of the derived prediction samples.

[0226] The inter-intra combined prediction mode may mean a mode of deriving a prediction sample of a current block by weighting a prediction sample generated by inter prediction and a prediction sample generated by intra prediction.

[0227] The decoding apparatus 200 may correct the derived motion information by itself. The decoding apparatus 200 may search for a predetermined area based on a reference block indicated by the derived motion information, and derive motion information having a minimum SAD as the corrected motion information.

[0228] The decoding apparatus 200 may compensate for prediction samples derived through inter-frame prediction using optical flow.

[0229] Figure 6 is a diagram illustrating transform and quantization processing.

[0230] like Figure 6 As shown in , a transform process and / or a quantization process is performed on the residual signal to generate a quantized level signal. The residual signal is the difference between the original block and the prediction block (i.e., an intra-frame prediction block or an inter-frame prediction block). The prediction block is a block generated by intra-frame prediction or inter-frame prediction. The transform can be a primary transform, a secondary transform, or both a primary transform and a secondary transform. The primary transform of the residual signal generates transform coefficients, and the secondary transform of the transform coefficients generates secondary transform coefficients.

[0231] At least one scheme selected from various predefined transform schemes is used to perform the primary transform. For example, examples of the predetermined transform scheme include discrete cosine transform (DCT), discrete sine transform (DST) and Karhunen-Loève transform (KLT). The transform coefficients generated by the primary transform may undergo a secondary transform. The transform scheme for the primary transform and / or the secondary transform may be determined based on the coding parameters of the current block and / or the neighboring blocks of the current block. Optionally, transform information indicating the transform scheme may be sent by a signal. DCT-based transforms may include, for example, DCT-2, DCT-8, etc. DST-based transforms may include, for example, DST-7.

[0232] A quantized level signal (quantized coefficient) may be generated by performing quantization on a residual signal or a result of performing a primary transform and / or a secondary transform. Depending on the intra prediction mode of the block or the block size / shape, the quantized level signal may be scanned according to at least one of a diagonal upper right scan, a vertical scan, and a horizontal scan. For example, when scanning coefficients in a diagonal upper right scan, the coefficients in block form are changed to a one-dimensional vector form. In addition to the diagonal upper right scan, a horizontal scan that scans the coefficients in a two-dimensional block form horizontally or a vertical scan that scans the coefficients in a two-dimensional block form vertically may be used depending on the intra prediction mode and / or the size of the transform block. The scanned quantized level coefficients may be entropy encoded for insertion into a bitstream.

[0233] The decoder performs entropy decoding on the bit stream to obtain quantized level coefficients. The quantized level coefficients can be arranged in a two-dimensional block form by reverse scanning. For reverse scanning, at least one of diagonal upper right scanning, vertical scanning, and horizontal scanning can be used.

[0234] The quantized level coefficients may then be dequantized, then subjected to a secondary inverse transform as required, and finally subjected to a first inverse transform as required to produce a reconstructed residual signal.

[0235] Inverse mapping in the dynamic range can be performed for the luminance component reconstructed by intra-frame prediction or inter-frame prediction before in-loop filtering. The dynamic range can be partitioned into 16 equal segments, and the mapping function of each segment can be sent with a signal. The mapping function can be sent with a signal at the slice level or the parallel block group level. The inverse mapping function for performing inverse mapping can be derived based on the mapping function. In-loop filtering, reference picture storage and motion compensation are performed in the inverse mapping area, and the prediction block generated by inter-frame prediction is converted to the mapping area via mapping using the mapping function, and then used to generate a reconstructed block. However, since intra-frame prediction is performed in the mapping area, the prediction block generated via intra-frame prediction can be used to generate a reconstructed block without mapping / inverse mapping.

[0236] When the current block is a residual block of a chroma component, the residual block can be converted to an inverse mapping area by performing scaling on the chroma component of the mapping area. The availability of scaling can be signaled at the slice level or the parallel block group level. Scaling can be applied only when the mapping of the luminance component is available and the partitions of the luminance component and the chroma component follow the same tree structure. Scaling can be performed based on the average value of the sample values ​​of the luminance prediction block corresponding to the chroma block. In this case, when the current block uses inter-frame prediction, the luminance prediction block can represent the mapped luminance prediction block. The value required for scaling can be derived by using the index reference lookup table of the fragment to which the average value of the sample values ​​of the luminance prediction block belongs. Finally, the residual block can be converted to an inverse mapping area by scaling the residual block using the derived value. Then, chroma component block recovery, intra-frame prediction, inter-frame prediction, in-loop filtering, and reference picture storage can be performed in the inverse mapping area.

[0237] Information indicating whether mapping / inverse mapping of luma components and chroma components is available may be signaled through a sequence parameter set.

[0238] The prediction block of the current block can be generated based on a block vector indicating the displacement between the current block and the reference block in the current picture. In this way, the prediction mode for generating the prediction block with reference to the current picture is called an intra-block copy (IBC) mode. The IBC mode can be applied to M×N (M<=64, N<=64) coding units. The IBC mode may include a skip mode, a merge mode, an AMVP mode, and the like. In the case of a skip mode or a merge mode, a merge candidate list is constructed, and a merge index is sent with a signal so that a merge candidate can be specified. The block vector of the specified merge candidate can be used as the block vector of the current block. The merge candidate list may include at least one of a spatial candidate, a history-based candidate, a candidate based on the average of two candidates, and a zero merge candidate. In the case of the AMVP mode, a difference block vector may be sent with a signal. In addition, a prediction block vector may be derived from the left neighboring block and the upper neighboring block of the current block. The index of the neighboring block to be used may be sent with a signal. The prediction block in the IBC mode is included in the current CTU or the left CTU and is limited to blocks in the reconstructed area. For example, the value of the block vector can be limited so that the prediction block of the current block is located in the region of three 64×64 blocks before the 64×64 block to which the current block belongs in the encoding / decoding order. By limiting the value of the block vector in this way, the memory consumption and device complexity of the implementation scheme according to the IBC mode can be reduced.

[0239] Hereinafter, an image encoding / decoding method according to the present invention will be described.

[0240] Figure 8 is a diagram illustrating an image encoding apparatus according to an embodiment of the present invention.

[0241] Reference Figure 1 and Figure 8 , Figure 1 The transform unit 130 may be composed of a first transform unit and a second transform unit, and Figure 1 The inverse transform unit 170 may be composed of a first inverse transform unit and a second inverse transform unit. Here, the first transform, the first inverse transform, the second transform, and the second inverse transform may represent a primary transform, a primary inverse transform, a secondary transform, and a secondary inverse transform, respectively.

[0242] The input signal of the first transform unit may be a residual signal generated by subtracting the original image signal from the predicted image signal. The first transform unit may perform a first transform on the input signal and output a corresponding result. In addition, the first transform unit may skip the first transform.

[0243] The input signal of the second transform unit may be the output signal of the first transform unit. The second transform unit may perform a second transform on the input signal and output a corresponding result. In addition, the second transform unit may skip the second transform.

[0244] The input signal of the quantization unit may be the output signal of the second transform unit. The quantization unit may perform quantization on the input signal and output a corresponding result (quantization level).

[0245] The entropy encoding unit may perform entropy encoding on the output signal of the quantization unit and the encoding information.

[0246] Fig. 9 is a diagram illustrating an image decoding apparatus according to an embodiment of the present invention.

[0247] Reference Figure 2 and Fig. 9 , Figure 2 The inverse transform unit 230 may be composed of a first inverse transform unit and a second inverse transform unit.

[0248] The entropy decoding unit may perform entropy decoding on a bit stream of the encoded quantization level signal and the encoding information transmitted from the encoding device.

[0249] The input signal of the inverse quantization unit may be a quantization level of entropy decoding. The inverse quantization unit may perform inverse quantization on the input signal and output a corresponding result.

[0250] The input signal of the second inverse transform unit may be the output signal of the inverse quantization unit. The second inverse transform unit may perform a second inverse transform on the input signal and output a corresponding result. In addition, the second inverse transform unit may skip the second inverse transform and output the input signal as is.

[0251] The input signal of the first inverse transform unit may be the output signal of the second inverse transform unit. The first inverse transform unit may perform a first inverse transform on the input signal and output a corresponding result. In addition, the first inverse transform unit may skip the first inverse transform and output the input signal as is. The output signal of the first inverse transform unit may be a reconstructed residual signal.

[0252] Image encoding / decoding may be performed by coding block partition units, and a single coding block partition unit may be divided into a plurality of sub-units.

[0253] A single coding block partition unit may be one of a picture, a tile, a slice, a partition, a CTU, and a CU.

[0254] A single coding block partition unit may include all components used to represent the entire image.

[0255] For example, the coding block partition unit may include components R, G, and B.

[0256] For example, the coding block partition unit may include components Y, U, and V.

[0257] For example, the coding block partition unit may include components Y, Cb, and Cr.

[0258] For example, a coding block partition unit may include only one component (monochrome).

[0259] Components of a coding block partition unit may have different sizes.

[0260] For example, the coding block partition unit may be YUV4:2:0.

[0261] For example, the coding block partition unit may be YUV4:2:2.

[0262] Here, when each component of the coding block partition unit is partitioned into sub-units, each component may be partitioned into a single partition structure or a multi-partition structure.

[0263] The single partition structure may mean that each component has one partition structure when partitioned into a plurality of sub-units.

[0264] Fig.10 This may be an example of a single partition structure when YUV4:2:0.

[0265] The multi-partition structure may mean that each component has a different partition structure when being partitioned into a plurality of sub-units.

[0266] For example, when there are three multi-partition structures, components Y, U, and V may be partitioned into different partition structures.

[0267] For example, there are two multi-partition structures, and the luma component (Y) and chroma components (Cb, Cr) can be partitioned into different partition structures.

[0268] Fig.11 This can be an example of two multi-partition structures in case of YcbCr4:2:0.

[0269] Fig.12 and Fig.13 is a diagram for explaining a method for encoding / decoding a residual signal according to an embodiment of the present invention. Fig.12 and Fig.13 A coding / decoding method of a residual signal is described. In the following description, a current block may be at least one of a coding block, a sub-coding block, a transform block, and a sub-transform block.

[0270] [D1] First transformation / first inverse transformation step When encoding of the current block is performed, a first transformation may be performed.

[0271] In the first transform step, a transform coefficient may be generated by performing a first transform on the residual signal, and the transform coefficient generated thereby may be output. Here, the transform coefficient may be a coefficient value generated by performing a transform on the residual block. Optionally, when a first transform skip mode is applied, the first transform may be skipped and the residual signal may be output as is. The output of the first transform may be the input of the second transform.

[0272] In the first inverse transform step, a residual signal may be output by performing the first inverse transform on the result of the second inverse transform. Optionally, when the first inverse transform skip mode is applied, the first inverse transform may be skipped and the result of the second inverse transform may be output as is. Here, the output of the first inverse transform may be a residual signal.

[0273] The first transform and the first inverse transform may be performed by using at least one of a plurality of predefined transform schemes. For example, the plurality of predefined transform schemes may include discrete cosine transform (DCT), discrete sine transform (DST), and Karhunen-Loève transform (KLT). A secondary transform may be performed on the transform coefficients generated after performing the primary transform. The transform scheme applied to the primary transform and / or the secondary transform may be determined based on at least one of the coding parameters of the current block and / or the coding parameters of the neighboring blocks. Optionally, transform information indicating the transform scheme may be sent by a signal. For example, a transform scheme based on DCT may include DCT-2 and DCT-8. A transform scheme based on DST may include DST-7.

[0274] The first transform and the first inverse transform may be performed in a first transform block unit (TB1). Here, the first transform block may be a coding block.

[0275] When the current coding block is larger than the maximum first transform size, the current coding block may be partitioned into two or four partitions, thereby configuring multiple first transform blocks.

[0276] For example, Fig.14 As shown, when the current coding block has a size of 128×64 and the maximum first transform size is 64×64, the current coding block may be partitioned into two, and a first transform block (TB1) may be configured.

[0277] For example, Fig.15 As shown, when the current coding block has a size of 128×128 and the maximum first transform size is 64×64, the current coding block may be partitioned into four parts, and a first transform block (TB1) may be configured.

[0278] [D2] Second transformation and second inverse transformation steps When transform encoding / decoding of the current block is performed, the second transform and the second inverse transform may be performed by using the transform block to determine at least one of the second transform / inverse transform and zeroing the transform result.

[0279] In the second transform step, second transform coefficients may be generated by performing a second transform on the signal of the first transform signal, and the second transform coefficients generated thereby may be output. The output of the second transform may be an input to the quantization step.

[0280] In the second inverse transform step, the primary transform coefficients may be output by performing a second inverse transform on the inverse quantization result. In addition, the second transform and the second inverse transform may be skipped. Here, when the current block is in the second transform skip mode, the second transform may be skipped.

[0281] According to an embodiment of the present invention, the second transform may be skipped depending on the size of the current block (eg, the horizontal size, the vertical size, and the area of ​​the current block).

[0282] For example, when the size of the current block is greater than N×N, the second transform may be skipped. Here, N may be 64 or 32.

[0283] For example, when the size of the current block is equal to or smaller than N×N, the second transform may be skipped.

[0284] For example, when the larger of the horizontal size and the vertical size of the current block is greater than a predefined value, the second transform may be skipped. Here, the predefined value may be derived based on the maximum transform block size.

[0285] According to an embodiment of the present invention, the second transform may be skipped according to the prediction mode of the current block.

[0286] For example, when the current block is in inter prediction mode, the second transform may be skipped.

[0287] For example, when the current block is in intra sub-block partitioning (ISP) mode, the second transform may be skipped.

[0288] For example, when the current block is in matrix-based intra prediction (MIP) mode, the second transform may be skipped.

[0289] For example, when the current block is in intra block copy (IBC) mode, the second transform may be skipped.

[0290] According to an embodiment of the present invention, the second transformation may be skipped according to the first transformation information of the current block.

[0291] For example, when the current block performs a transform other than DCT-2, the second transform may be skipped.

[0292] For example, when the current block is in sub-block transform (SBT) mode, the second transform may be skipped.

[0293] For example, when the current block is in the first transform skip mode, the second transform may be skipped.

[0294] According to an embodiment of the present invention, the second transform may be skipped depending on the image components of the current block.

[0295] For example, when the image component of the current block is a chrominance signal (Cb / Cr), the second transform of the current block may be skipped.

[0296] According to an embodiment of the present invention, the second transform may be skipped according to a transform block index of the current block. The transform block index may be an index indicating one of the sub-transform blocks.

[0297] For example, when the transform block index is not 0, the second transform may be skipped.

[0298] According to an embodiment of the present invention, the second transformation may be skipped unconditionally.

[0299] Whether to perform the second transform may be indicated in units of a sequence or a picture through a high level syntax (HLS).

[0300] [D2-1] Transformation block determination When the second transform and the second inverse transform of the current block are performed, a second transform block (TB2) may be determined. Here, the second transform block may be a block unit for performing the second transform or the second inverse transform.

[0301] According to an embodiment of the present invention, the second transform may be performed in units of coding blocks (CBs) or first transform blocks.

[0302] For example, the second transform (or the second inverse transform) may be performed per current coding block unit.

[0303] For example, the second transform (or second inverse transform) may be performed in units of first transform blocks.

[0304] According to an embodiment of the present invention, the second transform block unit may be a subblock included in the coding block or the first transform block.

[0305] For example, Fig.16 As shown in , the second transform block unit can be the coding block or the upper left 4×4 of the first transform block.

[0306] For example, Fig.17 As shown in , the second transform block unit may be the upper left 4×8 or upper left 8×4 of the coding block or the first transform block.

[0307] For example, the second transform block unit may be the upper left 8×8 of the coding block or the first transform block.

[0308] For example, the second transform block unit may be a non-rectangular area on the upper left of the coding block or the first transform block. Fig.18 It may be an example of a non-rectangular second transform block.

[0309] According to an embodiment of the present invention, the second transform block unit may be adaptively determined according to the size of the coding block or the first transform block. Here, N second transform blocks may be determined (N is a positive integer).

[0310] For example, when the coding block or the first transform block has a size of 4×4, the second transform block unit may be 4×4.

[0311] For example, when the coding block or the first transform block has a size of 4×8 or 8×4, the second transform block unit may be a top left 4×4.

[0312] For example, when the coding block or the first transform block has a size of N×4 or 4×N, the second transform block unit may be upper left 8×4 or upper left 4×8. Here, N may be a positive integer equal to or greater than 16.

[0313] For example, when the coding block or the first transform block has a size of N×M or M×N, the second transform block unit may be upper left 8×8. Here, N and M may be positive integers satisfying min(N,M)>=8.

[0314] For example, when the coding block or the first transform block has a size of N×4 or 4×N, the two second transform block units may be two upper left 4×4 regions. Here, N may be a positive integer equal to or greater than 16.

[0315] According to an embodiment of the present invention, when there are multiple first transform blocks in the current coding block, N second transform blocks (N is a positive integer) may be determined in the current coding block. Here, N may be equal to or less than the number of first transform blocks in the current coding block.

[0316] For example, Fig.19 As shown in , when a coding block having a size of 128×128 is quad-partitioned into four 64×64 first transform blocks, a second transform block may be determined in each of the first transform blocks.

[0317] For example, Fig. 20 As shown in , when a coding block having a size of 128×128 is quad-partitioned into four 64×64 first transform blocks, a second transform block may be determined only in the top left first transform block.

[0318] [D2-2] Second transformation The second transform and the second inverse transform may be performed on the current block. The second transform may be performed on the second transform block determined in step D2-1. The input coefficients of the second transform may be result coefficients of the first transform corresponding to the second transform block.

[0319] The second transform input coefficients may be defined in vector form.

[0320] For example, Fig.16 As shown in , the input coefficients of the second transform of the second transform block may be a 16×1 vector.

[0321] For example, Fig.17 As shown in , the input coefficients of the second transform of the second transform block may be a 32×1 vector.

[0322] For example, Fig.18 As shown in , the input coefficients of the second transform of the second transform block may be a 48×1 vector.

[0323] When the second transform is performed, the second transform may be performed by matrix product of an input coefficient of the second transform and a predefined transform matrix.

[0324] According to an embodiment of the present invention, a plurality of transformation matrices for the second transformation may be predefined.

[0325] According to an embodiment of the present invention, a transformation matrix having a specific size may be selected from transformation matrices predefined according to a vector size of an input coefficient of the second transformation.

[0326] For example, for an input vector having a size of 16x1, a 16x16 transformation matrix may be selected.

[0327] For example, for an input vector having a size of 32x1, a 32x32 transformation matrix may be selected.

[0328] For example, for an input vector having a size of 48×1, a 48×48 transformation matrix may be selected.

[0329] According to an embodiment of the present invention, a transform matrix set having N transform matrices may be defined for each size of the transform matrix according to the intra prediction mode of the current block. Here, for the second transform block, the index information of the best matrix may be signaled in the transform matrix of the corresponding transform matrix set.

[0330] When performing the second inverse transform, the second inverse transform may be performed on the second transform block determined in step D2-1. The input coefficients of the second inverse transform may be the result coefficients of the inverse quantization corresponding to the second transform block. Here, the input coefficients of the second inverse transform may be defined as vector form.

[0331] When the second inverse transform is performed, the second inverse transform may be performed by matrix product of input coefficients of the second transform and a transposed matrix of the predefined transform matrix.

[0332] [D2-3] The transformation result is reset to zero When the second transform and the second inverse transform are performed on the current block, zeroing of the transform result may be performed.

[0333] The zeroing of the transformation result may mean replacing the result of the second transformation for a specific area with 0. Here, the zeroing of the transformation result may be adaptively determined according to the size of the current coding block and the size of the second transformation block.

[0334] For example, Fig.21 As shown, when the transform result zeroing is performed on the second transform block having a size of 4×4, the transform result zeroing may be performed on the result of the second transform result.

[0335] For example, when the transformation result is reset to zero for the second transformation block of size 4×8 or 8×4, the following can be done: Fig. 22 (a) and Fig. 22 The transform result is zeroed on the result of the second transform result as shown in (b). Here, the size of the current coding block may be 4×N or N×4, and N may be an integer equal to or greater than 16.

[0336] For example, the transformation result zeroing may be performed for the non-rectangular second transformation block. Here, when the current coding block has a size of 8×8, Fig.23 In addition, when the current coding block has a size equal to or greater than 8×16, 16×8, or 16×16, the transformation result may be reset to zero as shown in (a) of FIG. Fig.23 The transformation result shown in (b) is reset to zero.

[0337] When performing the transformation result zeroing, the transformation result zeroing may be performed by a matrix product of the second transformed input vector and the simplified second transformed matrix.

[0338] For example, when Fig.21 When performing zeroing of the transformation result as shown, a matrix product of an input vector of size 16×1 and a second transformation matrix of size 8×16 may be used.

[0339] For example, when Fig. 22 When performing zeroing of the transformation result as shown, a matrix product of an input vector of size 32×1 and a second transformation matrix of size 16×32 may be used.

[0340] For example, when Fig.23 When performing zeroing of the transformation result as shown in (a), a matrix product of an input vector of size 48×1 and a second transformation matrix of size 8×48 may be used.

[0341] For example, when Fig.23 When performing zeroing of the transformation result as shown in (b), a matrix product of an input vector of size 48×1 and a second transformation matrix of size 16×48 may be used.

[0342] When the second inverse transform is performed, the second inverse transform may be performed by matrix product of the input coefficients of the second transform and a transposed matrix of the predefined simplified transform matrix.

[0343] [D3] Quantization and dequantization steps When transform encoding / decoding of the current block is performed, quantization and inverse quantization may be performed.

[0344] The quantization level may be generated by performing quantization on the result of the second transform or the residual signal.

[0345] The result of the first transform and / or the second transform or the residual signal may be generated by performing inverse quantization on a quantization level configured as an entropy result.

[0346] [D4] Entropy encoding and decoding steps When transform encoding and decoding of the current block are performed, entropy encoding / decoding of the second transform information may be performed by using at least one of [D4-1] second transform information encoding / decoding and [D4-2] determination of whether to perform second transform information encoding / decoding. Here, the second transform information may include a second transform skip mode indicator and second transform matrix index information.

[0347] [D4-1] Second transformation information encoding / decoding When entropy encoding / decoding of the current block is performed, second transform information encoding / decoding may be performed.

[0348] According to an embodiment of the present invention, the second transformation information encoding / decoding may be performed in the step of entropy encoding / decoding per coding unit.

[0349] For example, Fig.24 As shown, a single second transformation information encoding / decoding may be performed per coding unit.

[0350] According to an embodiment of the present invention, the second transformation information encoding / decoding may be performed in the step of entropy encoding / decoding per transformation unit.

[0351] For example, Fig.25 As shown, the second transformation information decoding may be performed per transformation unit.

[0352] For example, Fig.26 As shown, the second transform information decoding may be performed only in the first second transform unit. In other words, when there are multiple second transform blocks in the current coding block, the second transform information decoding may be performed only on the first second transform block. Here, in the remaining second transform units, the second transform information may be used by being derived from the first second transform unit. Optionally, the second transform may be skipped in the remaining second transform units.

[0353] According to an embodiment of the present invention, second transform information encoding and decoding may be performed differently according to image components and partition structures (single partition structure or multi-partition structure).

[0354] For example, the second transform information encoding and decoding may be performed only in the second transform block of the luminance component which is the image component.

[0355] For example, the second transform information may be encoded and decoded in the second transform block for the luminance component and the chrominance component, which are image components, respectively.

[0356] For example, in a single partition structure, second transform information of a second transform block may be encoded and decoded.

[0357] Here, the luminance component and the chrominance component may share a single piece of second transform information. Optionally, only the luminance component of the image may use the second transform information. Here, the second transform of the chrominance component may be skipped. Optionally, the second transform information may be encoded and decoded in the second transform block for the luminance component and the chrominance component as image components, respectively.

[0358] For example, in a multi-partition structure, second transform information of a second transform block may be encoded and decoded.

[0359] Here, the luminance component and the chrominance component may share a single piece of second transform information. Optionally, only the luminance component of the image may use the second transform information. Here, the second transform of the chrominance component may be skipped. Optionally, the second transform information may be encoded and decoded in the second transform block for the luminance component and the chrominance component of the image, respectively.

[0360] [D4-2] Determine whether to perform second transformation information encoding / decoding When entropy encoding / decoding of the current block is performed, it may be determined whether to perform second transform information encoding / decoding.

[0361] According to an embodiment of the present invention, before performing the second transform information encoding / decoding, whether to perform transform information encoding / decoding may be determined by confirming a quantization level signal.

[0362] For example, when each quantization level signal of the current block is 0, the second transform information encoding / decoding may not be performed. In this case, the second transform may be skipped.

[0363] For example, when a quantization level signal of the current block is not 0, the second transform information encoding / decoding may not be performed. In this case, the second transform may be skipped.

[0364] For example, when each quantization level signal of the first transform block is 0, the second transform information encoding / decoding may not be performed. In this case, the second transform may be skipped.

[0365] For example, when a quantization level signal of the first transform block is not 0, the second transform information encoding / decoding may not be performed. In this case, the second transform may be skipped.

[0366] For example, when there is a quantization level signal in the return-to-zero region of the second transform block, the second transform information encoding / decoding may not be performed. In this case, the second transform may be skipped.

[0367] When entropy encoding of the second transform information is performed in coding units, a quantization level used to consider whether to perform second transform information encoding / decoding may be a quantization level signal of a corresponding coding block including all image components to which each second transform is applied.

[0368] Fig. 27 There may be an example in which the second transform information decoding per coding unit includes determining whether to perform second transform information encoding / decoding.

[0369] When entropy encoding for the second transform information is performed per transform unit, a quantization level used to consider whether to perform second transform information encoding / decoding may be a quantization level signal of a corresponding transform block including all image components to which each second transform is applied.

[0370] Fig.28 and Fig.29 It may be an example in which the second transform information decoding per transform unit includes determining whether to perform second transform information encoding / decoding.

[0371] Hereinafter, an adaptive motion vector resolution (AMVR) method, which is one of methods for inter prediction, will be described.

[0372] The AMVR method may define a set of motion vector resolution units.

[0373] The encoder and the decoder may define N adaptive motion vector resolution unit sets in units of at least one of a picture, a slice, a tile, a partition, a CTU, a CU, and a PU.

[0374] The adaptive motion vector resolution method may be performed in at least one inter-frame prediction mode of the AMVP mode and the affine mode. Here, the motion vector of the AMVP mode and the affine mode may be obtained by adding the difference between the motion vector prediction obtained by the neighboring block and the motion vector obtained by the best inter-frame prediction and search in the encoder to the motion vector prediction factor. Here, the best cost may be at least one of the RD cost, SAD, SATD, MR-SAD, and MR-SATD.

[0375] The motion information to which the adaptive motion vector resolution method is applied may be defined as predetermined motion information.

[0376] The motion information to which the adaptive motion vector resolution method is applied may mean motion information obtained through the AMVP mode or the affine mode and shifted in a resolution unit.

[0377] In the AMVR method, motion information may be transmitted by using at least one of a plurality of different resolution units. Here, the motion information may include a motion vector (MVx, Mvy), a motion vector predictor (MVPx, MVPy), a reference picture list index, a reference picture index, and a motion vector difference (MVDx, MVDy).

[0378] Motion information in the AMVR method may have a single reference picture list index as a single piece of motion information.

[0379] The motion information in the AMVR method may refer to a single reference picture as a single piece of motion information.

[0380] A single piece of motion information in the AMVR method may have a single motion vector resolution.

[0381] In the AMVR method, multiple motion vectors can have a single motion vector resolution.

[0382] In the AMVR method, a single motion vector difference may have a single motion vector resolution.

[0383] In the AMVR method, multiple motion vector differences can have a single motion vector resolution.

[0384] In addition, the encoder may search for an optimal adaptive motion vector resolution. Here, the optimal cost may be at least one of RD cost, SAD, SATD, MR-SAD, and MR-SATD.

[0385] When the AMVR method is performed on the current coding block, motion resolution prediction and motion compensation may be performed.

[0386] Here, motion resolution prediction may mean predicting the motion information found in the AMVR method with a plurality of different units of precision. In this case, when the accuracy is applied to each piece of motion information, the motion information may be efficiently signaled.

[0387] When performing motion resolution prediction of the current block, the following equation may be used.

[0388] Equation 1 mv=((mv+ (1<<(amvrshift-1))-(mv>= 0 ) )>>amvrshift)< <amvrshift Here, mv may represent a motion vector obtained by the AMVP mode and the affine mode, and amvrshift may represent a resolution unit of motion information.

[0389] When performing motion vector resolution prediction of the current block, a resolution set consisting of a plurality of motion vector resolutions may be defined, and motion vector resolution prediction may be performed by using at least one of the defined resolutions.

[0390] For example, when the prediction mode of the current block is the AMVP mode, the resolution set {1 / 4, 1 / 2, 1, 4} can be used. In the case of the affine mode, the weight set {1 / 4, 1 / 16, 1} can be used.

[0391] For example, when the prediction mode of the current block is AMVP mode, the resolution set {1 / 4, 1 / 2, 1, 4} can be used. In the case of affine mode, the weight set {1 / 4, 1 / 2, 1 / 16, 1} can be used.

[0392] For example, when the prediction mode of the current block is AMVP mode, the resolution set {1 / 4, 1 / 2, 1, 4} can be used. In the case of affine mode, the weight set {1 / 4, 1 / 8, 1 / 16, 1} can be used.

[0393] For example, when the prediction mode of the current block is AMVP mode, the resolution set {1 / 4, 1 / 2, 1, 4} can be used. In the case of affine mode, the weight set {1 / 4, 1 / 16, 1, 2} can be used.

[0394] When performing motion vector resolution prediction of the current block, a resolution adaptively derived from encoding information of the current block may be used.

[0395] For example, when the prediction mode of the current block is a mode capable of deriving one resolution from a neighboring block, the resolution of the neighboring block may be used as the resolution of the current block.

[0396] For example, when the prediction mode of the current block is a mode capable of deriving one resolution from a neighboring block, the resolution may be used as the resolution of the current block.

[0397] For example, when the prediction mode of the current block is a mode capable of deriving a plurality of resolutions from neighboring blocks, a resolution having the highest frequency among the derived resolution values ​​may be used as the resolution of the current block.

[0398] For example, when the prediction mode of the current block is a mode capable of deriving a plurality of weights from neighboring blocks, the resolution may be used as the weight of the current block.

[0399] Here, the prediction mode of the current block capable of deriving one weight from neighboring blocks may be the AMVP mode, and the mode capable of deriving a plurality of weights may be the affine mode.

[0400] When entropy encoding and decoding of the current block are performed, encoding and decoding of detailed information about the prediction mode may be performed. For example, in the steps of entropy encoding and decoding by coding unit, encoding and decoding of detailed information about the prediction mode may be performed. In addition, when encoding and decoding of detailed information about the prediction mode are performed, an adaptive motion vector resolution (AMVR) method may be used.

[0401] When entropy encoding and entropy decoding for AMVR prediction information are performed, an AMVR usage flag (eg, amvr_enable_flag) may be transmitted and entropy encoded / decoded in a higher-level unit.

[0402] For example, transmission and entropy encoding / decoding of an AMVR usage flag may be performed in units of at least one of an SPS, a PPS, and a slice header.

[0403] When the AMVR usage flag is 1 (on), adaptive motion vector resolution prediction can be performed. When the AMVR usage flag is 0 (off), motion vector resolution prediction with resolution can be applied.

[0404] When entropy encoding and decoding of AMVR prediction information are performed, an AMVR flag (eg, amvr_flag) may be transmitted and entropy encoded / decoded per specific coding unit.

[0405] For example, transmission and entropy encoding / decoding of the AMVR flag may be performed in units of at least one of a picture, a sub-picture, a slice, a tile, a partition, a CTU, a CU, a PU, and a TU.

[0406] When entropy encoding and decoding of AMVR prediction information are performed, an AMVR flag (eg, amvr_flag) may be transmitted and entropy encoded / decoded per specific coding unit.

[0407] For example, transmission and entropy encoding / decoding of the AMVR index may be performed in units of at least one of a picture, a sub-picture, a slice, a tile, a partition, a CTU, a CU, a PU, and a TU.

[0408] Here, the binarization of the AMVR index may be performed by at least one method of a truncated Rice code, a truncated unary code, a k-th order exponential Golomb (exp_golomb) code, and a fixed length code.

[0409] For example, the AMVR index in AMVP mode can be obtained by using Fig.30 (a) Fig.30 (b) Fig.30 (c) and Fig.30 At least one method of (d) is transmitted and entropy encoded / entropy decoded.

[0410] For example, the AMVR index of the affine mode can be obtained by using Fig.31 (a) Fig.31 (b) Fig.31 (c) and Fig.31 At least one method of (d) is transmitted and entropy encoded / entropy decoded.

[0411] When performing entropy encoding and decoding of AMVR prediction information, an AMVR index (e.g., amvr_precision_idx), an AMVR flag (e.g., amvr_flag), an integer motion vector resolution flag (e.g., amvr_integer_flag), and an additional AMVR index (e.g., amvr_idx) may be transmitted and entropy encoded / decoded per specific coding unit.

[0412] For example, transmission and entropy encoding / decoding of the additional AMVR index may be performed in units of at least one of a picture, a sub-picture, a slice, a tile, a partition, a CTU, a CU, a PU, and a TU.

[0413] Here, the binarization of the AMVR index may be performed by at least one of a truncated Rice code, a truncated unary code, a k-order exp_golomb code, and a fixed-length code.

[0414] Here, the AMVR flag may indicate whether a resolution unit exists.

[0415] Here, in case of the AMVP mode, the integer motion vector resolution flag may indicate whether the resolution is less than 1.

[0416] For example, Fig.32 As shown, a resolution set for AMVP mode may be transmitted and entropy encoded / decoded.

[0417] For example, Fig.33 (a) Fig.33 (b) and Fig.33 As shown in (c), the resolution set for the affine mode can be transmitted and entropy encoded / decoded.

[0418] When entropy encoding and entropy decoding of AMVR prediction information are performed, normal mode entropy encoding and bypass mode entropy encoding may be performed for each binary bit.

[0419] Here, normal mode entropy coding may mean CABAC coding, and bypass entropy coding may mean bypass coding.

[0420] For example, normal mode entropy encoding may be performed on the AMVR flag.

[0421] For example, bypass mode entropy encoding may be performed for the AMVR flag.

[0422] For example, bypass mode entropy coding may be performed on the AMVR index.

[0423] For example, normal mode entropy encoding may be performed on the first binary bit of the AMVR index, and bypass mode entropy encoding may be performed on the remaining binary bits.

[0424] For example, normal mode entropy encoding may be performed on integer motion vector resolution flags.

[0425] For example, bypass mode entropy encoding may be performed for integer motion vector resolution flags.

[0426] For example, bypass mode entropy encoding may be performed for the additional AMVR indices.

[0427] Fig.34 is a flowchart for explaining an image decoding method according to an embodiment of the present invention.

[0428] Reference Fig.34, the decoder may obtain information about a maximum transform block size ( S3401 ).

[0429] In addition, based on the information about the maximum transform block size, the decoder may derive the maximum transform block size ( S3402 ).

[0430] For example, the step S3402 of determining whether to apply the secondary inverse transform may determine whether to apply the secondary inverse transform to the current block based on the larger value of the horizontal size and the vertical size of the current block. More specifically, when the larger value of the horizontal size and the vertical size of the current block is greater than the maximum transform block size, the step S3402 of determining whether to apply the secondary inverse transform may determine not to apply the secondary inverse transform to the current block.

[0431] For example, the step S3402 of determining whether to apply the secondary inverse transform may determine whether to apply the secondary inverse transform to the current block based on the primary inverse transform information of the current block. More specifically, when the primary inverse transform information of the current block indicates the primary inverse transform skip mode, the step S3402 of determining whether to apply the secondary inverse transform may determine not to apply the secondary inverse transform to the current block.

[0432] In addition, the decoder may determine whether to apply a secondary inverse transform to the current block based on the maximum transform block size and the horizontal size and the vertical size of the current block ( S3403 ).

[0433] Fig.35 is a flowchart for explaining an image encoding method according to an embodiment of the present invention.

[0434] Reference Fig.35 , the encoder may determine a maximum transform block size (S3501).

[0435] In addition, the encoder may encode maximum transform block size information indicating a maximum transform block size ( S3502 ).

[0436] In addition, the encoder may determine whether to apply a secondary inverse transform to the current block based on the maximum transform block size and the horizontal size and the vertical size of the current block ( S3503 ).

[0437] For example, the step S3503 of determining whether to apply the secondary inverse transform may determine whether to apply the secondary inverse transform to the current block based on the larger value of the horizontal size and the vertical size of the current block. More specifically, when the larger value of the horizontal size and the vertical size of the current block is greater than the maximum transform block size, the step S3503 of determining whether to apply the secondary inverse transform may determine not to apply the secondary inverse transform to the current block.

[0438] For example, the step S3503 of determining whether to apply the secondary inverse transform may determine whether to apply the secondary inverse transform to the current block based on the primary inverse transform information of the current block. More specifically, when the primary inverse transform information of the current block indicates the primary inverse transform skip mode, the step S3503 of determining whether to apply the secondary inverse transform may determine not to apply the secondary inverse transform to the current block.

[0439] In addition, the non-transitory computer-readable recording medium according to the present invention may store a bit stream generated by the image encoding method according to the present invention. More specifically, in a non-transitory computer-readable recording medium for storing a bit stream generated by the image encoding method, the image encoding method may include: determining a maximum transform block size; encoding maximum transform block size information indicating the maximum transform block size; and determining whether to apply a secondary inverse transform to the current block based on the maximum transform block size and the horizontal size and vertical size of the current block.

[0440] The above embodiments may be performed in the same way in an encoder and a decoder.

[0441] At least one or a combination of the above embodiments may be used to encode / decode a video.

[0442] The order applied to the above embodiments may be different between the encoder and the decoder, or the order applied to the above embodiments may be the same in the encoder and the decoder.

[0443] The above embodiments may be performed on each of the luminance signal and the chrominance signal, or may be performed identically on the luminance and chrominance signals.

[0444] The block form to which the above embodiment of the present invention is applied may have a square form or a non-square form.

[0445] At least one of the syntax elements (flags, indexes, etc.) entropy-encoded in the encoder and entropy-decoded in the decoder may use at least one of the following binarization, debinarization, entropy encoding / entropy decoding methods.

[0446] - Binarization / debinarization method with signed 0th order Exp_Golomb (se(v)) - Binarization / debinarization method of k-order Exp_Golomb with sign (sek(v)) - Binarization / debinarization method of Exp_Golomb of order 0 for unsigned positive integers (ue(v)) - Unsigned positive integer k-th order Exp_Golomb binarization / debinarization method (uek(v)) - Fixed length binarization / debinarization method (f(n)) - Truncated Rice binarization / debinarization method or truncated unary binarization / debinarization method (tu(v)) - Truncated Binary Binarization / Debinarization Method (tb(v)) -Context Adaptive Arithmetic Coding / Decoding Method (ae(v)) -Byte unit bit string (b(8)) - Binarization / debinarization methods for signed integers (i(n)) - Binarization / debinarization method for unsigned positive integers (u(n)) - Unary Binarization / Debinarization Method The above embodiments of the present invention may be applied according to the size of at least one of a coding block, a prediction block, a transform block, a block, a current block, a coding unit, a prediction unit, a transform unit, a unit, and a current unit. Here, the size may be defined as a minimum size or a maximum size or both a minimum size and a maximum size, so that the above embodiments are applied, or may be defined as a fixed size to which the above embodiments are applied. In addition, in the above embodiments, the first embodiment may be applied to a first size, and the second embodiment may be applied to a second size. In other words, the above embodiments may be applied according to size combinations. In addition, the above embodiments may be applied when the size is equal to or greater than the minimum size and equal to or less than the maximum size. In other words, the above embodiments may be applied when the block size is included in a specific range.

[0447] For example, when the size of the current block is 8×8 or larger, the above embodiment may be applied. For example, when the size of the current block is only 4×4, the above embodiment may be applied. For example, when the size of the current block is 16×16 or smaller, the above embodiment may be applied. For example, when the size of the current block is equal to or larger than 16×16 and equal to or smaller than 64×64, the above embodiment may be applied.

[0448] The above embodiments of the present invention may be applied in accordance with time layers. In order to identify the time layers to which the above embodiments may be applied, a corresponding identifier may be signaled, and the above embodiments may be applied to the specified time layers identified by the corresponding identifiers. Here, the identifier may be defined as the lowest layer or the highest layer or both the lowest layer and the highest layer to which the above embodiments may be applied, or may be defined as a specific layer indicating the application of the embodiments. In addition, a fixed time layer to which the embodiments may be applied may be defined.

[0449] For example, when the temporal layer of the current image is the lowest layer, the above embodiment can be applied. For example, when the temporal layer identifier of the current image is 1, the above embodiment can be applied. For example, when the temporal layer of the current image is the highest layer, the above embodiment can be applied.

[0450] A slice type or a tile group type to which the above embodiments of the present invention are applied may be defined, and the above embodiments may be applied depending on the corresponding slice type or tile group type.

[0451] In the above embodiments, the method is described based on a flowchart having a series of steps or units, but the present invention is not limited to the order of the steps, but some steps can be performed simultaneously with other steps or in a different order. In addition, it should be understood by those skilled in the art that the steps in the flowchart are not mutually exclusive, and other steps can be added to the flowchart, or some steps can be deleted from the flowchart without affecting the scope of the present invention.

[0452] The embodiments include various aspects of the examples. All possible combinations for various aspects may not be described, but those skilled in the art will be able to recognize different combinations. Therefore, the present invention may include all substitutions, modifications and changes within the scope of the claims.

[0453] The embodiments of the present invention may be implemented in the form of program instructions that can be executed by various computer components and recorded in a computer-readable recording medium. The computer-readable recording medium may include independent program instructions, data files, data structures, etc. or a combination of program instructions, data files, data structures, etc. The program instructions recorded in the computer-readable recording medium may be specially designed and constructed for the present invention, or known to ordinary technicians in the field of computer software technology. Examples of computer-readable recording media include: magnetic recording media (such as hard disks, floppy disks, and tapes); optical data storage media (such as CD-ROMs or DVD-ROMs); magnetically optimized media (such as optical floppy disks); and hardware devices (such as read-only memory (ROM), random access memory (RAM), flash memory, etc.) that are specially constructed to store and implement program instructions. Examples of program instructions include not only machine language codes formatted by a compiler, but also high-level language codes that can be implemented by a computer using an interpreter. The hardware device may be configured to be operated by one or more software modules to perform processing according to the present invention, or vice versa.

[0454] Although the present invention has been described according to specific items such as detailed elements and limited embodiments and drawings, they are only provided to help a more comprehensive understanding of the present invention, and the present invention is not limited to the above embodiments. It should be understood by those skilled in the art that various modifications and changes can be made based on the above description.

[0455] Therefore, the spirit of the present invention should not be limited to the above-described embodiments, and the full scope of the appended claims and their equivalents will fall within the scope and spirit of the present invention.

[0456] Industrial Applicability The present invention can be used to encode or decode images.

Claims

1. An image decoding method, the method comprising: Obtaining maximum transform block size information and a second transform coefficient of a current block; deriving a maximum transform block size based on the maximum transform block size information; determining whether to apply a secondary inverse transform to the current block based on the maximum transform block size and the size of the current block; as well as In response to determining to apply the secondary inverse transform to the current block, obtaining first transform coefficients of the current block by performing the secondary inverse transform on second transform coefficients of the current block, The step of determining whether to apply the secondary inverse transform comprises: when a larger value of a horizontal size and a vertical size of the current block is larger than the maximum transform block size, determining not to apply the secondary inverse transform to the current block.

2. The image decoding method according to claim 1, in, The step of determining whether to apply the secondary inverse transform includes determining whether to apply the secondary inverse transform to the current block based on primary inverse transform information of the current block.

3. The image decoding method according to claim 2, in, The step of determining whether to apply the secondary inverse transform includes: when the primary inverse transform information of the current block indicates a primary inverse transform skip mode, determining not to apply the secondary inverse transform to the current block.

4. A method for encoding an image, the method comprising: determining a maximum transform block size; encoding maximum transform block size information indicating the maximum transform block size; determining whether to apply a secondary transform to the current block based on the maximum transform block size and a size of the current block; generating a first transform coefficient of the current block; as well as In response to determining to apply the secondary transform to the current block, generating second transform coefficients of the current block by performing the secondary transform on first transform coefficients of the current block, The step of determining whether to apply the secondary transform comprises: when a larger value of a horizontal size and a vertical size of the current block is larger than the maximum transform block size, determining not to apply the secondary transform to the current block.

5. The image encoding method according to claim 4, in, The step of determining whether to apply the secondary transform includes determining whether to apply the secondary transform to the current block based on primary transform information of the current block.

6. The image encoding method according to claim 5, in, The step of determining whether to apply the secondary transform includes: when the primary transform information of the current block indicates a primary transform skip mode, determining not to apply the secondary transform to the current block.

7. A data transmission method, wherein: The data includes a bit stream of an image, The transmission method comprises: obtaining the bitstream of the image; and transmitting said data comprising said bit stream, The bitstream is generated by performing a process comprising: determining a maximum transform block size; encoding maximum transform block size information indicating the maximum transform block size; determining whether to apply a secondary transform to the current block based on the maximum transform block size and a size of the current block; generating a first transform coefficient of the current block; and In response to determining to apply the secondary transform to the current block, generating second transform coefficients of the current block by performing the secondary transform on first transform coefficients of the current block, The step of determining whether to apply the secondary transform comprises: when a larger value of a horizontal size and a vertical size of the current block is larger than the maximum transform block size, determining not to apply the secondary transform to the current block.