Image encoding / decoding method and apparatus using secondary transform

By adopting a strategy based on one-dimensional and two-dimensional transformation in video encoding, determining whether secondary transformation is performed, the problem of low high-resolution image coding efficiency is solved, and image quality improvement and cost reduction are achieved.

CN113950830BActive Publication Date: 2025-03-18INTELLECTUAL DISCOVERY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202080040520.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-01-17
Filing Date
2020-06-18
Publication Date
2025-03-18
Estimated Expiration
2040-06-18

AI Technical Summary

Technical Problem

The prior art is difficult to effectively improve the encoding efficiency of high-resolution and high-quality images, resulting in increased transmission and storage costs.

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 set of secondary transformation/inverse transformation and matrix, and then determine whether the secondary transformation/inverse transformation is performed.

Benefits of technology

By optimizing the transformation process, the objective and subjective quality of the image are improved, the amount of data is reduced, thereby reducing transmission and storage costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113950830B_ABST
    Figure CN113950830B_ABST
Patent Text Reader

Abstract

The present disclosure provides a video decoding method, comprising: 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 can be applied to the current block when the transform skip mode can be applied to the current block according to the transform skip mode flag; and a step of obtaining a transform matrix index for a secondary transform / inverse transform applicable to the current block when the transform skip mode can be applied to the current block according to the transform skip mode flag, and a step of determining whether a secondary transform / inverse transform can be applied to the current block according to the transform matrix index.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an image encoding / decoding method and apparatus, as well as a recording medium for storing bitstreams. More specifically, this invention relates to a method and apparatus for encoding / decoding video based on transformation. Background Technology

[0002] Recently, the demand for high-resolution and high-quality images (such as high-definition (HD) or ultra-high-definition (UHD) images) has increased in various applications. As image resolution and quality improve, the amount of data increases accordingly. This is one reason for the increased transmission and storage costs when transmitting image data over existing transmission media (such as wired or wireless broadband channels) or when storing image data. To address these issues related to high-resolution and high-quality image data, efficient image encoding / decoding technologies are needed.

[0003] Various video compression techniques exist, such as inter-frame prediction techniques that predict pixel values ​​in the current frame from pixel values ​​in previous or subsequent frames, intra-frame prediction techniques that predict pixel values ​​in another region of the current frame from pixel values ​​in one region of the current frame, energy transformation and quantization techniques for compressing residual signals, and entropy coding techniques that assign shorter codes to frequently occurring pixel values ​​and longer codes to less frequently occurring pixel values. Summary of the Invention

[0004] Technical issues

[0005] To improve the objective and subjective quality of images, this invention provides a video encoding / decoding method and apparatus that determines at least one of the following based on at least one of one-dimensional transform type, two-dimensional transform combination, and whether a transform is used (still based on intra-frame prediction mode, prediction mode, color components, size, and shape): a reduced set of secondary transform / inverse transform matrices, a reduced set of secondary transform / inverse transform matrices, and whether to perform a reduced set of secondary transform / inverse transform.

[0006] Technical solution

[0007] This disclosure provides a video decoding method, comprising: obtaining a transform skip mode flag indicating whether a transform skip mode is applied to a current block; when a 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 a 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 a secondary transform / inverse transform to the current block based on the transform matrix index.

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

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

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

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

[0012] According to an embodiment, the step of obtaining the transform skip mode flag may include: obtaining 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.

[0013] 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 single tree type, the transform skip mode flag of the luminance component indicates that a transform skip mode is applied to the luminance component, the transform skip mode flag of the Cb component indicates that a transform skip mode is applied to the Cb component, and the transform skip mode flag of the Cr component indicates that a transform skip mode is applied to the Cr component, determining not to apply a secondary transform / inverse transform to the current block.

[0014] According to an embodiment, the step of determining not to apply a secondary transform / inverse transform to the current block may include: determining not to apply a secondary transform / inverse transform to the current block 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 a transform skip mode is applied to the luminance component.

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

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

[0017] This disclosure provides a video coding method, the method comprising: entropy encoding a transform skip mode flag indicating whether a transform skip mode is applied to a current block; when a 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 a 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 the transform matrix index of the secondary transform / inverse transform of the current block according to whether a secondary transform / inverse transform is applied to the current block.

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

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

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

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

[0022] According to an embodiment, the step of entropy encoding the transform skip mode flag may include: entropy encoding 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.

[0023] 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 single tree type, the transform skip mode flag of the luminance component indicates that a transform skip mode is applied to the luminance component, the transform skip mode flag of the Cb component indicates that a transform skip mode is applied to the Cb component, and the transform skip mode flag of the Cr component indicates that a transform skip mode is applied to the Cr component, determining not to apply a secondary transform / inverse transform to the current block.

[0024] According to an embodiment, the step of determining not to apply a secondary transform / inverse transform to the current block may include: determining not to apply a secondary transform / inverse transform to the current block 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 a transform skip mode is applied to the luminance component.

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

[0026] According to an embodiment, whether to apply a secondary transformation / inverse transformation to the current block is determined based on at least one of the transformation matrix index, the size of the current block, and the transformation skip mode flag.

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

[0028] Beneficial effects

[0029] The present invention can improve the objective and subjective quality of an image by providing an image encoding / decoding method and apparatus that determines a reduced set of secondary transform / inverse transform matrices, a reduced set of secondary transform / inverse transform matrices, and whether to perform at least one of the following: a one-dimensional transform type, a two-dimensional transform combination, and whether a transform is used (still based on intra-frame prediction mode, prediction mode, color components, size, and shape). Attached Figure Description

[0030] Figure 1 This is a block diagram illustrating the configuration of an encoding device according to an embodiment of the present invention.

[0031] Figure 2 This is a block diagram illustrating the configuration of a decoding device according to an embodiment of the present invention.

[0032] Figure 3 It is a schematic diagram illustrating the partitioning structure of an image when it is encoded and decoded.

[0033] Figure 4 This is a diagram illustrating intra-frame prediction processing.

[0034] Figure 5 This is a diagram illustrating an embodiment of inter-screen prediction processing.

[0035] Figure 6 This is a diagram illustrating the transformation and quantization processes.

[0036] Figure 7 This is a diagram showing reference samples that can be used for intra-frame prediction.

[0037] Figure 8a This is a diagram showing the fundamental vectors in the frequency domain of DCT-2 according to the present invention.

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

[0039] Figure 9 This is a diagram showing the distribution of the average residual values ​​within the 2N×2N prediction units (PUs) of an 8×8 coding unit (CU) predicted according to the inter-frame pattern, wherein the “Cactus” sequence was obtained through testing in a low-latency P-profile environment.

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

[0041] Figure 11 This is a diagram illustrating 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.

[0042] Figure 12 This is a diagram illustrating the distribution characteristics of the residual signal before and after the rearrangement of the 2N×2N prediction unit (PU) according to the present invention.

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

[0044] Figure 14a and Figure 14b This is a diagram illustrating an embodiment of the transformation unit (TU) partitioning structure of the coding unit (CU) according to the rearrangement method of the prediction unit (PU) pattern and the transformation unit (TU).

[0045] Figure 15 This is a diagram showing the results of performing DCT-2 transformation and SDST transformation based on the distribution of the residual signal of the 2N×2N prediction unit (PU).

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

[0047] Figure 17 This is a diagram illustrating the distribution characteristics of the partitions and residual absolute values ​​of the transform units (TUs) of each prediction unit (PU) partition mode for inter-frame prediction according to the present invention.

[0048] Figure 18 This is a diagram illustrating the residual signal scanning sequence and rearrangement sequence of a transformation unit (TU) at depth 0 within a prediction unit (PU) according to an embodiment of the present invention.

[0049] Figure 19 This is a flowchart illustrating the DCT-2 or SDST selection encoding process according to the present invention, which utilizes Rate Distortion Optimization (RDO).

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

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

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

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

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

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

[0056] Figure 27 This is a diagram illustrating an embodiment of the decoding process in a method that performs a flip after an inverse transformation.

[0057] Figure 28 This is a diagram illustrating an embodiment of the encoding process in a method that performs a flip after a transformation.

[0058] Figure 29 This is a diagram illustrating an embodiment of the decoding process in a method that performs an inverse transformation after flipping.

[0059] Figure 30 This is a diagram illustrating an embodiment of the encoding process in a method that performs a flip after quantization.

[0060] Figure 31 This is a diagram illustrating an embodiment of the decoding process in a method that performs dequantization after inversion.

[0061] Figure 32 This is a diagram showing the flipping of the residual block.

[0062] Figure 33 This is a diagram illustrating an embodiment of a hardware implementation for performing a flip on an 8×8 size residual block.

[0063] Figure 34This is a diagram showing the flipping and transformation performed on the residual block.

[0064] Figures 35 to 37 This is a diagram illustrating an embodiment of the first sub-block partitioning mode according to the present invention.

[0065] Figure 38 This is a diagram illustrating an embodiment of the second sub-block partitioning mode according to the present invention.

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

[0067] Figure 40 This is a diagram illustrating an embodiment of horizontal scanning.

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

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

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

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

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

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

[0074] Figure 47 These are illustrations showing various embodiments of scanning based on the shape of blocks.

[0075] Figure 48 This is a diagram illustrating the intra-frame prediction mode.

[0076] Figures 49 to 53 This is a diagram illustrating an example of encoding or decoding processing using transformations according to an embodiment of the present invention.

[0077] Figure 54 Examples of performing secondary transformations and / or inverse secondary transformations in encoders / decoders are shown.

[0078] Figure 55 An example of a secondary transformation matrix is ​​shown.

[0079] Figure 56 This illustrates the reduced secondary / inverse transformation processing.

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

[0081] Figures 69 to 72 The present invention illustrates the syntax of a bitstream applied to an encoding / decoding method and apparatus using transformations, and a recording medium storing the bitstream.

[0082] Figures 73 to 90 Various embodiments are provided for transmitting the state of the transformation matrix index using signals.

[0083] Figure 91 The present invention illustrates the syntax of a bitstream applied to an encoding / decoding method and apparatus using transformations, and a recording medium storing the bitstream.

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

[0085] Figure 93 A video encoding method according to an embodiment of the present invention is shown. Detailed Implementation

[0086] Optimal mode

[0087] The present invention provides a video decoding method, comprising: obtaining a transform skip mode flag indicating whether a transform skip mode is applied to a current block; when a transform skip mode is applied to the current block according to the transform skip mode flag, determining that a secondary transform / inverse transform is not applied to the current block; and when a 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 a secondary transform / inverse transform to the current block based on the transform matrix index.

[0088] Invention Model

[0089] Various modifications can be made to this invention, and various embodiments of the invention exist, wherein examples of various embodiments of the invention will now be provided and described in detail with reference to the accompanying drawings. However, the invention is not limited thereto, although exemplary embodiments may be interpreted as including all modifications, equivalents, or substitutions within the technical concept and scope of the invention. In various respects, similar reference numerals refer to the same or similar functions. In the drawings, the shape and size of elements may be exaggerated for clarity. In the following detailed description of the invention, reference is made to the accompanying drawings, which illustrate specific embodiments in which the invention may be practiced. These embodiments have been described in sufficient detail to enable those skilled in the art to practice this disclosure. It should be understood that the various embodiments of this disclosure, though different, are not necessarily mutually exclusive. For example, specific features, structures, and characteristics described herein in conjunction with one embodiment may be implemented in other embodiments without departing from the spirit and scope of this disclosure. Furthermore, it should be understood that the position or arrangement of various elements within each disclosed embodiment may be modified without departing from the spirit and scope of this disclosure. Therefore, the following detailed description should not be considered limiting, and the scope of this disclosure is defined only by the appended claims (and, where appropriate, the full scope of the equivalents claimed in the claims).

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

[0091] 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 may be connected to or coupled to another element where there is another element intervening between the element and the other element. Conversely, it should be understood that when an element is referred to as "directly coupled to" or "directly connected to" another element, there is no intermediate element.

[0092] Furthermore, the constituent parts shown in the embodiments of the present invention are illustrated independently to represent different functional characteristics. Therefore, this does not mean that each constituent part is constructed as a separate hardware or software unit. In other words, for convenience, each constituent part includes every one of the listed constituent parts. Thus, at least two constituent parts of each constituent part can be combined to form one constituent part, or a constituent part can be divided into multiple constituent parts to perform each function. Embodiments in which each constituent part is combined and embodiments in which each constituent part is divided are also included within the scope of the present invention without departing from its spirit.

[0093] The terminology used in this specification is for describing particular embodiments only and is not intended to limit the invention. Unless the context clearly distinguishes them, expressions used in the singular include those used in the plural. In this specification, it will be understood that terms such as “comprising,” “having,” etc., are intended to indicate the presence of features, numbers, steps, actions, elements, components, or combinations thereof disclosed in the specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, actions, elements, components, or combinations thereof may be present or added. In other words, when a particular element is referred to as “comprising,” it does not exclude elements other than the corresponding element, but rather includes additional elements that may be included within the embodiments of the invention or within the scope of the invention.

[0094] Furthermore, some components may not be essential for performing the basic functions of the invention, but rather selective components that only improve its performance. The invention can be implemented by including only the essential components necessary for achieving the essence of the invention, excluding components used to improve performance. Structures that include only the essential components and exclude selective components used only to improve performance are also included within the scope of the invention.

[0095] In the following, embodiments of the present invention will be described in detail with reference to the accompanying drawings. In describing exemplary embodiments of the invention, well-known functions or structures will not be described in detail, as they may unnecessarily obscure the understanding of the invention. Like constituent elements in the drawings are indicated by like reference numerals, and repeated descriptions of like elements will be omitted.

[0096] In the following text, an image may refer to a frame that constitutes a video, or it may refer to the video itself. For example, "encoding or decoding an image or both" may refer to "encoding or decoding a moving image or both," and may also refer to "encoding or decoding an image within an image of a moving image or both."

[0097] In the following text, the terms "moving images" and "video" are used to mean the same thing and are interchangeable.

[0098] In the following text, the target image can be an encoded target image that serves as an encoding target and / or a decoded target image that serves as a decoding target. Additionally, the target image can 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.

[0099] In the following text, the terms “image,” “picture,” “frame,” and “screen” may be used as having the same meaning and may be used interchangeably with each other.

[0100] In the following text, a target block can be an encoded target block that serves as the encoding target and / or a decoded target block that serves as the decoding target. Additionally, a target block can be the current block that serves as the target of the current encoding and / or decoding. For example, the terms "target block" and "current block" can be used to mean the same thing and can be used interchangeably.

[0101] In the following text, the terms "block" and "unit" may be used to mean the same thing and may be used interchangeably. Alternatively, "block" may refer to a specific unit.

[0102] In the following text, the terms “region” and “fragment” are used interchangeably.

[0103] In the following text, a specific signal can be a signal representing a specific block. For example, the original signal can be a signal representing the target block. The prediction signal can be a signal representing the prediction block. The residual signal can be a signal representing the residual block.

[0104] In this embodiment, each of the following can have a value: information, data, flags, indexes, elements, and attributes. A value of "0" for information, data, flags, indexes, elements, and attributes can represent logical false or a first predefined value. In other words, the values ​​"0", false, logical false, and the first predefined value can be interchanged. A value of "1" for information, data, flags, indexes, elements, and attributes can represent logical true or a second predefined value. In other words, the values ​​"1", true, logical true, and the second predefined value can be interchanged.

[0105] When variables i or j are used to represent columns, rows, or indices, the value of i can be an integer equal to or greater than 0, or an integer equal to or greater than 1. That is, columns, rows, indices, etc., can be counted starting from 0, or they can be counted starting from 1.

[0106] Terminology Description

[0107] Encoder: Represents the device that performs encoding. That is, it represents the encoding device.

[0108] Decoder: Represents the device that performs decoding. That is, it represents the decoding device.

[0109] A block is an M×N sample array. Here, M and N can represent positive integers, and a block can represent a two-dimensional sample array. A block can refer to a unit. The current block can represent a coding target block that becomes the target during encoding, or a decoding target block that becomes the target during decoding. In addition, the current block can be at least one of a coding block, a prediction block, a residual block, and a transform block.

[0110] Samples are the basic units that make up a block. Based on the bit depth (Bd), samples can be represented as numbers from 0 to 2. Bd The value is -1. In this invention, a sample point can be used to represent a pixel. That is, a sample point, pel, and pixel can have the same meaning.

[0111] Unit: Refers to an encoding and decoding unit. When encoding and decoding an image, a unit can be a region created by partitioning a single image. Alternatively, a unit can represent a sub-partitioning unit when a single image is partitioned into sub-partitioning units during encoding or decoding. 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 smaller than the unit's size. Depending on the function, a unit can represent a block, macroblock, coding tree unit, coding tree block, coding unit, coding block, prediction unit, prediction block, residual unit, residual block, transform unit, transform block, etc. Furthermore, to distinguish a unit from a block, a unit can include a luma component block, a chroma component block associated with the luma component block, and syntax elements for each chroma component block. Units can have various sizes and shapes; specifically, the shape of a unit can be a two-dimensional geometric shape, such as a square, rectangle, trapezoid, triangle, pentagon, etc. In addition, the cell information may include at least one of the following: cell type indicating coding cell, prediction cell, transformation cell, etc., cell size, cell depth, and the order of encoding and decoding of the cell.

[0112] A coding tree unit is a single coding tree block configured with the luminance component Y and two coding tree blocks associated with the chrominance components Cb and Cr. Additionally, a coding tree unit can represent a block and the syntax elements for each block. Each coding tree unit can be partitioned using at least one of quadtree partitioning, binary tree partitioning, and ternary tree partitioning methods to configure lower-level units such as coding units, prediction units, transform units, etc. A coding tree unit can be used as a term to specify a sample block that becomes a processing unit when encoding / decoding an image as an input image. Here, a quadtree can represent a quadtree.

[0113] When the size of the coded block is within a predetermined range, it can be partitioned using only quadtree partitioning. Here, the predetermined range can be defined as at least one of the maximum and minimum sizes of the coded block that can be partitioned using only quadtree partitioning. Information indicating the maximum / minimum size of the coded block that allows quadtree partitioning can be transmitted via a signal in the bitstream, and said information can be transmitted via a signal in at least one unit of sequence, frame parameters, parallel block groups, or stripes (fragments). Optionally, the maximum / minimum size of the coded block can be a predetermined fixed size in the encoder / decoder. For example, when the size of the coded block corresponds to 256×256 to 64×64, it is possible to partition using only quadtree partitioning. Optionally, when the size of the coded block is greater than the size of the maximum transform block, it is possible to partition using only quadtree partitioning. Here, the block to be partitioned can be at least one of a coded block and a transform block. In this case, the information indicating the partitioning of the coded block (e.g., split_flag) can be a flag indicating whether quadtree partitioning is performed. When the size of the coded block falls within a predetermined range, it is possible to partition using only binary or ternary tree partitioning. In this case, the above description of quadtree partitioning can be applied in the same way to binary tree partitioning or ternary tree partitioning.

[0114] Encoding block: Can be used as a term to specify any one of the Y encoding block, Cb encoding block, and Cr encoding block.

[0115] Neighboring blocks: These can represent blocks adjacent to the current block. A block adjacent to the current block can be 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 also represent a block adjacent to a vertex of the current block. Here, a block adjacent to a vertex of the current block can be a block that is vertically adjacent to a block horizontally adjacent to the current block, or a block that is horizontally adjacent to a block vertically adjacent to the current block.

[0116] Reconstructing neighboring blocks: This can represent neighboring blocks that are adjacent to the current block and have already been spatially / temporally encoded or decoded. Here, reconstructing neighboring blocks can represent reconstructing neighboring units. Reconstructing spatial neighboring blocks can be blocks within the current frame that have already been reconstructed through encoding or decoding, or both. Reconstructing temporal neighboring blocks are blocks within a reference image that are located at the position corresponding to the current block in the current frame, or are neighboring blocks of said block.

[0117] Cell depth: Represents the degree of cell partitioning. In a tree structure, the highest node (root node) corresponds to the first cell 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 represents a cell created by partitioning the first cell once. A node with a depth of level 2 represents a cell created by partitioning the first cell twice. A node with a depth of level n represents a cell created by partitioning the first cell n times. Leaf nodes can be the lowest-level nodes and cannot be further partitioned. The depth of a leaf node can be the highest-level. For example, the predefined value for the highest-level can be 3. The root node can have the lowest depth, and the leaf nodes can have the deepest depth. Furthermore, when cells are represented as a tree structure, the level in which the cell exists can represent the cell depth.

[0118] Bitstream: A bitstream that can represent encoded image information.

[0119] Parameter set: Corresponds to the header information in the configuration within the bitstream. At least one of the video parameter set, sequence parameter set, picture parameter set, and adaptive parameter set may be included in the parameter set. Furthermore, the parameter set may include a slice header, a tile group header, and tile header information. The term "tile group" refers to a set of parallel tiles and has the same meaning as a slice.

[0120] An adaptive parameter set can represent a set of parameters that can be shared by referencing different frames, subframes, stripes, parallel block groups, parallel blocks, or segments. Furthermore, information in an adaptive parameter set can be used by referencing different adaptive parameter sets used for subframes, stripes, parallel block groups, parallel blocks, or segments within a frame.

[0121] Additionally, regarding adaptive parameter sets, different adaptive parameter sets can be referenced by using identifiers for different adaptive parameter sets used within a frame, such as sub-frames, stripes, parallel block groups, parallel blocks, or chunks.

[0122] Additionally, regarding adaptive parameter sets, different adaptive parameter sets can be referenced by using identifiers for different adaptive parameter sets used within a sub-screen, such as stripes, parallel block groups, parallel blocks, or chunks.

[0123] Additionally, regarding adaptive parameter sets, different adaptive parameter sets can be referenced by using identifiers for different adaptive parameter sets used within a stripe for parallel blocks or partitions.

[0124] Additionally, regarding adaptive parameter sets, different adaptive parameter sets can be referenced by using identifiers for different adaptive parameter sets used for partitions within a parallel block.

[0125] Information about the adaptive parameter set identifier can be included in the parameter set or header of the sub-screen, and the adaptive parameter set corresponding to the adaptive parameter set identifier can be used in the sub-screen.

[0126] Information about the adaptive parameter set identifier can be included in the parameter set or header of the parallel block, and the adaptive parameter set corresponding to the adaptive parameter set identifier can be used in the parallel block.

[0127] Information about the adaptive parameter set identifier can be included in the header of the chunk, and the adaptive parameter set corresponding to the adaptive parameter set identifier can be used for chunking.

[0128] The screen can be divided into one or more parallel block rows and one or more parallel block columns.

[0129] A sub-screen can be divided into one or more parallel block rows and one or more parallel block columns within a screen. A sub-screen can be a rectangular / square region within a screen and may include one or more CTUs. Additionally, at least one or more parallel blocks / strips / strips may be included within a sub-screen.

[0130] A parallel block can be a rectangular / square region within the frame and may include one or more CTUs. Additionally, a parallel block can be divided into one or more sub-blocks.

[0131] A block can represent one or more CTU lines within a parallel block. A parallel block can be partitioned into one or more blocks, and each block can have at least one or more CTU lines. A parallel block that is not partitioned into two or more blocks can be represented as a block.

[0132] A strip may include one or more parallel blocks within a frame, and may include one or more sub-blocks within a parallel block.

[0133] Explanation: This could mean determining the value of a syntax element by performing entropy decoding, or it could mean entropy decoding itself.

[0134] Symbols: can represent at least one of the syntax elements, encoding parameters, and transform coefficient values ​​of the encoding / decoding target unit. Additionally, symbols can represent entropy encoding targets or entropy decoding results.

[0135] Prediction mode: This can be information indicating the mode that is encoded / decoded using intra-frame prediction or the mode that is encoded / decoded using inter-frame prediction.

[0136] Prediction Unit: A basic unit that can be represented when performing prediction (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 it can be partitioned into multiple lower-level prediction units. Multiple partitions can be the basic units when performing prediction or compensation. Partitions created by dividing prediction units can also be prediction units.

[0137] Prediction cell partitioning: can represent the shape obtained by partitioning prediction cells.

[0138] A reference frame list can refer to a list of one or more reference frames used for inter-frame prediction or motion compensation. There are several types of available reference frame lists, including LC (list combination), L0 (list 0), L1 (list 1), L2 (list 2), and L3 (list 3).

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

[0140] The prediction list utilization flag indicates whether at least one reference frame from a specific reference frame list is used to generate a prediction block. The prediction list utilization flag can be used to derive an 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 a reference frame from the reference frame list is not used to generate a prediction block. On the other hand, when the prediction list utilization flag has a second value of one (1), it indicates that the reference frame list is used to generate a prediction block.

[0141] A reference screen index can refer to the index of a specific reference screen in a list of reference screens.

[0142] A reference frame can refer to a frame referenced by a specific block for the purpose of inter-frame prediction or motion compensation for that specific block. Alternatively, a reference frame can be a frame that includes a reference block referenced by the current block for inter-frame prediction or motion compensation. In the following text, the terms "reference frame" and "reference image" have the same meaning and can be used interchangeably.

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

[0144] The search range can be a two-dimensional region searched during inter-frame prediction to retrieve motion vectors. For example, the size of the search range can be M×N. Here, M and N are both integers.

[0145] Motion vector candidates can refer to a block of prediction candidates or the motion vectors within a block of prediction candidates when making predictions about motion vectors. Additionally, motion vector candidates can be included in a list of motion vector candidates.

[0146] A motion vector candidate list can represent a list consisting of one or more motion vector candidates.

[0147] A motion vector candidate index can represent an indicator that points to a motion vector candidate in the motion vector candidate list. Alternatively, it can be an index of a motion vector predictor.

[0148] Motion information may represent information including at least one of motion vectors, reference frame indexes, inter-frame prediction indicators, prediction list utilization flags, reference frame list information, reference frames, motion vector candidates, motion vector candidate indices, merge candidates, and merge indices.

[0149] A merge candidate list can represent a list consisting of one or more merge candidates.

[0150] Merge candidates can represent spatial merge candidates, temporal merge candidates, combined merge candidates, combined double prediction merge candidates, or zero merge candidates. Merge candidates may include motion information such as inter-frame prediction indicators, reference frame indices for each list, motion vectors, prediction list utilization flags, and inter-frame prediction indicators.

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

[0152] Transform unit: This can represent the basic unit used when performing encoding / decoding (such as transform, inverse transform, quantization, dequantization, transform coefficient encoding / decoding) on ​​the residual signal. A single transform unit can be partitioned into multiple lower-level transform units with smaller sizes. Here, the transform / inverse transform can include at least one of primary transform / primary inverse transform and secondary transform / secondary inverse transform.

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

[0154] Quantization parameters: These represent values ​​used when transform coefficients are used to generate quantization levels during quantization. Quantization parameters can also represent values ​​used when transform coefficients are generated by scaling the quantization levels during dequantization. Quantization parameters can be values ​​mapped to the quantization step size.

[0155] Incremental quantization parameter: can represent the difference between the predicted quantization parameter and the quantization parameter of the encoding / decoding target unit.

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

[0157] Transform coefficients: These represent the coefficient values ​​produced after a transform is performed in the encoder. Transform coefficients can also represent the coefficient values ​​produced after at least one of entropy decoding and dequantization is performed in the decoder. The quantization level, or the level of the quantized transform coefficients, obtained by quantizing the transform coefficients or residual signal, can also fall within the meaning of transform coefficients.

[0158] Quantization level: This can represent the value produced in the encoder by quantizing the transform coefficients or residual signal. Optionally, the quantization level can represent the value of the dequantization target that undergoes dequantization in the decoder. Similarly, the transform coefficient level, as a result of transform and quantization, can also fall within the meaning of quantization level.

[0159] Non-zero transform coefficients: can represent transform coefficients with values ​​other than zero, or transform coefficient levels or quantization levels with values ​​other than zero.

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

[0161] Quantization matrix coefficients: These represent each element within the quantization matrix. Quantization matrix coefficients can also be called matrix coefficients.

[0162] Default matrix: can represent a predefined quantization matrix in the encoder or decoder.

[0163] Non-default matrix: can represent a quantization matrix that is not predefined in the encoder or decoder but is sent by the user via signal.

[0164] Statistical value: For at least one of the following variables, coding parameters, constant values, etc., that have a computable specific value, a statistical value can be one or more of the following: mean, summation, weighted average, weighted sum, minimum, maximum, most frequent value, median, interpolation.

[0165] Figure 1 This is a block diagram illustrating the configuration of an encoding device according to an embodiment of the present invention.

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

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

[0168] Encoding device 100 can encode the input image using intra-frame mode, inter-frame mode, or both. Furthermore, encoding device 100 can generate a bitstream including encoded information by encoding the input image and output the generated bitstream. The generated bitstream can be stored in a computer-readable recording medium or streamed via a wired / wireless transmission medium. When intra-frame mode is used as the prediction mode, switcher 115 can switch to intra-frame mode. Optionally, when inter-frame mode is used as the prediction mode, switcher 115 can switch to inter-frame mode. Here, intra-frame mode can refer to intra-frame prediction mode, and inter-frame mode can refer to inter-frame prediction mode. Encoding device 100 can generate prediction blocks for input blocks of the input image. Furthermore, encoding device 100 can encode residual blocks using the residual between the input block and the prediction block after generating the prediction blocks. The input image can be referred to as the current image as the current encoding target. The input block can be referred to as the current block as the current encoding target, or as the encoding target block.

[0169] When the prediction mode is intra-frame mode, the intra-frame prediction unit 120 can use samples from blocks that have been encoded / decoded and are adjacent to the current block as reference samples. The intra-frame prediction unit 120 can perform spatial prediction on the current block using the reference samples, or generate prediction samples for the input block by performing spatial prediction. Here, intra-frame prediction can refer to prediction within a frame.

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

[0171] The motion compensation unit 112 can generate a prediction block by performing motion compensation on the current block using motion vectors. Here, inter-frame prediction can refer to prediction or motion compensation between frames.

[0172] When the value of the motion vector is not an integer, the motion prediction unit 111 and the motion compensation unit 112 can generate prediction blocks by applying an interpolation filter to a portion of the reference frame. To perform inter-frame prediction or motion compensation on the coding unit, it can be determined which of the following modes—skip mode, merge mode, Advanced Motion Vector Prediction (AMVP) mode, and current frame reference mode—is used for motion prediction and motion compensation on the prediction unit included in the corresponding coding unit. Then, depending on the determined mode, inter-frame prediction or motion compensation can be performed differently.

[0173] Subtractor 125 can generate a residual block by using the difference between the input block and the prediction block. The residual block can be referred to as a residual signal. The residual signal can represent the difference between the original signal and the prediction signal. Furthermore, the residual signal can be a signal generated by transforming or quantizing, or transforming and quantizing, the difference between the original signal and the prediction signal. The residual block can be the residual signal of a block cell.

[0174] Transform unit 130 can generate transform coefficients by performing a transform on the residual block and output the generated transform coefficients. Here, the transform coefficients can be coefficient values ​​generated by performing a transform on the residual block. When a transform skip mode is applied, transform unit 130 can skip the transform on the residual block.

[0175] The level of quantization can be generated by applying quantization to the transform coefficients or to the residual signal. In the following examples, the level of quantization may also be referred to as the transform coefficients.

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

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

[0178] When entropy coding is applied, symbols are represented such that fewer bits are allocated to symbols with a high probability of generation, and more bits are allocated to symbols with a low probability of generation. Therefore, the size of the bitstream used to encode the symbols can be reduced. The entropy coding unit 150 can use coding methods for entropy coding, such as Exponential Golomb, Context Adaptive Variable Length Coding (CAVLC), and Context Adaptive Binary Arithmetic Coding (CABAC). For example, the entropy coding unit 150 can perform entropy coding by using a variable-length code (VLC) table. Furthermore, the entropy coding unit 150 can derive a binarization method for the target symbol and a probability model for the target symbol / bits, and perform arithmetic coding by using the derived binarization method, probability model, and context model.

[0179] In order to encode the transform coefficient levels (quantization levels), the entropy coding unit 150 can convert the coefficients in two-dimensional block form into one-dimensional vector form by using a transform coefficient scanning method.

[0180] Encoding parameters may include information such as syntax elements (flags, indices, etc.) encoded in the encoder and signaled to the decoder, as well as information derived during encoding or decoding. Encoding parameters can represent the information required when encoding or decoding an image. For example, at least one value or combination of the following may be included in the encoding parameters: cell / block size, cell / block depth, cell / block partitioning information, cell / block shape, cell / block partitioning structure, whether quadtree partitioning is performed, whether binary tree partitioning is performed, binary tree partitioning direction (horizontal or vertical), binary tree partitioning type (symmetric or asymmetric), whether the current encoded unit is partitioned via ternary tree partitioning, the direction of the ternary tree partitioning (horizontal or vertical), the type of ternary tree partitioning (symmetric or asymmetric), whether the current encoded unit is partitioned via multi-type tree partitioning, and the type of multi-type tree partitioning. Direction (horizontal or vertical), type of multi-type tree partition (symmetric or asymmetric), tree structure of multi-type tree partition (binary or ternary), prediction mode (intra-frame prediction or inter-frame prediction), luma intra-frame prediction mode / direction, chroma intra-frame prediction mode / direction, intra-frame partition information, inter-frame partition information, coded block partition flag, prediction block partition flag, transform block partition flag, reference sample filtering method, reference sample filter taps, reference sample filter coefficients, prediction block filtering method, prediction block filter taps, prediction block filter coefficients, prediction block boundary filtering method, prediction block boundary filter taps, prediction block boundary filter coefficients, intra-frame prediction mode Inter-frame prediction mode, motion information, motion vector, motion vector difference, reference frame index, inter-frame prediction angle, inter-frame prediction indicator, prediction list utilization flag, reference frame list, reference frame, motion vector predictor index, motion vector predictor candidate, motion vector candidate list, whether to use merge mode, merge index, merge candidate, merge candidate list, whether to use skip mode, interpolation filter type, interpolation filter taps, interpolation filter coefficients, motion vector magnitude, motion vector representation accuracy, 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 the existence of residual signals, code block style, code block flag (CBF), quantization parameters, quantization parameter residuals, quantization matrix, whether an intra-loop filter is applied, intra-loop filter coefficients, intra-loop filter taps, intra-loop filter shape / form, whether a deblocking filter is applied, deblocking filter coefficients, deblocking filter taps, deblocking filter strength, deblocking filter shape / form, whether adaptive sample offset is applied, adaptive sample offset values, adaptive sample offset type, adaptive sample offset function, whether an adaptive intra-loop filter is applied, 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 normal mode, whether to execute bypass mode, context binary bits, bypass binary bits, valid coefficient flag, last valid coefficient flag, encoding flag for the unit of the coefficient group, position of the last valid coefficient, flag indicating whether the coefficient value is greater than 1, flag indicating whether the coefficient value is greater than 2, flag indicating whether the coefficient value is greater than 3, information about the remaining coefficient values, symbol information, reconstructed luminance samples, reconstructed chrominance samples, residual luminance samples, residual chrominance samples, luminance transformation coefficient, chrominance transformation coefficient, quantized luminance level, quantized chrominance level, transformation coefficient level scanning method, motion vector search area on the decoder side. The data includes the domain size, the shape of the motion vector search area on the decoder side, the number of motion vector searches on the decoder side, information about the CTU size, information about the minimum block size, information about the maximum block size, information about the maximum block depth, information about the minimum block depth, image display / output order, stripe identification information, stripe type, stripe 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, image type, bit depth of input samples, bit depth of reconstructed samples, bit depth of residual samples, bit depth of transform coefficients, bit depth of quantization levels, and information about the luminance signal or the chrominance signal.

[0181] Here, sending a flag or index with a signal can represent the encoder entropy encoding the corresponding flag or index and including it in the bitstream, and can also represent the decoder entropy decoding the corresponding flag or index from the bitstream.

[0182] When the encoding device 100 performs encoding via inter-frame 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 frame buffer 190.

[0183] The quantization level can be dequantized in dequantization unit 160 or inverse transformed in inverse transform unit 170. The coefficients that have undergone dequantization or inverse transform, or both, can be added to the prediction block by adder 175. A reconstructed block can be generated by adding the coefficients that have undergone dequantization or inverse transform, or both, to the prediction block. Here, the coefficients that have undergone dequantization or inverse transform, or both, can represent coefficients for which at least one of dequantization and inverse transform has been performed, and can represent the reconstructed residual block.

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

[0185] Deblocking filters remove block distortion that occurs at the boundaries between blocks. To determine whether to apply a deblocking filter, the number of samples included in several rows or columns within the block can be used. When applying a deblocking filter to a block, different filters can be applied depending on the desired deblocking intensity.

[0186] To compensate for coding errors, a suitable offset value can be added to the sample value using a sample-adaptive offset. The sample-adaptive offset corrects the offset between the deblocked image and the original image on a sample-by-sample basis. This can be achieved by considering edge information about each sample point when applying the offset, or by dividing the image's samples into a predetermined number of regions, determining the regions where the offset will be applied, and then applying the offset to those regions.

[0187] The adaptive in-loop filter (ALF) performs filtering based on a comparison between the filtered reconstructed image and the original image. 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 regarding whether to apply the ALF can be transmitted via a signal through the coding unit (CU), and the form and coefficients of the ALF to be applied to each block can vary.

[0188] The reconstructed blocks or reconstructed image that have passed through filter unit 180 can be stored in reference frame buffer 190. The reconstructed blocks processed by filter unit 180 can be a portion of the reference image. That is, the reference image is a reconstructed image composed of the reconstructed blocks processed by filter unit 180. The stored reference image can be used later in inter-frame prediction or motion compensation.

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

[0190] Decoding device 200 can be a decoder, video decoding device, or image decoding device.

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

[0192] Decoding device 200 can receive bitstreams output from encoding device 100. Decoding device 200 can receive bitstreams stored on a computer-readable recording medium, or bitstreams streamed via wired / wireless transmission media. Decoding device 200 can decode the bitstreams using intra-frame mode or inter-frame mode. Furthermore, decoding device 200 can generate and output reconstructed or decoded images produced by decoding.

[0193] When the prediction mode used during decoding is intra-frame mode, the switcher can be switched to intra-frame mode. Optionally, when the prediction mode used during decoding is inter-frame mode, the switcher can be switched to inter-frame mode.

[0194] Decoding device 200 can obtain a reconstructed residual block and generate a prediction block by decoding the input bitstream. When the reconstructed residual block and the prediction block are obtained, decoding device 200 can generate a reconstructed block that becomes the decoding target by adding the reconstructed residual block and the prediction block. The decoding target block can be referred to as the current block.

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

[0196] In order to decode the transform coefficient levels (quantization levels), the entropy decoding unit 210 can convert the coefficients in unidirectional vector form into two-dimensional block form by using the transform coefficient scanning method.

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

[0198] When using intra-frame mode, intra-frame prediction unit 240 can generate a prediction block by performing spatial prediction on the current block, wherein the spatial prediction uses sample values ​​of blocks that are adjacent to the target block and have already been decoded.

[0199] When using inter-frame mode, motion compensation unit 250 can generate a prediction block by performing motion compensation on the current block, wherein the motion compensation uses motion vectors and a reference image stored in reference frame buffer 270.

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

[0201] Figure 3 It is a schematic diagram illustrating the partitioning structure of an image when it is encoded and decoded. Figure 3 An example of dividing a single cell into multiple sub-cells is illustrated schematically.

[0202] To effectively partition an image, coding units (CUs) are used during encoding and decoding. A coding unit can serve as the basic unit when encoding / decoding an image. Furthermore, a coding unit can be used to distinguish between intra-frame prediction modes and inter-frame prediction modes during image encoding / decoding. A coding unit can be the basic unit used for prediction, transform, quantization, inverse transform, inverse quantization, or encoding / decoding processing of transform coefficients.

[0203] Reference Figure 3 Image 300 is partitioned sequentially according to the Maximum Coding Unit (LCU), and the LCU unit is determined as the partition structure. Here, LCU can be used with the same meaning as Coding Tree Unit (CTU). Unit partitioning can represent partitioning of the block associated with that unit. The block partitioning information may include information about the unit depth. The depth information may represent the number or extent to which the unit is partitioned, or both the number and extent 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 may correspond to a node and the child nodes of that node, respectively. Each of the partitioned lower-level units may have depth information. The depth information may be information representing the size of the CU and may be stored in each CU. The unit depth represents the number and / or extent associated with partitioning the unit. Therefore, the partitioning information of the lower-level units may include information about the size of the lower-level units.

[0204] The partitioning structure represents the distribution of coding units (CUs) within the LCU 310. This distribution can be determined by whether a single CU is partitioned into multiple CUs (positive integers equal to or greater than 2, including 2, 4, 8, 16, etc.). The horizontal and vertical dimensions of the CUs resulting from partitioning can be half the horizontal and vertical dimensions of the CUs before partitioning, respectively, or they can have dimensions smaller than the horizontal and vertical dimensions before partitioning, depending on the number of partitions performed. CUs can be recursively partitioned into multiple CUs. Through recursive partitioning, at least one of the height and width of the CU after partitioning can be reduced compared to at least one of the height and width of the CU before partitioning. CU partitioning can be performed recursively until a predefined depth or a predefined size is reached. For example, the depth of the LCU can be 0, and the depth of the minimum coding unit (SCU) can be a predefined maximum depth. Here, as mentioned above, the LCU can be a coding unit with the maximum coding unit size, and the SCU can be a coding unit with the minimum coding unit size. Partitioning begins at LCU 310. The CU depth increases by 1 when the horizontal or vertical dimension of a CU, or both, are reduced through partitioning. For example, for each depth, the size of an unpartitioned CU can be 2N × 2N. Furthermore, in the case of partitioned CUs, a CU of size 2N × 2N can be partitioned into four CUs of size N × N. As the depth increases by 1, the size of N can be halved.

[0205] Additionally, partition information of a CU can be used to indicate whether a CU is partitioned. Partition information can be 1 bit. All CUs except SCUs can include partition information. For example, when the partition information value is the first value, the CU may not be partitioned; when the partition information value is the second value, the CU may be partitioned.

[0206] Reference Figure 3 An LCU with depth 0 can be a 64×64 block. 0 can be the minimum depth. An SCU with depth 3 can be an 8×8 block. 3 can be the maximum depth. CUs with 32×32 blocks and 16×16 blocks can be represented as depth 1 and depth 2, respectively.

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

[0208] For example, when a coding unit is partitioned into two sub-coding units, the horizontal or vertical dimension (width or height) of each of the two sub-coding units can be half the horizontal or vertical dimension 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, it can be said that the coding unit is binary partitioned or partitioned according to a binary tree partitioning structure.

[0209] For example, when a coding unit is divided into three sub-coding units, the horizontal or vertical dimensions of the coding unit can be divided in a 1:2:1 ratio, resulting in three sub-coding units with a horizontal or vertical dimension ratio of 1:2:1. For instance, when a 16×32 coding unit is horizontally divided into three sub-coding units, these three sub-coding units, in order from the top to the bottom, can have dimensions of 16×8, 16×16, and 16×8, respectively. Similarly, when a 32×32 coding unit is vertically divided into three sub-coding units, these three sub-coding units, in order from the left to the right, can have dimensions of 8×32, 16×32, and 8×32, respectively. When a coding unit is divided into three sub-coding units, it can be said that the coding unit is tri-partitioned or partitioned according to a ternary tree partitioning structure.

[0210] exist Figure 3 In this context, the coding tree unit (CTU) 320 is an example of a CTU in which quadtree partitioning, binary tree partitioning, and ternary tree partitioning structures are all applied.

[0211] As described above, to partition the 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 applied sequentially to the CTU according to a predetermined priority order. For example, a quadtree partitioning structure can be preferentially applied to the CTU. Encoding units that cannot be further partitioned using a quadtree partitioning structure can correspond to leaf nodes of a quadtree. Encoding units corresponding to leaf nodes of a quadtree can be used as root nodes of binary and / or ternary tree partitioning structures. That is, encoding units corresponding to leaf nodes of a quadtree can be further partitioned according to a binary or ternary tree partitioning structure, or they can be left unpartitioned. Therefore, by preventing encoding units obtained from binary or ternary tree partitioning of encoding units corresponding to leaf nodes of a quadtree from undergoing further quadtree partitioning, block partitioning operations and / or the operation of signaling partitioning information can be effectively performed.

[0212] The fact that a coding unit corresponding to a node in a quadtree is partitioned can be signaled using four-partition information. Four-partition information with a first value (e.g., "1") indicates that the current coding unit is partitioned according to the quadtree partitioning structure. Four-partition information with a second value (e.g., "0") indicates that the current coding unit is not partitioned according to the quadtree partitioning structure. The four-partition information can be a flag with a predetermined length (e.g., one bit).

[0213] There may be no priority between binary tree partitions and ternary tree partitions. That is, the coding unit corresponding to the leaf node of the quadtree can further undergo any partition in either binary tree partitions or ternary tree partitions. In addition, the coding unit generated by binary tree partitions or ternary tree partitions may undergo further binary tree partitions or further ternary tree partitions, or it may not be further partitioned.

[0214] A tree structure in which there is no priority between binary tree partitions and ternary tree partitions is called a multi-type tree structure. The coding unit corresponding to the leaf node of a quadtree can be used as the 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 the coding unit corresponding to a node in the multi-type tree. To partition the coding unit corresponding to a node in the multi-type tree, the multi-type tree partition indication information, partition direction information, and partition tree information can be signaled sequentially.

[0215] A multi-type tree partitioning indication with a first value (e.g., "1") indicates that the current coding unit will undergo a multi-type tree partition. A multi-type tree partitioning indication with a second value (e.g., "0") indicates that the current coding unit will not undergo a multi-type tree partition.

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

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

[0218] Partition indication information, partition tree information, and partition direction information can all be flags with a predetermined length (e.g., one bit).

[0219] At least one of the following—quadtree partitioning indication information, multi-type tree partitioning indication information, partitioning direction information, and partitioning tree information—can be entropy encoded / decoded. To entropy encode / decode those types of information, information about neighboring coding units adjacent to the current coding unit can be used. For example, it is highly likely that the partitioning type (partitioned or unpartitioned, partitioning tree, and / or partitioning direction) of the left-hand neighboring coding unit and / or above-hand neighboring coding unit is similar to the partitioning type of the current coding unit. Therefore, contextual information for entropy encoding / decoding of information about the current coding unit can be derived from the information about neighboring coding units. Information about neighboring coding units may include at least one of the following: quadtree partitioning information, multi-type tree partitioning indication information, partitioning direction information, and partitioning tree information.

[0220] As another example, in binary tree partitioning and ternary tree partitioning, binary tree partitioning can be performed first. That is, the current coding unit can first undergo binary tree partitioning, and then the coding unit corresponding to the leaf node of the binary tree can 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 can be performed.

[0221] Encoding units that cannot be partitioned according to quadtree, binary tree, and / or ternary tree partitioning structures become the basic units for encoding, prediction, and / or transformation. That is, the encoding units cannot be further partitioned for prediction and / or transformation. Therefore, partitioning structure information and partitioning information for dividing encoding units into prediction and / or transformation units may not exist in the bitstream.

[0222] However, when the size of the coding unit (i.e., the basic unit used for partitioning) is larger than the size of the maximum transform block, the coding unit can be partitioned recursively until the size of the coding unit is reduced to be equal to or smaller than the size of the maximum transform block. For example, when the size of the coding unit is 64×64 and the size of the maximum transform block is 32×32, the coding unit 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 partitions of the coding unit for transformation are not sent separately by signal, and the partitions of the coding unit for transformation can be determined by comparing the horizontal or vertical dimensions of the coding unit with the horizontal or vertical dimensions of the maximum transform block. For example, when the horizontal dimension (width) of the coding unit is greater than the horizontal dimension (width) of the maximum transform block, the coding unit can be vertically bisected. For example, when the vertical dimension (height) of the coding unit is greater than the vertical dimension (height) of the maximum transform block, the coding unit can be horizontally bisected.

[0223] Information regarding the maximum and / or minimum size of the coding unit and the maximum and / or minimum size of the transform block can be transmitted or determined by signals at the higher level of the coding unit. The higher level can be, for example, the sequence level, frame level, stripe 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.

[0224] Information regarding the minimum size of the coding unit corresponding to the leaf node of the quadtree (minimum size of the quadtree) and / or the maximum depth from the root node to the leaf node of the multi-type tree (maximum depth of the multi-type tree) can be sent or determined by signals at the higher level of the coding unit. For example, the higher level can be a sequence level, frame level, stripe level, parallel block group level, parallel block level, etc. The minimum size of the quadtree and / or the maximum depth of the multi-type tree can be sent or determined by signals for each of the intra-frame stripes and inter-frame stripes.

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

[0226] As another example, the maximum size of a binary tree and / or the maximum size of a ternary tree can be signaled or determined at the stripe level. Alternatively, the minimum size of a binary tree and / or the minimum size of a ternary tree can be signaled or determined at the stripe level.

[0227] Based on the size and depth information of the various blocks mentioned above, the four-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.

[0228] For example, when the size of the coding unit is no greater than the minimum size of the quadtree, the coding unit does not include four-partition information. Therefore, the four-partition information can be inferred as the second value.

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

[0230] Optionally, when the size (horizontal and vertical dimensions) of the coding unit corresponding to a node of a multi-type tree is the same as the maximum size (horizontal and vertical dimensions) of a binary tree and / or twice the maximum size (horizontal and vertical dimensions) of a ternary tree, the coding unit may not be further divided into two or three partitions. Therefore, multi-type tree partitioning indication information can be inferred as a second value instead of being sent as a signal. This is because when coding units are partitioned 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 a ternary tree are generated.

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

[0232] - N×M (N and / or M are 128) ternary tree partitions for encoding units

[0233] - 128×N (N<=64) binary tree partitioning for the horizontal direction of the encoding unit

[0234] - N×128 (N<=64) binary tree partitions used in the vertical direction of the encoding unit

[0235] Optionally, when the depth of the coding unit corresponding to a node in the multi-type tree is equal to the maximum depth of the multi-type tree, the coding unit may not be further divided into two and / or three partitions. Therefore, multi-type tree partition indication information may not be sent by signal, but the multi-type tree partition indication information can be inferred as a second value.

[0236] Optionally, multi-type tree partitioning indication information may be signaled only if 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 the coding unit corresponding to the node of the multi-type tree. Otherwise, the coding unit may not be partitioned into two and / or three partitions. Therefore, multi-type tree partitioning indication information may not be signaled, but the multi-type tree partitioning indication information may be inferred as a second value.

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

[0238] Optionally, partition tree information may be signaled only if both vertical binary tree partitions and vertical ternary tree partitions, or both horizontal binary tree partitions and horizontal ternary tree partitions, are possible for encoding trees corresponding to nodes of multiple tree types. Otherwise, partition tree information may not be signaled, but rather inferred as values ​​indicating possible partition tree structures.

[0239] Figure 4 This is a diagram illustrating intra-frame prediction processing.

[0240] Figure 4 The arrows from the center outwards indicate the prediction direction of the intra-frame prediction mode.

[0241] Intra-frame coding and / or decoding can be performed using reference samples from neighboring blocks of the current block. A neighboring block can be a reconstructed neighboring block. For example, intra-frame coding and / or decoding can be performed using values ​​of reference samples or coding parameters included in the reconstructed neighboring block.

[0242] A prediction block can represent a block generated by performing intra-frame prediction. A prediction block can correspond to at least one of CU, PU, ​​and TU. The cells of a prediction block can have the size of one of CU, PU, ​​and TU. A prediction block can be a square block with dimensions such as 2×2, 4×4, 16×16, 32×32, or 64×64, or a rectangular block with dimensions such as 2×8, 4×8, 2×16, 4×16, and 8×16.

[0243] Intra-prediction can be performed based on the intra-prediction mode for the current block. The number of intra-prediction modes that the current block can have can be a fixed value, or it can be a value determined differently depending on the attributes of the predicted block. For example, the attributes of the predicted block can include the size and shape of the predicted block.

[0244] Regardless of the block size, the number of intra-prediction modes can be fixed at N. Alternatively, the number of intra-prediction modes can be 3, 5, 9, 17, 34, 35, 36, 65, or 67, etc. Optionally, the number of intra-prediction modes can vary depending on the block size or the color component type, or both. For example, the number of intra-prediction modes can vary depending on whether the color component is a luma signal or a chrominance signal. For example, the number of intra-prediction modes can increase as the block size increases. Optionally, the number of intra-prediction modes for the luma component block can be greater than the number of intra-prediction modes for the chrominance component block.

[0245] Intra-prediction modes can be non-angular or angular. Non-angular modes can be DC or planar modes, and angular modes can be prediction modes with a specific direction or angle. An intra-prediction mode can be represented by at least one of a mode number, a mode value, a mode number, a mode angle, and a mode direction. The number of intra-prediction modes can be greater than 1M, including both non-angular and angular modes. To perform intra-prediction on the current block, a step can be performed to determine whether a sample included in a reconstructed neighboring block can be used as a reference sample for the current block. When a sample cannot be used as a reference sample for the current block, a value obtained by copying or interpolating at least one sample value included in a reconstructed neighboring block, or by both copying and interpolating, can be used to replace the unavailable sample value, and the replaced sample value is then used as a reference sample for the current block.

[0246] Figure 7 This is a diagram showing reference samples that can be used for intra-frame prediction.

[0247] like Figure 7 As shown, at least one of reference sample lines 0 to 3 can be used for intra-frame prediction of the current block. Figure 7 In this scenario, samples from fragments A and F can be filled using samples from their nearest neighbors, fragments B and E, respectively, instead of being retrieved from reconstructed neighboring blocks. Index information of the reference sample lines to be used for intra-frame prediction of the current block can be signaled. For example, in... Figure 7 In this context, 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 the CTU, only reference sample line 0 can be available. Therefore, in this case, index information does not need to be signaled. When using reference sample lines other than reference sample line 0, the filtering for the prediction block, which will be described later, can be omitted.

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

[0249] In planar mode, when generating the prediction block for the current block, the sample value of the target sample is generated by using a weighted sum of the upper and left reference samples, and the upper right and lower left reference samples of the current block, based on the position of the target sample within the prediction block. Alternatively, in DC mode, the average of the upper and left reference samples of the current block can be used when generating the prediction block. Furthermore, in angled mode, the prediction block can be generated using the upper, left, upper right, and / or lower left reference samples of the current block. Real-valued interpolation can be performed to generate the prediction sample values.

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

[0251] The current block can be partitioned into two 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-predicted blocks. Additionally, inverse quantization and / or inverse transform can be performed on the sub-blocks to generate sub-residual blocks. Reconstructed sub-blocks can be generated by adding the sub-predicted blocks to the sub-residual blocks. The reconstructed sub-blocks can be used as reference samples for intra-prediction of subsequent sub-blocks. A sub-block can be a block comprising a predetermined number (e.g., 16) or more samples. Therefore, for example, when the current block is an 8×4 or 4×8 block, the current block can be partitioned into two sub-blocks. Furthermore, when the current block is a 4×4 block, the current block may not be partitioned into sub-blocks. When the current block has other sizes, it can be partitioned into four sub-blocks. Information regarding whether intra-prediction is performed based on sub-blocks and / or partitioning direction (horizontal or vertical) can be signaled. Intra-prediction based on sub-blocks can be limited to being performed only when using reference sample line 0. When performing sub-block-based intra-prediction, filtering for the prediction block, which will be described later, may not be performed.

[0252] A final prediction block can be generated by performing filtering on the prediction block that is intra-predicted. Filtering can be performed by applying predetermined weights to the target sample, the left reference sample, the top reference sample, and / or the top-left reference sample. The weights and / or reference samples (range, position, etc.) used for filtering can be determined based on at least one of the block size, the intra-prediction mode, and the position of the target sample in the prediction block. Filtering can be performed only in a predetermined intra-prediction mode (e.g., DC, planar, vertical, horizontal, diagonal, and / or adjacent diagonal mode). An adjacent diagonal mode can be a mode that adds k to or subtracts k from the diagonal mode. For example, k can be a positive integer of 8 or less.

[0253] The intra-prediction mode of the current block can be entropy-encoded / entropy-decoded by predicting the intra-prediction modes of adjacent blocks. When the intra-prediction modes of the current block and its neighboring blocks are the same, information indicating that the intra-prediction modes of the current block and its neighboring blocks are the same can be signaled using predetermined flag information. Alternatively, an indicator of the intra-prediction mode among multiple neighboring blocks that is the same as the intra-prediction mode of the current block can be signaled. When the intra-prediction modes of the current block and its neighboring blocks are different, the intra-prediction mode information of the current block can be entropy-encoded / entropy-decoded by performing entropy encoding / entropy decoding based on the intra-prediction modes of neighboring blocks.

[0254] Figure 5 This is a diagram illustrating an embodiment of inter-screen prediction processing.

[0255] exist Figure 5 In this context, rectangles can represent the image. Figure 5In the image, the arrow indicates the prediction direction. Based on the encoding type of the frame, frames can be classified into intra-frame frames (I-frames), predictive frames (P-frames), and dual-predictive frames (B-frames).

[0256] I-frames can be encoded via intra-frame prediction without requiring inter-frame prediction. P-frames can be encoded via inter-frame prediction using reference frames present in one direction (i.e., forward or backward) for the current block. B-frames can be encoded via inter-frame prediction using reference frames present in both directions (i.e., forward and backward) for the current block. When using inter-frame prediction, the encoder can perform inter-frame prediction or motion compensation, and the decoder can perform the corresponding motion compensation.

[0257] The following section will describe in detail an embodiment of inter-screen prediction.

[0258] Reference frames and motion information can be used to perform inter-frame prediction or motion compensation.

[0259] Motion information of the current block can be derived by each of the encoding device 100 and the decoding device 200 during inter-frame prediction. The motion information of the current block can be derived using motion information of reconstructed neighboring blocks, motion information of co-located blocks (also called col blocks or co-position blocks), and / or motion information of blocks adjacent to the co-position block. A co-position block can represent a block within a previously reconstructed co-located frame (also called a col frame or co-position frame) that is spatially located at the same position as the current block. A co-position frame can be one of one or more reference frames included in a list of reference frames.

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

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

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

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

[0264] Additionally, the encoding device 100 calculates the motion vector difference (MVD) between the motion vectors and motion vector candidates in the current block based on an affine model, and performs entropy encoding on the MVD. The decoding device 200 derives motion vectors based on each sub-block by deriving the affine control motion vector of the target block to be decoded based on the sum of the entropied MVD and the affine control motion vector candidates.

[0265] The bitstream may include a reference frame index indicating a reference frame. The reference frame index may be entropy encoded by encoding device 100 and subsequently transmitted as a bitstream to decoding device 200. Decoding device 200 may generate a predicted block for the decoded target block based on the derived motion vector and reference frame index information.

[0266] Another example of a method for deriving motion information for the current block could be a merge pattern. A merge pattern can represent a method for merging the motion of multiple blocks. A merge pattern can represent a pattern for deriving motion information for the current block from the motion information of neighboring blocks. When a merge pattern is applied, the reconstructed motion information of neighboring blocks and / or the motion information of co-located blocks can be used to generate a list of merge candidates. Motion information may include at least one of motion vectors, reference frame indices, and inter-frame prediction indicators. Prediction indicators may indicate unidirectional prediction (L0 prediction or L1 prediction) or bidirectional prediction (L0 prediction and L1 prediction).

[0267] The merge candidate list can be a list of stored motion information. The motion information included in the merge candidate list can be at least one of the following: motion information of neighboring blocks adjacent to the current block (spatial merge candidate), motion information of co-located blocks of the current block in the reference frame (temporal merge candidate), new motion information generated by combining motion information existing in the merge candidate list, motion information of blocks encoded / decoded before the current block (history-based merge candidate), and zero merge candidate.

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

[0269] Additionally, the encoding device 100 performs entropy encoding on the correction information for correcting motion vectors in the motion information of the merging candidates and sends it as a signal to the decoding device 200. The decoding device 200 can correct the motion vectors of the merging candidates selected by the merging 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 that corrects the motion vectors of the merging candidates based on the correction information sent by the signal can be referred to as a merging mode with motion vector difference.

[0270] Skip mode can be a mode in which motion information of neighboring blocks is applied to the current block as is. When skip mode is applied, encoding device 100 can perform entropy encoding on information about which block's motion information will be used as the current block's motion information to generate a bitstream, and can send the bitstream as a signal to decoding device 200. Encoding device 100 may not send syntax elements regarding at least one of motion vector difference information, coded block flags, and transform coefficient levels as signals to decoding device 200.

[0271] Sub-block merging patterns can represent a pattern for deriving motion information on a sub-block basis within a coded block (CU). When applying a sub-block merging pattern, a list of sub-block merging candidates can be generated using motion information of sub-blocks in the reference image that are in the same position as the current sub-block (based on sub-block temporal merging candidates) and / or affine control point motion vector merging candidates.

[0272] A geometric partitioning pattern can be represented as follows: motion information is derived by partitioning the current block in a predetermined direction, each of the derived motion information is used to derive each prediction sample, and the prediction sample of the current block is derived by weighting each of the derived prediction samples.

[0273] The inter-frame-intra-frame combined prediction mode can be represented as a mode for deriving the prediction samples of the current block by weighting the prediction samples generated by inter-frame prediction and the prediction samples generated by intra-frame prediction.

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

[0275] Decoding device 200 can use optical flow to compensate for prediction samples derived via inter-frame prediction.

[0276] Figure 6 This is a diagram illustrating the transformation and quantization processes.

[0277] like Figure 6 As shown, transform and / or quantization are performed on the residual signal to produce 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 through intra-frame prediction or inter-frame prediction. The transform can be a primary transform, a secondary transform, or both. The primary transform of the residual signal produces transform coefficients, and the secondary transform of the transform coefficients produces secondary transform coefficients.

[0278] At least one scheme selected from a variety of predefined transform schemes is used to perform the primary transform. Examples of the predefined transform schemes include the Discrete Cosine Transform (DCT), Discrete Sine Transform (DST), and Karhunen-Loève Transform (KLT). The transform coefficients generated by the primary transform may undergo a secondary transform. The transform scheme used for the primary and / or secondary transforms can be determined based on the coding parameters of the current block and / or its neighboring blocks. Optionally, transform information indicating the transform scheme can be transmitted via a signal. DCT-based transforms may include, for example, DCT-2, DCT-8, etc. DST-based transforms may include, for example, DST-7.

[0279] A quantized level signal (quantized coefficients) can be generated by performing quantization on the residual signal or the result of performing a primary and / or secondary transform. Depending on the intra-frame prediction mode or block size / shape, the quantized level signal can be scanned using at least one of diagonal upper-right scan, vertical scan, and horizontal scan. For example, when scanning coefficients according to a diagonal upper-right scan, the block-form coefficients change to a one-dimensional vector form. In addition to the diagonal upper-right scan, depending on the intra-frame 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 for insertion into the bitstream.

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

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

[0282] Inverse mapping in the dynamic range can be performed on the luma components reconstructed via intra-frame prediction or inter-frame prediction prior to intra-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 strip level or parallel block group level. The inverse mapping function used to perform the inverse mapping can be derived based on the mapping function. Intra-loop filtering, reference frame storage, and motion compensation are performed in the inverse mapping region, and the prediction blocks generated by inter-frame prediction are transformed into the mapping region via mapping using the mapping function and then used to generate reconstructed blocks. However, since intra-frame prediction is performed in the mapping region, the prediction blocks generated by intra-frame prediction can be used to generate reconstructed blocks without mapping / inverse mapping.

[0283] When the current block is a residual block for the chroma component, the residual block can be transformed into the inverse-mapped region by scaling the chroma components of the mapped region. The availability of scaling can be signaled at the stripe level or the parallel block group level. Scaling can only be applied if mapping for the luma component is available and the partitioning of the luma component and the partitioning of the chroma component follow the same tree structure. Scaling can be performed based on the average of the sample values ​​of the luma prediction block corresponding to the chroma block. In this case, when inter-frame prediction is used for the current block, the luma prediction block can represent the mapped luma prediction block. The required scaling value can be derived by using an index-referenced 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 using the derived value, the residual block can be transformed into the inverse-mapped region. Chroma component block recovery, intra-frame prediction, inter-frame prediction, intra-loop filtering, and reference frame storage can then be performed in the inverse-mapped region.

[0284] Information indicating whether the mapping / inverse mapping of the luminance and chrominance components is available can be sent via a sequence parameter set using signals.

[0285] The predicted block for the current block can be generated based on a block vector indicating the displacement between the current block and a reference block in the current frame. In this way, the prediction mode used to generate the predicted block with reference to the current frame is called Intra-Block Copy (IBC) mode. IBC mode can be applied to M×N (M<=64, N<=64) coding units. IBC modes can include skip mode, merge mode, AMVP mode, etc. In skip mode or merge mode, a merge candidate list is constructed, and a merge index is signaled so that a merge candidate can be specified. The block vector of the specified merge candidate can be used as the block vector of the current block. The merge candidate list can include at least one of spatial candidates, history-based candidates, candidates based on the average of two candidates, and zero merge candidates. In AMVP mode, the difference block vector can be signaled. Additionally, the predicted block vector can be derived from the left neighboring block and the top neighboring block of the current block. The index of the neighboring block to be used can be signaled. The predicted block in IBC mode is included in the current CTU or the left CTU and is limited to blocks in the reconstructed region. For example, the value of the block vector can be restricted such that the predicted block of the current block is located in the region of the three 64×64 blocks preceding the 64×64 block to which the current block belongs, in the encoding / decoding order. By restricting the value of the block vector in this way, memory consumption and device complexity can be reduced in implementations according to the IBC mode.

[0286] The following describes a method to enhance video compression efficiency by improving the transform method, which is one of the video coding processes. More specifically, coding in conventional video coding schematically includes: an intra-frame / inter-frame prediction step, predicting an original block as part of the current original image; a transform and quantization step, used as a residual block as the difference between the predicted block and the original block; and an entropy coding step, a lossless compression method based on the coefficients of the transformed and quantized block and the probability of compression information obtained at the previous steps. Thus, a bitstream as 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"), which will be described below in this specification, is intended to enhance compression efficiency by improving the transform efficiency.

[0287] 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 widely used as the transform kernel in video coding, thereby better reflecting the common frequency characteristics of the image.

[0288] According to the transformation method of the present invention, high objective video quality can be obtained even at relatively low bit rates compared with traditional video coding methods.

[0289] DST-7 can be applied to the data of the residual block. The application of DST-7 to the residual block can be performed based on the prediction mode corresponding to the residual block. For example, it can be applied to residual blocks encoded according to inter-frame modes. According to embodiments of the invention, DST-7 can be applied after the data of the residual block has been rearranged or rearranged. Here, rearrangement can refer to the rearrangement of image data and can be equivalent to the rearrangement or flipping of the residual signal. Here, residual block can have the same meaning as residual, remaining block, remaining signal, residual signal, remaining data, or residual data. Furthermore, residual block can have the same meaning as reconstructed residual, reconstructed remaining block, reconstructed remaining signal, reconstructed residual signal, reconstructed remaining data, or reconstructed residual data in the form of reconstruction of the residual block in the encoder and decoder.

[0290] According to an embodiment of the present invention, SDST can use DST-7 as the 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 can be used, such as Discrete Sine Transform Type-1 (DST-1), Discrete Sine Transform Type-2 (DST-2), Discrete Sine Transform Type-3 (DST-3), ..., Discrete Sine Transform Type-n (DST-n), Discrete Cosine Transform Type-1 (DCT-1), Discrete Cosine Transform Type-2 (DCT-2), Discrete Cosine Transform Type-3 (DCT-3), ..., Discrete Cosine Transform Type-n (DCT-n), etc. (here, n can be a positive integer of 1 or greater).

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

[0292] [Equation 1]

[0293]

[0294] DCT-2 in the two-dimensional domain can be achieved by performing horizontal and vertical transformations on the residual block using Equation 1 above.

[0295] The DCT-2 transform kernel can be defined as follows, Equation 2. Here, x k It can represent the basic vector based on its position in the frequency domain, and N can represent the size of the frequency domain.

[0296] [Equation 2]

[0297]

[0298] at the same time, Figure 7 This is a diagram showing the fundamental vectors in the frequency domain of the DCT-2 according to the present invention. Figure 7 The frequency characteristics of DCT-2 in the frequency domain are shown. Here, the value calculated from the X0 fundamental vector of DCT-2 represents the DC component.

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

[0300] Simultaneously, DCT-2 can be selectively used based on at least one of the following: the size of the residual block, the color components of the residual block (e.g., luma and chroma components), and the prediction mode corresponding to the residual block. For example, DCT-2 is used when the residual block size is 4×4 and it is encoded in intra-frame mode, and the components of the residual block are luma components. For example, a primary transform kernel can be used for horizontal transformation when the horizontal length (width) of the residual block encoded in intra-frame 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). Otherwise, a secondary transform kernel can be used for horizontal transformation. For example, a primary transform kernel can be used for vertical transformation when the vertical length (height) of the residual block encoded in intra-frame mode is equal to or greater than four pixels and equal to or less than 16 pixels, and the vertical length (height) is not longer than the horizontal length (height). Otherwise, a secondary transform kernel can be used for vertical transformation. The primary transform kernel may be different from the secondary transform kernel. In other words, the horizontal and vertical transform methods for blocks encoded according to intra-frame patterns can be implicitly determined based on the block shape under predetermined conditions. For example, the primary transform kernel can be DST-7, and the secondary transform kernel can be DCT-2. Here, the residual block is the transform target, and therefore can have the same meaning as the transform block. Here, the prediction mode can represent inter-frame prediction or intra-frame prediction. Furthermore, in the case of intra-frame prediction, the prediction mode represents the intra-frame prediction mode or intra-frame prediction direction.

[0301] Transforms using the DCT-2 transform kernel can achieve high compression efficiency for blocks with minimal variations in features between neighboring pixels (such as the background of an image). However, it may not be suitable as a transform kernel for regions (such as textured images with complex patterns). This is because when blocks with low correlation between neighboring pixels are transformed by DCT-2, a large number of transform coefficients appear in the high-frequency components of the frequency domain. When transform coefficients are frequently generated in the high-frequency domain, the compression efficiency of the image can decrease. To enhance compression efficiency, coefficients with large values ​​need to appear near the low-frequency components, and the values ​​of the coefficients need to be close to zero in the high-frequency components.

[0302] Equation 3 below represents 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 It can represent the value of the nth coefficient in the spatial domain.

[0303] [Equation 3]

[0304]

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

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

[0307] [Equation 4]

[0308]

[0309] DST-7 can be used in the transformation processing of residual blocks with a size of at least one of 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, 128×128, etc.

[0310] Simultaneously, DST-7 can be applied to rectangular blocks instead of square blocks. For example, DST-7 can be applied to at least one of the vertical and horizontal transformations of rectangular blocks whose horizontal dimensions differ from their vertical dimensions (such as 8×4, 16×8, 32×4, 64×16, etc.). When multiple transformation methods can be selectively applied, DCT-2 is applied to the vertical and horizontal transformations of square blocks. When multiple transformation methods can be selectively applied, DST-7 is applied to the vertical and horizontal transformations of square blocks.

[0311] Furthermore, DST-7 can be selectively used based on at least one of the following: the size of the residual block, the color components of the residual block (e.g., luma and chroma components), the prediction mode corresponding to the residual block, the intra-prediction mode (direction), and the shape of the residual block. For example, DST-7 is used when the residual block size is 4×4 and it is encoded according to the intra-prediction mode, and the components of the residual block are luma components. Here, the prediction mode can represent inter-frame prediction or intra-frame prediction. Furthermore, in the case of intra-prediction, the prediction mode represents the intra-prediction mode or the intra-prediction direction. For example, for the chroma component, the selection of a transformation method based on the block shape may not be available. For example, when the intra-prediction mode is a prediction between color components, the selection of a transformation method based on the block shape may not be available. For example, the transformation method for the chroma component can be specified by information transmitted via a signal through a bitstream. When the current block is partitioned into multiple sub-blocks and intra-prediction is performed on each sub-block, the transformation method for the current block is determined based on the intra-prediction mode and / or the block size (horizontal and / or vertical dimensions). For example, when the intra-prediction mode is non-directional (DC or planar) and the horizontal length (width) (or vertical length (height)) is within a predetermined range, the primary transform kernel is used for horizontal (vertical) transform. Otherwise, a secondary transform kernel can be used. The primary transform kernel may differ from the secondary transform kernel. For example, the primary transform kernel may be DST-7, and the secondary transform kernel may be DCT-2. The predetermined range may range from, for example, four pixels to 16 pixels. When the block size is not within the predetermined range, the same kernel (e.g., the secondary transform kernel) is used for both horizontal and vertical transform. When the block size is within the predetermined range, different transform kernels are used for intra-prediction modes adjacent to each other. For example, when the secondary transform kernel and the primary transform kernel are used for horizontal and vertical transform in mode 27, respectively, the primary transform kernel and the secondary transform kernel are used for horizontal and vertical transform in modes 26 and 28, which are adjacent to mode 27, respectively.

[0312] Meanwhile, Figure 8 is a diagram showing the fundamental vectors in each frequency domain of the DST-7 according to the present invention. Referring to Figure 8, the shape of the first fundamental vector (x0) of the DST-7 is a curve. Based on this, it is predicted that the DST-7 will exhibit higher transform performance for blocks with large spatial variations in an image compared to the DCT-2.

[0313] DST-7 can be used in the transformation of 4×4 transform units (TUs) within intra-predictive coding units (CUs). By reflecting the characteristic of intra-predictive where the error increases with distance from the reference sample, DST-7 can be used for higher transform efficiency. In other words, DST-7 can be used to effectively compress blocks where the residual signal increases with distance from the position (0, 0) within the block in the spatial domain.

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

[0315] Figure 9 This is a diagram showing the distribution of the average residual values ​​within the 2N×2N prediction units (PUs) of an 8×8 coding unit (CU) predicted according to the inter-frame pattern, wherein the “Cactus” sequence was obtained through testing in a low-latency P-profile environment.

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

[0317] like Figure 9 As shown, the distribution of residual signals within a 2N×2N PU of an 8×8 CU predicted according to the 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 with distance from the center point of the block. That is, the residual signal values ​​are large at the block boundaries. The residual signal distribution characteristics described above can be common characteristics of residual signals within the PU, and are independent of the size of the CU and PU partitioning modes (2N×2N, 2N×N, N×2N, N×N, nR×2N, nL×2N, 2N×nU, and 2N×nD) that the inter-frame predicted CU can have.

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

[0319] Reference Figure 10 It was found that residual signals with relatively small values ​​are distributed in a concentrated manner near the center of the block, while residual signals near the block boundary have relatively large values.

[0320] based on Figure 9 and Figure 10 The residual signal distribution characteristics shown in the figure demonstrate that the transformation of the residual signal within the PU of the inter-frame predicted CU is more efficient when using DST-7 instead of DCT-2.

[0321] The following will describe SDST as one of the transformation methods that uses DST-7 as the transformation kernel.

[0322] The following blocks can represent one of CU, PU, ​​and TU.

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

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

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

[0326] Scan from top row to bottom row, and from left to right within a row.

[0327] Scan from top row to bottom row, and from right to left row within a line.

[0328] Scan from bottom row to top row, and from left to right within a row.

[0329] Scan from bottom row to top row, and from right to left within a row.

[0330] Scan from left column to right column, and from top to bottom within a column.

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

[0332] Scanning from right column to left column, and scanning from top to bottom within a column.

[0333] Scanning from right column to left column, and scanning from bottom to top within a column.

[0334] A spiral scan: a scan from the inside (or outside) of the block to the outside (or inside) of the block, and a scan in a clockwise / counterclockwise direction.

[0335] Diagonal scan: Starting from one corner of the block, scan diagonally in the direction of top left, top right, bottom left, or bottom right.

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

[0337] Scanning and rearrangement of residual signals can be performed on a block-by-block basis.

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

[0339] Furthermore, scanning and rearrangement are described as being performed separately according to a first direction and a second direction, but scanning and rearrangement can also be performed as a single process for the first direction. For example, for residual signals within a block, scanning can be performed from top row to bottom row and scanning in a column from right to left for storage (rearrangement) within the block.

[0340] Simultaneously, the scanning and rearrangement of the residual signal can be performed according to predetermined units of sub-blocks within the current block. Here, a sub-block can be a block that is equal to or smaller in size than the current block. A sub-block can be a block obtained from partitioning the current block according to a quadtree, binary tree, or other similar format.

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

[0342] The scan direction and / or rearrangement direction can be adaptively determined based on the position of the sub-blocks. In this case, different scan directions and / or rearrangement directions can be used for the sub-blocks, or all or some sub-blocks of the current block can use the same scan direction and / or the same rearrangement direction.

[0343] Figure 11 This is a diagram illustrating 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.

[0344] Reference Figure 11 The Purpose Utility (PU) is divided into four sub-blocks according to a quadtree structure, with the arrow direction of each sub-block indicating the distribution characteristics of the residual signal. Specifically, the arrow direction of each sub-block indicates the direction of increase of the residual signal. This is attributed to the common distribution characteristics of the residual signals within the PU, and is independent of the PU partitioning pattern. Therefore, the rearrangement operation for rearranging the residual signals of each sub-block can be performed to have a distribution characteristic suitable for the DST-7 transform.

[0345] Figure 12 This is a diagram illustrating the distribution characteristics of the residual signal before and after the rearrangement of the 2N×2N prediction unit (PU) according to the present invention.

[0346] Reference Figure 12 The upper block shows the distribution of the residual signal within the 2N×2N PU of the 8×8 CU predicted according to the inter-frame mode, before rearrangement. Equation 5 below shows the distribution according to... Figure 12 The value of the position of each residual signal within the upper block.

[0347] [Equation 5]

[0348]

[0349] Due to the distribution characteristics of the residual signals within the PU of the CU predicted according to the inter-frame mode, many residual signals with relatively small values ​​are... Figure 12 The residual signals, which are distributed in the central region of the upper block and have large values, are distributed near the boundary of the upper block.

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

[0351] Equation 6 below represents a method for performing a rearrangement based on the position of each of the four sub-blocks within the PU, wherein the four sub-blocks are obtained by partitioning the PU according to a quadtree structure.

[0352] [Equation 6]

[0353]

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

[0355] Here, W k and H k Let x and y represent the width and height of the k-th sub-block (k∈{blk0,blk1,blk2,blk3}) in the PU, respectively, where blk0 to blk3 represent the sub-blocks obtained by partitioning the PU according to a quadtree structure. Furthermore, x and y represent the horizontal and vertical positions within the sub-block, respectively. Figure 12 As shown in the upper block, the positions of the residual signals before rearrangement are specified by a(x,y), b(x,y), c(x,y), and d(x,y). Figure 12 As shown in the lower block, the positions of the residual signals altered by rearrangement are represented by a'(x,y), b'(x,y), c'(x,y), and d'(x,y).

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

[0357] Reference Figure 13 A sub-block can represent one of multiple sub-blocks belonging to an 8×8 prediction block. Figure 13 (a) shows the location of the original residual data before the rearrangement, and Figure 13 (b) shows the location of the rearrangement of the residual data.

[0358] Reference Figure 13 (c) The values ​​of the residual data can gradually increase from position (0, 0) to 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 a basic vector as shown in Figure 8.

[0359] In other words, regarding the rearrangement according to the invention, the residual data of each sub-block can be rearranged such that the distribution of the residual data fits the form of the DST-7 basic vector. After rearranging each sub-block, the DST-7 transformation can be applied to the data rearranged according to each sub-block unit.

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

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

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

[0363] Figure 14a and Figure 14b This is a diagram illustrating an embodiment of the transformation unit (TU) partitioning structure of the coding unit (CU) according to the rearrangement method of the prediction unit (PU) pattern and the transformation unit (TU). Figure 14a and Figure 14b The quadtree partitioning structure of TU based on the depth of TU is shown for each asymmetric partitioning pattern (2N×nU, 2N×nD, nR×2N, and nL×2N).

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

[0365] At the same time, Figure 14a and Figure 14b In this context, the TU with depth 0 in each PU can have the same block size as the PU (e.g., in a 2N×2N PU, the size of the TU with depth 0 can be the same as the size of the PU). This will be discussed later. Figure 18 Describes the rearrangement of the residual signal within a TU at depth 0.

[0366] Furthermore, when at least one of CU, PU, ​​and TU is rectangular in shape (e.g., 2N×nU, 2N×nD, nR×2N, and nL×2N), at least one of CU, PU, ​​and TU is partitioned into N sub-blocks, such as two, four, six, eight, 16 sub-blocks, etc., before residual signal rearrangement is applied to the sub-blocks obtained from the partitions.

[0367] Furthermore, when at least one of CU, PU, ​​and TU is square in shape (e.g., 2N×2N and N×N), at least one of CU, PU, ​​and TU is partitioned into N sub-blocks, such as four, eight, 16 sub-blocks, etc., before residual signal rearrangement, and then residual signal rearrangement is applied to the sub-blocks obtained from the partitions.

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

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

[0370] At the same time, Figure 14a and Figure 14b The text describes the asymmetric partitioning pattern of the PU for inter-frame prediction but does not restrict it. The partitioning and rearrangement of the TU can be applied to the symmetric partitioning pattern of the PU (2N×N and N×2N).

[0371] A DST-7 transformation can be performed on each TU within a rearranged PU. Here, when the CU, PU, ​​and TU have the same shape and size, a DST-7 transformation is performed on a block.

[0372] Considering the distribution characteristics of the residual signals of the inter-frame predicted PU blocks, performing the DST-7 transform after rearranging the sizes of the CU and PU partition patterns is more efficient than performing the DCT-2 transform.

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

[0374] Figure 15 This is a diagram showing the results of performing DCT-2 transformation and SDST transformation based on the distribution of the residual signal of the 2N×2N prediction unit (PU).

[0375] exist Figure 15 The diagram shown on the left illustrates the distribution when the PU partitioning pattern of the CU is 2N×2N, with the residual signal increasing from the center to the boundaries. Furthermore, in... Figure 15 The diagram shown in the middle illustrates the distribution of the residual signal after performing a DCT-2 transform on a TU of depth 1 within the PU. Figure 15 The diagram shown on the right illustrates the distribution of the residual signal after DST-7 was performed following rearrangement of the TU at a depth of 1 within the PU.

[0376] Reference Figure 15 Compared to performing DCT-2 on the TU of a PU with the aforementioned 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. Based on the transform characteristics, it was found that performing SDST instead of DCT-2 is more advantageous in terms of compression efficiency when transforming the residual signal of the inter-frame predicted PU.

[0377] The cells of the block to which the DST-7 transformation is performed are the TU cells defined in the PU that perform the SDST. As described above with reference to FIG14, the TU can be obtained from the partition of the PU cell with the maximum depth according to a quadtree or a binary tree. This means that after rearrangement, the DST-7 transformation can be performed not only on square blocks but also on rectangular blocks.

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

[0379] Information about the type of a sub-residual block can be block partitioning information. Block partitioning information can be, for example, partitioning direction information indicating one of the horizontal or vertical partitions. Optionally, block partitioning information can include partitioning ratio information. For example, partitioning ratios can include 1:1, 1:3, and / or 3:1. Partitioning direction information and partitioning ratio information can be sent as separate syntax elements or as a single syntax element using signals.

[0380] Information about the location of sub-residual blocks can indicate their position within the block. For example, when the block is partitioned vertically, the location information indicates one between the left and right sides. Furthermore, when the block is partitioned horizontally, the location information indicates one between the top and bottom.

[0381] The transform kernel of a sub-residual block can be determined based on type information and / or location information. The transform kernel can be determined independently for horizontal and vertical transforms. For example, the transform kernel can be determined based on the partitioning direction. For example, in the case of vertical partitioning, a first transform kernel can be applied to the vertical transform. In the case of horizontal partitioning, a first transform kernel can be applied to the horizontal transform. For example, in the case of vertical partitioning, either a first or second transform kernel can be applied to the horizontal transform, and in the case of horizontal partitioning, either a first or second transform kernel can be applied to the vertical transform. For example, in the case of vertical partitioning, a second transform kernel can be applied to the horizontal transform at the left position and a first transform kernel can be applied to the horizontal transform at the right position. Furthermore, in the case of horizontal partitioning, a second transform kernel can be applied to the vertical transform at the upper position and a first transform kernel can be applied to the vertical transform at the lower position. For example, the first transform kernel and the second transform kernel can be DST-7 and DCT-8, respectively. For example, the first transform kernel and the second transform kernel can be DST-7 and DCT-2, respectively. However, this is not a limitation; any two different transform kernels can be used as the first and second transform kernels among the various transform kernels described in the specification. Here, the block can represent CU or TU. Furthermore, sub-residual blocks can represent sub-TUs.

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

[0383] In step S1610, the residual signal of the TU as the transformation target is input. Here, the TU can be a partition obtained from the PU whose prediction mode is inter-frame mode. In step S1620, the TU as the transformation target can be rearranged. Next, in step S1630, the rearranged TU is subjected to DST-7 transformation, in step S1640, quantization is performed, and a series of subsequent processes are performed, thereby performing SDST processing in this order.

[0384] Simultaneously, rearrangement and DST-7 transform can be performed on blocks whose prediction mode is intra-frame mode.

[0385] The following methods, as embodiments for implementing SDST transform in an encoder, will be described: i) a method for performing SDST on all TUs within the inter-frame prediction PU, and ii) a method for selectively performing SDST or DCT-2 through rate-distortion optimization. Inter-frame prediction blocks are described in the following methods, but the methods are not limited thereto; they can also be applied to intra-frame prediction blocks.

[0386] Figure 17 This is a diagram illustrating the distribution characteristics of the partitions and residual absolute values ​​of the transform units (TUs) of each prediction unit (PU) partition mode for inter-frame prediction according to the present invention.

[0387] Reference Figure 17 In inter-frame prediction mode, the TU can be obtained from partitions of the CU with a maximum depth, either according to a quadtree or a binary tree, and a total of K partition patterns for the PU can exist. Here, K is a positive integer, and for example, in Figure 17 In this context, K is 18.

[0388] As referred above Figure 10 The SDST according to the present invention utilizes the distribution characteristics of the residual signal in the PU within the CU predicted by inter-frame prediction. Furthermore, the TU can be obtained from partitioning the 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 the PU once according to a quadtree structure or a binary tree structure.

[0389] Figure 17 Each block in the diagram is shown in the following form: the TU is obtained by partitioning each PU partition pattern of the CU for inter-frame prediction at a depth of 2. Here, thick solid lines indicate PUs, thin solid lines indicate TUs, and the arrow direction of each TU indicates the direction in which the residual signal value within the TU increases. Each TU can be rearranged as described above regarding the rearrangement steps based on the position within the PU.

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

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

[0392] Figure 18 This is a diagram illustrating the residual signal scanning sequence and rearrangement sequence of the transformation unit (TU) at depth 0 within the prediction unit (PU) according to an embodiment of the present invention.

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

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

[0395] In the encoder, it can be based on Figure 16 The SDST process shown in the diagram performs SDST on all TUs within the inter-frame prediction PU. Based on the PU partitioning pattern of the inter-frame prediction CU, it can be performed as follows: Figure 17 The same form shown in the diagram executes TU partitioning from PU up to depth 2. This is achieved by using... Figure 17 The distribution characteristics of the residual signals within the TUs can be analyzed, and the residual signals within each TU can be rearranged. Afterwards, a transform using the DST-7 transform kernel can be performed, followed by quantization, entropy coding, etc.

[0396] When reconstructing the residual signals of TUs within the inter-frame predicted PU, the decoder performs an inverse DST-7 transform on each TU within the inter-frame predicted PU and performs inverse rearrangement on the reconstructed residual signals to obtain the reconstructed residual signals. In this SDST method, SDST is applied to the transform method of all TUs within the inter-frame predicted PU, so there are no flags or information that need to be further signaled to the decoder. That is, the SDST method can be executed without any signaling of the SDST method.

[0397] At the same time, even if SDST is performed on all TUs within the inter-frame prediction PU, the encoder will determine a portion of the rearrangement method for the residual signal described above regarding the rearrangement step as the optimal rearrangement method, and information about the determined rearrangement method can be sent to the decoder via a signal.

[0398] As another embodiment of performing SDST, at least one of two or more transform methods (e.g., DCT-2 and SDST) can be selected for application to transform the PU. According to this method, the encoder computation increases compared to an embodiment that performs SDST on all TUs within the inter-frame predicted PU. However, selecting a more efficient transform method between DCT-2 and SDST can improve compression efficiency.

[0399] Figure 19 This is a flowchart illustrating the DCT-2 or SDST selection encoding process according to the present invention, which utilizes Rate Distortion Optimization (RDO).

[0400] Reference Figure 19In step S1910, the residual signal of the TU as the transformation target can be input. In step S1950, the cost of the TU obtained by performing DCT-2 on each TU in 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 to determine the optimal transformation mode (e.g., DST-2 or SDST) for the TU in terms of rate distortion. Next, in step S1960, according to the determined transformation mode, the transformed TU can be quantized and entropy coding can be performed.

[0401] Furthermore, the optimal transformation mode is selected from SDST and DCT-2 only if the TU meets one of the following conditions.

[0402] i) Regardless of the PU partitioning mode, TU must be a CU or must be obtained from a CU partitioned according to a quadtree or a binary tree.

[0403] ii) The TU needs to be obtained from a PU partitioned according to the PU partitioning pattern or from a PU partitioned according to a quadtree or a binary tree.

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

[0405] Condition i) is the following method: for CUs that are partitioned according to a quadtree or a binary tree regardless of the PU partitioning mode, or for TUs obtained by partitioning to the size of the CU, select DCT-2 or SDST as the transformation mode for rate distortion optimization.

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

[0407] Condition iii) is that regardless of the PU partitioning mode, neither CU nor TU is partitioned according to CU cells with the same size as TU, and DCT-2 and SDST are performed to determine the transformation mode of TU.

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

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

[0410] Reference Figure 20 In step S2010, an SDST flag may be sent for each TU reference signal. Here, the SDST flag may be a flag indicating whether SDST is used as a conversion mode.

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

[0412] Simultaneously, when the SDST flag is not true in step S2020 (No), the transformation mode of the TU is determined to be DCT-2 mode. Subsequently, in step S2050, an inverse DCT-2 transformation is performed on the residual signal in the TU, and in step S2060, the reconstructed residual signal is obtained.

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

[0414] Additionally, for the selective use of DCT-2 or DST-7, the sdst_flag can be signaled. The signaling of sdst_flag is performed in units of TU. sdst_flag indicates whether SDST needs to be detected.

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

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

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

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

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

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

[0421] Here, the signal that is the target of rearrangement or reordering can be at least one of the following: the residual signal before inverse transformation, the residual signal before dequantization, the residual signal after inverse transformation, the residual signal after dequantization, the reconstructed residual signal, and the reconstructed block signal.

[0422] At the same time, Figure 21 The document describes sending the sdst_flag signal in units of TUs, but it can selectively send the sdst_flag signal based on at least one of the TU's transformation mode and CUDF value. For example, when the TU's transformation mode is transformation skip mode and / or the TU's CUDF value is 0, the sdst_flag signal is not sent. Furthermore, the sdst_flag signal is not sent even when the TU's depth is 0.

[0423] The description also mentions sending sdst_flag as a signal in units of TU, ​​but it can also be sent as a signal according to predetermined units. For example, sdst_flag can be sent as a signal in units of at least one of video, sequence, frame, stripe, parallel block, coding tree unit, coding unit, prediction unit, and transform unit.

[0424] like Figure 20 The SDST logo and Figure 21In an embodiment of the SDST flag, the selected transform mode information can be entropy encoded / decoded in units of TU using 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 the TU is transformed by DCT-2, whether the TU is transformed by SDST, whether the TU is transformed by DST-7, etc.

[0425] In the case of TU within the PU that only predicts between frames, the transform mode information can be entropy encoded / decoded via bypass mode. Furthermore, in the case of at least one of transform skip mode, residual differential PCM (RDPCM) mode, and lossless mode, entropy encoding / decoding of the transform mode information is omitted, and the transform mode information is not transmitted via signal.

[0426] Furthermore, when the coded block flag is 0, entropy encoding / decoding of the transform mode information is omitted, and the transform mode information is not transmitted via signal. When the coded block flag is 0, the inverse transform processing is omitted in the decoder. Therefore, block reconstruction can be performed even when transform mode information is absent in the decoder.

[0427] However, transformation pattern information is not limited to representing transformation patterns through flags, and can be implemented in the form of predefined tables and indexes. Here, the predefined tables can define the available transformation patterns for each index.

[0428] At the same time, Figures 18 to 21 The text describes the selective use of SDST or DCT-2, but is not limited to this; DCT-n or DST-n (where n is a positive integer) can be used instead of DCT-2.

[0429] Furthermore, DCT-2 or SDST transformations can be performed separately in the horizontal and vertical directions. The same transformation mode can be used in both the horizontal and vertical directions, or different transformation modes can be used.

[0430] Furthermore, entropy encoding / decoding can be performed separately on transform mode information regarding whether DCT-2 is used in the horizontal and vertical directions, whether SDST is used, and whether DST-7 is used. Transform mode information can be transmitted as an index, for example. Transform kernels indicated by the same index can be identical for intra-frame predicted blocks and inter-frame predicted blocks.

[0431] Furthermore, the transformation mode information can be entropy encoded / entropy decoded in units of at least one of CU, PU, ​​TU, and block.

[0432] Furthermore, transformation mode information can be transmitted via signals based on either the luminance or chrominance components. In other words, transformation mode information can be transmitted via signals based on the Y component, Cb component, or Cr component. For example, when transformation mode information about whether DCT-2 or SDST is performed is transmitted via signals for the Y component, the transformation mode information transmitted via signals for the Y component can be used as the transformation mode of the block without needing to transmit any transformation mode information via signals for at least one of the Cb and Cr components.

[0433] Here, the transformation pattern information can be entropy encoded / decoded using the arithmetic encoding method of the context model. When the transformation pattern information is implemented in the form of a predefined table and index, entropy encoding / decoding is performed on all or part of the binary bits in a plurality of binary bits using the arithmetic encoding method of the context model.

[0434] Furthermore, entropy encoding / decoding of the transform mode information can be selectively performed based on the block size. For example, when the current block size is equal to or greater than 64×64, entropy encoding / decoding of the transform mode information is not performed. When the size is equal to or less than 32×32, entropy encoding / decoding of the transform mode information is performed.

[0435] Furthermore, when non-zero transform coefficients or L quantization levels exist within the current block, entropy encoding / decoding of the transform mode information is not performed, and one of the DCT-2, DST-7, and SDST methods is executed. Here, entropy encoding / decoding of the transform mode information is not performed regardless of the position of the non-zero transform coefficients or quantization levels within the block. Additionally, entropy encoding / decoding of the transform mode information is only omitted when a non-zero transform coefficient or quantization level exists in the upper-left position within the block. Here, L can be a positive integer including 0, and can be, for example, 1.

[0436] Furthermore, when non-zero transform coefficients or J or more quantization levels exist within the current block, entropy encoding / decoding of the transform mode information is performed. Here, J is a positive integer.

[0437] Furthermore, transform mode information refers to the use of some transform modes that are limited by the transform mode of the same block or the transform mode of the same block is represented by several bits, which can change the binarization method of the transform method.

[0438] The above-mentioned SDST can be used in a limited manner based on at least one of the prediction mode, intra-frame prediction mode, inter-frame prediction mode, TU depth, size and shape of the current block.

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

[0440] A minimum / maximum depth for 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. Alternatively, SDST is used when the depth of the current block is equal to or less than the maximum depth. Here, the minimum / maximum depth can be a fixed value, or it can be variably determined based on information indicating the minimum / maximum depth. Information indicating the minimum / maximum depth can be sent from the encoder by signal, and information indicating the minimum / maximum depth can be derived from the decoder based on the attributes of the current / nearby blocks (e.g., size, depth, and / or shape).

[0441] The minimum / maximum size allowed for 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 it can be variably determined based on information indicating the minimum / maximum size. Information indicating the minimum / maximum size can be sent from the encoder by signal, and information indicating the minimum / maximum size 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 encoding / decoding is performed on the information about whether DCT-2 or SDST is used.

[0442] The shape of a block that allows SDST can be defined. In this case, SDST is used when the current block's shape is the defined block shape. Conversely, the shape of a block that does not allow SDST can be defined. In this case, SDST is not used when the current block's shape is the defined block shape. The shapes of blocks that allow or disallow SDST can be fixed, and information about this can be sent from the encoder via signals. 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 a block that allows or disallows SDST can represent, for example, an M×N block, M, N, and / or a ratio between M and N.

[0443] Furthermore, when the TU depth is 0, DCT-2 or DST-7 is used as the transform method, and entropy encoding / decoding is performed on the transform mode information regarding which transform method was used. When DST-7 is used as the transform method, residual signal rearrangement processing is performed. Additionally, when the TU depth is 1 or greater, DCT-2 or SDST is used as the transform method, and entropy encoding / decoding is performed on the transform mode information regarding which transform method was used.

[0444] Furthermore, transformation methods can be selectively used based on the partition shapes of CU and PU or the shape of the current block.

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

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

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

[0448] Furthermore, when SDST or DST-7 is executed using blocks obtained from partitions of the current block as units, scans and inverse scans of the transform coefficients (quantization levels) can be performed using blocks obtained from partitions as units. Additionally, when SDST or DST-7 is executed using blocks obtained from partitions of the current block as units, scans and inverse scans of the transform coefficients (quantization levels) can be performed using the unpartitioned current block as units.

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

[0450] Furthermore, in transform / inverse transforms using SDST or DST-7, DST-1 can be used instead of DST-7. Additionally, in transform / inverse transforms using SDST or DST-7, DST-4 can be used instead of DST-7.

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

[0452] The following describes various modifications and embodiments of the rearrangement method and signal transmission method.

[0453] The SDST of this invention aims to enhance image compression efficiency by altering the transform, rearrangement, repositioning, and / or flipping. By performing DST-7 through the rearrangement of the residual signal, the distribution characteristics of the residual signal within the PU are effectively reflected, thereby achieving high compression efficiency.

[0454] The residual signal rearrangement method has been described above in the description of the rearrangement steps. Below, in addition to the rearrangement method used for residual signal rearrangement, other implementation methods will be described.

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

[0456] To minimize hardware complexity in the rearrangement of residual signals, the residual signal rearrangement process can be implemented using horizontal and vertical flipping methods. The residual signal rearrangement method can be implemented using the flipping methods shown in (1) to (4) below. The rearrangement described below can represent flipping.

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

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

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

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

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

[0462] For example, as shown below, when performing a horizontal flip on a residual block that has already been horizontally flipped, the residual block before the flip was performed is obtained.

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

[0464] For example, as shown below, when performing a vertical flip on a residual block that has already been vertically flipped, the residual block before the flip was performed is obtained.

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

[0466] For example, as shown below, when performing a horizontal and vertical flip on a residual block that has already been horizontally and vertically flipped, the residual block before the flip was performed is obtained.

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

[0468] A residual signal rearrangement / repositioning method based on flipping can be used without partitioning the current block. That is, in the SDST method, the current block (TU, etc.) is described as being partitioned into sub-blocks and DST-7 is applied to each sub-block. However, when using the residual signal rearrangement / repositioning method based on flipping, the current block is not partitioned into sub-blocks, and a flip is performed on the entire current block or a portion of the current block, followed by a DST-7 transformation. Furthermore, when using the residual signal rearrangement / repositioning method based on flipping, the current block is not partitioned into sub-blocks, and a flip is performed on the entire current block or a portion of the current block after performing an inverse DST-7 transformation.

[0469] The maximum size (M×N) and / or minimum size (O×P) of the block capable of performing residual signal rearrangement / repositioning based on flipping can be defined. Here, the size may include at least one of a width as a horizontal dimension (M or O) and a height as a vertical dimension (N or P). M, N, O, and P can be positive integers. The maximum size and / or minimum size of the block can be predefined values ​​in the encoder / decoder, or they can be information sent from the encoder to the decoder via signals.

[0470] For example, when the size of the current block is smaller than the minimum size that allows the flip method to be performed, the flip and DST-7 transformations are not performed, and only the DCT-2 transformation is performed. Here, the SDST flag, which serves as transformation mode information indicating whether the flip and DST-7 are used as transformation modes, is not required to be transmitted.

[0471] For example, when the block width is less than the minimum width required to perform the flip method and the block height is greater than the minimum height required to perform the flip method, only DCT-2 is used to perform the one-dimensional transformation in the horizontal direction. Regarding the one-dimensional transformation in the vertical direction, DST-7 is used to perform the one-dimensional vertical transformation after a vertical flip, or DST-7 is used without flipping. Here, the SDST flag, which indicates whether flipping is used as the transformation mode, can be sent only for the one-dimensional transformation in the vertical direction.

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

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

[0474] For example, when the size of the current block is larger than the maximum size that can be used to perform the flipping method, only the DCT-2 transformation or the DST-7 transformation is used.

[0475] For example, when the maximum size for which the flip method can be performed is 32×32 and the minimum size is 4×4, a 64×64 block is treated with both flip and DST-7 transforms, and only DCT-2 transforms are used. Here, for a 64×64 block, the SDST flag, which indicates whether flip and DST-7 are used as transform modes, is not signaled. Furthermore, for blocks of sizes 4×4 to 32×32, the SDST flag, which indicates whether flip and DST-7 are used as transform modes, can be signaled. In this case, DST-7 transforms are not used for 64×64 blocks, thus saving memory space for storing DST-7 transforms for 64×64 blocks.

[0476] For example, when the maximum size that can be flipped is 32×32 and the minimum size is 4×4, a block of size 64×64 is not only flipped but also transformed using DCT-2 or DST-7.

[0477] For example, a square block of size M×N can be partitioned into four sub-blocks according to a quadtree, and a rearrangement / reshuffling method can be performed on each sub-block using a flipping method, followed by a DST-7 transformation. Here, the flipping method can be explicitly signaled for each sub-block. The flipping method can be signaled as a two-bit fixed-length code or as a truncated unary code. Furthermore, a binarization method based on the probability of occurrence 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.

[0478] For example, a square block of size M×N can be partitioned into four sub-blocks according to a quadtree, and a rearrangement / reshuffling method can be performed on each sub-block using a flipping method, followed by a DST-7 transformation. The flipping method for each sub-block can be implicitly determined. For example, a horizontal and vertical flip can be determined for the first (top left) sub-block, a vertical flip for the second (top right) sub-block, a horizontal flip for the third (bottom left) sub-block, and no flipping for the fourth (bottom right) sub-block. As mentioned above, when the flipping method is implicitly determined, it is not necessary to signal the flipping method. Here, M and N can be positive integers, for example, 64×64.

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

[0480] For example, a rectangular block of size 2M×N can be partitioned into two M×N square blocks according to a binary tree, and a rearrangement / repositioning method can be performed on each sub-block using a flipping method, followed by a DST-7 transformation. The flipping method for each sub-block can be implicitly determined. For example, a horizontal flip can be determined for the first (left) sub-block, and no flipping can be determined for the second (right) sub-block. As mentioned above, when the flipping method is implicitly determined, it is not necessary to signal the flipping method. Here, M and N can be positive integers, for example, 4×4.

[0481] For example, a rectangular block of size M×2N can be partitioned into two M×N square blocks according to a binary tree, and a rearrangement / reordering method can be performed on each sub-block using a flipping method, followed by a DST-7 transformation. The flipping method for each sub-block can be implicitly determined. A vertical flip can be determined for the first (top) sub-block, and no flipping can be determined for the second (bottom) sub-block. As mentioned above, when the flipping method is implicitly determined, it is not necessary to signal the flipping method. Here, M and N can be positive integers, for example, 4×4.

[0482] At least one of the following two methods can be applied: performing a DCT-2 transformation / inverse transformation on a block of size M×N; and partitioning the block according to a quadtree or a binary tree to generate sub-blocks, performing a flip on each sub-block, and then performing a DST-7 transformation / inverse transformation. Here, the flipping method can be performed differently depending on the relative position within the parent block that serves as a 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, a block of size M×N can be a relatively large block in size.

[0483] In the case of the top-left sub-block, horizontal and vertical flips can be defined as flips for the sub-block.

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

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

[0486] In the case of the lower right sub-block, it can be determined that no flipping is performed on the sub-block.

[0487] The transformation mode information (sdst_flag or sdst flag) can be used to entropy encode / decode information regarding the use of the flip-based residual signal rearrangement / repositioning method. That is, by sending the transformation mode information as a signal, the same method executed in the encoder can be performed in the decoder. For example, when the flag bit indicating the transformation mode information has a first value, the flip-based residual signal rearrangement / repositioning method and DST-7 are used as the transformation / inverse transformation method. When the flag bit has a second value, another transformation / inverse transformation method is used. Here, the transformation mode information can be entropy encoded / decoded for each block. Here, the other transformation / inverse transformation method can be the DCT-2 transformation / inverse transformation method. Furthermore, in the case of one of the transformation skip mode, residual differential PCM (RDPCM) mode, and lossless mode, the entropy encoding / decoding of the transformation mode information is omitted, and the transformation mode information is not sent as a signal.

[0488] The transform mode information can be entropy encoded / decoded using at least one of the following: the depth of the current block, the size of the current block, the shape of the current block, transform mode information of neighboring blocks, the coded block flag of the current block, and information about whether a transform skip mode is used in the current block. For example, when the coded block flag of the current block is 0, entropy encoding / decoding of the transform mode information is omitted, and the transform mode information is not transmitted by signal. Furthermore, the transform mode information can be predictively encoded / decoded from the transform mode information of reconstructed blocks adjacent to the current block during entropy encoding / decoding. Additionally, the transform mode information can be transmitted by signal based on at least one of the encoding parameters of the current block and neighboring blocks.

[0489] Furthermore, using 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 encoded / decoded in the form of a flag or index (flipping_idx). That is, by sending the flipping method information as a signal, the same flipping method executed in the encoder can be performed in the decoder. Transformation mode information may include the flipping method information.

[0490] Furthermore, in the case of one of the transform skip mode, residual differential PCM (RDPCM) mode, and lossless mode, entropy encoding / decoding of the flip method information is omitted, and the flip method information is not transmitted by signal. Entropy encoding / decoding of the flip method information can be performed using at least one of the following: the depth of the current block, the size of the current block, the shape of the current block, the flip method information of neighboring blocks, the coded block flag of the current block, and information regarding whether the transform skip mode of the current block is used. For example, when the coded block flag of the current block is 0, entropy encoding / decoding of the flip method information is omitted, and transform mode information is not transmitted by signal. Furthermore, the flip method information can be predictedly encoded / decoded from the flip method information of the reconstructed blocks adjacent to the current block during entropy encoding / decoding. Additionally, the flip method information can be transmitted by signal based on at least one of the encoding parameters of the current block and neighboring blocks.

[0491] Furthermore, the residual signal rearrangement method is not limited to the residual signal rearrangement described above, and can also be achieved by rotating the residual signals within the block by 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, and -135 degrees. Here, the information about the angle can be entropy encoded / entropy decoded in the form of a flag or index, and the information about the angle can be processed similarly to the signal transmission method for transform mode information.

[0492] Furthermore, angle information can be predictively encoded / decoded from angle information of reconstructed blocks adjacent to the current block during entropy encoding / decoding. When performing a rearrangement using angle information, SDST or DST-7 can be performed after partitioning the current block, or SDST or DST-7 can be performed on a block-by-block basis without partitioning the current block.

[0493] The predetermined angle can be determined differently depending on the position of the sub-block. The method of rearranging by rotating only the sub-block at a specific position (e.g., the first sub-block) can be used in a restricted manner. Furthermore, 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 following: the residual block before inverse transform, the residual block before dequantization, the residual block after inverse transform, the residual block after dequantization, the reconstructed residual block, and the reconstructed block.

[0494] Simultaneously, to achieve the same effect as rearranging or rotating the residual signal, the coefficients of the transformation matrix used for the transformation can be rearranged or rotated, and this can be applied to the previously rearranged residual signal to perform the transformation. That is, instead of rearranging the residual signal, rearranging the transformation matrix is ​​used to perform the transformation, thereby achieving the same effect as the method of rearranging and transforming the residual signal. Here, the rearrangement of the transformation matrix coefficients can be performed in the same manner as the residual signal rearrangement method described above, and the method for transmitting information by signal required for rearranging the transformation matrix coefficients can be performed in the same manner as the method for transmitting information by signal required by the residual signal rearrangement method described above.

[0495] Simultaneously, a portion of the residual signal rearrangement methods described above can be determined as the optimal rearrangement method for the encoder, and information about the determined rearrangement method (rearrangement method information) can be sent to the decoder via a signal. For example, when four rearrangement methods are used, the encoder sends up to two bits of information about the residual signal rearrangement method to the decoder via a signal.

[0496] Furthermore, 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 can be arranged in descending order of occurrence probability and can be signaled as truncated unary codes (e.g., (0, 10, 110, 111) or (1, 01, 001, 000)).

[0497] Furthermore, the occurrence probability of a rearrangement method can vary depending on coding parameters (such as the prediction mode of the current CU, the intra-frame prediction mode (direction) of the PU, the motion vectors of neighboring blocks, etc.). Therefore, coding methods that utilize information about the rearrangement method (flipping method information) can be used differently depending on the coding parameters. For example, the occurrence probability of a rearrangement method can vary depending on the intra-frame prediction mode. Therefore, for each intra-frame mode, fewer bits can be allocated to rearrangement methods with high occurrence probabilities, and many bits can be allocated to rearrangement methods with low occurrence probabilities. Optionally, depending on the situation, rearrangement methods with extremely low occurrence probabilities may not be used and may not be allocated any bits to them.

[0498] A rearrangement set, including at least one residual signal rearrangement method, can be constructed based on at least one of the following: the prediction mode (inter-frame or intra-frame), intra-frame prediction mode (including directional and non-directional modes), inter-frame prediction mode, block size, block shape (square or non-square), luma / chroma signal, transform mode information, etc. Rearrangement can represent flipping. Furthermore, a rearrangement set, including at least one residual signal rearrangement method, can be constructed based on at least one of the coding parameters of the current block and neighboring blocks.

[0499] Furthermore, based on at least one of the prediction mode of the current block, intra-frame prediction mode, inter-frame prediction mode, block size, block shape, luma / chroma signal, transform mode information, etc., at least one of the following rearrangement sets can be selected. Additionally, 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.

[0500] A rearrangement set may include at least one of "no flip", "horizontal flip", "vertical flip", and "horizontal and vertical flip". An example of a rearrangement set is shown below.

[0501] 1. Do not flip

[0502] 2. Horizontal flip

[0503] 3. Vertical Flip

[0504] 4. Horizontal and vertical flipping

[0505] 5. No flipping, and horizontal flipping.

[0506] 6. No flipping, and vertical flipping

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

[0508] 8. Horizontal flip and vertical flip

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

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

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

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

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

[0514] 14. Horizontal flip, vertical flip, and both horizontal and vertical flip

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

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

[0517] Furthermore, based on at least one of the prediction mode, intra-frame prediction mode, inter-frame prediction mode, block size, block shape, luma / chroma, transform mode information, and flip method information of the current block, at least one residual signal rearrangement method can be selected from the rearrangement set. Additionally, based on at least one of the coding parameters of the current block and neighboring blocks, at least one residual signal rearrangement method can be selected from the rearrangement set.

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

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

[0520] At least one rearrangement set can be constructed based on the size of the current block. For example, if the size of the current block is greater than 16×16, one rearrangement set is constructed. If the size of the current block is equal to or less than 16×16, multiple rearrangement sets are constructed.

[0521] Based on the shape of the current block, at least one rearrangement set can be constructed. For example, when the current block is square, one rearrangement set is constructed. When the current block is not square, multiple rearrangement sets are constructed.

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

[0523] Furthermore, based on the rearrangement set, the index of the residual signal rearrangement method can be entropy encoded / decoded. Here, the index can be entropy encoded / decoded into variable-length or fixed-length codes.

[0524] Furthermore, based on the rearrangement set, the index of the residual signal rearrangement method can be binarized and debinarized. Here, the index can be binarized and debinarized into variable-length or fixed-length codes.

[0525] Furthermore, the rearrangement set can be in the form of a table in the encoder and decoder, and can be computed through equations.

[0526] Furthermore, the redistribution set can be constructed in a symmetric manner. For example, the table for the redistribution set can be constructed in a symmetric manner. Here, the table can be constructed in a symmetric manner for intra-frame prediction modes.

[0527] Furthermore, the rearrangement set can be constructed based on at least one of the following: whether the intra-prediction mode is odd or even and whether the intra-prediction mode is within a specific range.

[0528] The following is an example of a method for encoding / decoding residual signals based on the prediction mode of the current block and the intra-frame prediction mode (direction).

[0529] In addition, the following table may use the flipping method information to indicate the use of at least one residual signal rearrangement method among the residual signal rearrangement methods.

[0530] [Table 1]

[0531]

[0532] In Table 1, columns (1) to (4) specify the residual signal rearrangement methods, such as the index for the scan / rearrangement order of the residual signal rearrangement, the index for the predetermined angle value, and the index for the predetermined flipping method. In Table 1, the symbol * in the column of residual signal rearrangement methods indicates that the corresponding rearrangement method is used implicitly without signal transmission, and the symbol - indicates that the corresponding rearrangement method is not used in the corresponding case. Implicit use of the rearrangement method means using the transformation mode information (sdst_flag or sdst flag) to use the rearrangement method without entropy encoding / decoding the index of the residual signal rearrangement method. Columns (1) to (4) of the residual signal rearrangement methods can refer to (1) no flipping, (2) horizontal flipping, (3) vertical flipping, and (4) horizontal and vertical flipping, respectively. Furthermore, the numbers 0, 1, 10, 11, 110, 111, etc., can be the result of binarization / debinarization for entropy coding / decoding of the residual signal rearrangement method. Fixed-length codes, truncated unary codes, unary codes, etc., can be used as binarization / debinarization methods. As shown in Table 1, when the current block corresponds to at least one of the prediction mode and the intra-frame prediction mode (direction), at least one rearrangement method is used in the encoder and decoder. Here, the diagonal direction at a 45-degree angle can represent a direction towards the upper left position in the current block or a direction from the upper left position in the current block towards the current block.

[0533] [Table 2]

[0534]

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

[0536] [Table 3]

[0537]

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

[0539] [Table 4]

[0540]

[0541] 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 decoder. For example, when the current block is in intra-prediction mode and the intra-prediction direction is even, at least one of the non-flip, horizontal flip, and vertical flip methods is used as the residual signal rearrangement method. Furthermore, when the current block is in intra-prediction mode and the intra-prediction direction is odd, at least one of the non-flip, vertical flip, horizontal and vertical flip methods is used as the residual signal rearrangement method.

[0542] [Table 5]

[0543]

[0544] 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 (direction), at least one rearrangement method is used in the encoder and decoder.

[0545] [Table 6]

[0546]

[0547]

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

[0549] [Table 7]

[0550]

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

[0552] [Table 8]

[0553]

[0554] 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 (direction), at least one rearrangement method is used in the encoder and decoder.

[0555] [Table 9]

[0556]

[0557] 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 (direction), at least one rearrangement method is used in the encoder and decoder.

[0558] [Table 10]

[0559]

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

[0561] [Table 11]

[0562]

[0563] 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 (direction), at least one rearrangement method is used in the encoder and decoder.

[0564] [Table 12]

[0565]

[0566]

[0567] 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 (direction), at least one rearrangement method is used in the encoder and decoder.

[0568] [Table 13]

[0569]

[0570] 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 (direction), at least one rearrangement method is used in the encoder and decoder. Here, the residual signal rearrangement method can represent the type of transform. For example, when the residual signal rearrangement method is (1), both the horizontal transform and the vertical transform represent the first transform kernel. As another example, when the residual signal rearrangement method is (2), the horizontal transform and the vertical transform represent the second transform kernel and the first transform kernel, respectively. As another example, when the residual signal rearrangement method is (3), the horizontal transform and the vertical transform represent the first transform kernel and the second transform kernel, respectively. As another example, when the residual signal rearrangement method is (4), the horizontal transform and the vertical transform represent the second transform kernel and the second transform kernel, respectively. For example, the first transform kernel can be DST-7, and the second transform kernel can be DCT-8. When the intra-prediction mode is a planar mode or a DC mode, truncated unary codes based on the occurrence probability are used for entropy coding / decoding of information about the four rearrangement methods (rearrangement method information). When the intra-frame prediction direction is a horizontal or near-horizontal pattern, the probability of rearrangement method (1) and / or rearrangement method (3) is high. In this case, one bit can be used for each of the two rearrangement methods, and entropy coding / entropy decoding can be performed on the information about the rearrangement method. Here, a near-horizontal pattern can mean that the value of a specific pattern is between the value of the horizontal pattern -K and the value of the horizontal pattern +K. Here, K can be an integer. For example, when the value of the horizontal pattern is 18 and K is 4 and the specific pattern is 20, the specific pattern is a near-horizontal pattern. For example, when the value of the horizontal pattern is 18 and K is 4 and the specific pattern is 26, the specific pattern is not a near-horizontal pattern.

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

[0572] When the intra-frame prediction direction is a diagonal direction at a 45-degree angle or a diagonal direction close to a 45-degree angle, 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 the method can be used implicitly without sending information about the rearrangement method via signal transmission. Here, the meaning of a diagonal direction close to a 45-degree angle can be that the value of a specific mode is between the value of the diagonal direction mode at a 45-degree angle -K and the value of the diagonal direction mode at a 45-degree angle +K. Here, K can be an integer. For example, when the value of the diagonal direction mode at a 45-degree angle is 34 and K is 2 and the specific mode is 36, the specific mode is a diagonal direction mode close to a 45-degree angle. For example, when the value of the diagonal direction mode at a 45-degree angle is 34 and K is 8 and the specific mode is 10, the specific mode is not a diagonal direction mode close to a 45-degree angle.

[0573] When the intra-frame prediction mode is even, the information entropy encoding / entropy decoding of the rearrangement method is converted into a truncated unary code or a unary code only for the rearrangement methods (1), (2) and (3).

[0574] When the intra-frame prediction mode is odd, the information entropy encoding / entropy decoding of the rearrangement method is converted into a truncated unary code or a unary code only for the rearrangement methods (1), (3) and (4).

[0575] For other intra-frame prediction directions, the probability of the rearrangement method (4) is low. Therefore, only for the rearrangement methods (1), (2) and (3), the information entropy encoding / entropy decoding of the rearrangement method is converted into truncated unary codes or unary codes.

[0576] In the case of inter-frame prediction, the probability of occurrence of rearrangement methods (1) to (4) is considered to be the same, and the information entropy encoding / entropy decoding of the rearrangement method can be converted into a two-bit fixed-length code.

[0577] Arithmetic encoding / decoding can be used for the code. Furthermore, arithmetic encoding using a context-based model for the code may not be used, and entropy encoding / decoding can be performed in a bypass mode.

[0578] The DST-7 transform / inverse transform can be performed on a region or CTU within a frame, the entire frame, or the current block within a frame group without flipping, or the transform / inverse transform can be performed by choosing one of two methods using DCT-2. In this case, a one-bit flag (transform mode information) indicating whether DST-7 or DCT-2 is used on a current block basis can be entropy encoded / decoded. This method can be used when the energy of the residual signal increases with the distance from the reference sample, or to reduce the computational complexity in encoding and decoding. Information about the region using this method can be transmitted by signal on a CTU, strip, PPS, SPS, or other specific region basis, and a one-bit flag can be transmitted by signal in an on / off manner.

[0579] For a region or CTU within a frame, the entire frame, or the current block within a frame group, a transform / inverse transform can be performed by selecting one of three methods: DCT-2 transform / inverse transform, DST-7 transform / inverse transform without flipping, and DST-7 transform / inverse transform after vertical flipping. Information about which of the three methods will be selected can be implicitly selected using the proximity information of the current block, or explicitly selected by sending an index (transformation mode information or flipping method information) using signals. The index can be sent as a truncated unary code with DCT-2 set to 0, DST-7 set to 10 without flipping, and DST-7 set to 11 after vertical flipping. Furthermore, the binarization of DCT-2 and DST-7 can be swapped for signal transmission depending on the size of the current block and the proximity information. Additionally, the first binary number of a binary number can be sent using signals at the CU level, and the remaining binary numbers can be sent using signals at the TU or PU level. Information about the area using the method can be transmitted by signal in units of CTU, strip, PPS, SPS or other specific areas, and a one-bit flag can be transmitted by signal in an on / off manner.

[0580] For a region or CTU within a frame, the entire frame, or the current block within a frame group, a transform / inverse transform can be performed by selecting one of four methods: DCT-2 transform / inverse transform, DST-7 transform / inverse transform without flipping, DST-7 transform / inverse transform after horizontal flipping, and DST-7 transform / inverse transform after vertical flipping. Information about which of the four methods will be selected can be implicitly selected using the proximity information of the current block, or explicitly selected by sending an index (transformation mode information or flipping method information) using a signal. The index can be sent as a truncated unary code with DCT-2 set to 0, DST-7 without flipping set to 10, DST-7 after horizontal flipping set to 110, and DST-7 after vertical flipping set to 111. Furthermore, the binarization of DCT-2 and DST-7 can be swapped for signal transmission depending on the size of the current block and the proximity information. Furthermore, the first binary digit of a binary number can be transmitted using a CU as the unit, and the remaining binary digits can be transmitted using a TU or PU as the unit. Depending on the intra-prediction mode, only a portion of the four methods may be used. For example, when the intra-prediction mode is numerically smaller than the diagonal prediction mode, is DC mode, or is a planar mode, only three methods are used: DCT-2, DST-7 without flipping, and DST-7 after vertical flipping. In this case, the transformation mode information or flipping method information can be transmitted using a signal with DCT-2 as 0, DST-7 without flipping as 10, and DST-7 after vertical flipping as 11. Similarly, when the intra-prediction mode is numerically larger than the diagonal prediction mode, only three methods are used: DCT-2, DST-7 without flipping, and DST-7 after horizontal flipping. In this case, the transformation mode information or flipping method information can be transmitted using a signal with DCT-2 as 0, DST-7 without flipping as 10, and DST-7 after horizontal flipping as 11. Information about the area using the method can be transmitted by signal in units of CTU, strip, PPS, SPS or other specific areas, and a one-bit flag can be transmitted by signal in an on / off manner.

[0581] For a region or CTU within a frame, the entire frame, or the current block within a frame 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 horizontal flipping, DST-7 transform / inverse transform after vertical flipping, and DST-7 transform / inverse transform after both horizontal and vertical flipping. Information about which of the five methods will be selected can be implicitly used from the proximity information of the current block, or explicitly selected by sending an index (transformation mode information or flipping method information) using a signal. The index can be sent as a truncated unary code with DCT-2 set to 0, DST-7 without flipping set to 10, DST-7 after horizontal flipping set to 110, DST-7 after vertical flipping set to 1110, and DST-7 after both horizontal and vertical flipping set to 1111. Furthermore, based on the current block size and proximity information, the binarization of DCT-2 and DST-7 can be swapped for signal transmission. Additionally, the first binary number in the binary number can be transmitted signaled in units of CU, and the remaining binary numbers can be transmitted signaled in units of TU or PU. Furthermore, information can be transmitted as a fixed-length code by distinguishing between the binary numbers (first binary number, second binary number, and third binary number). For example, transformation mode information or flipping method information can be transmitted signaled with DCT-2 as 0, DST-7 without flipping as 000, DST-7 after horizontal flipping as 001, DST-7 after vertical flipping as 010, and DST-7 after both horizontal and vertical flipping as 011. Furthermore, depending on the intra-frame prediction mode, only a portion of the five methods can be used. For example, when the intra-frame prediction mode is a prediction mode close to the horizontal prediction mode, only three transformation methods are used: DCT-2, DST-7 without flipping, and DST-7 after vertical flipping. In this case, the transformation mode information or flipping method information can be sent by signaling with DCT-2 as 0, DST-7 as 10 without flipping, and DST-7 as 11 after vertical flipping.

[0582] For example, when the intra-frame prediction mode is close to the vertical prediction mode, only three transformation methods are used: DCT-2, DST-7 without flipping, and DST-7 after horizontal flipping. In this case, the transformation mode information or flipping method information can be transmitted by signaling with DCT-2 as 0, DST-7 without flipping as 10, and DST-7 after horizontal flipping as 11.

[0583] For example, when the intra-frame 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 transmitted by signaling with DCT-2 and DST-7 without flipping set to 1.

[0584] For example, in cases other than the three mentioned above, 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 both horizontal and vertical flipping. The index used for the transformation method can be sent as a truncated unary code scheme, a fixed-length code scheme, or other schemes.

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

[0586] For example, when the intra-frame prediction mode is an odd-numbered mode, four transformation methods are used: DCT-2, DST-7 without flipping, DST-7 after vertical flipping, and DST-7 after both horizontal and vertical flipping. In this case, the transformation mode information or flipping method information can be transmitted by signaling with DCT-2 as 0, DST-7 without flipping as 10, DST-7 after vertical flipping as 110, and DST-7 after both horizontal and vertical flipping as 111.

[0587] For example, when the intra-frame prediction mode is an even-numbered 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, transformation mode information or flipping method information can be transmitted via signaling with DCT-2 as 0, DST-7 without flipping as 10, DST-7 after horizontal flipping as 110, and DST-7 after vertical flipping as 111. Information about the area using this method can be transmitted via signaling in units of CTU, strip, PPS, SPS, or other specific areas, and a one-bit flag can be transmitted via signaling in an on / off manner.

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

[0589] Reference Figure 22In the encoder, residual signal rearrangement can be performed before DST-7 conversion processing. Although in Figure 22 Although not shown in the figure, in the encoder, residual signal rearrangement can be performed between the transformation process and the quantization process, or residual signal rearrangement can be performed after quantization.

[0590] Reference Figure 23 In the decoder, residual signal rearrangement can be performed after the DST-7 inverse transform processing. Although in Figure 23 Although not shown in the diagram, residual signal rearrangement can be performed between dequantization and inverse transform processing in the decoder, or it can be performed before dequantization.

[0591] The above has been referred to Figures 7 to 23 The SDST method according to the present invention is described. Hereinafter, reference will be made to... Figure 24 and Figure 25 The decoding method, encoding method, decoder, encoder, and bitstream using the SDST method according to the present invention are described in detail.

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

[0593] Reference Figure 24 First, in step S2401, the transformation mode of the current block can be determined. In step S2402, the residual data of the current block can be inversely transformed according to the transformation mode of the current block.

[0594] Next, in step S2403, the residual data of the current block that has undergone inverse transformation according to the transformation mode of the current block can be rearranged.

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

[0596] The SDST mode indicates a mode that performs an inverse transformation according to the DST-7 transformation mode and rearranges the residual data after the inverse transformation.

[0597] The SDCT mode indicates a mode that performs an inverse transformation according to the DCT-2 transformation mode and rearranges the residual data that has undergone the inverse transformation.

[0598] The DST mode indicates a mode that performs an inverse transformation according to the DST-7 transformation mode and does not perform a rearrangement of the residual data that has already undergone the inverse transformation.

[0599] The DCT mode can indicate a mode that performs an inverse transformation according to the DCT-2 transformation mode and does not perform a rearrangement on the residual data that has already undergone the inverse transformation.

[0600] Therefore, the rearrangement of residual data is only performed if the transformation mode of the current block is either SDST or SDCT.

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

[0602] Meanwhile, determining the transformation mode of the current block in step S2401 may include: obtaining the transformation mode information of the current block from the bit stream; and determining the transformation mode of the current block based on the transformation mode information.

[0603] Furthermore, in determining the transformation mode of the current block in step S2401, the determination can be 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.

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

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

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

[0607] (2) Scan from top row to bottom row, and scan from right to left within a row.

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

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

[0610] (5) Scan from the left column to the right column, and scan from top to bottom in a column.

[0611] (6) Scan from the left column to the right column, and scan from bottom to top in a column.

[0612] (7) Scan from the right column to the left column, and scan from top to bottom in a column.

[0613] (8) Scan from the right column to the left column, and scan from bottom to top in a column.

[0614] (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.

[0615] Furthermore, regarding the order of the second direction, one of the aforementioned directions may be used selectively. The first and second directions may be the same or different from each other.

[0616] Furthermore, in the rearrangement of the residual data of the current block that has undergone inverse transformation in step S2403, the rearrangement is performed on a sub-block basis within the current block. In this case, the residual data can be rearranged based on the position of the sub-blocks within the current block. Since the rearrangement of residual data based on the position of sub-blocks has already been described in detail in Equation 6 above, a repeating description will be omitted.

[0617] Furthermore, in the rearrangement of the inverse-transformed residual data of the current block in step S2403, the inverse-transformed residual data arranged in the current block can be rotated according to a predefined angle for rearrangement.

[0618] Furthermore, in the rearrangement of the inverse-transformed residual data of the current block in step S2403, the inverse-transformed residual data arranged within the current block can be inverted for rearrangement according to the inversion method. In this case, determining the transformation mode of the current block in step S2401 may include: obtaining inversion method information from the bit stream; and determining the inversion method for the current block based on the inversion method information.

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

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

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

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

[0623] Here, the transform mode may include at least one of the rearranged discrete sine transform (SDST), rearranged discrete cosine transform (SDCT), discrete sine transform (DST), and discrete cosine transform (DCT). Since already referenced... Figure 24 SDST, SDCT, DST, and DCT have been described, so repeated descriptions will be omitted.

[0624] Additionally, residual data rearrangement is performed only if the current block's transformation mode is either SDST or SDCT.

[0625] Furthermore, in determining the transformation mode of the current block in step S2501, the determination can be 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.

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

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

[0628] Furthermore, in the rearrangement of the residual data of the current block in step S2502, the rearrangement is performed on a per-sub-block basis within the current block.

[0629] In this case, during 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-blocks within the current block.

[0630] Meanwhile, in the rearrangement of the residual data of the current block in step S2502, the residual data arranged in the current block can be rotated according to a predefined angle for rearrangement.

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

[0632] The image decoder using the SDST method according to the present invention may include an inverse transform module, wherein the inverse transform module determines a transform mode for the current block, performs an inverse transform on the residual data of the current block according to the transform mode of the current block, and performs a rearrangement on the residual data of the current block that has undergone an inverse transform according to the transform mode of the current block. 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).

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

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

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

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

[0637] Figures 26 to 31 An example is shown of the location where the flipping method is performed in the encoder and decoder according to the invention.

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

[0639] Figure 27 This is a diagram illustrating an embodiment of the decoding process in a method that performs a flip after an inverse transformation.

[0640] Reference Figure 26 The inter-frame or intra-frame prediction signal is subtracted from the original signal of the current block to generate a residual signal. Then, one of the following transformation methods can be selected: DCT-2 transform, flip, or DST-7 transform. When the transformation method is DCT-2 transform, the residual signal is transformed using DCT-2 transform to generate transform coefficients. When the transformation method is flip and DST-7 transform, one of four flip methods (no flip, horizontal flip, vertical flip, and horizontal and vertical flip) is selected to flip the residual signal. Then, DST-7 transform is used to transform the flipped residual signal to generate transform coefficients. Quantization levels are generated by quantizing the transform coefficients.

[0641] Reference Figure 27 The system receives quantized levels to perform inverse quantization, thereby generating transform coefficients. A method corresponding to the one selected in the encoding process and corresponding to either the DCT-2 inverse transform or the DST-7 inverse transform and flipping can be selected. That is, when a DCT-2 transform is performed in the encoding process, a DCT-2 inverse transform is performed in the decoding process. Furthermore, when a flipping and DST-7 transform method is performed in the encoding process, a DST-7 inverse transform and flipping are performed in the decoding process. When the inverse transform method is DCT-2 inverse transform, the transform coefficients are inversely transformed using the DCT-2 inverse transform, thereby generating the reconstructed residual signal. When the inverse transform method is DST-7 inverse transform and flipping, the residual coefficients are inversely transformed using the DST-7 inverse transform to generate the reconstructed residual signal. Subsequently, one of four flipping methods (no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) is selected to flip the reconstructed residual signal, thereby generating a flipped reconstructed residual signal. The inter-frame or intra-frame prediction signal is added to the reconstructed residual signal or the flipped reconstructed residual signal to generate the reconstructed signal.

[0642] Figure 28 This is a diagram illustrating an embodiment of the encoding process in a method that performs a flip after a transformation.

[0643] Figure 29 This is a diagram illustrating an embodiment of the decoding process in a method that performs an inverse transformation after flipping.

[0644] Reference Figure 28The inter-frame or intra-frame prediction signal is subtracted from the original signal of the current block to generate a residual signal. Then, one of the following transformation methods can be selected: DCT-2 transform, DST-7 transform, or flipping. When the transformation method is DCT-2 transform, the residual signal is transformed using DCT-2 transform to generate transform coefficients. When the transformation method is DST-7 transform and flipping, the residual signal is transformed using DST-7 transform. Subsequently, one of four flipping methods (no flipping, horizontal flipping, vertical flipping, and horizontal and vertical flipping) is selected to flip the transform coefficients, resulting in flipped transform coefficients. Quantization levels are generated by quantizing the transform coefficients or the flipped transform coefficients. When flipping the transform coefficients, a rearrangement of the transform coefficients is performed. The rearrangement method can be the same as the flipping method, a method that performs a second transform to rotate the axis at the zeros of the transform base, a method that swaps the signs of the transform coefficients, etc.

[0645] Reference Figure 29 The system receives quantized levels to perform inverse quantization, thereby generating transform coefficients. A method corresponding to the one selected in the encoding process and corresponding to either DCT-2 inverse transform or flip and DST-7 inverse transform can be selected. That is, when a DCT-2 transform is performed in the encoding process, a DCT-2 inverse transform is performed in the decoding process. When a DST-7 transform and flip method are performed in the encoding process, a flip and DST-7 inverse transform are performed in the decoding process. When the inverse transform method is DCT-2 inverse transform, the transform coefficients are inversely transformed using the DCT-2 inverse transform, thereby generating the reconstructed residual signal. When the inverse transform method is flip and DST-7 inverse transform, one of four flip methods (no flip, horizontal flip, vertical flip, and horizontal and vertical flip) is selected to flip the transform coefficients. Subsequently, a DST-7 inverse transform is performed to inversely transform the flipped transform coefficients, thereby generating the reconstructed residual signal. The inter-frame or intra-frame prediction signal is added to the reconstructed residual signal to generate the reconstructed signal.

[0646] Figure 30 This is a diagram illustrating an embodiment of the encoding process in a method that performs a flip after quantization.

[0647] Figure 31 This is a diagram illustrating an embodiment of the decoding process in a method that performs dequantization after inversion.

[0648] Reference Figure 30The inter-frame or intra-frame prediction signal is subtracted from the original signal of the current block to generate a residual signal. Then, one of the DCT-2 transform and DST-7 transform can be selected as the transform method. When the transform method is DCT-2, the residual signal is transformed using DCT-2 to generate transform coefficients. When the transform method is DST-7, the residual signal is transformed using DST-7 to generate transform coefficients. Quantization levels are generated by quantizing the transform coefficients. Furthermore, when the transform method is DST-7, one of four flipping methods (no flip, horizontal flip, vertical flip, and horizontal and vertical flip) is selected to flip the quantized levels, resulting in flipped quantized levels. Additionally, when flipping the quantized levels, a rearrangement of the quantized levels is performed. The rearrangement method can be the same as the flipping method, a method of performing a second transform to rotate the axis at the zeros of the transform base, a method of swapping the positive and negative signs of the quantized levels, etc.

[0649] Reference Figure 31 The system receives the quantized levels and selects an inverse transform method corresponding to the method chosen in the encoding process and corresponding to the DCT-2 inverse transform and DST-7 inverse transform. That is, when a DCT-2 transform is performed in the encoding process, a DCT-2 inverse transform is performed in the decoding process. Similarly, when a DST-7 transform is performed in the encoding process, a DST-7 inverse transform is performed in the decoding process. When the inverse transform method is DCT-2 inverse transform, the quantized levels are dequantized to generate transform coefficients, and then the transform coefficients are inversely transformed using DCT-2 inverse transform to generate the reconstructed residual signal. When the inverse transform method is DST-7 inverse transform, one of four flipping methods (no flip, horizontal flip, vertical flip, and horizontal and vertical flip) is selected to flip the quantized levels, and then the flipped quantized levels are dequantized to generate transform coefficients. The transform coefficients are inversely transformed using DST-7 inverse transform to generate the reconstructed residual signal. The inter-frame or intra-frame prediction signal is added to the reconstructed residual signal to generate the reconstructed signal.

[0650] At the same time, the position for performing the flipping method in the decoder can be determined based on the information about the flipping position sent from the encoder by the signal.

[0651] Figure 32 This is a diagram showing the flipping of the residual block.

[0652] Reference Figure 32 It can perform at least one of the following on the residual block: "no flip", "horizontal flip", "vertical flip", and "horizontal and vertical flip". For example... Figure 32 As shown, the position of the sample point within the residual block can change depending on the flipping type.

[0653] Figure 33 This is a diagram illustrating an embodiment of a hardware implementation for performing a flip on an 8×8 size residual block.

[0654] Reference Figure 33 In the hardware implementation of vertical flipping of an M×N residual block, the vertical flip is performed on the M×N block by changing the address value (addr) used to read data from the residual block memory to M-1-addr. In other words, instead of a vertical flip operation, the memory row address used for the M×N block is changed to read data from the residual block, thereby achieving vertical flipping.

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

[0656] Figure 34 This is a diagram showing the flipping and transformation performed on the residual block.

[0657] Reference Figure 34 It can perform at least one of "No-Flip", "H-Flip", "V-Flip", and "HV-Flip" on the residual block, and can perform DST-7 transformation. Figure 34 As shown, the position of the sample points within the residual block can be changed according to the flip type, and DST-7 transformation can be performed.

[0658] The following is an example of using the Adaptive Multiple Transformation (AMT) method, in which at least one of the transformations used in the specification is employed.

[0659] An AMT set can be constructed using at least one of the transforms used in the specification. For example, in addition to transforms such as DCT-2, DCT-5, DCT-8, DST-1, DST-7, etc., at least one transform for each block 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 blocks used in inter-frame encoding / decoding, and KLT-1 and KLT-2 can be added to the AMT transform set for blocks used in intra-frame encoding / decoding.

[0660] Transforms corresponding to blocks of sizes such as 4×24 and 8×48 that are not powers of 2 can be added. For example, in intra-frame encoding / decoding processing, seven transform sets, each with four transform pairs, can be defined as shown in Table 14 below.

[0661] [Table 14]

[0662]

[0663] In Table 14, the first item of a transform pair can represent the transform in the vertical direction, and the second item can represent the transform in the horizontal direction. The transform pair sets in Table 14 can be defined by allocating each of the seven transform sets based on different intra-prediction modes and different block sizes. In Table 14, T0 to T6 can represent the available transform pair sets corresponding to various block sizes. For example, T0 can be used for 2×2 block sizes, T1 for 4×4 block sizes, T2 for 8×8 block sizes, T3 for 16×16 block sizes, T4 for 32×32 block sizes, T5 for 64×64 block sizes, and T6 for 128×128 block sizes. Identification transforms can be applied to blocks with sizes not exceeding 16×16. Furthermore, identification transforms can be applied to blocks according to patterns close to the horizontal and vertical intra-prediction directions. Patterns close to the horizontal and / or vertical intra-prediction directions can be defined as thresholds based on the block size. For example, when the transform index is 3 and the block meets the above conditions, horizontal and / or vertical identification transforms are applied. Meanwhile, in inter-frame encoding / decoding processing, two transform sets, each with four transform pairs, can be defined as shown in Table 15 below.

[0664] [Table 15]

[0665]

[0666] In Table 15, T0 and T1 can represent the set of available transformation pairs corresponding to the block size. For example, in Table 15, the set of transformations including KLT (i.e., T0 and T1) can be represented. 1,帧间 ) Applicable to blocks with a size equal to or less than 16×16, and can be T 0,帧间 Applicable to blocks larger than 16×16.

[0667] Furthermore, an AMT transform can be approximated using only the DCT-2 transform and adjustment steps. The adjustment steps can be defined using a block-band orthogonal matrix to transform the DCT-2 transform into a form similar to the AMT transform.

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

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

[0670] [Table 16]

[0671]

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

[0673] Furthermore, 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 transform index information (AMT index) is not sent to the decoder via a signal.

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

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

[0676] [Equation 7]

[0677] Flipped DST-7:

[0678] DST-6:

[0679] here, Let l represent the l-th component of the k-th fundamental vector in the N×N transformation matrix of DST-7.

[0680] Furthermore, AMT transformations, including transformation matrices of DCT-8, DST-1, and DCT-5, can be applied to both the luminance and chrominance components.

[0681] The transformation used for the luminance component can be determined based on the transformation set according to the pattern and the explicit AMT index of the signal transmission indicating the horizontal and vertical transformations.

[0682] In the case of chroma component / intra-frame mode, the transform can be determined in the same way as the transform used for the luma component, but the number of transform candidates can be less than the number of transform candidates used for the luma component.

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

[0684] Furthermore, AMT can select between horizontal and vertical transforms in DCT-2, DST-7, and flipped DST-7 (FDST-7). Additionally, 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 the other transform is used based on the AMT index. AMT is only allowed when the block width and height are both equal to or less than 64. The AMT flag can be determined by the intra-prediction mode. In even-numbered intra-prediction modes, the AMT flag can be implicitly assigned to 1. In odd-numbered intra-prediction modes, the AMT flag can be implicitly assigned to 0.

[0685] A transform set with two additional transforms, DST-7 and DCT-8, can be used, and the maximum block size for applying AMT can be limited to 32×32. A forward N×N DST-7 with a Discrete Fourier Transform (DFT) of length 2N+1 can be implemented to obtain an N×N DST-7. A 2N+1 FFT can be constructed as a two-dimensional FFT. DCT-8 can be derived from DST-7 immediately before and after DST-7 computation through sign changes and reordering. Therefore, DST-7 can be reused to implement DCT-8.

[0686] The transform or inverse transform is performed only on sub-blocks within the current block. For example, a sub-block could be the one located at the top left of the current block. The horizontal (width) and vertical (height) length of a sub-block can be determined independently. For example, the horizontal (width) length (or vertical (height) length) can be determined based on the type of transform kernel applied to the horizontal or inverse transform (or vertical or inverse transform). For example, when the transform kernel applied to the horizontal or inverse transform is DCT-2, the horizontal length (width) is 32 samples. For example, when the transform kernel applied to the horizontal 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 or inverse transform is DCT-2, the vertical length (height) is 32 samples. For example, when the transform kernel applied to the vertical or inverse transform is not DCT-2 but, for example, DST-7 or DCT-8, the vertical length (height) is 16 samples. Furthermore, since a 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 to which the transform or inverse transform has been performed is determined as the length of the current block. The transform or inverse transform may not be performed on samples within the current block that are not included in the sub-block. All sample values ​​of a sample may be set to "0". Here, the sub-block may include the residual signal as the difference between the input signal and the predicted signal, or it may include transform coefficients obtained from the transform of the residual signal.

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

[0688] The transformation of the luminance and chrominance components based on the intra-frame prediction mode can be represented as shown in Tables 17 and 18 below.

[0689] [Table 17]

[0690]

[0691] [Table 18]

[0692]

[0693] Here, Table 17 shows the transformation mapping table for the luminance component, and Table 18 shows the transformation mapping table for the chrominance component. Furthermore, position-based transformations can be used for the residual signal in merging mode. The transformation used for the residual signal in merging mode can be changed based on the spatial motion vector predictor (MVP) candidate used for motion compensation of the current block.

[0694] Table 19 below shows the mapping between MVP positions and transformations.

[0695] [Table 19]

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

[0697] In Table 19, for the left-hand MVP candidate, DST-7 and DCT-2 can be used as horizontal and vertical transforms, respectively. Similarly, for the upper-hand MVP candidate, DCT-2 and DST-7 can be used as horizontal and vertical transforms, respectively. In other cases, DCT-2 can be used as the default transform. Entropy encoding / decoding can be performed on transform usage information that combines AMT transform usage information, primary transform usage information, inseparable secondary transform (NSST) usage information, and secondary transform usage information. Instead of independently sending the primary transform index and secondary transform index as signals, the use of AMT and NSST can be represented by a single transform index. A single transform index can be used to combine the primary and secondary transforms for signal transmission. Furthermore, the combined transform index can be used for both the luma and chroma components.

[0698] Furthermore, the transforms used in the specification can be selected from a predefined set of N transform candidates for each block. Here, N can be a positive integer. Each transform candidate 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 be changed according to the block size and prediction mode. The selected transforms can be signaled as follows: When the coded 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: if the number of non-zero transform coefficient levels is greater than a threshold, the transform index of the transform candidate to be used is sent; otherwise, the second transform in the list is used.

[0699] Furthermore, NSST is used as a secondary transform only when DCT-2, as the primary transform, is used as the default transform. Additionally, regarding horizontal or vertical transforms, DST-7 is selected without signal transmission when the width or height is equal to or less than 4, respectively.

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

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

[0702] Instead of performing a flipping method on the residual signal, a flipped transform kernel or transform matrix can be used to perform the transform / inverse transform. Here, the flipped transform / inverse transform kernel or transform / inverse transform matrix can be a kernel or matrix that has already been flipped and is predefined in the encoder / decoder. In this case, since the flipped transform / inverse transform matrix is ​​used to perform the transform / inverse transform, the same effect as flipping the residual signal can be obtained. Here, the flipping can be no flipping, horizontal flipping, vertical flipping, or at least one of horizontal and vertical flipping. In this case, information about whether the flipped transform / inverse transform has been used can be sent via a signal. Furthermore, information about whether the flipped transform / inverse transform has been used can be sent via a signal for each of the horizontal and vertical transform / inverse transforms.

[0703] Furthermore, instead of performing a flipping method on the residual signal, the transform kernel or transform matrix can be flipped during the encoding / decoding process to perform a transform / inverse transform. In this case, since the transform / inverse transform matrix is ​​flipped to perform the transform / inverse transform, the same effect as performing a flip on the residual signal can be obtained. Here, the flipping can be no flipping, horizontal flipping, vertical flipping, or at least one of horizontal and vertical flipping. In this case, information about whether a flipping has been performed on the transform / inverse transform matrix can be sent using a signal. Furthermore, information about whether a flipping has been performed on the transform / inverse transform matrix can be sent using a signal for each of the horizontal and vertical transform / inverse transforms.

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

[0705] Furthermore, when a flipping method is determined based on the intra-prediction mode and two or more intra-prediction modes for the current block are used, the flipping method, which is the dominant direction mode, is performed before / after the transform / inverse transform of the current block. Here, the dominant direction mode can be at least one of the vertical mode, the horizontal mode, and the diagonal mode.

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

[0707] To reduce memory requirements, the transform coefficients generated after the transformation can be right-shifted by K. Additionally, the temporary transform coefficients generated after the horizontal transformation can be right-shifted by K. Furthermore, the temporary transform coefficients generated after the vertical transformation can be right-shifted by K. Here, K is a positive integer.

[0708] To reduce memory requirements, the reconstructed residual signal generated after the inverse transform can be right-shifted by K. Furthermore, the temporary transform coefficients generated after the horizontal inverse transform can be right-shifted by K. Additionally, the temporary transform coefficients generated after the vertical inverse transform can be right-shifted by K. Here, K is a positive integer.

[0709] At least one of the following flipping methods can be performed on at least one of the signals generated before, after, and during the horizontal / inverse transformation, respectively, and after the vertical / inverse transformation. In this case, information about the flipping method used in the horizontal or vertical transformation can be transmitted via a signal.

[0710] Furthermore, DCT-4 can be used instead of DST-7. A 2N-1 size DCT-4 transform / inverse transform matrix is ​​extracted from a 2N-size DCT-2 transform / inverse transform matrix for use, such that only the DCT-2 transform / inverse transform matrix is ​​stored in the encoder / decoder without storing the DCT-4, thereby reducing the encoder / decoder's memory requirements. Furthermore, utilizing a 2N-1 size DCT-4 transform / inverse transform matrix logic from a 2N-size DCT-2 transform / inverse transform matrix reduces the chip area required to implement the encoder / decoder. Here, the above examples apply not only to DCT-2 and DCT-4, but also to situations where 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 exists. That is, from one transform / inverse transform matrix or logic, another transform / inverse transform matrix or logic can be extracted for use. Furthermore, given 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. Furthermore, from a transformation / inverse transformation matrix, another transformation / inverse transformation matrix can be extracted according to at least one of the matrix elements, basic vector elements, and matrix coefficient elements.

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

[0712] Furthermore, at least one of the transformations of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc., used in the specification can be replaced by at least one of the transformations calculated based on DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. Here, the calculated transformation can be one obtained by modifying the coefficient values ​​within the transformation matrices of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. Furthermore, the coefficient values ​​within the transformation matrices of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc., can have integer values. That is, the transformations of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc., can be integer transformations. Furthermore, the coefficient values ​​within the calculated transformation matrix can have integer values. That is, the calculated transformation can be an integer transformation. Furthermore, the calculated transformation can be the result of left-shifting the coefficient values ​​within the transformation matrices of DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc., by N. Here, N can be a positive integer.

[0713] The DCT-Q and DST-W transforms can be represented by the DCT-Q and DST-W transforms as well as their inverses. Here, Q and W can be positive integers of one or greater, and for example, the numbers 1 to 9 can have the same meaning as the Roman numerals I to IX.

[0714] Furthermore, the DCT-4, DCT-8, DCT-2, DST-4, DST-1, DST-7, etc. used in the specification are not limited to these, and at least one of the DCT-Q transform and DST-W transform can be used by substituting the transforms of DCT-4, DCT-8, DCT-2, DST-4, DST-1, and DST-7. Here, Q and W can be positive integers of one or greater, and for example, the numbers 1 to 9 can have the same meaning as the Roman numerals I to IX.

[0715] Furthermore, in the case of square blocks, the transformation used in the specification can be performed according to the square transformation form. In the case of non-square blocks, the transformation can be performed according to the non-square transformation form. In the case of a square-shaped region that includes at least one of square blocks and non-square blocks, the transformation of that region can be performed according to the square transformation form. In the case of a non-square-shaped region that includes at least one of square blocks and non-square blocks, the transformation of that region can be performed according to the non-square transformation form.

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

[0717] Furthermore, the transformations used in the specification may represent at least one of the transformation and the inverse transformation.

[0718] The encoder can perform a transform on the residual block to generate transform coefficients, quantize the transform coefficients to generate quantized coefficient levels, and entropy encode the quantized coefficient levels to improve the subjective / objective image quality of the image.

[0719] The decoder can perform entropy decoding on the quantized coefficient levels, dequantize the quantized coefficient levels to generate transform coefficients, and perform inverse transform on the transform coefficients to generate reconstructed residual blocks.

[0720] Entropy encoding / decoding can be performed explicitly on transform type information regarding which transform is used as the transform and its inverse. Alternatively, transform type information regarding which transform is used as the transform and its inverse can be determined implicitly based on at least one of the encoded coefficients, without performing entropy encoding / decoding on the transform type information.

[0721] The following describes embodiments of the image encoding / decoding method and apparatus for performing at least one of the transformations or inverse transformations, as well as the recording medium for storing bit streams, according to the present invention.

[0722] Using at least one of the following embodiments, a block can be partitioned into N sub-blocks, and at least one of prediction, transform / inverse transform, quantization / dequantization, or entropy coding / entropy decoding can 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).

[0723] A block can represent a coded block, a prediction block, or a transform block. For example, a block can be a transform block.

[0724] Furthermore, the partitioned sub-blocks can represent at least one of a coded block, a prediction block, or a transform block. For example, the partitioned sub-blocks can be transform blocks.

[0725] Furthermore, a sub-block derived from a block or partition can be at least one of an intra-block, an inter-block, or a copy of an intra-block. For example, a sub-block derived from a block or partition can be an intra-block.

[0726] Furthermore, the sub-blocks derived from a block or partition can be at least one of intra-prediction blocks, inter-prediction blocks, or intra-block copy prediction blocks. For example, the sub-blocks derived from a block or partition can be intra-prediction blocks.

[0727] Furthermore, the sub-blocks derived from a block or partition can be at least one of a luminance signal block or a chrominance signal block. For example, the sub-blocks derived from a block or partition can be luminance signal blocks.

[0728] When a block is partitioned into N sub-blocks, the block before partitioning can be a coding block, and the resulting sub-blocks can be at least one of a prediction block or a transform block. In other words, the size of the partitioned sub-blocks can be used to perform transform coefficient prediction, transform / inverse transform, quantization / dequantization, and entropy coding / entropy decoding.

[0729] Furthermore, when a block is partitioned into N sub-blocks, the block preceding the partition can be at least one of a coding block or a prediction block, and the resulting sub-blocks can be transform blocks. That is, the size of the block preceding the partition can be used to perform prediction, and the size of the resulting sub-blocks can be used to perform transform / inverse transform, quantization / dequantization, and entropy coding / decoding of the transform coefficients.

[0730] Whether to divide a block into multiple sub-blocks can be determined based on at least one of the block's area (the product of its width and height, etc.), size (width, height, or a combination of width and height), and shape / form (rectangle (not square), square, etc.).

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

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

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

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

[0735] As another example, when the current block is a 4x4 block, it is not necessary to divide the current block into multiple sub-blocks.

[0736] As another example, when the current block is a 2×4 block, it is not necessary to divide the current block into multiple sub-blocks.

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

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

[0739] As another example, when the area of ​​the current block is 256 and the shape of the current block is rectangular, the current block can be divided into multiple sub-blocks.

[0740] As another example, when the area of ​​the current block is 16 and the shape of the current block is a square, it is not necessary to divide the current block into multiple sub-blocks.

[0741] When partitioning a block, it can be divided into multiple sub-blocks according to at least one partitioning direction, either vertical or horizontal.

[0742] For example, the current block can be divided into two sub-blocks along the vertical direction.

[0743] As another example, the current block can be divided into two sub-blocks horizontally.

[0744] As another example, the current block can be divided into four sub-blocks horizontally.

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

[0746] When a block is divided into N sub-blocks, N can be a positive integer, and for example, it can be 2 or 4. Furthermore, N can be determined using at least one of the block's area, size, shape, or partitioning orientation.

[0747] For example, when the current block is a 4×8 or 8×4 block, it can be divided into two sub-blocks horizontally or vertically.

[0748] As another example, when the current block is a 16×8 or 16×16 block, the current block can be divided into four sub-blocks vertically or horizontally.

[0749] As another example, when the current block is an 8×32 or 32×32 block, the current block can be divided into four sub-blocks horizontally or vertically.

[0750] As another example, when the current block is a 16×4, 32×4, or 64×4 block, it can be divided into four sub-blocks vertically. Furthermore, when the current block is a 16×4, 32×4, or 64×4 block, it can be divided into two sub-blocks horizontally.

[0751] As another example, when the current block is a 4×16, 4×32, or 4×64 block, it can be divided into four sub-blocks horizontally. Furthermore, when the current block is a 4×16, 4×32, or 4×64 block, it can be divided into two sub-blocks vertically.

[0752] As another example, when the current block is a J×4 block, it can be divided into two sub-blocks horizontally. Here, J can be a positive integer.

[0753] As another example, when the current block is a 4×K block, it can be divided into two sub-blocks vertically. Here, K can be a positive integer.

[0754] As another example, when the current block is a J×K (K>4) block, it can be divided into four sub-blocks horizontally. Here, J can be a positive integer.

[0755] As another example, when the current block is a J×K (J>4) block, it can be divided into four sub-blocks vertically. Here, J can be a positive integer.

[0756] As another example, when the current block is a J×K (K>4) block, it can be divided into four sub-blocks vertically. Here, J can be a positive integer.

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

[0758] 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 divided into four sub-blocks in the vertical direction.

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

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

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

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

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

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

[0765] The encoding / decoding order of sub-blocks partitioned from a block can be determined based on at least one of the partitioning directions.

[0766] For example, the encoding / decoding order of the sub-blocks divided by a horizontal partition can be determined as an order from top to bottom.

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

[0768] For sub-blocks partitioned from the original block, intra-prediction modes can be shared and used.

[0769] At this point, within the block preceding the partition, information about the intra-prediction mode for each sub-block can be entropy encoded / entropy decoded only once.

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

[0771] At this point, within the block preceding the partition, information about the intra-block copying mode for each sub-block can be entropy-coded / entropy-decoded only once.

[0772] To indicate a sub-block partitioning pattern that divides a block into N sub-blocks and performs at least one of prediction, transform / inverse transform, quantization / dequantization, or entropy coding / entropy decoding on a sub-block basis, at least one of the sub-block partitioning pattern information or partitioning direction information can be entropy coded / entropy decoded.

[0773] Here, sub-block partitioning mode information can be used to indicate the sub-block partitioning mode. When indicating the use of a sub-block partitioning mode (second value), the block can be partitioned into sub-blocks and at least one of prediction, transform / inverse transform, quantization / dequantization, or entropy coding / decoding can be performed. When indicating the non-use of a 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 / dequantization, or entropy coding / decoding can be performed. Here, the first value can be 0, and the second value can be 1.

[0774] Furthermore, partitioning direction information can be used to indicate whether the sub-block partitioning mode is vertical or horizontal. When the partitioning direction information has a first value, the block can be partitioned into sub-blocks horizontally, and the first value can be 0. Conversely, when the partitioning direction information has a second value, the block can be partitioned into sub-blocks vertically, and the second value can be 1.

[0775] When the current block does not use the nearest reference sample line (the first reference sample line) as its reference sample line, entropy encoding / decoding of at least one of the sub-block partitioning mode information or partitioning direction information is not required. In this case, it can be inferred from the sub-block partitioning mode information that the current block has not been partitioned into sub-blocks.

[0776] Here, the fact that the current block does not use the nearest reference sample line (the first reference sample line) as the reference sample line means that the second reference sample line or a larger reference sample line can be used as the reconstruction reference line around the current block.

[0777] In other words, entropy encoding / entropy decoding can be performed on at least one of the sub-block partitioning mode information or partitioning direction information only when the current block uses the nearest reference sample line as the reference sample line.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0793] 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 to be at least one of 4×4 or 2×8.

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

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

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

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

[0798] For each sub-block from the partition, the code block flag indicating whether at least one transform coefficient with a non-zero value exists in the sub-block unit can be entropy encoded / entropy decoded.

[0799] For example, a coded block flag can indicate that at least one transform coefficient with a non-zero value exists in at least one sub-block within a sub-block unit.

[0800] As another example, when m represents the total number of sub-blocks and the coding block flags of the first m-1 sub-blocks indicate that there are no transform coefficients with non-zero values, it can be inferred that the coding block flag of the m-th sub-block indicates that there is at least one transform coefficient with a non-zero value.

[0801] As another example, when entropy encoding / decoding of the coded block flags according to sub-block units, the coded block flags can be entropy encoded / decoded on the basis of the blocks preceding the partition.

[0802] As another example, when entropy encoding / decoding of the coded block flag is performed on the block before partitioning, it is not necessary to entropy entropy encoding / decoding of the coded block flag according to the sub-block unit.

[0803] Meanwhile, when the current block is in the first sub-block partitioning mode and the current block size is a predefined size, the size of the sub-block used for intra-frame prediction and the size of the sub-block used for transformation can be different from each other. That is, the sub-block partitions used for intra-frame prediction and the sub-block partitions used for transformation can be different from each other. Here, the predefined size can be 4×N or 8×N (N>4). Here, sub-block partitions can represent vertical partitions.

[0804] For example, when the current block is in the first sub-block partitioning mode and the size of the current block is 4×N (N>4), the current block can be vertically partitioned into sub-blocks of size 4×N for intra-frame prediction, or it can be vertically partitioned into sub-blocks of size 1×N for transform. In this case, a one-dimensional transform / inverse transform can be performed to execute a transform of size 1×N. That is, a one-dimensional transform / inverse transform can be performed based on at least one of the current block's partitioning mode or its size.

[0805] As another example, when the current block is in the first sub-block partitioning mode and the size of the current block is 8×N (N>4), the current block can be vertically partitioned into sub-blocks of size 4×N for intra-frame prediction, and can also be vertically partitioned into sub-blocks of size 2×N for transform. In this case, a two-dimensional transform / inverse transform can be performed to execute a transform of size 2×N. That is, a two-dimensional transform / inverse transform can be performed based on at least one of the current block's partitioning mode or the current block's size.

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

[0807] In addition, the size of the current block can represent at least one of the size of the coded block, the size of the predicted block, or the size of the transformed block.

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

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

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

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

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

[0813] Furthermore, the partitioned block can represent at least one of a coded block, a prediction block, or a transform block. For example, the partitioned block can be a transform block.

[0814] Furthermore, the block or partitioned block can be at least one of an intra-frame block, an inter-frame block, or an intra-frame block copy block. For example, the block or partitioned block can be an inter-frame block.

[0815] Furthermore, a block or a block partitioned from a frame can be at least one of an intra-prediction block, an inter-prediction block, or an intra-block copy prediction block. For example, a block can be an inter-prediction block.

[0816] Furthermore, the block or partitioned block can be at least one of a luminance signal block or a chrominance signal block. For example, the block or partitioned block can be a luminance signal block.

[0817] When a block is partitioned into N sub-blocks, the block preceding the partition can be a coding block, and the resulting sub-blocks can be at least one of a prediction block or a transform block. In other words, the size of the partitioned sub-blocks can be used to perform transform / inverse transform, quantization / dequantization, and entropy coding / decoding of the transform coefficients.

[0818] Furthermore, when a block is partitioned into N sub-blocks, the block preceding the partition can be at least one of a coding block or a prediction block, and the resulting sub-blocks can be transform blocks. That is, prediction is performed using the size of the block preceding the partition, and transform / inverse transform, quantization / dequantization, and entropy coding / decoding of the transform coefficients can be performed using the size of the resulting sub-blocks.

[0819] Whether to divide a block into multiple sub-blocks can be determined based on at least one of the block's area (the product of its width and height), size (width or height or a combination of width and height), or shape / form (rectangle, square, etc.).

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

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

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

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

[0824] As another example, when the current block is a 4x4 block, it is not necessary to divide the current block into multiple sub-blocks.

[0825] As another example, when the current block is a 2×4 block, it is not necessary to divide the current block into multiple sub-blocks.

[0826] As another example, the current block may not be divided into multiple sub-blocks when at least one of its width or height is greater than the maximum size of the transform block. That is, when at least one of its width or height is less than or equal to the maximum size of the transform block, a second sub-block partitioning pattern may be applied to the current block.

[0827] As another example, the current block may not be divided into multiple sub-blocks if at least one of its width or height is greater than the maximum size of the transform block. That is, when the width and height of the current block are less than or equal to the maximum size of the transform block, a second sub-block partitioning pattern can be applied to the current block.

[0828] Furthermore, when at least one of the width or height of the current block is less than or equal to the maximum size of the transform block, at least one of the information indicating the partitioning mode of the second sub-block (sub-block partitioning mode information, partitioning direction information, sub-block position information, or sub-block size information) can be entropy encoded / entropy decoded. Here, the maximum size of the transform block can be determined based on the maximum size information of the transform block trans...

Claims

1. A video decoding method, the method comprising: obtaining a transform skip mode flag indicating whether a transform skip mode is applied to the current block; as well as determining, based on a reference size and the transform skip mode flag, whether to decode index information from a bitstream, 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 a 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, wherein when the reference size is greater than a threshold, the index information is decoded from the bitstream, 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, in, 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, comprising: obtaining information about whether an intra-frame residual Depta pulse code modulation (DPCM) method is used for the current block, wherein, when the information about whether the intra-frame residual DPCM method is used indicates that the intra-frame 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, the transform skip mode flag is not obtained from the bitstream, and it is determined that the transform skip mode is applied to the current block.

4. The video decoding method according to claim 1, in, When the current block is predicted according to an intra prediction mode that is not a matrix-based intra prediction mode, the index information of the secondary inverse transform of the current block is obtained.

5. The video decoding method according to claim 1, in, The transform skip mode flag is obtained 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, in, 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, in, When the tree structure of the current block is a dual-tree luma type and a transform skip mode flag of the luma component indicates that a transform skip mode is applied to the luma component, the index information is not decoded from the bitstream.

8. The video decoding method according to claim 5, in, When the tree structure of the current block is a dual-tree chroma type, 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 a transform skip mode is applied to a corresponding color component, the index information is not decoded from the bitstream.

9. A video encoding method, the method comprising: entropy encoding a transform skip mode flag indicating whether a transform skip mode is applied to the current block; determining whether to encode index information into a bitstream based on a reference size and the transform skip mode being applied to the current block, the index information indicating whether to perform a secondary transform 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 a secondary transform is applied to the current block, the value of the index information is determined based on a 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, 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 comprising: a processor configured to obtain the compressed video data, the compressed video data comprising a transform skip flag, the transform skip flag indicating whether a transform skip mode is applied to a current block; as well as a sending unit, configured to send the compressed video data, wherein whether the compressed video data further includes index information is determined based on a reference size and whether a 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 a 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 a secondary transform is applied to the current block, the value of the index information is set based on a 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, The reference size changes according to whether an intra sub-partition ISP is applied to the current block.