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

By using one-dimensional and two-dimensional transformation methods in video encoding/decoding, determining whether secondary transformation is performed, the problem of high-resolution image data transmission and storage costs is solved, improving image quality and reducing costs.

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

Patent Information

Application Number
CN202510225740.3
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 problem of increasing cost of high-resolution and high-quality image data in transmission and storage, and requires efficient image encoding/decoding technology.

Method used

A method based on the one-dimensional transformation type, two-dimensional transformation combination, and whether the transformation is used is used to determine the reduced secondary transformation/inverse transformation matrix set and matrix, and then determine whether the secondary transformation/inverse transformation is performed.

Benefits of technology

By reducing the use of secondary transformation/inverse transformation, the objective and subjective quality of the image are improved, and the cost of data transmission and storage is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075433A_ABST
    Figure CN120075433A_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, an application number of 202080040520.9, and a title of "Image Encoding / Decoding Method and Apparatus Using Secondary Transform and Recording Medium Storing Bitstream". Technical Field

[0002] The present invention relates to an image encoding / decoding method and apparatus, and a recording medium for storing a bitstream. More specifically, the present invention relates to a method and apparatus for encoding / decoding video based on a transform. Background Art

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

[0004] There are various video compression techniques, such as an inter-frame prediction technique for predicting the value of a pixel in a current picture from the values of pixels in a previous picture or a subsequent picture, an intra-frame prediction technique for predicting the value of a pixel in another area of a current picture from the values of pixels in an area of the current picture, a transform and quantization technique for compressing the energy of a residual signal, and an entropy encoding technique for assigning shorter codes to frequently occurring pixel values and longer codes to less frequently occurring pixel values. Summary of the Invention

[0005] Technical Problem

[0006] In order to improve the objective quality 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 secondary transform / inverse transform matrix set, a reduced secondary transform / inverse transform matrix, and whether to perform a reduced secondary 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 the secondary transform / inverse transform to the current block, determining a secondary transform matrix of the current block according to the transform matrix index; and applying the 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 transform matrix of the current block may include: determining the secondary transform matrix of the current block according to at least one of the transform matrix index, a transform matrix set index of the current block, and a size of the current block.

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

[0012] According to an embodiment, when predicting the current block 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 luminance 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 luminance component indicates that the transform skip mode is applied to the luminance 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 luminance type and the transform skip mode flag of the luminance component indicates that the transform skip mode is applied to the luminance 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 chrominance 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 the secondary transform / inverse transform to the current block based on the transform matrix index may include: determining whether to apply the secondary transform / inverse transform to the current block based on at least one of the transform matrix index, the size of the current block, and the transform skip mode flag.

[0018] The present disclosure provides a video coding method, the method including: performing entropy coding on a transform skip mode flag indicating whether the 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 the 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, determining whether to apply the secondary transform / inverse transform to the current block, and performing entropy coding on the transform matrix index of the secondary transform / inverse transform of the current block according to whether the secondary transform / inverse transform is applied to the current block.

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

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

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

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

[0023] According to an embodiment, the step of entropy coding the transform skip mode flag may include: entropy coding the transform skip mode flag of the luminance component, the transform skip mode flag of the Cb component, and the transform skip mode flag of the 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 luminance component indicates that the transform skip mode is applied to the luminance 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 luminance type and the transform skip mode flag of the luminance component indicates that the transform skip mode is applied to the luminance 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 a secondary transform / inverse transform to the current block may include: when the tree structure of the current block is a dual-tree chrominance 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 a secondary transform / inverse transform to the current block.

[0027] According to an embodiment, it is determined whether to apply a secondary transform / inverse transform to the current block 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, the bitstream being generated by encoding a video by a video encoding method. Here, the video encoding method includes: entropy encoding a transform skip mode flag indicating whether the 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, determining whether to apply a secondary transform / inverse transform to the current block, and entropy encoding a transform matrix index of the secondary transform / inverse transform of the current block according to whether the secondary transform / inverse transform is applied to the current block.

[0029] Advantageous Effects

[0030] The present invention can improve the objective quality and subjective quality of an image by providing an image encoding / decoding method and apparatus for determining at least one of a reduced secondary transform / inverse transform matrix set, a reduced secondary transform / inverse transform matrix, and whether to perform a reduced secondary 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 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 the 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 showing a partition structure of an image when the image is encoded and decoded.

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

[0035] Figure 5 It is a diagram showing an embodiment of inter - picture prediction processing.

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

[0037] Figure 7 It is a diagram showing reference sample points that can be used for intra - prediction.

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

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

[0040] Figure 9 It is a diagram showing the distribution of average residual values of positions within a 2N×2N prediction unit (PU) of an 8×8 coding unit (CU) predicted according to an inter - frame mode, where the "Cactus" sequence is obtained through testing in a low - latency P profile environment.

[0041] Figure 10 It is a three - dimensional graph showing the distribution characteristics of residual signals within a 2N×2N prediction unit (PU) of an 8×8 coding unit (CU) predicted according to an inter - frame prediction mode (inter - frame mode).

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

[0043] Figure 12 It is a diagram showing the distribution characteristics of residual signals before and after rearrangement of a 2N×2N prediction unit (PU) according to the present invention.

[0044] Figure 13 It is a diagram showing an example of 4×4 residual data rearrangement of sub - blocks according to the present invention.

[0045] Figure 14a and Figure 14b It is a diagram showing an embodiment of the transform unit (TU) partition structure of a coding unit (CU) according to the rearrangement method of a prediction unit (PU) mode and a transform unit (TU).

[0046] Figure 15 It is a diagram showing the results of performing DCT - 2 transform and SDST transform according to the distribution of residual signals of a 2N×2N prediction unit (PU).

[0047] Figure 16 It is a diagram showing the SDST processing according to the present invention.

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

[0049] Figure 18 It is a diagram showing the residual signal scanning order and rearrangement order of the transform unit (TU) with depth 0 within the prediction unit (PU) according to an embodiment of the present invention.

[0050] Figure 19 It is a flowchart showing the DCT-2 or SDST selection coding process according to the rate-distortion optimization (RDO) of the present invention.

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

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

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

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

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

[0056] Figure 26 It is a diagram showing an embodiment of the coding process in the method of performing transformation after flipping.

[0057] Figure 27 It is a diagram showing an embodiment of the decoding process in the method of performing flipping after inverse transformation.

[0058] Figure 28 It is a diagram showing an embodiment of the coding process in the method of performing flipping after transformation.

[0059] Figure 29 It is a diagram showing an embodiment of the decoding process in the method of performing inverse transformation after flipping.

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

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

[0062] Figure 32 It is a diagram showing flipping of a residual block.

[0063] Figure 33 It is a diagram showing an embodiment of implementing flipping of an 8×8-sized residual block as hardware.

[0064] Figure 34 It is a diagram showing flipping and transformation of a residual block.

[0065] Figures 35 to 37 It is a diagram showing an embodiment of the first sub-block partitioning pattern according to the present invention.

[0066] Figure 38 It is a diagram showing an embodiment of the second sub-block partitioning pattern according to the present invention.

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

[0068] Figure 40 It is a diagram showing an embodiment of horizontal scanning.

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

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

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

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

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

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

[0075] Figure 47 It is a diagram showing various embodiments of scanning based on the shape of a block.

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

[0077] Figures 49 to 53 A diagram showing an example of encoding processing or decoding processing using a transform according to an embodiment of the present invention.

[0078] Figure 54 An embodiment showing the execution of a secondary transform and / or a secondary inverse transform in an encoder / decoder.

[0079] Figure 55 An embodiment showing a secondary transform matrix.

[0080] Figure 56 A reduced secondary transform / inverse transform process is shown.

[0081] Figures 57 to 68 Multiple embodiments showing that a transform matrix is derived according to a block size, a transform matrix set index, and a transform matrix index are shown.

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

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

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

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

[0089] Inventive Mode

[0090] Various modifications can be made to the present invention, and there are various embodiments of the present invention. Among them, examples of various embodiments of the present invention will now be provided and described in detail with reference to the accompanying drawings. However, the present invention is not limited thereto, although the exemplary embodiments can be interpreted as including all modifications, equivalents or alternatives within the technical concept and technical scope of the present invention. In all 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, in which specific embodiments in which the present invention can be practiced are shown in an illustrative manner. 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, without departing from the spirit and scope of the present disclosure, the specific features, structures, and characteristics described herein in connection with one embodiment can be implemented in other embodiments. Additionally, it should be understood that without departing from the spirit and scope of the present disclosure, the positions or arrangements of the respective elements within each disclosed embodiment can be modified. Therefore, the following detailed description should not be considered limiting in nature, and the scope of the present disclosure is defined only by the appended claims (interpreted appropriately, together with the full scope of equivalents claimed by the claims).

[0091] The terms "first", "second", etc. used in the specification may be used to describe various components, but the components should not be construed as limited to these terms. These terms are only used to distinguish one component from other components. For example, without departing from the scope of the present invention, the "first" component may be named the "second" component, and the "second" component may also be similarly named the "first" component. The term "and / or" includes combinations of multiple items or any one of multiple items.

[0092] It will be understood that in this specification, when an element is simply referred to as "connected to" or "coupled to" another element rather than "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 in the case where other elements are interposed between the element and the other element. Conversely, it should be understood that when an element is referred to as "directly coupled" or "directly connected" to another element, there is no intermediate element.

[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 constituted by a separate hardware or software component unit. In other words, for convenience, each component includes each of the listed components. Therefore, at least two components of each component may be combined to form one component, or one component may be divided into multiple components to perform each function. Embodiments in which each component is combined and embodiments in which one component is divided are also included in the scope of the present invention without departing from the essence of the present invention.

[0094] The terms used in this specification are only for describing specific embodiments and are not intended to limit the present invention. Unless having an obviously different meaning in the context, expressions used in the singular form include those in the plural form. In this specification, it will be understood that terms such as "including", "having", etc. are intended to indicate the existence of features, numbers, steps, actions, elements, components, or combinations thereof disclosed in the specification, and are not intended to exclude the possibility of the existence or addition of one or more other features, numbers, steps, actions, elements, components, or combinations thereof. In other words, when a specific element is referred to as "being included", elements other than the corresponding element are not excluded, but additional elements may be included in the embodiments 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 are only optional components for improving its performance. The present invention can be implemented by including only the essential components for realizing the essence of the present invention and not including the components for improving performance. Structures that include only the essential components and do not include the optional components for only improving 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 the 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 drawings are denoted 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" may refer to "encoding or decoding a moving picture or both encoding and decoding", and may refer to "encoding or decoding or both encoding and decoding one image in the images of a moving picture".

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

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

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

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

[0102] Hereinafter, the terms "block" and "unit" may be used with the same meaning and may be interchangeable with each other. Or "block" may represent a specific unit.

[0103] Hereinafter, the terms "region" and "segment" may be interchangeable with each other.

[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 specific information, data, flag, index, element, and attribute, etc. may have a value. A value of the information, data, flag, index, element, and attribute equal to "0" may represent logical false or a first predefined value. In other words, the values "0", false, logical false, and the first predefined value may be interchangeable with each other. A value of the information, data, flag, index, element, and attribute equal to "1" may represent logical true or a second predefined value. In other words, the values "1", true, logical true, and the second predefined value may be interchangeable with each other.

[0106] When variables i or j are used to represent a column, row, or index, the value of i may be an integer equal to or greater than 0, or an integer equal to or greater than 1. That is, counting of columns, rows, indexes, etc. may start from 0, or may start from 1.

[0107] Term description

[0108] Encoder: Represents a device that performs encoding. That is, represents an encoding device.

[0109] Decoder: Represents a device that performs decoding. That is, represents a decoding device.

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

[0111] Sample: A sample is a basic unit that constitutes a block. Depending on the bit depth (Bd), a sample can be represented as a value from 0 to 2 Bd -1. In the present invention, a sample can be used in the sense of a pixel. That is, a sample, a pel, and a pixel can have the same meaning as each other.

[0112] Unit: A unit can refer to an encoding and decoding unit. When encoding and decoding an image, a unit can be a region generated by partitioning a single image. Additionally, when a single image is partitioned into sub-partition units during encoding or decoding, a unit can represent a sub-partition unit. That is, an image can be partitioned into multiple units. When encoding and decoding an image, predetermined processing can be performed for each unit. A single unit can be partitioned into sub-units with a size smaller than the size of the unit. Depending on the function, a unit can represent a block, a macroblock, a coding tree unit, a coding tree block, an encoding unit, an encoding block, a prediction unit, a prediction block, a residual unit, a residual block, a transform unit, a transform block, etc. Additionally, in order to distinguish a unit from a block, a unit can include a luminance component block, chrominance component blocks associated with the luminance 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, etc. Additionally, unit information can include at least one of a unit type indicating an encoding unit, a prediction unit, a transform unit, etc., and a unit size, a unit depth, an encoding and decoding order of the unit, etc.

[0113] Coding Tree Unit: A coding tree unit is configured with a single coding tree block of the luminance component Y and two coding tree blocks related to the chrominance components Cb and Cr. Additionally, a coding tree unit can represent including a block and syntax elements for each block. Each coding tree unit can 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 an encoding unit, a prediction unit, a transform unit, etc. A coding tree unit can be used as a term for specifying a block of samples that becomes a processing unit when encoding / decoding an image as an input image. Here, a quadtree can represent a quadtree.

[0114] When the size of a coding block is within a predetermined range, quadtree partitioning can be used for division only. Here, the predetermined range can be defined as at least one of the maximum size and the minimum size of coding blocks that can be divided using quadtree partitioning only. Information indicating the maximum / minimum size of coding blocks allowing quadtree partitioning can be signaled by a bitstream, and the information can be signaled in at least one unit among a sequence, picture parameters, parallel block groups, or slices (segments). Optionally, the maximum / minimum size of coding blocks can be a fixed size predetermined in an encoder / decoder. For example, when the size of a coding block corresponds to 256×256 to 64×64, division using quadtree partitioning only is possible. Optionally, when the size of a coding block is larger than the size of the maximum transform block, division using quadtree partitioning only is possible. Here, the block to be divided can be at least one of a coding block and a transform block. In this case, information indicating the division of a coding block (e.g., split_flag) can be a flag indicating whether quadtree partitioning is performed. When the size of a coding block falls within the predetermined range, division using binary tree or ternary tree partitioning only is possible. In this case, the above description of quadtree partitioning can be applied to binary tree partitioning or ternary tree partitioning in the same manner.

[0115] Coding tree block: A term that can be used to specify any one of a Y coding tree block, a Cb coding tree block, and a Cr coding tree block.

[0116] Neighboring block: Can represent a block adjacent to a current block. A block adjacent to a current block can represent a block that touches the boundary of the current block or a block located within a predetermined distance from the current block. A neighboring block can represent a block adjacent to a vertex of the current block. Here, a block adjacent to a vertex of the current block can represent a block that is vertically adjacent to a horizontally neighboring block of the current block or a block that is horizontally adjacent to a vertically neighboring block of the current block.

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

[0118] Unit depth: It can represent the degree of partitioning of a unit. In a tree structure, the highest node (root node) can correspond to the first unit that is not partitioned. Additionally, the highest node can have the minimum depth value. In this case, the depth of the highest node can be level 0. A node with a depth of level 1 can represent a unit generated by 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 is a node that cannot be further partitioned. The depth of a leaf node can be the maximum level. For example, a predefined value for 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. Additionally, when a unit is represented as a tree structure, the level in which the unit exists can represent the unit depth.

[0119] Bitstream: It can represent a bitstream including encoded image information.

[0120] Parameter set: It corresponds to the header information among the configurations within the bitstream. At least one of a video parameter set, a sequence parameter set, a picture parameter set, and an adaptive parameter set can be included in the parameter set. In addition, the parameter set can include slice headers, tile group headers, and tile header information. The term "tile group" represents a group of tiles and has the same meaning as a slice.

[0121] An adaptive parameter set can represent a parameter set that can be shared by being referenced in different pictures, sub-pictures, slices, tile groups, tiles, or blocks. Additionally, the information in the adaptive parameter set can be used by referring to different adaptive parameter sets for sub-pictures, slices, tile groups, tiles, or blocks within a picture.

[0122] In addition, regarding the adaptive parameter set, different adaptive parameter sets can be referred to by using the identifiers of different adaptive parameter sets for sub-pictures, slices, tile groups, tiles, or blocks within a picture.

[0123] In addition, regarding the adaptive parameter set, different adaptive parameter sets can be referred to by using the identifiers of different adaptive parameter sets for slices, tile groups, tiles, or blocks within a sub-picture.

[0124] In addition, regarding the adaptive parameter set, different adaptive parameter sets can be referred to by using the identifiers of different adaptive parameter sets for tiles or blocks within a slice.

[0125] In addition, regarding the adaptive parameter set, different adaptive parameter sets can be referred to by using the identifiers of different adaptive parameter sets for blocks within a tile.

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

[0127] Information about an adaptive parameter set identifier may be included in the parameter set or header of a parallel block, and the adaptive parameter set corresponding to the adaptive parameter set identifier may be used for the parallel block.

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

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

[0130] A sub - picture may be partitioned into one or more parallel block rows and one or more parallel block columns within the picture. A sub - picture may be a region within the picture having a rectangular / square form and may include one or more CTUs. Additionally, at least one or more parallel blocks / partitioned blocks / strips may be included within one sub - picture.

[0131] A parallel block may be a region within the picture having a rectangular / square form and may include one or more CTUs. Additionally, a parallel block may be partitioned into one or more partitioned blocks.

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

[0133] A strip may include one or more parallel blocks within the picture and may include one or more partitioned blocks within the parallel block.

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

[0135] Symbol: may represent at least one of a syntax element, an encoding parameter, and a transform coefficient value of an encoding / decoding target unit. Additionally, a symbol may represent an entropy encoding target or an entropy decoding result.

[0136] Prediction mode: may be information indicating a mode encoded / decoded using intra - prediction or a mode encoded / decoded using inter - prediction.

[0137] Prediction unit: It can represent the basic unit 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 with smaller sizes, or can be partitioned into multiple subordinate prediction units. Multiple partitions can be the basic units when performing prediction or compensation. The partitions generated by dividing the prediction unit can also be prediction units.

[0138] Prediction unit partition: It can represent the shape obtained by partitioning the prediction unit.

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

[0140] The inter-frame prediction indicator can refer to the direction of inter-frame prediction of the current block (unidirectional prediction, bidirectional prediction, etc.). Optionally, the inter-frame prediction indicator can refer to the number of reference pictures used to generate the prediction block of the current block. Optionally, the inter-frame prediction indicator can refer to 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 specific reference picture list is used to generate the prediction block. The prediction list utilization flag can be used to derive the inter-frame prediction indicator, and conversely, the inter-frame 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 can refer to the index indicating a specific reference picture in the reference picture list.

[0143] The reference picture can represent the reference picture referred to by a specific block for the purpose of inter-frame prediction or motion compensation of the specific block. Optionally, the reference picture can be a picture including the reference blocks referred to by the current block for inter-frame prediction or motion compensation. Hereinafter, the terms "reference picture" and "reference image" have the same meaning and can be interchanged.

[0144] The motion vector can be a two-dimensional vector for inter-frame prediction or motion compensation. The motion vector can represent the offset between the coded / decoded target block and the reference block. For example, (mvX, mvY) can represent the 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 prediction to retrieve a motion vector. For example, the size of the search range may be M×N. Here, both M and N are integers.

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

[0147] A motion vector candidate list may represent a list composed of one or more motion vector candidates.

[0148] A motion vector candidate index may represent an indicator that indicates a motion vector candidate in the motion vector candidate list. Optionally, it may be an index of a motion vector prediction factor.

[0149] 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] A merge candidate list may represent a list composed of one or more merge candidates.

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

[0152] A merge index may represent an indicator that indicates a merge candidate in the merge candidate list. Optionally, 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. Optionally, the merge index may indicate at least one motion information of the merge candidate.

[0153] Transform unit: may represent a basic unit when performing encoding / decoding on a residual signal (such as transformation, inverse transformation, quantization, dequantization, transform coefficient encoding / decoding). A single transform unit may be partitioned into multiple subordinate transform units with smaller sizes. Here, the transform / inverse transform may include at least one of a primary transform / primary inverse transform and a secondary transform / secondary inverse transform.

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

[0155] Quantization parameter: A value that can represent the value used when transform coefficients are used to generate quantized levels during quantization. The quantization parameter can also represent the value used when transform coefficients are generated by scaling quantized levels during dequantization. The quantization parameter can be a value mapped to a quantization step size.

[0156] Delta quantization parameter: A value that can represent the difference between a predicted quantization parameter and the quantization parameter of an encoded / decoded target unit.

[0157] Scanning: A method that can represent sorting coefficients within a unit, block, or matrix. For example, converting a two-dimensional matrix of coefficients into a one-dimensional matrix can be referred to as scanning, and converting a one-dimensional matrix of coefficients into a two-dimensional matrix can be referred to as scanning or inverse scanning.

[0158] Transform coefficient: A coefficient value that can represent the value generated after performing a transform in an encoder. The transform coefficient can represent the value generated after performing at least one of entropy decoding and dequantization in a decoder. The quantized level or quantized transform coefficient level obtained by quantizing a transform coefficient or a residual signal can also fall within the meaning of a transform coefficient.

[0159] Quantized level: A value that can represent the value generated by quantizing a transform coefficient or a residual signal in an encoder. Optionally, the quantized level can represent the value of a dequantization target that undergoes dequantization in a decoder. Similarly, the quantized transform coefficient level as a result of transform and quantization can also fall within the meaning of a quantized level.

[0160] Non-zero transform coefficient: A transform coefficient with a value other than zero, or a transform coefficient level or quantized level with a value other than zero.

[0161] Quantization matrix: A matrix that can represent the matrix used in a quantization process or a dequantization process performed to improve subjective image quality or objective image quality. The quantization matrix can also be referred to as a scaling list.

[0162] Quantization matrix coefficient: Each element within a quantization matrix. The quantization matrix coefficient can also be referred to as a matrix coefficient.

[0163] Default matrix: A predefined quantization matrix in an encoder or decoder.

[0164] Non-default matrix: A quantization matrix that is not predefined in an encoder or decoder but signaled by a user.

[0165] Statistical value: The statistical value for at least one of a variable, coding parameter, constant value, etc. with a computable 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, interpolation of the corresponding specific value.

[0166] Figure 1 It is a block diagram showing the 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. The video may include at least one image. The encoding device 100 may sequentially encode at least one image.

[0168] Referring to Figure 1 , the encoding device 100 may include a motion prediction unit 111, a motion compensation unit 112, an intra prediction unit 120, a switch 115, a subtractor 125, a 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 may perform encoding of an input image by using an intra mode or an inter mode or both an intra mode and an inter mode. In addition, the encoding device 100 may generate a bitstream including encoding information by encoding the input image, and output the generated bitstream. The generated bitstream may be stored in a computer-readable recording medium, or may be streamed through a wired / wireless transmission medium. When the intra mode is used as a prediction mode, the switch 115 may switch to intra. Optionally, when the inter mode is used as a prediction mode, the switch 115 may switch to the inter mode. Here, the intra mode may represent an intra prediction mode, and the inter mode may represent an inter prediction mode. The encoding device 100 may generate a prediction block for an input block of the input image. In addition, the encoding device 100 may encode a residual block by using the residual between the input block and the prediction block after generating the prediction block. The input image may be referred to as a current image that is a current encoding target. The input block may be referred to as a current block that is a current encoding target, or may be referred to as an encoding target block.

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

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

[0172] The motion compensation unit 112 may perform motion compensation on the current block by using the motion vector to generate a prediction block. Here, inter-frame prediction may represent 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 region of the reference picture. To perform inter-picture prediction or motion compensation on an encoding unit, it may be determined which one of the skip mode, merge mode, advanced motion vector prediction (AMVP) mode, and current picture reference mode is used for the motion prediction and motion compensation of the prediction unit included in the corresponding encoding unit. Then, inter-picture prediction or motion compensation may be performed differently according to the determined mode.

[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 both transforming and quantizing the difference between the original signal and the prediction signal. The residual block may be the residual signal in block units.

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

[0176] Quantized levels may be generated by applying quantization to the transform coefficients or to the residual signal. Hereinafter, the quantized levels may also be referred to as transform coefficients in the embodiments.

[0177] The quantization unit 140 may generate quantized levels by quantizing the transform coefficients or the residual signal according to parameters, and output the generated quantized levels. Here, the quantization unit 140 may quantize the transform coefficients by using a quantization matrix.

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

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

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

[0181] Coding parameters may include information such as syntax elements (flags, indices, etc.) that are coded in an encoder and signaled to a decoder, as well as information derived during the execution of encoding or decoding. The coding parameters may represent the information required for 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 partitioning information, unit / block shape, unit / block partitioning structure, whether quadtree-based partitioning is performed, whether binary tree-based partitioning is performed, the binary tree-based partitioning direction (horizontal or vertical direction), the binary tree-based partitioning form (symmetric partitioning or asymmetric partitioning), whether the current coding unit is partitioned by ternary tree partitioning, the ternary tree partitioning direction (horizontal or vertical direction), the ternary tree partitioning type (symmetric type or asymmetric type), whether the current coding unit is partitioned by multi-type tree partitioning, the multi-type tree partitioning direction (horizontal or vertical direction), the multi-type tree partitioning type (symmetric type or asymmetric type), the multi-type tree partitioning tree (binary tree or ternary tree) structure, prediction mode (intra prediction or inter prediction), luminance intra prediction mode / direction, chrominance intra prediction mode / direction, intra partitioning information, inter partitioning information, coding block partitioning flag, prediction block partitioning flag, transform block partitioning flag, reference sample filtering method, reference sample filter taps, reference sample filter coefficients, prediction block filtering method, prediction block filter taps, prediction block filter coefficients, prediction block boundary filtering method, prediction block boundary filter taps, prediction block boundary filter coefficients, intra prediction mode, inter prediction mode, motion information, motion vector, motion vector difference, reference picture index, inter prediction angle, inter prediction indicator, prediction list utilization flag, reference picture list, reference picture, motion vector predictor index, motion vector predictor candidate, motion vector candidate list, whether to use the merge mode, merge index, merge candidate, merge candidate list, whether to use the skip mode, interpolation filter type, interpolation filter taps, interpolation filter coefficients, motion vector magnitude, representation precision of the motion vector, transform type, transform size, information on whether the primary (first) transform is used, information on whether the secondary transform is used, primary transform index, secondary transform index, information on whether a residual signal exists, coding block style, coding block flag (CBF), quantization parameter, quantization parameter residual, quantization matrix, whether to apply an intra-loop filter, intra-loop filter coefficients, intra-loop filter taps, intra-loop filter shape / form, whether to apply a deblocking filter, deblocking filter coefficients, deblocking filter taps, deblocking filter strength, deblocking filter shape / form, whether to apply an adaptive sample offset, adaptive sample offset value, adaptive sample offset category, adaptive sample offset type, whether to apply an adaptive intra-loop filter, adaptive intra-loop filter coefficients, adaptive intra-loop filter taps, adaptive intra-loop filter shape / form,Binarization / inverse binarization method, context model determination method, context model update method, whether to execute the normal mode, whether to execute the bypass mode, context binary bits, bypass binary bits, valid coefficient flag, last valid coefficient flag, coding flag for the unit of the coefficient group, position of the last valid coefficient, flag indicating whether the value of the coefficient is greater than 1, flag indicating whether the value of the coefficient is greater than 2, flag indicating whether the value of the coefficient is greater than 3, information about the values of the remaining coefficients, sign information, reconstructed luminance samples, reconstructed chrominance samples, residual luminance samples, residual chrominance samples, luminance transform coefficients, chrominance transform coefficients, quantized luminance levels, quantized chrominance levels, transform coefficient level scanning method, size of the motion vector search area on the decoder side, shape of the motion vector search area on the decoder side, number of times of motion vector search on the decoder side, information about the CTU size, information about the minimum block size, information about the maximum block size, information about the maximum block depth, information about the minimum block depth, image display / output order, slice identification information, slice type, slice partition information, parallel block identification information, parallel block type, parallel block partition information, parallel block group identification information, parallel block group type, parallel block group partition information, picture type, bit depth of the input samples, bit depth of the reconstructed samples, bit depth of the residual samples, bit depth of the transform coefficients, bit depth of the quantized levels, and information about the luminance signal or the chrominance signal.

[0182] Here, it can be indicated by a signaling flag or index that the encoder performs entropy coding on the corresponding flag or index and includes it in the bitstream, and it can be indicated that the decoder performs entropy decoding on the corresponding flag or index from the bitstream.

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

[0184] The quantized levels can be dequantized in the dequantization unit 160, or can be inverse-transformed in the inverse transform unit 170. The coefficients that have been dequantized or inverse-transformed or both can be added to the prediction block by the adder 175. By adding the coefficients that have been dequantized or inverse-transformed or both to the prediction block, a reconstructed block can be generated. Here, the coefficients that have been dequantized or inverse-transformed or both can represent the coefficients on which at least one of dequantization and inverse transformation has been performed, and can represent the reconstructed residual block.

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

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

[0187] To compensate for coding errors, an appropriate offset value can be added to the sample value by using sample adaptive offset. The sample adaptive offset can correct the offset between the deblocked image and the original image on a sample-by-sample basis. A method that applies an offset considering edge information about each sample can be used, or the following method can be used: partitioning the samples of the image into a predetermined number of regions, determining the regions to which the offset is applied, and applying the offset to the determined regions.

[0188] The adaptive loop filter can perform filtering based on the comparison result between 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 the ALF can be signaled through the coding unit (CU), and the form and coefficients of the ALF to be applied to each block can vary.

[0189] The reconstructed block or reconstructed image that has passed through the filter unit 180 can be stored in the reference picture buffer 190. The reconstructed block processed by the filter unit 180 can be part of the 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 can 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 applying the present invention.

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

[0192] Referring to Figure 2 , the decoding device 200 can 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 a 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 through a wired / wireless transmission medium. The decoding device 200 may decode the bitstream by using an intra mode or an inter 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 during decoding is the intra mode, the switcher may be switched to intra. Optionally, when the prediction mode used during decoding is the inter mode, the switcher may be switched to the inter mode.

[0195] The decoding device 200 may obtain a reconstructed residual block by decoding an input bitstream, and generate a prediction block. When the reconstructed residual block and the prediction block are obtained, the decoding device 200 may generate a reconstructed block to be decoded by adding the reconstructed residual block to the prediction block. The block to be decoded may be referred to as a current block.

[0196] The entropy decoding unit 210 may generate symbols by performing entropy decoding on the bitstream according to a probability distribution. The generated symbols may include symbols in a quantized level form. Here, the entropy decoding method may be an inverse process of the above entropy encoding method.

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

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

[0199] When using the intra mode, the intra prediction unit 240 may generate a prediction block by performing spatial prediction on the current block, where the spatial prediction uses the sample values of blocks adjacent to the block to be decoded and already decoded.

[0200] When using the inter mode, the motion compensation unit 250 may generate a prediction block by performing motion compensation on the current block, where 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 and the prediction block. The filter unit 260 can apply at least one of a deblocking filter, a sample adaptive offset, and an adaptive in-loop filter to the reconstructed block or the reconstructed image. The filter unit 260 can output the reconstructed image. The reconstructed block or the reconstructed image can be stored in the reference picture buffer 270 and used when performing inter 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 prediction or motion compensation.

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

[0203] To partition an image effectively, a coding unit (CU) can be used when encoding and decoding. The coding unit can be used as a basic unit when encoding / decoding an image. In addition, the coding unit can be used as a unit for distinguishing between an intra prediction mode and an inter prediction mode when encoding / decoding an image. The coding unit can be a basic unit for prediction, transformation, quantization, inverse transformation, dequantization, or encoding / decoding processing of transform coefficients.

[0204] Refer to Figure 3 , the image 300 is sequentially partitioned according to the largest coding unit (LCU), and the LCU unit is determined as the partitioning structure. Here, the LCU can be used with the same meaning as the coding tree unit (CTU). Unit partitioning can represent partitioning of the blocks associated with the unit. In the block partitioning information, information on the unit depth can be included. The depth information can represent the number of times or the degree or both the number of times and the degree to which the unit is partitioned. A single unit can 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 can correspond to a node and the children of the node, respectively. Each of the partitioned lower-level units can have depth information. The depth information can be information representing the size of the CU and can be stored in each CU. The unit depth represents the number of times and / or the degree related to partitioning of the unit. Therefore, the partitioning information of the lower-level units can include information on the size of the lower-level units.

[0205] The partitioning structure may represent the distribution of coding units (CUs) within the LCU 310. Such a distribution may be determined based on whether a single CU is partitioned into multiple (positive integers equal to or greater than 2, including 2, 4, 8, 16, etc.) CUs. The horizontal size and vertical size of the CUs generated by the partitioning may be half of the horizontal size and vertical size of the CU before partitioning, respectively, or may have sizes less than the horizontal size and vertical size before partitioning, respectively, depending on the number of partitions. A CU may be recursively partitioned into multiple CUs. Through recursive partitioning, at least one of the height and width of the CU after partitioning may be reduced compared to at least one of the height and width of the CU before partitioning. The partitioning of the CU may be recursively executed until a predefined depth or a predefined size is reached. For example, the depth of the LCU may be 0, and the depth of the smallest coding unit (SCU) may be the predefined maximum depth. Here, as described above, the LCU may be a coding unit with the maximum coding unit size, and the SCU may be a coding unit with the smallest coding unit size. The partitioning starts from the LCU 310, and when the horizontal size or vertical size or both the horizontal size and vertical size of the CU are reduced by the partitioning, the CU depth is incremented by 1. For example, for each depth, the size of the unpartitioned CU may be 2N×2N. Additionally, in the case of a partitioned CU, a CU with a size of 2N×2N may be partitioned into four CUs with a size of N×N. As the depth is incremented by 1, the size of N may be halved.

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

[0207] Referring to Figure 3 , the LCU with a depth of 0 may be a 64×64 block. 0 may be the minimum depth. The SCU with a depth of 3 may be an 8×8 block. 3 may be the maximum depth. CUs of 32×32 blocks and 16×16 blocks may be represented as depth 1 and depth 2, respectively.

[0208] For example, when a single coding unit is partitioned into four coding units, the horizontal size and vertical size of the four partitioned coding units may be half the size of the horizontal size and vertical size of the CU before partitioning. In one embodiment, when a coding unit with a size of 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 may be said that the coding unit may be partitioned in a quadtree form.

[0209] For example, when a 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 can be half of the horizontal size or vertical size of the original coding unit. For example, when a coding unit with a size of 32×32 is vertically partitioned into two sub-coding units, each of the two sub-coding units can have a size of 16×32. For example, when a coding unit with a size of 8×32 is horizontally partitioned into two sub-coding units, each of the two sub-coding units can have a size of 8×16. When a coding unit is partitioned into two sub-coding units, the coding unit can be said to be bipartitioned or partitioned according to a binary tree partitioning structure.

[0210] For example, when a coding unit is partitioned into three sub-coding units, the horizontal size or vertical size of the coding unit can be partitioned in a ratio of 1:2:1, thereby generating three sub-coding units with a horizontal size or vertical size ratio of 1:2:1. For example, when a coding unit with a size of 16×32 is horizontally partitioned into three sub-coding units, the three sub-coding units can have sizes of 16×8, 16×16, and 16×8 in order from the uppermost sub-coding unit to the lowermost sub-coding unit. For example, when a coding unit with a size of 32×32 is vertically divided into three sub-coding units, the three sub-coding units can have sizes of 8×32, 16×32, and 8×32 in order from the leftmost sub-coding unit to the rightmost sub-coding unit. When a coding unit is partitioned into three sub-coding units, the coding unit can be said to be tripartitioned or partitioned according to a ternary tree partitioning structure.

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

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

[0213] The fact that a coding unit corresponding to a node of a quadtree is partitioned can be signaled using quadtree partition information. Quadtree partition information having a first value (e.g., "1") can indicate that the current coding unit is partitioned according to a quadtree partition structure. Quadtree partition information having a second value (e.g., "0") can indicate that the current coding unit is not partitioned according to a quadtree partition structure. The quadtree partition information can be a flag having 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 can further undergo either binary tree partitioning or ternary tree partitioning. In addition, a coding unit generated by binary tree partitioning or ternary tree partitioning can undergo further binary tree partitioning or further 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 referred to as a multi-type tree structure. A coding unit corresponding to a leaf node of a quadtree can be used as a root node of a multi-type tree. At least one of multi-type tree partition indication information, partition direction information, and partition tree information can be used to signal whether to partition a coding unit corresponding to a node of a multi-type tree. To partition a coding unit corresponding to a node of a multi-type tree, the multi-type tree partition indication information, partition direction information, and partition tree information can be signaled sequentially.

[0216] Multi-type tree partition indication information having a first value (e.g., "1") can indicate that the current coding unit will undergo multi-type tree partitioning. Multi-type tree partition indication information having a second value (e.g., "0") can 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 can include partition direction information. The partition direction information can indicate in which direction the current coding unit will be partitioned for multi-type tree partitioning. Partition direction information having a first value (e.g., "1") can indicate that the current coding unit will be vertically partitioned. Partition direction information having a second value (e.g., "0") can indicate that the current coding unit will be horizontally partitioned.

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

[0219] The partition indication information, the partition tree information, and the partition direction information may each be a flag having a predetermined length (e.g., one bit).

[0220] At least any one of the quadtree partition indication information, the multi-type tree partition indication information, the partition direction information, and the partition tree information may be entropy-coded / entropy-decoded. To entropy-code / entropy-decode those types of information, information about neighboring coding units adjacent to the current coding unit may be used. For example, the likelihood 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 is high. Thus, context information for entropy-coding / entropy-decoding the information about the current coding unit may be derived from the information about the neighboring coding units. The information about the neighboring coding units may include at least any one of the quad-partition information, the multi-type tree partition indication information, the partition direction information, and the partition tree information.

[0221] As another example, in binary tree partitioning and ternary tree partitioning, binary tree partitioning may be preferentially performed. That is, the current coding unit may first undergo binary tree partitioning, and subsequently, the coding unit corresponding to the leaf node of the binary tree may be set as the root node for 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 coding, prediction, and / or transformation. That is, the coding unit cannot be further partitioned for prediction and / or transformation. Thus, there may be no partition structure information and partition information in the bitstream for partitioning the coding unit into a prediction unit and / or a transformation unit.

[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 can be recursively partitioned until the size of the coding unit is reduced to be equal to or smaller than the size of the maximum transform block. For example, when the size of the coding unit is 64×64 and when the size of the maximum transform block is 32×32, the coding unit can be partitioned into four 32×32 blocks for transformation. 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 can be partitioned into two 32×32 blocks for transformation. In this case, the partitioning of the coding unit for transformation is not signaled separately, and the partitioning of the coding unit for transformation can be determined by comparing the horizontal size or vertical size of the coding unit with the horizontal size or vertical size of the maximum transform block. For example, when the horizontal size (width) of the coding unit is larger than the horizontal size (width) of the maximum transform block, the coding unit can be bisected vertically. 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 can be bisected horizontally.

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

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

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

[0228] According to the size and depth information of the above various blocks, the 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 can be inferred as a second value.

[0230] For example, when the size (horizontal size and vertical size) of the coding unit corresponding to a node of the multi-type tree is greater than the maximum size (horizontal size and vertical size) of the binary tree and / or the maximum size (horizontal size and vertical size) of the ternary tree, the coding unit may not be partitioned by the binary tree or the ternary tree. Therefore, the multi-type tree partition indication information may not be signaled, but the multi-type tree partition indication information can be inferred as a second value.

[0231] Optionally, when the size (horizontal size and vertical size) of a coding unit corresponding to a node of a multi-type tree is the same as the maximum size (horizontal size and vertical size) of a binary tree and / or twice as large as the maximum size (horizontal size and vertical size) of a ternary tree, the coding unit may not be further bipartitioned or tripartitioned. Therefore, instead of signaling the multi-type tree partitioning indication information, the multi-type tree partitioning indication information may be inferred as a second value. This is because when partitioning a coding unit according to a binary tree partitioning structure and / or a ternary tree partitioning structure, coding units smaller than the minimum size of a binary tree and / or the minimum size of a ternary tree are produced.

[0232] Optionally, the binary tree partitioning or ternary tree partitioning may be restricted based on the size of a virtual pipeline data unit (hereinafter, pipeline buffer size). For example, when a coding unit is divided into sub-coding units that do not fit the pipeline buffer size by binary tree partitioning or ternary tree partitioning, the corresponding binary tree partitioning or ternary tree partitioning may be restricted. 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 divisions may be restricted.

[0233] - Ternary tree partitioning for an N×M (N and / or M is 128) coding unit

[0234] - Binary tree partitioning in the horizontal direction for a 128×N (N <= 64) coding unit

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

[0236] Optionally, when the depth of a coding unit corresponding to a node of a multi-type tree is equal to the maximum depth of the multi-type tree, the coding unit may not be further bipartitioned and / or tripartitioned. Therefore, instead of signaling the multi-type tree partitioning indication information, the multi-type tree partitioning indication information may be inferred as a second value.

[0237] Optionally, the multi-type tree partitioning indication information may be signaled only when at least one of the 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, instead of signaling the multi-type tree partitioning indication information, the multi-type tree partitioning indication information may be inferred as a second value.

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

[0240] Figure 4 is a diagram showing the intra prediction process.

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

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

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

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

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

[0246] The intra prediction mode can be a non - angular mode or an angular mode. The non - angular mode can be a DC mode or a planar mode, and the angular mode can be a prediction mode with a specific direction or angle. The intra prediction mode can be represented by at least one of a mode number, a mode value, a mode numbering, a mode angle, and a mode direction. The number of intra prediction modes can be M which is greater than 1, including the non - angular mode and the angular mode. To perform intra prediction on a current block, a step of determining whether samples included in reconstructed neighboring blocks can be used as reference samples for the current block can be executed. When there are samples that cannot be used as reference samples for the current block, values obtained by copying at least one sample value included in the reconstructed neighboring blocks or performing interpolation or both copying and interpolation can be used to replace the unavailable sample values of the samples, and thus the replaced sample values are used as reference samples for the current block.

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

[0248] As Figure 7 shown, at least one of reference sample lines 0 to 3 can be used for intra prediction of the current block. In Figure 7 , the samples of segment A and segment F can be filled with the samples closest to segment B and segment E respectively, instead of being retrieved from the reconstructed neighboring blocks. 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 , reference sample line indicators 0, 1, and 2 can 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 a CTU, only reference sample line 0 can be available. Therefore, in this case, the index information can be not signaled. When using a reference sample line other than reference sample line 0, filtering for the prediction block described later may not be performed.

[0249] When performing intra prediction, a filter can be applied to at least one of the reference samples and the prediction samples based on at least one of the intra prediction mode and the current block size.

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

[0251] In the case of intra prediction between color components, a prediction block of the current block of a second color component can be generated based on a corresponding reconstructed block of a first color component. For example, the first color component can be a luminance component, and the second color component can be a chrominance component. For intra prediction between color components, parameters of a linear model between the first color component and the second color component can be derived based on a template. The template can include upper and / or left neighboring samples of the current block and upper and / or left neighboring samples of the corresponding reconstructed block of the first color component. For example, the sample value of the first color component with the maximum value among the samples in the template and the corresponding sample value of the second color component, and the sample value of the first color component with the minimum value among the samples in the template and the corresponding sample value of the second color component can be used to derive the parameters of the linear model. When deriving the parameters of the linear model, the corresponding reconstructed block can be applied to the linear model to generate a prediction block of the current block. According to the video format, subsampling can be performed on the reconstructed block of the first color component and 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 can be subsampled to calculate one corresponding sample. In this case, the derivation of the parameters of the linear model and the intra prediction between color components can be performed based on the corresponding subsampled samples. Whether to perform intra prediction between color components and / or the range of the template can be signaled as an intra prediction mode.

[0252] The current block can be partitioned into two sub - blocks or four sub - blocks either horizontally or vertically. The partitioned sub - blocks can be reconstructed sequentially. That is, intra - prediction can be performed on the sub - blocks to generate sub - prediction blocks. Additionally, inverse quantization and / or inverse transform can be performed on the sub - blocks to generate sub - residual blocks. The reconstructed sub - blocks can be generated by adding the sub - prediction blocks and the sub - residual blocks. The reconstructed sub - blocks can be used as reference sample points for intra - prediction of subsequent sub - blocks. A sub - block can be a block including a predetermined number (e.g., 16) or more sample points. Thus, for example, when the current block is an 8×4 block or a 4×8 block, the current block can be partitioned into two sub - blocks. Further, when the current block is a 4×4 block, the current block may not be partitioned into sub - blocks. When the current block has other dimensions, the current block can be partitioned into four sub - blocks. Information regarding whether to perform intra - prediction based on sub - blocks and / or the partition direction (horizontal or vertical) can be signaled. The intra - prediction based on sub - blocks can be limited to being performed only when using reference sample line 0. When performing intra - prediction based on sub - blocks, filtering for the prediction block described later may not be performed.

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

[0254] The intra - prediction mode of the current block can be entropy - coded / entropy - decoded by predicting the intra - prediction mode of the block adjacent to the current block. When the intra - prediction mode of the current block is the same as that of the neighboring block, the information that the intra - prediction modes of the current block and the neighboring block are the same can be signaled by using predetermined flag information. Additionally, the indicator information of the intra - prediction mode among the intra - prediction modes of multiple neighboring blocks that is the same as the intra - prediction mode of the current block can be signaled. When the intra - prediction mode of the current block is different from that of the neighboring block, the intra - prediction mode information of the current block can be entropy - coded / entropy - decoded by performing entropy - coding / entropy - decoding based on the intra - prediction mode of the neighboring block.

[0255] Figure 5 It is a diagram showing an embodiment of the inter - prediction process.

[0256] In Figure 5 it, the rectangle can represent a picture. In Figure 5In the figure, the arrow indicates the prediction direction. According to the coding type of the picture, the pictures can be classified into intra pictures (I pictures), predicted pictures (P pictures), and bi-predicted pictures (B pictures).

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

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

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

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

[0261] The method of deriving motion information can vary according to the prediction mode of the current block. For example, prediction modes applied to inter-frame prediction include the AMVP mode, the merge mode, the skip mode, the merge mode with motion vector difference, the sub-block merge mode, the geometric partitioning mode, the combined inter-frame intra-frame prediction mode, the affine mode, etc. Here, the merge mode can be referred to as the motion merge mode.

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

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

[0264] In addition, the encoding device 100 can perform entropy encoding on resolution information of the calculated MVD. The decoding device 200 can use the MVD resolution information to adjust the resolution of the entropy-decoded MVD.

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

[0266] The bitstream can include a reference picture index indicating a reference picture. The reference picture index can be entropy-encoded by the encoding device 100 and then signaled as a bitstream to the decoding device 200. The decoding device 200 can generate a predicted block of the 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 of a current block can be a merge mode. The merge mode can represent a method of merging the motions of multiple blocks. The merge mode can represent a mode of deriving the motion information of a current block from the motion information of neighboring blocks. When the merge mode is applied, the motion information of reconstructed neighboring blocks and / or the motion information of co-located blocks can be used to generate a merge candidate list. The motion information can include at least one of a motion vector, a reference picture index, and an inter-picture prediction indicator. The prediction indicator can indicate uni-directional prediction (L0 prediction or L1 prediction) or bi-directional 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 neighboring blocks adjacent to the current block (spatial merge candidates), motion information of collocated blocks of the current block in a reference picture (temporal merge candidates), new motion information generated by combining the motion information present in the merge candidate list, motion information of blocks encoded / decoded before the current block (history-based merge candidates), and zero merge candidates.

[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 signal the bitstream to the decoding device 200. The merge flag may be information indicating whether the merge mode is performed for each block, and the merge index may be information indicating which neighboring block among the neighboring blocks of the current block is the merge target block. For example, the neighboring blocks of the current block may include a left neighboring block located on the left side of the current block, an upper neighboring block arranged above the current block, and a temporal neighboring block temporally adjacent to the current block.

[0270] In addition, the encoding device 100 performs entropy encoding on correction information for correcting a motion vector in the motion information of the merge candidate and signals it to the decoding device 200. 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 of correcting the motion vector of the merge candidate 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 of applying the motion information of a neighboring block to the current block as it is. When the skip mode is applied, the encoding device 100 may perform entropy encoding on information on which block's motion information will 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 syntax elements regarding at least any one of motion vector difference information, an encoded block flag, and a transform coefficient level to the decoding device 200.

[0272] The sub-block merge mode may represent a mode of deriving motion information in units of sub-blocks of a coding unit (CU). When the sub-block merge mode is applied, motion information of sub-blocks collocated with the current sub-block in a reference image (sub-block-based temporal merge candidates) and / or affine control point motion vector merge candidates may be used to generate a sub-block merge candidate list.

[0273] The geometric partitioning mode can represent a mode in which motion information is derived by partitioning a current block in a predetermined direction, each of the derived motion information is used to derive each predicted sample point, and the predicted sample point of the current block is derived by weighting each of the derived predicted sample points.

[0274] The inter-frame intra-frame combined prediction mode can represent a mode in which the predicted sample point of the current block is derived by weighting the predicted sample points generated by inter-frame prediction and the predicted sample points generated by intra-frame prediction.

[0275] The decoding device 200 can correct the derived motion information by itself. The decoding device 200 can search a predetermined region based on the reference block indicated by the derived motion information, and derive the motion information with the minimum SAD as the corrected motion information.

[0276] The decoding device 200 can compensate the predicted sample points derived via inter-frame prediction using optical flow.

[0277] Figure 6 is a diagram showing the transform and quantization processes.

[0278] As Figure 6 shown, 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 predicted block (i.e., an intra-frame predicted block or an inter-frame predicted block). The predicted 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 various predefined transform schemes is used to perform the primary transform. For example, examples of the predefined transform schemes include the discrete cosine transform (DCT), the discrete sine transform (DST), and the Karhunen-Loève transform (KLT). The transform coefficients generated by the primary transform can undergo a secondary transform. The transform scheme for the primary transform and / or the secondary transform can be determined according to the coding parameters of the current block and / or the neighboring blocks of the current block. Optionally, transform information indicating the transform scheme can be signaled. The DCT-based transform can include, for example, DCT-2, DCT-8, etc. The DST-based transform can 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 a block, the quantized level signal can be scanned according to at least one of a right-up diagonal scan, a vertical scan, and a horizontal scan. For example, when scanning coefficients according to a right-up diagonal scan, the coefficients in block form are changed to a one-dimensional vector form. In addition to the right-up diagonal scan, depending on the intra prediction mode and / or the size of the transform block, a horizontal scan that horizontally scans the coefficients in two-dimensional block form or a vertical scan that vertically scans the coefficients in two-dimensional block form can be used. The scanned quantized level coefficients can be entropy encoded to be inserted into a bitstream.

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

[0282] Then, the quantized level coefficients can be dequantized, then a secondary inverse transform can be performed as needed, and finally a primary inverse transform can be performed as needed to generate a reconstructed residual signal.

[0283] Inverse mapping in the dynamic range can be performed on 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 a mapping function for each segment can be signaled. The mapping function can be signaled 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 region, and a predicted block generated by inter prediction is transformed to the mapping region via mapping using the mapping function and then used to generate a reconstructed block. However, since intra prediction is performed in the mapping region, a predicted 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 a chrominance component, the residual block can be transformed to the inverse mapping region by performing scaling on the chrominance component of the mapping region. The availability of the scaling can be signaled at the slice level or at the parallel block group level. The scaling can be applied only when the mapping for the luma component is available and the partitioning of the luma component and the partitioning of the chrominance component follow the same tree structure. The scaling can be performed based on the average of the sample values of the luma prediction block corresponding to the chroma difference block. In this case, when inter prediction is used for the current block, the luma prediction block can represent the mapped luma prediction block. The value required for the scaling can be derived by using the index reference lookup table of the segment to which the average of the sample values of the luma prediction block belongs. Finally, by scaling the residual block by using the derived value, the residual block can be transformed to the inverse mapping region. Then, chrominance component block recovery, intra prediction, inter prediction, in-loop filtering, and reference picture storage can be performed in the inverse mapping region.

[0285] The information indicating whether the mapping / inverse mapping of the luma component and the chrominance component is available can be signaled by the sequence parameter set.

[0286] A prediction block for the current block can be generated based on the block vector indicating the displacement between the current block in the current picture and the reference block. In this way, the prediction mode for generating the prediction block by referring to the current picture is called the Intra Block Copy (IBC) mode. The IBC mode can be applied to M×N (M <= 64, N <= 64) coding units. The IBC mode can include a skip mode, a merge mode, an AMVP mode, etc. In the case of the skip mode or the merge mode, a merge candidate list 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 can include at least one of a spatial candidate, a history-based candidate, a candidate based on the average of two candidates, and a zero merge candidate. In the case of the AMVP mode, a differential block vector can be signaled. Additionally, the prediction block vector can 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 can be signaled. The prediction block in the IBC mode is included in the current CTU or the left CTU and is limited to the blocks in the reconstructed region. For example, the value of the block vector can be restricted so that the prediction block of the current block is located in the region of three 64×64 blocks before the 64×64 block to which the current block belongs in the coding / decoding order. By restricting the value of the block vector in this way, the memory consumption and device complexity according to the IBC mode implementation can be reduced.

[0287] Hereinafter, a method for enhancing video compression efficiency by improving a transform method, which is 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 a difference between a predicted block obtained by prediction and the original block; and an entropy encoding step that is a lossless compression method based on coefficients of a block on which transform and quantization have been performed and probabilities of compression information obtained in the previous step. Thus, a bitstream that is a compressed form of the original image is generated and sent to a decoder or stored in a recording medium. The rearranged discrete sine transform (hereinafter referred to as "SDST") to be described hereinafter 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 encoding, so as to better reflect frequency characteristics common to images.

[0289] According to the transform method of the present invention, high objective video quality can be obtained even at a relatively low bitrate as compared with conventional video encoding methods.

[0290] DST-7 can be applied to data of a residual block. Application of DST-7 to a residual block can be performed based on a prediction mode corresponding to the residual block. For example, it can be applied to a residual block encoded in an inter-frame mode. According to an embodiment of the present invention, DST-7 can be applied after rearranging or reordering data of the residual block. Here, reordering can represent rearrangement of image data and can be equivalent to rearrangement or flipping of a residual signal. Here, a residual block can have the same meaning as a residual, a residual block, a residual signal, a residual signal, residual data, or residual data. In addition, a residual block can have the same meaning as a reconstructed residual, a reconstructed residual block, a reconstructed residual signal, a reconstructed residual signal, reconstructed residual data, or reconstructed residual data in a reconstructed form of the residual block in an encoder and a 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 at least one of various types of DST and DCT may be used, such as discrete sine transform type-1 (DST-1), discrete sine transform type-2 (DST-2), discrete sine transform type-3 (DST-3), …, discrete sine transform type-n (DST-n), discrete cosine transform type-1 (DCT-1), discrete cosine transform type-2 (DCT-2), discrete cosine transform type-3 (DCT-3), …, discrete cosine transform type-n (DCT-n), etc. (where n may be a positive integer of 1 or greater).

[0292] The following Equation 1 may represent a method for 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 may represent the value of the nth coefficient in the spatial domain.

[0293] [Equation 1]

[0294]

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

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

[0297] [Equation 2]

[0298]

[0299] Meanwhile, Figure 7 is a diagram showing the basic vector in the frequency domain of DCT-2 according to the present invention. Figure 7 shows the frequency characteristics of DCT-2 in the frequency domain. Here, the value calculated by the X0 basic vector of DCT-2 may represent the DC component.

[0300] DCT-2 can be used in the transform processing of residual blocks with sizes of 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., the luminance component and the chrominance component), and the prediction mode corresponding to the residual block. For example, when the size of the residual block is 4×4 and it is encoded in the intra mode and the component of the residual block is the luminance component, DCT-2 is used. For example, when the horizontal length (width) of the residual block encoded in the 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), the primary transform kernel can be used for horizontal transformation. Otherwise, the secondary transform kernel can be used for horizontal transformation. For example, when the vertical length (height) of the residual block encoded in the 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 (width), the primary transform kernel can be used for vertical transformation. Otherwise, the secondary transform kernel can be used for vertical transformation. The primary transform kernel can be different from the secondary transform kernel. That is, the horizontal transformation and vertical transformation methods for the block encoded in the intra mode can be implicitly determined based on the shape of the block 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 target of transformation, so it can have the same meaning as the transform block. Here, the prediction mode can represent inter prediction or intra prediction. In addition, in the case of intra prediction, the prediction mode represents the intra prediction mode or the intra prediction direction.

[0302] The transformation by the DCT-2 transform kernel can achieve high compression efficiency for blocks with the characteristic that the change between adjacent pixels is small (such as the background of an image). However, it may not be suitable as a transform kernel for regions (such as texture images with complex patterns). This is because when a block with low correlation between adjacent pixels is 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 can be reduced. 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 approach zero at the high-frequency components.

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

[0304] [Equation 3]

[0305]

[0306] Two-dimensional DST-7 in the domain can be achieved by performing horizontal transformation and vertical transformation on the residual block using the above Equation 3.

[0307] The DST-7 transform kernel can be defined as Equation 4 below. Here, x k can represent the k-th basic vector of DST-7, i can represent the position in the frequency domain, and N can represent the size of the frequency domain.

[0308] [Equation 4]

[0309]

[0310] DST-7 can be used in the transform processing of a residual block having at least one of sizes 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, 128×128, etc.

[0311] Meanwhile, DST-7 can be applied to rectangular blocks instead of square blocks. For example, DST-7 can be applied to at least one of vertical transformation and horizontal transformation 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 transformation methods are selectively applied, DCT-2 is applied to vertical transformation and horizontal transformation of a square block. When multiple transformation methods are selectively applied, DST-7 is applied to vertical transformation and horizontal transformation of a square block.

[0312] In addition, 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., the luminance component and the chrominance component), the prediction mode corresponding to the residual block, the intra prediction mode (direction), and the shape of the residual block. For example, when the size of the residual block is 4×4 and it is encoded in the intra mode and the component of the residual block is the luminance component, DST-7 is used. Here, the prediction mode can represent inter prediction or intra prediction. In addition, in the case of intra prediction, the prediction mode represents the intra prediction mode or the intra prediction direction. For example, for the chrominance component, the selection of the transformation method based on the block shape may not be available. For example, when the intra prediction mode is prediction between color components, the selection of the transformation method based on the block shape may not be available. For example, the transformation method for the chrominance component can be specified by information signaled via the bitstream. When the current block is partitioned into multiple sub-blocks and intra prediction is performed for each sub-block, the transformation method for the current block is determined based on the intra prediction mode and / or the block size (horizontal size and / or vertical size). For example, when the intra prediction mode is non-directional (DC or plane) and the horizontal length (width) (or vertical length (height)) is within a predetermined range, the primary transformation kernel is used for the horizontal transformation (vertical transformation). Otherwise, the secondary transformation kernel can be used. The primary transformation kernel can be different from the secondary transformation kernel. For example, the primary transformation kernel can be DST-7, and the secondary transformation kernel can be DCT-2. The predetermined range can 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 transformation kernel) is used for both the horizontal transformation and the vertical transformation. When the size of the block is within the predetermined range, different transformation kernels are used for intra prediction modes adjacent to each other. For example, when the secondary transformation kernel and the primary transformation kernel are used for the horizontal transformation and the vertical transformation in mode 27, respectively, the primary transformation kernel and the secondary transformation kernel are used for the horizontal transformation and the vertical transformation in modes 26 and 28 adjacent to mode 27, respectively.

[0313] Meanwhile, FIG. 8 is a diagram showing the basic vectors in each frequency domain of DST-7 according to the present invention. Referring to FIG. 8, the shape of the first basic vector (x0) of DST-7 is a curve. Through this, it is predicted that DST-7 will show higher transformation performance for blocks with large spatial variations in the image compared to DCT-2.

[0314] In the transformation of the 4×4 transform unit (TU) within the coding unit (CU) for intra prediction, DST-7 can be used. By reflecting the characteristic of intra prediction where the error amount increases as the distance from the reference sample point increases, DST-7 with higher transformation efficiency can be used. That is, in the case of a block where the amount of the 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 effectively compress the block.

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

[0316] Figure 9 is a diagram showing the distribution of average residual values at positions within a 2N×2N prediction unit (PU) of an 8×8 coding unit (CU) predicted according to an inter-frame mode, where the "Cactus" sequence was obtained through testing in a low-delay P profile environment.

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

[0318] As Figure 9 shown, the distribution of the residual signal within a 2N×2N PU of an 8×8 CU predicted according to an inter-frame mode has the following characteristics: small residual signal values are mainly concentrated near the center of the block and the residual signal values increase as they move away from the center point of the block. That is, the residual signal values are large at the block boundaries. The distribution characteristics of the residual signal as described above can be a common feature of the residual signal within a PU, regardless of the size of the CU and PU partitioning patterns (2N×2N, 2N×N, N×2N, N×N, nR×2N, nL×2N, 2N×nU, and 2N×nD) that the CU with inter-frame prediction can have.

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

[0320] Referring to 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 boundaries have relatively large values.

[0321] Based on Figure 9 and Figure 10 the distribution characteristics of the residual signal shown in, when using DST-7 instead of DCT-2, the transformation of the residual signal within the PU of the CU with inter-frame prediction is more effective.

[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 represent 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 rearrange the residual signal within the PU of the CU predicted in the inter-frame mode or the intra-frame mode. The second step is to apply DST-7 to the rearranged residual signal within the block.

[0325] The residual signal arranged within 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 within the current block can be scanned in a first direction and rearranged in a second direction to perform rearrangement. Here, the residual signal can represent a signal indicating the difference signal between the original signal and the predicted signal. That is, the residual signal can represent a signal before performing at least one of transformation and quantization. Optionally, the residual signal can represent a signal form that has performed at least one of transformation and quantization. In addition, the residual signal can represent a reconstructed residual signal. That is, the residual signal can represent a signal that has performed at least one of inverse transformation and inverse quantization. In addition, the residual signal can represent a signal before performing at least one of inverse transformation and inverse quantization.

[0326] At the same time, the first direction (or scanning direction) can be one of the raster scan order, the upper-right diagonal scan order, the horizontal scan order, and the vertical scan order. In addition, the first direction can be defined as at least one of the following (1) to (10).

[0327] Scanning from the upper row to the lower row and scanning from the left to the right in one row

[0328] Scanning from the upper row to the lower row and scanning from the right to the left in one row

[0329] Scanning from the lower row to the upper row and scanning from the left to the right in one row

[0330] Scanning from the lower row to the upper row and scanning from the right to the left in one row

[0331] Scanning from the left column to the right column and scanning from the upper to the lower in one column

[0332] Scanning from the left column to the right column and scanning from the lower to the upper in one column

[0333] Scanning from the right column to the left column and scanning from the upper to the lower in one column

[0334] Scanning from the right column to the left column and scanning from the lower to the upper in one column

[0335] Spiral-shaped scanning: 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 scanning: Starting from a corner within the block, scanning diagonally in the upper-left, upper-right, lower-left, or lower-right direction

[0337] Meanwhile, with respect to the second direction (or rearrangement direction), at least one of the scanning directions (1) to (10) can be selectively used. The first direction and the second direction can be the same or can be different from each other.

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

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

[0340] In addition, the scanning and rearrangement are described as being performed separately according to the first direction and the second direction, but the scanning and rearrangement can be performed as one process for the first direction. For example, for the residual signal within the block, the scanning can be performed from the upper row to the lower row and the scanning can be performed from the right to the left in a column for storage (rearrangement) in the block.

[0341] Meanwhile, the scanning and rearrangement processing for the residual signal can be performed according to a predetermined unit of sub-blocks within the current block. Here, the sub-block can be a block that is equal to or smaller than the current block in size. The sub-block can be a block obtained by partitioning the current block in the form of a quadtree, binary tree, etc.

[0342] The sub-block unit can have a fixed size and / or shape (e.g., 4×4, 4×8, 8×8, …, N×M, where N and M are positive integers). In addition, the size and / or shape of the sub-block unit can be derived differently. For example, the size and / or shape of the sub-block unit can be determined according to the size, shape, and / or prediction mode (inter-frame and intra-frame) of the current block.

[0343] The scanning direction and / or rearrangement direction can be adaptively determined according to the position of the sub-block. In this case, different scanning directions and / or rearrangement directions can be used for the sub-blocks, or all or part of the sub-blocks of the current block can use the same scanning direction and / or the same rearrangement direction.

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

[0345] Refer toFigure 11 The PU is partitioned into four sub - blocks according to a quadtree structure, and the arrow direction of each sub - block shows the distribution characteristics of the residual signal. Specifically, the arrow direction of each sub - block indicates the direction in which the residual signal increases. This is attributed to the common distribution characteristics of the residual signals within the PU, regardless of the PU partitioning pattern. Therefore, a rearrangement operation for rearranging the residual signals of each sub - block can be performed to have distribution characteristics suitable for the DST - 7 transform.

[0346] Figure 12 is a diagram showing the distribution characteristics of the residual signals before and after rearrangement in a 2N×2N prediction unit (PU) according to the present invention.

[0347] Referring to Figure 12 , the upper block shows the distribution before rearrangement of the residual signals within the 2N×2N PU of an 8×8 CU predicted in an inter - frame mode. The following Equation 5 shows the values of the positions of each residual signal within the upper block in Figure 12 .

[0348] [Equation 5]

[0349]

[0350] Due to the distribution characteristics of the residual signals within the PU of a CU predicted in an inter - frame mode, many residual signals with relatively small values are distributed in the central region within the upper block in Figure 12 , and many residual signals with larger values are distributed near the boundaries within the upper block.

[0351] Figure 12 The lower block in

[0352] shows the distribution characteristics of the residual signals within the 2N×2N PU after the rearrangement is performed. This shows that the distribution of the residual signals of each sub - block of the PU for which the rearrangement has been performed is the distribution of the residual signals suitable for the first basic vector of DST - 7. That is, since the residual signals within each sub - block have larger values as they are farther from the position (0, 0), when the transform is performed, the transform coefficient values transformed by DST - 7 are concentrated in the low - frequency domain.

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

[0353] [Equation 6]

[0354] S0

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

[0356] S1

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

[0358] S2

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

[0360] S3

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

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

[0363] Here, W k and H k respectively 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 the sub-blocks obtained by partitioning the PU according to the quadtree structure. In addition, x and y respectively represent the horizontal position and vertical position within the sub-block. As shown in the upper block in Figure 12 , the positions of the residual signals before rearrangement are specified by a(x, y), b(x, y), c(x, y), and d(x, y). As shown in the lower block in Figure 12 , the positions of the residual signals changed by rearrangement are represented by a'(x, y), b'(x, y), c'(x, y), and d'(x, y).

[0364] Figure 13 is a diagram showing an example of the 4×4 residual data rearrangement of the sub-block according to the present invention.

[0365] Referring to Figure 13 , the sub-block can represent one of a plurality of sub-blocks belonging to an 8×8 prediction block. Figure 13 (a) shows the positions of the original residual data before rearrangement, and Figure 13 (b) shows the positions of the rearrangement of the residual data.

[0366] Referring to Figure 13 (c), the values of the residual data can gradually increase from the position (0, 0) to the position (3, 3). Here, the horizontal and / or vertical one-dimensional residual data within each sub-block can have a data distribution in the form of the basic vectors shown in FIG. 8.

[0367] That is, regarding the rearrangement according to the present invention, the residual data of each sub-block can be rearranged such that the distribution of the residual data is suitable for the form of the DST-7 basic vector. After rearranging each sub-block, the DST-7 transform can be applied to the data rearranged according to each sub-block unit.

[0368] Meanwhile, the sub-blocks can be further partitioned based on the depth of the TU according to the quadtree structure, or rearrangement processing can be selectively performed. 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 processing is applied to each N / 2×N / 2 block. Here, the quadtree-based TU partitioning can be repeatedly executed until the minimum TU size is reached.

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

[0370] Meanwhile, the SDST method according to the present invention uses the distribution characteristics of the residual signals within the PU block, such that the partitioning structure of the TUs for which SDST is performed can be defined as being partitioned based on the PU according to the quadtree structure.

[0371] Figure 14a and Figure 14b are diagrams showing embodiments of the partitioning structure of the transform unit (TU) of the coding unit (CU) illustrating the rearrangement method according to the prediction unit (PU) mode and the transform unit (TU). Figure 14a and Figure 14b show the quadtree partitioning structure of the TUs according to the depth of the TUs for each asymmetric partitioning mode (2N×nU, 2N×nD, nR×2N, and nL×2N).

[0372] Referring to Figure 14a and Figure 14b , the thick solid lines of each block indicate the PUs within the CU, and the thin solid lines indicate the TUs. In addition, S0, S1, S2, and S3 within each TU indicate the rearrangement method of the residual signals within the TU defined in Equation 6 above.

[0373] Meanwhile, in Figure 14a and Figure 14b , the TUs with a depth of 0 for each PU can have the same block size as the PU (for example, in a 2N×2N PU, the size of the TU with a depth of 0 can be the same as the size of the PU). Here, the rearrangement of the residual signals within the TU with a depth of 0 will be described later with reference to Figure 18 .

[0374] In addition, when at least one of the CU, PU, and TU is 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.

[0375] In addition, when at least one of the CU, PU, and TU is a square shape (e.g., 2N×2N and N×N), before the residual signal rearrangement, 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.

[0376] In addition, when the TU obtained from the partitioning 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 on a per-sub-block basis obtained from the partitioning.

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

[0378] Meanwhile, in Figure 14a and Figure 14b asymmetric partitioning patterns of the PU for inter-frame prediction are described but not limited thereto, and the partitioning of the TU and the rearrangement of the TU can be applied to the symmetric partitioning patterns (2N×N and N×2N) of the PU.

[0379] The DST-7 transform can be performed on each TU within the PU for 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.

[0380] Considering the distribution characteristics of the residual signal of the PU block for inter-frame prediction, performing the DST-7 transform after the rearrangement regardless of the size of the CU and PU partitioning patterns is more effective than performing the DCT-2 transform.

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

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

[0383] On Figure 15 The diagram shown on the left side of shows the distribution when the PU partitioning mode of the CU is 2N×2N, and the residual signal increases from the center to the boundary. In addition, on Figure 15 The diagram shown in the middle of shows the distribution of the residual signal after performing DCT-2 transform on the TU with a depth of 1 within the PU. On Figure 15 The diagram shown on the right side of shows the distribution of the residual signal after performing DST-7 after rearrangement on the TU with a depth of 1 within the PU.

[0384] Referring to Figure 15 , compared with the case of performing DCT-2 on the TU of the PU with the above-mentioned residual signal distribution characteristics, when performing SDST, more coefficients are concentrated near the low-frequency components and the coefficients on the high-frequency components have smaller values. According to the transform characteristics, it is found that when transforming the residual signal of the PU for inter-frame prediction, performing SDST instead of DCT-2 is more advantageous in terms of compression efficiency.

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

[0386] For example, for a block of inter prediction, a residual block having the same size as the block may be decoded, or a sub-residual block corresponding to a part of the block may be decoded. Information for this may be signaled for the block, and the information may be, for example, a flag. When a residual block having the same size as the block is decoded, information regarding a transform kernel may be determined by decoding information included in the bitstream. When a sub-residual block corresponding to a part of the block is decoded, a transform kernel for the sub-residual block is determined based on information for specifying the type and / or the position within the block of the sub-residual block. For example, information regarding the type and / or the position within the block of the sub-residual 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 type and / or the position within the block of the sub-residual block is not performed. For example, for a block larger than 32×32, a predetermined transform kernel (e.g., DCT-2) may be applied, or information regarding the transform kernel may be signaled explicitly. Optionally, when the width or height of the block is larger than 32, determination of the transform kernel based on the type and / or the position within the block of the sub-residual block is not performed. For example, for a 64×8 block, a predetermined transform kernel (e.g., DCT-2) may be applied, or information regarding the transform kernel may be signaled explicitly.

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

[0388] Information regarding the position of the sub-residual block may indicate the position within the block. For example, when the partition of the block is a vertical partition, the information regarding the position indicates one between the left side and the right side. Further, when the partition of the block is a horizontal partition, the information regarding the position indicates one between the upper side and the lower side.

[0389] The transformation kernel of the sub-residual block can be determined based on type information and / or position information. The transformation kernel can be determined independently for horizontal transformation and vertical transformation. For example, the transformation kernel can be determined based on the partitioning direction. For example, in the case of vertical partitioning, a first transformation kernel can be applied to the vertical transformation. In the case of horizontal partitioning, a first transformation kernel can be applied to the horizontal transformation. For example, in the case of vertical partitioning, the first transformation kernel or the second transformation kernel can be applied to the horizontal transformation, and in the case of horizontal partitioning, the first transformation kernel or the second transformation kernel can be applied to the vertical transformation. For example, in the case of vertical partitioning, the second transformation kernel can be applied to the horizontal transformation at the left position, and the first transformation kernel can be applied to the horizontal transformation at the right position. Further, in the case of horizontal partitioning, the second transformation kernel can be applied to the vertical transformation at the upper position, and the first transformation kernel can be applied to the vertical transformation at the lower position. For example, the first transformation kernel and the second transformation kernel can be DST-7 and DCT-8 respectively. For example, the first transformation kernel and the second transformation kernel can be DST-7 and DCT-2 respectively. However, this is not limited thereto, and any two different transformation kernels described in the specification can be used as the first transformation kernel and the second transformation kernel. Here, the block can represent a CU or a TU. Further, the sub-residual block can represent a sub-TU.

[0390] Figure 16 is a diagram showing the SDST processing according to the present invention.

[0391] In step S1610, a residual signal of a TU to be transformed is input. Here, the TU can be a TU obtained by partitioning a PU whose prediction mode is an inter-frame mode. In step S1620, rearrangement can be performed on the TU to be transformed. Next, in step S1630, DST-7 transformation is performed on the TU on which rearrangement has been performed, in step S1640, quantization is performed, and a series of subsequent processes are performed, thereby performing SDST processing in this order.

[0392] Meanwhile, rearrangement and DST-7 transformation can be performed on a block whose prediction mode is an intra-frame mode.

[0393] Hereinafter, as an embodiment for implementing SDST transformation in an encoder, the following methods will be described: i) a method of performing SDST on all TUs within a PU for inter-frame prediction, and ii) a method of selectively performing SDST or DCT-2 through rate-distortion optimization. In the following methods, inter-frame prediction blocks are described, but this is not limited thereto, and the following methods can be applied to intra-frame prediction blocks.

[0394] Figure 17 is a diagram showing the partitioning of transformation units (TUs) and the distribution characteristics of the magnitudes of residual absolute values for each prediction unit (PU) partitioning mode of an encoding unit (CU) for inter-frame prediction according to the present invention.

[0395] Reference Figure 17 , in the inter-frame prediction mode, a TU can be obtained from a partition of a CU having a maximum depth up to a quadtree or a binary tree, and there can be a total of K partition patterns of a PU. Here, K is a positive integer, and for example, in Figure 17 , K is 18.

[0396] As referred to above Figure 10 described, the SDST according to the present invention uses the distribution characteristics of residual signals in a PU within a CU using inter-frame prediction. In addition, a TU can be obtained from a partition of a PU according to a quadtree or a binary tree. That is, a TU of depth 0 can correspond to a PU, and a TU of depth 1 can correspond to each sub-block obtained by partitioning a PU once according to a quadtree structure or a binary tree structure.

[0397] Figure 17 Each block in

[0398] shows the following form: TUs are obtained by partitioning each PU partition pattern for inter-frame prediction by depth 2. Here, a thick solid line can indicate a PU, a thin solid line can indicate a TU, and the arrow direction of each TU can indicate the direction in which the residual signal value increases within the TU. Each TU can be rearranged as described above regarding the rearrangement step according to the position within the PU.

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

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

[0400] Figure 18 is a diagram showing the residual signal scan order and rearrangement order of a transform unit (TU) of depth 0 within a prediction unit (PU) according to an embodiment of the present invention.

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

[0402] A DST-7 transform can be performed on the residual signals within each rearranged TU, and quantization, entropy coding, etc. can be performed. This rearrangement method uses the distribution characteristics of residual signals within a TU according to the PU partition pattern, thereby optimizing the distribution of residual signals to improve the efficiency of the DST-7 transform as the next step.

[0403] In an encoder, SDST can be performed on all TUs within a PU of inter - frame prediction according to the SDST processing shown in Figure 16 . According to the PU partition mode of the CU of inter - frame prediction, TU partitioning can be performed from the PU in the same form as shown in Figure 17 until depth 2. By using the distribution characteristics of the residual signal within the TU in Figure 17 , rearrangement can be performed on the residual signal within each TU. After that, transformation using a DST - 7 transform kernel can be performed, and then quantization, entropy coding, etc. can be performed.

[0404] When reconstructing the residual signal of the TU within the PU of inter - frame prediction, the decoder performs an inverse DST - 7 transform on each TU within the PU of inter - frame prediction and performs inverse rearrangement on the reconstructed residual signal to obtain the reconstructed residual signal. In this SDST method, SDST is applied to the transformation method of all TUs within the PU of inter - frame prediction, so there is no flag or information that needs to be further signaled to the decoder. That is, the SDST method can be performed without any signaling of the SDST method.

[0405] Meanwhile, even if SDST is performed on all TUs within the PU of inter - frame prediction, the encoder determines a part 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 signaled to the decoder.

[0406] As another embodiment of performing SDST, at least one of two or more transformation methods (e.g., DCT - 2 and SDST) can be selected for application to perform transformation on the PU. According to this method, compared with the embodiment of performing SDST on all TUs within the PU of inter - frame prediction, the calculation of the encoder will increase. However, a more effective transformation method is selected between DCT - 2 and SDST, so the compression efficiency can be enhanced.

[0407] Figure 19 is a flowchart showing the DCT - 2 or SDST selection coding process for rate - distortion optimization (RDO) according to the present invention.

[0408] Refer to Figure 19, at step S1910, the residual signal of the TU to be transformed can be input. At step S1950, the cost of the TU obtained by performing DCT-2 on each TU within the PU predicted in the inter-frame mode in step S1920 can be compared with the cost of the TU obtained by performing rearrangement in step S1930 and DST-7 in step S1940, so as to determine the optimal transformation mode (e.g., DST-2 or SDST) of the TU in terms of rate distortion. Next, at step S1960, according to the determined transformation mode, quantization can be performed on the transformed TU, and entropy coding can be performed.

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

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

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

[0412] iii) Regardless of the PU partition mode, the TU is not obtained from the partition of a CU.

[0413] Condition i) is as follows: For a CU partitioned according to a quadtree or a binary tree regardless of the PU partition mode or for a TU obtained by partitioning into the CU size, DCT-2 or SDST is selected as the transformation mode in terms of rate distortion optimization.

[0414] Condition ii) is an embodiment of performing SDST on all TUs within the inter-frame predicted PU. That is, according to the PU partition mode, DCT-2 or SDST is performed on a PU partitioned according to a quadtree or a binary tree or a TU obtained by partitioning into the PU size, and considering each cost, the transformation mode of the TU is determined.

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

[0416] In comparing the rate distortion cost (RD cost) of the TU block at depth 0 under 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 transformation mode of the TU at depth 0 can be selected.

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

[0418] Refer to Figure 20 , in step S2010, the SDST flag sent by the reference signal can be targeted for each TU. Here, the SDST flag can be a flag indicating whether SDST is used as a transform mode.

[0419] When - Yes in step S2020 and the SDST flag is true, 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, an inverse rearrangement using the above equation 6 is performed on the residual signal within the TU for which the DST-7 inverse transform has been performed, according to the position of the TU within the PU. Finally, in step S2060, a reconstructed residual signal is obtained.

[0420] Meanwhile, when - No in step S2020 and the SDST flag is not true, the transform mode of the TU is determined to be the DCT-2 mode. Subsequently, an inverse DCT-2 transform is performed on the residual signal within the TU in step S2050, and a reconstructed residual signal is obtained in step S2060.

[0421] When using the SDST method, the residual data is rearranged. Here, the residual data can represent the residual data corresponding to the PU of the inter prediction. An integer transform derived from DST-7 using separable attributes can be used as the SDST method.

[0422] Meanwhile, for the selective use of DCT-2 or DST-7, the sdst_flag can be sent by a signal. The signal transmission of the sdst_flag is performed on a TU-by-TU basis. The sdst_flag can indicate the need to identify whether SDST is performed.

[0423] Figure 21 It is a flowchart showing the decoding process using SDST according to the present invention.

[0424] Refer to Figure 21 , in step S2110, entropy decoding of the sdst_flag can be performed on a TU-by-TU basis.

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

[0426] In addition, although in step S2120 - No, the depth of the TU is not 0, when in step S2130 - Yes, 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 S2180, the TU is reconstructed without performing the inverse transform.

[0427] Meanwhile, when in step S2120 - No, the depth of the TU is not 0, and when in step S2130 - No, the transform mode of the TU is not the transform skip mode and the cbf value of the TU is not 0, in step S2140, the sdst_flag value is checked.

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

[0429] Here, the signal that is the target of rearrangement or re - arrangement can be at least one of the residual signal before the inverse transform, the residual signal before the inverse quantization, the residual signal after the inverse transform, the residual signal after the inverse quantization, the reconstructed residual signal, and the reconstructed block signal.

[0430] Meanwhile, in Figure 21 it is described that the sdst_flag is signaled in units of TUs, but the sdst_flag can be selectively signaled based on at least one of the transform mode of the TU and the cbf value of the TU. For example, when the transform mode of the TU is the transform skip mode and / or the cbf value of the TU is 0, the sdst_flag is not signaled. In addition, even when the depth of the TU is 0, the sdst_flag is not signaled.

[0431] Meanwhile, it is described that the sdst_flag is signaled in units of TUs, but the sdst_flag can be signaled in a predetermined unit. For example, the sdst_flag can be signaled in units of at least one of video, sequence, picture, slice, parallel block, coding tree unit, coding unit, prediction unit, and transform unit.

[0432] As Figure 20 the SDST flag in Figure 21In an embodiment of the SDST flag, entropy coding / decoding of selected transform mode information can be performed in units of TUs by an n-bit flag or index (n is a positive integer equal to or greater than 1). The transform mode information can indicate at least one of whether to perform a transform on a TU by DCT-2, whether to perform a transform on a TU by SDST, whether to perform a transform on a TU by DST-7, etc.

[0433] In the case of a TU within a PU with only inter prediction, entropy coding / decoding of the transform mode information can be performed by a bypass mode. Further, in the case of at least one of a transform skip mode, a residual differential PCM (RDPCM) mode, and a lossless mode, entropy coding / decoding of the transform mode information is omitted and the transform mode information is not signaled.

[0434] Further, when the coding block flag of a block is 0, entropy coding / decoding of the transform mode information is omitted and the transform mode information is not signaled. When the coding block flag is 0, inverse transform processing is omitted in the decoder. Thus, even when there is no transform mode information in the decoder, reconstruction of the block can be performed.

[0435] However, the transform mode information is not limited to representing the transform mode by a flag and can be implemented in the form of a predefined table and index. Here, the predefined table can define available transform modes for each index.

[0436] Meanwhile, in 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) can be applied instead of DCT-2.

[0437] Further, the transform of DCT-2 or SDST can be performed separately in the horizontal and vertical directions. The same transform mode can be used for the horizontal and vertical directions, or different transform modes can be used.

[0438] Further, entropy coding / decoding of transform mode information regarding whether DCT-2 is used for the horizontal and vertical directions, whether SDST is used, and whether DST-7 is used can be performed separately. The transform mode information can be signaled, for example, as an index. The transform kernel indicated by the same index can be the same for in-frame prediction blocks and inter-frame prediction blocks.

[0439] Further, entropy coding / decoding of the transform mode information can be performed in units of at least one of a CU, a PU, a TU, and a block.

[0440] In addition, the transform mode information may be signaled according to the luminance component or the chrominance component. In other words, the transform mode information may be signaled according to the Y component, the Cb component, or the Cr component. For example, when the 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.

[0441] Here, the transform mode information may be entropy encoded / decoded by using an arithmetic coding method of a context model. When the transform mode information is implemented in the form of a predefined table and index, all or part of the multiple bits are entropy encoded / decoded by using an arithmetic coding method of a context model.

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

[0443] In addition, when non-zero transform coefficients or L quantized levels exist in the current block, the transform mode information is not entropy encoded / decoded, and one of the DCT-2, DST-7, and SDST methods is performed. Here, regardless of the positions of the non-zero transform coefficients or the quantized levels within the block, the transform mode information may not be entropy encoded / decoded. In addition, the transform mode information is not entropy encoded / decoded only when non-zero transform coefficients or quantized levels exist in the upper left position within the block. Here, L may be a positive integer including 0 and may be, for example, 1.

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

[0445] In addition, for a method in which the use of some transform modes is restricted according to the transform mode of a co-located block or the transform mode of a co-located block is represented by several bits, the binarization method of the transform method may be changed.

[0446] The above SDST may be restrictedly used based on at least one of the prediction mode of the current block, the intra prediction mode, the inter prediction mode, the TU depth, the size, and the shape.

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

[0448] The minimum / maximum depth allowing SDST can be defined. In this case, SDST is used when the depth of the current block is equal to or greater than the minimum depth. Optionally, SDST is used when the depth of the current block is equal to or less than the maximum depth. Here, the minimum / maximum depth can be a fixed value or can be variably determined based on information indicating the minimum / maximum depth. Information indicating the minimum / maximum depth can be signaled from the encoder and can be derived from the decoder based on the attributes of the current / neighboring blocks (e.g., size, depth, and / or shape).

[0449] The minimum / maximum size allowing SDST can be defined. Similarly, SDST is used when the size of the current block is equal to or greater than the minimum size. Optionally, SDST is used when the size of the current block is equal to or less than the maximum size. Here, the minimum / maximum size can be a fixed value or can be variably determined based on information indicating the minimum / maximum size. Information indicating the minimum / maximum size can be signaled from the encoder and can be derived from the decoder based on the attributes of the current / neighboring blocks (e.g., size, depth, and / or shape). For example, when the current block is 4×4, DCT-2 is used as the transform method and no entropy coding / decoding is performed on the transform mode information regarding whether DCT-2 or SDST is used.

[0450] The shape of the block allowing SDST can be defined. In this case, SDST is used when the shape of the current block is the defined block shape. Additionally, the shape of the block not allowing 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 the block allowing or not allowing SDST can be fixed and information about this can be signaled from the encoder. Optionally, it can be derived from the decoder based on the attributes of the current / neighboring blocks (e.g., size, depth, and / or shape). The shape of the block allowing or not allowing SDST can represent, for example, an M×N block, M, N, and / or the ratio between M and N.

[0451] Furthermore, when the depth of the TU is 0, DCT-2 or DST-7 is used as the transform method and entropy coding / decoding is performed on the transform mode information regarding which transform method has been used. When DST-7 is used as the transform method, a rearrangement process of the residual signal is performed. Additionally, when the depth of the TU is 1 or greater, DCT-2 or SDST is used as the transform method and entropy coding / decoding is performed on the transform mode information regarding which transform method has been used.

[0452] Furthermore, the transform method can be selectively used based on the partitioning shapes of the CU and PU or the shape of the current block.

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

[0454] In addition, when the partition shape of the CU and the 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.

[0455] In addition, when the partition shape of the CU and the 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.

[0456] Meanwhile, when performing SDST or DST-7 in units of blocks obtained from partitioning of the current block, scanning and inverse scanning can be performed on the transform coefficients (quantized levels) in units of blocks obtained from partitioning. In addition, when performing SDST or DST-7 in units of blocks obtained from partitioning of the current block, scanning and inverse scanning can be performed on the transform coefficients (quantized levels) in units of the unpartitioned current block.

[0457] In addition, the transform / inverse transform using SDST or DST-7 can be performed according to at least one of the intra prediction mode (direction) of the current block, the size of the current block, and the component (luminance component or chrominance component) of the current block.

[0458] In addition, in the transform / inverse transform using SDST or DST-7, DST-1 can be used instead of DST-7. In addition, in the transform / inverse transform using SDST or DST-7, DST-4 can be used instead of DST-7.

[0459] In addition, in the transform / inverse transform using DCT-2, a rearrangement method for rearrangement of the residual signal for SDST or DST-7 can be applied. That is, even when using DCT-2, rearrangement of the residual signal using a predetermined angle or rotation of the residual signal can be performed.

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

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

[0462] In the above description of the rearrangement step, the residual signal rearrangement method has been described. Hereinafter, other implementation methods will be described in addition to the rearrangement method for the rearrangement of the residual signal.

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

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

[0465] (1) r'(x,y) = r(x,y); no flip

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

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

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

[0469] 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 a flip can be performed with the same processing as the rearrangement method. That is, the residual signal rearranged using a horizontal flip can be reconstructed into the original residual signal arrangement by performing a horizontal flip again. The rearrangement method performed by the encoder and the inverse rearrangement method performed by the decoder can be the same flip method.

[0470] For example, as shown below, when a horizontal flip is performed on a residual block that has already undergone a horizontal flip, the residual block before the flip is obtained.

[0471] r’(w-1-x,y) = r(w-1-(w-1-x),y) = r(x,y)

[0472] For example, as shown below, when a vertical flip is performed on a residual block that has already undergone a vertical flip, the residual block before the flip is obtained.

[0473] r’(x,h-1-y) = r(x,h-1-(h-1-y)) = r(x,y)

[0474] For example, as shown below, when horizontal and vertical flips are performed on a residual block that has already undergone horizontal and vertical flips, the residual block before the flips is obtained.

[0475] r’(w-1-x,h-1-y) = r(w-1-(w-1-x),h-1-(h-1-y)) = r(x,y)

[0476] A flip-based residual signal rearrangement / redistribution method can be used without partitioning the current block. That is, in the SDST method, it is described that the current block (such as a TU) is partitioned into sub-blocks and DST-7 is used for each sub-block. However, when using the flip-based residual signal rearrangement / redistribution method, the current block is not partitioned into sub-blocks and a flip is performed on the entire current block or a part of the current block, and then the DST-7 transform is performed. In addition, when using the flip-based residual signal rearrangement / redistribution method, the current block is not partitioned into sub-blocks, and after performing the inverse DST-7 transform, a flip is performed on the entire current block or a part of the current block.

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

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

[0479] For example, when the width of the block is smaller than the minimum width capable of performing the flip method and the height of the block is greater than the minimum height capable of performing the flip method, a one-dimensional transform in the horizontal direction is performed only using DCT-2. For the one-dimensional transform in the vertical direction, a one-dimensional vertical transform is performed using DST-7 after vertical flipping, or a one-dimensional vertical transform is performed using DST-7 without flipping. Here, the SDST flag indicating the transform mode information of whether the flip is used as the transform mode may be signaled only for the one-dimensional transform in the vertical direction.

[0480] For example, when the height of a block is less than the minimum height capable of performing a flipping method and the width of the block is greater than the minimum width capable of performing the flipping method, for a one-dimensional transform in the horizontal direction, a one-dimensional horizontal transform is performed using DST-7 after horizontal flipping, or a one-dimensional horizontal transform is performed using DST-7 without flipping. A one-dimensional transform in the vertical direction can be performed using only DCT-2. Here, an SDST flag indicating whether flipping is used as a transform mode can be signaled only for the one-dimensional transform in the horizontal direction as transform mode information.

[0481] For example, when the size of the current block is greater than the maximum size capable of performing the flipping method, flipping and DST-7 transforms are not used and only DCT-2 transform is used. Here, an SDST flag indicating whether flipping and DST-7 transforms are used as transform modes can be not signaled.

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

[0483] For example, when the maximum size capable of performing the flipping method is 32×32 and the minimum size is 4×4, flipping and DST-7 transforms are used for a 64×64 block and only DCT-2 transform is used. Here, for a 64×64 block, an SDST flag indicating whether flipping and DST-7 are used as transform modes can be not signaled. In addition, for blocks sized 4×4 to 32×32, an SDST flag indicating whether flipping and DST-7 are used as transform modes can be signaled. In this case, DST-7 transform is not used for 64×64 blocks, thus saving memory space for storing DST-7 transform for 64×64 blocks.

[0484] For example, when the maximum size capable of performing the flipping method is 32×32 and the minimum size is 4×4, for a 64×64 block, not only the flipping method is used, but also DCT-2 or DST-7 transform is used.

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

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

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

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

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

[0490] 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 in which the block is partitioned according to a quadtree or a binary tree to generate sub-blocks, and a flip is performed on each sub-block, followed by performing DST-7 transform / inverse transform. Here, the flip method can be performed differently according to the relative position in the block that is the parent block of the sub-block, and this can be implicitly determined. Here, M and N can be positive integers, and for example, M and N can be 64. That is, the block of size M×N can be a relatively large block in size.

[0491] In the case of the upper left sub-block, a horizontal and vertical flip can be determined as the flip for the sub-block.

[0492] In the case of the upper right sub-block, a vertical flip can be determined as the flip for the sub-block.

[0493] In the case of the lower left sub-block, a horizontal flip can be determined as the flip for the sub-block.

[0494] In the case of the lower right sub-block, it can be determined that no flip is performed for the sub-block.

[0495] Transform mode information can be used to perform entropy encoding / decoding on information (sdst_flag or sdst flag) regarding the use of the flip-based residual signal rearrangement / redistribution method. That is, by transmitting the transform mode information with the signal, 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 / redistribution 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, another transform / inverse transform method can be the DCT-2 transform / inverse transform method. In addition, in the case of one of the transform skip mode, the residual differential PCM (RDPCM) mode, and the lossless mode, the entropy encoding / decoding of the transform mode information is omitted, and the transform mode information is not signaled.

[0496] At least one of the depth of the current block, the size of the current block, the shape of the current block, the transform mode information of neighboring blocks, the coding block flag of the current block, and information on whether the transform skip mode of the current block is used can be used to perform entropy coding / decoding on the transform mode information. For example, when the coding block flag of the current block is 0, the entropy coding / decoding of the transform mode information is omitted and the transform mode information is not signaled. In addition, the transform mode information can be predictively encoded / decoded from the transform mode information of the reconstructed blocks adjacent to the current block during entropy coding / decoding. In addition, the transform mode information can be signaled based on at least one of the coding parameters of the current block and neighboring blocks.

[0497] In addition, using the flipping method information, at least one of the four flipping methods (no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) can be entropy-coded / decoded in the form of a flag or an 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 can include the flipping method information.

[0498] In addition, in the case of one of the transform skip mode, the residual differential PCM (RDPCM) mode, and the lossless mode, the entropy coding / decoding of the flipping method information is omitted and the flipping method information is not signaled. At least one of the depth of the current block, the size of the current block, the shape of the current block, the flipping method information of neighboring blocks, the coding block flag of the current block, and information on whether the transform skip mode of the current block is used can be used to perform entropy coding / decoding on the flipping method information. For example, when the coding block flag of the current block is 0, the entropy coding / decoding of the flipping method information is omitted and the transform mode information is not signaled. In addition, the flipping method information can be predictively encoded / decoded from the flipping method information of the reconstructed blocks adjacent to the current block during entropy coding / decoding. In addition, the flipping method information can be signaled based on at least one of the coding parameters of the current block and neighboring blocks.

[0499] In addition, the residual signal rearrangement method is not limited to the above-mentioned residual signal rearrangement and can be achieved by rotating the residual signal within the block at a predetermined angle. Here, the predetermined angle can represent angles such as 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 on the angle can be entropy-coded / decoded in the form of a flag or an index, and the information on the angle can be performed in a similar manner to the signaling method of the transform mode information.

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

[0501] The predetermined angle can be determined differently according to the position of the sub-block. A method of rearrangement by rotating only the sub-block at a specific position (e.g., the first sub-block) in the sub-block can be used in a restricted manner. In addition, the rearrangement using the predetermined angle can be applied to the entire current block. Here, the current block targeted for rearrangement can be at least one of the residual block before inverse transformation, the residual block before inverse quantization, the residual block after inverse transformation, the residual block after inverse quantization, the reconstructed residual block, and the reconstructed block.

[0502] Meanwhile, in order to achieve the same effect as the rearrangement or rotation of the residual signal, the coefficients of the transformation matrix used for transformation can be rearranged or rotated, and this can be applied to the previously arranged residual signal to perform transformation. That is, instead of the rearrangement of the residual signal, the rearrangement of the transformation matrix is used to perform transformation, thereby achieving the same effect as the method of performing rearrangement and transformation on the residual signal. Here, the rearrangement of the coefficients of the transformation matrix can be performed in the same manner as the above-described residual signal rearrangement method, and the method of signaling information required for the rearrangement of the coefficients of the transformation matrix can be performed in the same manner as the method of signaling information required for the above-described residual signal rearrangement method.

[0503] Meanwhile, a part of the residual signal rearrangement method regarding the rearrangement step can be determined as the optimal rearrangement method of the encoder, and information (rearrangement method information) regarding the determined rearrangement method can be signaled to the decoder. For example, when four rearrangement methods are used, the encoder signals up to two bits of information regarding the residual signal rearrangement method to the decoder.

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

[0505] In addition, the occurrence probability of the rearrangement method may vary according to coding parameters such as the prediction mode of the current CU, the intra prediction mode (direction) of the PU, the motion vectors of neighboring blocks, etc. Therefore, the coding method for the information (flipping method information) regarding the rearrangement method can be used differently according to the coding parameters. For example, the occurrence probability of the rearrangement method may vary according to the prediction mode of intra prediction. Therefore, for each intra mode, fewer bits can be allocated to the rearrangement method with a high occurrence probability, and many bits can be allocated to the rearrangement method with a low occurrence probability. Optionally, depending on the situation, the rearrangement method with an extremely low occurrence probability may not be used and no bits may be allocated to it.

[0506] A rearrangement set including at least one of the residual signal rearrangement methods can be constructed according to at least one of the prediction mode (inter-frame mode or intra-frame mode) of the current block, the intra prediction mode (including the directional mode and the non-directional mode), the inter-frame prediction mode, the block size, the block shape (square shape or non-square shape), the luminance / chrominance signal, the transform mode information, etc. The rearrangement can represent flipping. In addition, based on at least one of the coding parameters of the current block and neighboring blocks, a rearrangement set including at least one of the residual signal rearrangement methods can be constructed.

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

[0508] The rearrangement set may include at least one of "no flipping", "horizontal flipping", "vertical flipping", and "horizontal and vertical flipping". Examples of the rearrangement set are shown below.

[0509] 1. No flipping

[0510] 2. Horizontal flipping

[0511] 3. Vertical flipping

[0512] 4. Horizontal and vertical flipping

[0513] 5. No flipping, and horizontal flipping

[0514] 6. No flipping, and vertical flipping

[0515] 7. No flipping, and horizontal and vertical flipping

[0516] 8. Horizontal flipping, and vertical flipping

[0517] 9. Horizontal flipping, and horizontal and vertical flipping

[0518] 10. Vertical flipping, as well as horizontal and vertical flipping

[0519] 11. No flipping, horizontal flipping, and vertical flipping

[0520] 12. No flipping, horizontal flipping, and horizontal and vertical flipping

[0521] 13. No flipping, vertical flipping, and horizontal and vertical flipping

[0522] 14. Horizontal flipping, vertical flipping, and horizontal and vertical flipping

[0523] 15. No flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping

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

[0525] In addition, according to at least one of the prediction mode of the current block, intra prediction mode, inter prediction mode, block size, block shape, luminance / chrominance, transform mode information, flipping method information, etc., at least one of the residual signal rearrangement methods can be selected from the rearrangement set. In addition, based on at least one of the coding parameters of the current block and neighboring blocks, at least one of the residual signal rearrangement methods can be selected from the rearrangement set.

[0526] According to the prediction mode of the current block, at least one rearrangement set can be constructed. For example, when the prediction mode of the current block is intra prediction, multiple rearrangement sets are constructed. When the prediction mode of the current block is inter prediction, one rearrangement set is constructed.

[0527] According to the intra prediction mode of the current block, at least one rearrangement set can be constructed. For example, when the intra prediction mode of the current block is a non-directional mode, one rearrangement set is constructed. When the intra prediction mode of the current block is a directional mode, multiple rearrangement sets are constructed.

[0528] According to the size of the current block, at least one rearrangement set can be constructed. For example, when the size of the current block is greater than 16×16, one rearrangement set is constructed. When the size of the current block is equal to or less than 16×16, multiple rearrangement sets are constructed.

[0529] According to the shape of the current block, at least one rearrangement set can be constructed. For example, when the shape of the current block is a square shape, one rearrangement set is constructed. When the shape of the current block is a non-square shape, multiple rearrangement sets are constructed.

[0530] At least one rearrangement set can be constructed according to the luminance / chrominance signal of the current block. For example, when the current block is a chrominance signal, one rearrangement set is constructed. When the current block is a luminance signal, multiple rearrangement sets are constructed.

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

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

[0533] In addition, the rearrangement set can be in the form of a table in the encoder and decoder and can be calculated by an equation.

[0534] In addition, the rearrangement set can be constructed in a symmetric manner. For example, the table for the rearrangement set can be constructed in a symmetric manner. Here, the table can be constructed in a manner that is symmetric with respect to the intra prediction mode.

[0535] In addition, the rearrangement set can 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.

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

[0537] In addition, in the following table, the flip method information can be used to indicate the use of at least one of the residual signal rearrangement methods in the residual signal rearrangement method.

[0538] [Table 1]

[0539]

[0540] In Table 1, columns (1) to (4) of the residual signal rearrangement method specify the residual signal rearrangement method, such as the index of the scan / rearrangement order for the above-mentioned residual signal rearrangement, the index for a predetermined angle value, the index for a predetermined flipping method, etc. In Table 1, the notation * in the column of the residual signal rearrangement method indicates that the corresponding rearrangement method is implicitly used without signal transmission, and the notation - indicates that the corresponding rearrangement method is not used in the corresponding case. The meaning of implicitly using the rearrangement method can be to use the transform mode information (sdst_flag or sdst flag) to use the rearrangement method without entropy coding / decoding the index of the residual signal rearrangement method. Columns (1) to (4) of the residual signal rearrangement method may respectively refer to (1) no flipping, (2) horizontal flipping, (3) vertical flipping, and (4) horizontal and vertical flipping. In addition, numbers such as 0, 1, 10, 11, 110, 111, etc. can be the results of binarization / inverse binarization for entropy coding / decoding the residual signal rearrangement method. As the binarization / inverse binarization 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 prediction mode (direction), at least one rearrangement method is used in the encoder and the decoder. Here, the diagonal direction of 45 degrees can represent the direction towards the upper left position in the current block or the direction from the upper left position in the current block towards the current block.

[0541] [Table 2]

[0542]

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

[0544] [Table 3]

[0545]

[0546]

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

[0548] [Table 4]

[0549]

[0550] 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 the intra mode and the intra prediction direction is even, at least one of the non-flipping, horizontal flipping, and vertical flipping methods is used as the residual signal rearrangement method. In addition, when the current block is in the intra mode and the intra prediction direction is odd, at least one of the non-flipping, vertical flipping, horizontal and vertical flipping methods is used as the residual signal rearrangement method.

[0551] [Table 5]

[0552]

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

[0554] [Table 6]

[0555]

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

[0557] [Table 7]

[0558]

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

[0560] [Table 8]

[0561]

[0562]

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

[0564] [Table 9]

[0565]

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

[0567] [Table 10]

[0568]

[0569] 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 prediction modes (directions), at least one rearrangement method is used in the encoder and the decoder. Here, the diagonal direction of the 135-degree angle may represent the direction towards the upper right position in the current block or the direction from the upper right position in the current block towards the current block. For example, the value of the diagonal direction mode of the 135-degree angle may be 6. Here, the diagonal direction of the -45-degree angle may represent the direction towards the lower right position in the current block or the direction from the lower right position in the current block towards the current block. For example, the value of the diagonal direction mode of the -45-degree angle may be 2.

[0570] [Table 11]

[0571]

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

[0573] [Table 12]

[0574]

[0575]

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

[0577] [Table 13]

[0578]

[0579] 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 decoder. Here, the residual signal rearrangement method may represent the type of transformation. For example, when the residual signal rearrangement method is (1), both the horizontal transformation and the vertical transformation represent the first transformation kernel. As another example, when the residual signal rearrangement method is (2), the horizontal transformation and the vertical transformation represent the second transformation kernel and the first transformation kernel, respectively. As another example, when the residual signal rearrangement method is (3), the horizontal transformation and the vertical transformation represent the first transformation kernel and the second transformation kernel, respectively. As another example, when the residual signal rearrangement method is (4), the horizontal transformation and the vertical transformation represent the second transformation kernel and the second transformation kernel, respectively. For example, the first transformation kernel may be DST-7, and the second transformation kernel may be DCT-8. When the intra prediction mode is the planar mode or the DC mode, the information about the four rearrangement methods (rearrangement method information) is entropy encoded / decoded using the truncated unary code based on the occurrence probability. When the intra prediction direction is the horizontal direction or a mode close to the horizontal direction, the probability of the rearrangement method (1) and / or the rearrangement method being (3) is high. In this case, one bit can be used for each of the two rearrangement methods, and the information about the rearrangement method can be entropy encoded / entropy decoded. Here, the meaning of a mode close to the horizontal direction may be that the value of a specific mode is between the value of the horizontal direction mode - K and the value of the horizontal direction mode + K. Here, K may be an integer. For example, when the value of the horizontal direction mode is 18, 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, K is 4, and the specific mode is 26, the specific mode is not a mode close to the horizontal direction.

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

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

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

[0583] When the intra prediction mode is odd, the information entropy about the rearrangement method is entropy-coded / entropy-decoded into a truncated unary code or a unary code only for rearrangement methods (1), (3), and (4).

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

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

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

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

[0588] For a region or CTU within a picture, the entire picture, or the current block within a picture group, the transform / inverse transform can be performed by selecting one of the following three methods: DCT-2 transform / inverse transform, DST-7 transform / inverse transform without flipping, and DST-7 transform / inverse transform after performing a vertical flip. Information about which of the three methods will be selected can be implicitly selected using the neighboring information of the current block, or can be explicitly selected by signaling an index (transform mode information or flip method information). The index can be signaled as a truncated unary code in such a way that DCT-2 is 0, DST-7 without flipping is 10, and DST-7 after a vertical flip is 11. In addition, depending on the size and neighboring information of the current block, the binarization of DCT-2 and the binarization of DST-7 can be swapped for signaling. In addition, the first binary number in the binary numbers can be signaled in units of CU, and the remaining binary numbers can be signaled in units of TU or PU. Information about the region where this method is used can be signaled in units of CTU, slice, PPS, SPS, or other specific regions, and a one-bit flag can be signaled in an on / off form.

[0589] For a region within a picture or a CTU, the entire picture, or a current block within a picture group, a transform / inverse transform can be performed by selecting one of the following four methods: DCT-2 transform / inverse transform, DST-7 transform / inverse transform without flipping, DST-7 transform / inverse transform after performing a horizontal flip, and DST-7 transform / inverse transform after performing a vertical flip. Information regarding which of the four methods will be selected can be implicitly selected using information near the current block, or can be explicitly selected by signaling an index (transform mode information or flip method information). The index can be signaled as a truncated unary code such that DCT-2 is 0, DST-7 without flipping is 10, DST-7 after a horizontal flip is 110, and DST-7 after a vertical flip is 111. Additionally, depending on the size and neighboring information of the current block, binarization of DCT-2 and binarization of DST-7 can be swapped for signaling. Further, a first binary number in the binary number can be signaled in units of a CU, and the remaining binary numbers can be signaled in units of a TU or a PU. Depending on the intra prediction mode, only a subset of the four methods can be used. For example, when the intra prediction mode is numerically less than the diagonal prediction mode, is the DC mode, or is the planar mode, only three methods are used: DCT-2, DST-7 without flipping, and DST-7 after a vertical flip. In this case, the transform mode information or flip method information can be signaled such that DCT-2 is 0, DST-7 without flipping is 10, and DST-7 after a vertical flip is 11. For example, when the intra prediction mode is numerically greater than the diagonal prediction mode, only three methods are used: DCT-2, DST-7 without flipping, and DST-7 after a horizontal flip. In this case, the transform mode information or flip method information can be signaled such that DCT-2 is 0, DST-7 without flipping is 10, and DST-7 after a horizontal flip is 11. Information regarding the region where this method is used can be signaled in units of a CTU, a slice, a PPS, an SPS, or other specific regions, and a one-bit flag can be signaled in an on / off form.

[0590] For a region within a picture or a CTU, the entire picture, or a current block within a picture group, 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 performing a horizontal flip, DST-7 transform / inverse transform after performing a vertical flip, and DST-7 transform / inverse transform after performing both a horizontal and a vertical flip. Information regarding which of the five methods will be selected can be implicitly selected using information near the current block, or can be explicitly selected by signaling an index (transform mode information or flip method information). The index can be signaled as a truncated unary code such that DCT-2 is 0, DST-7 without flipping is 10, DST-7 after a horizontal flip is 110, DST-7 after a vertical flip is 1110, and DST-7 after both a horizontal and a vertical flip is 1111. Further, depending on the size of the current block and the nearby information, the binarization of DCT-2 and the binarization of DST-7 can be swapped for signaling. Further, a first binary number in the binary number can be signaled in units of CUs, and the remaining binary numbers can be signaled in units of TUs or PUs. Further, information can be signaled as a fixed-length code by differentiating among the binary numbers (first binary number, second binary number, and third binary number). For example, the transform mode information or the flip method information can be signaled such that DCT-2 is 0, DST-7 without flipping is 000, DST-7 after a horizontal flip is 001, DST-7 after a vertical flip is 010, and DST-7 after both a horizontal and a vertical flip is 011. Further, depending on the intra prediction mode, only a part of the five methods can be used. For example, when the intra prediction mode is a prediction mode close to the horizontal direction prediction mode, only three transform methods are used: DCT-2, DST-7 without flipping, and DST-7 after a vertical flip. In this case, the transform mode information or the flip method information can be signaled such that DCT-2 is 0, DST-7 without flipping is 10, and DST-7 after a vertical flip is 11.

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

[0592] For example, when the intra prediction mode is a prediction mode close to the diagonal direction prediction mode, only two transformation methods are used: DCT-2 and DST-7 without flipping. In this case, the transformation mode information or the flipping method information can be signaled in such a way that DCT-2 and DST-7 without flipping are 1.

[0593] For example, in cases other than the above three cases, all five transformation 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 transformation method can be signaled as a truncated unary code scheme, a fixed-length code scheme, or other schemes.

[0594] For example, when the intra prediction mode is a non-directional mode, all five transformation 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 transformation method can be signaled as a truncated unary code scheme, a fixed-length code scheme, or other schemes.

[0595] For example, when the intra prediction mode is an odd mode, four transformation methods are used: DCT-2, DST-7 without flipping, DST-7 after vertical flipping, and DST-7 after horizontal and vertical flipping. In this case, the transformation mode information or the flipping method information can be signaled in such a way 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.

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

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

[0598] Refer to Figure 22, in the encoder, residual signal rearrangement may be performed before DST-7 transform processing. Although not shown in Figure 22 , in the encoder, residual signal rearrangement may be performed between the transform processing and the quantization processing, or residual signal rearrangement may be performed after quantization.

[0599] Referring to Figure 23 , in the decoder, residual signal rearrangement may be performed after the DST-7 inverse transform processing. Although not shown in Figure 23 , in the decoder, residual signal rearrangement may be performed between the dequantization processing and the inverse transform processing, or residual signal rearrangement may be performed before dequantization.

[0600] The above has described the SDST method according to the present invention with reference to Figures 7 to 23 . Hereinafter, a decoding method, an encoding method, a decoder, an encoder, and a bitstream to which the SDST method according to the present invention is applied will be described in detail with reference to Figure 24 and Figure 25 .

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

[0602] Referring to Figure 24 , first, in step S2401, the transform mode of the current block may be determined, and in step S2402, the inverse transform may be performed on the residual data of the current block according to the transform mode of the current block.

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

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

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

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

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

[0608] The DCT mode may indicate a mode in which an inverse transform is performed according to the DCT-2 transform mode and rearrangement of the residual data for which the inverse transform has been performed is not performed.

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

[0610] Although the inverse transform is described above as being performed according to the DST-7 transform mode for the SDST and DST modes, transform modes based on other DSTs (such as DST-1, DST-2, etc.) may be used.

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

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

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

[0614] Meanwhile, rearrangement of the residual data for which the inverse transform has been performed on the current block in step S2403 may include: scanning the residual data for which the inverse transform has been performed arranged in the current block in order in a first direction; rearranging the residual data scanned in the first direction in the current block in order in a second direction. Here, the order in the first direction may be one of a raster scan order, an upper right diagonal scan order, a horizontal scan order, and a vertical scan order. In addition, the order in the first direction may be defined as follows.

[0615] (1) Scanning from the upper row to the lower row, and scanning from the left side to the right side in one row

[0616] (2) Scanning from the upper row to the lower row, and scanning from the right side to the left side in one row

[0617] (3) Scanning from the lower row to the upper row, and scanning from the left side to the right side in one row

[0618] (4) Scanning from the lower row to the upper row, and scanning from the right side to the left side in one row

[0619] (5) Scanning from the left column to the right column, and scanning from the upper side to the lower side in one column

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

[0621] (7) Scanning from the right column to the left column and scanning from the top to the bottom within a column

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

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

[0624] Meanwhile, regarding the order in the second direction, one of the above directions can be selectively used. The first direction and the second direction can be the same or different from each other.

[0625] In addition, in the rearrangement of the residual data of the current block in step S2403 for which the inverse transform has been performed, the rearrangement is performed in units of sub-blocks within the current block. In this case, the residual data can be rearranged based on the positions of the sub-blocks within the current block. Since the rearrangement of the residual data based on the positions of the sub-blocks has been described in detail in Equation 6 above, the repeated description will be omitted.

[0626] In addition, in the rearrangement of the residual data of the current block in step S2403 for which the inverse transform has been performed, the residual data of the inverse transform arranged within the current block can be rotated at a predefined angle for rearrangement.

[0627] In addition, in the rearrangement of the residual data of the current block in step S2403 for which the inverse transform has been performed, according to the flipping method, the residual data of the inverse transform arranged within the current block can be flipped for rearrangement. In this case, the determination of the transform mode of the current block in step S2401 can include: obtaining the flipping method information from the bitstream; and determining the flipping method for the current block based on the flipping method information.

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

[0629] Referring to Figure 25 , in step S2501, the transform mode of the current block can be determined.

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

[0631] Next, in step S2503, the residual data of the current block that has been rearranged according to the transform mode of the current block can be transformed.

[0632] Here, the transformation mode may include at least one of rearranged discrete sine transform (SDST), rearranged discrete cosine transform (SDCT), discrete sine transform (DST), and discrete cosine transform (DCT). Since SDST, SDCT, DST, and DCT have been described with reference to Figure 24 the repeated description will be omitted.

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

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

[0635] Here, when the prediction mode of the current block is an inter-frame prediction mode, one of SDST and SDCT is determined as the transformation mode of the current block.

[0636] 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 the order according to the first direction; rearranging the residual data scanned in the first direction in the current block in the order according to the second direction.

[0637] In addition, 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.

[0638] In this case, in the rearrangement of the residual data of the current block in step S2502, the residual data can be rearranged based on the position of the sub-block within the current block.

[0639] Meanwhile, in the rearrangement of the residual data of the current block in step S2502, the residual data arranged within the current block can be rotated at a predefined angle for rearrangement.

[0640] Meanwhile, in the rearrangement of the residual data of the current block in step S2502, according to the flipping method, the residual data arranged within the current block can be flipped for rearrangement.

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

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

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

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

[0645] For a bitstream generated by an encoding method using the SDST method according to 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, where the transformation mode may include at least one of rearranged discrete sine transform (SDST), rearranged discrete cosine transform (SDCT), discrete sine transform (DST), and discrete cosine transform (DCT).

[0646] Figures 26 to 31 An example showing the position where the flipping method is performed in an encoder and a decoder according to the present invention is shown.

[0647] Figure 26 It is a diagram showing an embodiment of an encoding process in a method of performing a transformation after flipping.

[0648] Figure 27 It is a diagram showing an embodiment of a decoding process in a method of performing a flip after an inverse transformation.

[0649] Referring to Figure 26 , the inter-frame or intra-frame predicted signal is subtracted from the original signal of the current block to generate a residual signal. Subsequently, one of the DCT-2 transform, flipping, and DST-7 transform can be selected as the transform method. When the transform method is the DCT-2 transform, the DCT-2 transform is used to perform a transform on the residual signal, thereby generating transform coefficients. When the transform method is the 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 the DST-7 transform is used to perform a transform on the residual signal on which flipping has been performed, thereby generating transform coefficients. By performing quantization on the transform coefficients, quantized levels can be generated.

[0650] Referring to Figure 27 , the quantized levels are received to perform inverse quantization, thereby generating transform coefficients. A method corresponding to the method selected in the encoding process and corresponding to the inverse DCT-2 transform or DST-7 inverse transform and flipping can be selected. That is, when the DCT-2 transform is performed in the encoding process, the inverse DCT-2 transform is performed in the decoding process. In addition, when the flipping and DST-7 transform method is performed in the encoding process, the DST-7 inverse transform and flipping are performed in the decoding process. When the inverse transform method is the inverse DCT-2 transform, the inverse DCT-2 transform is used to perform an inverse transform on the transform coefficients, thereby generating a reconstructed residual signal. When the inverse transform method is the DST-7 inverse transform and flipping method, the DST-7 inverse transform is used to perform an inverse transform on the residual coefficients to generate a reconstructed residual signal. Subsequently, one of four flipping methods (no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) is selected to perform flipping on the reconstructed residual signal, thereby generating a flipped reconstructed residual signal. The inter-frame or intra-frame predicted signal is added to the reconstructed residual signal or the flipped reconstructed residual signal, thereby generating a reconstructed signal.

[0651] Figure 28 is a diagram showing an embodiment of the encoding process in the method of performing flipping after the transform.

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

[0653] Referring to Figure 28, the inter-frame or intra-frame predicted signal is subtracted from the original signal of the current block to generate a residual signal. Subsequently, 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 DCT-2 transform is used to perform a transform on the residual signal, thereby generating transform coefficients. When the transform method is DST-7 transform and the flipping method, the DST-7 transform is used to perform a transform on the residual signal. Subsequently, one of four flipping methods (no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) is selected to perform flipping on the transform coefficients, thereby generating the transformed coefficients on which flipping has been performed. By performing quantization on the transform coefficients or the transformed coefficients on which flipping has been performed, quantized levels can be generated. When flipping is performed on the transform coefficients, rearrangement of the transform coefficients is performed. The method of performing rearrangement can be the same method as flipping, can be the method of performing a second transform for rotating the axis at the zero point of the transform basis, can be the method of swapping the positive and negative signs of the transform coefficients, and so on.

[0654] Refer to Figure 29 , the quantized levels are received to perform inverse quantization, thereby generating transform coefficients. A method corresponding to the method selected in the encoding process and corresponding to the inverse DCT-2 transform or flipping and inverse DST-7 transform can be selected. That is, when the DCT-2 transform is performed in the encoding process, the inverse DCT-2 transform is performed in the decoding process. When the DST-7 transform and the flipping method are performed in the encoding process, flipping and inverse DST-7 transform are performed in the decoding process. When the inverse transform method is the inverse DCT-2 transform, the inverse DCT-2 transform is used to perform an inverse transform on the transform coefficients, thereby generating a reconstructed residual signal. When the inverse transform method is the flipping and inverse 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 transform coefficients. Subsequently, the inverse DST-7 transform is used to perform an inverse transform on the transformed coefficients on which flipping has been performed, thereby generating a reconstructed residual signal. The inter-frame or intra-frame predicted signal is added to the reconstructed residual signal, thereby generating a reconstructed signal.

[0655] Figure 30 is a diagram showing an embodiment of the encoding process in the method of performing flipping after quantization.

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

[0657] Refer to Figure 30, the inter-frame or intra-frame predicted 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 DCT-2 transform is used to perform a transform on the residual signal, thereby generating transform coefficients. When the transform method is the DST-7 transform, the DST-7 transform is used to perform a transform on the residual signal, thereby generating transform coefficients. By performing quantization on the transform coefficients, quantized levels can be generated. In addition, 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 perform flipping on the quantized levels, thereby generating the quantized levels on which flipping has been performed. In addition, when flipping is performed on the quantized levels, rearrangement of the quantized levels is performed. The method of performing rearrangement can be the same method as flipping, can be a method of performing a second transform for rotating the axis at the zero point of the transform basis, can be a method of swapping the positive and negative signs of the quantized levels, and so on.

[0658] Refer to Figure 31 , the quantized levels are received, and an inverse transform method corresponding to the method selected in the encoding process and corresponding to the inverse DCT-2 transform and the inverse DST-7 transform is selected. That is, when the DCT-2 transform is performed in the encoding process, the inverse DCT-2 transform is performed in the decoding process. In addition, when the DST-7 transform is performed in the encoding process, the inverse DST-7 transform is performed in the decoding process. When the inverse transform method is the inverse DCT-2 transform, the quantized levels are dequantized to generate transform coefficients, and then the inverse DCT-2 transform is used to perform an inverse transform on the transform coefficients, thereby generating a reconstructed residual signal. When the inverse transform method is the inverse 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 quantized levels, and then the quantized levels on which flipping has been performed are dequantized, thereby generating transform coefficients. The inverse DST-7 transform is used to perform an inverse transform on the transform coefficients, thereby generating a reconstructed residual signal. The inter-frame or intra-frame predicted signal is added to the reconstructed residual signal, thereby generating a reconstructed signal.

[0659] At the same time, the position where the flipping method is performed in the decoder can be determined based on the information about the flipping position signaled from the encoder.

[0660] Figure 32 is a diagram showing flipping of a residual block.

[0661] Refer to Figure 32 , at least one of "no flipping", "horizontal flipping", "vertical flipping", and "horizontal and vertical flipping" can be performed on the residual block. As Figure 32 shown, the positions of the samples within the residual block can change according to the flipping type.

[0662] Figure 33 is a diagram showing an embodiment for implementing a flip of an 8×8 - sized residual block as hardware.

[0663] Referring to Figure 33 , in the hardware implementation of the vertical flip of an M×N residual block, the vertical flip of the M×N block is performed by changing the address value (addr) for reading data from the residual - block memory to M−1−addr. That is, instead of the vertical - flip operation, the memory - row address for the M×N block is changed to read the data within the residual block, thereby implementing the vertical flip.

[0664] In the hardware implementation of the horizontal flip of an M×N residual block, the horizontal flip of the M×N block is performed by changing the data values in the residual - block memory in a reverse - read order. That is, instead of the horizontal - flip operation, the order of reading the data values of the M×N block is changed, thereby implementing the horizontal flip. For example, when 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, thereby performing the horizontal flip.

[0665] Figure 34 is a diagram showing the flip and transform of a residual block.

[0666] Referring to 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 the DST - 7 transform can be performed. As Figure 34 shown, the positions of the samples within the residual block can be changed according to the flip type, and the DST - 7 transform can be performed.

[0667] The following shows an example of using the Adaptive Multiple Transform (AMT) method, in which at least one of the transforms used in the specification is used.

[0668] At least one of the transforms used in the specification can be used to construct an AMT set. For example, in addition to transforms such as DCT - 2, DCT - 5, DCT - 8, DST - 1, DST - 7, etc., at least one transform for each block of intra - frame and inter - frame - encoding / decoding can be added to the AMT transform set. Specifically, DST - 4 and the identity transform can be added to the AMT transform set for the blocks of inter - frame - encoding / decoding, and KLT - 1 and KLT - 2 can be added to the AMT transform set for the blocks of intra - frame - encoding / decoding.

[0669] Transformations corresponding to blocks of sizes other than powers of two, such as 4×24 and 8×48, can be added. For example, in intra-frame encoding / decoding processing, seven transformation sets each having four transformation pairs can be defined as shown in Table 14 below.

[0670] [Table 14]

[0671]

[0672] In Table 14, the first item of the transformation pair can represent the transformation in the vertical direction, and the second item can represent the transformation in the horizontal direction. The set of transformation pairs in Table 14 can be defined in such a way that each of the seven transformation sets is allocated based on different intra-frame prediction modes and different block sizes. In Table 14, T0 to T6 can represent the available transformation pair sets corresponding to the respective block sizes. For example, T0 can be used for a 2×2 block size, T1 can be used for a 4×4 block size, T2 can be used for an 8×8 block size, T3 can be used for a 16×16 block size, T4 can be used for a 32×32 block size, T5 can be used for a 64×64 block size, and T6 can be used for a 128×128 block size. The identity transformation can be applied to blocks with a size of up to 16×16. In addition, the identity transformation can be applied to blocks in a pattern close to the horizontal and vertical intra-frame prediction directions. The pattern close to the horizontal and / or vertical intra-frame prediction directions can be defined as a threshold based on the size of the block. For example, when the transformation index is 3 and the block satisfies the above conditions, the horizontal and / or vertical identity transformation is applied. Meanwhile, in inter-frame encoding / decoding processing, two transformation sets each having four transformation pairs can be defined as shown in Table 15 below.

[0673] [Table 15]

[0674]

[0675] In Table 15, T0 and T1 can represent the available transformation pair sets corresponding to the block size. For example, in Table 15, the transformation set including KLT (i.e., T 1,帧间 ) can be applied to blocks with a size equal to or smaller than 16×16, and T 0,帧间 can be applied to blocks with a size larger than 16×16.

[0676] In addition, a method that approximates the AMT transformation using only the DCT-2 transformation and an adjustment step can be used. The adjustment step can be defined using a block band orthogonal matrix for transforming the DCT-2 transformation into a form similar to the AMT transformation.

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

[0678] For example, the transforms are used to construct a two-dimensional transform set (i.e., horizontal and vertical transforms) for use in the inter-frame encoding / decoding process. In the intra-frame encoding / decoding process, the two-dimensional transform set shown in Table 16 below can be used.

[0679] [Table 16]

[0680]

[0681]

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

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

[0684] The transform matrices of DCT-8, DST-1, and DCT-5 included in the AMT transform set used in the specification can be replaced by other transform matrices. Flipped DST-7 can be used to replace DCT-8. DST-6 can be used to replace DST-1. DCT-2 can be used to replace DCT-5.

[0685] As shown in Equation 7 below, the transform matrices of flipped DST-7 and DST-6 can be derived from DST-7.

[0686] [Equation 7]

[0687] Flipped DST-7:

[0688] DST-6:

[0689] Here, represents the first component of the k-th elementary vector in the N×N transform matrix of DST-7.

[0690] In addition, the AMT transform including the transform matrices of DCT-8, DST-1, and DCT-5 can be applied to both the luminance component and the chrominance component.

[0691] The transform for the luminance component can be determined based on a pattern-dependent transform set and an explicitly signaled AMT index indicating horizontal and vertical transforms.

[0692] In the case of the chrominance component / intra mode, the transform can be determined in the same way as the method for determining the transform for the luminance component, and the number of transform candidates can be less than the number of transform candidates for the luminance component.

[0693] In the case of the chrominance component / inter mode, the transform can 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 luminance component.

[0694] In addition, the AMT can select horizontal and vertical transforms from 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 and vertical transforms. When the AMT flag is 1, it indicates that another transform is used according to the AMT index. The use of AMT is allowed only when both the width and height of the block are equal to or less than 64. The AMT flag can be determined by the intra prediction mode. In the even intra prediction mode, the AMT flag can be implicitly assigned as 1. In the odd intra prediction mode, the AMT flag can be implicitly assigned as 0. In addition, in the odd intra prediction mode, the AMT flag can be implicitly assigned as 1. In the even intra prediction mode, the AMT flag can be implicitly assigned as 0.

[0695] A transform set adding two transforms DST-7 and DCT-8 can be used, and the maximum block size to which the AMT is applied can be limited to a size of 32×32. The forward N×N DST-7 with a discrete Fourier transform (DFT) of length 2N+1 can be implemented to obtain the N×N DST-7. The 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 the DST-7 calculation. Therefore, DST-7 can be reused to implement DCT-8.

[0696] The transform or inverse transform for the current block is only performed on the sub-blocks within the current block. For example, the sub-block can be the sub-block at the upper left position in the current block. The horizontal length (width) and vertical length (height) of the sub-block can be determined independently. For example, the horizontal length (width) (or vertical length (height)) of the sub-block can be determined according to the type of the transform kernel applied to the horizontal transform or inverse transform (or vertical transform or inverse transform). For example, when the transform kernel applied to the horizontal transform or inverse transform is DCT-2, the horizontal length (width) is 32 samples. For example, when the transform kernel applied to 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, for example, when the transform kernel applied to the vertical transform or inverse transform is DCT-2, the vertical length (height) is 32 samples. For example, when the transform kernel applied to 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. In addition, since the sub-block cannot be larger than the current block, when the length of the current block is shorter than the derived length of the sub-block (e.g., 32 samples or 16 samples), the length of the block on which the transform or inverse transform has been performed is determined as the length of the current block. The transform or inverse transform is not performed on the samples in the region within the current block that are not included in the sub-block. All sample values of the samples can be set to "0". Here, the sub-block can include the residual signal that is the difference between the input signal and the prediction signal, or can include the transform coefficients obtained from the transform of the residual signal.

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

[0698] The transforms for the luminance component and the chrominance component according to the intra-frame prediction mode can be represented as shown in Table 17 and Table 18 below, respectively.

[0699] [Table 17]

[0700]

[0701] [Table 18]

[0702]

[0703] Here, Table 17 shows the transform mapping table for the luminance component, and Table 18 shows the transform mapping table for the chrominance component. In addition, the transform according to the position can be used for the residual signal in the merge mode. The transform used for the residual signal in the merge mode can be changed according to the spatial motion vector prediction factor (MVP) candidate for the motion compensation of the current block.

[0704] Table 19 below shows the mapping table between the MVP position and the transform.

[0705] [Table 19]

[0706] MVP position Horizontal transformation 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

[0707] In Table 19, for the left MVP candidate, DST-7 and DCT-2 can be used as the horizontal and vertical transforms, respectively. In addition, for the upper MVP candidate, DCT-2 and DST-7 can be used as the horizontal and vertical transforms, respectively. In other cases, DCT-2 can be used as the default transform. Entropy coding / entropy decoding can be performed on the transform usage information that combines the AMT transform usage information, the primary transform, the non-separable secondary transform (NSST) usage information, and the secondary transform. The usage of AMT and NSST can be represented by a single transform index, rather than signaling the index of the primary transform and the index of the secondary transform independently. The primary transform and the secondary transform can be combined by a transform index for signaling. In addition, the combined transform index can be used for both the luminance component and the chrominance component.

[0708] In addition, the transform used in the specification can be selected from N predefined sets of transform candidates 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 the prediction mode. The selected transform can be signaled as follows. When the coding block flag is 1, a flag indicating whether the first transform in the candidate list is used is sent. When the flag indicating whether the first transform in the candidate list is used is 0, the following steps are applied: when the number of non-zero transform coefficient levels is greater than the threshold, the transform index indicating the used transform candidate is sent; otherwise, the second transform in the list is used.

[0709] In addition, NSST is used only when DCT-2 as the primary transform is used as the default transform. In addition, regarding the horizontal transform or the vertical transform, when the width or the height is equal to or less than 4, respectively, DST-7 is selected without signaling.

[0710] In addition, when the number of non-zero transform coefficients is greater than the threshold, the AMT flag is signaled. In the case of an inter-frame block, the threshold can be set to 2. In the case of an intra-frame block, the threshold can be set to 0. When the number of non-zero transform coefficients is greater than 2, the AMT index is signaled. Otherwise, it is estimated to be 0. In the case of NSST, for a block of the intra-frame luminance component, when the sum of the number of non-zero transform coefficients of the upper-left 8×8 or 4×4 luminance component and the number of non-zero AC coefficients of the upper-left 8×8 or 4×4 chrominance component is greater than 2, the NSST index is signaled.

[0711] 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 transformation 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 transformation instead of DCT-2. Additionally, even if the width or height of the block is equal to or less than K, when the intra prediction mode is the linear model (LM) chrominance mode, DCT-2 is used. Here, K and L can be positive integers, for example, 4. Additionally, K and L can be the same or can have different values. Additionally, the residual block can be a block encoded according to the intra mode. Additionally, the residual block can be a chrominance block.

[0712] Instead of performing a flipping method on the residual signal, a transformed kernel or transformation matrix that has been flipped can be used to perform the transformation / inverse transformation. Here, the transformed / inverse transformed kernel or transformed / inverse transformed matrix that has been flipped can be a kernel or matrix that has undergone flipping and is predefined in the encoder / decoder. In this case, since the transformed / inverse transformed matrix that has been flipped is used to perform the transformation / inverse transformation, the same effect as performing flipping on the residual signal can be obtained. Here, the flipping can be at least one of no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping. In this case, information regarding whether the transformed / inverse transformed matrix that has been flipped is used can be signaled. Additionally, information regarding whether the transformed / inverse transformed matrix that has been flipped is used can be signaled for each of the transformation / inverse transformation in the horizontal direction and the transformation / inverse transformation in the vertical direction.

[0713] Additionally, instead of performing a flipping method on the residual signal, flipping can be performed on the transformation kernel or transformation matrix during the encoding / decoding process to perform the transformation / inverse transformation. In this case, since flipping is performed on the transformation / inverse transformation matrix to perform the transformation / inverse transformation, the same effect as performing flipping on the residual signal can be obtained. Here, the flipping can be at least one of no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping. In this case, information regarding whether flipping has been performed on the transformation / inverse transformation matrix can be signaled. Additionally, information regarding whether flipping has been performed on the transformation / inverse transformation matrix can be signaled for each of the transformation / inverse transformation in the horizontal direction and the transformation / inverse transformation in the vertical direction.

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

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

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

[0717] To reduce memory requirements, a right shift operation can be performed on the transform coefficients generated after performing the transformation by K. In addition, a right shift operation can be performed on the temporary transform coefficients generated after performing the horizontal transformation by K. In addition, a right shift operation can be performed on the temporary transform coefficients generated after performing the vertical transformation by K. Here, K is a positive integer.

[0718] To reduce memory requirements, a right shift operation can be performed on the reconstructed residual signal generated after performing the inverse transformation by K. In addition, a right shift operation can be performed on the temporary transform coefficients generated after performing the horizontal inverse transformation by K. In addition, a right shift operation can be performed on the temporary transform coefficients generated after performing the vertical inverse transformation by K. Here, K is a positive integer.

[0719] At least one of the signals generated before performing the transformation / inverse transformation in the horizontal direction, after performing the transformation / inverse transformation in the horizontal direction, before performing the transformation / inverse transformation in the vertical direction, and after performing the transformation / inverse transformation in the vertical direction can be subjected to at least one of the flipping methods. In this case, the flipping method information used in the transformation / inverse transformation in the horizontal direction or the transformation / inverse transformation in the vertical direction can be signaled.

[0720] In addition, instead of DST-7, DCT-4 can be used. The DCT-4 transform / inverse transform matrix of size 2N-1 is extracted from the DCT-2 transform / inverse transform matrix of size 2N for use, so that only the DCT-2 transform / inverse transform matrix is stored in the encoder / decoder without storing the DCT-4, thereby reducing the memory requirement of the encoder / decoder. In addition, the DCT-4 transform / inverse transform matrix of size 2N-1 is logically utilized from the DCT-2 transform / inverse transform matrix of size 2N, so that the chip area required to implement the encoder / decoder is reduced. Here, the above examples are not only applied to DCT-2 and DCT-4, and the above examples are also applied 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. In addition, in the case of 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. In addition, from one transform / inverse transform matrix, another transform / inverse transform matrix can be extracted according to at least one of a matrix unit, a basic vector unit, and a matrix coefficient unit.

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

[0722] In addition, at least one of the transforms used in the specification, such as DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc., can be replaced by at least one of the transforms calculated based on DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. Here, the calculated transform can be a transform calculated by modifying the coefficient values within the transform matrix of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. In addition, the coefficient values within the transform matrix of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. can have integer values. That is to say, the transforms of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. can be integer transforms. In addition, the coefficient values within the calculated transform matrix can have integer values. That is to say, the calculated transform can be an integer transform. In addition, the calculated transform can be the result of performing a left shift operation on the coefficient values within the transform matrix of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. according to N. Here, N can be a positive integer.

[0723] The DCT-Q and DST-W transforms can represent including the DCT-Q and DST-W transforms and the DCT-Q and DST-W inverse transforms. Here, Q and W can have a positive integer of one or greater, and for example, the numbers 1 to 9 can have the same meaning as the Roman numerals I to IX.

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

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

[0726] In addition, in the specification, the information about the rearrangement method can be the flipping method information.

[0727] In addition, the transform used in the specification may represent at least one of a transform and an inverse transform.

[0728] An encoder may perform a transform on a residual block to generate transform coefficients, quantize the transform coefficients to generate quantized coefficient levels, and perform entropy coding on the quantized coefficient levels to improve the subjective / objective image quality of an image.

[0729] A decoder may perform entropy decoding on the quantized coefficient levels, dequantize the quantized coefficient levels to generate transform coefficients, and perform an inverse transform on the transform coefficients to generate a reconstructed residual block.

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

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

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

[0733] A block may represent an encoding block, a prediction block, or a transform block. For example, a block may be a transform block.

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

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

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

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

[0738] When a block is partitioned into N sub - blocks, the block before partitioning can be an encoded block, and the sub - blocks obtained by partitioning can be at least one of prediction blocks or transform blocks. That is, the prediction of transform coefficients, transform / inverse transform, quantization / anti - quantization, and entropy encoding / entropy decoding can be performed using the size of the sub - blocks obtained by partitioning.

[0739] In addition, when a block is partitioned into N sub - blocks, the block before partitioning can be at least one of an encoded block or a prediction block, and the sub - blocks obtained by partitioning can be transform blocks. That is, prediction can be performed using the size of the block before partitioning, and transform / inverse transform, quantization / anti - quantization, and entropy encoding / entropy decoding of transform coefficients can be performed using the size of the sub - blocks obtained by partitioning.

[0740] Whether to partition a block into multiple sub - blocks can be determined based on at least one of the area of the block (such as the product of width and height), size (width, height, or a combination of width or height), and shape / form (rectangle (non - square), square, etc.).

[0741] For example, when the current block is a 64×64 block, the current block can be partitioned into multiple sub - blocks.

[0742] As another example, when the current block is a 32×32 block, the current block can be partitioned into multiple sub - blocks.

[0743] As another example, when the current block is a 32×16 block, the current block can be partitioned into multiple sub - blocks.

[0744] As another example, when the current block is a 16×32 block, the current block can be partitioned into multiple sub - blocks.

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

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

[0747] As another example, when the area of the current block is equal to or greater than 32, the current block can be partitioned into multiple sub - blocks.

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

[0749] 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 can be partitioned into multiple sub - blocks.

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

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

[0752] For example, the current block can be partitioned into two sub - blocks in the vertical direction.

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

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

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

[0756] When the block is partitioned into N sub - blocks, N can be a positive integer and can be, for example, 2 or 4. In addition, at least one of the area, size, shape, or partitioning direction of the block can be used to determine N.

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

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

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

[0760] As another example, when the current block is a 16×4, 32×4, or 64×4 block, the current block can 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 can be partitioned into two sub - blocks in the horizontal direction.

[0761] As another example, when the current block is a 4×16, 4×32, or 4×64 block, the current block can 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 can be partitioned into two sub - blocks in the vertical direction.

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

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

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

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

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

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

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

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

[0770] In addition, the sub-block can have at least one of a minimum area, a minimum width, or a minimum height.

[0771] For example, the sub-block can have S as the minimum area. Here, S can be a positive integer and can be, for example, 16.

[0772] As another example, the sub-block can have J as the minimum width. Here, J can be a positive integer and can be, for example, 4.

[0773] As another example, the sub-block can have K as the minimum height. Here, K can be a positive integer and can be, for example, 4.

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

[0775] The encoding / decoding order of the sub-blocks partitioned from the block can be determined according to at least one of the partitioning directions.

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

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

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

[0779] At this time, in the block before partitioning, the information on the intra prediction mode for each sub-block can be entropy-coded / entropy-decoded only once.

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

[0781] At this time, in the block before partitioning, the information on the intra block copy mode for each sub-block can be entropy-coded / entropy-decoded only once.

[0782] To indicate a sub-block partitioning mode in which a block is partitioned into N sub-blocks and at least one of prediction, transform / inverse transform, quantization / anti-quantization, or entropy-coding / entropy-decoding is performed on a per-sub-block basis, at least one of the sub-block partitioning mode information or the partitioning direction information can be entropy-coded / entropy-decoded.

[0783] Here, the sub-block partitioning mode information can be used to indicate the sub-block partitioning mode. When it is indicated to use the sub-block partitioning mode (second value), the block can be partitioned into sub-blocks and at least one of prediction, transform / inverse transform, quantization / anti-quantization, or entropy-coding / entropy-decoding can be performed. When it is indicated not to use the sub-block partitioning mode (first value), the block can not be partitioned into sub-blocks and at least one of prediction, transform / inverse transform, quantization / anti-quantization, or entropy-coding / entropy-decoding can be performed. Here, the first value can be 0 and the second value can be 1.

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

[0785] When the current block does not use the closest reference sample line (first reference sample line) as a reference sample line, at least one of the sub-block partitioning mode information or the partitioning direction information may not be entropy-coded / entropy-decoded. At this time, from the sub-block partitioning mode information, it can be inferred that the current block is not partitioned into sub-blocks.

[0786] Here, the current block not using the closest reference sample line (first reference sample line) as a reference sample line can mean that the second reference sample line or a larger reference sample line can be used as a reconstructed reference line around the current block.

[0787] That is, only when the current block uses the closest reference sample line as a reference sample line, at least one of the sub-block partitioning mode information or the partitioning direction information can be entropy-coded / entropy-decoded.

[0788] At least one of the area, size, shape, or partitioning direction of a coefficient group used during entropy encoding / decoding of transform coefficients can be determined based on at least one of the area, size, shape, or partitioning direction of a sub-block.

[0789] For example, when the area of the sub-block is 16, the area of the coefficient group can be determined to be 16.

[0790] As another example, when the area of the sub-block is 32, the area of the coefficient group can be determined to be 16.

[0791] As another example, when the size of the sub-block is 1×16 or 16×1, the size of the coefficient group can be determined to be 1×16 or 16×1.

[0792] As another example, when the size of the sub-block is 2×8 or 8×2, the size of the coefficient group can be determined to be 2×8 or 8×2.

[0793] As another example, when the size of the sub-block is 4×4, the size of the coefficient group can be determined to be 4×4.

[0794] As another example, when the width of the sub-block is 2, the width of the coefficient group can be determined to be 2.

[0795] As another example, when the width of the sub-block is 4, the width of the coefficient group can be determined to be 4.

[0796] As another example, when the height of the sub-block is 2, the height of the coefficient group can be determined to be 2.

[0797] As another example, when the height of the sub-block is 4, the height of the coefficient group can be determined to be 4.

[0798] As another example, when the shape of the sub-block is rectangular (non-square), the shape of the coefficient group can be determined to be rectangular (non-square).

[0799] As another example, when the shape of the sub-block is square, the shape of the coefficient group can be determined to be square.

[0800] As another example, when the size of the sub-block is 16×4 and its shape is rectangular, the size of the coefficient group can be determined to be at least one of 4×4 or 8×2.

[0801] As another example, when the size of the sub-block is 4×8 and its shape is rectangular, the size of the coefficient group can be determined to be at least one of 4×4 or 2×8.

[0802] As another example, when the size of the sub-block is 32×4 and its shape is rectangular, the size of the coefficient group can be determined to be at least one of 4×4 or 8×2.

[0803] As another example, when the size of the sub-block is 8×64 and its shape is rectangular, the size of the coefficient group can be determined as at least one of 4×4 or 2×8.

[0804] As another example, when the size of the sub-block is 16×4 and the partitioning direction is the vertical direction, the size of the coefficient group can be determined as 4×4.

[0805] As another example, when the size of the sub-block is 4×8 and the partitioning direction is the horizontal direction, the size of the coefficient group can be determined as 4×4.

[0806] As another example, when the size of the sub-block is 32×4 and the partitioning direction is the horizontal direction, the size of the coefficient group can be determined as 8×2.

[0807] As another example, when the size of the sub-block is 8×64 and the partitioning direction is the vertical direction, the size of the coefficient group can be determined as 2×8.

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

[0809] For example, the coding block flag can indicate that at least one transform coefficie...

Claims

1. A video decoding method, the method comprises: determining an intra prediction mode of a current block; obtaining a transform skip mode flag indicating whether a transform skip mode is applied to the current block; and based on a reference size and the transform skip mode flag, determining from a bitstream whether to decode index information, the index information indicating whether a secondary inverse transform is applied to the current block, wherein when the value of the index information is greater than 0, the secondary inverse transform is applied to the current block, wherein when the secondary inverse transform is applied to the current block, a secondary transform matrix of the secondary inverse transform is determined based on the index information and the intra prediction mode, wherein when the reference size is greater than a threshold, the index information is decoded from the bitstream, wherein the reference size changes according to whether an intra sub - partition ISP is applied to the current block.

2. The video decoding method according to claim 1, wherein, the secondary transform matrix of the current block is further determined based on a transform matrix set index of the current block and a size of the current block.

3. The video decoding method according to claim 1, comprises: obtaining information on whether an intra - residual Depta pulse - code modulation DPCM method is used for the current block, wherein when the information on whether the intra - residual DPCM method is used indicates that the intra - residual DPCM method is not used for the current block, obtaining the transform skip mode flag from the bitstream, wherein when the information on whether the intra - residual DPCM method is used indicates that the intra - residual DPCM method is used for the current block, not obtaining the transform skip mode flag from the bitstream and determining that the transform skip mode is applied to the current block.

4. The video decoding method according to claim 1, wherein, when predicting the current block according to an intra prediction mode that is not a matrix - based intra prediction mode, obtaining the index information of the secondary transform / inverse transform of the current block.

5. The video decoding method according to claim 1, wherein, obtaining the transform skip mode flag for each color component of the current block, the color components including a luminance component, a Cb component, and a Cr component.

6. The video decoding method according to claim 5, wherein, when the tree structure of the current block is a single - tree type, even if the transform skip mode flag of the luminance component indicates that the transform skip mode is not applied to the luminance component, when at least one of the transform skip mode flag of the Cb component and the transform skip mode flag of the Cr component indicates that the transform skip mode is applied to the corresponding color component, the index information is not decoded from the bitstream.

7. The video decoding method according to claim 5, wherein, when the tree structure of the current block is a dual - tree luminance type and the transform skip mode flag of the luminance component indicates that the transform skip mode is applied to the luminance component, the index information is not decoded from the bitstream.

8. The video decoding method according to claim 5, wherein, When the tree structure of the current block is of the dual-tree chrominance type and at least one of the transform skip mode flag of the Cb component and the transform skip mode flag of the Cr component indicates that the transform skip mode is applied to the corresponding color component, the index information is not decoded from the bitstream.

9. A video coding method, the method comprises: determining an intra prediction mode of a current block; encoding a transform skip mode flag indicating whether the transform skip mode is applied to the current block; determining whether to encode index information into a bitstream based on a reference size and that the transform skip mode is applied to the current block, the index information indicating whether a secondary transform is performed on the current block, wherein when the secondary transform is applied to the current block, the index information is encoded with a value greater than 0, wherein when the secondary transform is applied to the current block, the secondary transform matrix of the secondary transform is determined based on the intra prediction mode of the current block, and the value of the index information is determined based on the secondary transform matrix of the secondary transform, wherein when the reference size is greater than a threshold, the index information is encoded into the bitstream, wherein the reference size changes according to whether an intra sub-partition ISP is applied to the current block.

10. A device for transmitting compressed video data, the device comprises: a processor for obtaining the compressed video data, the compressed video data including a transform skip flag indicating whether the transform skip mode is applied to a current block; and a transmitting unit for transmitting the compressed video data, wherein whether the compressed video data further includes index information is determined based on a reference size and whether the transform skip mode is applied to the current block, the index information indicating whether a secondary transform is performed on the current block, wherein when the secondary transform is applied to the current block, the index information is included in the compressed video data with a value greater than 0, wherein when the secondary transform is applied to the current block, the secondary transform matrix is determined based on the intra prediction mode of the current block, and the value of the index information is set based on the secondary transform matrix of the secondary transform, wherein when the reference size is greater than a threshold, the index information is included in the compressed video data, wherein the reference size changes according to whether an intra sub-partition ISP is applied to the current block.