Image encoding / decoding method and apparatus, and recording medium storing bit stream

By adaptively selecting the transformation type of image blocks and optimizing the image encoding/decoding method, the problem of high transmission and storage costs of high-definition or ultra-high-definition image data is solved, and efficient encoding and decoding effects are achieved.

CN118612466APending Publication Date: 2024-09-06ELECTRONICS & TELECOMM RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410751824.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2019-05-28
Filing Date
2020-03-06
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing technologies are difficult to effectively improve the encoding/decoding efficiency of high-definition or ultra-high-definition images, resulting in increased transmission and storage costs for high-resolution and high-quality image data.

Method used

Adopt an image encoding/decoding method based on adaptive transform type selection, by determining the horizontal and vertical transform types of the current block, deriving the residual block and reconstructing the image block, optimizing the transform type selection in the intra-frame sub-block partition mode, and improving encoding/decoding efficiency.

Benefits of technology

It improves the efficiency of image encoding/decoding, reduces storage and transmission costs, and is suitable for efficient encoding and decoding of high-definition or ultra-high-definition images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118612466A_ABST
    Figure CN118612466A_ABST
Patent Text Reader

Abstract

The invention relates to an image encoding / decoding method and apparatus, and a recording medium storing a bitstream. An image decoding method according to the present invention comprises the steps of: determining a horizontal transform type and a vertical transform type of a current block; deriving a residual block of the current block by performing inverse transform on the current block based on the determined horizontal transform type and vertical transform type; and reconstructing the current block on the basis of the residual block, in which, when the current block is in an intra sub-block partition (ISP) mode, the step of determining the horizontal transform type and the vertical transform type is performed on the basis of at least one of a horizontal size and a vertical size of the current block regardless of an intra prediction mode 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 March 6, 2020, application number "202080019220.2", and title "Image encoding / decoding method and device and recording medium for storing bit stream". Technical Field

[0002] The present invention relates to a method and apparatus for encoding / decoding an image, and a recording medium for storing a bit stream. More particularly, the present invention relates to a method and apparatus for encoding / decoding a video image based on adaptive transform type selection. Background Art

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

[0004] There are various video compression technologies, such as inter-frame (Inter) prediction technology that predicts the value of a pixel in a current picture from the value of a pixel in a previous picture or a subsequent picture, intra-frame (Intra) prediction technology that predicts the value of a pixel in an area of ​​the current picture from the value of a pixel in another area of ​​the current picture, transformation and quantization technology that compresses the energy of a residual signal, and entropy coding technology that assigns shorter codes to frequently occurring pixel values ​​and longer codes to less frequently occurring pixel values. Summary of the Invention

[0005] Technical issues

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

[0007] Another object of the present invention is to provide an image encoding / decoding method and apparatus based on transformation, shuffling, rearrangement and / or flipping for improving encoding / decoding efficiency.

[0008] Another object of the present invention is to provide an image encoding / decoding method and apparatus based on adaptive transform type selection for improving encoding / decoding efficiency.

[0009] Another object of the present invention is to provide an image encoding / decoding method and apparatus for improving image conversion efficiency.

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

[0011] Solutions to the Problem

[0012] According to an embodiment of the present invention, a method for decoding an image includes: determining a horizontal transform type and a vertical transform type of a current block, deriving a residual block of the current block by performing inverse transform on the current block based on the determined horizontal transform type and vertical transform type, and reconstructing the current block based on the residual block. When the current block is in intra sub-block partitioning (ISP) mode, determining the horizontal transform type and the vertical transform type is performed based on at least one of a width or a height of the current block, regardless of an intra prediction mode of the current block.

[0013] In the image decoding method, the step of determining the horizontal transform type and the vertical transform type may further include setting implicit multi-transform selection information.

[0014] In the image decoding method, the step of setting implicit multi-transform selection information may include: when the current block is in an intra sub-block partitioning (ISP) mode, setting the implicit multi-transform selection information to a value indicating implicit multi-transform selection.

[0015] In the image decoding method, the step of setting the implicit multi-transform selection information may include: when the intra-frame prediction explicit multi-transform selection enabling information indicates that explicit multi-transform selection is not enabled, the prediction mode of the current block is the intra-frame prediction mode, the secondary inverse transform is not performed on the current block and the current block is not in the matrix-based intra-frame prediction mode, setting the implicit multi-transform selection information to a value indicating implicit multi-transform selection.

[0016] In the image decoding method, when the implicit multi-transform selection information indicates implicit multi-transform selection, the horizontal transform type and the vertical transform type may be determined based on whether the current block is in a sub-block transform (SBT) mode.

[0017] In an image decoding method, when the implicit multi-transform selection information indicates implicit multi-transform selection and the current block is not in a sub-block transform (SBT) mode, the horizontal transform type and the vertical transform type may be determined regardless of an intra prediction mode of the current block.

[0018] In the image decoding method, when the current block is in intra sub-block partitioning (ISP) mode and a secondary inverse transform is performed, the horizontal transform type and the vertical transform type may be determined as a first transform indicating a DCT-2 based integer transform, regardless of the implicit multi-transform selection information.

[0019] In the image decoding method, the step of determining the horizontal transform type and the vertical transform type may include: when the current block is a chroma component, determining the horizontal transform type and the vertical transform type as a first transform indicating a DCT-2 based integer transform, regardless of the implicit multi-transform selection information.

[0020] According to another embodiment of the present invention, a method for encoding an image includes: determining a horizontal transform type and a vertical transform type of a current block, performing a transform on a residual block of the current block based on the determined horizontal transform type and vertical transform type, and encoding the current block based on the transformed residual block. When the current block is in intra sub-block partitioning (ISP) mode, the determination of the horizontal transform type and the vertical transform type may be performed based on at least one of a width or a height of the current block, regardless of an intra prediction mode of the current block.

[0021] In the image encoding method, the step of determining the horizontal transform type and the vertical transform type may further include setting implicit multi-transform selection information.

[0022] In the image encoding method, the step of setting the implicit multi-transform selection information may include: when the current block is in an intra sub-block partitioning (ISP) mode, setting the implicit multi-transform selection information to a value indicating implicit multi-transform selection.

[0023] In the image encoding method, the step of setting the implicit multi-transform selection information may include: when the intra-frame prediction explicit multi-transform selection enabling information indicates that explicit multi-transform selection is not enabled, the prediction mode of the current block is the intra-frame prediction mode, the secondary inverse transform is not performed on the current block and the current block is not in the matrix-based intra-frame prediction mode, setting the implicit multi-transform selection information to a value indicating implicit multi-transform selection.

[0024] In the image encoding method, when the implicit multi-transform selection information indicates implicit multi-transform selection, the horizontal transform type and the vertical transform type may be determined based on whether the current block is in a sub-block transform (SBT) mode.

[0025] In an image encoding method, when the implicit multi-transform selection information indicates implicit multi-transform selection and the current block is not in a sub-block transform (SBT) mode, the horizontal transform type and the vertical transform type may be determined regardless of an intra prediction mode of the current block.

[0026] In the image encoding method, when the current block is in intra sub-block partitioning (ISP) mode and a secondary inverse transform is performed, the horizontal transform type and the vertical transform type may be determined as a first transform indicating a DCT-2 based integer transform, regardless of the implicit multi-transform selection information.

[0027] In the image encoding method, the step of determining the horizontal transform type and the vertical transform type may include: when the current block is a chroma component, determining the horizontal transform type and the vertical transform type as a first transform indicating a DCT-2 based integer transform, regardless of the implicit multi-transform selection information.

[0028] According to another embodiment of the present invention, a non-transitory computer-readable recording medium may store a bitstream generated by an image encoding method, and the image encoding method may include: determining a horizontal transform type and a vertical transform type of a current block, performing a transform on a residual block of the current block based on the determined horizontal transform type and vertical transform type, and encoding the current block based on the transformed residual block. When the current block is in intra subblock partitioning (ISP) mode, determining the horizontal transform type and the vertical transform type is performed based on at least one of a width or a height of the current block, regardless of an intra prediction mode of the current block.

[0029] Effects of the present invention

[0030] According to the present invention, an image encoding / decoding method and apparatus with improved encoding / decoding efficiency can be provided.

[0031] According to the present invention, a method and apparatus for image encoding / decoding based on transformation, shuffling, rearrangement and / or flipping for improving encoding / decoding efficiency can be provided.

[0032] According to the present invention, an image encoding / decoding method and apparatus based on adaptive transform type selection for improving encoding / decoding efficiency can be provided.

[0033] According to the present invention, an image encoding / decoding method and apparatus for improving image conversion efficiency can be provided.

[0034] According to the present invention, there can be provided a recording medium for storing a bit stream generated by an image encoding / decoding method or apparatus. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

[0037] Figure 3 is a diagram schematically illustrating a partition structure of an image when encoding and decoding the image.

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

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

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

[0041] Figure 7 is a diagram illustrating basis vectors in the frequency domain of DCT-2 according to the present invention.

[0042] Figure 8 is a diagram illustrating basis vectors in each frequency domain of DST-7 according to the present invention.

[0043] Figure 9 is a diagram showing the distribution of average residual values ​​according to positions within a 2N×2N prediction unit (PU) of an 8×8 coding unit (CU) predicted in inter mode, where a “Cactus” sequence is obtained by testing in a low-delay-P configuration environment.

[0044] Figure 10 3D diagram showing distribution characteristics of residual signals within 2N×2N prediction units (PUs) of an 8×8 coding unit (CU) predicted in inter prediction mode (inter mode).

[0045] Figure 11 is a diagram illustrating distribution characteristics of a residual signal in a 2N×2N prediction unit (PU) mode of a coding unit (CU) according to the present invention.

[0046] Figure 12 is a diagram illustrating distribution characteristics of residual signals before and after scrambling of 2N×2N prediction units (PUs) according to the present invention.

[0047] Figure 13 is a diagram illustrating an example of rearrangement of 4×4 residual data of subblocks according to the present invention.

[0048] Figure 14a and Figure 14b is a diagram illustrating an embodiment of a transform unit (TU) partition structure of a coding unit (CU) according to a prediction unit (PU) mode and a transform unit (TU) shuffling method.

[0049] Figure 15is a diagram illustrating results of performing DCT-2 transform and SDST transform according to distribution of a residual signal of a 2N×2N prediction unit (PU).

[0050] Figure 16 is a diagram illustrating an SDST process according to the present invention.

[0051] Figure 17 is a diagram illustrating partitions of a transform unit (TU) and distribution characteristics of the magnitude of a residual absolute value for each prediction unit (PU) partition mode of an inter-predicted coding unit (CU) according to the present invention.

[0052] Figure 18 is a diagram illustrating a residual signal scanning order and a reordering order of a transform unit (TU) having a depth of zero within a prediction unit (PU) according to an exemplary embodiment.

[0053] Figure 19 is a flow chart illustrating a DCT-2 or SDST selection encoding process with rate-distortion optimization (RDO) according to the present invention.

[0054] Figure 20 is a flowchart illustrating a process of selecting DCT-2 or SDST for decoding according to the present invention.

[0055] Figure 21 is a flowchart illustrating a decoding process using SDST according to the present invention.

[0056] Figure 22 and Figure 23 The positions where residual signal rearrangement (residual rearrangement) is performed in the encoder and the decoder according to the present invention are respectively shown.

[0057] Figure 24 is a diagram illustrating an embodiment of a decoding method using an SDST method according to the present invention.

[0058] Figure 25 is a diagram illustrating an embodiment of an encoding method using an SDST method according to the present invention.

[0059] Figure 26 is a diagram illustrating an embodiment of an encoding process in a method of performing transformation after flipping.

[0060] Figure 27 is a diagram illustrating an embodiment of a decoding process in a method of performing flipping after inverse transform.

[0061] Figure 28 is a diagram illustrating an embodiment of an encoding process in a method of performing flipping after transformation.

[0062] Figure 29is a diagram illustrating an embodiment of a decoding process in a method of performing inverse transform after flipping.

[0063] Figure 30 is a diagram illustrating an embodiment of an encoding process in a method of performing flipping after quantization.

[0064] Figure 31 is a diagram illustrating an embodiment of a decoding process in a method of performing inverse quantization after flipping.

[0065] Figure 32 is a diagram illustrating flipping performed on a residual block.

[0066] Figure 33 FIG. 1 is a diagram illustrating an embodiment for implementing flipping of a residual block having a size of 8×8 as hardware.

[0067] Figure 34 is a diagram illustrating flipping and transforming performed on a residual block.

[0068] Figures 35 to 37 is a diagram illustrating an embodiment of a first subblock partitioning mode according to the present invention.

[0069] Figure 38 is a diagram illustrating an embodiment of a second subblock partitioning mode according to the present invention.

[0070] Figure 39 is a diagram illustrating an embodiment of diagonal scanning.

[0071] Figure 40 is a diagram illustrating an example of horizontal scanning.

[0072] Figure 41 is a diagram illustrating an embodiment of vertical scanning.

[0073] Figure 42 is a diagram illustrating an embodiment of block-based diagonal scanning.

[0074] Figure 43 is a diagram illustrating an embodiment of block-based horizontal scanning.

[0075] Figure 44 is a diagram illustrating an embodiment of block-based vertical scanning.

[0076] Figure 45 is a diagram illustrating an embodiment of block-based horizontal scanning.

[0077] Figure 46 is a diagram illustrating an embodiment of block-based vertical scanning.

[0078] Figure 47 are diagrams illustrating various embodiments of block-based shape scanning.

[0079] Figure 48 is a diagram illustrating an intra prediction mode.

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

[0081] Figures 50 to 54 is a diagram illustrating an example of an encoding process or a decoding process using transform according to an embodiment of the present invention.

[0082] Figure 55 is a diagram illustrating an image decoding method according to an embodiment of the present invention.

[0083] Figure 56 is a diagram illustrating an image encoding method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0084] Various modifications may be made to the present invention, and there are various embodiments of the present invention. Examples of various embodiments of the present invention will now be provided and described in detail with reference to the accompanying drawings. However, although the exemplary embodiments may be interpreted as including all modifications, equivalents, or alternatives within the technical concept and technical scope of the present invention, the present invention is not limited thereto. Similar reference numerals refer to the same or similar functions in various aspects. In the accompanying drawings, the shapes and sizes of elements may be exaggerated for clarity. In the following detailed description of the present invention, reference is made to the accompanying drawings that illustrate specific embodiments in which the present invention may be implemented. These embodiments are described in sufficient detail to enable those skilled in the art to implement the present disclosure. It should be understood that the various embodiments of the present disclosure, although different, are not necessarily mutually exclusive. For example, specific features, structures, and characteristics described herein in conjunction with one embodiment may be implemented in other embodiments without departing from the spirit and scope of the present disclosure. In addition, it should be understood that the position or arrangement of the various elements within each disclosed embodiment may be modified without departing from the spirit and scope of the present disclosure. Therefore, the following detailed description should not be understood in a limiting sense, and the scope of the present disclosure is limited solely by the appended claims (and, where appropriately interpreted, together with the full range of equivalents claimed by the claims).

[0085] The terms "first," "second," and the like used in the specification may be used to describe various components, but these components are not to be construed as being limited to these terms. These terms are merely used to distinguish one component from another. For example, without departing from the scope of the present invention, a "first" component may be referred to as a "second" component, and a "second" component may similarly be referred to as a "first" component. The term "and / or" includes a combination of a plurality of items or any one of the plurality of items.

[0086] It will be understood that, in this specification, when an element is merely referred to as being “connected to” or “coupled to” another element rather than being “directly connected to” or “directly coupled to” the other element, the element may be “directly connected to” or “directly coupled to” the other element, or connected to or coupled to the other element with other elements between the element and the other element. Conversely, it will be understood that when an element is referred to as being “directly coupled to” or “directly coupled” to another element, there are no intervening elements.

[0087] In addition, the components shown in the embodiments of the present invention are shown independently to present characteristic functions that are different from each other. Therefore, this does not mean that each component is composed of a component unit of independent hardware or software. In other words, for convenience, each component includes each of the enumerated components. Therefore, at least two components in each component can be combined to form a component, or a component can be divided into multiple components for performing each function. Without departing from the essence of the present invention, the embodiment in which each component is combined and the embodiment in which a component is divided are also included in the scope of the present invention.

[0088] The terms used in this specification are only used to describe specific embodiments and are not intended to limit the present invention. Unless the expression used in the singular has a significantly different meaning in the context, it includes plural expressions. In this specification, it will be understood that terms such as "including ... ", "having ... " etc. are intended to indicate that there are features, quantities, steps, actions, elements, parts or combinations thereof disclosed in the specification, and are not intended to exclude the possibility that one or more other features, quantities, steps, actions, elements, parts or combinations thereof may be present or may be added. In other words, when a particular element is referred to as "comprising ", elements other than the corresponding element are not excluded, but additional elements may be included in embodiments of the present invention or are within the scope of the present invention.

[0089] In addition, some components may not be indispensable components for performing the necessary functions of the present invention, but may be optional components that only enhance its performance. The present invention may be implemented by including only the components that are indispensable for implementing the essence of the present invention and excluding components that are used to enhance performance. Structures that include only the indispensable components and exclude optional components that are used only to enhance performance are also included in the scope of the present invention.

[0090] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. When describing exemplary embodiments of the present invention, well-known functions or structures will not be described in detail because they may unnecessarily obscure the understanding of the present invention. The same components in the drawings are represented by the same reference numerals, and repeated description of the same components will be omitted.

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

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

[0093] Hereinafter, a target image may be an encoding target image serving as an encoding target and / or a decoding target image serving as a decoding target. Furthermore, a target image may be an input image input to an encoding device or an input image input to a decoding device. Here, the target image may have the same meaning as the current image.

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

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

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

[0097] Hereinafter, the terms "region" and "segment" may be used interchangeably.

[0098] 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.

[0099] In embodiments, each of the specific information, data, flags, indexes, elements, and attributes may have a value. A value of "0" for the information, data, flags, indexes, elements, and attributes may represent a logical false value or a first predefined value. In other words, the values ​​"0," false, logical false, and the first predefined value may be interchangeable. A value of "1" for the information, data, flags, indexes, elements, and attributes may represent a logical true value or a second predefined value. In other words, the values ​​"1," true, logical true, and the second predefined value may be interchangeable.

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

[0101] Description of terms

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

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

[0104] Block: An M×N array of samples. Here, M and N may represent positive integers, and a block may represent a two-dimensional array of samples. A block may refer to a unit. The current block may refer to an encoding target block that is targeted during encoding, or a decoding target block that is targeted during decoding. Furthermore, the current block may be at least one of a coding block, a prediction block, a residual block, and a transform block.

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

[0106] Unit: This refers to a unit for encoding and decoding. When encoding and decoding an image, a unit may be a region created by partitioning a single image. Furthermore, when a single image is partitioned into sub-divisions during encoding or decoding, a unit may represent a sub-division. In other words, an image may be partitioned into multiple units. When encoding and decoding an image, predetermined processing may be performed on each unit. A single unit may be partitioned into sub-units smaller than the unit. Depending on its function, a unit may refer to a block, macroblock, coding tree unit, coding tree block, coding unit, coding block, prediction unit, prediction block, residual unit, residual block, transform unit, transform block, and so on. Furthermore, to distinguish a unit from a block, a unit may include a luma component block, chroma component blocks associated with the luma component block, and syntax elements for each color component block. A unit may have various sizes and shapes. Specifically, the unit may be a two-dimensional geometric figure, such as a square, rectangle, trapezoid, triangle, or pentagon. Also, 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.

[0107] Coding tree unit: A single coding tree block configured with the luma component Y and two coding tree blocks associated with the chroma components Cb and Cr. In addition, the coding tree unit may represent a block and a syntax element of 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.

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

[0109] Coding tree block: may be used as a term for designating any one of a Y coding tree block, a Cb coding tree block, and a Cr coding tree block.

[0110] Neighboring blocks: These may represent blocks adjacent to the current block. These blocks may be blocks that touch the boundary of the current block or are located within a predetermined distance from the current block. These blocks may be blocks adjacent to vertices of the current block. Here, blocks adjacent to vertices of the current block may be blocks that are vertically adjacent to a neighboring block horizontally adjacent to the current block, or blocks that are horizontally adjacent to a neighboring block vertically adjacent to the current block.

[0111] Reconstructed neighboring blocks: These may refer to neighboring blocks that are adjacent to the current block and have already been spatially or temporally encoded or decoded. Here, reconstructed neighboring blocks may refer to reconstructed neighboring units. Reconstructed spatial neighboring blocks may be blocks within the current picture that have been reconstructed through encoding or decoding, or both. Reconstructed temporal neighboring blocks are blocks within the reference picture that are located at a position corresponding to the current block in the current picture, or blocks adjacent to the current block.

[0112] 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 has not been partitioned. In addition, the highest node can have the smallest 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 partitioning the first unit once. 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 partitioned further. 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.

[0113] Bitstream: can represent a bit stream containing coded image information.

[0114] Parameter set: Corresponds to header information in the configuration within the bitstream. A parameter set may include at least one of a video parameter set, a sequence parameter set, a picture parameter set, and an adaptation parameter set. Furthermore, a parameter set may include slice header, tile group header, and tile header information. The term "tile group" may refer to a group of tiles and has the same meaning as a slice.

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

[0116] In addition, regarding the adaptation parameter set, 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.

[0117] In addition, regarding the adaptation parameter set, 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.

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

[0119] In addition, regarding the adaptation parameter set, different adaptation parameter sets may be referenced by using identifiers of different adaptation parameter sets for partitions within a tile.

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

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

[0122] 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.

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

[0124] A sub-picture may be partitioned into one or more tile rows and one or more tile columns within a picture. A sub-picture may be a rectangular (non-square) / square area within a picture and may include one or more CTUs. In addition, at least one or more tiles / blocks / slices may be included in a sub-picture.

[0125] A tile may be a region having a rectangular (non-square) / square shape within a picture and may include one or more CTUs. In addition, a tile may be partitioned into one or more partitions.

[0126] A partition may refer to one or more CTU rows within a tile. A tile may be partitioned into one or more partitions, and each partition may have at least one or more CTU rows. A tile that is not partitioned into two or more may be referred to as a partition.

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

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

[0129] Symbol: can represent at least one of the syntax elements, coding parameters, and transform coefficient values ​​of the encoding / decoding target unit. In addition, the symbol can represent the entropy encoding target or the entropy decoding result.

[0130] Prediction mode: may be information indicating a mode of encoding / decoding using intra-frame prediction or a mode of encoding / decoding using inter-frame prediction.

[0131] Prediction unit: This refers to the basic unit used when performing predictions such as inter-frame prediction, intra-frame prediction, inter-frame compensation, intra-frame compensation, and motion compensation. A single prediction unit can be partitioned into multiple partitions of smaller sizes, or into multiple prediction units of lower levels. Multiple partitions can be the basic unit used when performing prediction or compensation. Partitions generated by splitting a prediction unit can also be prediction units.

[0132] Prediction unit partition: can be expressed by partitioning the prediction unit into

[0133] 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 available reference picture lists, including LC (List Combination), L0 (List 0), L1 (List 1), L2 (List 2), and L3 (List 3).

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

[0135] 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 can be used to derive the inter prediction indicator, and conversely, the inter prediction indicator can 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 pictures in the reference picture list are 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.

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

[0137] A reference picture may refer to a reference picture that is referenced by a specific block for the purpose of performing inter-frame prediction or motion compensation on the specific block. Alternatively, a reference picture may be a picture that includes a reference block that is referenced by the current block for inter-frame prediction or motion compensation. Hereinafter, the terms "reference picture" and "reference image" have the same meaning and are interchangeable.

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

[0139] The search range may be a two-dimensional area that is searched during inter-frame 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.

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

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

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

[0143] 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, reference picture list information, a reference picture, a motion vector candidate, a motion vector candidate index, a merge candidate, and a merge index.

[0144] The merge candidate list may mean a list consisting of one or more merge candidates.

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

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

[0147] Transform unit: This refers to a basic unit used when encoding / decoding a residual signal (such as transform, inverse transform, quantization, inverse quantization, and transform coefficient encoding / decoding). A single transform unit can be partitioned into multiple transform units of smaller sizes at lower levels. The transform / inverse transform may include at least one of a first transform / first inverse transform and a second transform / second inverse transform.

[0148] Scaling: This refers to the process of multiplying the quantization level by a factor. Transform coefficients can be generated by scaling the quantization level. Scaling can also be called inverse quantization.

[0149] Quantization parameter: This may indicate the value used when generating the quantization level using the transform coefficient during quantization. It may also indicate the value used when generating the transform coefficient by scaling the quantization level during inverse quantization. The quantization parameter may be a value mapped to the quantization step size.

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

[0151] Scan: This refers to a method of sorting coefficients within a cell, block, or matrix. For example, the operation of converting a two-dimensional matrix of coefficients into a one-dimensional matrix can be called a scan, and the operation of converting a one-dimensional matrix of coefficients into a two-dimensional matrix can be called a scan or an inverse scan.

[0152] Transform coefficient: This term may refer to a coefficient value generated after a transform is performed in an encoder. A transform coefficient may refer to a coefficient value generated after at least one of entropy decoding and inverse quantization is performed in a decoder. A transform coefficient also includes a quantization level obtained by quantizing a transform coefficient or a residual signal, or a quantized transform coefficient level.

[0153] Quantization level: This refers to the value generated by quantizing a transform coefficient or residual signal in an encoder. Alternatively, the quantization level may refer to a value that serves as a target for inverse quantization to be performed in a decoder. Similarly, the level of quantized transform coefficients, which are the result of transformation and quantization, also falls within the meaning of the quantization level.

[0154] 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.

[0155] 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.

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

[0157] Default matrix: may represent a predetermined quantization matrix preliminarily defined in an encoder or decoder.

[0158] Non-default matrix: may represent a quantization matrix that is not initially defined in the encoder or decoder but is signaled by the user.

[0159] Statistical value: The statistical value for at least one of a variable, coding parameter, constant value, etc. having a calculable specific value can be one or more of the average value, total 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.

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

[0161] 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.

[0162] 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.

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

[0164] When the prediction mode is 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 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.

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

[0166] 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.

[0167] 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. To perform inter-frame prediction or motion compensation on a coding unit, it may be determined which mode among skip mode, merge mode, advanced motion vector prediction (AMVP) mode, and current picture reference mode is used for motion prediction and motion compensation of the prediction unit included in the corresponding coding unit. Then, depending on the determined mode, inter-frame prediction or motion compensation may be performed differently.

[0168] 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, or 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.

[0169] 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 transforming the residual block.

[0170] The quantization level may be generated by applying quantization to the transform coefficients or to the residual signal. Hereinafter, the quantization level may also be referred to as the transform coefficient in the embodiments.

[0171] 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.

[0172] The entropy coding unit 150 may generate a bitstream by performing entropy coding on the value calculated by the quantization unit 140 or the encoding parameter value calculated when performing encoding according to the probability distribution, and output the generated bitstream. The entropy coding unit 150 may perform entropy coding on sample information of an image and information for decoding the image. For example, the information for decoding the image may include syntax elements.

[0173] 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, thereby reducing the size of the bit stream for the symbols to be encoded. 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 the target symbol and a probability model of the target symbol / binary bit, and perform arithmetic coding by using the derived binarization method and context model.

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

[0175] The coding parameters may include information such as syntax elements (flags, indexes, etc.) that are encoded in the encoder and transmitted to the decoder using signals, 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 shape 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 partitioning direction (horizontal or vertical), binary tree partitioning 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) and tree (binary tree or ternary tree) structure of multi-type tree partition, prediction mode (intra prediction or inter prediction), luma intra prediction mode / direction, chroma intra prediction mode / direction, intra partition information, inter partition information, coding block partition flag, prediction block partition flag, transform block partition flag, reference sample filtering method, reference sample filter 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 prediction mode, frame 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 primary (first) transform is used, information on whether secondary transform is used, primary transform index, secondary transform index, residual Information on whether a difference signal exists, coding block pattern, coding block flag (CBF), quantization parameter, quantization parameter residual, quantization matrix, whether an in-loop filter is applied, in-loop filter coefficients, in-loop filter taps, in-loop filter shape / form, whether a deblocking filter is applied, deblocking filter coefficients, deblocking filter taps, deblocking filter strength, deblocking filter shape / form, whether an adaptive sample offset is applied, adaptive sample offset value, adaptive sample offset category, adaptive sample offset type, whether an adaptive loop filter is applied, adaptive loop filter coefficients, adaptive loop filter taps, adaptive 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, significant coefficient flag, last significant coefficient flag, coding flag for unit of coefficient group, position of last significant 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, size of motion vector search area on decoder side , the shape of the motion vector search area on the decoder side, the number of motion vector searches on the decoder side, information about the CTU size, information about the minimum block size, information about the maximum block size, information about the maximum block depth, information about the 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.

[0176] 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.

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

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

[0179] 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 loop filter (ALF) to the reconstructed samples, the reconstructed block, or the reconstructed image. The filter unit 180 may be referred to as an in-loop filter.

[0180] A deblocking filter can remove block distortion generated at the boundaries between blocks. To determine whether to apply the deblocking filter, the determination can be made based on the samples included in a number of rows or columns included in the block. When the deblocking filter is applied to the block, another filter can be applied according to the desired deblocking filter strength.

[0181] To compensate for coding errors, sample adaptive offset can be used to add an appropriate offset value to the sample value. Sample adaptive offset can correct the offset between the deblocked image and the original image on a sample-by-sample basis. A method can be used to apply the offset by considering edge information about each sample, or a method can be used in which the samples of the image are partitioned into a predetermined number of regions, the regions to which the offset is applied are determined, and the offset is applied to the determined regions.

[0182] The adaptive loop filter can perform filtering based on the comparison result of the filtered reconstructed image and the original image. The samples included in the image can be partitioned into predetermined groups, the filter to be applied to each group can be determined, and differential filtering can be performed on each group. Information on whether to apply ALF can be signaled by the coding unit (CU), and the form and coefficients of the ALF to be applied to each block can be varied.

[0183] The reconstructed block or 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 part of a reference image. That is, the reference image is a reconstructed image composed of the reconstructed blocks processed by the filter unit 180. The stored reference image may be used later in inter-frame prediction or motion compensation.

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

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

[0186] Reference Figure 2 , the decoding apparatus 200 may include an entropy decoding unit 210 , an inverse quantization unit 220 , an inverse transform unit 230 , an intra prediction unit 240 , a motion compensation unit 250 , an adder 225 , a filter unit 260 , and a reference picture buffer 270 .

[0187] The decoding device 200 may receive the bitstream output from the encoding device 100. The decoding device 200 may receive the bitstream stored in a computer-readable recording medium, or may receive the bitstream streamed via a wired / wireless transmission medium. The decoding device 200 may decode the bitstream 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.

[0188] When the prediction mode used at the time of decoding is the intra mode, the switch may be switched to the intra mode. Alternatively, when the prediction mode used at the time of decoding is the inter mode, the switch may be switched to the inter mode.

[0189] 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.

[0190] The entropy decoding unit 210 may generate symbols by performing entropy decoding on 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-mentioned entropy encoding method.

[0191] In order to decode transform coefficient levels (quantized levels), the entropy decoding unit 210 may change coefficients in a unidirectional vector form into a two-dimensional block form by using a transform coefficient scanning method.

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

[0193] 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 already been decoded.

[0194] 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 image stored in the reference picture buffer 270 .

[0195] 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 loop filter to the reconstructed block or reconstructed image. The filter unit 260 can output the reconstructed image. The reconstructed block or 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 part of a reference image. In other words, the reference image is a reconstructed image composed of the reconstructed blocks processed by the filter unit 260. The stored reference image can be used later in inter-frame prediction or motion compensation.

[0196] Figure 3 is a diagram schematically showing a partition structure of an image when encoding and decoding the image. Figure 3 An example of partitioning a single cell into multiple lower-level cells is schematically shown.

[0197] 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 between an intra-frame prediction mode and an inter-frame 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 transform coefficient.

[0198] Reference Figure 3 , the image 300 is sequentially partitioned according to the largest coding unit (LCU), and the LCU unit is determined as a partition structure. Here, LCU can be used with the same meaning as coding tree unit (CTU). Unit partitioning may mean partitioning the block associated with the unit. In the block partition information, unit depth information may be included. The depth information may indicate the number or degree of partitioning of the unit or both the number and degree of partitioning of the unit. A single unit may be partitioned into multiple lower-level units hierarchically associated with 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.

[0199] The partition structure may indicate the distribution of coding units (CUs) within an LCU 310. This distribution may be determined by whether a single CU is partitioned into multiple CUs (a positive integer equal to or greater than 2, including 2, 4, 8, 16, etc.). The horizontal and vertical sizes of the CUs generated by partitioning may be half the horizontal and vertical sizes of the CU before partitioning, or may be smaller than the horizontal and vertical sizes before partitioning, depending on the number of partitioning operations. A CU may be recursively partitioned into multiple CUs. Recursive partitioning may reduce at least one of the height and width of the CU after partitioning compared to at least one of the height and width of the CU before partitioning. CU partitioning may be recursively performed until a predefined depth or predefined size is reached. For example, the depth of an LCU may be 0, and the depth of a smallest coding unit (SCU) may be a predefined maximum depth. As described above, an LCU may be the coding unit with the largest coding unit size, and an SCU may be the coding unit with the smallest coding unit size. Partitioning begins with the LCU 310, and as the horizontal or vertical size, or both, of the CU decreases due to partitioning, the CU depth increases by 1. For example, for each depth, the size of a non-partitioned CU may be 2N×2N. In addition, 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.

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

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

[0202] For example, when a single coding unit is partitioned into four coding units, the horizontal and vertical sizes of the four partitioned coding units may be half the horizontal and vertical sizes of the CU before partitioning. In one embodiment, when a coding unit of size 32×32 is partitioned into four coding units, the size of each of the four partitioned coding units may be 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.

[0203] 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 the horizontal size or vertical size of the original coding unit. For example, when a coding unit of size 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 of size 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 according to a binary tree partition structure.

[0204] For example, when a coding unit is partitioned into three sub-coding units, the horizontal size or vertical size of the coding unit may be partitioned in a ratio of 1:2:1, thereby generating three sub-coding units with a ratio of the horizontal size or the vertical size of 1:2:1. For example, when a coding unit with 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 with a size of 32×32 is divided 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 a coding unit is partitioned into three sub-coding units, it can be said that the coding unit is partitioned into three or partitioned according to a ternary tree partition structure.

[0205] 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.

[0206] As described above, 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. The various tree partition structures may be sequentially applied to the CTU according to a predetermined priority order. For example, the quadtree partition structure may be preferentially applied to the CTU. Coding units that can no longer be partitioned using the quadtree partition structure may correspond to leaf nodes of the quadtree. Coding units corresponding to leaf nodes of the quadtree may serve as root nodes of the binary and / or ternary tree partition structures. That is, coding units corresponding to leaf nodes of the quadtree may be further partitioned according to the binary or ternary tree partition structure, or may not be further partitioned. Therefore, by preventing coding units resulting from binary or ternary tree partitioning of coding units corresponding to leaf nodes of the quadtree from being further quadtree partitioned, block partitioning operations and / or operations for signaling partition information may be efficiently performed.

[0207] The fact that the coding unit corresponding to the node of the quadtree is partitioned can be signaled using the four partition information. The four partition information having a first value (e.g., "1") can 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") can indicate that the current coding unit is not partitioned according to the quadtree partition structure. The four partition information can be a flag with a predetermined length (e.g., one bit).

[0208] 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 be further partitioned by either binary tree partitioning or ternary tree partitioning. In addition, the coding unit generated by binary tree partitioning or ternary tree partitioning may be further partitioned by binary tree partitioning or ternary tree partitioning, or may not be further partitioned.

[0209] A tree structure in which there is no priority between binary tree partitioning and ternary tree partitioning is called a multi-type tree structure. Coding units corresponding to leaf nodes of a quadtree can be used as root nodes of a multi-type tree. Whether to partition coding units corresponding to nodes of a multi-type tree can be signaled using at least one of multi-type tree partition indication information, partition direction information, and partition tree information. To partition coding units corresponding to nodes of a multi-type tree, the multi-type tree partition indication information, partition direction information, and partition tree information can be sequentially signaled.

[0210] The multi-type tree partition indication information having a first value (e.g., '1') may indicate that the current coding unit will be multi-type tree partitioned. The multi-type tree partition indication information having a second value (e.g., '0') may indicate that the current coding unit will not be multi-type tree partitioned.

[0211] 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 according to the multi-type tree partitioning. Partition direction information having a first value (e.g., "1") may indicate that the current coding unit will be partitioned vertically. Partition direction information having a second value (e.g., "0") may indicate that the current coding unit will be partitioned horizontally.

[0212] When the coding unit corresponding to the node of the multi-type tree is further partitioned according to the multi-type tree partition structure, the current coding unit may include partition tree information. The partition tree information may indicate the tree partition structure to be used to partition the node 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 the 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 the ternary tree partition structure.

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

[0214] At least any one of quadtree partition indication information, multi-type tree partition indication information, partition direction information, and 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 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 quadtree partition information, multi-type tree partition indication information, partition direction information, and partition tree information.

[0215] As another example, between binary tree partitioning and ternary tree partitioning, binary tree partitioning may be prioritized. That is, the current coding unit may first be binary tree partitioned, 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.

[0216] 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 prediction units and / or transformation units may not be present in the bitstream.

[0217] However, when the size of a coding unit (i.e., 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 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 partitioning of the coding unit for transforming is not separately signaled, and the partitioning of the coding unit for transforming may be determined by comparing the horizontal or vertical size of the coding unit with the horizontal 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 bisected. 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 bisected.

[0218] Information about the maximum and / or minimum size of a coding unit and information about 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 to be 4×4. For example, the maximum size of a transform block may be determined to be 64×64. For example, the minimum size of a transform block may be determined to be 4×4.

[0219] Information about the minimum size of a coding unit corresponding to a leaf node of a quadtree (quadtree minimum size) and / or information about the maximum depth of a multi-type tree from a root node to a leaf node (multi-type tree maximum tree depth) 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 tile group level, a tile level, etc. Information about the minimum size of the quadtree and / or information about the maximum depth of the multi-type tree may be signaled or determined for each of an intra-picture slice and an inter-picture slice.

[0220] The difference between the size of a CTU and the maximum size of a transform block may be signaled or determined at a higher level of the coding unit. For example, the higher level may be the sequence level, picture level, slice level, tile group level, tile level, etc. Information regarding 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 slice type. For example, for intra-picture slices, the maximum size of the ternary tree may be 32×32. For example, for inter-picture slices, 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 as the minimum size of the coding block.

[0221] 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.

[0222] Depending on the size information and depth information of the various blocks described above, 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.

[0223] 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.

[0224] For example, when the size (horizontal size and vertical size) of the coding unit corresponding to the node of the multi-type tree is larger 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 into two or three. Therefore, 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.

[0225] 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 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 signaled, but the multi-type tree partition indication information may be inferred as the second value. This is because when the coding unit is partitioned according to 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.

[0226] Optionally, binary tree partitioning or ternary tree partitioning may be limited based on the size of the virtual pipeline data unit (hereinafter, the pipeline buffer size). For example, when a coding unit is divided into sub-coding units that do not fit into the pipeline buffer size through binary tree partitioning or ternary tree partitioning, the corresponding binary tree partitioning or ternary tree partitioning may be limited. The pipeline buffer size may be the size of the largest transform block (e.g., 64×64). For example, when the pipeline buffer size is 64×64, the following partitioning may be limited.

[0227] - N×M (N and / or M is 128) ternary tree partitions for coding units

[0228] - 128×N (N<=64) binary tree partitioning along the horizontal direction for the coding unit

[0229] - N×128 (N<=64) binary tree partitioning along the vertical direction for the coding unit

[0230] Optionally, when the depth of a coding unit corresponding to a node of a multi-type tree is equal to the maximum depth of the multi-type 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 signaled, but the multi-type tree partition indication information may be inferred as the second value.

[0231] Optionally, multi-type tree partition indication information may be signaled only when at least one of vertical binary tree partitioning, horizontal binary tree partitioning, vertical ternary tree partitioning, and horizontal ternary tree partitioning is feasible for the coding unit corresponding to the node of the multi-type tree. Otherwise, the coding unit may not be bipartitioned and / or tripartitioned. Therefore, the multi-type tree partition indication information may not be signaled, and instead the multi-type tree partition indication information may be inferred as the second value.

[0232] 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 feasible for the coding unit corresponding to the node of the multi-type tree. Otherwise, partition direction information may not be signaled, but may be inferred as a value indicating a possible partition direction.

[0233] Optionally, 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 feasible for the coding tree corresponding to the node of the multi-type tree. Otherwise, partition tree information may not be signaled, but may be inferred as a value indicating a possible partition tree structure.

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

[0235] Figure 4 The arrows from the center to the outside in may represent the prediction direction of the intra prediction mode.

[0236] Intra-frame encoding and / or decoding may be performed by using reference samples of a neighboring block of the current block. The neighboring block may be a reconstructed neighboring block. 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 block.

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

[0238] Intra-frame prediction may be performed based on an intra-frame prediction mode for the current block. The number of intra-frame prediction modes that the current block may have may be a fixed value or may be a value determined differently depending on the properties of the prediction block. For example, the properties of the prediction block may include the size and shape of the prediction block.

[0239] 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. Alternatively, the number of intra-frame prediction modes can vary depending on the block size or the color component type, or both. 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 increases, the number of intra-frame prediction modes can increase. Alternatively, the number of intra-frame prediction modes for a luminance component block can be greater than the number of intra-frame prediction modes for a chrominance component block.

[0240] 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 a current block, a step of determining whether a sample included in a reconstructed neighboring block can be used as a reference sample for the current block may be performed. When there are samples that cannot be used as reference samples for 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, and thus, the replaced sample value is used as the reference sample for the current block.

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

[0242] As in Figure 49 As shown in , 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 49 In the example, the samples of fragments A and F can be filled with the samples of the closest fragments B and E, respectively, instead of retrieving them 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 transmitted by signal. For example, in Figure 49 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 the prediction block, which will be described later, may not be performed.

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

[0244] In the case of planar mode, when generating a prediction block for the current block, the sample value of the prediction target sample may be generated by using a weighted sum of the upper and left reference samples of the current block, and the upper right and lower left reference samples of the current block, depending on the position of the prediction target sample within the prediction block. Furthermore, in the case of DC mode, when generating a prediction block for the current block, the average of the upper and left reference samples of the current block may be used. Furthermore, in the case of angular mode, the prediction block may be generated by using the upper, left, upper right, and / or lower left reference samples of the current block. To generate the prediction sample values, real-number unit interpolation may be performed.

[0245] In the case of intra-frame prediction between color components, a prediction block for the second color component of the current block can be generated based on the corresponding reconstructed block of the first color component. For example, the first color component can be a luma component, and the second color component can be a chroma component. For intra-frame prediction between color components, parameters of a linear model between the first and second color components can be derived based on a template. The template can include the upper and / or left neighboring samples of the current block and the upper and / or left neighboring samples of the corresponding reconstructed block of the first color component. For example, the parameters of the linear model can be derived using the sample value of the first color component with the maximum value and the sample value of the second color component with the minimum value among the samples in the template, and the sample value of the first color component with the minimum value and the sample value of the second color component with the minimum value among the samples in the template. Once the parameters of the linear model are derived, the corresponding reconstructed block can be applied to the linear model to generate a prediction block for the current block. Depending on the video format, subsampling can be performed on the reconstructed block of the first color component and the adjacent samples of the corresponding reconstructed 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 the corresponding subsampled samples. Whether to perform intra prediction between color components and / or the range of the template may be signaled as an intra prediction mode.

[0246] The current block can be partitioned into two or four sub-blocks in the horizontal or vertical direction. The partitioned sub-blocks can be reconstructed sequentially. That is, intra-frame prediction can be performed on the sub-blocks to generate sub-prediction blocks. In addition, inverse quantization and / or inverse transformation can be performed on the sub-blocks to generate sub-residual blocks. The reconstructed sub-blocks can be generated by adding the sub-prediction blocks to the sub-residual blocks. The reconstructed sub-blocks can be used as reference samples for intra-frame prediction of the sub-sub-blocks. A sub-block can 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 can be partitioned into two sub-blocks. Furthermore, 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 regarding whether intra-frame prediction is performed based on the sub-blocks and / or the partition direction (horizontal or vertical) can be signaled. Intra-frame prediction based on sub-blocks can be limited to being performed only when using reference sample line 0. When subblock-based intra prediction is performed, filtering for the prediction block, which will be described later, may not be performed.

[0247] The final prediction block can be generated by performing filtering on the prediction block of the intra-frame prediction. The filtering can be performed by applying predetermined weights to the filtering target sample, the left reference sample, the upper reference sample and / or the upper left reference sample. 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 sample in the prediction block. The 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 the diagonal mode is added to k or the diagonal mode is subtracted from k. For example, k can be a positive integer of 8 or less.

[0248] The intra-frame prediction mode of the current block can be entropy encoded / decoded by predicting the intra-frame prediction mode of a block adjacent to the current block. When the intra-frame prediction mode of the current block is the same as that of the neighboring block, information indicating that the intra-frame prediction mode of the current block and the neighboring block is the same can be signaled using predetermined flag information. In addition, 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 signaled. When the intra-frame prediction mode of the current block is different from that of the neighboring block, 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.

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

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

[0251] I-pictures can be encoded using intra-picture prediction without requiring inter-picture prediction. P-pictures can be encoded using inter-picture prediction using reference pictures existing in one direction (i.e., forward or backward) relative to the current block. B-pictures can be encoded using inter-picture prediction using reference pictures preset in two directions (i.e., forward and backward) relative to the current block. When using inter-picture prediction, the encoder can perform inter-picture prediction or motion compensation, and the decoder can perform corresponding motion compensation.

[0252] Hereinafter, embodiments of inter-frame prediction will be described in detail.

[0253] Inter-picture prediction or motion compensation may be performed using reference pictures and motion information.

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

[0255] The method of deriving motion information may differ depending on the prediction mode of the current block. For example, prediction modes applied to inter-frame 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.

[0256] 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 candidates. A motion vector candidate for the current block may be derived by using the generated motion vector candidate list. 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.

[0257] The encoding device 100 may calculate a motion vector difference (MVD) between the motion vector of the current block and the 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 the 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 the 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.

[0258] 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.

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

[0260] 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.

[0261] Another example of a method for deriving current motion information may be merge mode. Merge mode may indicate a method for merging the motion of multiple blocks. Merge mode may indicate a mode for deriving motion information of a current block from motion information of neighboring blocks. When merge mode is applied, reconstructed motion information of neighboring blocks and / or motion information of co-located blocks may be used to generate a merge candidate list. 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).

[0262] 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 combining motion information present in the merge candidate list, motion information of a block encoded / decoded before the current block (history-based merge candidate), and a zero merge candidate.

[0263] 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 transmit the bitstream to the decoding device 200 using a signal. 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 of the current block is a merge target block. For example, the neighboring blocks of the current block may include a left neighboring block 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.

[0264] In addition, the encoding device 100 performs entropy encoding on correction information for correcting the motion vector in the motion information of the merge candidate and transmits it to the decoding device 200 using a signal. The decoding device 200 may 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 that corrects the motion vector of the merge candidate based on the correction information transmitted using the signal may be referred to as a merge mode with a motion vector difference.

[0265] The skip mode may be a mode in which the motion information of the neighboring blocks is applied to the current block as is. When the skip mode is applied, the encoding apparatus 100 may perform entropy encoding on information indicating 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.

[0266] 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, a subblock merge candidate list may be generated using motion information of a subblock co-located with the current subblock in a reference image (subblock-based temporal merge candidates) and / or affine control point motion vector merge candidates.

[0267] The geometric partition mode may denote a mode of deriving motion information by partitioning the current block into predetermined 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.

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

[0269] 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 corrected motion information.

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

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

[0272] As in 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 residual signal is subjected to a primary transform to generate transform coefficients, and the transform coefficients are subjected to a secondary transform to generate secondary transform coefficients.

[0273] At least one scheme selected from a variety of predefined transform schemes is used to perform the primary transform. For example, examples of predefined transform schemes 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 used for the primary transform and / or secondary transform may be determined based on coding parameters of the current block and / or neighboring blocks of the current block. Optionally, transform information indicating the transform scheme may be signaled. DCT-based transforms may include, for example, DCT-2, DCT-8, etc. DST-based transforms may include, for example, DST-7.

[0274] 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 or block size / shape of the block, the quantized level signal may be scanned according to at least one of diagonal upper right scanning, vertical scanning, and horizontal scanning. For example, when the coefficients are scanned along the diagonal upper right scanning, the coefficients in block form are changed to a one-dimensional vector form. In addition to the diagonal upper right scanning, horizontal scanning for horizontally scanning the coefficients in two-dimensional block form or vertical scanning for vertically scanning the coefficients in two-dimensional block form may be used according to the size of the transform block and / or the intra prediction mode. The scanned quantized level coefficients may be entropy coded for insertion into the bitstream.

[0275] The decoder entropy decodes the bitstream to obtain quantized level coefficients. The quantized level coefficients may be arranged in a two-dimensional block by inverse scanning. The inverse scanning may use at least one of a diagonal upper right scan, a vertical scan, and a horizontal scan.

[0276] The quantized level coefficients may then be inversely quantized, followed by a secondary inverse transform as needed, and finally a primary inverse transform as needed to produce a reconstructed residual signal.

[0277] Inverse mapping in the dynamic range can be performed for the luminance component reconstructed by intra prediction or inter prediction before in-loop filtering. The dynamic range can be divided into 16 equal segments, and the mapping function for each segment can be transmitted with a signal. The mapping function can be transmitted with a signal at the slice level or the parallel block group level. An 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 prediction is converted to a mapping area via mapping using the mapping function, and then used to generate a reconstructed block. However, since intra prediction is performed in the mapping area, the prediction block generated by intra prediction can be used to generate a reconstructed block without mapping / inverse mapping.

[0278] When the current block is a residual block of chroma components, the residual block can be converted to an inverse mapping area by performing scaling on the chroma components of the mapping area. The availability of scaling can be signaled at the slice level or the tile group level. Scaling can only be applied when mapping for the luma component is available and the partitioning of the luma component and the partitioning of the chroma components follow the same tree structure. Scaling can be performed based on the average value of the sample values ​​of the luma prediction block corresponding to the chroma block. In this case, when the current block uses inter-frame prediction, the luma prediction block can represent the mapped luma prediction block. The values ​​required for scaling can be derived by referencing a lookup table using the index of the segment to which the average value of the sample values ​​of the luma prediction block belongs. Finally, the residual block can be converted to the inverse mapping area by scaling the residual block using the derived values. 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.

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

[0280] 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 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 skip mode, merge mode, AMVP mode, etc. In the case of skip mode or merge mode, a merge candidate list is constructed and a merge index is transmitted by signal so that one 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 AMVP mode, a difference block vector may be transmitted by signal. In addition, the 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 transmitted by signal. The prediction block in IBC mode is included in the current CTU or the left CTU and is limited to the block in the reconstructed area. For example, the value of the block vector may be limited so that the prediction block of the current block is located within the region of three 64×64 blocks preceding the 64×64 block to which the current block belongs in encoding / decoding order. By limiting the value of the block vector in this manner, memory consumption and device complexity of an implementation according to IBC mode can be reduced.

[0281] Hereinafter, a method for improving video compression efficiency by improving a transform method as one of video encoding processes will be described. More specifically, the encoding steps in conventional video encoding schematically include: an intra / inter prediction step for predicting an original block that is part of a current original image; a transform and quantization step for a residual block, wherein the residual block is the difference between a predicted prediction block and an original block; and an entropy encoding step, which is a lossless compression method based on the probability of coefficients of a block that has been transformed and quantized and compression information obtained in the previous step. Thus, a bit stream is generated as a compressed form of the original image, and the bit stream is sent to a decoder or stored in a recording medium. The scrambled and discrete sine transform (hereinafter referred to as "SDST") to be described below in this specification aims to improve compression efficiency by improving transform efficiency.

[0282] The SDST method according to the present invention uses discrete sine transform type-7 (hereinafter referred to as "DST-VII" or "DST-7") instead of discrete cosine transform type-2 (hereinafter referred to as "DCT-II" or "DCT-2") which is a transform kernel widely used in video encoding, so as to better reflect the common frequency characteristics of images.

[0283] According to the transformation method of the present invention, high objective video quality can be obtained even at a relatively low bit rate compared to conventional video encoding methods.

[0284] DST-7 can be applied to the data of the residual block. The application of DST-7 to the residual block can be performed based on the prediction mode corresponding to the residual block. For example, DST-7 can be applied to the residual block encoded in inter-frame mode. According to an embodiment of the present invention, DST-7 can be applied after the data of the residual block is rearranged or shuffled. Here, shuffling may mean the rearrangement of image data and may be equivalent to rearrangement or flipping of the residual signal. Here, the residual block may have the same meaning as the residual, residual block, residual signal, residual signal, residual data or residual data. In addition, the residual block may have the same meaning as the reconstructed residual, reconstructed residual block, reconstructed residual signal, reconstructed residual signal, reconstructed residual data or reconstructed residual data of the reconstructed form of the residual block in the encoder and decoder.

[0285] According to an embodiment of the present invention, SDST may use DST-7 as a transform kernel. Here, the transform kernel of SDST is not limited to DST-7, and at least one of various types of DST and DCT may be used, such as discrete sine transform type-1 (DST-1), discrete sine transform type-2 (DST-2), discrete sine transform type-3 (DST-3), ..., discrete sine transform type-n (DST-n), discrete cosine transform type-1 (DCT-1), discrete cosine transform type-2 (DCT-2), discrete cosine transform type-3 (DCT-3), ..., discrete cosine transform type-n (DCT-n), etc. (here, n may be a positive integer of 1 or greater).

[0286] The following equation 1 may represent a method of performing one-dimensional DCT-2 according to an embodiment of the present invention. Here, N may represent the size of a block, k may represent the position of a frequency component, and x n It can represent the value of the nth coefficient in the spatial domain.

[0287] [Equation 1]

[0288]

[0289] DCT-2 in the two-dimensional domain may be implemented by performing horizontal transform and vertical transform on the residual block using Equation 1 above.

[0290] The DCT-2 transform kernel can be defined as the following equation 2. Here, X k may represent basis vectors according to positions in the frequency domain, and N may represent the size of the frequency domain.

[0291] [Equation 2]

[0292]

[0293] in addition, Figure 7 is a diagram illustrating basis vectors in the frequency domain of DCT-2 according to the present invention. Figure 7 The frequency characteristics of DCT-2 in the frequency domain are shown. Here, the value calculated by the X0 basis vector of DCT-2 may represent a DC component.

[0294] DCT-2 can be used for transform processing of residual blocks of sizes such as 4×4, 8×8, 16×16, and 32×32.

[0295] In addition, DCT-2 can be selectively used based on at least one of the size of the residual block, the color components of the residual block (e.g., luma and chroma components), and the prediction mode corresponding to the residual block. For example, when the residual block is 4×4 in size and encoded in intra mode, and the components of the residual block are luma components, DCT-2 is used. For example, when the horizontal length (width) of the residual block encoded in intra mode is within a predetermined range (e.g., equal to or greater than 4 pixels and equal to or less than 16 pixels) and the horizontal length (width) is not longer than the vertical length (height), a first transform kernel can be used for horizontal transform. Otherwise, a second transform kernel can be used for horizontal transform. For example, when the vertical length (height) of the residual block encoded in intra mode is equal to or greater than 4 pixels and equal to or shorter than 16 pixels and the vertical length (height) is not longer than the horizontal length (width), the first transform kernel can be used for vertical transform. Otherwise, the second transform kernel can be used for vertical transform. The first transform kernel may be different from the second transform kernel. That is, the horizontal and vertical transform methods used for blocks encoded in intra mode can be implicitly determined based on the block's shape under predetermined conditions. For example, the first transform kernel can be DST-7, and the second transform kernel can be DCT-2. Here, the residual block is the transform target, so it can have the same meaning as the transform block. Here, the prediction mode can represent inter-frame prediction or intra-frame prediction. Furthermore, in the case of intra-frame prediction, the prediction mode refers to the intra-frame prediction mode or intra-frame prediction direction.

[0296] Transformation by the DCT-2 transform kernel can achieve high compression efficiency for blocks with the characteristic of small changes between adjacent pixels (such as the background of an image). However, DCT-2 may not be suitable as a transform kernel for areas with complex patterns (such as texture images). This is because when blocks with low correlation between adjacent pixels are transformed by DCT-2, a large number of transform coefficients appear in the high-frequency components of the frequency domain. When transform coefficients are frequently generated in the high-frequency domain, the compression efficiency of the image may decrease. In order to improve the compression efficiency, coefficients with large values ​​need to appear near the low-frequency components, and the values ​​of the coefficients need to be close to zero at the high-frequency components.

[0297] The following equation 3 may represent a method of performing one-dimensional DST-7 according to an embodiment of the present invention. Here, N may represent the size of a block, k may represent the position of a frequency component, and x n It can represent the value of the nth coefficient in the spatial domain.

[0298] [Equation 3]

[0299]

[0300] DST-7 in the two-dimensional domain may be implemented by performing horizontal and vertical transforms on the residual block using Equation 3 above.

[0301] The DST-7 transform kernel can be defined as the following equation 4. Here, X k may denote a k-th basis vector of DST-7, i may denote a position in the frequency domain, and N may denote a size of the frequency domain.

[0302] [Equation 4]

[0303]

[0304] DST-7 may be used for transform processing of a residual block having at least one size of 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, 128×128, and the like.

[0305] In addition, DST-7 can be applied to rectangular blocks instead of square blocks. For example, DST-7 can be applied to at least one of the vertical transform and the horizontal transform of a rectangular block whose horizontal size is different from the vertical size (such as 8×4, 16×8, 32×4, 64×16, etc.). When multiple transform methods can be selectively applied, DCT-2 is applied to the horizontal transform and the vertical transform of the square block. When multiple transform methods cannot be selectively applied, DST-7 is applied to the horizontal transform and the vertical transform of the square block.

[0306] Furthermore, DST-7 can be selectively used based on at least one of the size of the residual block, the color components of the residual block (e.g., luma and chroma components), the prediction mode corresponding to the residual block, the intra prediction mode (direction), and the shape of the residual block. For example, DST-7 is used when the residual block is 4×4 in size and encoded in intra mode, and the components of the residual block are luma components. Here, the prediction mode can represent inter prediction or intra prediction. Furthermore, in the case of intra prediction, the prediction mode refers to the intra prediction mode or intra prediction direction. For example, for chroma components, selecting a transform method based on block shape may not be possible. For example, when the intra prediction mode is prediction between color components, selecting a transform method based on block shape is not possible. For example, the transform method for chroma components may be specified by information signaled via the bitstream. When the current block is partitioned into multiple subblocks and intra prediction is performed on each subblock, the transform method for the current block is determined based on the intra prediction mode and / or block size (horizontal and / or vertical size). For example, when the intra prediction mode is non-directional (DC or planar) and the horizontal length (width) (or vertical length (height)) is within a predetermined range, the first transform kernel is used for horizontal transform (vertical transform). Otherwise, the second transform kernel is used. The first transform kernel may be different from the second transform kernel. For example, the first transform kernel may be DST-7 and the second transform kernel may be DCT-2. The predetermined range may be, for example, from 4 pixels to 16 pixels. When the size of the block is not within the predetermined range, the same kernel (for example, the second transform kernel) is used for horizontal transform and vertical transform. When the size of the block is within the predetermined range, different transform kernels are used for intra prediction modes adjacent to each other. For example, when the second transform kernel and the first transform kernel are used for horizontal transform and vertical transform in mode 27, respectively, the first transform kernel and the second transform kernel are used for horizontal transform and vertical transform in modes 26 and 28 adjacent to mode 27, respectively.

[0307] in addition, Figure 8 : is a diagram showing a basis vector in each frequency domain of DST-7 according to the present invention. Figure 8 , the first basis vector (x0) of DST-7 is in a curved shape. From this, it is predicted that DST-7 will show higher transform performance for blocks with large spatial changes in an image compared to DCT-2.

[0308] DST-7 can be used when transforming 4×4 transform units (TUs) within intra-predicted coding units (CUs). By reflecting the characteristics of intra-prediction, namely that the amount of error increases with increasing distance from the reference sample, DST-7 can be used with higher transform efficiency. In other words, in the case of blocks where the amount of residual signal increases as the distance from the position (0, 0) within the block increases in the spatial domain, DST-7 can be used to efficiently compress the block.

[0309] As mentioned above, in order to improve transform efficiency, it is important to use a transform kernel that is suitable for the frequency characteristics of the image. Specifically, since the transform is performed on the residual block for the original block, the transform efficiency of DST-7 and DCT-2 can be understood by examining the distribution characteristics of the residual signal within the CU, PU, ​​or TU block.

[0310] Figure 9 is a diagram showing the distribution of average residual values ​​according to positions within a 2N×2N prediction unit (PU) of an 8×8 coding unit (CU) predicted in inter mode, where a “Cactus” sequence is obtained by testing in a low-delay-P configuration environment.

[0311] Reference Figure 9 , Figure 9 The left side of shows relatively large values ​​marked as the top 30% of the average residual signal values ​​within the block. The right side shows relatively large values ​​marked as the top 70% of the average residual signal values ​​within the same block shown on the left.

[0312] like Figure 9 As shown in , the distribution of the residual signal within the 2N×2N PU of the 8×8 CU predicted in inter mode has the following characteristics: small residual signal values ​​are mainly concentrated near the center of the block and the residual signal value increases as it moves away from the center point of the block. That is, the residual signal value is large at the block boundary. The distribution characteristics of the residual signal as described above can be a common feature of the residual signal within the PU, regardless of the size of the CU partition mode and PU partition mode (2N×2N, 2N×N, N×2N, N×N, nR×2N, nL×2N, 2N×nU and 2N×nD) that the inter-predicted CU can have.

[0313] Figure 10 3D diagram showing distribution characteristics of residual signals within 2N×2N prediction units (PUs) of an 8×8 coding unit (CU) predicted in inter prediction mode (inter mode).

[0314] Reference Figure 10 , it is found that residual signals with relatively small values ​​are distributed in a concentrated manner near the center of the block, and residual signals closer to the block boundary have relatively larger values.

[0315] based on Figure 9 and Figure 10 The distribution characteristics of the residual signal are shown in , and when DST-7 is used instead of DCT-2, the transformation of the residual signal within the PU of the inter-frame predicted CU is more efficient.

[0316] Hereinafter, SDST, which is one of the transformation methods using DST-7 as a transformation kernel, will be described.

[0317] Hereinafter, a block may mean one of CU, PU, ​​and TU.

[0318] The SDST according to the present invention can be performed in two steps. The first step is to perform scrambling on the residual signal within the PU of the CU predicted in inter mode or intra mode. The second step is to apply DST-7 to the residual signal within the block that has been scrambled.

[0319] The residual signal arranged in the current block (e.g., CU, PU, ​​or TU) may be scanned in a first direction and rearranged in a second direction. That is, the residual signal arranged in the current block may be scanned in the first direction and rearranged in the second direction to perform shuffling. Here, the residual signal may represent a signal indicating a difference signal between the original signal and the predicted signal. That is, the residual signal may represent a signal before at least one of transformation and quantization is performed. Alternatively, the residual signal may represent a signal form in which at least one of transformation and quantization has been performed. Furthermore, the residual signal may represent a reconstructed residual signal. That is, the residual signal may represent a signal that has been subjected to at least one of inverse transformation and inverse quantization. Furthermore, the residual signal may represent a signal before at least one of inverse transformation and inverse quantization is performed.

[0320] In addition, the first direction (or scanning direction) can be one of a raster scanning order, an upper right diagonal scanning order, a horizontal scanning order, and a vertical scanning order. In addition, the first direction can be defined as at least one of the following (1) to (10).

[0321] (1) Scan from top to bottom, and scan from left to right within a row

[0322] (2) Scan from top to bottom and from right to left within a row

[0323] (3) Scan from bottom row to top row, and scan from left to right within a row

[0324] (4) Scan from the bottom row to the top row, and scan from the right to the left within a row

[0325] (5) Scan from left column to right column, and scan from top to bottom within a column

[0326] (6) Scan from left column to right column, and scan from bottom to top within a column

[0327] (7) Scan from the right column to the left column, and scan from top to bottom within a column

[0328] (8) Scan from the right column to the left column, and scan from the bottom to the top within a column

[0329] (9) Scanning in a spiral shape: Scanning from the inside (or outside) of the block to the outside (or inside) of the block, and scanning in a clockwise / counterclockwise direction

[0330] (10) Diagonal scan: Starting from a vertex in the block, scan diagonally in the upper left, upper right, lower left, or lower right direction.

[0331] In addition, regarding the second direction (or rearrangement direction), at least one of the scanning directions (1) to (10) may be selectively used. The first direction and the second direction may be the same or may be different from each other.

[0332] The scanning and rearrangement processes for the residual signal may be performed in units of a current block.

[0333] Here, rearrangement may mean that the residual signal scanned in the first direction within the block is arranged in blocks of the same size in the second direction. Here, the size of the block for scanning in the first direction may be different from the size of the block for rearrangement in the second direction.

[0334] In addition, scanning and rearrangement are described as being performed separately according to the first direction and the second direction, but scanning and rearrangement may be performed as a single process for the first direction. For example, for a residual signal within a block, scanning may be performed from the top row to the bottom row, and scanning may be performed from the right to the left within a row to store (rearrange) it in the block.

[0335] In addition, the scanning and rearrangement processing of the residual signal can be performed in predetermined units of subblocks within the current block. Here, the subblock can be a block of a size equal to or smaller than the current block. The subblock can be a block generated by partitioning the current block in a quadtree form, a binary tree form, or the like.

[0336] The sub-block unit may have a fixed size and / or shape (e.g., 4×4, 4×8, 8×8, ..., N×M, where N and M are positive integers). Furthermore, the size and / or shape of the sub-block unit may be variably derived. For example, the size and / or shape of the sub-block unit may be determined based on the size, shape, and / or prediction mode (inter and intra) of the current block.

[0337] The scanning direction and / or rearrangement direction may be adaptively determined based on the position of the sub-block. In this case, different scanning directions and / or rearrangement directions may be used for the sub-blocks, or all or a portion of the sub-blocks of the current block may use the same scanning direction and / or the same rearrangement direction.

[0338] Figure 11 is a diagram illustrating distribution characteristics of a residual signal in a 2N×2N prediction unit (PU) mode of a coding unit (CU) according to the present invention.

[0339] Reference Figure 11 , the PU is partitioned into four sub-blocks according to a quadtree structure, and the direction of the arrow for each sub-block shows the distribution characteristics of the residual signal. Specifically, the direction of the arrow for each sub-block indicates the direction in which the residual signal increases. This is due to the common distribution characteristics of the residual signal within the PU, regardless of the PU partition mode. Therefore, a shuffling operation can be performed to rearrange the residual signal of each sub-block to have a distribution characteristic suitable for the DST-7 transform.

[0340] Figure 12 is a diagram illustrating distribution characteristics of residual signals before and after scrambling of 2N×2N prediction units (PUs) according to the present invention.

[0341] Reference Figure 12 , the upper block shows the distribution of the residual signal in the 2N×2N PU of the 8×8 CU predicted in inter-frame mode before scrambling. The following equation 5 shows the distribution of the residual signal in the 2N×2N PU of the 8×8 CU predicted in inter-frame mode before scrambling. Figure 12 The value of each residual signal position in the upper block.

[0342] [Equation 5]

[0343]

[0344] Due to the distribution characteristics of the residual signal within the PU of the CU predicted in inter mode, many residual signals with relatively small values ​​are distributed in Figure 12 In the central area within the upper block in , many residual signals with larger values ​​are distributed closer to the boundary of the upper block.

[0345] Figure 12 The lower block in the figure shows the distribution characteristics of the residual signal within the 2N×2N PU after shuffling. This shows that the distribution of the residual signal for each subblock of the PU that has been shuffled is the distribution of the residual signal suitable for the first basis vector of DST-7. That is, since the residual signal within each subblock has a larger value as it moves away from the position (0, 0), when the transform is performed, the transform coefficient values ​​transformed by DST-7 are concentrated in the low-frequency domain.

[0346] Equation 6 below shows a method of performing shuffling according to the position of each of four sub-blocks within a PU, wherein the four sub-blocks are generated by partitioning the PU in a quadtree structure.

[0347] [Equation 6]

[0348] S0

[0349] a′(x, y)=a(W blk0 -1-x,H blk0 -1-y)

[0350] S1

[0351] b′(x, y)=b(x, H blk1 -1-y)

[0352] S2

[0353] c′(x, y)=c(W blk2 -1-x,y)

[0354] S3

[0355] d′(x, y) = d(x, y)

[0356] 0≤x≤W k , 0≤y≤H k , k∈{blk0, blk1, blk2, blk3}

[0357] Here, W k and H k Respectively represent the width and height of the kth sub-block (k∈{blk0, blk1, blk2, blk3}) in the PU, and blk0 to blk3 represent the sub-blocks generated by partitioning the PU in a quadtree structure. In addition, x and y represent the horizontal position and vertical position within the sub-block, respectively. Figure 12 As shown in the upper block in FIG, the position of the residual signal before the shuffling is performed is specified by a(x, y), b(x, y), c(x, y), and d(x, y). Figure 12 As shown in the lower block in , the positions of the residual signals after the shuffling are designated by a'(x,y), b'(x,y), c'(x,y), and d'(x,y).

[0358] Figure 13 is a diagram illustrating an example of rearrangement of 4×4 residual data of subblocks according to the present invention.

[0359] Reference Figure 13 , the sub-block may represent one of multiple sub-blocks belonging to the 8×8 prediction block. Figure 13(a) shows the position of the original residual data before rearrangement, and Figure 13 (b) shows the position of the rearranged residual data.

[0360] Reference Figure 13 (c), the value of the residual data may gradually increase from position (0,0) to position (3,3). Here, the horizontal one-dimensional residual data and / or the vertical one-dimensional residual data in each sub-block may have Figure 8 The data distribution in the form of basis vectors is shown in .

[0361] That is, regarding the scrambling according to the present invention, the residual data of each sub-block can be rearranged so that the distribution of the residual data is suitable for the form of DST-7 basis vectors. After scrambling each sub-block, the DST-7 transform can be applied to the rearranged data in each sub-block unit.

[0362] In addition, the sub-blocks can be further partitioned in a quadtree structure based on the depth of the TU, or a reordering process can be selectively performed. For example, when the depth of the TU is two, the N×N sub-blocks belonging to the 2N×2N PU are partitioned into N / 2×N / 2 blocks, and the reordering process is applied to each of the N / 2×N / 2 blocks. Here, the quadtree-based TU partitioning can be repeated until the minimum TU size is reached.

[0363] In addition, when the depth of the TU is zero, DCT-2 transform is applied to the 2N×2N block. Here, rearrangement of residual data may not be performed.

[0364] In addition, the SDST method according to the present invention uses the distribution characteristics of the residual signal within the PU block, so the partition structure of the TU performing SDST can be defined as partitioning in a quadtree structure based on the PU.

[0365] Figure 14a and Figure 14b is a diagram illustrating an embodiment of a transform unit (TU) partition structure of a coding unit (CU) according to a prediction unit (PU) mode and a transform unit (TU) shuffling method. Figure 14a and Figure 14b Each of the asymmetric partition modes (2N×nU, 2N×nD, nR×2N, and nL×2N) for an inter-predicted PU shows a quadtree partition structure of the TU according to the depth of the TU.

[0366] Reference Figure 14a and Figure 14b , the thick solid line of each block represents the PU within the CU, and the thin solid line represents the TU. In addition, S0, S1, S2 and S3 within each TU represent the shuffling method of the residual signal within the TU defined in the above equation 6.

[0367] In addition, Figure 14a and Figure 14b In the PU, the TU with a depth of zero of each PU may be the same as the PU in terms of block size (for example, in a 2N×2N PU, the size of the TU with a depth of zero may be the same as the size of the PU). Figure 18 Describes the out-of-order nature of the residual signal within a TU of depth zero.

[0368] In addition, when at least one of the CU, PU and TU is in a rectangular shape (e.g., 2N×nU, 2N×nD, nR×2N and nL×2N), before the residual signal is rearranged, at least one of the CU, PU and TU is partitioned into N sub-blocks, such as two, four, six, eight, 16 sub-blocks, etc., and then the residual signal rearrangement is applied to the sub-blocks generated by the partitioning.

[0369] In addition, when at least one of the CU, PU and TU is in a square shape (e.g., 2N×2N and N×N), before the residual signal is rearranged, at least one of the CU, PU and TU is partitioned into N sub-blocks, such as four, eight, 16 sub-blocks, etc., and then the residual signal rearrangement is applied to the sub-blocks generated by the partitioning.

[0370] In addition, when a TU is generated by partitioning a CU or PU and the TU has a top-level depth (not partitioned), the TU is partitioned into N sub-blocks, such as two, four, six, eight, 16 sub-blocks, etc., and then residual signal rearrangement is performed in units of sub-blocks generated by partitioning.

[0371] In the above example, when CU, PU, ​​and TU have different shapes or different sizes, residual signal rearrangement is performed. However, when at least two of CU, PU, ​​and TU have the same shape or the same size, residual signal rearrangement may also be applied.

[0372] In addition, Figure 14a and Figure 14b , an asymmetric partition mode of an inter-predicted PU is described, but not limited thereto, partitioning of TUs and reordering of TUs may be applied to symmetric partition modes (2N×N and N×2N) of a PU.

[0373] The DST-7 transform may be performed on each TU within the PU for which the shuffling has been performed. Here, when the CU, PU, ​​and TU have the same size and the same shape, the DST-7 transform is performed on one block.

[0374] Considering the distribution characteristics of the residual signal of the inter-predicted PU block, regardless of the size of the CU and the PU partition mode, performing DST-7 transform after shuffling may be more efficient than performing DCT-2 transform.

[0375] After transformation, when many transform coefficients are distributed near low-frequency components (especially DC components), the distribution of the residual signal has higher compression efficiency than the opposite case in terms of i) minimizing energy loss after quantization and ii) reducing bit usage in the entropy coding process.

[0376] Figure 15 is a diagram illustrating results of performing DCT-2 transform and SDST transform according to distribution of a residual signal of a 2N×2N prediction unit (PU).

[0377] Figure 15 The figure shown on the left side of shows the distribution of the residual signal increasing from the center to the boundary when the PU partition mode of the CU is 2N×2N. In addition, Figure 15 The drawing shown in the middle of shows distribution of a residual signal when DCT-2 transform is performed on a TU with a depth of 1 within a PU. Figure 15 The drawing shown on the right side of shows distribution of a residual signal after performing DST-7 transform (SDST) on TUs of depth 1 within a PU.

[0378] Reference Figure 15 Compared to the case where DCT-2 is performed on the TU of a PU having the above-described residual signal distribution characteristics, when SDST is performed, more coefficients are concentrated near low-frequency components, and coefficients regarding high-frequency components have smaller values. Based on the transform characteristics, it was found that when transforming the residual signal of an inter-predicted PU, performing SDST is more advantageous in terms of compression efficiency than performing DCT-2.

[0379] The block unit for performing DST-7 transforms is the TU unit for performing SDST defined in the PU. As described with reference to FIG14 , TUs can be generated by partitioning the PU unit with the maximum depth using a quadtree or binary tree. This means that DST-7 transforms can be performed not only on square blocks but also on rectangular blocks after shuffling.

[0380] For example, for an inter-frame predicted block, a residual block of the same size as the block may be decoded, or a sub-residual block corresponding to a portion of the block may be decoded. Information for this purpose may be signaled for the block, and may be, for example, a flag. When decoding a residual block of the same size as the block, information regarding the transform kernel is determined by decoding information contained in the bitstream. When decoding a sub-residual block corresponding to a portion of the block, the transform kernel for the sub-residual block is determined based on information specifying its type and / or position within the block. For example, information regarding the sub-residual block type and / or position within the block may be included in the signaled bitstream. Here, when the block is larger than 32×32, the operation of determining the transform kernel based on the sub-residual block type and / or position within the block is not performed. For example, for blocks larger than 32×32, a predetermined transform kernel (e.g., DCT-2) may be applied, or information regarding the transform kernel may be explicitly signaled. Optionally, when the width or height of the block is greater than 32, the operation of determining the transform kernel based on the type of the sub-residual block and / or the position within the block is not performed. For example, for a 64×8 block, a predetermined transform kernel (e.g., DCT-2) may be applied, or information about the transform kernel may be explicitly signaled.

[0381] The information about the type of the sub-residual block may be partition information of the block. The partition information of the block may be, for example, partition direction information indicating one of horizontal partitioning and vertical partitioning. Optionally, the partition information of the block may include partition ratio information. For example, the partition ratio may include 1:1, 1:3, and / or 3:1. The partition direction information and the partition ratio information may be signaled as separate syntax elements or as a single syntax element.

[0382] The information about the position of the sub-residual block may indicate a position within the block. For example, when the block is partitioned vertically, the information about the position indicates one of the left and right sides. Furthermore, when the block is partitioned horizontally, the information about the position indicates one of the top and bottom sides.

[0383] The transform kernel of a sub-residual block may be determined based on type information and / or position information. The transform kernel may be determined independently for horizontal and vertical transforms. For example, the transform kernel may be determined based on the partition direction. For example, in the case of vertical partitioning, the first transform kernel may be applied to the vertical transform. In the case of horizontal partitioning, the first transform kernel may be applied to the horizontal transform. For example, in the case of vertical partitioning, the first transform kernel or the second transform kernel may be applied to the horizontal transform, and in the case of horizontal partitioning, the first transform kernel or the second transform kernel may be applied to the vertical transform. For example, in the case of vertical partitioning, the second transform kernel may be applied to the horizontal transform at the left position, and the first transform kernel may be applied to the horizontal transform at the right position. Furthermore, in the case of horizontal partitioning, the second transform kernel may be applied to the vertical transform at the top position, and the first transform kernel may be applied to the vertical transform at the bottom position. For example, the first transform kernel and the second transform kernel may be DST-7 and DCT-8, respectively. For example, the first transform kernel and the second transform kernel may be DST-7 and DCT-2, respectively. However, this is not limiting. Among the various transform kernels described in this specification, any two different transform kernels may be used as the first transform kernel and the second transform kernel. Here, a block may represent a CU or a TU. In addition, the sub-residual block may represent a sub-TU.

[0384] Figure 16 is a diagram illustrating an SDST process according to the present invention.

[0385] In step S1610, the residual signal of the TU that is the target of the transform is input. Here, the TU may be a TU generated by partitioning a PU whose prediction mode is inter mode. In step S1620, the TU that is the target of the transform may be shuffled. Next, in step S1630, the DST-7 transform is performed on the TU that has been shuffled. In step S1640, quantization is performed, and a series of subsequent processes are performed, thereby performing SDST processing in this order.

[0386] In addition, shuffling and DST-7 transform may be performed on a block whose prediction mode is intra mode.

[0387] Hereinafter, as embodiments for implementing the SDST transform in an encoder, we will describe: i) a method for performing SDST on all TUs within an inter-predicted PU, and ii) a method for selectively performing SDST or DCT-2 with rate-distortion optimization. The following methods describe inter-predicted blocks, but are not limited thereto and can be applied to intra-predicted blocks.

[0388] Figure 17 is a diagram illustrating partitions of a transform unit (TU) and distribution characteristics of the magnitude of a residual absolute value for each prediction unit (PU) partition mode of an inter-predicted coding unit (CU) according to the present invention.

[0389] Reference Figure 17 In inter prediction mode, a TU may be generated by partitioning a CU according to a quadtree or a binary tree up to a maximum depth, and there may be a total of K partition modes for a PU. Here, K is a positive integer, and for example, in Figure 17 In the middle, K is 8.

[0390] As mentioned above Figure 10 As described above, the SDST according to the present invention uses the distribution characteristics of the residual signal in the PU in the inter-frame predicted CU. In addition, TUs can be generated by partitioning the PU according to a quadtree structure or a binary tree structure. That is, a TU with a depth of 0 may correspond to a PU, and a TU with a depth of 1 may correspond to each subblock obtained by partitioning the PU once according to a quadtree structure or a binary tree structure.

[0391] Figure 17 Each block in FIG shows a form in which a TU is partitioned according to a depth of two with respect to each PU partition mode of an inter-frame predicted CU. Here, a thick solid line may represent a PU, a thin solid line may represent a TU, and the direction of the arrow of each TU may represent a direction in which the residual signal value within the TU increases. Each TU may be shuffled as described above with respect to the shuffling step according to its position within the PU.

[0392] Specifically, in the case of a TU with a depth of 0, in addition to performing shuffling in the method proposed for the shuffling step, shuffling may be performed in various methods.

[0393] One of the various methods is to start scanning from the residual signal at the center position of the PU block, and scan the nearby residual signals in a circular manner in the boundary direction of the block, and rearrange the scanned residual signals in a zigzag scanning order starting from the position (0,0) in the PU.

[0394] Figure 18 is a diagram illustrating a residual signal scanning order and a reordering order of a transform unit (TU) having a depth of 0 within a prediction unit (PU) according to an exemplary embodiment.

[0395] Figure 18 (a) and Figure 18 (b) shows the scanning order for out-of-order, Figure 18 (c) shows the rearrangement sequence for SDST.

[0396] The DST-7 transform may be performed on the residual signal within each scrambled TU, and quantization, entropy coding, etc. may be performed. This scrambling method uses the distribution characteristics of the residual signal within the TU according to the PU partition mode, and thus the distribution of the residual signal may be optimized to improve the efficiency of the DST-7 transform as the next step.

[0397] In the encoder, the Figure 16 The SDST process shown performs SDST on all TUs within an inter-frame predicted PU. Figure 17 The same form as shown in is used to perform TU partitioning from PU to depth 2. Figure 17 Based on the distribution characteristics of the residual signal within the TU in the image, the residual signal within each TU may be shuffled. After that, a transform using the DST-7 transform kernel may be performed, and then quantization, entropy coding, etc. may be performed.

[0398] When reconstructing the residual signal of a TU within an inter-predicted PU, the decoder performs an inverse DST-7 transform on each TU within the inter-predicted PU and performs inverse shuffling on the reconstructed residual signal, thereby obtaining the reconstructed residual signal. In this SDST method, SDST is applied to all TUs within the inter-predicted PU, so there is no flag or information that needs to be further signaled to the decoder. In other words, the SDST method can be performed without any signaling of the SDST method.

[0399] In addition, even if SDST is performed on all TUs within an inter-frame predicted PU, the encoder determines a portion of the rearrangement method for the residual signal described above regarding the shuffling step as the optimal rearrangement method, and can transmit information about the determined rearrangement method to the decoder using a signal.

[0400] As another embodiment of performing SDST, at least one transform method from two or more transform methods (e.g., DCT-2 and SDST) can be selected and applied to transform the PU. This method may increase encoder computational effort compared to embodiments in which SDST is performed on all TUs within an inter-predicted PU. However, by selecting the more efficient transform method between DCT-2 and SDST, compression efficiency can be improved.

[0401] Figure 19 is a flow chart illustrating a DCT-2 or SDST selection encoding process with rate-distortion optimization (RDO) according to the present invention.

[0402] Reference Figure 19In step S1910, a residual signal of a TU as a transform target may be input. The cost of the TU obtained by performing DCT-2 on each TU within the PU predicted in inter mode in step S1920 may be compared with the cost of the TU obtained by performing shuffling in step S1930 and performing DST-7 in step S1940, thereby determining an optimal transform mode (e.g., DST-2 or SDST) for the TU in terms of rate-distortion in step S1950. Next, according to the determined transform mode, quantization may be performed on the transformed TU in step S1960, and entropy encoding may be performed.

[0403] In addition, the best transform mode among SDST and DCT-2 is selected only when the TU satisfies one of the following conditions.

[0404] i) Regardless of the PU partition mode, a TU needs to be a CU, or a TU needs to be generated by partitioning a CU with a quadtree or a binary tree.

[0405] ii) The TU needs to be a PU according to the PU partition mode, or the TU needs to be generated by partitioning the PU using a quadtree or a binary tree.

[0406] iii) Regardless of the PU partition mode, TUs are not generated by partitioning a CU.

[0407] Condition i) is a method of selecting DCT-2 or SDST as a transform mode in terms of rate-distortion optimization for a CU partitioned in a quadtree or binary tree regardless of the PU partition mode, or for a TU obtained from partitioning into a CU size.

[0408] Condition ii) is related to an embodiment in which SDST is performed on all TUs within an inter-predicted PU. That is, depending on the PU partition mode, DCT-2 and SDST are performed on a PU partitioned using a quadtree or binary tree, or on a TU obtained by partitioning to the PU size, and the transform mode of the TU is determined taking into account each cost.

[0409] Condition iii) is that regardless of the PU partition mode, the CU or TU is not partitioned in a CU unit having the same size as the TU, and DCT-2 and SDST are performed to determine a transform mode of the TU.

[0410] When comparing the rate-distortion cost (RD cost) for a TU block with a depth of 0 in a specific PU partition mode, the cost of the result of performing SDST on the TU with a depth of 0 is compared with the cost of the result of performing DCT-2 on the TU with a depth of 0, and the transform mode of the TU with a depth of 0 may be selected.

[0411] Figure 20 is a flowchart illustrating a process of selecting DCT-2 or SDST for decoding according to the present invention.

[0412] Reference Figure 20 In step S2010, a signaled SDST flag may be referenced for each TU. Here, the SDST flag may be a flag indicating whether SDST is used as a transform mode.

[0413] When the SDST flag is true (Yes in step S2020), the transform mode of the TU is determined to be the SDST mode. Then, in step S2030, the DST-7 inverse transform is performed on the residual signal within the TU. For the residual signal within the TU that has undergone the DST-7 inverse transform, in step S2040, the inverse shuffling using the above equation 6 is performed according to the position of the TU within the PU. Finally, in step S2060, a reconstructed residual signal is obtained.

[0414] In addition, when the SDST flag is not true (at step S2020-No), the transform mode of the TU is determined to be DCT-2 mode. Then, at step S2050, an inverse DCT-2 transform is performed on the residual signal within the TU, and a reconstructed residual signal is obtained at step S2060.

[0415] When the SDST method is used, the residual data is rearranged. Here, the residual data may represent the residual data corresponding to the inter-frame predicted PU. An integer transform derived from DST-7 using the separable property may be used as the SDST method.

[0416] In addition, to selectively use DCT-2 or DST-7, sdst_flag can be signaled. The signaling of sdst_flag is performed in units of TUs. sdst_flag can indicate whether to perform SDST.

[0417] Figure 21 is a flowchart illustrating a decoding process using SDST according to the present invention.

[0418] Reference Figure 21 In step S2110, sdst_flag may be entropy decoded in units of TU.

[0419] First, when the depth of the TU is zero (at step S2120 —Yes), SDST is not used and DCT-2 is used to reconstruct the TU at steps S2170 and S2180 . This is because SDST can be performed between the depth of the TU being 1 and the maximum depth value of the TU.

[0420] In addition, although the depth of the TU is not zero (at step S2120-No), when the transform mode of the TU is the transform skip mode and / or the coded block flag (cbf) value of the TU is zero, at step S2180, the TU is reconstructed without performing inverse transform.

[0421] In addition, when the depth of the TU is not 0 (at step S2120-No), and when the transform mode of the TU is not the transform skip mode and the cbf value of the TU is not 0 (at step S2130-No), at step S2140, the sdst_flag value is checked.

[0422] Here, when the sdst_flag value is 1 (at step S2140-Yes), in step S2150, an inverse transform based on DST-7 is performed, in step S2160, inverse shuffling is performed on the residual data of the TU, and in step S2180, the TU is reconstructed. Conversely, when the sdst_flag value is not 1 (at step S2140-No), in step S2170, an inverse transform based on DCT-2 is performed, and in step S2180, the TU is reconstructed.

[0423] Here, the signal targeted for scrambling or rearrangement may be at least one of a residual signal before inverse transformation, a residual signal before inverse quantization, a residual signal after inverse transformation, a residual signal after inverse quantization, a reconstructed residual signal, and a reconstructed block signal.

[0424] In addition, Figure 21 , although sdst_flag is described as being signaled in units of TUs, sdst_flag may be selectively signaled based on at least one of a transform mode of the TU and a cbf value of the TU. For example, when the transform mode of the TU is transform skip mode and / or the cbf value of the TU is 0, sdst_flag is not signaled. Furthermore, sdst_flag is not signaled even when the depth of the TU is zero.

[0425] In addition, although the sdst_flag is described as being signaled in units of TUs, the sdst_flag may be signaled in predetermined units. For example, the sdst_flag may be signaled in units of at least one of a video, a sequence, a picture, a slice, a tile, a coding tree unit, a coding unit, a prediction unit, and a transform unit.

[0426] and Figure 20 The SDST mark and Figure 21Similar to the embodiment of sdst_flag in

[15] , the selected transform mode information may be entropy encoded / decoded in units of TUs using an n-bit flag or index (n is a positive integer equal to or greater than 1). The transform mode information may indicate at least one of whether the TU is transformed using DCT-2, whether the TU is transformed using SDST, whether the TU is transformed using DST-7, and the like.

[0427] In the case of a TU within an inter-predicted PU, the transform mode information may be entropy encoded / decoded in bypass mode. In addition, in at least one of a transform skip mode, a residual differential PCM (RDPCM) mode, and a lossless mode, the entropy encoding / decoding of the transform mode information is omitted and the transform mode information is not signaled.

[0428] Furthermore, when the coded block flag for a block is zero, entropy encoding / decoding of the transform mode information is omitted, and the transform mode information is not signaled. When the coded block flag is zero, the inverse transform process is omitted in the decoder. Therefore, reconstruction of the block can be performed even when the transform mode information is not present in the decoder.

[0429] However, the transformation mode information is not limited to indicating the transformation mode through a flag, and the transformation mode information may be implemented in the form of a predefined table and an index. Here, the predefined table may define available transformation modes for each index.

[0430] In addition, Figures 19 to 21 In , selective use of SDST or DCT-2 is described, but not limited thereto, DCT-n or DST-n (n is a positive integer) may be applied instead of DCT-2.

[0431] In addition, DCT-2 or SDST transformation can be performed in the horizontal direction and the vertical direction, respectively. The same transformation mode can be used for the horizontal direction and the vertical direction, or different transformation modes can be used.

[0432] Furthermore, transform mode information regarding whether DCT-2 is used for the horizontal and vertical directions, whether SDST is used, and whether DST-7 is used can be entropy encoded / decoded separately. The transform mode information can be signaled, for example, as an index. The transform kernel indicated by the same index can be the same for intra-predicted blocks and inter-predicted blocks.

[0433] Also, the transform mode information may be entropy encoded / decoded in units of at least one of CU, PU, ​​TU, and block.

[0434] Furthermore, transform mode information may be signaled based on the luma component or the chroma component. In other words, transform mode information may be signaled based on the Y component, the Cb component, or the Cr component. For example, when transform mode information regarding whether DCT-2 or SDST is performed on the Y component is signaled, the transform mode information signaled for the Y component may be used as the transform mode of the block without signaling any transform mode information for at least one of the Cb component and the Cr component.

[0435] Here, the transformation mode information may be entropy encoded / decoded using an arithmetic coding method using a context model. When the transformation mode information is implemented in the form of a predefined table and an index, all or part of the plurality of bins may be entropy encoded / decoded using an arithmetic coding method using a context model.

[0436] In addition, the transform mode information can be selectively entropy-encoded / decoded according to the block size. For example, when the size of the current block is equal to or greater than 64×64, the transform mode information is not entropy-encoded / decoded. When the size is equal to or less than 32×32, the transform mode information is entropy-encoded / decoded.

[0437] Furthermore, when there are non-zero transform coefficients or L quantization levels within the current block, entropy encoding / decoding of the transform mode information is not performed, and one of the DCT-2, DCT-7, and SDST methods is performed. Here, entropy encoding / decoding of the transform mode information may not be performed regardless of the quantization level or the position of the non-zero transform coefficient within the block. Furthermore, entropy encoding / decoding of the transform mode information may not be performed only when a non-zero transform coefficient or quantization level exists at the top left position within the block. Here, L may be a positive integer including zero, and may be, for example, 1.

[0438] In addition, when there are non-zero transform coefficients or J or more quantization levels in the current block, the transform mode information is entropy encoded / decoded. Here, J is a positive integer.

[0439] Furthermore, the transform mode information is a method of limiting the use of certain transform modes according to the transform mode of the co-located block or expressing the transform mode of the co-located block by several bits, and the binarization method of the transform method can be varied.

[0440] The above-mentioned SDST may be restrictively used based on at least one of a prediction mode of a current block, an intra prediction mode, an inter prediction mode, a TU depth, a size, and a shape.

[0441] For example, when the current block is encoded in inter mode, SDST is used.

[0442] A minimum / maximum depth for which SDST is allowed may be defined. In this case, SDST is used when the depth of the current block is equal to or greater than the minimum depth. Alternatively, SDST is used when the depth of the current block is equal to or less than the maximum depth. Here, the minimum / maximum depth may be fixed values ​​or may be variably determined based on information indicating the minimum / maximum depth. The information indicating the minimum / maximum depth may be signaled from the encoder, and the information indicating the minimum / maximum depth may be derived from the decoder based on properties of the current block / neighboring blocks (e.g., size, depth, and / or shape).

[0443] The minimum / maximum size for which SDST is allowed may be defined. Similarly, SDST is used when the size of the current block is equal to or greater than the minimum size. Alternatively, SDST is used when the size of the current block is equal to or less than the maximum size. Here, the minimum / maximum size may be a fixed value, or the minimum / maximum size may be variably determined based on information indicating the minimum / maximum size. The information indicating the minimum / maximum size may be signaled from the encoder, and the information indicating the minimum / maximum size may be derived from the decoder based on the properties (e.g., size, depth, and / or shape) of the current / neighboring block. For example, when the current block is 4×4, DCT-2 is used as the transform method, and the transform mode information regarding whether DCT-2 or SDST is used is not entropy encoded / decoded.

[0444] The shape of a block that allows SDST can be defined. In this case, SDST is used when the shape of the current block is the defined block shape. Furthermore, the shape of a block that does not allow SDST can be defined. In this case, SDST is not used when the shape of the current block is the defined block shape. The shape of a block that allows or does not allow SDST can be fixed, and information about this can be signaled from the encoder. Alternatively, the shape of a block that allows or does not allow SDST can be derived from the decoder based on properties of the current block / neighboring blocks (e.g., size, depth, and / or shape). The shape of a block that allows or does not allow SDST can represent, for example, M, N, and / or the ratio between M and N in an M×N block.

[0445] In addition, when the depth of the TU is 0, DCT-2 or DST-7 is used as the transform method, and transform mode information about which transform method has been used is entropy encoded / decoded. When DST-7 is used as the transform method, rearrangement processing of the residual signal is performed. In addition, when the depth of the TU is 1 or more, DCT-2 or SDST is used as the transform method, and transform mode information about which transform method has been used is entropy encoded / decoded.

[0446] Also, a transform method may be selectively used depending on partition shapes of CUs and PUs or the shape of a current block.

[0447] According to an embodiment, when the partition shape of CU and PU or the shape of the current block is 2N×2N, DCT-2 is used. Regarding the remaining partition shapes and block shapes, DCT-2 or SDST can be selectively used.

[0448] In addition, when the partition shape of CU and PU or the shape of the current block is 2N×N or N×2N, DCT-2 is used. Regarding the remaining partition shapes and block shapes, DCT-2 or SDST can be selectively used.

[0449] In addition, when the partition shape of CU and PU or the shape of the current block is nR×2N, nL×2N, 2N×nU, or 2N×nD, DCT-2 is used. For the remaining partition shapes and block shapes, DCT-2 or SDST can be selectively used.

[0450] In addition, when SDST or DST-7 is performed in units of blocks generated by partitioning the current block, scanning and inverse scanning of the transform coefficient (quantization level) may be performed in units of the blocks generated by partitioning. In addition, when SDST or DST-7 is performed in units of blocks generated by partitioning the current block, scanning and inverse scanning of the transform coefficient (quantization level) may be performed in units of the current block that is not partitioned.

[0451] Also, transformation / inverse transformation using SDST or DST-7 may be performed according to at least one of an intra prediction mode (direction) of a current block, a size of the current block, and a component (luminance component or chrominance component) of the current block.

[0452] Furthermore, in transform / inverse transform using SDST or DST-7, DST-1 may be used instead of DST-7. Furthermore, in transform / inverse transform using SDST or DST-7, DCT-4 may be used instead of DST-7.

[0453] In addition, in the transformation / inverse transformation using DCT-2, the rearrangement method for rearranging the residual signal of SDST or DST-7 can be applied. That is, even when DCT-2 is used, the residual signal is rearranged or rotated by a predetermined angle.

[0454] Hereinafter, various modifications and embodiments of the out-of-order method and the signal transmission method will be described.

[0455] The SDST of the present invention aims to improve image compression efficiency by changing the transformation, shuffling, rearranging and / or flipping method. Performing DST-7 by shuffling the residual signal effectively reflects the distribution characteristics of the residual signal within the PU, thereby achieving high compression efficiency.

[0456] In the above description of the shuffling step, the residual signal rearrangement method has been described. In addition to the shuffling method for rearranging the residual signal, other implementation methods will be described below.

[0457] The rearrangement method described below can be applied to at least one of the embodiments related to the above-mentioned SDST method.

[0458] In order to minimize the hardware complexity of implementing the rearrangement of the residual signal, the residual signal rearrangement processing can be implemented by a horizontal flip method and a vertical flip method. The residual signal rearrangement method can be implemented by flipping as shown in the following (1) to (4). The rearrangement described below can represent flipping.

[0459] (1) r'(x,y) = r(x,y); no flipping

[0460] (2) r'(x,y) = r(w-1-x,y); horizontal flip

[0461] (3) r'(x,y)=r(x,h-1-y); vertical flip

[0462] (4) r'(x,y)=r(w-1-x,h-1-y); horizontal and vertical flip

[0463] The expression r'(x,y) represents the residual signal after rearrangement, and the expression r(x,y) represents the residual signal before rearrangement. The width and height of the block are represented by w and h, respectively. The position of the residual signal within the block is represented by x and y. The inverse rearrangement method of the rearrangement method using flipping can be performed in the same process as the rearrangement method. That is, by performing horizontal flipping again, the residual signal rearranged using horizontal flipping can be reconstructed into the original residual signal arrangement. The rearrangement method performed by the encoder and the inverse rearrangement method performed by the decoder can be the same flipping method.

[0464] For example, when horizontal flipping is performed on a residual block that has been horizontally flipped, a residual block before flipping is obtained, which is expressed as follows.

[0465] r'(w-1-x,y)=r(w-1-(w-1-x),y)=r(x,y).

[0466] For example, when vertical flipping is performed on a residual block on which vertical flipping has been performed, a residual block before flipping is obtained, which is represented as follows.

[0467] r'(x,h-1-y)=r(x,h-1-(h-1-y))=r(x,y).

[0468] For example, when horizontal and vertical flipping is performed on a residual block on which horizontal and vertical flipping has been performed, a residual block before flipping is obtained, which is expressed as follows.

[0469] r'(w-1-x,h-1-y)=r(w-1-(w-1-x),h-1-(h-1-y))=r(x,y).

[0470] The residual signal scrambling / rearrangement method based on flipping can be used without partitioning the current block. That is, in the SDST method, it is described that the current block (TU, etc.) is partitioned into sub-blocks and DST-7 is used for each sub-block. However, when the residual signal scrambling / rearrangement method based on flipping is used, the current block is not partitioned into sub-blocks, and flipping is performed on the entire current block or a portion of the current block, and then the DST-7 transform is performed. In addition, when the residual signal scrambling / rearrangement method based on flipping is used, the current block is not partitioned into sub-blocks, and after performing the inverse DST-7 transform, flipping is performed on all or a portion of the current block.

[0471] A maximum size (M×N) and / or a minimum size (O×P) of a block capable of performing flip-based residual signal shuffling / rearrangement may be defined. Here, the size may include at least one of a width as a horizontal size (M or O) and a height as a vertical size (N or P). M, N, O, and P may be positive integers. The maximum size of a block and / or the minimum size of a block may be predefined values ​​in the encoder / decoder, or may be information signaled from the encoder to the decoder.

[0472] For example, when the size of the current block is smaller than the minimum size capable of performing the flip method, flipping and DST-7 transform are not performed, and only DCT-2 transform is performed. Here, the SDST flag as transform mode information indicating whether flipping and DST-7 are used as transform modes may not be signaled.

[0473] For example, when the width of a block is smaller than the minimum width for which the flipping method can be performed and the height of the block is larger than the minimum height for which the flipping method can be performed, one-dimensional transform is performed only in the horizontal direction using DCT-2. With respect to one-dimensional transform in the vertical direction, one-dimensional vertical transform is performed using DST-7 after vertical flipping, or one-dimensional vertical transform is performed using DST-7 without flipping. Here, an SDST flag as transform mode information indicating whether flipping is used as the transform mode may be signaled only for one-dimensional transform in the vertical direction.

[0474] For example, when the height of a block is smaller than the minimum width for which the flipping method can be performed and the width of the block is larger than the minimum width for which the flipping method can be performed, with respect to the one-dimensional transform in the horizontal direction, the one-dimensional transform is performed using DST-7 after horizontal flipping, or the one-dimensional transform is performed using DST-7 without flipping. The one-dimensional transform in the vertical direction is performed using DCT-2 only. Here, the SDST flag, which is transform mode information indicating whether flipping is used as the transform mode, may be signaled only for the one-dimensional transform in the horizontal direction.

[0475] For example, when the size of the current block is larger than the maximum size that can perform the flip method, flipping and DST-7 transform are not used, and only DCT-2 transform is used. Here, the SDST flag as transform mode information indicating whether flipping and DST-7 transform are used as transform modes may not be signaled.

[0476] For example, when the size of the current block is larger than the maximum size capable of performing the flipping method, only DCT-2 transform or DST-7 transform is used.

[0477] For example, when the maximum size for which the flipping method can be performed is 32×32 and the minimum size is 4×4, flipping and the DST-7 transform are used for blocks of 64×64 size, and only the DCT-2 transform is used. Here, for blocks of 64×64 size, the SDST flag, which serves as transform mode information indicating whether flipping and DST-7 are used as transform modes, may not be signaled. Furthermore, for blocks of 4×4 to 32×32 sizes, the SDST flag, which serves as transform mode information indicating whether flipping and DST-7 are used as transform modes, may be signaled. In this case, the DST-7 transform is not used for blocks of 64×64 size, thereby saving memory space for storing the DST-7 transform for blocks of 64×64 size.

[0478] For example, when the maximum size in which the flipping method can be performed is 32×32 and the minimum size is 4×4, not only the flipping method is used for a block of 64×64 size, but also DCT-2 or DST-7 transform is used.

[0479] For example, a square block of size M×N can be partitioned into four sub-blocks according to a quadtree, and a shuffling / rearrangement method can be performed on each sub-block using flipping, and then a DST-7 transform can be performed. Here, the flipping method can be explicitly signaled for each sub-block. The flipping method can be signaled as a two-bit fixed-length code and can be signaled as a truncated unary code. In addition, a binarization method based on the probability of occurrence of the flipping method for each block generated by partitioning can be used. Here, M and N can be positive integers, such as 64.

[0480] For example, a square block of size M×N can be partitioned into four sub-blocks according to a quadtree, and a shuffling / rearrangement method can be performed on each sub-block using flipping, and then a DST-7 transform can be performed. The flipping method for each sub-block can be implicitly determined. For example, horizontal and vertical flipping can be determined for the first (upper left) sub-block, vertical flipping can be determined for the second (upper right) sub-block, horizontal flipping can be determined for the third (lower left) sub-block, and no flipping can be determined for the fourth (lower right) sub-block. As described above, when the flipping method is implicitly determined, signal transmission for the flipping method is not required. Here, M and N can be positive integers, such as 64.

[0481] For example, a rectangular block of size 2M×N can be partitioned into two M×N square blocks according to a binary tree, and a shuffling / rearrangement method can be performed on each of the two blocks using flipping, and then a DST-7 transform can be performed. Here, the flipping method can be explicitly signaled for each sub-block. The flipping method can be signaled as a two-bit fixed-length code and can be signaled as a truncated unary code. In addition, a binarization method based on the probability of occurrence of the flipping method for each sub-block can be used. Here, M and N can be positive integers, such as 8.

[0482] For example, a rectangular block of size 2M×N can be partitioned into two M×N square blocks according to a binary tree, and a shuffling / rearrangement method can be performed on each sub-block using flipping, and then a DST-7 transform can be performed. The flipping method for each sub-block can be implicitly determined. Horizontal flipping can be determined for the first (left) sub-block, and no flipping can be determined for the second (right) sub-block. As described above, when the flipping method is implicitly determined, there is no need to signal the flipping method. Here, M and N can be positive integers, such as 4.

[0483] For example, a rectangular block of size M×2N can be partitioned into two M×N square blocks according to a binary tree, and a shuffling / rearrangement method can be performed on each sub-block using flipping, and then a DST-7 transform can be performed. The flipping method for each sub-block can be implicitly determined. Vertical flipping can be determined for the first (top) sub-block, and no flipping can be determined for the second (bottom) sub-block. As described above, when the flipping method is implicitly determined, there is no need to signal the flipping method. Here, M and N can be positive integers, such as 4.

[0484] At least one of the following two methods can be applied: a method of performing DCT-2 transform / inverse transform on a block of size M×N; and a method of partitioning the block according to a quadtree or a binary tree to generate subblocks, performing flipping on each subblock, and then performing DCT-7 transform / inverse transform. Here, the flipping method can be performed differently depending on the relative position in the block serving as the parent block of the subblock, and the flipping method can be implicitly determined. Here, M and N can be positive integers, and for example, M and N can be 64. That is, the block of size M×N can be a relatively large block in size.

[0485] In case of the top left sub-block, horizontal and vertical flipping may be determined as flipping for the sub-block.

[0486] In case of the top right sub-block, vertical flipping may be determined as the flipping for the sub-block.

[0487] In case of the lower left sub-block, horizontal flipping may be determined as the flipping for the sub-block.

[0488] In case of the lower right sub-block, it may be determined not to perform flipping for the sub-block.

[0489] Information about the use of a flip-based residual signal scrambling / reordering method (sdst_flag or sdst flag) can be entropy encoded / decoded using transform mode information. That is, by signaling the transform mode information, the same method performed in the encoder can be performed in the decoder. For example, when the flag bit indicating the transform mode information has a first value, the flip-based residual signal scrambling / reordering method and DST-7 are used as the transform / inverse transform method. When the flag bit has a second value, another transform / inverse transform method is used. Here, the transform mode information can be entropy encoded / decoded for each block. Here, the other transform / inverse transform method can be a DCT-2 transform / inverse transform method. In addition, in the case of one of a transform skip mode, a residual differential PCM (RDPCM) mode, and a lossless mode, entropy encoding / decoding of the transform mode information is omitted and the transform mode information is not signaled.

[0490] Transform mode information may be entropy encoded / decoded using at least one of the depth of the current block, the size of the current block, the shape of the current block, transform mode information of neighboring blocks, a coded block flag of the current block, and information regarding whether transform skip mode is used for the current block. For example, when the coded block flag of the current block is 0, entropy encoding / decoding of the transform mode information is omitted and the transform mode information is not signaled. Furthermore, during entropy encoding / decoding, the transform mode information may be predictively encoded / decoded based on transform mode information of reconstructed blocks adjacent to the current block. Furthermore, the transform mode information may be signaled based on at least one of coding parameters of the current block and neighboring blocks.

[0491] In addition, using the flipping method information, at least one of the four flipping methods (non-flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) can be entropy encoded / decoded in the form of a flag or index (flipping_idx). That is, by signaling the flipping method information, the same flipping method performed in the encoder can be performed in the decoder. The transform mode information may include the flipping method information.

[0492] Furthermore, in one of transform skip mode, residual differential PCM (RDPCM) mode, and lossless mode, entropy encoding / decoding of flipping method information is omitted and not signaled. The flipping method information may be entropy encoded / decoded using at least one of the depth of the current block, the size of the current block, the shape of the current block, flipping method information of neighboring blocks, a coded block flag of the current block, and information regarding whether transform skip mode is used for the current block. For example, when the coded block flag of the current block is 0, entropy encoding / decoding of the flipping method information is omitted and not signaled. Furthermore, during entropy encoding / decoding, the flipping method information may be predictively encoded / decoded based on flipping method information of reconstructed blocks adjacent to the current block. Furthermore, the flipping method information may be signaled based on at least one of coding parameters of the current block and neighboring blocks.

[0493] In addition, the residual signal rearrangement method is not limited to the above-mentioned residual signal rearrangement, and the order can be achieved by rotating the residual signal within the block by a predetermined angle. Here, the predetermined angle may represent an angle of 0 degrees, 90 degrees, 180 degrees, -90 degrees, -180 degrees, 270 degrees, -270 degrees, 45 degrees, -45 degrees, 135 degrees, -135 degrees, etc. Here, the information about the angle can be entropy encoded / decoded in the form of a flag or an index, and the signal transmission method for the information about the angle can be performed similarly to the signal transmission method for the transform mode information.

[0494] In addition, angle information can be predictively encoded / decoded from angle information of reconstructed blocks adjacent to the current block during entropy encoding / decoding. When rearrangement is performed using angle information, SDST or DST-7 can be performed after partitioning the current block, but SDST or DST-7 can also be performed on a per-block basis without partitioning the current block.

[0495] The predetermined angle may be determined differently depending on the position of the subblock. A method of rearranging by rotating only a subblock at a specific position (e.g., the first subblock) among the subblocks may be used in a limited manner. Furthermore, rearrangement using a predetermined angle may be applied to the entire current block. Here, the current block targeted for rearrangement may be at least one of a residual block before inverse transformation, a residual block before inverse quantization, a residual block after inverse transformation, a residual block after inverse quantization, a reconstructed residual block, and a reconstructed block.

[0496] In addition, to achieve the same effect as rearranging or rotating the residual signal, the coefficients of the transform matrix used for the transform can be rearranged or rotated, and this can be applied to the pre-arranged residual signal to perform the transform. That is, instead of rearranging the residual signal, the transform is performed using rearrangement of the transform matrix, thereby achieving the same effect as the method of performing rearrangement and transformation on the residual signal. Here, the rearrangement of the coefficients of the transform matrix can be performed in the same manner as the above-mentioned residual signal rearrangement method, and the method of signaling the information required for the rearrangement of the coefficients of the transform matrix can be performed in the same manner as the method of signaling the information required for the above-mentioned residual signal rearrangement method.

[0497] In addition, the encoder may determine a portion of the residual signal reordering methods described above regarding the shuffling step as the optimal reordering method, and may signal information regarding the determined reordering method (reversal method information) to the decoder. For example, when four reordering methods are used, the encoder may signal up to two bits of information regarding the residual signal reordering method to the decoder.

[0498] Furthermore, when the rearrangement methods used have different probabilities of occurrence, a smaller number of bits are used to encode the rearrangement method with a higher probability of occurrence, and a relatively larger number of bits are used to encode the rearrangement method with a lower probability of occurrence. For example, four rearrangement methods may be arranged in descending order of probability of occurrence and may be signaled as a truncated unary code (e.g., (0, 10, 110, 111) or (1, 01, 001, 000)).

[0499] In addition, the probability of occurrence of the rearrangement method may vary depending on coding parameters, such as the prediction mode of the current CU, the intra-frame prediction mode (direction) of the PU, the motion vector of the neighboring block, etc. Therefore, the coding method of the information about the rearrangement method (flip method information) may be used differently according to the coding parameters. For example, the probability of occurrence of the rearrangement method may vary according to the prediction mode of the intra-frame prediction. Therefore, for each intra-frame mode, a few bits may be allocated to a rearrangement method with a high probability of occurrence, and many bits may be allocated to a rearrangement method with a low probability of occurrence. Alternatively, depending on the situation, a rearrangement method with a very low probability of occurrence may not be used and may not be allocated any bits.

[0500] A reordering set including at least one of the residual signal reordering methods may be constructed based on at least one of the following: a prediction mode (inter mode or intra mode), an intra prediction mode (including a directional mode and a non-directional mode), an inter prediction mode, a block size, a block shape (square or non-square), luma / chroma signals, transform mode information, and the like for the current block. The reordering may include flipping. Furthermore, a reordering set including at least one of the residual signal reordering methods may be constructed based on at least one of the coding parameters of the current block and a neighboring block.

[0501] Furthermore, at least one of the following reordering sets may be selected based on at least one of a prediction mode, an intra-frame prediction mode, an inter-frame prediction mode, a block size, a block shape, a luminance / chrominance signal, transform mode information, etc. of the current block. Furthermore, at least one of the reordering sets may be selected based on at least one coding parameter among coding parameters of the current block and a neighboring block.

[0502] The rearrangement set may include at least one of “no flip,” “horizontal flip,” “vertical flip,” and “horizontal and vertical flip.” An example of the rearrangement set is shown below.

[0503] 1. Do not flip

[0504] 2. Horizontal Flip

[0505] 3. Vertical Flip

[0506] 4. Horizontal and vertical flip

[0507] 5. No flip, and horizontal flip

[0508] 6. No flip, and vertical flip

[0509] 7. No flip, horizontal and vertical flip

[0510] 8. Horizontal flip and vertical flip

[0511] 9. Horizontal flip, and horizontal and vertical flip

[0512] 10. Vertical flip, horizontal and vertical flip

[0513] 11. No flip, horizontal flip, and vertical flip

[0514] 12. No flip, horizontal flip, and horizontal and vertical flip

[0515] 13. No flip, vertical flip, horizontal and vertical flip

[0516] 14. Flip horizontally, flip vertically, and flip horizontally and vertically

[0517] 15. No flip, horizontal flip, vertical flip, and horizontal and vertical flip

[0518] Based on the reordering set, at least one of the residual signal reordering methods may be used to reorder the current block.

[0519] Furthermore, at least one of the residual signal reordering methods may be selected from the reordering set based on at least one of a prediction mode, an intra-frame prediction mode, an inter-frame prediction mode, a block size, a block shape, luminance / chrominance, transform mode information, and flipping method information of the current block. Furthermore, at least one of the residual signal reordering methods may be selected from the reordering set based on at least one of encoding parameters of the current block and a neighboring block.

[0520] At least one reordering set may be constructed based on the prediction mode of the current block. For example, when the prediction mode of the current block is intra-frame prediction, multiple reordering sets may be constructed. When the prediction mode of the current block is inter-frame prediction, one reordering set may be constructed.

[0521] At least one reordering set may be constructed based on the intra prediction mode of the current block. For example, when the intra prediction mode of the current block is a non-directional mode, one reordering set may be constructed. When the intra prediction mode of the current block is a directional mode, multiple reordering sets may be constructed.

[0522] At least one reordering set may be constructed based on the size of the current block. For example, if the size of the current block is larger than 16×16, one reordering set may be constructed. If the size of the current block is equal to or smaller than 16×16, multiple reordering sets may be constructed.

[0523] At least one reordering set may be constructed based on the shape of the current block. For example, if the current block is a square, one reordering set may be constructed. If the current block is a non-square shape, multiple reordering sets may be constructed.

[0524] At least one reordering set can be constructed based on the luminance / chrominance signal of the current block. For example, if the current block is a chrominance signal, one reordering set is constructed. If the current block is a luminance signal, multiple reordering sets are constructed.

[0525] In addition, based on the reordering set, the index for the residual signal reordering method can be entropy encoded / decoded. Here, the index can be entropy encoded / decoded into a variable length code or a fixed length code.

[0526] Furthermore, based on the rearrangement set, binarization and debinarization of the index for the residual signal rearrangement method may be performed.Here, the index may be binarized and debinarized into a variable length code or a fixed length code.

[0527] Furthermore, the reordered set can be in the form of tables in the encoder and decoder and can be calculated by equations.

[0528] In addition, the reordering set can be constructed in a symmetrical manner. For example, the table for the reordering set can be constructed in a symmetrical manner. Here, the table can be constructed in a symmetrical manner for the intra prediction mode.

[0529] Furthermore, the reordering set may be constructed according to at least one of whether the intra prediction mode is within a specific range and whether the intra prediction mode is even or odd.

[0530] The following table shows an example of a method of encoding / decoding a residual signal rearrangement method according to a prediction mode and an intra prediction mode (direction) of a current block.

[0531] Furthermore, in the following table, flip method information may be used to indicate use of at least one of the residual signal rearrangement methods.

[0532] [Table 1]

[0533]

[0534] In Table 1, columns (1) to (4) of the residual signal reordering method specify the residual signal reordering method, such as an index for a scanning / reordering order for the above-mentioned residual signal reordering, an index for a predetermined angle value, an index for a predetermined flipping method, etc. In Table 1, the mark * in the column of the residual signal reordering method indicates that the corresponding reordering method is implicitly used in the absence of signal transmission, and the mark - indicates that the corresponding reordering method is not used in the corresponding case. Implicitly using the reordering method may mean using the reordering method using transform mode information (sdst_flag or sdstflag) without entropy encoding / decoding the index for the residual signal reordering method. Columns (1) to (4) of the residual signal reordering method may refer to (1) no flipping, (2) horizontal flipping, (3) vertical flipping, and (4) horizontal and vertical flipping, respectively. In addition, the numbers 0, 1, 10, 11, 110, 111, etc. can be the binarization / debinarization results used for entropy encoding / decoding of the residual signal rearrangement method. Fixed length code, truncated unary code, unary code, etc. can be used as the binarization / debinarization method.

[0535] As shown in Table 1, when the current block corresponds to at least one of a prediction mode and an intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder. Here, the diagonal direction of the 45-degree angle may indicate a direction toward the upper left position in the current block or a direction from the upper left position in the current block toward the current block.

[0536] [Table 2]

[0537]

[0538] As another example, as shown in Table 2, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder.

[0539] [Table 3]

[0540]

[0541]

[0542] As another example, as shown in Table 3, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder.

[0543] [Table 4]

[0544]

[0545] As another example, as shown in Table 4, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder. For example, when the current block is in intra mode and the intra prediction direction is an even number, at least one of non-flip, horizontal flip, and vertical flip methods may be used as the residual signal rearrangement method. In addition, when the current block is in intra mode and the intra prediction direction is an odd number, at least one of non-flip, vertical flip, horizontal flip, and vertical flip methods may be used as the residual signal rearrangement method.

[0546] [Table 5]

[0547]

[0548] As another example, as shown in Table 5, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder.

[0549] [Table 6]

[0550]

[0551] As another example, as shown in Table 6, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder.

[0552] [Table 7]

[0553]

[0554] As another example, as shown in Table 7, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder.

[0555] [Table 8]

[0556]

[0557]

[0558] As another example, as shown in Table 8, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder.

[0559] [Table 9]

[0560]

[0561] As another example, as shown in Table 9, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder.

[0562] [Table 10]

[0563]

[0564] As another example, as shown in Table 10, when the current block corresponds to at least one prediction mode and at least one intra-frame prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder. Here, a diagonal direction of 135 degrees may represent a direction toward the upper right position in the current block or a direction from the upper right position in the current block toward the current block. For example, the value of the diagonal direction mode of 135 degrees may be 6. Here, a diagonal direction of -45 degrees may represent a direction toward the lower right position in the current block or a direction from the lower right position in the current block toward the current block. For example, the value of the diagonal direction mode of -45 degrees may be 2.

[0565] [Table 11]

[0566]

[0567] As another example, as shown in Table 11, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder.

[0568] [Table 12]

[0569]

[0570]

[0571] As another example, as shown in Table 12, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder.

[0572] [Table 13]

[0573]

[0574] As another example, as shown in Table 13, when the current block corresponds to at least one prediction mode and at least one intra prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder. Here, the residual signal rearrangement method may indicate the type of transform. For example, when the residual signal rearrangement method is (1), both the horizontal transform and the vertical transform represent the first transform kernel. As another example, when the residual signal rearrangement method is (2), the horizontal transform and the vertical transform represent the second transform kernel and the first transform kernel, respectively. As another example, when the residual signal rearrangement method is (3), the horizontal transform and the vertical transform represent the first transform kernel and the second transform kernel, respectively. As another example, when the residual signal rearrangement method is (4), the horizontal transform and the vertical transform represent the second transform kernel and the second transform kernel, respectively. For example, the first transform kernel may be DST-7, and the second transform kernel may be DCT-8. When the intra prediction mode is planar mode or DC mode, information about the four rearrangement methods (flip method information) is entropy encoded / decoded using truncated unary codes based on the frequency of occurrence.

[0575] When the intra-frame prediction direction is a horizontal direction or a mode close to the horizontal direction, the probability of rearrangement method (1) and / or rearrangement method (3) is high. In this case, one bit can be used for each of the two rearrangement methods, and information about the rearrangement method can be entropy encoded / decoded. Here, the mode close to the horizontal direction may mean that the value of the specific mode is between the value -K for the horizontal direction mode and the value +K for the horizontal direction mode. Here, K can be an integer. For example, when the value for the horizontal direction mode is 18 and K is 4, and the specific mode is 20, the specific mode is a mode close to the horizontal direction. For example, when the value for the horizontal direction mode is 18 and K is 4, and the specific mode is 26, the specific mode is not a mode close to the horizontal direction.

[0576] When the intra-frame prediction direction is a vertical direction or a mode close to the vertical direction, the probability of the rearrangement method (1) and / or the rearrangement method (2) is high. In this case, one bit can be used for each of the two methods, and information about the rearrangement method can be entropy encoded / decoded. Here, the mode close to the vertical direction may mean that the value of the specific mode is between the value -K for the vertical direction mode and the value +K for the vertical direction mode. Here, K can be an integer. For example, when the value for the vertical direction mode is 50 and K is 2, and the specific mode is 51, the specific mode is a mode close to the vertical direction. For example, when the value for the vertical direction mode is 50 and K is 8, and the specific mode is 20, the specific mode is not a mode close to the vertical direction.

[0577] When the intra prediction direction is a diagonal direction at a 45-degree angle or a pattern close to a diagonal direction at a 45-degree angle, the probabilities of the other rearrangement methods (2), (3), and (4) are very low compared to the probability of the rearrangement method (1). In this case, only one of the above methods is applied, and the method can be used implicitly without signaling information about the rearrangement method. Here, the pattern close to a diagonal direction at a 45-degree angle may mean that the value of the specific pattern is between the value -K for the diagonal direction pattern at a 45-degree angle and the value +K for the diagonal direction pattern at a 45-degree angle. Here, K may be an integer. For example, when the value of the diagonal direction pattern at a 45-degree angle is 34 and K is 2, and the specific pattern is 36, the specific pattern is a pattern close to a diagonal direction pattern at a 45-degree angle. For example, when the value of the diagonal direction pattern at a 45-degree angle is 34 and K is 8, and the specific pattern is 10, the specific pattern is not a pattern close to a diagonal direction pattern at a 45-degree angle.

[0578] When the intra prediction direction is an even number, information about the rearrangement method may be entropy encoded / decoded as a truncated unary code or a unary code only for the rearrangement methods (1), (2), and (3).

[0579] When the intra prediction direction is an odd number, information about the rearrangement method may be entropy encoded / decoded as a truncated unary code or a unary code only for the rearrangement methods (1), (3), and (4).

[0580] For other intra prediction directions, the occurrence probability of the rearrangement method (4) may be low, so the information entropy about the rearrangement method is encoded / decoded as a truncated unary code or a unary code only for the rearrangement methods (1), (2) and (3).

[0581] In the case of inter-frame prediction, the occurrence probabilities of the rearrangement methods (1) to (4) can be considered equal, and information entropy on the rearrangement method can be encoded / decoded as a two-bit fixed-length code.

[0582] Arithmetic coding / decoding may be used for the code. In addition, arithmetic coding using a context model for the code may not be used, and entropy coding / decoding may be performed in bypass mode.

[0583] Transformation / inverse transformation using DST-7 can be performed on a region or CTU within a picture, an entire picture, or a current block within a picture group without flipping, or transformation / inverse transformation can be performed by selecting one of two methods of performing transformation / inverse transformation using DCT-2. In this case, one-bit flag information (transform mode information) indicating whether DST-7 or DCT-2 is used in units of the current block can be entropy encoded / decoded. This method can be used in cases where the distance from the reference sample point is longer and the energy of the residual signal is greater, or it can be used to reduce the computational complexity during encoding and decoding. Information about the area where this method is used can be transmitted by signal in units of CTU, slice, PPS, SPS, or other specific areas, and the one-bit flag can be transmitted by signal in an on / off form.

[0584] For a current block within a region or CTU within a picture, an entire picture, or a group of pictures, a transform / inverse transform can be performed by selecting one of three methods: DCT-2 transform / inverse transform, DST-7 transform / inverse transform without flipping, and DST-7 transform / inverse transform after vertical flipping. Information about which of these three methods is to be selected can be implicitly selected using surrounding information about the current block, and information about which of these three methods is to be selected can be explicitly selected by signaling an index (transform mode information or flipping method information). The index can be signaled as a truncated unary code, with DCT-2 being 0, DST-7 being 10 without flipping, and DST-7 being 11 after vertical flipping. Furthermore, depending on the size of the current block and surrounding information, the binarization of DCT-2 and DST-7 can be interchanged for signaling. Furthermore, the first binary digit of the binary digit can be signaled per CU, and the remaining binary digits can be signaled per TU or PU. Information about the area using this method can be signaled in units of CTU, slice, PPS, SPS, or other specific areas, and a one-bit flag can be signaled in an on / off form.

[0585] For a region or CTU within a picture, a current block within an entire picture or a picture group, a transform / inverse transform can be performed by selecting one of the following four methods: DCT-2 transform / inverse transform, DST-7 transform / inverse transform without flipping, DST-7 transform / inverse transform after horizontal flipping, and DST-7 transform / inverse transform after vertical flipping. The information about which of the four methods will be selected can be implicitly selected using the surrounding information of the current block, and the information about which of the four methods will be selected can be explicitly selected by signaling an index (transform mode information or flipping method information). The index can be signaled as a truncated unary code in the form of 0 for DCT-2, 10 for DST-7 without flipping, 110 for DST-7 after horizontal flipping, and 111 for DST-7 after vertical flipping. In addition, depending on the size of the current block and the surrounding information, the binarization of DCT-2 and DST-7 can be interchanged for signaling. In addition, the first binary number in the binary number can be signaled in units of CUs, and the remaining binary numbers can be signaled in units of TUs or PUs. Depending on the intra-frame prediction mode, only some of the four methods may be used. For example, when the value of the intra-frame prediction mode is less than the value of the diagonal prediction mode, the intra-frame prediction mode is DC mode, or the intra-frame prediction mode is planar mode, only three methods are used: DCT-2, DST-7 without flipping, and DST-7 after vertical flipping. In this case, the transform mode information or flipping method information can be signaled in a manner such that DCT-2 is 0, DST-7 without flipping is 10, and DST-7 after vertical flipping is 11. For example, when the value of the intra-frame prediction mode is greater than the value of the diagonal prediction mode, only three methods are used: DCT-2, DST-7 without flipping, and DST-7 after horizontal flipping. In this case, transform mode information or inversion method information may be signaled in such a manner that DCT-2 is 0, DST-7 without inversion is 10, and DST-7 after horizontal inversion is 11. Information on the area using this method may be signaled in units of CTU, slice, PPS, SPS, or other specific areas, and a one-bit flag may be signaled in an on / off form.

[0586] For a current block within a region or CTU within a picture, an entire picture, or a group of pictures, a transform / inverse transform can be performed by selecting one of the following five methods: DCT-2 transform / inverse transform, DST-7 transform / inverse transform without flipping, DST-7 transform / inverse transform after horizontal flipping, DST-7 transform / inverse transform after vertical flipping, and DST-7 transform / inverse transform after horizontal and vertical flipping. Information about which of the five transform methods will be selected can be implicitly selected using surrounding information of the current block, and information about which of the five transform methods will be selected can be explicitly selected by signaling an index (transform mode information or flipping method information). The index can be signaled as a truncated unary code in the form of 0 for DCT-2, 10 for DST-7 without flipping, 110 for DST-7 after horizontal flipping, 1110 for DST-7 after vertical flipping, and 1111 for DST-7 after horizontal and vertical flipping. Furthermore, depending on the size of the current block and surrounding information, DCT-2 and DST-7 binarization can be interchanged for signaling. Furthermore, the first binary digit in a binary number can be signaled per CU, and the remaining binary digits can be signaled per TU or PU. Furthermore, information can be signaled as a fixed-length code by distinguishing the first, second, and third binary digits in the binary number. For example, transform mode information or flipping method information can be signaled as 0 for DCT-2, 000 for DST-7 without flipping, 001 for DST-7 after horizontal flipping, 010 for DST-7 after vertical flipping, and 011 for DST-7 after both horizontal and vertical flipping. Furthermore, depending on the intra-prediction mode, only some of the five methods may be used. For example, when the intra-prediction mode is a prediction mode close to the horizontal prediction mode, only three transform methods are used: DCT-2, DST-7 without flipping, and DST-7 after vertical flipping. In this case, the transform mode information or the flipping method information may be signaled in such a manner that DCT-2 is 0, DST-7 is 10 in the case of no flipping, and DST-7 is 11 after vertical flipping.

[0587] For example, when the intra prediction mode is a prediction mode close to the vertical prediction mode, only three transform methods are used: DCT-2, DST-7 without flipping, and DST-7 after horizontal flipping. In this case, the transform mode information or flipping method information can be signaled in such a way that DCT-2 is 0, DST-7 without flipping is 10, and DST-7 after horizontal flipping is 11.

[0588] For example, when the intra prediction mode is a prediction mode close to the diagonal prediction mode, only two transform methods are used: DCT-2 and DST-7 in the case of non-inversion. In this case, the transform mode information or the inversion method information can be signaled in such a way that DCT-2 is 0 and DST-7 in the case of non-inversion is 1.

[0589] For example, in cases other than the above three, all five transform methods may be used: DCT-2, DST-7 without flipping, DST-7 after horizontal flipping, DST-7 after vertical flipping, and DST-7 after horizontal and vertical flipping. The index for the transform method may be signaled using a truncated unary code scheme, a fixed-length code scheme, or other schemes.

[0590] For example, when the intra prediction mode is a non-directional mode, all five transform methods are used: DCT-2, DST-7 without flipping, DST-7 after horizontal flipping, DST-7 after vertical flipping, and DST-7 after horizontal and vertical flipping. The index for the transform method can be signaled using a truncated unary code scheme, a fixed-length code scheme, or other schemes.

[0591] For example, when the intra prediction mode is an odd mode, four transform methods are used: DCT-2, DST-7 without flipping, DST-7 after vertical flipping, and DST-7 after horizontal and vertical flipping. In this case, the transform mode information or flipping method information can be signaled in such a manner that DCT-2 is 0, DST-7 without flipping is 10, DST-7 after vertical flipping is 110, and DST-7 after horizontal and vertical flipping is 111.

[0592] For example, when the intra prediction mode is an even mode, four transform methods are used: DCT-2, DST-7 without flipping, DST-7 after horizontal flipping, and DST-7 after vertical flipping. In this case, transform mode information or flipping method information can be signaled in the form of DCT-2 being 0, DST-7 without flipping being 10, DST-7 after horizontal flipping being 110, and DST-7 after vertical flipping being 111. Information about the area where this method is used can be signaled in units of CTU, slice, PPS, SPS, or other specific areas, and a one-bit flag can be signaled in an on / off form.

[0593] Figure 22 and Figure 23 The positions where residual signal rearrangement (residual rearrangement) is performed in the encoder and the decoder according to the present invention are respectively shown.

[0594] Reference Figure 22 , in the encoder, residual signal reordering can be performed before the DST-7 transform process. Figure 22 Although not shown in the figure, in the encoder, residual signal rearrangement may be performed between the transform process and the quantization process, or may be performed after the quantization process.

[0595] Reference Figure 23 , in the decoder, residual signal rearrangement can be performed after the DST-7 inverse transform process. Figure 23 Although not shown in the figure, in the decoder, residual signal rearrangement may be performed between the inverse quantization process and the inverse transform process, or may be performed before the inverse quantization process.

[0596] Referenced above Figures 7 to 23 The SDST method according to the present invention is described. Figure 24 and 25 A decoding method, an encoding method, a decoder, an encoder, and a bit stream to which the SDST method according to the present invention is applied are described in detail.

[0597] Figure 24 is a diagram illustrating an embodiment of a decoding method using an SDST method according to the present invention.

[0598] Reference Figure 24 First, in step S2401, a transformation mode of a current block may be determined, and in step S2402, an inverse transformation may be performed on residual data of the current block according to the transformation mode of the current block.

[0599] Next, in step S2403 , rearrangement may be performed on residual data of the current block on which inverse transformation has been performed according to the transformation mode of the current block.

[0600] Here, the transform mode may include at least one of scrambled discrete sine transform (SDST), scrambled discrete cosine transform (SDCT), discrete sine transform (DST), and discrete cosine transform (DCT).

[0601] The SDST mode may indicate a mode in which inverse transformation is performed in the DST-7 transformation mode and rearrangement is performed on residual data on which the inverse transformation has been performed.

[0602] The SDCT mode may indicate a mode in which inverse transformation is performed in a DCT-2 transform mode and rearrangement is performed on residual data on which the inverse transformation has been performed.

[0603] The DST mode may indicate a mode in which inverse transformation is performed in a DST-7 transformation mode and rearrangement is not performed on residual data on which inverse transformation has been performed.

[0604] The DCT mode may indicate a mode in which inverse transformation is performed in a DCT-2 transform mode and rearrangement is not performed on residual data on which inverse transformation has been performed.

[0605] Therefore, the rearrangement of the residual data is performed only when the transform mode of the current block is one of SDST and SDCT.

[0606] Although it is described that inverse transform is performed in the DST-7 transform mode for the SDST and DST modes as described above, transform modes based on other DSTs such as DST-1, DST-2, etc. may be used.

[0607] In addition, the step of determining the transform mode of the current block in step S2401 may include: obtaining transform mode information of the current block from a bitstream; and determining the transform mode of the current block based on the transform mode information.

[0608] In addition, when determining the transformation mode of the current block in step S2401, the transformation mode of the current block may be determined based on at least one of the prediction mode of the current block, the depth information of the current block, the size of the current block, and the shape of the current block.

[0609] Specifically, when the prediction mode of the current block is the inter prediction mode, one of SDST and SDCT is determined as the transform mode of the current block.

[0610] In addition, the step of rearranging the residual data of the inverse-transformed current block in step S2403 may include: scanning the residual data arranged in the inverse-transformed current block in a sequence along a first direction; and rearranging the residual data scanned in the first direction in the inverse-transformed current block in a sequence along a second direction. Here, the sequence along the first direction may be one of a raster scan sequence, an upper right diagonal scan sequence, a horizontal scan sequence, and a vertical scan sequence. Furthermore, the sequence along the first direction may be defined as follows.

[0611] (1) Scan from top to bottom, and scan from left to right within a row

[0612] (2) Scan from top to bottom and from right to left within a row

[0613] (3) Scan from bottom row to top row, and scan from left to right within a row

[0614] (4) Scan from the bottom row to the top row, and scan from the right to the left within a row

[0615] (5) Scan from left column to right column, and scan from top to bottom within a column

[0616] (6) Scan from left column to right column, and scan from bottom to top within a column

[0617] (7) Scan from the right column to the left column, and scan from top to bottom within a column

[0618] (8) Scan from the right column to the left column, and scan from the bottom to the top within a column

[0619] (9) Scanning in a spiral shape: Scanning from the inside (or outside) of the block to the outside (or inside) of the block, and scanning in a clockwise / counterclockwise direction

[0620] In addition, regarding the order along the second direction, one of the above directions may be selectively used.The first direction and the second direction may be the same, or may be different from each other.

[0621] Furthermore, when the residual data of the current block that has been inversely transformed is rearranged in step S2403, the rearrangement is performed in units of subblocks within the current block. In this case, the residual data may be rearranged based on the positions of the subblocks within the current block. Since the rearrangement of the residual data based on the positions of the subblocks has been described in detail above in Equation 6, a repeated description will be omitted.

[0622] Furthermore, when the residual data of the current block on which the inverse transform has been performed is rearranged in step S2403, the residual data arranged within the current block on which the inverse transform has been performed may be rotated by a predetermined angle for rearrangement.

[0623] Furthermore, when rearranging the residual data of the inverse-transformed current block in step S2403, the residual data arranged within the inverse-transformed current block may be flipped for rearrangement according to a flipping method. In this case, determining the transform mode of the current block in step S2401 may include: obtaining flipping method information from a bitstream; and determining the flipping method of the current block based on the flipping method information.

[0624] Figure 25 is a diagram illustrating an embodiment of an encoding method using an SDST method according to the present invention.

[0625] Reference Figure 25 , in step S2501, the transformation mode of the current block can be determined.

[0626] Next, in step S2502 , residual data of the current block may be rearranged according to a transform mode of the current block.

[0627] Next, in step S2503 , the residual data of the current block rearranged according to the transformation mode of the current block may be transformed.

[0628] Here, the transform mode may include at least one of a random order discrete sine transform (SDST), a random order discrete cosine transform (SDCT), a discrete sine transform (DST), and a discrete cosine transform (DCT). Figure 24 The SDST, SDCT, DST, and DCT modes are described, so repeated descriptions will be omitted.

[0629] In addition, rearrangement of residual data is performed only when the transform mode of the current block is one of SDST and SDCT.

[0630] In addition, when determining the transformation mode of the current block in step S2501, the transformation mode of the current block may be determined based on at least one of the prediction mode of the current block, the depth information of the current block, the size of the current block, and the shape of the current block.

[0631] Here, when the prediction mode of the current block is the inter prediction mode, one of SDST and SDCT is determined as the transform mode of the current block.

[0632] In addition, the step of rearranging the residual data of the current block in step S2502 may include: scanning the residual data arranged in the current block in an order along the first direction; and rearranging the residual data scanned along the first direction in the current block in an order along the second direction.

[0633] In addition, when the residual data of the current block is rearranged in step S2502, the rearrangement is performed in units of sub-blocks within the current block.

[0634] In this case, when the residual data of the current block is rearranged in step S2502 , the residual data may be rearranged based on the positions of the subblocks within the current block.

[0635] In addition, when the residual data of the current block is rearranged in step S2502, the residual data arranged in the current block may be rotated by a predefined angle for rearrangement.

[0636] In addition, when the residual data of the current block is rearranged in step S2502, according to a flipping method, flipping may be performed on the residual data arranged in the current block for rearrangement.

[0637] An image decoder using the SDST method according to the present invention may include an inverse transform module, wherein the inverse transform module determines a transform mode of a current block, performs inverse transform on residual data of the current block according to the transform mode of the current block, and rearranges the residual data of the current block that has been inverse transformed according to the transform mode of the current block. Here, the transform mode may include at least one of a scrambled discrete sine transform (SDST), a scrambled discrete cosine transform (SDCT), a discrete sine transform (DST), and a discrete cosine transform (DCT).

[0638] An image decoder using the SDST method according to the present invention may include an inverse transform module, wherein the inverse transform module determines a transform mode of a current block, rearranges residual data of the current block according to the transform mode of the current block, and performs inverse transform on the residual data of the current block rearranged according to the transform mode of the current block. Here, the transform mode may include at least one of a scrambled discrete sine transform (SDST), a scrambled discrete cosine transform (SDCT), a discrete sine transform (DST), and a discrete cosine transform (DCT).

[0639] An image encoder using the SDST method according to the present invention may include a transform module, wherein the transform module determines a transform mode of a current block, rearranges residual data of the current block according to the transform mode of the current block, and transforms the residual data of the current block rearranged according to the transform mode of the current block. Here, the transform mode may include at least one of a scrambled discrete sine transform (SDST), a scrambled discrete cosine transform (SDCT), a discrete sine transform (DST), and a discrete cosine transform (DCT).

[0640] An image encoder using the SDST method according to the present invention may include a transform module, wherein the transform module determines a transform mode of a current block, transforms residual data of the current block according to the transform mode of the current block, and rearranges the residual data of the current block transformed according to the transform mode of the current block. Here, the transform mode may include at least one of a scrambled discrete sine transform (SDST), a scrambled discrete cosine transform (SDCT), a discrete sine transform (DST), and a discrete cosine transform (DCT).

[0641] The bitstream generated by the encoding method using the SDST method according to the present invention may include: determining a transformation mode of a current block; rearranging residual data of the current block according to the transformation mode of the current block; and transforming the residual data of the current block rearranged according to the transformation mode of the current block, wherein the transformation mode may include at least one of a scrambled discrete sine transform (SDST), a scrambled discrete cosine transform (SDCT), a discrete sine transform (DST) and a discrete cosine transform (DCT).

[0642] Figures 26 to 31 Examples of locations where the flipping method is performed in the encoder and decoder according to the present invention are shown.

[0643] Figure 26 is a diagram illustrating an embodiment of an encoding process in a method of performing transformation after flipping.

[0644] Figure 27 is a diagram illustrating an embodiment of a decoding process in a method of performing flipping after inverse transform.

[0645] Reference Figure 26, the inter-frame or intra-frame prediction signal is subtracted from the original signal for the current block to generate a residual signal, and then DCT-2 transform can be selected as the transform method or flip and DST-7 transform can be selected as the transform method. When the transform method is DCT-2 transform, the residual signal is transformed using DCT-2 transform, thereby generating transform coefficients. When the transform method is flip and DST-7 transform method, one of the four flip methods (no flip, horizontal flip, vertical flip, and horizontal and vertical flip) is selected to flip the residual signal, and then the DST-7 transform is used to transform the residual signal that has been flipped, thereby generating transform coefficients. By performing quantization on the transform coefficients, a quantization level can be generated.

[0646] Reference Figure 27 , receiving the quantization level to perform inverse quantization, thereby generating transform coefficients. A method corresponding to the method selected in the encoding process can be selected from among DCT-2 inverse transform and DST-7 inverse transform and flip. That is, when DCT-2 transform is performed in the encoding process, DCT-2 inverse transform is performed in the decoding process. Furthermore, when flip and DST-7 transform methods are performed in the encoding process, DST-7 inverse transform and flip are performed in the decoding process. When the inverse transform method is DCT-2 inverse transform, the transform coefficients are inverse transformed using the DCT-2 inverse transform, thereby generating a reconstructed residual signal. When the inverse transform method is DST-7 inverse transform and flip, the residual coefficients are inverse transformed using the DST-7 inverse transform to generate a reconstructed residual signal. Then, one of four flip methods (non-flip, horizontal flip, vertical flip, and horizontal and vertical flip) is selected to flip the reconstructed residual signal, thereby generating a flipped and reconstructed residual signal. The inter-frame or intra-frame prediction signal is added to the reconstructed residual signal or to the flipped and reconstructed residual signal to generate a reconstructed signal.

[0647] Figure 28 is a diagram illustrating an embodiment of an encoding process in a method of performing flipping after transformation.

[0648] Figure 29 is a diagram illustrating an embodiment of a decoding process in a method of performing inverse transform after flipping.

[0649] Reference Figure 28, an inter-frame or intra-frame prediction signal is subtracted from the original signal for the current block to generate a residual signal, and then a DCT-2 transform or a DST-7 transform and flipping transform method can be selected as the transform method. When the transform method is the DCT-2 transform, the residual signal is transformed using the DCT-2 transform to generate transform coefficients. When the transform method is the DST-7 transform and flipping method, the residual signal is transformed using the DST-7 transform, and then one of four flipping methods (non-flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) is selected to flip the transform coefficients to generate flipped transform coefficients. Quantization is performed on the transform coefficients or the flipped transform coefficients to generate quantization levels. When flipping is performed on the transform coefficients, the transform coefficients are rearranged. The rearrangement method can be the same as the flipping method, a method of performing a second transform to rotate the axis at the zero point of the transform basis, a method of exchanging the positive and negative signs of the transform coefficients, and so on.

[0650] Reference Figure 29 , receiving the quantization level to perform inverse quantization, thereby generating transform coefficients. A method corresponding to the method selected in the encoding process can be selected from among DCT-2 inverse transform, flipping, and DST-7 inverse transform. That is, when DCT-2 transform is performed in the encoding process, DCT-2 inverse transform is performed in the decoding process. When DST-7 transform and flipping methods are performed in the encoding process, flipping and DST-7 inverse transform are performed in the decoding process. When the inverse transform method is DCT-2 inverse transform, the transform coefficients are inversely transformed using the DCT-2 inverse transform, thereby generating a reconstructed residual signal. When the inverse transform method is flipping and DST-7 inverse transform methods, one of four flipping methods (non-flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) is selected to flip the transform coefficients. The flipped transform coefficients are then inversely transformed using the DST-7 inverse transform, thereby generating a reconstructed residual signal. The inter-frame or intra-frame prediction signal is added to the reconstructed residual signal to generate a reconstructed signal.

[0651] Figure 30 is a diagram illustrating an embodiment of an encoding process in a method of performing flipping after quantization.

[0652] Figure 31 is a diagram illustrating an embodiment of a decoding process in a method of performing inverse quantization after flipping.

[0653] Reference Figure 30, an inter-frame or intra-frame prediction signal is subtracted from the original signal of the current block to generate a residual signal, and then one of a DCT-2 transform and a DST-7 transform can be selected as the transform method. When the transform method is a DCT-2 transform, the residual signal is transformed using the DCT-2 transform to generate transform coefficients. When the transform method is a DST-7 transform, the residual signal is transformed using the DST-7 transform to generate transform coefficients. Quantization of the transform coefficients can be generated to generate quantized levels. In addition, when the transform method is a DST-7 transform, one of four flipping methods (no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) is selected to flip the quantized levels, thereby generating flipped quantized levels. In addition, when the quantized levels are flipped, the quantized levels are rearranged. The rearrangement method can be the same as the flipping method, a method of performing a second transform to rotate the axis at the zero point of the transform basis, a method of exchanging the positive and negative signs of the quantized levels, and so on.

[0654] Reference Figure 31 , receiving a quantization level and selecting an inverse transform method corresponding to the method selected in the encoding process, either an inverse DCT-2 transform or an inverse DST-7 transform. That is, when a DCT-2 transform is performed in the encoding process, an inverse DCT-2 transform is performed in the decoding process. Furthermore, when a DST-7 transform is performed in the encoding process, an inverse DST-7 transform is performed in the decoding process. When the inverse transform method is an inverse DCT-2 transform, the quantized levels are inversely quantized to generate transform coefficients, which are then inversely transformed using an inverse DCT-2 transform to generate a reconstructed residual signal. When the inverse transform method is the inverse DST-7 transform method, one of four flipping methods (non-flip, horizontal flip, vertical flip, and horizontal and vertical flip) is selected to flip the quantized levels, which are then inversely quantized to generate transform coefficients. The transform coefficients are inversely transformed using an inverse DST-7 transform to generate a reconstructed residual signal. The reconstructed residual signal is added to an inter-frame or intra-frame prediction signal.

[0655] Additionally, the position at which the flipping method is performed in the decoder may be determined based on information about the flipping position signaled from the encoder.

[0656] Figure 32 is a diagram illustrating flipping performed on a residual block.

[0657] Reference Figure 32 , at least one of “no flip”, “horizontal flip”, “vertical flip” and “horizontal and vertical flip” can be performed on the residual block. Figure 32 As shown, the positions of samples within the residual block may vary depending on the flipping type.

[0658] Figure 33 FIG. 1 is a diagram illustrating an embodiment for implementing flipping of a residual block having a size of 8×8 as hardware.

[0659] Reference Figure 33 In the hardware implementation of vertical flipping of an M×N residual block, the M×N block is vertically flipped by changing the address value (addr) used to read data from the residual block memory to M-1-addr. That is, instead of performing a vertical flip operation, the memory row address of the M×N block is changed to read the data within the residual block, thereby achieving vertical flipping.

[0660] In the hardware implementation of horizontally flipping an M×N residual block, the M×N block is horizontally flipped by reading the data values ​​in the residual block memory in reverse order. That is, instead of performing a horizontal flip, the order in which the data values ​​for the M×N block are read is changed to achieve horizontal flipping. For example, when the data a, b, c, d, e, f, g, and h are stored in the memory in this order, the data values ​​h, g, f, e, d, c, b, and a are read in this order to perform a horizontal flip.

[0661] Figure 34 is a diagram illustrating flipping and transforming performed on a residual block.

[0662] Reference Figure 34 , at least one of “No-Flip”, “Horizontal Flip (H-Flip)”, “Vertical Flip (V-Flip)”, and “Horizontal and Vertical Flip (HV-Flip)” may be performed on the residual block, and a DST-7 transform may be performed. Figure 34 As shown in , the positions of samples within the residual block may vary depending on the flipping type, and a DST-7 transform may be performed.

[0663] An example of using an Adaptive Multiple Transform (AMT) method is shown below, in which at least one of the transforms used in this specification is used.

[0664] The AMT set can be constructed using at least one of the transforms used in the specification. For example, in addition to transforms such as DCT-2, DCT-5, DCT-8, DST-1, DST-7, etc., at least one transform for each block encoded / decoded in intra-frame and inter-frame can be added to the AMT transform set. Specifically, DST-4 and the identity transform can be added to the AMT transform set for blocks encoded / decoded in inter-frame, and KLT-1 and KLT-2 can be added to the AMT transform set for blocks encoded / decoded in intra-frame.

[0665] Transforms corresponding to blocks of sizes other than powers of 2, such as 4×24 and 8×48, may be added. For example, in an intra encoding / decoding process, seven transform sets each having four transform pairs may be defined as shown in Table 14 below.

[0666] [Table 14]

[0667]

[0668] In Table 14, the first item in a transform pair may refer to a transform in the vertical direction, and the second item may refer to a transform in the horizontal direction. The transform pair sets in Table 14 may be defined by assigning each of the seven transform sets based on different intra prediction modes and different block sizes. In Table 14, T0 to T6 may represent available transform pair sets corresponding to respective block sizes. For example, T0 may be used for a 2×2 block size, T1 may be used for a 4×4 block size, T2 may be used for an 8×8 block size, T3 may be used for a 16×16 block size, T4 may be used for a 32×32 block size, T5 may be used for a 64×64 block size, and T6 may be used for a 128×128 block size. An identity transform may be applied to blocks of a size not exceeding 16×16. Furthermore, an identity transform may be applied to blocks in a mode that approximates the horizontal and vertical intra prediction directions. The mode that approximates the horizontal and / or vertical intra prediction directions may be defined based on a threshold value of the block size. For example, when the transform index is 3 and the block satisfies the above conditions, a horizontal and / or vertical identity transform is applied.

[0669] In addition, during inter-frame encoding / decoding processing, two transform sets each having four transform pairs may be defined as shown in Table 15 below.

[0670] [Table 15]

[0671] <![CDATA[T 0,inter ]]> {(DCT-8,DCT-8),(DCT-8,DST-7),(DST-7,DCT-8),(DST-7,DST-7)} <![CDATA[T 1,inter ]]> {(KLT-1,KLT-1),(KLT-1,KLT-2),(KLT-2,KLT-1),(KLT-2,KLT-2)}

[0672] In Table 15, T0 and T1 may represent a set of available transform pairs corresponding to a block size. For example, in Table 15, a transform set including KLT (ie, T 1,inter ) can be applied to blocks of size equal to or less than 16×16, and T 0,inter It can be applied to blocks larger than 16×16. In addition, a method can be used to approximate the AMT transform using only the DCT-2 transform and the adjustment step. The adjustment step can be defined using a block-band orthogonal matrix used to transform the DCT-2 transform into a form similar to the AMT transform.

[0673] The primary transform set used for AMP used in this specification may be composed of DCT-2, DCT-8, DST-4, DST-7 transforms, etc., and the primary transform set may be composed of DCT-8, DST-4, and DST-7 transforms. In addition, the DST-7 transform matrix can be implemented by performing flipping, sign change, etc. based on the DCT-8 transform matrix.

[0674] For example, the transform is used to construct a two-dimensional transform set (ie, horizontal and vertical transforms) to use the result in inter-frame encoding / decoding processing. During intra-frame encoding / decoding processing, a two-dimensional transform set as shown in Table 16 below can be used.

[0675] [Table 16]

[0676]

[0677] Table 16 shows the transform sets of vertical and horizontal transforms for each prediction mode (predModIdx) and each transform index (TrIdx). In addition, the AMT transform set can be replaced by a transform set using DCT-8 and DST-7.

[0678] Furthermore, when the horizontal or vertical size of a block exceeds 32 pixels, AMT transform is not applied to the block, and at least one of AMT transform usage information (AMT flag) and transform index information (AMT index) is not signaled to the decoder.

[0679] The transform matrices for DCT-8, DST-1, and DCT-5 included in the AMT transform set used in this specification can be replaced by other transform matrices. A flipped DST-7 can be used instead of DCT-8. DST-6 can be used instead of DST-1. DCT-2 can be used instead of DCT-5.

[0680] As shown in Equation 7 below, the transformation matrices for flipped DST-7 and DST-6 can be derived from DST-7.

[0681] [Equation 7]

[0682] Flipped DST-7:

[0683] DST-6:

[0684] here, Represents the lth component of the kth basis vector in the N×N transformation matrix of DST-7.

[0685] Furthermore, AMT transforms including transform matrices of DCT-8, DST-1, and DCT-5 may be applied to both luma and chroma components.

[0686] The transform for the luma component may be determined based on a mode-dependent transform set and an explicitly signaled AMT index indicating the horizontal and vertical transforms.

[0687] In case of chroma components / intra mode, transform may be determined in the same manner as a method of determining transform for luma components, and the number of transform candidates may be smaller than that for luma components.

[0688] In case of chroma component / inter mode, the transform may be determined by a one-bit flag indicating whether the AMT index is the same as the co-located block of the luma component or the default transform (DCT-2×DCT-2).

[0689] In addition, AMT can select horizontal transform and vertical transform among DCT-2, DST-7 and flipped DST-7 (FDST-7). In addition, an AMT flag can be defined. When the AMT flag is zero, it indicates that DCT-2 is used for both horizontal transform and vertical transform. When the AMT flag is 1, it indicates that another transform is used according to the AMT index. AMT is allowed only when the width and height of the block are both equal to or less than 64. The AMT flag can be determined by the intra-frame prediction mode. In the even intra-frame prediction mode, the AMT flag can be implicitly assigned to 1. In the odd intra-frame prediction mode, the AMT flag can be implicitly assigned to 0. In addition, in the odd intra-frame prediction mode, the AMT flag can be implicitly assigned to 1. In the even intra-frame prediction mode, the AMT flag can be implicitly assigned to 0.

[0690] A transform set with two additional transforms, DST-7 and DCT-8, can be used, and the maximum block size to which AMT is applied can be limited to 32×32. A forward N×N DST-7 with a discrete Fourier transform (DFT) of length 2N+1 can be implemented to obtain an N×N DST-7. The 2N+1 FFT can be reconstructed as a two-dimensional FFT. DCT-8 can be derived from DST-7 by performing a sign change and reordering immediately before and after the DST-7 calculation. Therefore, DST-7 can be reused to implement DCT-8.

[0691] The transform or inverse transform of the current block may be performed only on subblocks within the current block. For example, the subblock may be the subblock at the upper left position in the current block. The horizontal length (width) and vertical length (height) of the subblock may be determined independently. For example, the horizontal length (width) (or vertical length (height)) of the subblock may be determined based on the type of transform kernel used for the horizontal transform or inverse transform (or vertical transform or inverse transform). For example, when the transform kernel used for the horizontal transform or inverse transform is DCT-2, the horizontal length (width) is 32 samples. For example, when the transform kernel used for the horizontal transform or inverse transform is not DCT-2 but, for example, DST-7 or DCT-8, the horizontal length (width) is 16 samples. Similarly, when the transform kernel used for the vertical transform or inverse transform is DCT-2, the vertical length (height) is 32 samples. For example, when the transform kernel used for the vertical transform or inverse transform is not DCT-2 but, for example, DST-7 or DCT-8, the vertical length (height) is 16 samples. Furthermore, since a subblock cannot be larger than the current block, when the length of the current block is shorter than the derived subblock length (e.g., 32 samples or 16 samples), the length of the block on which the transform or inverse transform is performed is determined to be the length of the current block. Transformation or inverse transformation may not be performed on samples in an area within the current block that are not included in the subblock. All sample values ​​of the samples may be set to "zero." Here, the subblock may include a residual signal that is the difference between the input signal and the prediction signal, or may include transform coefficients generated by transforming the residual signal.

[0692] In the intra-frame and inter-frame encoding / decoding processes, the AMT transform can be determined implicitly.

[0693] Intra prediction mode-dependent transformations of the luma component and chroma component may be represented as shown in the following Table 17 and Table 18, respectively.

[0694] [Table 17]

[0695]

[0696]

[0697] [Table 18]

[0698] Intra prediction mode Horizontal Transform Vertical Transformation Block size limit LM mode DST-7 DST-7 Width <= 8 && Height <= 8 flat DST-7 DST-7 Width <= 16 && Height <= 16 level DST-7 DCT-2 Width <= 16 && Height <= 32 Vertical, VDIA DCT-2 DST-7 Width <= 32 && Height <= 16

[0699] Here, Table 17 shows a transform mapping table for the luma component, and Table 18 shows a transform mapping table for the chroma component. In addition, a position-dependent transform may be used for the residual signal in merge mode. The transform of the residual signal in merge mode may vary depending on the spatial motion vector predictor (MVP) candidate used for motion compensation of the current block.

[0700] Table 19 below shows a mapping table between MVP positions and transformations.

[0701] [Table 19]

[0702] MVP position Horizontal Transform Vertical Transformation Block size limit L (left) DST-7 DCT-2 Width <= 32 && Height <= 32 A(above) DCT-2 DST-7 Width <= 32 && Height <= 32

[0703] In Table 19, for the left MVP candidate, DST-7 and DCT-2 can be used as the horizontal transform and vertical transform, respectively. In addition, for the upper MVP candidate, DCT-2 and DST-7 can be used as the horizontal transform and vertical transform, respectively. In other cases, DCT-2 can be used as the default transform. Entropy encoding / decoding can be performed on transform usage information in which AMT transform usage information (primary transform) and non-separable secondary transform (NSST) usage information (secondary transform) are combined. The use of AMT and NSST can be represented by a single transform index, and the primary transform and secondary transform can be combined by one transform index for signal transmission instead of separately signaling the indices of the primary transform and secondary transform. In addition, the combined transform index can be used for both the luminance component and the chrominance component.

[0704] In addition, the transform used in the specification can be selected from N predefined transform candidate sets for each block. Here, N can be a positive integer. Each of the transform candidates can specify a primary horizontal transform, a primary vertical transform, and a secondary transform (which can be the same as the identity transform). The list of transform candidates can vary depending on the block size and prediction mode. The selected transform can be signaled as follows. When the coding block flag is 1, a flag indicating whether the first transform in the candidate list is used is sent. When the flag indicating whether the first transform in the candidate list is used is 0, the following applies: when the number of non-zero transform coefficient levels is greater than a threshold, a transform index indicating the transform candidate used is sent; otherwise, the second transform in the list is used.

[0705] In addition, NSST as a secondary transform is used only when DCT-2 as a primary transform is used as a default transform. In addition, regarding horizontal transform or vertical transform, when the width or height is independently equal to or less than 4, DST-7 is selected without being signaled.

[0706] In addition, an AMT flag is signaled when the number of non-zero transform coefficients is greater than a threshold. In the case of inter blocks, the threshold may be set to 2. In the case of intra blocks, the threshold may be set to 0. When the number of non-zero transform coefficients is greater than 2, an AMT index is signaled. Otherwise, the threshold is estimated to be 0. In the case of NSST, for blocks of intra luma components, when the sum of the number of non-zero transform coefficients of the upper left 8×8 or 4×4 luma component and the number of non-zero AC coefficients of the upper left 8×8 or 4×4 chroma component is greater than 2, an NSST index is signaled.

[0707] Regarding the residual block, when the width of the block is equal to or less than K, DST-7 is used instead of DST-2 for one-dimensional horizontal transform. When the height of the block is equal to or less than L, DST-7 is used instead of DCT-2 for one-dimensional vertical transform. In addition, even if the width or height of the block is equal to or less than K, DCT-2 is used when the intra prediction mode is the linear model (LM) chroma mode. Here, K and L can be positive integers, for example, 4. In addition, K and L can be the same or can have different values. In addition, the residual block can be a block encoded in intra mode. In addition, the residual block can be a chroma block.

[0708] As an alternative to performing a flipping method on the residual signal, a transform kernel or transform matrix that has been flipped can be used to perform transformation / inverse transformation. Here, the transform kernel or transform matrix that has been flipped can be a kernel or matrix that has been flipped and predefined in the encoder / decoder. In this case, since the transform / inverse transform matrix that has been flipped is used to perform transformation / inverse transformation, the same effect as flipping the residual signal can be obtained. Here, flipping can be at least one of no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping. In this case, information about whether to use the transform / inverse transform that has been flipped can be transmitted by a signal. In addition, information about whether to use the transform / inverse transform that has been flipped can be transmitted by a signal for each of the transform / inverse transform in the horizontal direction and the transform / inverse transform in the vertical direction.

[0709] Furthermore, as an alternative to performing a flipping method on the residual signal, the transform kernel or transform matrix may be flipped during the encoding / decoding process to perform the transform / inverse transform. In this case, since the transform / inverse transform matrix is ​​flipped to perform the transform / inverse transform, the same effect as flipping the residual signal can be achieved. Here, the flipping may be at least one of non-flipping, horizontal flipping, vertical flipping, or horizontal and vertical flipping. In this case, information regarding whether the transform / inverse transform matrix is ​​flipped may be transmitted using a signal. Furthermore, information regarding whether the transform / inverse transform matrix is ​​flipped may be transmitted using a signal for each of the horizontal transform / inverse transform and the vertical transform / inverse transform.

[0710] When a flipping method is determined based on an intra prediction mode and two or more intra prediction modes of a current block are used, flipping is performed before / after transformation / inverse transformation of the current block as a flipping method for a non-directional mode.

[0711] In addition, when a flipping method is determined based on an intra prediction mode and two or more intra prediction modes of a current block are used, flipping is performed before / after transformation / inverse transformation of the current block as a flipping method of a main direction mode. Here, the main direction mode may be at least one of a vertical mode, a horizontal mode, and a diagonal mode.

[0712] When the size of the transform is equal to or greater than M×N, all transform coefficients existing in the region of M / 2 to M and N / 2 to N are set to 0 values ​​during or after the transform. Here, M and N may be positive integers, for example, 64.

[0713] In order to reduce memory requirements, a right shift by K may be performed on the transform coefficients generated after the transform is performed. In addition, a right shift by K may be performed on the temporary transform coefficients generated after the horizontal transform is performed. In addition, a right shift by K may be performed on the temporary transform coefficients generated after the vertical transform is performed. Here, K is a positive integer.

[0714] In order to reduce memory requirements, a right shift of K may be performed on the reconstructed residual signal generated after performing the inverse transform. In addition, a right shift of K may be performed on the temporary transform coefficients generated after performing the horizontal inverse transform. In addition, a right shift of K may be performed on the temporary transform coefficients generated after performing the vertical inverse transform. Here, K is a positive integer.

[0715] At least one of the flipping methods may be performed on at least one of the signals generated before horizontal transformation / inverse transformation, after horizontal transformation / inverse transformation, before vertical transformation / inverse transformation, and after vertical transformation / inverse transformation. In this case, information on the flipping method used in the horizontal transformation / inverse transformation or the vertical transformation / inverse transformation may be transmitted using a signal.

[0716] In addition, DCT-4 can be used instead of DST-7. N Extract the DCT-2 transform / inverse transform matrix of size 2 N-1 The DCT-4 transform / inverse transform matrix of the same size is used, so only the DCT-2 transform / inverse transform matrix is ​​stored in the encoder / decoder instead of the DCT-4, thereby reducing the memory requirements of the encoder / decoder. N Size DCT-2 transform / inverse transform logic uses 2 N-1The DCT-4 transform / inverse transform logic of the same size is used, thereby reducing the chip area required to implement the encoder / decoder. Here, the above example is not only applicable to DCT-2 and DCT-4, but also applies when there is a transform matrix or transform logic shared between at least one of the types of DST transform / inverse transform and at least one of the types of DCT transform / inverse transform. That is, another transform / inverse transform matrix or logic can be extracted from one transform / inverse transform matrix or logic for use. In addition, in the case of a specific transform / inverse transform size, another transform / inverse transform matrix or logic can be extracted from one transform / inverse transform matrix or logic for use. In addition, another transform / inverse transform matrix can be extracted from one transform / inverse transform matrix using at least one of a matrix unit, a base vector unit, and a matrix coefficient unit.

[0717] Furthermore, when the current block is smaller than an M×N size, another transform / inverse transform is used as a replacement for the specific transform / inverse transform for the current block. Furthermore, when the current block is larger than an M×N size, another transform / inverse transform is used as a replacement for the specific transform / inverse transform for the current block. Here, M and N are positive integers. The specific transform / inverse transform and the another transform / inverse transform may be transforms / inverse transforms predefined in the encoder / decoder.

[0718] Furthermore, at least one of the transforms of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. used in this specification may be replaced by at least one transform calculated based on a transform of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. Here, the calculated transform may be a transform calculated by modifying coefficient values ​​within a transform matrix of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. Furthermore, the coefficient values ​​within the transform matrix of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. may have integer values. In other words, the transform of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. may be an integer transform. Furthermore, the coefficient values ​​within the calculated transform matrix may have integer values. In other words, the calculated transform may be an integer transform. Furthermore, the calculated transform may be the result of performing a left shift by N on coefficient values ​​within a transform matrix of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. Here, N may be a positive integer.

[0719] DCT-Q and DST-W transforms may include DCT-Q and DST-W transforms and DCT-Q and DST-W inverse transforms. Here, Q and W may have positive integers of 1 or greater, and for example, the numbers 1 to 9 may have the same meanings as Roman numerals I to IX.

[0720] In addition, the transforms of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. used in this specification are not limited thereto, and at least one of the DCT-Q transform and the DST-W transform may be used by replacing the transforms of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7. Here, Q and W may have positive integers of 1 or greater, and, for example, the numbers 1 to 9 may have the same meanings as Roman numerals I to IX.

[0721] Furthermore, in the case of square blocks, the transform used in this specification may be performed in a square transform form. In the case of non-square blocks, the transform may be performed in a non-square transform form. In the case of a square-shaped region including at least one of a square block and a non-square block, the transform may be performed on the region in a square transform form. In the case of a non-square-shaped region including at least one of a square block and a non-square block, the transform may be performed on the region in a non-square transform form.

[0722] Furthermore, in this specification, the information on the rearrangement method may be inversion method information.

[0723] In addition, transform used in this specification may mean at least one of transform and inverse transform.

[0724] The encoder may perform transform on the residual block to generate transform coefficients, quantize the transform coefficients to generate quantized coefficient levels, and entropy encode the quantized coefficient levels in order to improve subjective / objective image quality of an image.

[0725] The decoder may entropy decode the quantized coefficient levels, dequantize the quantized coefficient levels to generate transform coefficients, and inverse transform the transform coefficients to generate a reconstructed residual block.

[0726] Transform type information regarding which transform is used as transform and inverse transform may be explicitly entropy encoded / decoded. Alternatively, transform type information regarding which transform is used as transform and inverse transform may be implicitly determined based on at least one encoding parameter without entropy encoding / decoding.

[0727] Hereinafter, embodiments of an image encoding / decoding method and apparatus for performing at least one of transformation or inverse transformation and a recording medium for storing a bit stream in the present invention will be described.

[0728] Using at least one of the following embodiments, a block may be partitioned into N sub-blocks, and at least one of prediction, transform / inverse transform, quantization / dequantization, or entropy encoding / decoding may be performed. This mode may be referred to as a first sub-block partitioning mode (e.g., ISP mode or intra-frame sub-partitioning mode).

[0729] A block may represent a coding block, a prediction block, or a transform block. For example, a block may be a transform block.

[0730] In addition, the sub-block of the partition may represent at least one of a coding block, a prediction block, or a transform block. For example, the sub-block of the partition may be a transform block.

[0731] In addition, the block or sub-block of the partition may be at least one of an intra block, an inter block, or an intra block copy block. For example, the block and the sub-block may be intra blocks.

[0732] In addition, the block or subblock of the partition may be at least one of an intra-prediction block, an inter-prediction block, or an intra-block copy prediction block. For example, the block and subblock may be an intra-prediction block.

[0733] In addition, the block or sub-block of the partition may be at least one of a luminance signal block or a chrominance signal block. For example, the block and the sub-block may be a luminance signal block.

[0734] When a block is partitioned into N subblocks, the block before the partition can be a coding block, and the subblocks of the partition can be at least one of a prediction block or a transform block. That is, prediction, transform / inverse transform, quantization / dequantization, and entropy encoding / decoding of transform coefficients can be performed using the subblock size of the partition.

[0735] In addition, when a block is partitioned into N sub-blocks, the block before the partition can be at least one of a coding block or a prediction block, and the sub-blocks of the partition can be transform blocks. That is, prediction can be performed using the size of the block before the partition, and transform coefficients can be transformed / inversely transformed, quantized / dequantized, and entropy encoded / decoded using the size of the sub-blocks of the partition.

[0736] Whether to partition a block into a plurality of sub-blocks may be determined based on at least one of an area (the product of width and height, etc.), a size (width, height, or a combination of width or height), and a shape / form (rectangular (non-square), square, etc.) of the block.

[0737] For example, when the current block is a 64×64 block, the current block may be partitioned into a plurality of sub-blocks.

[0738] As another example, when the current block is a 32×32 block, the current block may be partitioned into a plurality of sub-blocks.

[0739] As another example, when the current block is a 32×16 block, the current block may be partitioned into a plurality of sub-blocks.

[0740] As another example, when the current block is a 16×32 block, the current block may be partitioned into a plurality of sub-blocks.

[0741] As another example, when the current block is a 4×4 block, the current block may not be partitioned into a plurality of sub-blocks.

[0742] As another example, when the current block is a 2×4 block, the current block may not be partitioned into a plurality of sub-blocks.

[0743] As another example, when the area of ​​the current block is equal to or greater than 32, the current block may be partitioned into a plurality of sub-blocks.

[0744] As another example, when the area of ​​the current block is less than 32, the current block may not be partitioned into a plurality of sub-blocks.

[0745] As another example, when the area of ​​the current block is 256 and the shape of the current block is rectangular, the current block may be partitioned into a plurality of sub-blocks.

[0746] As another example, when the area of ​​the current block is 16 and the shape of the current block is a square, the current block may not be partitioned into a plurality of sub-blocks.

[0747] When partitioning a block, the block may be partitioned into a plurality of sub-blocks along at least one partitioning direction of a vertical direction or a horizontal direction.

[0748] For example, the current block may be partitioned into two sub-blocks along a vertical direction.

[0749] As another example, the current block may be partitioned into two sub-blocks along the horizontal direction.

[0750] As another example, the current block may be partitioned into four sub-blocks along the horizontal direction.

[0751] As another example, the current block may be partitioned into four sub-blocks along the vertical direction.

[0752] When a block is partitioned into N sub-blocks, N may be a positive integer, and for example, may be 2 or 4. In addition, N may be determined using at least one of an area, a size, a shape, or a partition direction of the block.

[0753] For example, when the current block is a 4×8 or 8×4 block, the current block may be partitioned into two sub-blocks in a horizontal direction or in a vertical direction.

[0754] As another example, when the current block is a 16×8 or 16×16 block, the current block may be partitioned into four sub-blocks in a vertical direction or in a horizontal direction.

[0755] As another example, when the current block is an 8×32 or 32×32 block, the current block may be partitioned into four sub-blocks in a horizontal direction or in a vertical direction.

[0756] As another example, when the current block is a 16×4, 32×4, or 64×4 block, the current block may be partitioned into four sub-blocks in the vertical direction. In addition, when the current block is a 16×4, 32×4, or 64×4 block, the current block may be partitioned into two sub-blocks in the horizontal direction.

[0757] As another example, when the current block is a 4×16, 4×32, or 4×64 block, the current block may be partitioned into four sub-blocks in the horizontal direction. In addition, when the current block is a 4×16, 4×32, or 4×64 block, the current block may be partitioned into two sub-blocks in the vertical direction.

[0758] As another example, when the current block is a J×4 block, the current block may be partitioned into two sub-blocks along the horizontal direction. Here, J may be a positive integer.

[0759] As another example, when the current block is a 4×K block, the current block may be partitioned into two sub-blocks along a vertical direction.Here, J may be a positive integer.

[0760] As another example, when the current block is a J×K (K>4) block, the current block may be partitioned into four sub-blocks along the horizontal direction. Here, J may be a positive integer.

[0761] As another example, when the current block is a J×K (J>4) block, the current block may be partitioned into four sub-blocks along a vertical direction. Here, J may be a positive integer.

[0762] As another example, when the current block is a J×K (K>4) block, the current block may be partitioned into four sub-blocks along a vertical direction. Here, J may be a positive integer.

[0763] As another example, when the area of ​​the current block is 64, the current block may be partitioned into four sub-blocks along a horizontal direction or a vertical direction.

[0764] As another example, when the current block is a 16×4 block and the shape of the current block is rectangular, the current block may be partitioned into four sub-blocks along a vertical direction.

[0765] As another example, when the area of ​​the current block is 1024 and the shape of the current block is a square, the current block may be partitioned into four sub-blocks in a horizontal direction or a vertical direction.

[0766] Additionally, the sub-block may have at least one of a minimum area, a minimum width, or a minimum height.

[0767] For example, the sub-block may have a minimum area of ​​S. Here, S may be a positive integer, and may be 16, for example.

[0768] As another example, the sub-block may have a minimum width of J. Here, J may be a positive integer, and may be 4, for example.

[0769] As another example, the sub-block may have a minimum height of K. Here, K may be a positive integer, and may be 4, for example.

[0770] In each partitioned subblock, a reconstructed block can be generated by adding the residual block (or reconstructed residual block) to the prediction block. Here, at least one reconstructed sample in each reconstructed subblock can be used as a reference sample in intra-frame prediction of the subblock to be encoded / decoded later.

[0771] An encoding / decoding order of subblocks partitioned from a block may be determined according to at least one of partition directions.

[0772] For example, the encoding / decoding order of the sub-blocks partitioned horizontally may be determined as an order from an upper direction to a lower direction.

[0773] As another example, the encoding / decoding order of the vertically partitioned sub-blocks may be determined as an order from the left direction to the right direction.

[0774] For the partitioned sub-blocks, the intra prediction mode can be shared and used.

[0775] At this time, information about the intra prediction mode for each subblock may be entropy encoded / decoded only once in the block before partitioning.

[0776] For the partitioned sub-blocks, the intra block copy mode can be shared and used.

[0777] At this time, information about the intra-block copy mode for each sub-block may be entropy encoded / decoded only once in the block before partitioning.

[0778] In order to indicate a subblock partition mode in which a block is partitioned into N subblocks and at least one of prediction, transformation / inverse transformation, quantization / dequantization, or entropy encoding / decoding is performed, at least one of subblock partition mode information or partition direction information may be entropy encoded / decoded.

[0779] Here, the subblock partition mode information may be used to indicate the subblock partition mode. When it is indicated that the subblock partition mode is used (the second value), the block may be partitioned into subblocks, and at least one of prediction, transform / inverse transform, quantization / inverse quantization, or entropy encoding / decoding may be performed. When it is indicated that the subblock partition mode is not used (the first value), the block may not be partitioned into subblocks, and at least one of prediction, transform / inverse transform, quantization / inverse quantization, or entropy encoding / decoding may be performed. Here, the first value may be 0, and the second value may be 1.

[0780] In addition, the partition direction information may be used to indicate whether the sub-block partition mode is vertical partitioning or horizontal partitioning. When the partition direction information has a first value, the block may be partitioned in the horizontal direction, and the first value may be 0. In addition, when the partition direction information has a second value, the block may be partitioned in the vertical direction, and the second value may be 1.

[0781] When the current block does not use the closest reference sample line (the first reference sample line) as a reference sample row, at least one of the subblock partition mode information or the partition direction information may not be entropy encoded / decoded. In this case, it can be inferred from the subblock partition mode information that the current block is not partitioned into subblocks.

[0782] Here, the fact that the current block does not use the closest reference sample line (the first reference sample line) as a reference sample line may mean that a second or greater reference sample line may be used as a reconstruction reference sample line around the current block.

[0783] That is, only when the current block uses the closest reference sample line as a reference sample line, at least one of the subblock partition mode information or the partition direction information may be entropy encoded / decoded.

[0784] At least one of the area, size, shape, or partition direction of a coefficient group used during entropy encoding / decoding of a transform coefficient may be determined based on at least one of the area, size, shape, or partition direction of a subblock.

[0785] For example, when the area of ​​the subblock is 16, the area of ​​the coefficient group may be determined to be 16.

[0786] As another example, when the area of ​​the subblock is 32, the area of ​​the coefficient group may be determined to be 16.

[0787] As another example, when the size of the subblock is 1×16 or 16×1, the size of the coefficient group may be determined to be 1×16 or 16×1.

[0788] As another example, when the size of the subblock is 2×8 or 8×2, the size of the coefficient group may be determined to be 2×8 or 8×2.

[0789] As another example, when the size of the subblock is 4×4, the size of the coefficient group may be determined to be 4×4.

[0790] As another example, when the width of the subblock is 2, the width of the coefficient group may be determined to be 2.

[0791] As another example, when the width of the subblock is 4, the width of the coefficient group may be determined to be 4.

[0792] As another example, when the height of the subblock is 2, the height of the coefficient group may be determined to be 2.

[0793] As another example, when the height of the subblock is 4, the height of the coefficient group may be determined to be 4.

[0794] As another example, when the shape of the subblock is rectangular (not square), the shape of the coefficient group may be determined to be rectangular (not square).

[0795] As another example, when the shape of the subblock is a square, the shape of the coefficient group may be determined to be a square.

[0796] As another example, when the size of the subblock is 16×4 and its form is rectangular, the size of the coefficient group may be determined to be at least one of 4×4 or 8×2.

[0797] As another example, the size of the subblock is 4×8 and its form is rectangular, the size of the coefficient group may be determined to be at least one of 4×4 or 2×8.

[0798] As another example, the size of the subblock is 32×4 and has a rectangular form, and the size of the coefficient group may be determined to be at least one of 4×4 or 8×2.

[0799] As another example, the size of the subblock is 8×64 and has a rectangular form, and the size of the coefficient group may be determined to be at least one of 4×4 or 2×8.

[0800] As another example, the size of the subblock is 16×4 and the partition direction is the vertical direction, the size of the coefficient group may be determined to be 4×4.

[0801] As another example, the size of the subblock is 4×8 and the partition direction is the horizontal direction, the size of the coefficient group may be determined to be 4×4.

[0802] As another example, the size of the subblock is 32×4 and the partition direction is the horizontal direction, the size of the coefficient group may be determined to be 8×2.

[0803] As another example, the size of the subblock is 8×64 and the partition direction is the vertical direction, the size of the coefficient group may be determined to be 2×8.

[0804] For each partitioned sub-block, entropy encoding / decoding may be performed on a coding block flag indicating whether at least one transform coefficient having a non-zero value exists in the sub-block unit.

[0805] For example, the coding block flag may indicate that at least one transform coefficient having a non-zero value exists in at least one subblock in the subblock unit.

[0806] As another example, when m represents the total number of subblocks and the coding block flags of the m-1 subblocks from the front of the subblock indicate that there are no transform coefficients having non-zero values, it can be inferred that the coding block flag of the m-th subblock indicates that there are at least one transform coefficient having a non-zero value.

[0807] As another example, when the coded block flag is entropy encoded / decoded in a sub-block unit, the coded block flag may be entropy encoded / decoded in a block unit before partitioning.

[0808] As another example, when the coded block flag is entropy encoded / decoded in units of blocks before partitioning, the coded block flag may not be entropy encoded / decoded in units of subblocks.

[0809] In addition, when the current block is in the first subblock partition mode and the size of the current block is a predefined size, the size of the subblock used for intra prediction and the size of the subblock used for transform may be different from each other. That is, the subblock partition used for intra prediction and the subblock partition used for transform may be different from each other. Here, the predefined size may be 4×N or 8×N (N>4). Here, the subblock partition may represent a vertical partition.

[0810] For example, when the current block is in the first subblock partition mode and the size of the current block is 4×N (N>4), the current block may be vertically partitioned into subblocks of size 4×N for intra prediction, and the current block may be vertically partitioned into subblocks of size 1×N for transform. In this case, a one-dimensional transform / inverse transform may be performed to perform a transform of size 1×N. That is, a one-dimensional transform / inverse transform may be performed based on at least one of the partition mode of the current block or the size of the current block.

[0811] As another example, when the current block is in the first subblock partition mode and the size of the current block is 8×N (N>4), the current block may be vertically partitioned into subblocks of size 4×N for intra prediction, and the current block may be vertically partitioned into subblocks of size 2×N for transform. In this case, a two-dimensional transform / inverse transform may be performed to perform a transform of size 2×N. That is, a two-dimensional transform / inverse transform may be performed based on at least one of the partition mode of the current block or the size of the current block.

[0812] Here, N may represent a positive integer, and may be a positive integer smaller than 64 or 128.

[0813] In addition, the size of the current block may mean at least one of the size of a coding block, the size of a prediction block, or the size of a transform block of the current block.

[0814] As in Figure 35 In the example, according to an embodiment of the first subblock partitioning mode, the current block may be partitioned into two subblocks along a horizontal direction, and the current block may be partitioned into two subblocks along a vertical direction.

[0815] As in Figure 36 In the example, according to an embodiment of the first subblock partitioning mode, the current block may be partitioned into two subblocks along a horizontal direction, and the current block may be partitioned into two subblocks along a vertical direction.

[0816] As in Figure 37 In the example, according to an embodiment of the first subblock partitioning mode, the current block may be partitioned into four subblocks along a horizontal direction, and the current block may be partitioned into four subblocks along a vertical direction.

[0817] Using at least one of the following embodiments, a block may be partitioned into N sub-blocks to perform at least one of transform / inverse transform, quantization / dequantization, or entropy encoding / decoding. Such a mode may be referred to as a second sub-block partitioning mode (e.g., SBT mode or sub-block transform mode).

[0818] A block may represent at least one of a coding block, a prediction block, or a transform block. For example, a block may be a transform block.

[0819] In addition, the partitioned sub-blocks may represent at least one of a coding block, a prediction block, or a transform block. For example, the partitioned sub-blocks may be transform blocks.

[0820] In addition, the block or the sub-block obtained by partitioning may be at least one of an intra block, an inter block or an intra block copy block. For example, the block or the sub-block obtained by partitioning may be an inter block.

[0821] In addition, the block or the partitioned sub-block may be at least one of an intra-frame prediction block, an inter-frame prediction block, or an intra-block copy prediction block. For example, the block may be an inter-frame prediction block.

[0822] In addition, the block or the partitioned sub-block may be at least one of a luminance signal block or a chrominance signal block. For example, the block and the sub-block may be a luminance signal block.

[0823] When a block is partitioned into N sub-blocks, the block before partitioning can be a coding block, and the partitioned sub-blocks can be at least one of a prediction block and a transform block. That is, transformation / inverse transformation, quantization / dequantization, and entropy encoding / decoding of transform coefficients can be performed using the size of the partitioned sub-blocks.

[0824] In addition, when a block is partitioned into N sub-blocks, the block before partitioning can be at least one of a coding block or a prediction block, and the partitioned sub-blocks can be transform blocks. That is, prediction is performed using the size of the block before partitioning, and transform coefficients can be transformed / inversely transformed, quantized / dequantized, and entropy encoded / decoded using the size of the partitioned sub-blocks.

[0825] Whether a block is partitioned into multiple sub-blocks may be determined based on at least one of the area (product of width and height), size (width or height or a combination of width and height), or shape / form (rectangular, square, etc.) of the block.

[0826] For example, when the current block is a 64×64 block, the current block may be partitioned into a plurality of sub-blocks.

[0827] As another example, when the current block is a 32×32 block, the current block may be partitioned into a plurality of sub-blocks.

[0828] As another example, when the current block is a 32×16 block, the current block may be partitioned into a plurality of sub-blocks.

[0829] As another example, when the current block is a 16×32 block, the current block may be partitioned into a plurality of sub-blocks.

[0830] As another example, when the current block is a 4×4 block, the current block may not be partitioned into a plurality of sub-blocks.

[0831] As another example, when the current block is a 2×4 block, the current block may not be partitioned into a plurality of sub-blocks.

[0832] As another example, when at least one of the width or height of the current block is larger than the maximum size of the transform block, the current block may not be partitioned into multiple sub-blocks. That is, when at least one of the width or height of the current block is less than or equal to the maximum size of the transform block, the current block may use the second sub-block partitioning mode.

[0833] In addition, when at least one of the width or height of the current block is less than or equal to the maximum size of the transform block, at least one of the information indicating the second subblock partition mode (subblock partition mode information, partition direction information, subblock position information, or subblock size information) may be entropy encoded / decoded. Here, the maximum size of the transform block may be determined based on transform block maximum size information signaled in a higher-level unit. For example, the maximum size of the transform block may be determined to be either 64 or 32 based on the transform block maximum size information.

[0834] As another example, when the area of ​​the current block is equal to or greater than 32, the current block may be partitioned into a plurality of sub-blocks.

[0835] As another example, when the area of ​​the current block is less than 32, the current block may not be partitioned into a plurality of sub-blocks.

[0836] As another example, when the area of ​​the current block is 256 and the shape of the current block is rectangular, the current block may be partitioned into a plurality of sub-blocks.

[0837] As another example, when the area of ​​the current block is 16 and the shape of the current block is a square, the current block may not be partitioned into a plurality of sub-blocks.

[0838] When at least one of a width or a height of the current block is greater than or equal to a predefined value, the current block may be partitioned into a plurality of sub-blocks.

[0839] For example, when at least one of the width or the height of the current block is equal to or greater than 8, the current block may be partitioned into a plurality of sub-blocks.

[0840] On the contrary, when both the width and the height of the current block are smaller than the predefined values, the current block may not be partitioned into a plurality of sub-blocks.

[0841] When the current block is in GPM (Geometric Partitioning Mode), the transform block of the current block may not be partitioned into multiple subblocks. Here, GPM may be a prediction mode in which the prediction block of the current block is partitioned into two subblocks for prediction. When the current block is in GPM, the prediction block of the current block may be partitioned into two subblocks. In this case, information regarding the partitioning direction used to partition the prediction block of the current block into two subblocks may be entropy encoded / decoded. Inter-frame prediction may be performed on the two subblocks, thereby generating prediction samples for the two subblocks....

Claims

1. A method for decoding an image, the method comprising: Get the residual coefficient of the current block; Performing inverse quantization on the residual coefficients of the current block; performing a secondary inverse transform on the quantized residual coefficients of the current block; as well as obtaining residual samples of the current block by performing a primary inverse transform on intermediate transform coefficients generated from the secondary inverse transform, Wherein, the secondary inverse transformation is performed based on the transformation matrix included in the transformation matrix set, The transformation matrix set for the current block is selected from a plurality of transformation matrix sets based on a size and an intra prediction mode of the current block.

2. The method according to claim 1, wherein: When the current block is encoded by intra prediction, the secondary inverse transform is applied to the current block.

3. The method according to claim 2, wherein: When the current block is a chroma block and the intra prediction mode of the current block is one of cross-component linear model (CCLM) modes, the intra prediction mode of the current block is modified by referring to an intra prediction mode of a luma block corresponding to the chroma block.

4. The method according to claim 3, wherein: When the current block is predicted by a matrix-based intra prediction mode, the transform matrix set is selected by inferring the intra prediction mode of the current block as a planar mode.

5. The method according to claim 3, wherein: When the luma block is predicted by an intra-block copy mode or a palette prediction mode, the transform matrix set is selected by inferring the intra prediction mode of the current block as a DC mode.

6. The method according to claim 1, wherein: The size of the region where the secondary inverse transform is performed is adaptively determined based on the size of the current block.

7. A method for encoding an image, the method comprising: Get the residual sample points of the current block; Performing a primary transform on residual samples of the current block; performing a secondary transform on intermediate transform coefficients resulting from the primary transform; and encoding transform coefficients resulting from the secondary transform, wherein the secondary transformation is performed based on the transformation matrix included in the transformation matrix set, The transformation matrix set for the current block is selected from a plurality of transformation matrix sets based on a size and an intra prediction mode of the current block.

8. An apparatus for transmitting compressed video data, the apparatus comprising: a processor configured to obtain compressed video data; as well as a sending unit configured to send compressed video data, The operation of obtaining compressed video data includes: Get the residual sample points of the current block; Performing a primary transform on residual samples of the current block; performing a secondary transform on intermediate transform coefficients resulting from the primary transform; and encoding transform coefficients resulting from the secondary transform, wherein the secondary transformation is performed based on the transformation matrix included in the transformation matrix set, The transformation matrix set for the current block is selected from a plurality of transformation matrix sets based on a size and an intra prediction mode of the current block.