Video encoding / decoding method and apparatus for transmitting compressed video data

By determining and reducing the secondary transformation matrix based on the combination of one-dimensional and two-dimensional transformations in video encoding/decoding, the problem of high-resolution image data transmission and storage costs is solved, and image quality improvement and cost reduction are achieved.

CN120075432APending Publication Date: 2025-05-30INTELLECTUAL DISCOVERY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510225683.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2020-01-17
Filing Date
2020-06-18
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The prior art is difficult to effectively solve the high cost problem of high-resolution and high-quality image data in transmission and storage, especially in the efficiency and cost of transmission media and storage devices.

Method used

A method based on one-dimensional transformation type, two-dimensional transformation combination and whether the transformation is used is used to determine a reduced set of secondary transformation/inverse transformation matrix, a reduced secondary transformation/inverse transformation matrix, and whether a reduced secondary transformation/inverse transformation is performed, for video encoding/decoding methods and devices.

Benefits of technology

By reducing unnecessary transformation operations, the objective and subjective quality of images are improved, and the cost of data transmission and storage is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075432A_ABST
    Figure CN120075432A_ABST
Patent Text Reader

Abstract

The invention provides a video encoding / decoding method and a device for transmitting compressed video data. The video decoding method comprises: a step of obtaining a transform skip mode flag indicating whether a transform skip mode can be applied to a current block; a step of determining that a secondary transform / inverse transform may not be applied to the current block when a transform skip mode may be applied to the current block according to the transform skip mode flag; and a step of obtaining a transform matrix index applicable to a secondary transform / inverse transform of the current block when a transform skip mode may not be applied to the current block according to the transform skip mode flag, and a step of determining whether the secondary transform / inverse transform may be applied to the current block according to the transform matrix index.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of a patent application with an application date of June 18, 2020, application number 202080040520.9, and titled “Image encoding / decoding method and device using secondary transformation and recording medium for storing bit stream”. Technical Field

[0002] The present invention relates to an image encoding / decoding method and apparatus 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 based on transformation. 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 for the increase in transmission costs and storage costs when image data is transmitted through existing transmission media (such as wired or wireless broadband channels) or when image data is stored. In order to solve these problems of high-resolution and high-quality image data, efficient image encoding / decoding technology is needed.

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

[0005] Technical issues

[0006] In order to improve the objective and subjective quality of an image, the present invention provides a video encoding / decoding method and apparatus for determining at least one of a reduced sub-transform / inverse transform matrix set, a reduced sub-transform / inverse transform matrix, and whether to perform a reduced sub-transform / inverse transform based on at least one of a one-dimensional transform type, a two-dimensional transform combination, and whether a transform is used (still based on an intra-frame prediction mode, a prediction mode, a color component, a size, and a shape).

[0007] Technical Solution

[0008] The present disclosure provides a video decoding method, including: obtaining a transform skip mode flag indicating whether a transform skip mode is applied to a current block; when the transform skip mode is applied to the current block according to the transform skip mode flag, determining not to apply a secondary transform / inverse transform to the current block; and when the transform skip mode is not applied to the current block according to the transform skip mode flag, obtaining a transform matrix index of the secondary transform / inverse transform of the current block, and determining whether to apply the secondary transform / inverse transform to the current block based on the transform matrix index.

[0009] According to an embodiment, the video decoding method may further include: when applying a secondary transform / inverse transform to the current block, determining the secondary transform matrix of the current block according to the transform matrix index; and applying a secondary transform / inverse transform to the current block according to the secondary transform matrix.

[0010] According to an embodiment, the step of determining the secondary transformation matrix of the current block may include: determining the secondary transformation matrix of the current block according to at least one of the transformation matrix index, the transformation matrix set index of the current block and the size of the current block.

[0011] According to an embodiment, the video decoding method may include: obtaining information regarding whether an intra-frame residual DPCM method is used for the current block; and when the information regarding whether the intra-frame residual DPCM method is used indicates that the intra-frame residual DPCM method is used for the current block, determining to apply a transform skip mode to the current block. The step of obtaining the transform skip mode flag may include: obtaining the transform skip mode flag when the information regarding whether the intra-frame residual DPCM method is used indicates that the intra-frame residual DPCM method is not used for the current block.

[0012] According to an embodiment, when the current block is predicted according to an intra prediction mode that is not a matrix-based intra prediction mode, the transform matrix index of the secondary transform / inverse transform of the current block is obtained.

[0013] According to an embodiment, the step of obtaining the transform skip mode flag may include obtaining a transform skip mode flag of a luma component, a transform skip mode flag of a Cb component, and a transform skip mode flag of a Cr component.

[0014] According to an embodiment, the step of determining not to apply the secondary transform / inverse transform to the current block may include: when the tree structure of the current block is a single tree type, the transform skip mode flag of the luma component indicates that the transform skip mode is applied to the luma component, the transform skip mode flag of the Cb component indicates that the transform skip mode is applied to the Cb component, and the transform skip mode flag of the Cr component indicates that the transform skip mode is applied to the Cr component, determining not to apply the secondary transform / inverse transform to the current block.

[0015] According to an embodiment, the step of determining not to apply the secondary transform / inverse transform to the current block may include: when the tree structure of the current block is a dual-tree luma type and the transform skip mode flag of the luma component indicates that the transform skip mode is applied to the luma component, determining not to apply the secondary transform / inverse transform to the current block.

[0016] According to an embodiment, the step of determining not to apply the secondary transform / inverse transform to the current block may include: when the tree structure of the current block is a dual-tree chroma type, the transform skip mode flag of the Cb component indicates that the transform skip mode is applied to the Cb component, and the transform skip mode flag of the Cr component indicates that the transform skip mode is applied to the Cr component, determining not to apply the secondary transform / inverse transform to the current block.

[0017] According to an embodiment, the step of determining whether to apply a secondary transform / inverse transform to the current block based on the transform matrix index may include: determining whether to apply a secondary transform / inverse transform to the current block based on the transform matrix index, the size of the current block and at least one of the transform skip mode flag.

[0018] The present disclosure provides a video encoding method, which includes: entropy encoding a transform skip mode flag indicating whether a transform skip mode is applied to a current block; when the transform skip mode is applied to the current block according to the transform skip mode flag, determining not to apply a sub-transform / inverse transform to the current block; and when the transform skip mode is not applied to the current block according to the transform skip mode flag, determining whether to apply a sub-transform / inverse transform to the current block, and entropy encoding a transform matrix index of the sub-transform / inverse transform of the current block according to whether the sub-transform / inverse transform is applied to the current block.

[0019] According to an embodiment, the step of entropy encoding the transformation matrix index may include: determining the secondary transformation matrix of the current block when the secondary transformation / inverse transformation is applied to the current block; and entropy encoding the transformation matrix index according to whether the secondary transformation / inverse transformation is applied to the current block.

[0020] According to an embodiment, the step of determining the secondary transformation matrix of the current block may include: determining the secondary transformation matrix of the current block according to at least one of the transformation matrix index, the transformation matrix set index of the current block and the size of the current block.

[0021] According to an embodiment, the video encoding method may include: entropy encoding information regarding whether an intra-frame residual DPCM method is used for the current block; and when the information regarding whether the intra-frame residual DPCM method is used indicates that the intra-frame residual DPCM method is used for the current block, determining to apply a transform skip mode to the current block. The step of entropy encoding the transform skip mode flag may include: entropy encoding the transform skip mode flag when the information regarding whether the intra-frame residual DPCM method is used indicates that the intra-frame residual DPCM method is not used for the current block.

[0022] According to an embodiment, the step of entropy encoding the transformation matrix index of the secondary transformation / inverse transformation of the current block may include: when the current block is predicted according to an intra-frame prediction mode that is not a matrix-based intra-frame prediction mode, entropy encoding the transformation matrix index.

[0023] According to an embodiment, the step of entropy encoding the transform skip mode flag may include entropy encoding a transform skip mode flag of a luma component, a transform skip mode flag of a Cb component, and a transform skip mode flag of a Cr component.

[0024] According to an embodiment, the step of determining not to apply the secondary transform / inverse transform to the current block may include: when the tree structure of the current block is a single tree type, the transform skip mode flag of the luma component indicates that the transform skip mode is applied to the luma component, the transform skip mode flag of the Cb component indicates that the transform skip mode is applied to the Cb component, and the transform skip mode flag of the Cr component indicates that the transform skip mode is applied to the Cr component, determining not to apply the secondary transform / inverse transform to the current block.

[0025] According to an embodiment, the step of determining not to apply the secondary transform / inverse transform to the current block may include: when the tree structure of the current block is a dual-tree luma type and the transform skip mode flag of the luma component indicates that the transform skip mode is applied to the luma component, determining not to apply the secondary transform / inverse transform to the current block.

[0026] According to an embodiment, the step of determining not to apply the secondary transform / inverse transform to the current block may include: when the tree structure of the current block is a dual-tree chroma type, the transform skip mode flag of the Cb component indicates that the transform skip mode is applied to the Cb component, and the transform skip mode flag of the Cr component indicates that the transform skip mode is applied to the Cr component, determining not to apply the secondary transform / inverse transform to the current block.

[0027] According to an embodiment, whether to apply sub-transform / inverse transform to the current block is determined based on at least one of the transform matrix index, the size of the current block, and the transform skip mode flag.

[0028] The present disclosure provides a computer-readable recording medium for storing a bitstream generated by encoding a video using a video encoding method. The video encoding method includes: entropy encoding a transform skip mode flag indicating whether a transform skip mode is applied to a current block; determining not to apply a sub-transform / inverse transform to the current block when the transform skip mode is applied to the current block according to the transform skip mode flag; and determining whether to apply a sub-transform / inverse transform to the current block when the transform skip mode is not applied to the current block according to the transform skip mode flag, and entropy encoding a transform matrix index of the sub-transform / inverse transform of the current block according to whether the sub-transform / inverse transform is applied to the current block.

[0029] Beneficial effects

[0030] The present invention can improve the objective quality and subjective quality of an image by providing an image encoding / decoding method and device that determines at least one of a reduced sub-transform / inverse transform matrix set, a reduced sub-transform / inverse transform matrix, and whether to perform a reduced sub-transform / inverse transform based on at least one of a one-dimensional transform type, a two-dimensional transform combination, and whether a transform is used (still based on an intra-frame prediction mode, a prediction mode, a color component, a size, and a shape). BRIEF DESCRIPTION OF THE DRAWINGS

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

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

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

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

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

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

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

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

[0039] Figure 8b is a diagram showing basis vectors in each frequency domain of DCT-7 according to the present invention.

[0040] 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 the “Cactus” sequence is obtained through testing in a low-delay P profile environment.

[0041] Figure 10 3D graph 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).

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

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

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

[0045] 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) reordering method.

[0046] 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).

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

[0048] 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 a coding unit (CU) for inter prediction according to the present invention.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0077] Figures 49 to 53 is a diagram illustrating an example of an encoding process or a decoding process using transform according to an embodiment of the present invention.

[0078] Figure 54 An embodiment is shown in which a sub-transform and / or a sub-inverse transform is performed in an encoder / decoder.

[0079] Figure 55 An embodiment of a secondary transformation matrix is ​​shown.

[0080] Figure 56 Shows a reduced sub-transform / inverse transform process.

[0081] Figures 57 to 68 Several embodiments are shown in which a transform matrix is ​​derived based on a block size, a transform matrix set index, and a transform matrix index.

[0082] Figures 69 to 72 Shown is a syntax of a bit stream applied to an encoding / decoding method and apparatus using transform and a recording medium storing the bit stream according to an embodiment of the present invention.

[0083] Figures 73 to 90 Various embodiments are provided for signaling conditions of a transform matrix index.

[0084] Figure 91 Shown is a syntax of a bit stream applied to an encoding / decoding method and apparatus using transform and a recording medium storing the bit stream according to an embodiment of the present invention.

[0085] Figure 92 A video decoding method according to an embodiment of the present invention is shown.

[0086] Figure 93 A video encoding method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0087] Optimal Mode

[0088] The present invention provides a video decoding method, comprising: obtaining a transform skip mode flag indicating whether a transform skip mode is applied to a current block; when the transform skip mode is applied to the current block according to the transform skip mode flag, determining not to apply a secondary transform / inverse transform to the current block; and when the transform skip mode is not applied to the current block according to the transform skip mode flag, obtaining a transform matrix index of the secondary transform / inverse transform of the current block, and determining whether to apply the secondary transform / inverse transform to the current block based on the transform matrix index.

[0089] Invention Mode

[0090] The present invention may be modified in various ways, and there are various embodiments of the present invention, of which examples of various embodiments will now be provided with reference to the accompanying drawings and described in detail. However, the present invention is not limited thereto, 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. In various aspects, similar reference numerals refer to the same or similar functions. In the 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, which illustrate specific embodiments in which the present invention may be practiced. 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 connection 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 taken in a limiting sense, and the scope of the present disclosure is defined solely by the appended claims (and, where appropriately interpreted, together with the full scope of equivalents claimed by the claims).

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

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

[0093] In addition, the components shown in the embodiments of the present invention are shown independently to represent different characteristic functions from each other. Therefore, this does not mean that each component is composed of a separate hardware or software component. In other words, for convenience, each component includes each of the enumerated components. Therefore, at least two components of each component can be combined to form a component, or a component can be divided into multiple components to perform each function. If it does not depart 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.

[0094] The terms used in this specification are only used to describe specific embodiments and are not intended to limit the present invention. Unless there is a significantly different meaning in the context, the expressions used in the singular include expressions in the plural form. In this specification, it will be understood that terms such as "including", "having" etc. are intended to indicate the presence of features, numbers, 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, numbers, 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", it does not exclude elements other than the corresponding elements, but may include additional elements in an embodiment of the present invention or within the scope of the present invention.

[0095] In addition, some components may not be essential components for performing the basic functions of the present invention, but may be optional components that only improve its performance. The present invention can be implemented by including only the essential components for achieving the essence of the present invention without including components that improve performance. Structures that include only the essential components without including optional components that only improve performance are also included in the scope of the present invention.

[0096] 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 configurations will not be described in detail because they may unnecessarily obscure the understanding of the present invention. The same constituent elements in the accompanying drawings are represented by the same reference numerals, and repeated descriptions of the same elements will be omitted.

[0097] 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."

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

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

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

[0101] Hereinafter, a target block may be an encoding target block as an encoding target and / or a decoding target block as a decoding target. In addition, a target block may be a current block as a target of current encoding and / or decoding. For example, the terms "target block" and "current block" may be used as having the same meaning and may be used interchangeably.

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

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

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

[0105] In an embodiment, 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.

[0106] 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 column, row, index, etc. can be counted from 0 or 1.

[0107] Terminology Description

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

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

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

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

[0112] Unit: This refers to a unit for encoding and decoding. When encoding and decoding an image, a unit can 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 can represent a sub-division. That is, an image can be partitioned into multiple units. When encoding and decoding an image, predetermined processing can be performed on each unit. A single unit can be partitioned into sub-units smaller than the unit. Depending on its function, a unit can represent 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 can include a luma component block, chroma component blocks associated with the luma component block, and syntax elements for each color component block. A unit can have various sizes and shapes. Specifically, the shape of a unit can be a two-dimensional geometric figure such as a square, rectangle, trapezoid, triangle, pentagon, and so on. In addition, the unit information may include at least one of a unit type indicating a coding unit, a prediction unit, a transformation unit, etc., and a unit size, a unit depth, an order of encoding and decoding of the unit, etc.

[0113] 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 syntax element including a block and each block. Each coding tree unit may be partitioned by using at least one of a quadtree partitioning method, a binary tree partitioning method, and a ternary tree partitioning method to configure lower-level units such as coding units, prediction units, and transform units. 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, quadtree may represent a quadtree.

[0114] 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 is possible to partition using only quadtree partitioning. Alternatively, when the size of the coding block is larger than the size of the largest transform block, it is possible to partition 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 a predetermined range, it is possible to partition using only binary or ternary tree partitioning. In this case, the above description of the quadtree partition can be applied to the binary tree partition or the ternary tree partition in the same manner.

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

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

[0117] Reconstructed Neighboring Block: This refers to a neighboring block that is adjacent to the current block and has been spatially / temporally encoded or decoded. Here, a reconstructed neighboring block may refer to a reconstructed neighboring unit. A reconstructed spatial neighboring block may be a block within the current picture that has been reconstructed through encoding or decoding, or both. A reconstructed temporal neighboring block is a block at a position corresponding to the current block in the current picture within the reference image, or a neighboring block of the current block.

[0118] 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 further partitioned. The depth of a leaf node can be the maximum level. For example, the predefined value of the maximum level can be 3. The depth of the root node can be the lowest, and the depth of the leaf node can be the deepest. In addition, when a unit is represented as a tree structure, the level at which the unit exists can represent the unit depth.

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

[0120] Parameter set: This corresponds to header information within the bitstream configuration. 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 a slice header, a tile group header, and tile header information. The term "tile group" refers to a group of tiles and has the same meaning as a slice.

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

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

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

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

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

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

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

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

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

[0130] 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 / 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.

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

[0132] A partition may represent 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 partitions may represent a partition.

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

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

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

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

[0137] 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 lower-level prediction units. 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.

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

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

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

[0141] The prediction list utilization flag indicates whether at least one reference picture in a particular 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.

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

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

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

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

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

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

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

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

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

[0151] 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 an inter prediction indicator, a reference picture index for each list, a motion vector, a prediction list utilization flag, and an inter prediction indicator.

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

[0153] 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 lower-level transform units of smaller size. Transform / inverse transform may include at least one of a primary transform / primary inverse transform and a secondary transform / secondary inverse transform.

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

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

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

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

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

[0159] 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 is a target for inverse quantization 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.

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

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

[0162] Quantization matrix coefficients: These represent each element in the quantization matrix. Quantization matrix coefficients are also called matrix coefficients.

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

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

[0165] 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, sum 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.

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

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

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

[0169] The encoding device 100 can perform encoding of 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 switch to intra mode. Alternatively, when inter mode is used as the prediction mode, the switch 115 can switch 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.

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

[0171] 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 the reference image, the reference image may be stored in the reference picture buffer 190.

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

[0173] 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-picture 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-picture prediction or motion compensation may be performed differently.

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

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

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

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

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

[0179] 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, probability model, and context model.

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

[0181] The coding parameters may include information such as syntax elements (flags, indexes, etc.) that are encoded in the encoder and sent to the decoder using a signal, as well as information derived when performing encoding or decoding. The coding parameters may represent information required when encoding or decoding an image. For example, at least one value or combination of the following items may be included in the coding parameters: unit / block size, unit / block depth, unit / block partition information, unit / block shape, unit / block partition structure, whether quadtree partitioning is performed, whether binary tree partitioning is performed, 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 type of multi-type tree partitioning direction (horizontal or vertical), type of multi-type tree partition (symmetric or asymmetric), tree (binary tree or ternary tree) structure of multi-type tree partition, prediction mode (intra-frame prediction or inter-frame prediction), luminance intra-frame prediction mode / direction, chrominance intra-frame prediction mode / direction, intra-frame partition information, inter-frame partition information, coding block partition flag, prediction block partition flag, transform block partition flag, reference sample filtering method, reference sample filter taps, reference sample filter coefficients, prediction block filtering method, prediction block filter taps, prediction block filter coefficients, prediction block boundary filtering method, prediction block boundary filter taps, prediction block boundary filter coefficients, intra-frame prediction mode , inter-frame prediction mode, motion information, motion vector, motion vector difference, reference picture index, inter-frame prediction angle, inter-frame 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 , information on whether a residual signal exists, coding block pattern, coding block flag (CBF), quantization parameter, quantization parameter residual, quantization matrix, whether to apply an intra-frame loop filter, intra-frame loop filter coefficients, intra-frame loop filter taps, intra-frame loop filter shape / form, whether to apply a deblocking filter, deblocking filter coefficients, deblocking filter taps, deblocking filter strength, deblocking filter shape / form, whether to apply an adaptive sample offset, adaptive sample offset value, adaptive sample offset category, adaptive sample offset type, whether to apply an adaptive loop filter, adaptive loop filter coefficients, adaptive loop filter taps, adaptive loop filter shape / form,Binarization / debinarization method, context model determination method, context model updating 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 sample, reconstructed chrominance sample, residual luminance sample, residual chrominance sample, luminance transform coefficient, chrominance transform coefficient, quantized luminance level, quantized chrominance level, transform coefficient level scanning method, motion vector search area at decoder side domain size, shape of a motion vector search area at the decoder side, number of motion vector searches at the decoder side, information on a CTU size, information on a minimum block size, information on a maximum block size, information on a maximum block depth, information on a minimum block depth, image display / output order, slice identification information, slice type, slice partition information, tile identification information, tile type, tile partition information, tile group identification information, tile group type, tile group partition information, picture type, bit depth of input samples, bit depth of reconstructed samples, bit depth of residual samples, bit depth of transform coefficients, bit depth of quantization levels, and information on a luminance signal or information on a chrominance signal.

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

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

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

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

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

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

[0188] The adaptive in-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.

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

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

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

[0192] 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 255 , a filter unit 260 , and a reference picture buffer 270 .

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

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

[0195] 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 that becomes 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.

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

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

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

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

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

[0201] The adder 225 can generate a reconstructed block by adding the reconstructed residual block to the prediction block. The filter unit 260 can apply at least one of a deblocking filter, a sample adaptive offset, and an adaptive in-loop filter to the reconstructed block or 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. That is, 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.

[0202] Figure 3 is a diagram schematically illustrating a partition structure of an image when encoding and decoding the image. Figure 3 An example of partitioning a single unit into multiple lower-level units is schematically shown.

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

[0204] 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 the coding tree unit (CTU). Unit partitioning may mean partitioning the block associated with the unit. In the block partition information, information about the unit depth may be included. The depth information may indicate the number or degree of 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 the depth information based on a tree structure. In other words, the unit and the lower-level units generated by partitioning the unit may correspond to a node and a child node of the node, respectively. Each of the partitioned lower-level units may have depth information. The depth information may be information indicating the size of a CU and may be stored in each CU. The unit depth indicates the number and / or degree associated with partitioning the unit. Therefore, the partition information of the lower-level unit may include information about the size of the lower-level unit.

[0205] The partition structure may indicate the distribution of coding units (CUs) within the LCU 310. This distribution may be determined based on 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 a 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. Here, as described above, an LCU may be a coding unit with the largest coding unit size, and an SCU may be a coding unit with the smallest coding unit size. Partitioning starts with the LCU 310. When the horizontal or vertical size, or both the horizontal and vertical sizes of the CU are reduced by partitioning, the CU depth increases by 1. For example, for each depth, the size of a non-partitioned CU can be 2N×2N. In addition, in the case of a partitioned CU, a CU of size 2N×2N can be partitioned into four CUs of size N×N. As the depth increases by 1, the size of N can be halved.

[0206] In addition, information about whether a CU is partitioned can be indicated by using its partition information. The partition information can be 1-bit information. 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.

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

[0208] 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, each of the four partitioned coding units may have a size of 16×16. When a single coding unit is partitioned into four coding units, it can be said that the coding unit can be partitioned into a quadtree form.

[0209] 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 having a size of 32×32 is vertically partitioned into two sub-coding units, each of the two sub-coding units may have a size of 16×32. For example, when a coding unit having a size of 8×32 is horizontally partitioned 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.

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

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

[0212] 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 derived from binary or ternary tree partitioning of coding units corresponding to leaf nodes of the quadtree from undergoing further quadtree partitioning, block partitioning operations and / or operations for signaling partition information may be efficiently performed.

[0213] 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).

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

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

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

[0217] When a coding unit corresponding to a node of a multi-type tree is further partitioned according to a multi-type tree partition structure, the coding unit may include partition direction information. The partition direction information may indicate in which direction the current coding unit will be partitioned for the multi-type tree partition. 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.

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

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

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

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

[0222] 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 exist in the bitstream.

[0223] 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 divided into two equal parts. For example, when the vertical size (height) of the coding unit is larger than the vertical size (height) of the maximum transform block, the coding unit may be horizontally divided into two equal parts.

[0224] 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, or the like. 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.

[0225] 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 from the root node to a leaf node of a multi-type tree (maximum tree depth of a multi-type tree) may be signaled or determined at an upper level of the coding unit. For example, the upper 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.

[0226] The difference between the size of the CTU and the maximum size of the transform block may be signaled or determined at a higher level of the coding unit. For example, the higher level may be 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 to the minimum size of the coding block.

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

[0228] Depending on the sizes 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.

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

[0230] 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 by the binary tree or the ternary tree. 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] Alternatively, when the size (horizontal and vertical) of the coding unit corresponding to a node of the multi-type tree is the same as the maximum size (horizontal and vertical) of the binary tree and / or twice the maximum size (horizontal and vertical) 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.

[0232] Optionally, binary tree partitioning or ternary tree partitioning can be limited based on the size of the virtual pipeline data unit (hereinafter, pipeline buffer size). For example, when a coding unit is divided into sub-coding units that do not fit in the pipeline buffer size by 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 maximum transform block (e.g., 64×64). For example, when the pipeline buffer size is 64×64, the following partitioning may be limited.

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

[0234] - 128×N (N<=64) binary tree partitions in the horizontal direction for coding units

[0235] - N×128 (N<=64) binary tree partitions in the vertical direction for the coding unit

[0236] Optionally, when the depth of the coding unit corresponding to a node of the multi-type tree is equal to the maximum depth of the multi-type tree, the coding unit may not be further partitioned into two and / or three partitions. 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.

[0237] 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 possible for a coding unit corresponding to a node of a multi-type tree. Otherwise, the coding unit may not be bipartitioned and / or tripartitioned. Therefore, 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.

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

[0239] 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 possible 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.

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

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

[0242] 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 values ​​of reference samples or coding parameters included in the reconstructed neighboring block.

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

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

[0245] 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 the block size and the color component type. For example, the number of intra-frame prediction modes can vary depending on whether the color component is a luminance signal or a chrominance signal. For example, as the block size 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.

[0246] The intra prediction mode may be a non-angle mode or an angle mode. The non-angle mode may be a DC mode or a planar mode, and the angle mode may be a prediction mode having a specific direction or angle. The intra prediction mode may be represented by at least one of a mode number, a mode value, a mode number, a mode angle, and a mode direction. The number of intra prediction modes may be M, which is greater than 1, including non-angle modes and angle modes. In order to perform intra prediction on the current block, a step of determining whether a sample included in a reconstructed neighboring block can be used as a reference sample 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, so that the replaced sample value is used as the reference sample for the current block.

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

[0248] like Figure 7 As shown, at least one of the reference sample line 0 to the reference sample line 3 can be used for intra prediction of the current block. Figure 7 In the example, the samples of segments A and F can be filled with the samples of the closest segments 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 signaled. For example, in Figure 7 In the example, reference sample line indicators 0, 1, and 2 may be signaled as index information indicating reference sample lines 0, 1, and 2. When the upper boundary of the current block is the boundary of the CTU, only reference sample line 0 may be available. Therefore, in this case, index information may not be signaled. When a reference sample line other than reference sample line 0 is used, filtering for the prediction block, which will be described later, may not be performed.

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

[0250] 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, as well as 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. Alternatively, 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. Alternatively, 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, interpolation of real units may be performed.

[0251] In the case of intra-frame prediction between color components, a prediction block for the current block of the second color component 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 corresponding sample value of the second color component among the samples in the template, as well as the sample value of the first color component with the minimum value and the corresponding sample value of the second color component 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 neighboring 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-frame prediction between color components may be performed based on the corresponding subsampled samples. Whether to perform intra-frame prediction between color components and / or the range of the template may be signaled as an intra-frame prediction mode.

[0252] The current block may be partitioned into two subblocks or four subblocks in the horizontal or vertical direction. The partitioned subblocks may be reconstructed sequentially. That is, intra prediction may be performed on the subblocks to generate subprediction blocks. In addition, inverse quantization and / or inverse transformation may be performed on the subblocks to generate subresidual blocks. A reconstructed subblock may be generated by adding the subprediction block to the subresidual block. The reconstructed subblock may be used as a reference sample for intra prediction of a subsequent subblock. A subblock may be a block including a predetermined number (e.g., 16) or more samples. Thus, for example, when the current block is an 8×4 block or a 4×8 block, the current block may be partitioned into two subblocks. Furthermore, when the current block is a 4×4 block, the current block may not be partitioned into subblocks. When the current block has other sizes, the current block may be partitioned into four subblocks. Information regarding whether intra prediction is performed based on subblocks and / or partition direction (horizontal or vertical) may be signaled. Subblock-based intra prediction may be limited to 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.

[0253] The final prediction block can be generated by performing filtering on the prediction block predicted by the intra-frame. The filtering can be performed by applying predetermined weights to the filtering target samples, the left reference samples, the upper reference samples and / or the upper left reference samples. The weights and / or reference samples (range, position, etc.) used for filtering can be determined based on at least one of the block size, the intra-frame prediction mode and the position of the filtering target samples in the prediction block. 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 k is added to the diagonal mode or subtracted from the diagonal mode. For example, k can be a positive integer of 8 or less.

[0254] 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 an 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.

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

[0256] 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).

[0257] I-pictures can be encoded using intra-frame prediction without requiring inter-picture prediction. P-pictures can be encoded using inter-picture prediction using reference pictures available in one direction (i.e., forward or backward) for the current block. B-pictures can be encoded using inter-picture prediction using reference pictures available in both directions (i.e., forward and backward) for 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.

[0258] Hereinafter, embodiments of inter-picture prediction will be described in detail.

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

[0260] Motion information of the 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 by 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.

[0261] The method of deriving motion information may vary 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 partitioning mode, combined inter-frame and intra-frame prediction modes, and affine mode. Here, the merge mode may be referred to as motion merge mode.

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

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

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

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

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

[0267] Another example of a method for deriving motion information for a current block may be a 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 for a current block from motion information for neighboring blocks. When merge mode is applied, reconstructed motion information for neighboring blocks and / or motion information for 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).

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

[0269] 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 located to the left of the current block, an upper neighboring block arranged above the current block, and a temporal neighboring block temporally adjacent to the current block.

[0270] 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 the correction information 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 correction is performed, correction direction information, and correction size information. As described above, the prediction mode in which the motion vector of the merge candidate is corrected based on the signaled correction information may be referred to as a merge mode with a motion vector difference.

[0271] The skip mode may be a mode in which the motion information of the neighboring blocks is applied to the current block as it is. When the skip mode is applied, the encoding device 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 device 200. The encoding device 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 device 200.

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

[0273] The geometric partition mode may indicate a mode in which motion information is derived by partitioning the current block in a predetermined direction, each prediction sample is derived using each of the derived motion information, and the prediction sample of the current block is derived by weighting each of the derived prediction samples.

[0274] The inter-intra combined prediction mode may indicate 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.

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

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

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

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

[0279] At least one scheme selected from a variety of predefined transform schemes is used to perform the primary transform. For example, examples of the 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.

[0280] A quantized level signal (quantized coefficient) can 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 can be scanned according to at least one of diagonal upper right scanning, vertical scanning, and horizontal scanning. For example, when the coefficients are scanned according to diagonal upper right scanning, the coefficients in block form are changed to a one-dimensional vector form. In addition to 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 can be used depending on the intra prediction mode and / or the size of the transform block. The scanned quantized level coefficients can be entropy coded to be inserted into the bitstream.

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

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

[0283] 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 sent with a signal. The mapping function can be sent 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 the 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.

[0284] When the current block is a residual block of chroma components, the residual block can be converted to the 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 parallel block group level. Scaling can only be applied when mapping for the luma component is available and the division of the luma component and the division of the chroma component 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 value 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 value. Then, chroma component block recovery, intra-frame prediction, inter-frame prediction, in-loop filtering, and reference picture storage can be performed in the inverse mapping area.

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

[0286] 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 signaled so that a merge candidate can be specified. The block vector of the specified merge candidate can be used as the block vector of the current block. The merge candidate list may include at least one of a spatial candidate, a history-based candidate, a candidate based on the average of two candidates, and a zero merge candidate. In the case of AMVP mode, a difference block vector may be signaled. 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 signaled. The prediction block in IBC mode is included in the current CTU or the left CTU and is limited to blocks in the reconstructed area. For example, the value of the block vector can be limited so that the prediction block of the current block is located in the area of ​​three 64×64 blocks before the 64×64 block to which the current block belongs in the encoding / decoding order. By limiting the value of the block vector in this way, memory consumption and device complexity of the implementation according to the IBC mode can be reduced.

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

[0288] 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 coding, so as to better reflect the common frequency characteristics of images.

[0289] 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 coding methods.

[0290] 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, it can be applied to the residual block encoded in the inter-frame mode. According to an embodiment of the present invention, DST-7 can be applied after rearranging or reordering the data of the residual block. Here, rearrangement can mean the rearrangement of image data and can be equivalent to rearranging or flipping the residual signal. Here, the residual block can have the same meaning as the residual, the residual block, the residual signal, the residual signal, the residual data or the residual data. In addition, the residual block can have the same meaning as the reconstructed residual, the reconstructed residual block, the reconstructed residual signal, the reconstructed residual signal, the reconstructed residual data or the reconstructed residual data in the form of reconstruction of the residual block in the encoder and the decoder.

[0291] 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 may use at least one of various types of DST and DCT, 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).

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

[0293] [Equation 1]

[0294]

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

[0296] The DCT-2 transform kernel can be defined as the following equation 2. Here, x k may denote a basis vector according to a position in the frequency domain, and N may denote the size of the frequency domain.

[0297] [Equation 2]

[0298]

[0299] at the same time, Figure 7 is a diagram illustrating basis vectors in the frequency domain of DCT-2 according to the present invention. Figure 7 FIG2 shows the frequency characteristics of DCT-2 in the frequency domain. Here, the value calculated by the X0 basis vector of DCT-2 may represent the DC component.

[0300] DCT-2 can be used in the transform process for residual blocks of sizes 4×4, 8×8, 16×16, 32×32, etc.

[0301] Meanwhile, 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, DCT-2 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. 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 four pixels and equal to or less than 16 pixels) and the horizontal length (width) is not longer than the vertical length (height), a primary transform kernel can be used for horizontal transform. Otherwise, a secondary 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 four pixels and equal to or less than 16 pixels and the vertical length (height) is not longer than the horizontal length (height), the primary transform kernel can be used for vertical transform. Otherwise, a secondary transform kernel can be used for vertical transform. The primary transform kernel may be different from the secondary transform kernel. That is, the horizontal and vertical transform methods for a block encoded in intra mode can be implicitly determined based on the block's shape under predetermined conditions. For example, the primary transform kernel can be DST-7, and the secondary 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 represents the intra-frame prediction mode or intra-frame prediction direction.

[0302] Transformation by the DCT-2 transform kernel can achieve high compression efficiency for blocks with features that have small changes between adjacent pixels (such as the background of an image). However, it may not be suitable as a transform kernel for areas (such as texture images with complex patterns). 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 be reduced. In order to enhance 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.

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

[0304] [Equation 3]

[0305]

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

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

[0308] [Equation 4]

[0309]

[0310] DST-7 may be used in a transform process for a residual block having at least one size of 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, 128×128, etc.

[0311] At the same time, 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 vertical transform and the horizontal transform of the square block. When multiple transform methods can be selectively applied, DST-7 is applied to the vertical transform and the horizontal transform of the square block.

[0312] 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 indicate inter prediction or intra prediction. Furthermore, in the case of intra prediction, the prediction mode indicates the intra prediction mode or intra prediction direction. For example, for chroma components, block shape-based transform method selection may not be available. For example, when the intra prediction mode is prediction between color components, block shape-based transform method selection may not be available. For example, the transform method for chroma components can be specified via 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 primary transform kernel is used for horizontal transform (vertical transform). Otherwise, a secondary transform kernel may be used. The primary transform kernel may be different from the secondary transform kernel. For example, the primary transform kernel may be DST-7 and the secondary transform kernel may be DCT-2. The predetermined range may range from, for example, four pixels to 16 pixels. When the size of the block is not within the predetermined range, the same kernel (e.g., the secondary 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 secondary transform kernel and the primary transform kernel are used for horizontal transform and vertical transform under mode 27, respectively, the primary transform kernel and the secondary transform kernel are used for horizontal transform and vertical transform under modes 26 and 28 adjacent to mode 27, respectively.

[0313] Meanwhile, Figure 8 is a diagram illustrating basis vectors in each frequency domain of DST-7 according to the present invention. Referring to Figure 8 , the first basis vector (x0) of DST-7 is shaped like a curve. This suggests that DST-7 will exhibit higher transform performance than DCT-2 for blocks with large spatial variations in an image.

[0314] DST-7 can be used for transforming 4×4 transform units (TUs) within intra-predicted coding units (CUs). By reflecting the characteristics of intra-prediction, in which the amount of error increases as the distance from the reference sample increases, DST-7, which has higher transform efficiency, can be used. That is, in the case of a block where the amount of residual signal increases as the distance from the position (0, 0) within the block in the spatial domain increases, DST-7 can be used to efficiently compress the block.

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

[0316] 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 the “Cactus” sequence is obtained through testing in a low-delay P profile environment.

[0317] Reference Figure 9 , Figure 9 The left side of shows a relatively large value that is a marker of the top 30% among the average residual signal values ​​within the block. The right side shows a relatively large value that is a marker of the top 70% among the average residual signal values ​​within the same block as shown on the left.

[0318] like Figure 9 As shown, the distribution of the residual signal within the 2N×2N PU of the 8×8 CU predicted in inter-frame 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 and PU partition modes (2N×2N, 2N×N, N×2N, N×N, nR×2N, nL×2N, 2N×nU and 2N×nD) that the inter-predicted CU can have.

[0319] Figure 10 A three-dimensional graph showing distribution characteristics of residual signals within a 2N×2N prediction unit (PU) of an 8×8 coding unit (CU) predicted in inter-frame prediction mode (inter mode).

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

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

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

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

[0324] The SDST according to the present invention can be performed in two steps. The first step is to perform rearrangement on the residual signal within the PU of the CU predicted in inter-frame mode or intra-frame mode. The second step is to apply DST-7 to the rearranged residual signal within the block.

[0325] The residual signal arranged in the current block (e.g., CU, PU, ​​or TU) can be scanned in a first direction and rearranged in a second direction. That is, the residual signal arranged in the current block can be scanned in the first direction and rearranged in the second direction to perform rearrangement. Here, the residual signal may represent a signal indicating a difference signal between the original signal and the prediction 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 is performed. In addition, 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. In addition, the residual signal may represent a signal before at least one of inverse transformation and inverse quantization is performed.

[0326] Meanwhile, the first direction (or scanning direction) may 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 may be defined as at least one of the following (1) to (10).

[0327] Scan from the upper row to the lower row, and scan from left to right within a row

[0328] Scan from the upper row to the lower row, and scan from right to left within a row

[0329] Scan from the lower row to the upper row, and scan from left to right within a row

[0330] Scan from the lower row to the upper row, and scan from right to left within a row

[0331] Scan from the left column to the right column, and scan from top to bottom within a column

[0332] Scan from the left column to the right column, and scan from bottom to top within a column

[0333] Scan from the right column to the left column, and scan from top to bottom within a column

[0334] Scan from the right column to the left column, and scan from bottom to top within a column

[0335] 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

[0336] Diagonal scan: Start from a corner of the block and scan diagonally in the upper left, upper right, lower left, or lower right direction

[0337] Meanwhile, 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.

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

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

[0340] 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 one process for the first direction. For example, for a residual signal within a block, scanning may be performed from an upper row to a lower row and scanning may be performed from the right to the left in a column for storage (rearrangement) in the block.

[0341] At the same time, the scanning and rearrangement processing for the residual signal can be performed in predetermined units of sub-blocks within the current block. Here, the sub-block may be a block that is equal to or smaller in size than the current block. The sub-block may be a block obtained by partitioning the current block in a quadtree, binary tree, or the like.

[0342] 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 derived differently. 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.

[0343] 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 part of the sub-blocks of the current block may use the same scanning direction and / or the same rearrangement direction.

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

[0345] Reference Figure 11 , the PU is partitioned into four sub-blocks according to the 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, the rearrangement operation for rearranging the residual signal of each sub-block can be performed to have a distribution characteristic suitable for the DST-7 transform.

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

[0347] 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 rearrangement. 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 rearrangement. Figure 12 The value of each residual signal position in the upper block.

[0348] [Equation 5]

[0349]

[0350] Due to the distribution characteristics of the residual signal within the PU of the CU predicted in inter-frame mode, many residual signals with relatively small values ​​are Figure 12 The residual signals are distributed in the central area within the upper block, and many residual signals with large values ​​are distributed close to the boundary within the upper block.

[0351] Figure 12 The lower block in FIG shows the distribution characteristics of the residual signal within the 2N×2N PU after rearrangement. This shows that the distribution of the residual signal of each subblock of the rearranged PU is the distribution of the residual signal suitable for the first basis vector of DST-7. In other words, 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 ​​whose frequencies are transformed by DST-7 are concentrated in the low-frequency domain.

[0352] The following Equation 6 represents a method of performing rearrangement according to the position of each of four subblocks within a PU, wherein the four subblocks are obtained by partitioning the PU according to a quadtree structure.

[0353] [Equation 6]

[0354]

[0355] Here, W k and H kRespectively represent the width and height of the k-th sub-block (k∈{blk0,blk1,blk2,blk3}) in the PU, and blk0 to blk3 respectively represent sub-blocks obtained by partitioning the PU according to the 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 , the position of the residual signal before rearrangement 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 changed by the rearrangement are represented by a'(x,y), b'(x,y), c'(x,y), and d'(x,y).

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

[0357] 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 location of the original residual data before rearrangement, and Figure 13 (b) shows the rearranged position of the residual data.

[0358] Reference Figure 13 (c), the value of the residual data may gradually increase from position (0, 0) to position (3, 3). Here, the horizontal and / or vertical one-dimensional residual data within each sub-block may have a data distribution in the form of a basic vector as shown in FIG.

[0359] That is, with respect to the rearrangement 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 the DST-7 basis vector. After rearranging each sub-block, the DST-7 transform can be applied to the data rearranged according to each sub-block unit.

[0360] At the same time, the sub-blocks can be further partitioned according to the quadtree structure based on the depth of the TU, or can be selectively rearranged. For example, when the depth of the TU is 2, the N×N sub-blocks belonging to the 2N×2N PU are partitioned into N / 2×N / 2 blocks, and the rearrangement process is applied to each N / 2×N / 2 block. Here, the quadtree-based TU partitioning can be repeatedly performed until the minimum TU size is reached.

[0361] Furthermore, when the depth of the TU is 0, DCT-2 transform is applied to the 2N×2N block. Here, rearrangement of residual data may not be performed.

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

[0363] 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) reordering method. Figure 14a and Figure 14b A quadtree partition structure of a TU according to the depth of the TU for each asymmetric partition mode (2N×nU, 2N×nD, nR×2N, and nL×2N) is shown.

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

[0365] At the same time, Figure 14a and Figure 14b In the PU, the TU of depth 0 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 of depth 0 may be the same as the size of the PU). Figure 18 Describes the reordering of the residual signal within a TU at depth 0.

[0366] In addition, when at least one of the CU, PU and TU is of a rectangular shape (e.g., 2N×nU, 2N×nD, nR×2N and nL×2N), before the residual signal rearrangement, 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 obtained from the partitioning.

[0367] In addition, when at least one of the CU, PU, ​​and TU is square in 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 obtained from the partitioning.

[0368] In addition, when the TU obtained from the partition of the CU or PU and TU has the highest depth (unpartitioned), the TU is partitioned into N sub-blocks, such as two, four, six, eight, 16 sub-blocks, etc., and then the residual signal rearrangement is performed in units of sub-blocks obtained from the partition.

[0369] 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 can also be applied.

[0370] At the same time, Figure 14a and Figure 14b In , the asymmetric partition mode of the inter-frame predicted PU is described but not limited thereto, and the partitioning of TUs and the rearrangement of TUs are applicable to the symmetric partition mode (2N×N and N×2N) of the PU.

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

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

[0373] After the transform, when many transform coefficients are distributed close to low-frequency components (especially, DC components), the distribution of the residual signal has higher compression efficiency compared to the relative situation in the following two aspects: i) energy loss after quantization is minimized, and ii) bit usage is reduced in the entropy coding process.

[0374] 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).

[0375] exist Figure 15 The diagram shown on the left side of shows the distribution when the PU partition mode of the CU is 2N×2N, and the residual signal increases from the center to the boundary. Figure 15 The diagram shown in the middle of shows the distribution of the residual signal after DCT-2 transformation is performed on the TU with a depth of 1 within the PU. Figure 15 The diagram shown on the right side of shows the distribution of a residual signal after DST-7 is performed on TUs of depth 1 within a PU.

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

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

[0378] 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 this information may be, for example, a flag. When a residual block of the same size as the block is decoded, information regarding the transform kernel may be determined by decoding information included in the bitstream. When a sub-residual block corresponding to a portion of the block is decoded, 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's type and / or position within the block may be included in the bitstream for signaling. Here, when the block is larger than 32×32, determination of the transform kernel based on the sub-residual block's 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, determination of 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.

[0379] 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 whether to partition horizontally or vertically. 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.

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

[0381] The transform kernel of the 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, while 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, and any two different transform kernels among the various transform kernels described in this specification may be used as the first transform kernel and the second transform kernel. Here, the block may represent a CU or a TU. In addition, the sub-residual block may represent a sub-TU.

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

[0383] 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 obtained from a partition of a PU whose prediction mode is inter mode. In step S1620, the TU that is the target of the transform may be rearranged. Next, in step S1630, the DST-7 transform is performed on the rearranged TU, and in step S1640, quantization is performed, and a series of subsequent processes are performed, thereby performing SDST processing in this order.

[0384] Meanwhile, rearrangement and DST-7 transform may be performed on a block whose prediction mode is an intra mode.

[0385] The following methods will be described as embodiments for implementing SDST in an encoder: 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 using rate-distortion optimization. The following methods describe inter-prediction blocks, but are not limited thereto and can be applied to intra-prediction blocks.

[0386] 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 a coding unit (CU) for inter prediction according to the present invention.

[0387] Reference Figure 17 , in inter prediction mode, a TU can be obtained from a partition of a CU having a highest maximum depth according to a quadtree or a binary tree, and there can be a total of K partition modes of a PU. Here, K is a positive integer, and for example, in Figure 17 In the middle, K is 18.

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

[0389] Figure 17 Each block in shows the following form: a TU is partitioned by depth 2 from each PU partition mode of the CU for inter prediction. Here, a thick solid line may indicate a PU, a thin solid line may indicate a TU, and the direction of the arrow of each TU may indicate the direction in which the residual signal value within the TU increases. Each TU may be rearranged as described above with respect to the rearrangement step according to the position within the PU.

[0390] Specifically, in the case of a TU of depth 0, in addition to the method proposed for the reordering step, reordering may be performed according to various methods.

[0391] One of these methods is as follows: scanning starts from the residual signal at the center position of the PU block, and the nearby residual signals are scanned in a circular manner in the boundary direction of the block, and the scanned residual signals are rearranged in a zigzag scanning order starting from the position (0, 0) in the PU.

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

[0393] Figure 18 (a) and Figure 18 (b) shows the scan order for rearrangement, and Figure 18 (c) shows the rearrangement order for SDST.

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

[0395] In the encoder, the Figure 16 The SDST process shown in FIG performs SDST on all TUs within an inter-frame predicted PU. Figure 17 The same form shown in

[15] performs TU partitioning from PU up to depth 2. By using Figure 17 The distribution characteristics of the residual signal within the TU in the image may be determined, and the residual signal within each TU may be rearranged. After that, a transform using a DST-7 transform kernel may be performed, followed by quantization, entropy coding, etc.

[0396] When reconstructing the residual signal of a TU within an inter-frame predicted PU, the decoder performs an inverse DST-7 transform on each TU within the inter-frame predicted PU and performs inverse shuffling on the reconstructed residual signal to obtain the reconstructed residual signal. In this SDST method, SDST is applied to the transform method of all TUs within the inter-frame 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.

[0397] At the same time, 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 rearrangement step as the optimal rearrangement method, and information about the determined rearrangement method can be sent to the decoder using a signal.

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

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

[0400] Reference Figure 19In step S1910, a residual signal of a TU as a transform target may be input. In step S1950, 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 rearrangement in step S1930 and performing DST-7 in step S1940, thereby determining an optimal transform mode (e.g., DST-2 or SDST) in terms of rate-distortion for the TU. Next, in step S1960, quantization may be performed on the transformed TU according to the determined transform mode, and entropy encoding may be performed.

[0401] Meanwhile, the optimal transform mode is selected from SDST and DCT-2 only when the TU satisfies one of the following conditions.

[0402] i) A TU needs to be a CU regardless of the PU partition mode or needs to be obtained from the partitioning of the CU according to a quadtree or a binary tree.

[0403] ii) A TU needs to be a PU according to the PU partition mode or needs to be obtained from the partitioning of the PU according to the quadtree or the binary tree.

[0404] iii) Regardless of the PU partition mode, TUs are not derived from the partitioning of a CU.

[0405] 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 according to a quadtree or a binary tree, or for a TU obtained by partitioning into a CU size, regardless of the PU partition mode.

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

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

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

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

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

[0411] If the SDST flag is true in step S2020, the transform mode of the TU is determined to be the SDST mode. Subsequently, in step S2030, an inverse DST-7 transform is performed on the residual signal within the TU. In step S2040, the residual signal within the TU that has undergone the inverse DST-7 transform is inversely rearranged using Equation 6 according to the position of the TU within the PU. Finally, in step S2060, a reconstructed residual signal is obtained.

[0412] Meanwhile, when the SDST flag is not true at step S2020-No, the transform mode of the TU is determined to be the DCT-2 mode. Subsequently, 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.

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

[0414] Meanwhile, for selective use of DCT-2 or DST-7, sdst_flag can be signaled. The signaling of sdst_flag is performed per TU. sdst_flag can indicate whether SDST is to be performed.

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

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

[0417] First, when the depth of the TU is 0 in step S2120-yes, SDST is not used but DCT-2 is used to reconstruct the TU in steps S2170 and S2180. This is because SDST can be performed between the depth 1 of the TU and the maximum depth value of the TU.

[0418] In addition, although the depth of the TU is not 0 in step S2120-No, when the transform mode of the TU is the transform skip mode and / or the coding block flag (cbf) value of the TU is 0 in step S2130-Yes, in step S2180, the TU is reconstructed without performing inverse transform.

[0419] Meanwhile, when the depth of the TU is not 0 in 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 in step S2130-No, in step S2140, the sdst_flag value is checked.

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

[0421] Here, the signal targeted for rearrangement or re-arrangement 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.

[0422] At the same time, Figure 21 , it is described that sdst_flag is signaled in units of TUs, but 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, even when the depth of the TU is 0, sdst_flag is not signaled.

[0423] Meanwhile, although it is described that sdst_flag is signaled in units of TUs, sdst_flag may be signaled in predetermined units, for example, 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.

[0424] like Figure 20 The SDST mark and Figure 21In an embodiment of the SDST flag in the TU, 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.

[0425] In the case of a TU within an inter-frame-only predicted PU, the transform mode information may be entropy encoded / decoded in bypass mode. In addition, in the case of 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.

[0426] Furthermore, when the coded block flag of a block is 0, entropy encoding / decoding of the transform mode information is omitted and the transform mode information is not signaled. When the coded block flag is 0, inverse transform processing is omitted in the decoder. Therefore, even when the transform mode information is not present in the decoder, reconstruction of the block is possible.

[0427] However, the transformation mode information is not limited to indicating the transformation mode through a flag, and 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.

[0428] At the same time, Figures 18 to 21 , selective use of SDST or DCT-2 is described, but is not limited thereto, and DCT-n or DST-n (n is a positive integer) may be applied instead of DCT-2.

[0429] In addition, the transform of DCT-2 or SDST can be performed separately in the horizontal direction and the vertical direction. The same transform mode can be used for the horizontal direction and the vertical direction, or different transform modes can be used.

[0430] In addition, entropy encoding / decoding can be performed separately for transform mode information regarding whether DCT-2 is used in the horizontal and vertical directions, whether SDST is used, and whether DST-7 is used. 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.

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

[0432] Furthermore, transform mode information may be signaled according to a luminance component or a chrominance component. In other words, transform mode information may be signaled according to a Y component, a Cb component, or a Cr component. For example, when transform mode information regarding whether DCT-2 or SDST is performed is signaled for the Y component, 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.

[0433] 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 index, all or part of the plurality of binary bits may be entropy encoded / decoded using an arithmetic coding method using a context model.

[0434] In addition, the transform mode information can be selectively entropy coded / 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 coded / decoded. When the size is equal to or less than 32×32, the transform mode information is entropy coded / decoded.

[0435] Furthermore, when a non-zero transform coefficient or L quantization levels exist within the current block, entropy encoding / decoding is not performed on the transform mode information, 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 position of the non-zero transform coefficient or quantization level within the block. Furthermore, entropy encoding / decoding of the transform mode information is not performed only when a non-zero transform coefficient or quantization level exists in the upper left position within the block. Here, L may be a positive integer including 0, and may be, for example, 1.

[0436] In addition, when a non-zero transform coefficient or J or more quantized levels exist within the current block, the transform mode information is entropy encoded / decoded. Here, J is a positive integer.

[0437] In addition, the transform mode information is a method in which use of some transform modes is limited according to the transform mode of the co-located block or the transform mode of the co-located block is represented by several bits, and a binarization method of the transform method can be changed.

[0438] The above-mentioned SDST may be used restrictively 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.

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

[0440] 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 may be derived from the decoder based on properties of the current / neighboring block (e.g., size, depth, and / or shape).

[0441] 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 may be variably determined based on information indicating the minimum / maximum size. Information indicating the minimum / maximum size may be signaled from the encoder and may be derived from the decoder based on 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 entropy encoding / decoding is not performed on the transform mode information regarding whether DCT-2 or SDST is used.

[0442] 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, it can be derived from the decoder based on properties of the current / 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, an M×N block, M, N, and / or a ratio between M and N.

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

[0444] Also, a transform method may be selectively used based on partition shapes of CU and PU or the shape of a current block.

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

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

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

[0448] Meanwhile, when SDST or DST-7 is performed in units of blocks obtained from a partition of the current block, scanning and inverse scanning of the transform coefficient (quantization level) may be performed in units of blocks obtained from the partition. In addition, when SDST or DST-7 is performed in units of blocks obtained from a partition of the current block, scanning and inverse scanning of the transform coefficient (quantization level) may be performed in units of the non-partitioned current block.

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

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

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

[0452] Hereinafter, various modifications and embodiments of the rearrangement method and the signal transmission method will be described.

[0453] The SDST of the present invention is intended to enhance image compression efficiency by changing transformation, rearrangement, re-arrangement and / or flipping. Performing DST-7 by rearranging the residual signal effectively reflects the distribution characteristics of the residual signal within the PU, thereby achieving high compression efficiency.

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

[0455] The rearrangement method described below may be applied to at least one of the embodiments related to the SDST method described above.

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

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

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

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

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

[0461] The expression r'(x,y) indicates the residual signal after rearrangement, and the expression r(x,y) indicates the residual signal before rearrangement. The width and height of the block are specified 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 with the same processing as the rearrangement method. That is, the residual signal rearranged using horizontal flipping can be reconstructed into the original residual signal arrangement by performing horizontal flipping again. The rearrangement method performed by the encoder and the inverse rearrangement method performed by the decoder can be the same flipping method.

[0462] For example, as shown below, when horizontal flipping is performed on a residual block on which horizontal flipping has been performed, a residual block before flipping is obtained.

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

[0464] For example, as shown below, when vertical flipping is performed on a residual block on which vertical flipping has been performed, the residual block before flipping is obtained.

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

[0466] For example, as shown below, 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.

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

[0468] A flip-based residual signal rearrangement / rearrangement method 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 a flip-based residual signal rearrangement / rearrangement method 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 a DST-7 transform is performed. In addition, when a flip-based residual signal rearrangement / rearrangement method is used, the current block is not partitioned into sub-blocks, and after performing an inverse DST-7 transform, flipping is performed on the entire current block or a portion of the current block.

[0469] The maximum size (M×N) and / or minimum size (O×P) of a block capable of performing flip-based residual signal rearrangement / rearrangement can 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 a value predefined in the encoder / decoder, or may be information signaled from the encoder to the decoder.

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

[0471] 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 in the horizontal direction is performed using DCT-2 only. Regarding 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, which serves 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.

[0472] For example, when the height of a block is less than the minimum height for which the flipping method can be performed and the width of the block is greater 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 may be 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.

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

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

[0475] 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 DST-7 transform are used for blocks of size 64×64, and only DCT-2 transform is used. Here, for blocks of size 64×64, 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 sizes 4×4 to 32×32, 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 size 64×64, thereby saving memory space required to store the DST-7 transform for blocks of size 64×64.

[0476] 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 but also DCT-2 or DST-7 transform is used for a block having a size of 64×64.

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

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

[0479] 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 reordering / rearrangement method can be performed on each of the two blocks using flipping, followed by a DST-7 transform. 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, for example, 8×8.

[0480] For example, a rectangular block of size 2M×N may be partitioned into two M×N square blocks according to a binary tree, and a reordering / rearrangement method may be performed on each sub-block using flipping, followed by a DST-7 transform. The flipping method for each sub-block may be implicitly determined. For example, horizontal flipping may be determined for the first (left) sub-block, and no flipping may 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 may be positive integers, for example, 4×4.

[0481] For example, a rectangular block of size M×2N may be partitioned into two M×N square blocks according to a binary tree, and a reordering / rearrangement method may be performed on each subblock using flipping, followed by a DST-7 transform. The flipping method for each subblock may be implicitly determined. Vertical flipping may be determined for the first (upper) subblock, and no flipping may be determined for the second (lower) subblock. As described above, when the flipping method is implicitly determined, the flipping method does not need to be signaled. Here, M and N may be positive integers, for example, 4×4.

[0482] 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 of the parent block of the subblock, and this can be determined implicitly. 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.

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

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

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

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

[0487] Transform mode information can be used to entropy encode / decode information about the use of the flip-based residual signal rearrangement / rearrangement method (sdst_flag or sdst flag). 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 rearrangement / rearrangement 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 the transform skip mode, residual differential PCM (RDPCM) mode, and lossless mode, entropy encoding / decoding of the transform mode information is omitted and the transform mode information is not signaled.

[0488] 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 coding block flag of the current block, and information regarding whether transform skip mode is used for the current block. For example, when the coding 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.

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

[0490] Furthermore, in one of transform skip mode, residual differential PCM (RDPCM) mode, and lossless mode, entropy encoding / decoding of the flipping method information is omitted and the flipping method information is 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 the transform mode information is 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.

[0491] In addition, the residual signal rearrangement method is not limited to the above-mentioned residual signal rearrangement, and the rearrangement 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 information about the angle can be performed similarly to the signal transmission method of the transform mode information.

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

[0493] The predetermined angle may be determined differently depending on the position of the sub-block. A rearrangement method that rotates only a sub-block at a specific position (e.g., the first sub-block) among the sub-blocks may be used in a limited manner. Furthermore, the rearrangement using the predetermined angle may be applied to the entire current block. Here, the current block that is the target of 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.

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

[0495] At the same time, a portion of the residual signal rearrangement methods described above regarding the rearrangement step may be determined as the optimal rearrangement method for the encoder, and information about the determined rearrangement method (rearrangement method information) may be signaled to the decoder. For example, when four rearrangement methods are used, the encoder may signal up to two bits of information about the residual signal rearrangement method to the decoder.

[0496] In addition, when the rearrangement methods used have different probabilities of occurrence, a few bits are used to encode the rearrangement method with a high probability of occurrence, and relatively more bits are used to encode the rearrangement method with a low probability of occurrence. For example, four rearrangement methods are arranged in descending order of probability of occurrence and can be signaled as a truncated unary code (e.g., (0, 10, 110, 111) or (1, 01, 001, 000)).

[0497] In addition, the probability of occurrence of the rearrangement method may change according to 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 change according to the prediction mode of the intra-frame prediction. Therefore, for each intra-frame mode, fewer bits may be allocated to the rearrangement method with a high probability of occurrence, and many bits may be allocated to the rearrangement method with a low probability of occurrence. Alternatively, depending on the situation, a rearrangement method with an extremely low probability of occurrence may not be used and no bits may be allocated to it.

[0498] A rearrangement set including at least one of the residual signal rearrangement methods may be constructed based on at least one of the prediction mode (inter mode or intra mode), intra prediction mode (including directional mode and non-directional mode), inter prediction mode, block size, block shape (square or non-square), luminance / chrominance signal, transform mode information, and the like of the current block. The rearrangement may represent flipping. Furthermore, a rearrangement set including at least one of the residual signal rearrangement methods may be constructed based on at least one of the coding parameters of the current block and a neighboring block.

[0499] In addition, at least one of the following rearrangement sets may be selected based on at least one of the prediction mode, intra-frame prediction mode, inter-frame prediction mode, block size, block shape, luminance / chrominance signal, transform mode information, etc. of the current block. In addition, at least one of the rearrangement sets may be selected based on at least one of the coding parameters of the current block and the neighboring blocks.

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

[0501] 1. Do not flip

[0502] 2. Horizontal Flip

[0503] 3. Vertical Flip

[0504] 4. Horizontal and vertical flip

[0505] 5. No flip, and horizontal flip

[0506] 6. No flip, and vertical flip

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

[0508] 8. Horizontal flip and vertical flip

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

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

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

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

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

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

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

[0516] Based on the rearrangement set, at least one of the residual signal rearrangement methods may be used for rearrangement of the current block.

[0517] Furthermore, at least one of the residual signal rearrangement methods may be selected in the rearrangement 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, flipping method information, etc. of the current block. Furthermore, at least one of the residual signal rearrangement methods may be selected in the rearrangement set based on at least one of encoding parameters of the current block and a neighboring block.

[0518] At least one rearrangement 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 prediction, multiple rearrangement sets may be constructed. When the prediction mode of the current block is inter prediction, one rearrangement set may be constructed.

[0519] At least one rearrangement 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 rearrangement set may be constructed. When the intra prediction mode of the current block is a directional mode, multiple rearrangement sets may be constructed.

[0520] At least one rearrangement set may be constructed based on the size of the current block. For example, when the size of the current block is larger than 16×16, one rearrangement set may be constructed. When the size of the current block is equal to or smaller than 16×16, multiple rearrangement sets may be constructed.

[0521] At least one rearrangement set may be constructed based on the shape of the current block. For example, when the current block is square, one rearrangement set may be constructed. When the current block is non-square, multiple rearrangement sets may be constructed.

[0522] At least one rearrangement set may be constructed based on the luminance / chrominance signal of the current block. For example, when the current block is a chrominance signal, one rearrangement set may be constructed. When the current block is a luminance signal, multiple rearrangement sets may be constructed.

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

[0524] In addition, based on the rearrangement set, binarization and debinarization of the index of the residual signal rearrangement method can be performed. Here, the index can be binarized and debinarized into a variable length code or a fixed length code.

[0525] Furthermore, the rearrangement set may be in the form of a table in the encoder and decoder and may be calculated by equations.

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

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

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

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

[0530] [Table 1]

[0531]

[0532] In Table 1, columns (1) to (4) of the residual signal rearrangement method specify the residual signal rearrangement method, such as an index of a scanning / rearrangement order for the above-mentioned residual signal rearrangement, an index for a predetermined angle value, an index for a predetermined flipping method, etc. In Table 1, the symbol * in the column of the residual signal rearrangement method indicates that the corresponding rearrangement method is implicitly used without signal transmission, and the symbol - indicates that the corresponding rearrangement method is not used in the corresponding case. Implicitly using the rearrangement method may mean using the rearrangement method using transform mode information (sdst_flag or sdst flag) without entropy encoding / decoding the index of the residual signal rearrangement method. Columns (1) to (4) of the residual signal rearrangement 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 results of binarization / debinarization for entropy encoding / decoding of the residual signal rearrangement method. As the binarization / debinarization method, a fixed-length code, a truncated unary code, a unary code, etc. can be used. As shown in Table 1, when the current block corresponds to at least one of the prediction mode and the intra-frame 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 can represent 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.

[0533] [Table 2]

[0534]

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

[0536] [Table 3]

[0537]

[0538]

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

[0540] [Table 4]

[0541]

[0542] As another example, as shown in Table 4, when the current block corresponds to at least one of the prediction modes and at least one of the intra prediction modes (directions), 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 the non-flip, horizontal flip, and vertical flip methods is 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 the non-flip, vertical flip, horizontal flip, and vertical flip methods is used as the residual signal rearrangement method.

[0543] [Table 5]

[0544]

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

[0546] [Table 6]

[0547]

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

[0549] [Table 7]

[0550]

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

[0552] [Table 8]

[0553]

[0554]

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

[0556] [Table 9]

[0557]

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

[0559] [Table 10]

[0560]

[0561] As another example, as shown in Table 10, when the current block corresponds to at least one of the prediction modes and at least one of the intra-frame prediction modes (directions), at least one rearrangement method is used in the encoder and the decoder. Here, the 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, the 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.

[0562] [Table 11]

[0563]

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

[0565] [Table 12]

[0566]

[0567]

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

[0569] [Table 13]

[0570]

[0571] As another example, as shown in Table 13, when the current block corresponds to at least one of the prediction modes and at least one of the intra prediction modes (directions), at least one rearrangement method is used in the encoder and the decoder. Here, the residual signal rearrangement method may represent 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 (rearrangement method information) is entropy encoded / decoded using a truncated unary code based on the probability of occurrence. When the intra-frame prediction direction is a horizontal direction or a mode close to the horizontal direction, the probability that the rearrangement method (1) and / or the rearrangement method is (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 meaning of the mode close to the horizontal direction can be that the value of the specific mode is between the value of the horizontal direction mode -K and the value of the horizontal direction mode +K. Here, K can be an integer. For example, when the value of 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 of 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.

[0572] When the intra-frame prediction direction is a vertical direction or a mode close to the vertical direction, the probability that the rearrangement method (1) and / or the rearrangement method is (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 meaning of the mode close to the vertical direction can be that the value of the specific mode is between the value of the vertical direction mode -K and the value of the vertical direction mode +K. Here, K can be an integer. For example, when the value of 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 of 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.

[0573] When the intra-frame 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 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 of the diagonal direction pattern at a 45-degree angle -K and the value of the diagonal direction pattern at a 45-degree angle +K. Here, K may be an integer. For example, when the value of the diagonal direction pattern at a 45-degree angle is 34, 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, 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.

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

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

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

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

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

[0579] 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 situations where the energy of the residual signal increases as the distance from the reference sample point increases, or can be used to reduce the computational complexity in encoding and decoding. 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.

[0580] For a region or CTU within a picture, an entire picture, or a current block within 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. The selection of one of the three methods can be implicitly selected using the current block's neighborhood information, or 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 without flipping being 10, and DST-7 after vertical flipping being 11. Furthermore, depending on the size of the current block and neighborhood information, the DCT-2 binarization and DST-7 binarization can be interchanged for signaling. Furthermore, the first binary digit of the binary number can be signaled per CU, and the remaining binary digits can be signaled per TU or PU. Information about 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.

[0581] For a region or CTU within a picture, an entire picture, or a current block within a group of pictures, 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. Information about which of the four methods will be selected can be implicitly selected using the current block's neighborhood information, or 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 without flipping being 10, DST-7 after horizontal flipping being 110, and DST-7 after vertical flipping being 111. Furthermore, depending on the size of the current block and neighborhood information, the DCT-2 binarization and DST-7 binarization can be interchanged for signaling. Furthermore, the first binary digit of the binary number can be signaled per CU, and the remaining binary digits can be signaled per TU or PU. Depending on the intra prediction mode, only some of the four methods may be used. For example, when the intra prediction mode is numerically smaller than the diagonal prediction mode, is in DC mode, or is in 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 as DCT-2 being 0, DST-7 without flipping being 10, and DST-7 after vertical flipping being 11. For example, when the intra prediction mode is numerically larger than the diagonal prediction mode, only three 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 as DCT-2 being 0, DST-7 without flipping being 10, and DST-7 after horizontal flipping being 11. Information about 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.

[0582] For a region or CTU within a picture, an entire picture, or a current block within 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 methods to be selected can be implicitly selected using neighborhood information of the current block, or 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 nearby information, the DCT-2 binarization and DST-7 binarization can be interchanged for signaling. Furthermore, the first binary digit of the 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 between the first, second, and third binary digits. For example, transform mode information or flipping method information can be signaled with DCT-2 being 0, DST-7 without flipping being 000, DST-7 after horizontal flipping being 001, DST-7 after vertical flipping being 010, and DST-7 after both horizontal and vertical flipping being 011. Furthermore, depending on the intra-frame prediction mode, only some of the five methods may be used. For example, when the intra-frame 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, transform mode information or flip method information may be signaled in such a manner that DCT-2 is 0, DST-7 without flipping is 10, and DST-7 after vertical flipping is 11.

[0583] 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 manner that DCT-2 is 0, DST-7 without flipping is 10, and DST-7 after horizontal flipping is 11.

[0584] 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 without inversion. In this case, the transform mode information or inversion method information can be signaled in such a way that DCT-2 and DST-7 without inversion are 1.

[0585] For example, in addition to the above three cases, all five transform methods can 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 can be signaled as a truncated unary code scheme, a fixed-length code scheme, or other schemes.

[0586] For example, when the intra prediction mode is non-directional, 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 as a truncated unary code scheme, a fixed-length code scheme, or other schemes.

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

[0588] 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 the 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.

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

[0590] Reference Figure 22, in the encoder, the residual signal re-arrangement 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 quantization.

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

[0592] The above has been referenced Figures 7 to 23 The SDST method according to the present invention is described. Figure 24 and Figure 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.

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

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

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

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

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

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

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

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

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

[0602] Although it has been described above that inverse transformation is performed according to the DST-7 transformation mode for the SDST and DST modes, transformation modes based on other DSTs such as DST-1, DST-2, etc. may be used.

[0603] Meanwhile, the determining of 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.

[0604] In addition, in the determination of the transform mode of the current block in step S2401 , the determination may be made 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.

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

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

[0607] (1) Scan from the upper row to the lower row, and scan from left to right within a row

[0608] (2) Scan from the upper row to the lower row, and scan from the right to the left within a row

[0609] (3) Scan from the lower row to the upper row, and scan from left to right within a row

[0610] (4) Scan from the lower row to the upper row, and scan from the right to the left within a row

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

[0612] (6) Scanning from the left column to the right column, and scanning from bottom to top within a column

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

[0614] (8) Scanning from the right column to the left column, and scanning from bottom to top within a column

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

[0616] Meanwhile, regarding the sequence according to 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.

[0617] Furthermore, in step S2403, the rearrangement of the residual data of the current block on which the inverse transform has been performed 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.

[0618] Furthermore, in the rearrangement of the inverse-transformed residual data of the current block in step S2403 , the inverse-transformed residual data arranged within the current block may be rotated by a predefined angle for rearrangement.

[0619] Furthermore, in the rearrangement of the residual data of the current block that has been inversely transformed in step S2403, the residual data arranged in the current block that has been inversely transformed 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 for the current block based on the flipping method information.

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

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

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

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

[0624] Here, the transform mode may include at least one of reordered discrete sine transform (SDST), reordered discrete cosine transform (SDCT), discrete sine transform (DST) and discrete cosine transform (DCT). Figure 24 SDST, SDCT, DST, and DCT have been described, so duplicate descriptions will be omitted.

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

[0626] In addition, in the determination of the transform mode of the current block in step S2501 , the determination may be made 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.

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

[0628] Meanwhile, the rearrangement of the residual data of the current block in step S2502 may include: scanning the residual data arranged in the current block in an order according to the first direction; and rearranging the residual data in the current block scanned in the first direction in an order according to the second direction.

[0629] Furthermore, in the rearrangement of the residual data of the current block in step S2502 , the rearrangement is performed in units of sub-blocks within the current block.

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

[0631] Meanwhile, in the rearrangement of the residual data of the current block in step S2502 , the residual data arranged within the current block may be rotated by a predefined angle for rearrangement.

[0632] Meanwhile, in the rearrangement of the residual data of the current block in step S2502 , according to a flipping method, flipping may be performed on the residual data arranged within the current block for rearrangement.

[0633] 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 rescaled discrete sine transform (SDST), a rescaled discrete cosine transform (SDCT), a discrete sine transform (DST), and a discrete cosine transform (DCT).

[0634] 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 that has been rearranged according to the transform mode of the current block. Here, the transform mode may include at least one of a rescaled discrete sine transform (SDST), a rescaled discrete cosine transform (SDCT), a discrete sine transform (DST), and a discrete cosine transform (DCT).

[0635] 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 that has been rearranged according to the transform mode of the current block. Here, the transform mode may include at least one of a rescaled discrete sine transform (SDST), a rescaled discrete cosine transform (SDCT), a discrete sine transform (DST), and a discrete cosine transform (DCT).

[0636] 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 that has been transformed according to the transform mode of the current block. Here, the transform mode may include at least one of a rescaled discrete sine transform (SDST), a rescaled discrete cosine transform (SDCT), a discrete sine transform (DST), and a discrete cosine transform (DCT).

[0637] According to the bit stream generated by the encoding method using the SDST method of the present invention, the encoding method using the SDST method 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 that has been rearranged according to the transformation mode of the current block, wherein the transformation mode may include at least one of a reordered discrete sine transform (SDST), a reordered discrete cosine transform (SDCT), a discrete sine transform (DST) and a discrete cosine transform (DCT).

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

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

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

[0641] Reference Figure 26 , 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 DCT-2 transform, flipping, 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 a transform coefficient. When the transform method is flipping and DST-7 transform method, one of four flipping methods (no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) is selected to perform flipping on the residual signal, and then DST-7 transform is used to transform the residual signal that has been flipped, thereby generating a transform coefficient. By performing quantization on the transform coefficient, a quantization level can be generated.

[0642] Reference Figure 27 , receiving a quantization level and performing inverse quantization to generate transform coefficients. A method corresponding to the method selected in the encoding process and corresponding to DCT-2 inverse transform or DST-7 inverse transform and flipping can be selected. That is, when DCT-2 transform was performed in the encoding process, DCT-2 inverse transform is performed in the decoding process. Furthermore, when flipping and DST-7 transform methods were performed in the encoding process, DST-7 inverse transform and flipping 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 to generate a reconstructed residual signal. When the inverse transform method is DST-7 inverse transform and flipping, the residual coefficients are inverse transformed using the DST-7 inverse transform to generate a reconstructed residual signal. One of four flipping methods (non-flip, horizontal flip, vertical flip, and horizontal and vertical flip) is then selected to flip the reconstructed residual signal to generate a flipped reconstructed residual signal. The inter-frame or intra-frame prediction signal is added to the reconstructed residual signal or the flipped reconstructed residual signal to generate a reconstructed signal.

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

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

[0645] Reference Figure 28, 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 DCT-2 transform, DST-7 transform, and flipping can be selected as the transform method. When the transform method is DCT-2 transform, the residual signal is transformed using DCT-2 transform to generate transform coefficients. When the transform method is DST-7 transform and flipping method, the residual signal is transformed using DST-7 transform. Subsequently, one of four flipping methods (no 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 that rotates the axes at the zero point of the transform basis, a method of exchanging the positive and negative signs of the transform coefficients, and so on.

[0646] 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 and corresponding to DCT-2 inverse transform or flip and DST-7 inverse transform can be selected. 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 flip method are performed in the encoding process, flip 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 DCT-2 inverse transform, thereby generating a reconstructed residual signal. When the inverse transform method is flip and DST-7 inverse transform method, one of four flip methods (no flip, horizontal flip, vertical flip, and horizontal and vertical flip) is selected to flip the transform coefficients. Subsequently, DST-7 inverse transform is used to inverse transform the flipped transform coefficients, 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.

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

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

[0649] 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. Subsequently, one of the DCT-2 transform and the DST-7 transform 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, the residual signal is transformed using the DST-7 transform to generate transform coefficients. By quantizing the transform coefficients, quantized levels are generated. Furthermore, when the transform method is the 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. Furthermore, when flipping the quantized levels, the quantized levels are rearranged. The rearrangement method can be the same as the flipping method, a method that performs a second transform that rotates the axes at the zero point of the transform basis, a method that swaps the positive and negative signs of the quantized levels, and so on.

[0650] Reference Figure 31 , receiving a quantization level and selecting an inverse transform method corresponding to the method selected in the encoding process and corresponding to an inverse DCT-2 transform and a DST-7 transform. That is, if a DCT-2 transform was performed in the encoding process, an inverse DCT-2 transform is performed in the decoding process. Furthermore, if a DST-7 transform was 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 an inverse DST-7 transform method, one of four flipping methods (non-flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) 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. An inter-frame or intra-frame prediction signal is added to the reconstructed residual signal to generate a reconstructed signal.

[0651] Meanwhile, a position at which the flip method is performed in the decoder may be determined based on information about the flip position signaled from the encoder.

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

[0653] 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 position of the sample points in the residual block can change according to the flip type.

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

[0655] 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. In other words, instead of performing a vertical flip operation, the memory row address for the M×N block is changed to read data within the residual block, thereby achieving vertical flipping.

[0656] In the hardware implementation of horizontal flipping of an M×N residual block, the M×N block is horizontally flipped by changing the data values ​​in the residual block memory in the reverse reading order. In other words, instead of performing a horizontal flip, the order in which the data values ​​of 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.

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

[0658] Reference Figure 34 , at least one of “No-Flip”, “Horizontal Flip (H-Flip)”, “Vertical Flip (V-Flip)” and “Horizontal and Vertical Flip (HV-Flip)” can be performed on the residual block, and DST-7 transformation can be performed. Figure 34 As shown, the positions of samples within the residual block may be changed according to the flip type, and a DST-7 transform may be performed.

[0659] An example using an adaptive multiple transform (AMT) method is shown below, in which at least one transform among the transforms used in the specification is used.

[0660] An AMT set may 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, and DST-7, at least one transform for each block of intra- and inter-coding / decoding may be added to the AMT transform set. Specifically, DST-4 and the identity transform may be added to the AMT transform set for blocks used in inter-coding / decoding, and KLT-1 and KLT-2 may be added to the AMT transform set for blocks used in intra-coding / decoding.

[0661] Transforms corresponding to blocks of sizes that are not 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.

[0662] [Table 14]

[0663]

[0664] In Table 14, the first entry in a transform pair may represent a transform in the vertical direction, and the second entry may represent a transform in the horizontal direction. The transform pair sets in Table 14 can 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 the available transform pair sets corresponding to various block sizes. For example, T0 is applicable to a 2×2 block size, T1 is applicable to a 4×4 block size, T2 is applicable to an 8×8 block size, T3 is applicable to a 16×16 block size, T4 is applicable to a 32×32 block size, T5 is applicable to a 64×64 block size, and T6 is applicable to a 128×128 block size. An identity transform can be applied to blocks up to a size of 16×16. Furthermore, an identity transform can be applied to a block in a pattern that approximates the horizontal and vertical intra prediction directions. The pattern that approximates the horizontal and / or vertical intra prediction directions can be defined as a threshold based on the block size. For example, when the transform index is 3 and the block meets the above conditions, a horizontal and / or vertical identity transform is applied. Meanwhile, in the inter-frame encoding / decoding process, two transform sets each having four transform pairs may be defined as shown in Table 15 below.

[0665] [Table 15]

[0666]

[0667] 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,帧间 ) is applied to blocks of size equal to or less than 16×16, and T 0,帧间 Applicable for blocks larger than 16×16 in size.

[0668] Furthermore, a method for approximating the AMT transform using only the DCT-2 transform and an adjustment step may be used. The adjustment step may be defined using a block-band orthogonal matrix for transforming the DCT-2 transform into a form similar to the AMT transform.

[0669] 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 may be implemented by performing flipping, sign change, etc. based on the DCT-8 transform matrix.

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

[0671] [Table 16]

[0672]

[0673]

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

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

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

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

[0678] [Equation 7]

[0679] Flipped DST-7:

[0680] DST-6:

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

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

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

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

[0685] In the case of chroma components / 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 or the default transform (DCT-2×DCT-2) of the luma component.

[0686] 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 0, 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 to be used only when the width and height of the block are 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.

[0687] A transform set that adds two 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. A 2N+1 FFT can be constructed as a two-dimensional FFT. DCT-8 can be derived from DST-7 by sign change and reordering immediately before and after DST-7 calculation. Therefore, DST-7 can be reused to implement DCT-8.

[0688] The transform or inverse transform for the current block is performed only on the 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 length of the subblock (e.g., 32 samples or 16 samples), the length of the block on which the transform or inverse transform is performed is determined as 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 "0." 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 obtained from transforming the residual signal.

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

[0690] Transformations of the luma component and chroma component according to the intra prediction mode may be expressed as shown in Tables 17 and 18 below, respectively.

[0691] [Table 17]

[0692]

[0693] [Table 18]

[0694]

[0695] 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, position-dependent transforms may be used for the residual signal in merge mode. The transform used for 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.

[0696] The following Table 19 shows a mapping table between MVP positions and transformations.

[0697] [Table 19]

[0698] 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

[0699] In Table 19, for the left MVP candidate, DST-7 and DCT-2 may be used as horizontal and vertical transforms, respectively. In addition, for the upper MVP candidate, DCT-2 and DST-7 may be used as horizontal and vertical transforms, respectively. In other cases, DCT-2 may be used as the default transform. The transform usage information combining AMT transform usage information, primary transform, non-separable secondary transform (NSST) usage information, and secondary transform may be entropy encoded / decoded. The use of AMT and NSST may be represented by a single transform index, rather than independently signaling the index of the primary transform and the index of the secondary transform, the primary transform and the secondary transform may be combined by one transform index for signaling. In addition, the combined transform index may be used for both the luminance component and the chrominance component.

[0700] 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 change according to 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 of the candidate list is used is sent. When the flag indicating whether the first transform of the candidate list is used is 0, the following steps are applied: when the number of non-zero transform coefficient levels is greater than a threshold, a transform index indicating the transform candidate to be used is sent; otherwise, the second transform in the list is used.

[0701] 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 equal to or less than 4, respectively, DST-7 is selected without being signaled.

[0702] In addition, when the number of non-zero transform coefficients is greater than a threshold, an AMT flag is signaled. In the case of inter blocks, the threshold can be set to 2. In the case of intra blocks, the threshold can be set to 0. When the number of non-zero transform coefficients is greater than 2, an AMT index is signaled. Otherwise, it 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.

[0703] Regarding the residual block, when the width of the block is equal to or less than K, DST-7 is used for one-dimensional horizontal transform instead of DCT-2. When the height of the block is equal to or less than L, DST-7 is used for one-dimensional vertical transform instead of DCT-2. 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.

[0704] Instead of 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 achieved. Here, flipping can be at least one of non-flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping. In this case, information about whether the flipped transform / inverse transform is used can be sent by a signal. In addition, information about whether the flipped transform / inverse transform is used can be sent by a signal for each of the horizontal transform / inverse transform and the vertical transform / inverse transform.

[0705] Furthermore, instead of 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 has been flipped may be signaled. Furthermore, information regarding whether the transform / inverse transform matrix has been flipped may be signaled for each of the horizontal transform / inverse transform and the vertical transform / inverse transform.

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

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

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

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

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

[0711] 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, flipping method information used in horizontal transformation / inverse transformation or vertical transformation / inverse transformation may be signaled.

[0712] Furthermore, DCT-4 can be used instead of DST-7. A 2N-1 DCT-4 transform / inverse transform matrix is ​​extracted from a 2N-sized DCT-2 transform / inverse transform matrix for use, allowing only the DCT-2 transform / inverse transform matrix to be stored in the encoder / decoder, without the DCT-4 matrix, thereby reducing the memory requirements of the encoder / decoder. Furthermore, the 2N-1 DCT-4 transform / inverse transform matrix is ​​logically utilized from the 2N-sized DCT-2 transform / inverse transform matrix, reducing the chip area required to implement the encoder / decoder. The above examples apply not only to DCT-2 and DCT-4, but also when there is a transform matrix or transform logic shared between at least one type of DST transform / inverse transform and at least one type of DCT transform / inverse transform. That is, from one transform / inverse transform matrix or logic, another transform / inverse transform matrix or logic can be extracted for use. Furthermore, for a specific transform / inverse transform size, from one transform / inverse transform matrix or logic, another transform / inverse transform matrix or logic can be extracted for use. Also, from one transform / inverse transform matrix, another transform / inverse transform matrix may be extracted in at least one unit of a matrix unit, a basis vector unit, and a matrix coefficient unit.

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

[0714] Furthermore, at least one of the transforms used in the specification as DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. may be replaced by at least one transform calculated based on 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 transforms of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. may be integer transforms. 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 a result of performing a left shift operation on coefficient values ​​within a transform matrix of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. by N. Here, N may be a positive integer.

[0715] 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 one or more, and for example, the numbers 1 to 9 may have the same meanings as Roman numerals I to IX.

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

[0717] Furthermore, in the case of square blocks, the transform used in the specification may be performed using a square transform format. In the case of non-square blocks, the transform may be performed using a non-square transform format. 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 using a square transform format on the region. 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 using a non-square transform format on the region.

[0718] Furthermore, in the specification, the information on the rearrangement method may be flip method information.

[0719] Furthermore, transform used in the specification may mean at least one of transform and inverse transform.

[0720] 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 to improve subjective / objective image quality of the image.

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

[0722] Transform type information regarding which transform is used as transform and inverse transform may be explicitly entropy encoded / decoded. Furthermore, transform type information regarding which transform is used as transform and inverse transform may be implicitly determined based on at least one of the coded coefficients without entropy encoding / decoding the transform type information.

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

[0724] 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 / entropy decoding may be performed. Such a mode may be referred to as a first sub-block partitioning mode (e.g., ISP mode or intra-frame sub-partitioning mode).

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

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

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

[0728] In addition, the block or the sub-block obtained from the partition 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 or the sub-block obtained from the partition may be an intra-frame prediction block.

[0729] 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 or the partitioned sub-block may be a luminance signal block.

[0730] 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. In other words, the size of the partitioned sub-blocks can be used to perform prediction, transform / inverse transform, quantization / dequantization, and entropy encoding / decoding of transform coefficients.

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

[0732] Whether to partition a block into a plurality of sub-blocks may be determined based on at least one of an area (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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0749] 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 may be partitioned into two sub-blocks in a vertical direction.

[0750] 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 may be partitioned into four sub-blocks in a horizontal direction.

[0751] 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 may be partitioned into four sub-blocks in a vertical direction.

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

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

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

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

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

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

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

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

[0760] 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 in a vertical direction.

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

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

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

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

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

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

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

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

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

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

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

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

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

[0774] 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 / entropy decoding is performed in units of subblocks, at least one of the subblock partition mode information or the partition direction information may be entropy encoded / entropy decoded.

[0775] Here, the subblock partition mode information may be used to indicate the subblock partition mode. When the subblock partition mode is indicated to be 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 / entropy decoding may be performed. When the subblock partition mode is indicated not to be 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 / entropy decoding may be performed. Here, the first value may be 0 and the second value may be 1.

[0776] 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 into sub-blocks in a 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 into sub-blocks in a vertical direction, and the second value may be 1.

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

[0778] 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 the second reference sample line or a larger reference sample line may be used as a reconstruction reference line around the current block.

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

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

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

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

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

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

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

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

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

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

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

[0790] 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).

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

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

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

[0794] As another example, when the size of the subblock is 32×4 and the shape thereof is rectangular, the size of the coefficient group may be determined to be at least one of 4×4 or 8×2.

[0795] As another example, when the size of the subblock is 8×64 and the shape thereof is rectangular, the size of the coefficient group may be determined to be at least one of 4×4 or 2×8.

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

[0797] As another example, when 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.

[0798] As another example, when 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.

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

[0800] For each partitioned sub-block, a coding block flag indicating whether at least one transform coefficient having a non-zero value exists in a sub-block unit may be entropy encoded / decoded.

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

[0802] As another example, when m represents the total number of subblocks and the coding block flags of the first m-1 subblocks from 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 is at least one transform coefficient having a non-zero value.

[0803] As another example, when entropy encoding / decoding is performed on the coding block flag in units of sub-blocks, the coding block flag may be entropy encoded / decoded in units of blocks before partitioning.

[0804] 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 sub-blocks.

[0805] Meanwhile, when the current block is in the first subblock partitioning 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.

[0806] 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 can be vertically partitioned into subblocks with a size of 4×N for intra prediction, and the current block can be vertically partitioned into subblocks with a size of 1×N for transform. In this case, a one-dimensional transform / inverse transform can be performed to perform a transform with a size of 1×N. That is, a one-dimensional transform / inverse transform can be performed based on at least one of the partition mode of the current block or the size of the current block.

[0807] 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 having a size of 4×N for intra prediction, and the current block may be vertically partitioned into subblocks having a size of 2×N for transform. In this case, a two-dimensional transform / inverse transform may be performed to perform a transform having a size of 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.

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

[0809] Also, the size of the current block may mean at least one of the size of a coding block of the current block, the size of a prediction block, or the size of a transform block.

[0810] like Figure 35 In the example, according to an embodiment of the first sub-block partitioning mode, the current block may be partitioned into two sub-blocks in a horizontal direction, and the current block may be partitioned into two sub-blocks in a vertical direction.

[0811] like Figure 36 In the example, according to an embodiment of the first sub-block partitioning mode, the current block may be partitioned into two sub-blocks in a horizontal direction, and the current block may be partitioned into two sub-blocks in a vertical direction.

[0812] like Figure 37 In the example, according to an embodiment of the first sub-block partitioning mode, the current block may be partitioned into four sub-blocks in a horizontal direction, and may be partitioned into four sub-blocks in a vertical direction.

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

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

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

[0816] In addition, the block or the partitioned block may be at least one of an intra block, an inter block, or an intra block copy block. For example, the block or the partitioned block may be an inter block.

[0817] In addition, the block or the partitioned 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.

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

[0819] 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 or a transform block. That is, the size of the partitioned sub-blocks can be used to perform transformation / inverse transformation, quantization / dequantization, and entropy encoding / decoding of transform coefficients.

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

[0821] Whether to partition a block 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.

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

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

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

[0825] As another examp...

Claims

1. A method for decoding a video, the method comprises: decoding, from a bitstream, first index information indicating whether a secondary inverse transform is applied to a current block; and determining a transform type of a primary inverse transform of the current block, wherein the transform type includes a horizontal transform type and a vertical transform type, wherein, based on the first index information, it is determined whether to decode, from the bitstream, second index information indicating the transform type of the current block, wherein, when the first index information is greater than 0, decoding the second index information from the bitstream is omitted.

2. The method according to claim 1, wherein, when decoding the second index information is omitted, the transform type of the current block is determined in consideration of whether an intra sub - partition ISP mode is applied to the current block.

3. The method according to claim 2, wherein, when the ISP mode is not applied to the current block, the horizontal transform type is determined based on the width of the current block, and the vertical transform type is determined based on the height of the current block.

4. The method according to claim 3, wherein, when the ISP mode is applied to the current block, the horizontal transform type and the vertical transform type are set to a default type.

5. The method according to claim 4, wherein, the default type is DCT - 2.

6. A method for encoding a video, the method comprises: determining a transform type of a primary inverse transform of the current block, wherein the transform type includes a horizontal transform type and a vertical transform type; and encoding first index information indicating whether a secondary transform is applied to the current block into the bitstream, wherein, based on the first index information, it is determined whether to encode second index information indicating the transform type of the current block into the bitstream, wherein, when the first index information is greater than 0, encoding the second index information into the bitstream is omitted.

7. A device for transmitting compressed video data, the device comprises: a processor, configured to obtain compressed video data; and a transmitting unit, configured to transmit the compressed video data, wherein the step of obtaining the compressed video data includes: determining a transform type of a primary inverse transform of the current block, wherein the transform type includes a horizontal transform type and a vertical transform type; and encoding first index information indicating whether a secondary transform is applied to the current block into the bitstream, wherein, based on the first index information, it is determined whether to encode second index information indicating the transform type of the current block into the bitstream, wherein, when the first index information is greater than 0, encoding the second index information into the bitstream is omitted.