Image decoding method, image encoding method, transmission method, and computer-readable recording medium

Adaptive scanning of transform coefficients based on linear or quadratic transforms enhances image encoding/decoding efficiency, addressing inefficiencies in conventional methods and improving computational performance.

JP7763876B2Active Publication Date: 2025-11-04ELECTRONICS & TELECOMM RES INST
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2024017116
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2017-07-31
Filing Date
2024-02-07
Publication Date
2025-11-04
Estimated Expiration
2038-07-31

AI Technical Summary

Technical Problem

Conventional image encoding/decoding methods fail to optimize scanning of transform coefficients based on whether a linear or quadratic transform is performed, limiting the efficiency of image encoding/decoding processes, especially for high-resolution and high-quality images.

Method used

Adaptive determination of scanning methods for transform coefficients, including various scanning orders and units such as vertical, horizontal, diagonal, and mixed diagonal, based on the performance of linear or quadratic transforms, and considering neighboring blocks and chrominance/luminance components.

Benefits of technology

Improves the efficiency of image encoding/decoding by reducing computational complexity and enhancing the overall encoding and decoding performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007763876000005
    Figure 0007763876000005
  • Figure 0007763876000006
    Figure 0007763876000006
  • Figure 0007763876000007
    Figure 0007763876000007
Patent Text Reader

Abstract

To provide an image decoding method, an image encoding method, and a computer-readable recording medium that can adaptively determine a scanning method for transform coefficients in order to improve image encoding / decoding efficiency.SOLUTION: An image decoding method according to an embodiment of the present invention includes the steps of obtaining a transform coefficient of the current block, and decoding the current block on the basis of the transform coefficients. An image encoding method according to an embodiment of the present invention includes the steps of obtaining transform coefficients of the current block, and encoding the current block on the basis of the transform coefficients.SELECTED DRAWING: Figure 19
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present invention relates to an image encoding / decoding method and apparatus, and a recording medium storing a bitstream. Specifically, the present invention relates to an image encoding / decoding method and apparatus capable of adaptively determining a scanning method for transform coefficients. [Background technology]

[0002] Recently, demand for high-resolution, high-quality images, such as HD (High Definition) images and UHD (Ultra High Definition) images, is increasing in various application fields. As image data becomes higher in resolution and quality, the amount of data increases relatively compared to conventional image data. Therefore, when image data is transmitted over conventional media such as wired or wireless broadband lines or stored using conventional storage media, transmission and storage costs increase. To solve the problems that arise with the increase in resolution and quality of image data, highly efficient image encoding / decoding technologies for images with higher resolution and quality are required.

[0003] There are various image compression techniques, such as inter-frame (inter) prediction techniques that predict pixel values ​​contained in a current picture from pictures before or after the current picture, intra-frame (intra) prediction techniques that predict pixel values ​​contained in a current picture using pixel information within the current picture, transformation and quantization techniques that compress the energy of residual signals, and entropy coding techniques that assign short codes to values ​​that occur frequently and long codes to values ​​that occur less frequently.By using these image compression techniques, image data can be effectively compressed and transmitted or stored.

[0004] Conventional image encoding / decoding methods and apparatuses perform scanning of transform coefficients regardless of whether a primary transform or a secondary transform is performed, and therefore there is a limit to the improvement of encoding efficiency. Summary of the Invention [Problem to be solved by the invention]

[0005] The present invention provides a method and apparatus for scanning transform coefficients depending on whether at least one of a linear transform and a quadratic transform is performed in order to improve the efficiency of image encoding / decoding.

[0006] The present invention can provide an image decoding / encoding method and apparatus that can adaptively determine a scanning method for transform coefficients to improve the efficiency of image encoding / decoding. [Means for solving the problem]

[0007] The image decoding method according to the present invention may include the steps of obtaining transform coefficients of a current block from a bitstream, determining a scanning unit and a scanning order of the current block, and scanning and arranging the transform coefficients of the current block based on the determined scanning unit and scanning order.

[0008] In the image decoding method, the transform coefficients of the current block may be any one of an input of inverse quantization, an input of a second-order inverse transform, or an input of a first-order inverse transform.

[0009] In the image decoding method, the scanning order may include at least one of a vertical scanning order, a horizontal scanning order, a first vertical priority scanning order in which the first column is scanned with priority over other columns, a second vertical priority scanning order in which the first and second columns are scanned with priority over other columns, a first horizontal priority scanning order in which the first row is scanned with priority over other rows, a second horizontal priority scanning order in which the first and second rows are scanned with priority over other rows, a top-right diagonal scanning order, and a bottom-left diagonal scanning order.

[0010] In the image decoding method, the scanning unit may be determined as one of a coefficient group unit, an individual coefficient unit, and a mixed unit.

[0011] In the image decoding method, the step of determining a scanning unit and a scanning order of the current block may determine the scanning unit and the scanning order of the current block based on at least one of the scanning units and scanning orders of neighboring blocks of the current block.

[0012] In the image decoding method, when the scanning unit of the current block is determined to be a coefficient group unit, the transform coefficient scanning order within the coefficient group unit may be determined based on the scanning order of neighboring coefficient groups adjacent to the current coefficient group.

[0013] In the image decoding method, the scanning order of the current block may be determined based on the depth of the current block.

[0014] In the image decoding method, a scanning unit and a scanning order of the chrominance components of the current block may be determined based on a scanning unit and a scanning order of the luminance components of the current block.

[0015] In the image decoding method, a scanning order of the quantization matrices of the current block can be derived based on the determined scanning order.

[0016] The image decoding method may further include performing at least one of inverse quantization, a second-order inverse transform, or a first-order inverse transform on the aligned transform coefficients.

[0017] Meanwhile, the image encoding method according to the present invention may include the steps of obtaining transform coefficients of a current block from a residual block of the current block, determining a scanning unit and a scanning order of the current block, and scanning and entropy encoding the transform coefficients of the current block based on the determined scanning unit and scanning order.

[0018] In the image coding method, the transform coefficients of the current block may be any one of the outputs of a linear transform, a quadratic transform, or a quantization.

[0019] In the image encoding method, the scanning order may include at least one of a vertical scanning order, a horizontal scanning order, a first vertical priority scanning order in which the first column is scanned with priority over other columns, a second vertical priority scanning order in which the first and second columns are scanned with priority over other columns, a first horizontal priority scanning order in which the first row is scanned with priority over other rows, a second horizontal priority scanning order in which the first and second rows are scanned with priority over other rows, a top right diagonal scanning order, and a bottom left diagonal scanning order.

[0020] In the image encoding method, the scanning unit may be determined to be one of a coefficient group unit, an individual coefficient unit, and a mixed unit.

[0021] In the image encoding method, the step of determining a scanning unit and a scanning order of the current block may determine the scanning unit and the scanning order of the current block based on at least one of the scanning units and scanning orders of neighboring blocks of the current block.

[0022] In the image encoding method, when the scanning unit of the current block is determined to be a coefficient group unit, the transform coefficient scanning order within the coefficient group unit may be determined based on the scanning order of neighboring coefficient groups adjacent to the current coefficient group.

[0023] In the image encoding method, the scanning order of the current block may be determined based on the depth of the current block.

[0024] In the image encoding method, a scanning unit and a scanning order of the chrominance components of the current block may be determined based on a scanning unit and a scanning order of the luminance components of the current block.

[0025] In the image encoding method, a scanning order of the quantization matrices of the current block can be derived based on the determined scanning order.

[0026] Meanwhile, the recording medium according to the present invention can store a bitstream generated by an encoding method including the steps of obtaining transform coefficients of a current block from a residual block of the current block, determining a scanning unit and a scanning order of the current block, and scanning and entropy encoding the transform coefficients of the current block based on the determined scanning unit and scanning order. [Effects of the Invention]

[0027] According to the present invention, a method and apparatus for scanning transform coefficients depending on whether at least one of a linear transform and a quadratic transform is performed can be provided to improve the efficiency of image encoding / decoding.

[0028] According to the present invention, it is possible to provide an image encoding / decoding method and apparatus capable of adaptively determining a scanning method for transform coefficients.

[0029] According to the present invention, it is possible to improve the efficiency of encoding and decoding images.

[0030] According to the present invention, the computational complexity of image encoders and decoders can be reduced. [Brief explanation of the drawings]

[0031] [Figure 1] FIG. 1 is a block diagram showing the configuration of an embodiment of an encoding device to which the present invention is applied. [Figure 2] FIG. 1 is a block diagram showing the configuration of an embodiment of a decoding device to which the present invention is applied. [Figure 3] FIG. 1 is a diagram showing a schematic diagram of an image division structure when encoding and decoding an image. [Figure 4] FIG. 1 is a diagram illustrating a transform set according to an intra-frame prediction mode. [Figure 5] A diagram for explaining the process of transformation and quantization [Figure 6] FIG. 1 illustrates scanning of quantized transform coefficients. [Figure 7] FIG. 1 is a diagram illustrating a scanning unit according to an embodiment of the present invention; [Figure 8] FIG. 1 is a diagram illustrating a scanning unit according to an embodiment of the present invention; [Figure 9] FIG. 1 is a diagram illustrating a scanning unit according to an embodiment of the present invention; [Figure 10] FIG. 1 is a diagram illustrating a first mixed diagonal scanning order and a second mixed diagonal scanning order according to an embodiment of the present invention. [Figure 11] FIG. 1 is a diagram for explaining the relationship between scanning within a coefficient group and scanning between coefficient groups when scanning in units of coefficient groups. [Figure 12] FIG. 1 is a diagram for explaining the relationship between scanning within a coefficient group and scanning between coefficient groups when scanning in units of coefficient groups. [Figure 13]FIG. 1 is a diagram for explaining the relationship between scanning within a coefficient group and scanning between coefficient groups when scanning in units of coefficient groups. [Figure 14] FIG. 10 is a diagram illustrating an embodiment in which a scanning order is determined based on the shape of a current block. [Figure 15] FIG. 1 is a diagram illustrating an embodiment in which a scanning order is determined based on an area where a transformation is performed. [Figure 16] FIG. 1 is a diagram illustrating an embodiment in which a scanning order is determined based on an area where a transformation is performed. [Figure 17] FIG. 1 is a diagram illustrating an embodiment in which a scanning order is determined based on an area where a transformation is performed. [Figure 18] FIG. 1 is a diagram illustrating an embodiment in which a scanning order is determined based on an area where a transformation is performed. [Figure 19] 1 is a flow diagram illustrating an image decoding method according to an embodiment of the present invention. [Figure 20] FIG. 1 is a flow diagram illustrating an image encoding method according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0032] Because the present invention is susceptible to various modifications and can have various embodiments, specific embodiments are illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present invention to the specific embodiments, but rather to encompass all modifications, equivalents, and alternatives falling within the spirit and scope of the present invention. In the drawings, like reference numerals indicate the same or similar functions throughout the various aspects. The shapes and sizes of elements in the drawings may be exaggerated for clarity. The detailed description of exemplary embodiments below refers to the accompanying drawings, which show specific embodiments by way of example. These embodiments are described in sufficient detail to enable those skilled in the art to practice the embodiments. It should be understood that the various embodiments, although different from one another, are not necessarily mutually exclusive. For example, specific shapes, structures, and characteristics described herein in connection with one embodiment can be implemented in various embodiments without departing from the spirit and scope of the present invention. It should also be understood that the location or arrangement of individual components within each disclosed embodiment can be changed without departing from the spirit and scope of the embodiment. Accordingly, the following detailed description is not to be taken in a limiting sense, and the scope of the exemplary embodiments is limited only by the appended claims, if properly recited, and to the full scope of equivalents to which those claims are entitled.

[0033] In the present invention, the terms "first," "second," etc. may be used to describe various elements, but these elements should not be limited by these terms. These terms are used only to distinguish one element from another. For example, a first element can be called a second element, and similarly, a second element can be called a first element, without departing from the scope of the present invention. The term "and / or" includes a combination of multiple related listed items or any of multiple related listed items.

[0034] When a component of the present invention is said to be "coupled" or "connected" to another component, it should be understood that the component may be directly coupled or connected to the other component, but that there may be other components between them. In contrast, when a component is said to be "directly coupled" or "directly connected" to another component, it should be understood that there are no other components between them.

[0035] The components shown in the embodiments of the present invention are illustrated independently to show different characteristic functions, and do not mean that each component is composed of separate hardware or a single software unit. That is, each component is included in the list of components for the convenience of explanation, and at least two of the components may be combined to form a single component, or each component may be divided into multiple components to perform its function. Such integrated and separated embodiments of each component are also included in the scope of the present invention as long as they do not deviate from the essence of the present invention.

[0036] The terms used in the present invention are merely used to describe specific embodiments and do not limit the present invention. A singular expression includes a plural expression unless the context clearly dictates otherwise. In the present invention, terms such as "comprise" or "have" specify the presence of features, numbers, steps, operations, components, parts, or combinations thereof described in the specification, and should be understood not to preclude the presence or additional possibility of one or more other features, numbers, steps, operations, components, parts, or combinations thereof. In other words, in the present invention, a description that a specific configuration "comprises" does not exclude configurations other than the specified configuration, but means that additional configurations may be included within the scope of the implementation of the present invention or the technical idea of ​​the present invention.

[0037] Some components of the present invention may not be essential components that perform essential functions in the present invention, but may be optional components simply for improving performance. The present invention can be realized by including only components that are essential for achieving the essence of the present invention, excluding components used simply for improving performance, and a structure including only essential components excluding optional components used simply for improving performance is also included in the scope of the present invention.

[0038] Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In describing the embodiments of this specification, if it is determined that a detailed description of related known configurations or functions may obscure the gist of this specification, the detailed description will be omitted, and the same reference numerals will be used for the same components in the drawings, and duplicate descriptions of the same components will be omitted.

[0039] Hereinafter, an image may refer to either a single picture constituting a video or the video itself. For example, "encoding and / or decoding of an image" may mean "encoding and / or decoding of a video" or "encoding and / or decoding of any one of the images constituting a video."

[0040] In the following, the terms "motion picture" and "video" may be used interchangeably or interchangeably.

[0041] Hereinafter, a target image may be a target image to be coded, which is a target of coding, and / or a target image to be decoded, which is a target of decoding. The target image may also be an input image input to an encoding device or an input image input to a decoding device. Here, the target image may have the same meaning as a current image.

[0042] In the following, the terms "image", "picture", "frame" and "screen" may be used interchangeably or interchangeably.

[0043] Hereinafter, a target block may be a target block to be coded and / or a target block to be decoded. Also, a target block may be a current block to be coded and / or decoded. For example, the terms "target block" and "current block" may be used interchangeably.

[0044] In the following, the terms "block" and "unit" may be used interchangeably or "block" may refer to a specific unit.

[0045] In the following, the terms "region" and "segment" may be used interchangeably.

[0046] In the following, a specific signal may be a signal indicating a specific block. For example, an original signal may be a signal indicating a current block. A prediction signal may be a signal indicating a predicted block. A residual signal may be a signal indicating a residual block.

[0047] In an embodiment, each of specific information, data, flags, indexes, elements, attributes, etc. can have a value. A value of "0" for information, data, flags, indexes, elements, attributes, etc. can indicate logical false or a first predefined value. In other words, the values ​​of "0", false, logical false, and the first predefined value may be used interchangeably. A value of "1" for information, data, flags, indexes, elements, attributes, etc. can indicate logical true or a second predefined value. In other words, the values ​​of "1", true, logical true, and the second predefined value may be used interchangeably.

[0048] When a variable such as i or j is used to indicate a row, column, or index, the value of i may be an integer greater than or equal to 0, or may be an integer greater than or equal to 1. In other words, in an embodiment, rows, columns, and indices may be counted from 0 or from 1.

[0049] <Terminology> Encoder: A device that performs encoding. In other words, it can refer to a coding device.

[0050] Decoder: A device that performs decoding. In other words, it can refer to a decoding device.

[0051] Block: An MxN array of samples. Here, M and N may represent positive integer values, and a block may generally represent a two-dimensional sample array. A block may represent a unit. A current block may represent a block to be coded during coding, or a block to be decoded during decoding. The current block may be at least one of a coding block, a predicted block, a residual block, and a transform block.

[0052] Sample: The basic unit that makes up a block. Bit depth (B d ) from 0 to 2 depending on Bd It can be expressed as a value up to -1. In the present invention, a sample can be used synonymously with a picture element or pixel. That is, a sample, a picture element, and a pixel can have the same meaning.

[0053] Unit: This may refer to a unit of image encoding and decoding. In image encoding and decoding, a unit may be a region into which an image is divided. Also, when an image is divided into smaller units for encoding or decoding, a unit may refer to the divided units. That is, an image may be divided into multiple units. In image encoding and decoding, predefined processing may be performed on each unit. A unit may be further divided into subunits having a smaller size than the unit. Depending on the function, a unit may refer to a block, macroblock, coding tree unit, coding tree block, coding unit, coding block, prediction unit, prediction block, residual unit, residual block, transform unit, transform block, etc. Furthermore, a unit may refer to a luma component block, a corresponding chroma component block, and syntax elements for each block in order to distinguish it from a block. The unit may have various sizes and shapes, and in particular, the shape of the unit may include geometric shapes that can be expressed two-dimensionally, such as a square, a rectangle, a trapezoid, a triangle, a pentagon, etc. Furthermore, the unit information may include at least one of a unit type indicating a coding unit, a prediction unit, a residual unit, a transform unit, etc., a unit size, a unit depth, an encoding and decoding order of the unit, etc.

[0054] Coding tree unit: Consists of two chrominance (Cb, Cr) coding tree blocks associated with one luminance (Y) coding tree block. It can also refer to the blocks and the syntax elements for each block. Each coding tree unit can be divided using one or more division methods, such as a quad tree, a binary tree, or a ternary tree, to form subunits such as a coding unit, a prediction unit, or a transform unit. Like division of an input image, it can be used as a term to indicate a sample block that serves as a processing unit in the image decoding / encoding process. Here, quad tree can refer to a quarternary tree.

[0055] Coding Tree Block: A term that can be used to refer to any of the Y coding tree block, Cb coding tree block, and Cr coding tree block.

[0056] Neighbor block: This may refer to a block adjacent to a current block. The block adjacent to the current block may refer to a block bordering the current block or a block located within a predetermined distance from the current block. The neighbor block may refer to a block adjacent to a vertex of the current block. Here, the block adjacent to a vertex of the current block may be a block adjacent to a horizontal neighboring block of the current block and a block adjacent to a vertical neighboring block of the current block, or a block adjacent to a horizontal neighboring block of the current block and a block adjacent to a vertical neighboring block of the current block. The neighbor block may also refer to a restored neighboring block.

[0057] Reconstructed Neighbor Block: This may refer to a neighboring block that has already been coded or decoded spatially / temporally around the current block. In this case, the reconstructed neighboring block may refer to a reconstructed neighboring unit. The reconstructed spatial neighboring block may be a block in the current picture that has already been reconstructed through coding and / or decoding. The reconstructed temporal neighboring block may be a reconstructed block or its neighboring block at a position corresponding to the current block of the current picture in the reference image.

[0058] Unit depth: This can refer to the degree to which a unit is divided. The top node in a tree structure can correspond to the first undivided unit. The top node is also called the root node. The top node can have the minimum depth value. In this case, the top node can have a depth of level 0. A node with a depth of level 1 can indicate a unit generated by dividing the first unit once. A node with a depth of level 2 can indicate a unit generated by dividing the first unit twice. A node with a depth of level n can indicate a unit generated by dividing the first unit n times. A leaf node is the lowest node and can be a node that cannot be divided any further. The depth of a leaf node can be the maximum level. For example, a predefined value for the maximum level can be 3. The root node has the shallowest depth, and the leaf node has the deepest depth. When units are represented in a tree structure, the level at which a unit exists can refer to the unit depth.

[0059] Bitstream: Can mean a string of bits containing coded image information.

[0060] Parameter Set: This corresponds to header information among structures within a bitstream. A parameter set may include at least one of a video parameter set, a sequence parameter set, a picture parameter set, and an adaptation parameter set. A parameter set may also include slice header and tile header information.

[0061] Parsing: This can refer to entropy decoding a bitstream to determine the values ​​of syntax elements, or it can refer to entropy decoding itself.

[0062] Symbol: A symbol may refer to at least one of a syntax element of a unit to be coded / decoded, a coding parameter, a value of a transform coefficient, etc. Also, a symbol may refer to an object of entropy coding or a result of entropy decoding.

[0063] Prediction Mode: This may be information indicating a mode in which coding / decoding is performed using intra-picture prediction or a mode in which coding / decoding is performed using inter-picture prediction.

[0064] Prediction unit: This may refer to a basic unit when performing prediction, such as inter prediction, intra prediction, inter compensation, intra compensation, motion compensation, etc. One prediction unit may be divided into multiple partitions or multiple sub-prediction units having smaller sizes. Multiple partitions may also be basic units for performing prediction or compensation. Partitions generated by dividing a prediction unit may also be prediction units.

[0065] Prediction Unit Partition: This may refer to the form in which a prediction unit is divided.

[0066] Reference Picture List: This can refer to a list containing one or more reference pictures used for inter-frame prediction or motion compensation. Types of reference picture lists include LC (List Combined), L0 (List 0), L1 (List 1), L2 (List 2), and L3 (List 3). Inter-frame prediction can use one or more reference picture lists.

[0067] Inter Prediction Indicator: This may refer to the inter prediction direction (unidirectional prediction, bidirectional prediction, etc.) of the current block, or the number of reference images used when generating a predicted block of the current block, or the number of predicted blocks used when performing inter prediction or motion compensation on the current block.

[0068] Prediction list utilization flag: Indicates whether a prediction block is generated using at least one reference picture in a specific reference picture list. The prediction list utilization flag can be used to derive an inter-picture prediction indicator, and conversely, the inter-picture prediction indicator can be used to derive the prediction list utilization flag. For example, when the prediction list utilization flag indicates a first value "0", it can indicate that a prediction block is not generated using a reference picture in the reference picture list, and when it indicates a second value "1", it can indicate that a prediction block can be generated using the reference picture list.

[0069] Reference Picture Index: This can refer to an index that points to a particular reference picture in a reference picture list.

[0070] Reference Picture: This can refer to an image that a specific block references for inter-frame prediction or motion compensation. Alternatively, the reference picture can be an image including a reference block that a current block references for inter-frame prediction or motion compensation. Hereinafter, the terms "reference picture" and "reference image" may be used interchangeably or interchangeably.

[0071] Motion Vector: A two-dimensional vector used for inter-frame prediction or motion compensation. A motion vector may indicate an offset between a current block to be coded / decoded and a reference block. For example, (mvX, mvY) may indicate a motion vector. mvX may indicate the horizontal component, and mvY may indicate the vertical component.

[0072] Search Range: A search range may be a two-dimensional area in which a search for a motion vector is performed in inter prediction. For example, the size of the search range may be MxN, where M and N may each be a positive integer.

[0073] Motion Vector Candidate: This can refer to a block that is a prediction candidate when predicting a motion vector, or the motion vector of that block. Also, the motion vector candidate may be included in a motion vector candidate list.

[0074] Motion Vector Candidate List: This may refer to a list composed of one or more motion vector candidates.

[0075] Motion Vector Candidate Index: This can refer to an indicator of a motion vector candidate in a motion vector candidate list. It may also be an index of a motion vector predictor.

[0076] Motion Information: This can refer to information including at least one of a motion vector, a reference image index, an inter-frame prediction indicator, a prediction list utilization flag, reference image list information, a reference image, a motion vector candidate, a motion vector candidate index, a merge candidate, a margin index, etc.

[0077] Merge Candidate List: This may refer to a list composed of one or more merge candidates.

[0078] Merge Candidate: This can refer to a spatial merge candidate, a temporal merge candidate, a combined merge candidate, a combined bi-predictive merge candidate, a zero merge candidate, etc. The merge candidate can include motion information such as an inter-picture prediction indicator, a reference image index for each list, a motion vector, a prediction list utilization flag, and an inter-picture prediction indicator.

[0079] Merge Index: This may refer to an indicator that indicates a merge candidate in a merge candidate list. The merge index may also indicate a block that has guided the merge candidate among reconstructed blocks that are spatially / temporally adjacent to the current block. The merge index may also indicate at least one of the motion information items of the merge candidate.

[0080] Transform unit: A basic unit for encoding / decoding a residual signal, such as transform, inverse transform, quantization, inverse quantization, and transform coefficient encoding / decoding. One transform unit can be divided into a plurality of sub-transform units with smaller sizes. Here, the transform / inverse transform can include at least one of a primary transform / inverse transform and a secondary transform / inverse transform.

[0081] Scaling: This can refer to the process of multiplying quantized levels by a factor. Transform coefficients can be generated as a result of scaling the quantized levels. Scaling can also be called dequantization.

[0082] Quantization Parameter: This can refer to a value used when generating a quantized level using a transform coefficient in quantization. Alternatively, it can refer to a value used when generating a transform coefficient by scaling a quantized level in inverse quantization. The quantization parameter can be a value mapped to a quantization step size.

[0083] Delta Quantization Parameter: This may refer to a difference value between a predicted quantization parameter and a quantization parameter of a unit to be coded / decoded.

[0084] Scan: This can refer to a method of sorting the order of coefficients in a unit, block, or matrix. For example, sorting a two-dimensional array into a one-dimensional array is called a scan. Alternatively, sorting a one-dimensional array into a two-dimensional array can also be called a scan or inverse scan.

[0085] Transform coefficient: This can refer to a coefficient value generated after performing a transform in an encoder. It can also refer to a coefficient value generated after performing at least one of entropy decoding and inverse quantization in a decoder. A quantization level or a quantized transform coefficient level obtained by applying quantization to a transform coefficient or a residual signal can also be included in the meaning of a transform coefficient.

[0086] Quantized Level: This can refer to a value generated by quantizing a transform coefficient or a residual signal in an encoder. Alternatively, it can refer to a value to be subjected to inverse quantization before inverse quantization in a decoder. Similarly, the quantized transform coefficient level, which is the result of transform and quantization, can also be included in the meaning of the quantized level.

[0087] Non-zero Transform Coefficient: This can refer to a transform coefficient whose magnitude is not 0, or a transform coefficient level whose magnitude is not 0, or a quantized level.

[0088] Quantization Matrix: A matrix used in the quantization or dequantization process to improve the subjective or objective image quality. A quantization matrix can also be called a scaling list.

[0089] Quantization Matrix Coefficient: This can refer to each element in a quantization matrix. The quantization matrix coefficient can also be called a matrix coefficient.

[0090] Default Matrix: This may refer to a predetermined quantization matrix that is predefined in the encoder and decoder.

[0091] Non-default Matrix: This can refer to a quantization matrix that is not predefined in the encoder and decoder but is signaled by the user.

[0092] Statistical value: A statistical value for at least one of a variable, coding parameter, constant, etc. having a specific value that can be calculated may be at least one of the average value, weighted average value, weighted sum value, minimum value, maximum value, mode value, median value, and interpolated value of the specific value.

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

[0094] The encoding device 100 may be an encoder, a video encoding device, or an image encoding device. A video may include one or more images. The encoding device 100 may sequentially encode one or more images.

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

[0096] The encoding device 100 may perform encoding on an input image in intra mode and / or inter mode. The encoding device 100 may also generate a bitstream including encoded information through encoding on the input image and output the generated bitstream. The generated bitstream may be stored in a computer-readable recording medium or streamed via a wired / wireless transmission medium. When an intra mode is used as a prediction mode, the switch 115 may switch to intra mode. When an inter mode is used as a prediction mode, the switch 115 may switch to inter mode. Here, the intra mode may refer to an intra-frame prediction mode, and the inter mode may refer to an inter-frame prediction mode. The encoding device 100 may generate a prediction block for an input block of the input image. After the prediction block is generated, the encoding device 100 may also encode a residual block using a residual between the input block and the prediction block. The input image may also be referred to as a current image currently being encoded. The input block may also be referred to as a current block currently being encoded or a block to be encoded.

[0097] When the prediction mode is the intra mode, the intra prediction unit 120 can also use samples of already coded / decoded blocks surrounding the current block as reference samples. The intra prediction unit 120 can perform spatial prediction on the current block using the reference samples and generate predicted samples for the input block through the spatial prediction. Here, intra prediction can mean intra-frame prediction.

[0098] When the prediction mode is inter mode, the motion prediction unit 111 may search for an area that best matches the input block from a reference image during the motion prediction process, and may derive a motion vector using the searched area. In this case, the search area may be used as the area. The reference image may be stored in the reference picture buffer 190. Here, when encoding / decoding of the reference image is processed, the reference image may be stored in the reference picture buffer 190.

[0099] The motion compensation unit 112 may generate a prediction block for the current block by performing motion compensation using the motion vector, where inter prediction may refer to inter prediction or motion compensation.

[0100] The motion prediction unit 111 and the motion compensation unit 112 may generate a prediction block by applying an interpolation filter to a part of a reference image when the value of a motion vector does not have an integer value. To perform inter-frame prediction or motion compensation, it may be determined based on a coding unit whether the motion prediction and motion compensation method of a prediction unit included in the corresponding coding unit is a skip mode, a merge mode, an advanced motion vector prediction (AMVP) mode, or a current picture reference mode, and inter-frame prediction or motion compensation may be performed according to each mode.

[0101] The subtractor 125 may generate a residual block using the difference between the input block and the predicted block. The residual block may also be referred to as a residual signal. The residual signal may refer to the difference between the original signal and the predicted signal. Alternatively, the residual signal may be a signal generated by transforming, quantizing, or transforming and quantizing the difference between the original signal and the predicted signal. The residual block may be a block-by-block residual signal.

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

[0103] By applying quantization to the transform coefficients or residual signal, quantized levels can be generated, which may also be referred to as transform coefficients in the following embodiments.

[0104] The quantization unit 140 may generate quantization levels by quantizing the transform coefficients or the residual signal based on the quantization parameter, and may output the generated quantization levels. In this case, the quantization unit 140 may quantize the transform coefficients using a quantization matrix.

[0105] The entropy coding unit 150 may generate a bitstream by performing entropy coding based on a probability distribution on values ​​calculated by the quantization unit 140 or coding parameter values ​​calculated during the coding process, and may output the bitstream. The entropy coding unit 150 may perform entropy coding on information about image samples and information for decoding the image. For example, the information for decoding the image may include syntax elements.

[0106] When entropy coding is applied, fewer bits are assigned to symbols with higher occurrence probabilities and more bits are assigned to symbols with lower occurrence probabilities to represent the symbols, thereby reducing the size of the bit string for the symbol to be coded. The entropy coding unit 150 can use coding methods such as exponential Golomb, context-adaptive variable length coding (CAVLC), and context-adaptive binary arithmetic coding (CABAC) for entropy coding. For example, the entropy coding unit 150 can perform entropy coding using a variable length coding / code (VLC) table. The entropy coding unit 150 can also derive a binarization method for the target symbol and a probability model for the target symbol / bin, and then perform arithmetic coding using the derived binarization method, probability model, and context model.

[0107] The entropy coding unit 150 can convert two-dimensional block-form coefficients into one-dimensional vectors through a transform coefficient scanning method in order to code the transform coefficient levels (quantization levels).

[0108] Coding parameters can include not only information (flags, indexes, etc.) that is coded by an encoder and signaled to a decoder, like syntax elements, but also information that is induced during the coding or decoding process, and can refer to information required when coding or decoding an image. For example, unit / block size, unit / block depth, unit / block division information, unit / block type, unit / block division structure, whether it is quadtree division, whether it is binary tree division, direction of binary tree division (horizontal or vertical), type of binary tree division (symmetric or asymmetric), whether it is ternary tree division, direction of ternary tree division (horizontal or vertical), type of ternary tree division (symmetric or asymmetric), whether it is hybrid tree division, direction of hybrid tree division (horizontal or vertical), type of hybrid tree division (symmetric or asymmetric), division tree of hybrid tree (binary tree or ternary tree), prediction mode (intra prediction or inter prediction), intra luminance prediction mode / direction, intra chrominance prediction mode / direction, intra division information, inter division information, coding block division flag, prediction block division flag, transform block division flag, reference sample filtering method, reference sample filter tap, reference sample filter coefficient, prediction Block filtering method, prediction block filter tap, prediction block filter coefficient, prediction block boundary filtering method, prediction block boundary filter tap, prediction block boundary filter coefficient, intra prediction mode, inter prediction mode, motion information, motion vector, motion vector difference, reference image index, inter prediction direction, inter prediction indicator, prediction list utilization flag, reference image list, reference image, motion vector prediction index, motion vector prediction candidate, motion vector candidate list, merge mode usage status, merge index, merge candidate, merge candidate list, skip mode usage status, interpolation filter type, interpolation filter tap, interpolation filter coefficient, motion vector size, motion vector representation accuracy, transform type, transform size, primary transform usage status information, secondary transform usage status information, primary transform index, secondary transform index, residual signal usage status information, coded block patternPattern), coded block flag, coded block flag, quantization parameter, residual quantization parameter, quantization matrix, whether intra-frame loop filter is applied, intra-frame loop filter coefficient, intra-frame loop filter tap, intra-frame loop filter shape / form, whether deblocking filter is applied, deblocking filter coefficient, deblocking filter tap, deblocking filter strength, deblocking filter shape / form, whether adaptive sample offset is applied, adaptive sample offset value, adaptive sample offset category, type of adaptive sample offset, whether adaptive loop filter is applied, adaptive loop filter coefficient, adaptive loop filter tap, adaptive loop filter shape / form, binarization / de-binarization method, context model determination method, context model update method, whether regular mode is executed, whether bypass mode is executed, context bin, bypass bin, important coefficient, flag, last important coefficient flag, coefficient group unit coding flag, last important coefficient position, flag indicating whether coefficient value is greater than 1, function The encoding parameters may include at least one value or combination of a flag indicating whether a numerical value is greater than 2, a flag indicating whether a coefficient value is greater than 3, residual coefficient value information, sign information, reconstructed luma sample, reconstructed chroma sample, residual luma sample, residual chroma sample, luma transform coefficient, chroma transform coefficient, luma quantization level, chroma quantization level, transform coefficient level scanning method, size of decoder side motion vector search area, shape of decoder side motion vector search area, number of decoder side motion vector searches, CTU size information, minimum block size information, maximum block size information, maximum block depth information, minimum block depth information, image display / output order, slice identification information, slice type, slice division information, tile identification information, tile type, tile division information, picture type, input sample bit depth, reconstructed sample bit depth, residual sample bit depth, transform coefficient bit depth, quantization level bit depth, information on the luma signal, and information on the chroma signal.

[0109] Here, signaling a flag or index can mean that an encoder entropy encodes the corresponding flag or index and includes it in a bitstream, and a decoder entropy decodes the corresponding flag or index from the bitstream.

[0110] When the encoding device 100 performs encoding using inter prediction, the encoded current image can be used as a reference image for other images to be processed later. Thus, the encoding device 100 can further restore or decode the encoded current image and store the restored or decoded image in the reference picture buffer 190 as a reference image.

[0111] The quantization levels may be dequantized by the inverse quantization unit 160 and inverse transformed by the inverse transform unit 170. The inverse quantized and / or inverse transformed coefficients may be combined with a prediction block via an adder 175. A reconstructed block may be generated by combining the inverse quantized and / or inverse transformed coefficients with the prediction block. Here, the inverse quantized and / or inverse transformed coefficients refer to coefficients that have undergone at least one of inverse quantization and inverse transformation, and may refer to a reconstructed residual block.

[0112] The reconstructed blocks may pass through a filter unit 180. The filter unit 180 may apply at least one of a deblocking filter, a sample adaptive offset (SAO), an adaptive loop filter (ALF), etc. to the reconstructed samples, the reconstructed blocks, or the reconstructed images. The filter unit 180 is also referred to as an in-loop filter.

[0113] The deblocking filter can remove block artifacts that occur at boundaries between blocks. To determine whether to perform the deblocking filter, it can be determined whether to apply the deblocking filter to the current block based on samples included in several columns or rows included in the block. When applying the deblocking filter to the block, different filters can be applied depending on the required deblocking filtering strength.

[0114] To compensate for encoding errors using sample adaptive offset, an appropriate offset value can be added to a sample value. Sample adaptive offset can correct the offset between a deblocked image and an original image on a sample-by-sample basis. After dividing the samples included in an image into a certain number of regions, the region to be offset is determined and the offset is applied to the corresponding region, or the offset is applied taking into account edge information of each sample.

[0115] The adaptive loop filter can perform filtering based on a value obtained by comparing a restored image with an original image. After dividing samples included in an image into predetermined groups, a filter to be applied to each group can be determined, and differential filtering can be performed for each group. Information related to whether to apply an adaptive loop filter can be signaled for each coding unit (CU), and the shape and filter coefficients of the adaptive loop filter applied can vary depending on each block.

[0116] The reconstructed blocks or reconstructed images that have passed through the filter unit 180 may be stored in the reference picture buffer 190. The reconstructed blocks that have passed through the filter unit 180 may be part of a reference image. In other words, the reference image may be a reconstructed image made up of the reconstructed blocks that have passed through the filter 180. The stored reference image may be used for subsequent inter prediction or motion compensation.

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

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

[0119] Referring to FIG. 2, the decoding device 200 may include an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra prediction unit 240, a motion compensation unit 250, an adder 255, a filter unit 260, and a reference picture buffer 270.

[0120] The decoding apparatus 200 may receive a bitstream output from the encoding apparatus 100. The decoding apparatus 200 may receive a bitstream stored in a computer-readable recording medium or a bitstream streamed via a wired / wireless transmission medium. The decoding apparatus 200 may perform decoding on the bitstream in an intra mode or an inter mode. The decoding apparatus 200 may also generate a reconstructed image or a decoded image through decoding and output the reconstructed image or the decoded image.

[0121] If the prediction mode used for decoding is an intra mode, the switch can be changed to intra. If the prediction mode used for decoding is an inter mode, the switch can be changed to inter.

[0122] The decoding apparatus 200 may decode an input bitstream, obtain a reconstructed residual block, and generate a prediction block. After obtaining the reconstructed residual block and the prediction block, the decoding apparatus 200 may generate a reconstructed block to be decoded by adding the reconstructed residual block and the prediction block. The block to be decoded may also be referred to as a current block.

[0123] The entropy decoding unit 210 may generate symbols by performing entropy decoding based on a probability distribution on the bitstream. The generated symbols may include symbols in the form of quantization levels. Here, the entropy decoding method may be the inverse process of the entropy encoding method described above.

[0124] The entropy decoding unit 210 can convert one-dimensional vector form coefficients into two-dimensional block form coefficients according to a scanning method of the transform coefficients in order to decode the transform coefficient levels (quantization levels).

[0125] The quantization levels can be inversely quantized by the inverse quantization unit 220 and inversely transformed by the inverse transform unit 230. The quantization levels are the result of inverse quantization and / or inverse transformation and can be generated as reconstructed residual blocks. In this case, the inverse quantization unit 220 can apply a quantization matrix to the quantization levels.

[0126] When intra mode is used, the intra prediction unit 240 can generate a predicted block by performing spatial prediction on the current block using sample values ​​of already decoded blocks surrounding the block to be decoded.

[0127] When the inter mode is used, the motion compensation unit 250 may generate a prediction block by performing motion compensation on the current block using a motion vector and a reference image stored in the reference picture buffer 270. When the value of the motion vector does not have an integer value, the motion compensation unit 250 may generate a prediction block by applying an interpolation filter to a portion of the reference image. To perform motion compensation, it may determine, based on a coding unit, whether the motion compensation method of a prediction unit included in the corresponding coding unit is skip mode, merge mode, AMVP mode, or current picture reference mode, and perform motion compensation according to each mode.

[0128] The adder 225 may generate a reconstructed block by adding the reconstructed residual block and the prediction block. The filter unit 260 may apply at least one of a deblocking filter, a sample adaptive offset, and an adaptive loop filter to the reconstructed block or the reconstructed image. The filter unit 260 may output the reconstructed image. The reconstructed block or the reconstructed image is stored in the reference picture buffer 270 and can be used for inter prediction. The reconstructed block that has passed through the filter unit 260 may be part of a reference image. In other words, the reference image may be a reconstructed image made up of the reconstructed block that has passed through the filter unit 260. The stored reference image can be used for inter prediction or motion compensation thereafter.

[0129] 3 is a schematic diagram showing the division structure of an image when encoding and decoding the image, which shows an embodiment in which one unit is divided into multiple sub-units.

[0130] In order to efficiently divide an image, a coding unit (CU) can be used in encoding and decoding. The coding unit can be used as a basic unit for image encoding / decoding. Furthermore, when encoding / decoding an image, the coding unit can be used as a unit in which an intra prediction mode and an inter prediction mode are distinguished. The coding unit may be a basic unit used for prediction, transform, quantization, inverse transform, inverse quantization, or encoding / decoding of transform coefficients.

[0131] Referring to FIG. 3, an image 300 is sequentially divided into largest coding units (LCUs), and a division structure is determined for each LCU. Here, LCU can be used interchangeably with coding tree unit (CTU). Division of a unit may refer to division of blocks corresponding to the unit. Block division information may include information about the depth of the unit. The depth information may indicate the number of times and / or the degree to which the unit is divided. One unit may be hierarchically divided into a plurality of subunits using depth information based on a tree structure. In other words, a unit and subunits generated by dividing the unit may correspond to a node and its child nodes, respectively. Each divided subunit may have depth information. The depth information indicates the size of a CU and may be stored for each CU. Since the unit depth indicates the number of times and / or the degree to which the unit is divided, the subunit division information may also include information about the size of the subunit.

[0132] The partition structure may refer to the distribution of coding units (CUs) within the CTU 310. This distribution may be determined by whether or not to partition one CU into multiple CUs (a positive integer equal to or greater than 2, including 2, 4, 8, 16, etc.). The width and height of a CU generated by partitioning may be half the width and half the height of the CU before partitioning, respectively, or may be smaller than the width and height of the CU before partitioning depending on the number of partitions. A CU may be recursively partitioned into multiple CUs. Recursive partitioning may reduce at least one of the width and height of the partitioned CU compared to at least one of the width and height of the CU before partitioning. CU partitioning may be performed recursively to a predefined depth or up to a predefined size. For example, the depth of a CTU may be 0, and the depth of a smallest coding unit (SCU) may be a predefined maximum depth. Here, as described above, a CTU may be a coding unit having the largest coding unit size, and an SCU may be a coding unit having the smallest coding unit size. Splitting begins with a CTU 310, and the depth of the CU increases by 1 each time the width and / or height of the CU decreases due to splitting. For example, for each depth, an unsplit CU may have a size of 2N×2N. Furthermore, for split CUs, a 2N×2N CU may be split into four N×N CUs. The size of N may be halved each time the depth increases by 1.

[0133] In addition, information on whether a CU is divided can be expressed through division information of the CU. The division information may be 1-bit information. All CUs except for SCUs may include division information. For example, if the value of the division information is a first value, the CU may not be divided, and if the value of the division information is a second value, the CU may be divided.

[0134] Referring to Figure 3, a CTU with depth 0 may be a 64x64 block. 0 may be the minimum depth. A SCU with depth 3 may be an 8x8 block. 3 may be the maximum depth. CUs with 32x32 and 16x16 blocks may be represented by depth 1 and depth 2, respectively.

[0135] For example, when one coding unit is divided into four coding units, the width and height of the four divided coding units may be half the size of the width and height of the coding unit before division. As an example, when a coding unit of 32x32 size is divided into four coding units, each of the four divided coding units may have a size of 16x16. When one coding unit is divided into four coding units, it can be said that the coding units are divided into a quad-tree (quad-tree partition).

[0136] For example, when one coding unit is divided into two coding units, the width or height of the two divided coding units may be half the width or height of the coding unit before division. As an example, when a 32x32 coding unit is vertically divided into two coding units, each of the divided coding units may have a size of 16x32. As an example, when an 8x32 coding unit is horizontally divided into two coding units, each of the divided coding units may have a size of 8x16. When one coding unit is divided into two coding units, it can be said that the coding unit is divided into a binary tree (binary-tree partition).

[0137] For example, when one coding unit is divided into three coding units, the coding unit can be divided into three coding units by dividing the width or height of the coding unit in a ratio of 1:2:1 before division. As an example, when a 16x32 coding unit is divided horizontally into three coding units, the three divided coding units may have sizes of 16x8, 16x16, and 16x8 from the top. As an example, when a 32x32 coding unit is divided vertically into three coding units, the three divided coding units may have sizes of 8x32, 16x32, and 8x32 from the left. When one coding unit is divided into three coding units, it can be said that the coding unit is divided into a ternary-tree shape (ternary-tree partition).

[0138] The CTU 320 in FIG. 3 is an example of an LCU to which quad-tree partitioning, binary-tree partitioning, and ternary-tree partitioning are all applied.

[0139] As described above, at least one of quadtree partitioning, binary tree partitioning, and ternary tree partitioning can be applied to partition a CTU. Each partitioning method can be applied based on a predetermined priority. For example, quadtree partitioning can be applied preferentially to a CTU. A coding unit that cannot be further partitioned into quadtrees can correspond to a leaf node of a quadtree. A coding unit that corresponds to a leaf node of a quadtree can become a root node of a binary tree and / or a ternary tree. That is, a coding unit that corresponds to a leaf node of a quadtree can be partitioned into binary trees, ternary trees, or cannot be further partitioned. In this case, quadtree partitioning is not performed again on a coding unit generated by partitioning a coding unit that corresponds to a leaf node of a quadtree into binary trees or ternary trees, thereby effectively partitioning blocks and / or signaling partition information.

[0140] The division of the coding unit corresponding to each node of the quadtree can be signaled using quad division information. Quad division information having a first value (e.g., "1") can indicate that the corresponding coding unit is quadtree divided. Quad division information having a second value (e.g., "0") can indicate that the corresponding coding unit is not quadtree divided. The quad division information can be a flag having a predetermined length (e.g., 1 bit).

[0141] There may be no priority between binary tree division and ternary tree division. That is, a coding unit corresponding to a leaf node of a quadtree can be divided into either a binary tree or a ternary tree. Furthermore, a coding unit generated by binary tree division or ternary tree division can be divided into either a binary tree or a ternary tree again, or cannot be divided further.

[0142] A partition in which there is no priority between binary tree partitioning and ternary tree partitioning may be called a multi-type tree partition. That is, a coding unit corresponding to a leaf node of a quadtree may become the root node of a multi-type tree. The partition of a coding unit corresponding to each node of a multi-type tree may be signaled using at least one of information on whether the multi-type tree is partitioned, split direction information, and split tree information. For the partition of a coding unit corresponding to each node of the multi-type tree, information on whether the multi-type tree is partitioned, split direction information, and split tree information may be signaled sequentially.

[0143] The hybrid tree split or not information having a first value (e.g., "1") may indicate that the coding unit is hybrid tree split. The hybrid tree split or not information having a second value (e.g., "0") may indicate that the coding unit is not hybrid tree split.

[0144] When a coding unit corresponding to each node of a hybrid tree is split into hybrid trees, the coding unit may further include split direction information. The split direction information may indicate the split direction of the hybrid tree split. Split direction information having a first value (e.g., "1") may indicate that the coding unit is split vertically. Split direction information having a second value (e.g., "0") may indicate that the coding unit is split horizontally.

[0145] When a coding unit corresponding to each node of a hybrid tree is hybrid tree split, the coding unit may further include splitting tree information. The splitting tree information may indicate a tree used for hybrid tree splitting. Splitting tree information having a first value (e.g., "1") may indicate that the coding unit is binary tree split. Splitting tree information having a second value (e.g., "0") may indicate that the coding unit is ternary tree split.

[0146] The information on whether or not a partition has occurred, the partition tree information, and the partition direction information may each be a flag having a predetermined length (for example, 1 bit).

[0147] At least one of quad partition information, information on whether a hybrid tree is split, split direction information, and split tree information can be entropy coded / decoded. For entropy coding / decoding of the information, information on neighboring coding units adjacent to the current coding unit can be used. For example, the partitioning pattern (splitting pattern, partition tree, and / or split direction) of the left coding unit and / or the upper coding unit is likely to be similar to the partitioning pattern of the current coding unit. Therefore, context information for entropy coding / decoding of information on the current coding unit can be derived based on information on neighboring coding units. In this case, the information on neighboring coding units may include at least one of quad partition information of the current coding unit, information on whether a hybrid tree is split, split direction information, and split tree information.

[0148] In another embodiment, binary tree partitioning may be performed preferentially between binary tree partitioning and ternary tree partitioning. That is, binary tree partitioning may be applied first, and a coding unit corresponding to a leaf node of the binary tree may be set as the root node of the ternary tree. In this case, quadtree partitioning and binary tree partitioning may not be performed on a coding unit corresponding to a node of the ternary tree.

[0149] A coding unit that is not further divided by quadtree partitioning, binary tree partitioning, and / or ternary tree partitioning may become a unit of coding, prediction, and / or transformation. That is, a coding unit may not be further divided for prediction and / or transformation. Therefore, a partition structure, partition information, etc. for dividing a coding unit into prediction units and / or transform units may not exist in the bitstream.

[0150] However, if the size of a coding unit, which is the division unit, is larger than the size of the largest transform block, the coding unit can be recursively divided until it becomes equal to or smaller than the size of the largest transform block. For example, if the size of a coding unit is 64x64 and the size of the largest transform block is 32x32, the coding unit can be divided into four 32x32 blocks for transformation. For example, if the size of a coding unit is 32x64 and the size of the largest transform block is 32x32, the coding unit can be divided into two 32x32 blocks for transformation. In this case, whether or not the coding unit is divided for transformation is not separately signaled, but can be determined by comparing the width or height of the coding unit with the width or height of the largest transform block. For example, if the width of a coding unit is larger than the width of the largest transform block, the coding unit can be divided vertically in half. Also, if the height of a coding unit is larger than the height of the largest transform block, the coding unit can be divided horizontally in half.

[0151] Information regarding the maximum and / or minimum size of a coding unit and information regarding the maximum and / or minimum size of a transform block can be signaled or determined at a higher level of the coding unit. The higher level may be, for example, the sequence level, the picture level, the slice level, etc. For example, the minimum size of a coding unit may be determined to be 4x4. For example, the maximum size of a transform block may be determined to be 64x64. For example, the minimum size of a transform block may be determined to be 4x4.

[0152] Information regarding the minimum size of a coding unit corresponding to a leaf node of a quadtree (minimum size of a quadtree) and / or information regarding the maximum depth from the root node of a hybrid tree to a leaf node (maximum depth of a hybrid tree) can be signaled or determined at a higher level of the coding unit. The higher level may be, for example, a sequence level, a picture level, a slice level, etc. The information regarding the minimum size of a quadtree and / or information regarding the maximum depth of the hybrid tree can be signaled or determined for each of an intra-screen slice and an inter-screen slice.

[0153] Difference information regarding the size of the CTU and the maximum size of the transform block can be signaled or determined at a higher level of the coding unit. The higher level may be, for example, the sequence level, the picture level, or the slice level. Information regarding the maximum size of the coding unit corresponding to each node of the binary tree (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 (maximum size of the ternary tree) may have different values ​​depending on the type of slice. For example, in the case of an intra-screen slice, the maximum size of the ternary tree may be 32x32. Also, in the case of an inter-screen slice, the maximum size of the ternary tree may be 128x128. For example, the minimum size of the coding unit corresponding to each node of the binary tree (minimum size of the binary tree) and / or the minimum size of the coding unit corresponding to each node of the ternary tree (minimum size of the ternary tree) can be set as the minimum size of the coding block.

[0154] 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 slice level, and the minimum size of a binary tree and / or the minimum size of a ternary tree can be signaled or determined at the slice level.

[0155] Depending on the size and depth information of the various blocks mentioned above, quad partition information, information on whether it is a composite tree partition, partition tree information and / or partition direction information may or may not be present in the bitstream.

[0156] For example, if the size of a coding unit is not larger than the minimum size of a quadtree, the coding unit does not include quad partition information, and the quad partition information can be inferred to a second value.

[0157] For example, if the size (width and height) of a coding unit corresponding to a node of a hybrid tree is larger than the maximum size (width and height) of a binary tree and / or the maximum size (width and height) of a ternary tree, the coding unit may not be split into a binary tree and / or a ternary tree. Therefore, information on whether the hybrid tree is split or not is not signaled and can be inferred from a second value.

[0158] Alternatively, if the size (width and height) of a coding unit corresponding to a node of a hybrid tree is the same as the minimum size (width and height) of a binary tree, or if the size (width and height) of a coding unit is the same as twice the minimum size (width and height) of a ternary tree, the coding unit may not be partitioned into binary trees and / or ternary trees. Therefore, information on whether the hybrid tree is to be partitioned is not signaled and can be inferred from a second value. This is because, if the coding unit is partitioned into binary trees and / or ternary trees, coding units smaller than the minimum size of a binary tree and / or the minimum size of a ternary tree are generated.

[0159] Alternatively, if the depth of a coding unit corresponding to a node of the hybrid tree in the hybrid tree is equal to the maximum depth of the hybrid tree, the coding unit may not be split into a binary tree and / or a ternary tree, and thus, information on whether the hybrid tree is split or not may not be signaled and may be inferred from a second value.

[0160] Alternatively, information on whether the hybrid tree is split can be signaled only if at least one of vertical binary tree splitting, horizontal binary tree splitting, vertical ternary tree splitting, and horizontal ternary tree splitting is possible for a coding unit corresponding to a node of the hybrid tree. Otherwise, the coding unit may not be split into a binary tree and / or a ternary tree. Therefore, information on whether the hybrid tree is split can be inferred as a second value without being signaled.

[0161] Alternatively, the split direction information may be signaled only if both vertical binary tree splitting and horizontal binary tree splitting are possible for a coding unit corresponding to a node of a hybrid tree, or both vertical ternary tree splitting and horizontal ternary tree splitting are possible. Otherwise, the split direction information may not be signaled and may be inferred to a value indicating the possible split direction.

[0162] Alternatively, the split tree information may be signaled only if both vertical binary tree splitting and vertical ternary tree splitting are possible for a coding unit corresponding to a node of a hybrid tree, or both horizontal binary tree splitting and horizontal ternary tree splitting are possible. Otherwise, the split tree information may not be signaled and may be inferred to a value indicating a tree that can be split.

[0163] Based on the above, the image encoding / decoding method according to the present invention will now be considered in detail.

[0164] Next, the transformation and quantization process according to the present invention will be described.

[0165] Quantized levels can be generated by performing a transform and / or quantization process on a residual signal generated after intra- or inter-prediction. The residual signal can be generated based on the difference between an original block and a predicted block (an intra-predicted block or an inter-predicted block). Here, the predicted block can be a block generated by intra- or inter-prediction. The predicted block can also be a block generated by at least one of intra-prediction and inter-prediction, or a combination of both. Here, the transform can include at least one of a linear transform and a secondary transform. A primary transform can be performed on the residual signal to generate transform coefficients, and a secondary transform can be performed on the transform coefficients to generate secondary transform coefficients.

[0166] Meanwhile, the residual signal can be transformed into the frequency domain through a transform process as part of the quantization process. In this case, the primary transform can be a DCT type 2 (DCT-II) or various DCT or DST kernels. These transform kernels can be separable transforms that perform 1D transforms on the residual signal in the horizontal and / or vertical directions, respectively, or 2D non-separable transforms.

[0167] For example, as shown in the table below, the DCT and DST types used for the transformation may include at least one of DCT-based transformations and DST-based transformations such as DCT-II, DCT-V, DCT-VIII, DST-I, and DST-VII, adaptively used for the 1D transformation. For example, a transform set may be configured as shown in Tables 1 and 2 to guide the DCT or DST type used for the transformation. [Table 1] [Table 2]

[0168] For example, as shown in FIG. 4, different transform sets may be defined in the horizontal or vertical direction depending on the intra-frame prediction mode, and then the encoder / decoder may perform transform and / or inverse transform using the intra-frame prediction mode of the currently encoding / decoding target block and the transform included in the corresponding transform set.

[0169] In this case, the set of transforms can be defined in the encoder / decoder based on the same rules, rather than being entropy coded / decoded, and information indicating which transforms from the set were used can be entropy coded / decoded.

[0170] For example, when the block size is 32x32 or less, a total of three transform sets are configured according to the intra-frame prediction mode, as shown in the example of Table 2, and a total of nine multiple transform methods are combined using three transforms each for the horizontal and vertical directions, and the residual signal is then encoded / decoded using the optimal transform method, thereby improving coding efficiency. In this case, truncated unary binarization can be used to entropy encode / decode information indicating which of the three transforms belonging to one transform set was used. In this case, information indicating which of the transforms belonging to the transform set was used for at least one of the vertical transform and the horizontal transform can be entropy encoded / decoded.

[0171] After completing the primary transform, the encoder may perform a secondary transform to increase the energy density of the transformed coefficients, as shown in the example of FIG. 5. The secondary transform may also be a separable transform that performs one-dimensional transforms in the horizontal and / or vertical directions, respectively, or a two-dimensional non-separable transform. The transform information used may be signaled or may be implicitly derived in the encoder / decoder according to current and surrounding coding information. For example, like the primary transform, a transform set for the secondary transform may be defined, and the transform set may be defined in the encoder / decoder based on the same rules as the primary transform, rather than being entropy coded / decoded. In this case, information indicating which transforms from the transform set were used may be signaled and may be applied to at least one residual signal obtained by intra-frame or inter-frame prediction.

[0172] At least one of the number or type of transform candidates varies depending on the transform set, and at least one of the number or type of transform candidates can be variably determined taking into account at least one of the position, size, shape, prediction mode (intra / inter mode), or directionality / non-directivity of the intra-screen prediction mode of the block (CU, PU, ​​TU, etc.).

[0173] In the decoder, a secondary inverse transform can be performed depending on whether or not a secondary inverse transform is performed, and a primary inverse transform can be performed on the result of the secondary inverse transform depending on whether or not a primary inverse transform is performed.

[0174] The above-mentioned primary and secondary transforms can be applied to at least one signal component of the luminance / chrominance components, or can be applied depending on the size / shape of any coding block. Whether or not they are used in any coding block and an index indicating the primary / secondary transform used can be entropy coded / decoded, or can be implicitly derived in the encoder / decoder based on at least one of current / surrounding coding information.

[0175] Quantized levels may be generated by quantizing the result of the primary transform and / or secondary transform or the residual signal. The quantized levels may be scanned based on at least one of upper right diagonal scanning, vertical scanning, and horizontal scanning based on at least one of an intra-frame prediction mode or a block size / shape. For example, coefficients of a block may be scanned using upper right diagonal scanning to be converted into a one-dimensional vector or array form. Instead of upper right diagonal scanning, vertical scanning, in which two-dimensional block shape coefficients are scanned in the column direction, or horizontal scanning, in which two-dimensional block shape coefficients are scanned in the row direction, may be used depending on the size and / or intra-frame prediction mode of the transform block. The scanned quantization levels may be entropy coded and included in a bitstream.

[0176] The decoder can generate quantization levels by entropy decoding the bitstream. The quantization levels in the form of a one-dimensional vector or array can be inverse scanned to arrange them into a two-dimensional block shape. In this case, the inverse scanning method can be at least one of upper right diagonal scanning, vertical scanning, and horizontal scanning.

[0177] Inverse quantization can be performed on the quantization levels, and a secondary inverse transform can be performed depending on whether or not a secondary inverse transform is performed. A primary inverse transform can be performed on the result of the secondary inverse transform depending on whether or not a primary inverse transform is performed, thereby generating a restored residual signal.

[0178] For example, if the size of the current coding block is 8x8, the residual signal for the 8x8 block may be entropy coded by scanning the quantized transform coefficients for each of four 4x4 sub-blocks according to at least one of the three scanning order methods shown in Figure 6 after primary transformation, secondary transformation, and quantization. Also, the quantized transform coefficients may be entropy decoded by inverse scanning. The inverse-scanned quantized transform coefficients become transform coefficients after inverse quantization, and at least one of secondary inverse transform or primary inverse transform may be performed to generate a reconstructed residual signal.

[0179] Hereinafter, a method for scanning transform coefficients according to an embodiment of the present invention will be described in detail with reference to FIGS.

[0180] The encoder can scan one or more of the transform coefficients generated as a result of a primary transform on the residual signal of the current block, the transform coefficients generated by further performing a secondary transform on the primary transform result, or the coefficients generated by performing quantization based on a scanning unit and a scanning order.

[0181] In this specification, the output of a primary transform, the output of a secondary transform, the output of quantization, the output of primary and secondary transforms, the output of primary transform and quantization, and the output of primary and secondary transform and quantization may be referred to as a transform coefficient. For convenience, the term "transform coefficient" also refers to a coefficient that is the result of only quantization without transformation.

[0182] In a decoder, entropy decoded transform coefficients may be inverse scanned based on one or more scanning units and scanning orders before performing an inverse transform, where the transform coefficients may be entropy decoded and / or dequantized transform coefficients.

[0183] Hereinafter, the scanning unit and scanning order of transform coefficients will be described based on the encoder, but the inverse scanning unit and inverse scanning order of transform coefficients can be described in the decoder in the same manner as the encoder.

[0184] The transform coefficients in the encoder can be quantized and scanned, and the scanned transform coefficients can then be entropy coded in the encoder.

[0185] The decoder may inverse scan the entropy-decoded transform coefficients and arrange them in a block shape. The block-arranged transform coefficients may be subjected to inverse quantization, secondary inverse transform, primary inverse transform after secondary inverse transform, or primary inverse transform. In this case, the block-arranged transform coefficients may be inverse transformed (secondary inverse transform and / or primary inverse transform) after inverse quantization. The inverse-transformed transform coefficients may become a reconstructed residual signal of the current block.

[0186] In this specification, the inputs of inverse quantization, secondary inverse transform, primary inverse transform, primary and secondary inverse transform, inverse quantization and primary inverse transform, and inverse quantization and primary and secondary inverse transform can be collectively referred to as transform coefficients. Here, for convenience, coefficients that are inputs to inverse quantization without transformation are also collectively referred to as transform coefficients.

[0187] Hereinafter, "scan" or "scanning" may refer to scanning or reverse scanning in an encoder / decoder. Reverse scanning in a decoder may also be referred to as "scan." A scanning order may refer to a scanning method. In this case, the scanning order may indicate at least one of diagonal scanning, vertical scanning, and horizontal scanning. The scanning order is not limited to the above scanning order, but may include at least one of first vertical-first scanning, which scans the first column before other columns, second vertical-first scanning, which scans the first and second columns before other columns, first horizontal-first scanning, which scans the first row before other rows, second horizontal-first scanning, which scans the first and second rows before other rows, up-right diagonal scanning, and down-left diagonal scanning.

[0188] Also, individual coefficients can refer to each of the transform coefficients.

[0189] Also, in this specification, first vertical priority scanning, second vertical priority scanning, first horizontal priority scanning, and second horizontal priority scanning may mean first vertical priority scanning order, second vertical priority scanning order, first horizontal priority scanning order, and second horizontal priority scanning order, respectively.

[0190] Furthermore, the first (or second) vertical priority scanning is not limited to scanning the first column (or the first and second columns) preferentially, but can scan one (or two) selected columns preferentially.

[0191] Furthermore, the first (or second) horizontally prioritized scanning is not limited to preferentially scanning the first row (or the first and second rows), but may preferentially scan one (or two) selected rows. Here, the selection of columns or rows to be preferentially scanned may be based on at least one of information signaled by a bitstream, information predetermined in the encoder / decoder, coding parameters, and a look-up table. Alternatively, any N selected rows or columns may be scanned prior to other rows or columns, or may be scanned after other rows or columns.

[0192] In accordance with an embodiment of the present invention, the start and end positions of a scanning order may be defined as the upper left and lower right sides of a block, respectively. Alternatively, the start and end positions of the scanning order may be defined as the lower right and upper left sides of a block, respectively. For example, an encoder and decoder may define a scanning order starting from the upper left position within a block and ending at the lower right position, but scanning may be performed in the reverse order of the scanning order when entropy encoding / decoding transform coefficients. Similarly, an encoder and decoder may define a scanning order starting from the lower right position within a block and ending at the upper left position, but scanning may be performed in the reverse order of the scanning order when entropy encoding / decoding transform coefficients.

[0193] Meanwhile, the start and end positions of the scanning order according to the present invention are not limited to the above example, and the positions of any two pixels within a block may be determined as the start and end positions of the scanning order, for example, at least one of the two pixels may be a corner pixel.

[0194] Coefficients belonging to a fixed size (e.g., a 4x4 square sub-block) in the current block may be determined as one coefficient group (CG). That is, to entropy encode / decode transform coefficients, a coefficient group may be defined, with N coefficients in the current block as one group. N may be a positive integer greater than or equal to 0. For example, N may be 16. The size of the coefficient group may be JxK, and a total of JxK coefficients may be included in one coefficient group. Here, J and K are positive integers and may have different values ​​or the same value. At least one of J and K may be information signaled from the encoder to the decoder, or may be a value preset in the encoder / decoder.

[0195] Meanwhile, flags and / or syntax elements for entropy coding / decoding transform coefficients can be determined for each coefficient group or each individual coefficient, i.e., at least one of the flags and / or syntax elements for transform coefficients can be entropy coded / decoded for each coefficient group or each individual coefficient.

[0196] Here, the flags and / or syntax elements may include at least one of coded_sub_block_flag (hereinafter referred to as CSBF), sig_coeff_flag, coeff_abs_level_greater1_flag, coeff_abs_level_greater2_flag, coeff_abs_level_greater3_flag, coeff_abs_level_greater4_flag, coeff_abs_level_greater5_flag, coeff_sign_flag, and coeff_abs_level_remaining_value.

[0197] The coded_sub_block_flag may be a syntax element that indicates whether there is at least one non-zero transform coefficient in each CG.

[0198] sig_coeff_flag may be a syntax element that indicates whether a transform coefficient is zero or not.

[0199] coeff_abs_level_greater1_flag may be a syntax element that indicates whether the absolute value of the transform coefficient is greater than one.

[0200] coeff_abs_level_greater2_flag may be a syntax element that indicates whether the absolute value of the transform coefficients is greater than two.

[0201] coeff_abs_level_greater3_flag may be a syntax element that indicates whether the absolute value of the transform coefficients is greater than three.

[0202] coeff_abs_level_greater4_flag may be a syntax element that indicates whether the absolute value of the transform coefficients is greater than four.

[0203] coeff_abs_level_greater5_flag may be a syntax element that indicates whether the absolute value of the transform coefficient is greater than 5.

[0204] coeff_sign_flag may be a syntax element that indicates the sign of the transform coefficient.

[0205] coeff_abs_level_remaining_value may be a syntax element that indicates the absolute value of the transform coefficient minus N when the absolute value of the transform coefficient is greater than N, where N may be a positive integer.

[0206] For example, when coeff_abs_level_greater1_flag and coeff_abs_level_greater2_flag are entropy coded / decoded, the coeff_abs_level_remaining_value may be a syntax element indicating a value obtained by subtracting 3 from the absolute value of a transform coefficient when the absolute value of the transform coefficient is greater than 3.

[0207] As another example, when coeff_abs_level_greater1_flag, coeff_abs_level_greater2_flag, coeff_abs_level_greater3_flag, coeff_abs_level_greater4_flag, and coeff_abs_level_greater5_flag are entropy coded / decoded, the coeff_abs_level_remaining_value may be a syntax element indicating a value obtained by subtracting 6 from the absolute value of a transform coefficient when the absolute value of the transform coefficient is greater than 6.

[0208] Meanwhile, at least one of flags and syntax elements for entropy encoding / decoding the transform coefficients can be entropy encoded / decoded while scanning the transform coefficients in the current block using a scanning order described below.

[0209] At least one of the flags and syntax elements for entropy encoding / decoding the transform coefficients may be scanned and entropy encoded or entropy decoded and scanned based on different scanning orders, and the scanning order of at least one of the flags and syntax elements for entropy encoding / decoding the transform coefficients may be determined based on the coding parameters of the current block.

[0210] Meanwhile, the transform coefficients to be scanned may refer to at least one of a quantized transform coefficient level, a transform coefficient, a quantized level, and a residual signal coefficient.

[0211] In addition, scanning may be performed on a quantization matrix (or a scaling list) using at least one of the scanning orders for the transform coefficients. In this case, the scanning order applied to the transform coefficients and the scanning order applied to the quantization matrix may correspond to each other. That is, one of the two scanning orders may be derived based on the other. For example, the two scanning orders may be the same or may be different from each other as derived by a predetermined method.

[0212] Also, for convenience, the following description will be made on the method of performing scanning in the encoder, but this is not limited to this, and the decoder can also perform reverse scanning based on the method of scanning in the encoder.

[0213] Next, the scanning unit will be described.

[0214] Transform coefficients may be scanned in one or more scanning units. According to an exemplary embodiment of the present invention, the scanning unit for transform coefficients may be any one of a region unit, a coefficient group unit, an individual coefficient unit, and a mixture unit. Scanning in a region unit may mean scanning each transform coefficient in a region including at least one of the blocks including the current block. The size of the region may be equal to or larger than the size of the current block. When scanning in a region unit, the region may be divided into coefficient groups, and scanning may be performed between each coefficient group, or for transform coefficients present in each coefficient group. Scanning in a coefficient group unit means dividing the current block into at least one coefficient group, and scanning each coefficient group, and for transform coefficients present in each coefficient group. That is, coefficient group unit scanning means that scanning may be performed between coefficient groups, or for transform coefficients within a coefficient group. Scanning in an individual coefficient unit may mean that scanning each transform coefficient in the current block is performed without using a coefficient group.

[0215] For example, the transform coefficients in the current block may be scanned in units of coefficient groups having one or more sizes or shapes of 2Nx2N, 2NxN, Nx2N, 3NxN, Nx3N, 3Nx2N, 2Nx3N, 4NxN, Nx4N, 4Nx3N, 3Nx4N, 8NxN, Nx8N, 8Nx7N, or 7Nx8N (N is an integer greater than or equal to 1), or may be scanned in units of individual coefficients. Here, the shape may refer to at least one of a square, a non-square, a non-square with a longer vertical length, and a non-square with a longer horizontal length.

[0216] The scanning unit can be determined based on the size of the current block.

[0217] Specifically, the scanning unit may be determined based on a comparison between the size of the current block and a predetermined threshold value, where the predetermined threshold value may refer to a reference size for determining the scanning unit and may be expressed as at least one of a minimum value and a maximum value.

[0218] On the other hand, the predetermined threshold value may be a fixed value predetermined in the encoder / decoder, or may be variably derived based on encoding / decoding related parameters of the current block (e.g., prediction mode (e.g., inter-frame prediction or intra-frame prediction), intra-frame prediction mode, whether or not to perform at least one of primary transformation and secondary transformation, transformation type, scanning order, etc.), and may be signaled via a bitstream (e.g., sequence, picture, slice, tile, CTU, block level, etc.).

[0219] For example, blocks whose product of horizontal length and vertical length is equal to or greater than N (for example, N=256) can be scanned in units of coefficient groups, while blocks whose product is not equal to N can be scanned in units of individual coefficients.

[0220] As another example, blocks whose minimum horizontal or vertical length is equal to or greater than M (e.g., M=8) may be scanned in coefficient group units, while other blocks may be scanned in individual coefficient units. However, without being limited to the above example, for example, blocks whose minimum horizontal or vertical length is equal to or less than the threshold (N or M) may be scanned in coefficient group units, while other blocks may be scanned in individual coefficient units.

[0221] Meanwhile, the scanning unit can be determined based on the shape of the current block.

[0222] For example, if the current block has a rectangular shape, it can be scanned in units of individual coefficients.

[0223] As another example, if the current block has a square shape, it can be scanned in units of coefficient groups. However, without being limited to the above example, for example, a rectangular current block can be scanned in units of coefficient groups, and a square current block can be scanned in units of individual coefficients.

[0224] Meanwhile, the scanning unit may be determined based on the intra prediction mode of the current block. At this time, the intra prediction mode value itself may be taken into consideration, or whether the intra prediction mode is a non-directional mode (DC mode or planar mode) or the directionality of the intra prediction mode (e.g., vertical direction or horizontal direction) may be taken into consideration.

[0225] For example, if the intra prediction mode of the current block is at least one of the DC mode and the planar mode, the current block may be scanned in units of coefficient groups.

[0226] As another example, if the intra prediction mode of the current block is the vertical mode, scanning may be performed in units of individual coefficients.

[0227] As another example, if the intra prediction mode of the current block is a horizontal mode, scanning may be performed in units of individual coefficients. However, without being limited to the above example, for example, scanning may be performed in units of individual coefficients in a non-directional mode, or in units of coefficient groups in a vertical mode or horizontal mode.

[0228] Meanwhile, information about the scanning unit can be signaled from the encoder to the decoder, so that the decoder can determine the scanning unit of the current block using the signaled information about the scanning unit.

[0229] 7 to 9 are diagrams illustrating a scanning unit according to an embodiment of the present invention.

[0230] The scanning unit may be determined in units of coefficient groups of a predefined fixed size or individual coefficients depending on the size and / or shape of the current block. For example, a single coefficient group having the same width:height ratio as the current block may be used.

[0231] The size of the coefficient group unit may be determined based on the horizontal:vertical ratio of the current block. Transform coefficients in the current block may be scanned in the same coefficient group unit. Here, the same coefficient group unit may mean that at least one of the size and shape of the coefficient group unit is the same.

[0232] As an example, the transform coefficients in a current block of size 16x16 can be scanned in units of the same 8x8 coefficient group.

[0233] As an example, the transform coefficients in a current block of size 8x16 can be scanned in units of the same 4x8 coefficient group.

[0234] As an example, the transform coefficients in a current block of size 16x8 can be scanned in units of the same 8x4 coefficient group.

[0235] For example, as shown in FIG. 7(a), the transform coefficients in a current block of size 16x16 can be scanned in units of the same 4x4 coefficient group.

[0236] For example, as shown in FIG. 7(b), the transform coefficients in a current block of size 8x16 can be scanned in units of the same 2x4 coefficient group.

[0237] For example, as shown in FIG. 7(c), the transform coefficients in a current block of size 16x8 can be scanned in units of the same 4x2 coefficient group.

[0238] Meanwhile, the transform coefficients in the current block may be scanned in units of different coefficient groups, where the different coefficient groups may differ in at least one of the size and the shape of the coefficient group units.

[0239] For example, as shown in FIG. 8, the transform coefficients in a current block of size 8x16 can be divided into one 8x8 coefficient group, two 4x4 coefficient groups, and eight 2x2 coefficient groups for scanning.

[0240] Meanwhile, size information for each coefficient group can be signaled from the encoder to the decoder, so that the decoder can determine the scanning unit of the current block using the signaled size information for each coefficient group.

[0241] Meanwhile, the transform coefficients in the current block may be scanned in units of individual coefficients, which may mean scanning the transform coefficients of the entire current block without dividing the current block into coefficient groups.

[0242] As an example, as shown in FIG. 9(a), all transform coefficients in a current block of size 16x8 can be scanned in units of individual coefficients.

[0243] Meanwhile, the transform coefficients in the current block may be scanned in a mixed unit, which may mean that coefficients belonging to some areas of the transform coefficients in the current block are scanned in coefficient group units, and coefficients belonging to the remaining areas are scanned in individual coefficient units.

[0244] As an example, as shown in (b) of Figure 9, among the transform coefficients in the current block of size 16x8, the transform coefficients belonging to the upper left 4x4 area can be scanned in units of 4x4 coefficient groups, and the transform coefficients belonging to the remaining areas can be scanned in units of individual coefficients.

[0245] However, without being limited to the above example, the size and / or shape of the partial region may be derived based on the size and / or shape of the current block. For example, if the current block is a 16x8 block, the partial region may be an 8x4 block.

[0246] Alternatively, at least one of the horizontal length and the vertical length of the partial region may be derived based on at least one of the horizontal length and the vertical length of the current block.

[0247] Alternatively, information indicating the size and / or shape of some regions can be entropy coded / decoded.

[0248] Alternatively, the size and / or shape of some regions can be derived from information of the current block and / or at least one neighboring block.

[0249] In addition, the location of the partial area is not limited to the upper left corner of the current block, but may be any location of the current block. For example, the partial area may be located at a corner of the current block, such as the lower left corner, upper right corner, or lower right corner.

[0250] Meanwhile, the positions of some regions may be derived based on at least one of the coding parameters including the size, shape, depth, prediction mode, intra-frame prediction mode, etc. of the current block. Alternatively, information regarding the positions of some regions may be signaled from the encoder to the decoder, or may be derived from information of the current block and / or at least one neighboring block.

[0251] Next, the scanning order will be described.

[0252] The transform coefficients may be scanned according to one or more scanning orders. When scanning in units of transform coefficient groups and / or in units of individual coefficients, the transform coefficients in the current block may be scanned between coefficient groups and / or within coefficient groups according to at least one scanning order. In this case, scanning may be performed on all or some of the transform coefficients in the current block.

[0253] According to an embodiment of the present invention, the transform coefficients may be scanned in units of individual coefficients and / or transform coefficient groups using one or more of the diagonal scanning order, horizontal scanning order, and vertical scanning order shown in Fig. 6, and the first mixed diagonal scanning order, second mixed diagonal scanning order, bottom-left diagonal scanning order, first vertical-first scanning order, second vertical-first scanning order, first horizontal-first scanning order, and second horizontal-first scanning order shown in Fig. 10. Here, the diagonal scanning order shown in Fig. 6 may refer to the top-right diagonal scanning order.

[0254] The scanning order can be determined based on the shape (square or non-square) of the current block. Here, the shape of the current block can be expressed by the width:height ratio of the current block. That is, the scanning order can be determined based on a comparison of the width and height of the current block. In this case, scanning can be performed on all or part of the transform coefficients in the current block.

[0255] For example, if the current block is square, it can be scanned in either a top-right diagonal scanning order or a bottom-left diagonal scanning order; if the block is longer in height than in width, it can be scanned in either a vertical scanning order, a first vertical-first scanning order, or a second vertical-first scanning order; and if the block is shorter in height than in width, it can be scanned in either a horizontal scanning order, a first horizontal-first scanning order, or a second horizontal-first scanning order.

[0256] As another example, if the current block is square, it may be scanned in either a top-right diagonal scanning order or a bottom-left diagonal scanning order, if the block is longer in height than width, it may be scanned in either a horizontal scanning order, a first horizontal-first scanning order, or a second horizontal-first scanning order, and if the block is shorter in height than width, it may be scanned in either a vertical scanning order, a first vertical-first scanning order, or a second vertical-first scanning order. Meanwhile, without being limited to the above example, for example, the available scanning orders when the current block is non-square (rectangular) and when the current block is square (square) may be reversed or different from those in the above example.

[0257] As another example, if the current block is rectangular (non-square) in shape, the transform coefficient groups or individual coefficients can be scanned based on at least one of a horizontal scanning order, a first horizontal priority scanning order, a second horizontal priority scanning order, a vertical scanning order, a first vertical priority scanning order, and a second vertical priority scanning order.

[0258] As another example, if the current block is square (rectangular), the transform coefficient groups or individual coefficients may be scanned based on at least one of a top-right diagonal scanning order and a bottom-left diagonal scanning order. However, without being limited to the above example, for example, the available scanning orders when the current block is rectangular and the available scanning orders when the current block is square may be reversed or different from the above example.

[0259] 11 to 13 are diagrams for explaining the relationship between scanning within a coefficient group and scanning between coefficient groups when scanning in units of coefficient groups. When scanning in units of coefficient groups, the same scanning order can be used for scanning within a coefficient group and scanning between coefficient groups.

[0260] For example, as shown in FIG. 11, when the transform coefficients in a current block of size 16x16 are scanned in units of 4x4 coefficient groups, the coefficients in the coefficient groups can be scanned in units of coefficient groups according to the upper right diagonal scanning order.

[0261] As another example, as shown in FIG. 12, when transform coefficients in a current block of size 8x16 are scanned in units of 2x4 coefficient groups, scanning of coefficients within the coefficient groups and coefficient group units can be performed according to the vertical scanning order.

[0262] As another example, as shown in FIG. 13, when transform coefficients in a current block of size 16x8 are scanned in units of 4x2 coefficient groups, scanning of coefficients within the coefficient groups and coefficient group units can be performed according to the horizontal scanning order.

[0263] As another example, when transform coefficients in a current block of size 8x8 are scanned in units of 4x4 coefficient groups, scanning of coefficients in the coefficient groups may be performed in units of coefficient groups according to a left-bottom diagonal scanning order.

[0264] As another example, when transform coefficients in a current block of size 4x8 are scanned in units of 4x4 coefficient groups, scanning of coefficients in the coefficient groups and coefficient groups may be performed according to a first vertical priority scanning order.

[0265] As another example, when transform coefficients in a current block of size 8x4 are scanned in units of 4x2 coefficient groups, scanning of coefficients within a coefficient group and between coefficient group units can be performed according to a first horizontal priority scanning order.

[0266] Conversely, when scanning in units of coefficient groups, different scanning orders may be used for scanning within a coefficient group and scanning between coefficient groups.

[0267] As an example, when scanning the transform coefficients in a current block of size 16x16 in units of 4x4 coefficient groups, the coefficients in the coefficient groups can be scanned according to the upper right diagonal scanning order, and the coefficient group units can be scanned according to the horizontal or vertical scanning order.

[0268] As another example, when scanning the transform coefficients in a current block of size 8x16 in units of 2x4 coefficient groups, the coefficients in the coefficient groups can be scanned according to a vertical scanning order, and the coefficient group units can be scanned according to an upper right diagonal or horizontal scanning order.

[0269] As another example, when scanning transform coefficients in a current block of size 16x8 in units of 4x2 coefficient groups, the coefficients in the coefficient groups can be scanned according to a horizontal scanning order, and the coefficient group units can be scanned according to an upper right diagonal or vertical scanning order.

[0270] As another example, when scanning the transform coefficients in a current block of size 8x8 in units of 4x4 coefficient groups, the coefficients in the coefficient groups can be scanned according to the lower left diagonal scanning order, and the coefficient group units can be scanned according to the upper right diagonal scanning order.

[0271] As another example, when scanning transform coefficients in a current block of size 4x8 in units of 4x4 coefficient groups, the coefficients in the coefficient groups can be scanned according to a first vertical-first scanning order or a second vertical-first scanning order, and the coefficient group units can be scanned according to a top right diagonal or bottom left diagonal scanning order.

[0272] As another example, when scanning transform coefficients in a current block of size 8x4 in units of 4x4 coefficient groups, the coefficients in the coefficient groups can be scanned according to a first horizontal priority scanning order or a second horizontal priority scanning order, and the coefficient group units can be scanned according to a top right diagonal scanning order or a bottom left diagonal scanning order.

[0273] Meanwhile, information indicating whether different scanning orders can be used for scanning within a coefficient group and scanning between coefficient groups during coefficient group scanning can be signaled from the encoder to the decoder in higher-level units. Here, the higher-level units can be, for example, one or more of a video parameter set (VPS), a sequence parameter set (SPS), a picture parameter set (PPS), a tile, a slice, a tile, and a CTU. Also, information regarding whether different types of scanning orders are used for block units such as a coding tree unit, a coding unit, a prediction unit, and a transform unit can be entropy coded / decoded. For example, information indicating whether different scanning orders can be used for scanning within a coefficient group and scanning between coefficient groups during coefficient group scanning can be represented in the form of a flag.

[0274] Meanwhile, in the individual coefficient unit scanning, all or some of the transform coefficients in the current block can be scanned according to one scanning order.

[0275] In the individual coefficient unit scanning, the scanning order can also be determined based on the shape of the current block. Here, the shape of the current block can be expressed by the width:height ratio of the current block. That is, the scanning order can be determined based on a comparison of the width and height of the current block.

[0276] As another example, as shown in (a) of Figure 14, the transform coefficients in a current block of size 8x8 can be scanned on an individual coefficient basis using either a top-right diagonal scanning order or a bottom-left diagonal scanning order, as shown in (b) of Figure 14, the transform coefficients in a current block of size 4x8 can be scanned on an individual coefficient basis using either a vertical scanning order, a first-vertical-priority scanning order, or a second-vertical-priority scanning order, and as shown in (c) of Figure 14, the transform coefficients in a current block of size 8x4 can be scanned on an individual coefficient basis using either a horizontal scanning order, a first-horizontal-priority scanning order, or a second-horizontal-priority scanning order.

[0277] Also, although not shown in Figure 14, if the current block is square, the transform coefficients within the current block are scanned on an individual coefficient basis using either an upper right diagonal scanning order or a lower left diagonal scanning order; if the current block is non-square in shape, where the vertical length is greater than the horizontal length, the transform coefficients within the current block are scanned on an individual coefficient basis using either a horizontal scanning order, a first horizontal priority scanning order, or a second horizontal priority scanning order; and if the current block is non-square in shape, where the vertical length is less than the horizontal length, the transform coefficients within the current block can be scanned on an individual coefficient basis using either a vertical scanning order, a first vertical priority scanning order, or a second vertical priority scanning order.

[0278] Meanwhile, during transform coefficient scanning, a scanning order mapped according to the size and / or shape of the current block may be used, where the shape may refer to whether the block is square, a non-square with a long horizontal length, or a non-square with a long vertical length.

[0279] Meanwhile, the scanning order can be determined based on the size of the current block.

[0280] Specifically, the scanning order may be determined based on a comparison between the size of the current block and a predetermined threshold value, where the predetermined threshold value may refer to a reference size for determining a scanning unit and may be expressed as at least one of a minimum value and a maximum value.

[0281] Meanwhile, the predetermined threshold value may be a fixed value predetermined in the encoder / decoder, or may be variably derived based on encoding / decoding related parameters of the current block (e.g., prediction mode, intra-frame prediction mode, transform type, scanning order, etc.), and may be signaled via a bitstream (e.g., sequence, picture, slice, tile, CTU, block level, etc.). In this case, scanning may be performed on all or some of the transform coefficients in the current block.

[0282] For example, for a block whose width and height are equal to or greater than 256, the transform coefficient groups or individual coefficients are scanned in either a top-right diagonal scanning order or a bottom-left diagonal scanning order. For other blocks, the transform coefficient groups or individual coefficients may be scanned in either a horizontal scanning order, a first-horizontal scanning order, or a second-horizontal scanning order, or in either a vertical scanning order, a first-vertical scanning order, or a second-vertical scanning order. Meanwhile, the threshold value compared with the product of the width and height is not limited to 256. Here, the threshold value may be, for example, any positive integer. Alternatively, there may be N (N is a positive integer) threshold values. When there are N threshold values, the scanning order corresponding to the section to which the current block belongs among the N+1 sections may be applied to the current block.

[0283] As another example, for a block whose minimum length among the horizontal and vertical lengths is 8 or less, the transform coefficient group or individual coefficients may be scanned in either the upper right diagonal scanning order or the lower left diagonal scanning order. For other blocks, the transform coefficient group or individual coefficients may be scanned in either the horizontal scanning order, the first horizontal priority scanning order, or the second horizontal priority scanning order, or in either the vertical scanning order, the first vertical priority scanning order, or the second vertical priority scanning order. Meanwhile, the threshold value compared with the minimum length among the horizontal and vertical lengths is not limited to 8. The threshold value may be, for example, any positive integer. Alternatively, there may be N (N is a positive integer) threshold values. When there are N threshold values, the scanning order corresponding to the section to which the current block belongs among N+1 sections may be applied to the current block.

[0284] As another example, if the size of the current block is the minimum block size that cannot be divided, a predetermined scanning order may be applied. The predetermined scanning order may be, for example, a diagonal scanning order from top right to bottom left. Information about the minimum block size may be signaled in units of at least one of VPS, SPS, PPS, slice, tile, CTU, and block.

[0285] Meanwhile, the scanning order can be determined based on the depth of the current block.

[0286] The scanning order may be determined based on a comparison between the depth of the current block and a predetermined threshold. The predetermined threshold refers to a reference size or depth that determines the scanning order. This may be expressed as at least one of a minimum value and a maximum value. The predetermined threshold may be a fixed value predetermined in the encoder / decoder, or may be variably derived based on encoding / decoding parameters of the current block (e.g., prediction mode, intra-frame prediction mode, transform type, scanning order, etc.), or may be signaled via a bitstream (e.g., sequence, picture, slice, tile, CTU, block level, etc.). In this case, scanning may be performed on all or some of the transform coefficients in the current block.

[0287] As an example, if the depth of the current block is 0, the transform coefficient groups or individual coefficients are scanned according to a top-right diagonal scanning order or a bottom-left diagonal scanning order, and if the depth of the current block is not 0, the transform coefficient groups or individual coefficients can be scanned in at least one of a horizontal scanning order, a first horizontal-first scanning order, a second horizontal-first scanning order, a vertical scanning order, a first vertical-first scanning order, and a second vertical-first scanning order.

[0288] As another example, if the depth of the current block is equal to or less than 1, the transform coefficient groups or individual coefficients are scanned in a top-right diagonal scanning order or a bottom-left diagonal scanning order. If the depth of the current block is greater than 1, the transform coefficient groups or individual coefficients may be scanned in any of a horizontal scanning order, a first-horizontal scanning order, a second-horizontal scanning order, a vertical scanning order, a first-vertical scanning order, and a second-vertical scanning order. Meanwhile, the threshold value compared with the depth of the current block is not limited to 0 or 1. Here, the threshold value may be, for example, a positive integer greater than or equal to 0. Alternatively, there may be N threshold values ​​(N is a positive integer). If there are N threshold values, a scanning order corresponding to the section to which the current block belongs among N+1 sections may be applied to the current block.

[0289] As another example, if the depth of the current block is the maximum division depth at which division is no longer possible, a predetermined scanning order may be applied. Here, the predetermined scanning order may be, for example, a diagonal scanning order. Information regarding the maximum division depth may be signaled in units of at least one of VPS, SPS, PPS, slice, tile, CTU, and block.

[0290] Meanwhile, the scanning order may be determined based on the intra prediction mode of the current block. In this case, the value of the intra prediction mode itself may be taken into consideration, or whether the intra prediction mode is a non-directional mode or the directionality of the intra prediction mode (e.g., vertical or horizontal) may be taken into consideration. In this case, scanning may be performed on all or some of the transform coefficients in the current block.

[0291] For example, if the intra prediction mode of the current block is at least one of DC mode and Planar mode, the transform coefficient groups or individual coefficients can be scanned according to either a top-right diagonal scanning order or a bottom-left diagonal scanning order.

[0292] As another example, if the intra-screen prediction mode of the current block is a vertical mode, the transform coefficient group or individual coefficients can be scanned according to any of a horizontal scanning order, a first horizontal priority scanning order, a second horizontal priority scanning order, a vertical scanning order, a first vertical priority scanning order, and a second vertical priority scanning order.

[0293] As another example, if the intra-screen prediction mode of the current block is a horizontal mode, the transform coefficient groups or individual coefficients can be scanned according to any of a horizontal scanning order, a first horizontal priority scanning order, a second horizontal priority scanning order, a vertical scanning order, a first vertical priority scanning order, and a second vertical priority scanning order.

[0294] As another example, if the intra prediction mode of the current block is a vertical mode or a horizontal mode, the transform coefficient groups or individual coefficients may be scanned according to at least one of a top-right diagonal scanning order and a bottom-left diagonal scanning order.

[0295] As another example, if the intra prediction mode of the current block is included in K modes adjacent to a vertical mode or a horizontal mode, the transform coefficient groups or individual coefficients may be scanned according to at least one of a horizontal scanning order and a left-bottom diagonal scanning order, where K may be a positive number greater than or equal to 1. In this case, the K modes adjacent to the vertical mode or the horizontal mode may be intra prediction modes corresponding to values ​​obtained by adding values ​​from −K / 2 to K / 2 to the value of a specific intra prediction mode indicated by the vertical mode or the horizontal mode.

[0296] As another example, if the intra prediction mode of the current block is included in K modes adjacent to a vertical mode or a horizontal mode, the transform coefficient groups or individual coefficients may be scanned according to one or more of a horizontal scanning order, a first horizontal-first scanning order, a second horizontal-first scanning order, a vertical scanning order, a first vertical-first scanning order, and a second vertical-first scanning order, where K may be a positive number greater than or equal to 1. In this case, the K modes adjacent to the vertical mode or the horizontal mode may be intra prediction modes corresponding to values ​​obtained by adding values ​​of −K / 2 to K / 2 to the value of a specific intra prediction mode indicated by the vertical mode or the horizontal mode.

[0297] As another example, if the intra prediction mode of the current block is even, the transform coefficient groups or individual coefficients may be scanned according to one or more of a top-right diagonal scanning order and a bottom-left diagonal scanning order, and if the intra prediction mode of the current block is odd, the transform coefficient groups or individual coefficients may be scanned according to one of a horizontal scanning order, a first-horizontal-first scanning order, a second-horizontal-first scanning order, a vertical scanning order, a first-vertical-first scanning order, a second-vertical-first scanning order, and a bottom-left diagonal scanning order.

[0298] As another example, if the intra prediction mode of the current block is odd, the transform coefficient groups or individual coefficients may be scanned according to one of the top-right diagonal scanning order and the bottom-left diagonal scanning order, and if the intra prediction mode of the current block is even, the transform coefficient groups or individual coefficients may be scanned according to one of the horizontal scanning order, the first-horizontal-first scanning order, the second-horizontal-first scanning order, the vertical scanning order, the first-vertical-first scanning order, the second-vertical-first scanning order, and the bottom-left diagonal scanning order.

[0299] As another example, regardless of the intra prediction mode of the current block, the transform coefficient groups or individual coefficients may be scanned according to either a top-right diagonal scanning order or a bottom-left diagonal scanning order.

[0300] As another example, based on a result of a modulo (MOD, %) operation performed on IPM, which is an intra prediction mode value of the current block, one of the top right diagonal scanning order, bottom left diagonal scanning order, horizontal scanning order, first horizontal-first scanning order, second horizontal-first scanning order, vertical scanning order, first vertical-first scanning order, and second vertical-first scanning order may be determined as the scanning order for the transform coefficient group or individual coefficient. Herein, the modulo operation may refer to a mathematical operation for calculating a remainder of a division. That is, at least one of the scanning orders may be determined based on the value of (IPM MOD M). Hereinafter, if IPM is 0, it may indicate a planar mode, and if IPM is 1, it may indicate a DC mode.

[0301] For example, if (IPM-2)MOD2) is 0, the transform coefficient groups or individual coefficients can be scanned according to an upper right diagonal scanning order, and if (IPM-2)MOD2) is 1, the transform coefficient groups or individual coefficients can be scanned according to a lower left diagonal scanning order.

[0302] For example, if (IPM-2)MOD4) is 0, the transform coefficient groups or individual coefficients can be scanned according to an upper right diagonal scanning order. If (IPM-2)MOD4) is 1, the transform coefficient groups or individual coefficients can be scanned according to a lower left diagonal scanning order. If (IPM-2)MOD4) is 2, the transform coefficient groups or individual coefficients can be scanned according to a vertical scanning order. If (IPM-2)MOD4) is 3, the transform coefficient groups or individual coefficients can be scanned according to a horizontal scanning order.

[0303] In addition, a predetermined number of directional prediction modes may be grouped into one group, and the scanning order corresponding to the group may be determined as the scanning order of the current block based on which group the intra prediction mode of the current block belongs to. In this case, the number of directional prediction modes included in the group may be the same as or different from the number of directional prediction modes included in other groups. Here, the grouping may be performed based on similarity in angle or direction of the directional prediction modes.

[0304] For example, a predetermined number of modes adjacent to a first mode may be classified into a first mode group, and a scanning order corresponding to the first mode group may be applied to a current block having an intra prediction mode included in the first mode group. For example, the first mode may be a vertical mode, a horizontal mode, a diagonal mode, etc.

[0305] Meanwhile, grouping may be performed based on a modulo operation of a value indicating a directional prediction mode. Here, a divisor used in the modulo operation may be determined based on the size, shape, or depth of the current block. The larger the size of the current block, the larger (or smaller) divisor can be used. The larger the divisor, the more groups are generated by the modulo operation, allowing for more precise determination of the scanning order.

[0306] In addition, a plurality of scanning orders (e.g., N, where N is a positive number greater than or equal to 2) may be determined based on the intra prediction mode (direction) of the current block. Here, the N scanning orders may be a plurality of scanning orders preset in the encoder / decoder according to the intra prediction mode. N different scanning orders may be determined according to the intra prediction mode. Here, the N scanning orders may include at least one of diagonal scanning, vertical scanning, horizontal scanning, upper right diagonal scanning, lower left diagonal scanning, first vertical-first scanning, second vertical-first scanning, first horizontal-first scanning, and second horizontal-first scanning.

[0307] As an example, if the intra-frame prediction mode of the current block is at least one of DC mode and Planar mode, the transform coefficient group or individual coefficient can be scanned based on information regarding the scanning order of one of two scanning orders (upper right diagonal scanning order and lower left diagonal scanning order).

[0308] As another example, if the intra prediction mode of the current block is a vertical mode, the transform coefficient groups or individual coefficients can be scanned based on information regarding a scanning order among two scanning orders (horizontal scanning order and bottom left diagonal scanning order).

[0309] As another example, if the intra prediction mode of the current block is included in K modes adjacent to the vertical mode, the transform coefficient groups or individual coefficients may be scanned based on information regarding a scanning order among two scanning orders (horizontal scanning order and bottom-left diagonal scanning order), where K may be a positive number greater than or equal to 1.

[0310] As another example, if the intra prediction mode of the current block is included in K modes adjacent to the vertical mode, the transform coefficient groups or individual coefficients may be scanned based on information regarding a scanning order among three scanning orders (horizontal scanning order, bottom-left diagonal scanning order, and first-horizontal-first scanning order), where K may be a positive number greater than or equal to 1.

[0311] As another example, if the intra-frame prediction mode of the current block is a horizontal mode, the transform coefficient groups or individual coefficients can be scanned based on information regarding a scanning order among two scanning orders (vertical scanning order and upper right diagonal scanning order).

[0312] As another example, if the intra prediction mode of the current block is included in K modes adjacent to the horizontal mode, the transform coefficient groups or individual coefficients may be scanned according to information on a scanning order among two scanning orders (vertical scanning order and upper right diagonal scanning order), where K may be a positive number greater than or equal to 1.

[0313] As another example, if the intra prediction mode of the current block is included in K modes adjacent to the horizontal mode, the transform coefficient groups or individual coefficients may be scanned based on information regarding a scanning order among three scanning orders (vertical scanning order, upper right diagonal scanning order, and first vertical-first scanning order), where K may be a positive number greater than or equal to 1.

[0314] As another example, when the vertical mode or horizontal mode has a specific intra-frame prediction mode value, the K modes adjacent to the vertical mode or horizontal mode may be intra-frame prediction modes corresponding to values ​​obtained by adding values ​​of -K / 2 to K / 2 to the specific intra-frame prediction mode value indicated by the vertical mode or horizontal mode.

[0315] Meanwhile, information about the scanning order can be signaled from the encoder to the decoder. Thus, the decoder can determine the scanning order of the current block using the signaled information about the scanning order. For example, the information about the scanning order can be information indicating a diagonal scanning order, a vertical scanning order, a horizontal scanning order, a first mixed diagonal scanning order, a second mixed diagonal scanning order, a top-right diagonal scanning order, a bottom-left diagonal scanning order, a first vertical-first scanning order, a second vertical-first scanning order, a first horizontal-first scanning order, or a second horizontal-first scanning order. In this case, the information about the scanning order can be entropy coded / decoded in the form of a flag or an index.

[0316] Meanwhile, the scanning order of the current block can be determined based on the scanning order used for the neighboring blocks of the current block or the coding parameters of the current block.

[0317] For example, the transform coefficients in the current block may be scanned in the same scanning order as that used in at least one of the left, right, upper, and lower blocks adjacent to the current block. In this case, a list including one or more scanning orders of the neighboring blocks may be formed, and the scanning order of the current block may be derived using an index to the list. The index may be entropy coded / decoded.

[0318] Alternatively, statistics of one or more scanning orders used in the neighboring blocks may be used. For example, a scanning order corresponding to at least one of the average, weighted average, minimum, maximum, mode, and median of values ​​indicating the scanning order may be determined as the scanning order of the current block.

[0319] On the other hand, when scanning is performed in coefficient group units, the scanning order of the transform coefficients in the current coefficient group in the current block may be determined based on the scanning order used in the neighboring coefficient groups adjacent to the current coefficient group. For example, the transform coefficients in the current coefficient group may be scanned in the same manner as the scanning order used in at least one of the left, right, upper, and lower coefficient groups adjacent to the current coefficient group.

[0320] In addition, the information on the scanning order is information on at least one of the scanning order between coefficient groups and the scanning order within a coefficient group, and can be entropy coded / decoded. That is, the scanning order information between coefficient groups and the scanning order information within a coefficient group can be entropy coded / decoded separately. Alternatively, the scanning order information between coefficient groups and the scanning order information within a coefficient group can be entropy coded / decoded as a single piece of information.

[0321] Alternatively, the scanning order of the neighboring blocks to which the same prediction mode as the intra prediction mode of the current block is applied may be selectively used. When there are a plurality of neighboring blocks to which the same prediction mode as the intra prediction mode of the current block is applied, the scanning order of the current block may be determined by constructing a list and applying an index, as described above.

[0322] At least one of the scanning unit and scanning order of the transform coefficients may be determined based on at least one of the type of transform applied to the current block, the position of the transform, the region to which the transform is applied, whether to perform a transform, whether to perform a primary transform, whether to perform a secondary transform, the block size, the block shape, and the intra-frame prediction mode (or direction). Here, at least one of the scanning unit and scanning order may be entropy coded / decoded.

[0323] Here, the position of the transform may be information indicating whether a specific transform is used for a vertical transform or a horizontal transform. Whether a transform is performed may indicate whether at least one of a linear transform and a quadratic transform is performed. The type of transform may indicate at least one of a trigonometric function-based transform type including a DCT-based transform such as DCT-II, DCT-V, DCT-VIII, DST-I, DST-VI, and DST-VII, and a DST-based transform, as well as a Karhunen-Loeve Transform (KLT), a directional transform, etc.

[0324] The linear transformation may be an identity transform, which may be applied to at least one of the horizontal transformation and the vertical transformation.

[0325] For example, if an identity transform is applied to both the vertical and horizontal transforms on the current block, the current block may be the same as if no transforms were applied.

[0326] For example, if an identity transform is used for the vertical transform on the current block, the current block will be the same as if only a one-dimensional horizontal transform had been performed, and if an identity transform is used for the horizontal transform on the current block, the current block will be the same as if only a one-dimensional vertical transform had been performed.

[0327] Alternatively, a secondary transformation can be performed on the current block using the identity transformation as the primary transformation, which is equivalent to performing only the secondary transformation on the current block.

[0328] Whether or not to use identity transforms as horizontal and vertical transforms can be determined based on at least one of coding parameters such as a prediction mode of the current block, an intra-frame prediction mode (direction), a block size, and a block shape.

[0329] Furthermore, blocks that have undergone identity transformation may not be subjected to deblocking filtering.

[0330] When a linear transformation is performed by combining an identity transform with another transform, the scanning order can be determined depending on the transformation position where the identity transform is used. Here, the identity transform is an n×n matrix I n It can be a matrix whose main diagonal (the diagonal from the top left to the bottom right) is all ones and whose remaining elements have values ​​of 0, such as:

number

[0331] As an example, when an identity transform is used for the horizontal transform and at least one of a DCT-based transform and a DST-based transform such as DCT-II, DCT-V, DCT-VIII, DST-I, DST-VI, or DST-VII is used for the vertical transform, the transform coefficient groups or individual coefficients can be scanned based on either a vertical scanning order, a first-vertical-first scanning order, or a second-vertical-first scanning order.

[0332] As another example, when the horizontal transform is performed using at least one of a DCT-based transform and a DST-based transform, such as DCT-II, DCT-V, DCT-VIII, DST-I, DST-VI, or DST-VII, and the vertical transform is performed using an identity transform, the transform coefficient groups or individual coefficients can be scanned based on either a horizontal scanning order, a first-horizontal-first scanning order, or a second-horizontal-first scanning order.

[0333] As another example, when the horizontal transform is an identity transform and the vertical transform is performed using at least one of a DCT-based transform and a DST-based transform, such as DCT-II, DCT-V, DCT-VIII, DST-I, DST-VI, or DST-VII, the groups of transform coefficients or individual coefficients can be scanned according to either a horizontal scanning order, a first-horizontal-first scanning order, or a second-horizontal-first scanning order.

[0334] As another example, when the horizontal transform uses at least one of a DCT-based transform and a DST-based transform, such as DCT-II, DCT-V, DCT-VIII, DST-I, DST-VI, or DST-VII, and the vertical transform identity transform is used, the groups of transform coefficients or individual coefficients can be scanned according to either a vertical scanning order, a first-vertical-first scanning order, or a second-vertical-first scanning order.

[0335] As another example, when an identity transform is performed for at least one of the horizontal and vertical transforms, the groups of transform coefficients or individual coefficients can be scanned based on either an upper right diagonal scan or a lower left diagonal scan.

[0336] The scanning order can also be determined based on whether or not an identity transformation is performed.

[0337] Meanwhile, when a DCT-based transform or a DST-based transform is performed on a transform block as a primary transform, the scanning order can be determined based on which of the DCT-based transform or the DST-based transform is used as a vertical transform or a horizontal transform. Here, the DCT-based transform may refer to at least one of DCT transforms such as DCT-II, DCT-V, and DCT-VIII. Also, the DST-based transform may refer to at least one of DST transforms such as DST-I, DST-VI, and DST-VII. Here, the DCT-based transform and the DST-based transform may refer to the DCT transform and the DST transform, respectively.

[0338] As an example, when a DCT transform is used for horizontal transformation and a DST transform is used for vertical transformation, the transform coefficient groups or individual coefficients can be scanned based on any one of a vertical scanning order, a first vertical priority scanning order, or a second vertical priority scanning order.

[0339] As another example, when a DST transform is used for the horizontal transform and a DCT transform is used for the vertical transform, the transform coefficient groups or individual coefficients can be scanned based on either a horizontal scanning order, a first horizontal priority scanning order, or a second horizontal priority scanning order.

[0340] As another example, when a DCT transform is used for horizontal transformation and a DST transform is used for vertical transformation, the transform coefficient groups or individual coefficients can be scanned based on any one of a horizontal scanning order, a first horizontal priority scanning order, or a second horizontal priority scanning order.

[0341] As another example, if the horizontal transformation is performed using a DST transformation and the vertical transformation is performed using a DCT transformation, the groups of transform coefficients or individual coefficients can be scanned based on either a vertical scanning order, a first vertical priority scanning order, or a second vertical priority scanning order.

[0342] As another example, when a DCT or DST transform is performed on a transform block as a primary transform, the groups of transform coefficients or individual coefficients may be scanned based on either a top-right diagonal scanning order or a bottom-left diagonal scanning order.

[0343] As another example, if a DCT or DST transform is used for the horizontal transform and a DCT or DST transform is used for the vertical transform as the primary transform, the transform coefficient groups or individual coefficients can be scanned based on either an upper right diagonal scanning or a lower left diagonal scanning.

[0344] The scanning order may be determined based on information such as a flag or index indicating at least one of the DCT and DST transformations, a flag or index indicating whether at least one of the DCT and DST transformations is to be used, or whether the DCT or DST transformation is to be performed as the primary transformation.

[0345] Meanwhile, when DST transformation is performed on the transform block as the primary transformation, the scanning order can be determined based on the rearrangement of the residual signal, which may mean a non-flipped residual signal, a horizontally flipped residual signal, a vertically flipped residual signal, a horizontally and vertically flipped residual signal, etc.

[0346] As an example, if the residual signal is not flipped, the transform coefficient groups or individual coefficients can be scanned based on either upper right diagonal scanning or lower left diagonal scanning.

[0347] As another example, if the residual signal is in a horizontally flipped form, the transform coefficient groups or individual coefficients can be scanned by upper right diagonal scanning.

[0348] As another example, if the residual signal is in a vertically flipped form, the transform coefficient groups or individual coefficients can be scanned by a lower left diagonal scanning.

[0349] As another example, if the residual signal is in a horizontally and vertically flipped form, the transform coefficient groups or individual coefficients can be scanned based on either a top-right diagonal scanning or a bottom-left diagonal scanning.

[0350] As another example, when a DST transform is performed on a transform block as a primary transform, groups of transform coefficients or individual coefficients can be scanned by either an upper right diagonal scan or a lower left diagonal scan.

[0351] As another example, if a transform block does not undergo a DST transform as a primary transform, the groups of transform coefficients or individual coefficients can be scanned by either an upper right diagonal scan or a lower left diagonal scan.

[0352] In addition, the scanning order can be determined based on whether or not DST conversion is performed as the primary conversion.

[0353] On the other hand, when a rotational transform is used as the secondary transform, the scanning order can be determined according to the rotation angle, and also based on information such as an index indicating the rotation angle.

[0354] For example, when the rotation angle is 0 degrees, vertical scanning, first vertical-priority scanning, or second vertical-priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle is 90 degrees, horizontal scanning, first horizontal-priority scanning, or second horizontal-priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle is 180 degrees, vertical scanning, first vertical-priority scanning, or second vertical-priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle is 270 degrees, horizontal scanning, first horizontal-priority scanning, or second horizontal-priority scanning can be used for each coefficient group or each individual coefficient.

[0355] As another example, when the rotation angle is 0 degrees, horizontal scanning, first horizontal priority scanning, or second horizontal priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle is 90 degrees, vertical scanning, first vertical priority scanning, or second vertical priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle is 180 degrees, horizontal scanning, first horizontal priority scanning, or second horizontal priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle is 270 degrees, vertical scanning, first vertical priority scanning, or second vertical priority scanning can be used for each coefficient group or each individual coefficient.

[0356] For example, when the transformation is performed using a rotation transformation as the secondary transformation, the scan can be performed by at least one of upper right diagonal scanning and lower left diagonal scanning.

[0357] As another example, if a quadratic transformation is performed, the scan can be performed by at least one of a top right diagonal scan and a bottom left diagonal scan.

[0358] As another example, when the DCT or DST transformation is performed as the primary transformation and the secondary transformation is performed, the image can be scanned by at least one of upper right diagonal scanning and lower left diagonal scanning.

[0359] Alternatively, the scanning order can be determined based on whether or not a secondary transformation is performed, whether or not a rotation transformation is performed as the secondary transformation, or whether or not a secondary transformation is performed after a primary transformation.

[0360] Meanwhile, when the secondary transformation is performed using a Givens transform or a Hyper-Givens transform, the scanning order can be determined according to the rotation angle θ (Theta). The scanning order can also be determined based on information such as an index indicating the rotation angle. Here, the Givens transform or Hyper-Givens transform matrix G(m, n, θ) can be defined based on a representative definition shown in Equation 2 below.

number

[0361] For example, when the rotation angle θ (Theta) is 0 degrees, vertical scanning, first vertical-priority scanning, or second vertical-priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle θ (Theta) is 90 degrees, horizontal scanning, first horizontal-priority scanning, or second horizontal-priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle θ (Theta) is 180 degrees, vertical scanning, first vertical-priority scanning, or second vertical-priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle θ (Theta) is 270 degrees, horizontal scanning, first horizontal-priority scanning, or second horizontal-priority scanning can be used for each coefficient group or each individual coefficient.

[0362] As another example, when the rotation angle θ (Theta) is 0 degrees, horizontal scanning, first horizontal priority scanning, or second horizontal priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle θ (Theta) is 90 degrees, vertical scanning, first vertical priority scanning, or second vertical priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle θ (Theta) is 180 degrees, horizontal scanning, first horizontal priority scanning, or second horizontal priority scanning can be used for each coefficient group or each individual coefficient. When the rotation angle θ (Theta) is 270 degrees, vertical scanning, first vertical priority scanning, or second vertical priority scanning can be used for each coefficient group or each individual coefficient.

[0363] As another example, if the transformation is performed using the Givens or Hyper-Givens transformation as the secondary transformation, scanning can be based on either an upper right diagonal scanning or a lower left diagonal scanning.

[0364] Alternatively, the scanning order can be determined based on whether the secondary transformation is a Givens transformation or a Hyper-Givens transformation.

[0365] The current block may include at least one of a transform-skipped region (only quantization is performed without transformation), a region where only primary transformation is performed, or a region where both primary and secondary transformations are performed. In this case, each region may be scanned in a predetermined scanning order. If secondary transformation is further performed only on some regions of the primary transformation result of the current block, the transform coefficients may be scanned by dividing the regions according to whether each transformation is applied. In this case, scanning may be performed on all or some of the transform coefficients in the current block.

[0366] For example, if the current block is a transform-skipped block or region, the transform coefficient groups or individual coefficients may be scanned based on one of the upper right diagonal scanning order and the lower left diagonal scanning order, and if the current block is not a transform-skipped block or region, the transform coefficient groups or individual coefficients may be scanned based on one of the horizontal scanning order, the first horizontal-first scanning order, the second horizontal-first scanning order, the vertical scanning order, the first vertical-first scanning order, and the second vertical-first scanning order.

[0367] As another example, if the current block is a transform-skipped block or region, the transform coefficient groups or individual coefficients may be scanned based on one of the horizontal scanning order, the first horizontal-first scanning order, the second horizontal-first scanning order, the vertical scanning order, the first vertical-first scanning order, and the second vertical-first scanning order. If the current block is not a transform-skipped block or region, the transform coefficient groups or individual coefficients may be scanned based on one of the upper-right diagonal scanning order and the lower-left diagonal scanning order. Meanwhile, the scanning order determined based on whether the current block is a transform-skipped block is not limited to the above example and may be determined as any scanning order selected from various scanning orders according to the present disclosure.

[0368] 15 shows a case where a primary transform is performed on an 8x8 current block, and then a secondary transform is performed on only a portion of the block (for example, the 4x4 region (gray region) in the upper left corner). In this case, the region where only the primary transform is performed and the region where both the primary and secondary transforms are performed are divided into Region A and Region B, respectively, and the transform coefficients are scanned by dividing them into Region A and Region B. Coefficient group units of the same or different sizes can be used in Region A and Region B, and the same or different scanning orders can be used between the regions.

[0369] As an example, the same 4x4 coefficient group unit scanning can be used for region A and region B, and the upper right diagonal scanning order or the lower left diagonal scanning order can be used for all regions.

[0370] As another example, region A may use 4x4 coefficient group unit scanning, region B may use 2x2 coefficient group unit scanning, and the coefficient units in region A may use vertical scanning order or horizontal scanning order, while the coefficient units in region B may use upper right diagonal scanning order or lower left diagonal scanning order.

[0371] As another example, region A can use 4x4 coefficient group-wise scanning, region B can use 2x2 coefficient group-wise scanning, and all regions can use right-up diagonal scanning or left-down diagonal scanning order.

[0372] As another example, as shown in FIG. 16, the same 4x4 coefficient group unit scanning can be used for both region A and region B, with the coefficient group units in region A using the upper right diagonal scanning order or the lower left diagonal scanning order, and region B using the vertical scanning order.

[0373] 17 shows a case where a primary transform is performed on a 16x16 current block, and then a secondary transform is performed on only a portion of the block (e.g., the 8x8 region (gray region) in the upper left corner). In this case, the region where only the primary transform is performed and the region where both the primary and secondary transforms are performed are divided into Region A and Region B, respectively, and the transform coefficients can be scanned by dividing them into Region A and Region B. Coefficient group units of the same or different sizes can be used in Region A and Region B, and the same or different scanning orders can be used between the regions.

[0374] As an example, the same 4x4 coefficient group unit scanning can be used for region A and region B, and the upper right diagonal scanning order or the lower left diagonal scanning order can be used for all regions.

[0375] As another example, region A may use 8x8 coefficient group unit scanning, region B may use 4x4 coefficient group unit scanning, and the coefficient units in region A may use vertical scanning order or horizontal scanning order, while the coefficient units in region B may use upper right diagonal scanning order or lower left diagonal scanning order.

[0376] As another example, the same 8x8 coefficient group-wise scanning can be used for region A and region B, and all regions can use either a right-up diagonal scanning or a left-down diagonal scanning order.

[0377] As another example, as shown in FIG. 18, the same 4x4 coefficient group unit scanning can be used for both region A and region B, with the coefficient group units in region A using a vertical scanning order and region B using a top right diagonal scanning order.

[0378] As another example, 4x4 and 8x8 coefficient unit scanning can be used for region A and region B, respectively, with coefficient units within region A using vertical scanning order and region B using upper right diagonal scanning order.

[0379] Meanwhile, the scanning order of the region that has undergone only primary transformation can be determined based on the intra prediction mode of the current block and the size of the current block.

[0380] The scanning order of the regions where the primary and secondary transformations have been performed may be determined based on the shape of the current block, or a predefined scanning order may be applied. Here, the predefined scanning order may be a scanning order commonly set in the encoder / decoder. Meanwhile, information about the predefined scanning order of the regions where the primary and secondary transformations have been performed may be signaled from the encoder to the decoder.

[0381] Meanwhile, at least one of the above scanning orders may be preset or stored in the encoder / decoder as a scanning order corresponding to a specific block size. Here, when determining the scanning order for blocks smaller than the specific block size, the scanning order for the specific block size may be derived by subsampling or upsampling.

[0382] As an example, if a block size of 32x32 is stored in an encoder / decoder in an upper right scanning order, in order to derive a scanning order for a block of 16x16 block size, only the scanning order value at the position corresponding to the upper right scanning order of 16x16 in the upper right scanning order of 32x32 can be extracted (or subsampled) to derive a scanning order for the block size of 16x16.

[0383] As another example, if the encoder / decoder stores data in a bottom-left scanning order for an 8x8 block size, to derive a scanning order for a block of 16x16 block size, the scanning order value at the position corresponding to the top-right scanning order for a 16x16 block size in the bottom-left scanning order for the 8x8 block can be upsampled (or interpolated) to derive a scanning order for the 16x16 block size.

[0384] On the other hand, if the current block has a non-square shape, the coefficient groups in the current block may be rearranged into a square, and then the transform coefficients in the rearranged coefficient groups may be scanned and entropy coded / decoded. In this case, the rearrangement method may be at least one of the scanning order embodiments of the present invention.

[0385] For example, if the current block is non-square and has a size of 32x8, the coefficient groups can be rearranged into a square block of size 16x16 using at least one of the scanning orders between the coefficient groups, and then the transform coefficients within the rearranged coefficient groups can be scanned.

[0386] The scanning order for the color difference signals can be determined in the same manner as the scanning order used for the luminance signal. In this case, the scanning order for the color difference signals can use at least one of the scanning order embodiments of the present invention. Alternatively, the scanning order for the color difference signals corresponding to the scanning order for the luminance signal can be predefined.

[0387] For example, the encoder / decoder may derive the scanning order for the chrominance signals from the scanning order for the luminance signal by referring to a predefined lookup table, or may determine the scanning order for the chrominance signals using at least one of various methods for determining the scanning order for the luminance signal according to the present invention.

[0388] Meanwhile, when the values ​​of the transform coefficients are expressed in the form of bit planes, they can be scanned and entropy coded / decoded for each bit plane using at least one of the scanning order embodiments of the present invention.

[0389] Meanwhile, the secondary transform may be performed using at least one of the scanning orders according to the present invention. That is, the secondary transform may be substituted by scanning the transform coefficients generated after the primary transform. By substituting scanning for the secondary transform, the transform coefficients may be rearranged, thereby improving coding efficiency.

[0390] FIG. 19 is a flowchart showing an image decoding method according to an embodiment of the present invention.

[0391] Referring to FIG. 19, the decoder may obtain transform coefficients of a current block from a bitstream (S1910).

[0392] Then, the decoder can determine the scanning unit and scanning order of the current block (S1920).

[0393] Here, the transform coefficients of the current block can be either the input of the inverse quantization, the input of the second-order inverse transform, or the input of the first-order inverse transform.

[0394] Meanwhile, the scanning order may include at least one of a vertical scanning order, a horizontal scanning order, a first vertical priority scanning order in which the first column is scanned before other columns, a second vertical priority scanning order in which the first and second columns are scanned before other columns, a first horizontal priority scanning order in which the first row is scanned before other rows, a second horizontal priority scanning order in which the first and second rows are scanned before other rows, a top right diagonal scanning order, and a bottom left diagonal scanning order.

[0395] Meanwhile, the scanning unit can be determined as one of a coefficient group unit, an individual coefficient unit, and a mixed unit.

[0396] Meanwhile, the step of determining a scanning unit and a scanning order of the current block (S1920) may determine the scanning unit and the scanning order of the current block based on at least one of the scanning units and scanning orders of the neighboring blocks of the current block.

[0397] Meanwhile, when the scanning unit of the current block is determined to be a coefficient group unit, the scanning order of the transform coefficients within the coefficient group unit can be determined based on the scanning order of the neighboring coefficient groups adjacent to the current coefficient group.

[0398] Meanwhile, the scanning order of the current block can be determined based on the depth of the current block.

[0399] Meanwhile, the scanning unit and scanning order of the chrominance components of the current block may be determined based on the scanning unit and scanning order of the luminance components of the current block.

[0400] Meanwhile, the scanning order of the quantization matrices of the current block can be derived based on the determined scanning order.

[0401] The decoder may then scan and arrange the transform coefficients of the current block based on the determined scanning unit and scanning order (S1930).

[0402] The decoder may then perform at least one of inverse quantization, a second-order inverse transform, or a first-order inverse transform on the aligned transform coefficients.

[0403] FIG. 20 is a flowchart illustrating an image encoding method according to an embodiment of the present invention.

[0404] Referring to FIG. 20, the encoder may obtain transform coefficients of the current block from the residual block of the current block (S2010). Next, the encoder can determine the scanning unit and scanning order of the current block (S2020).

[0405] Here, the transform coefficients of the current block may be any one of the outputs of a linear transform, a quadratic transform, or a quantization.

[0406] Meanwhile, the scanning order may include at least one of a vertical scanning order, a horizontal scanning order, a first vertical priority scanning order in which the first column is scanned before other columns, a second vertical priority scanning order in which the first and second columns are scanned before other columns, a first horizontal priority scanning order in which the first row is scanned before other rows, a second horizontal priority scanning order in which the first and second rows are scanned before other rows, a top right diagonal scanning order, and a bottom left diagonal scanning order.

[0407] Meanwhile, the scanning unit can be determined as one of a coefficient group unit, an individual coefficient unit, and a mixed unit.

[0408] Meanwhile, the step of determining a scanning unit and a scanning order of the current block (S2020) may determine the scanning unit and the scanning order of the current block based on at least one of the scanning units and scanning orders of the neighboring blocks of the current block.

[0409] Meanwhile, when the scanning unit of the current block is determined to be a coefficient group unit, the scanning order of the transform coefficients within the coefficient group unit can be determined based on the scanning order of the neighboring coefficient groups adjacent to the current coefficient group.

[0410] Meanwhile, the scanning order of the current block can be determined based on the depth of the current block.

[0411] Meanwhile, the scanning unit and scanning order of the chrominance components of the current block may be determined based on the scanning unit and scanning order of the luminance components of the current block.

[0412] Meanwhile, the scanning order of the quantization matrices of the current block can be derived based on the determined scanning order.

[0413] The encoder may then scan and entropy code the transform coefficients of the current block based on the determined scanning unit and scanning order (S2030).

[0414] These embodiments may be implemented in a similar manner in the encoder and decoder.

[0415] The order of applying the above embodiments may be different between the encoder and the decoder, or may be the same between the encoder and the decoder.

[0416] The above embodiment can be performed for each of the luminance and color difference signals, and the above embodiment can be performed for each of the luminance and color difference signals in the same manner.

[0417] The shape of the blocks to which the embodiments of the present invention are applied can have a square or non-square shape.

[0418] The embodiments of the present invention may be applied depending on the size of at least one of a coding block, a prediction block, a transform block, a block, a current block, a coding unit, a prediction unit, a transform unit, a unit, and a current unit. The size may be defined as a minimum size and / or a maximum size for applying the embodiments, or as a fixed size for applying the embodiments. The first embodiment may be applied to a first size, and the second embodiment may be applied to a second size. That is, the embodiments may be applied in combination depending on the size. The embodiments of the present invention may be applied only when the block size is equal to or greater than the minimum size and equal to or less than the maximum size. That is, the embodiments may be applied only when the block size is within a certain range.

[0419] For example, the above embodiment is applicable only when the size of the current block is 8x8 or larger. For example, the above embodiment is applicable only when the size of the current block is 4x4. For example, the above embodiment is applicable only when the size of the current block is 16x16 or smaller. For example, the above embodiment is applicable only when the size of the current block is 16x16 or larger and 64x64 or smaller.

[0420] An embodiment of the present invention may be applied according to a temporal layer. A separate identifier may be signaled to identify a temporal layer to which the embodiment is applicable, and the embodiment may be applied to the temporal layer identified by the identifier. The identifier may be defined as the lowest and / or highest layer to which the embodiment is applicable, or may be defined to indicate a specific layer to which the embodiment is applied. A fixed temporal layer to which the embodiment is applied may also be defined.

[0421] For example, the above embodiment is applicable only when the temporal layer of the current image is the lowest layer, for example, the above embodiment is applicable only when the temporal layer identifier of the current image is 1 or greater, or for example, the above embodiment is applicable only when the temporal layer of the current image is the highest layer.

[0422] Slice types to which the embodiments of the present invention are applied are defined, and the embodiments of the present invention can be applied according to the slice types.

[0423] At least one of the flags and indexes that are entropy coded in the encoder and entropy decoded in the decoder can be binarized using at least one of the following binarization methods. Truncated Rice Binarization Method K-th order Exp_Golomb (K-th order Exp_Golomb) binarization method Limited K-th order Exp_Golomb binarization method Fixed-length binarization method Unary binarization method Truncated Unary Binarization Method

[0424] The encoding / decoding process of the current block is not limited to any one of these embodiments, and a specific embodiment or a combination of at least one of these embodiments may be applied to the encoding / decoding process of the current block.

[0425] In the above-described embodiments, the methods are described as a series of steps or units and based on flowcharts, but the present invention is not limited to the order of these steps, and some steps may occur in a different order or simultaneously with other steps than those described above. Furthermore, those skilled in the art will understand that the steps shown in the flowcharts are not exclusive, and other steps may be included, or one or more steps in the flowcharts may be deleted without affecting the scope of the present invention.

[0426] The above-described embodiments include examples of various aspects. It is not possible to describe all possible combinations for illustrating the various aspects, but a person skilled in the art will recognize that other combinations are possible. Therefore, it can be said that the present invention includes all various alterations, modifications, and variations that fall within the scope of the following claims.

[0427] The above-described embodiments of the present invention may be embodied in the form of program instructions that can be executed by various computer components and stored on a computer-readable storage medium. The computer-readable storage medium may include, alone or in combination, program instructions, data files, data structures, and the like. The program instructions stored on the computer-readable storage medium may be those specially designed and constructed for the present invention, or those known and available to those skilled in the computer software arts. Examples of computer-readable storage media include magnetic media such as hard disks, floppy disks, and magnetic tape; optical media such as CD-ROMs and DVDs; magneto-optical media such as floptical disks; and hardware devices specially configured to store and execute program instructions, such as ROM, RAM, and flash memory. Examples of program instructions include not only machine language code produced by a compiler, but also high-level language code that can be executed by a computer using an interpreter, etc. The hardware devices may be configured to operate as one or more software modules to perform the processes of the present invention, or vice versa.

[0428] Although the present invention has been described above using specific details such as specific components, limited embodiments, and drawings, these are provided merely to facilitate a more comprehensive understanding of the present invention, and the present invention is not limited to the above embodiments. Those skilled in the art will be able to make various modifications and variations from these descriptions.

[0429] Therefore, the concept of the present invention should not be limited to the above-described embodiments, but should be considered to fall within the scope of the concept of the present invention, including not only the scope of the claims described below, but also all modifications equivalent to or similar to the scope of the claims. [Industrial Applicability]

[0430] The present invention can be used in devices for encoding / decoding images.

Claims

1. determining a scanning unit of the current block; obtaining the transform coefficients of the current block; aligning the transform coefficients of the current block by scanning the transform coefficients of the current block based on the determined scanning unit; Including, said scanning being performed according to a scanning order; If the current block is a transform-skipped block, the scan is performed in an upper right diagonal scanning order; the determined scanning unit is a coefficient group unit determined based on the size of the current block, the current block is non-square in shape; The coefficient group unit is square in shape. Image decoding method.

2. scanning a first transform coefficient followed by scanning a second transform coefficient according to the diagonal scanning order; the x-coordinate of the second transform coefficient is one greater than the x-coordinate of the first transform coefficient; The y coordinate of the second transform coefficient is smaller than the y coordinate of the first transform coefficient by 1. The image decoding method according to claim 1 .

3. obtaining the transform coefficients of the current block; determining a scanning unit of the current block; aligning the transform coefficients of the current block by scanning the transform coefficients of the current block based on the determined scanning unit; Including, said scanning being performed according to a scanning order; If the current block is a transform-skipped block, the scan is performed in an upper right diagonal scanning order; the determined scanning unit is a coefficient group unit determined based on the size of the current block, the current block is non-square in shape; The coefficient group unit is square in shape. Image encoding method.

4. scanning a first transform coefficient followed by scanning a second transform coefficient according to the diagonal scanning order; the x-coordinate of the second transform coefficient is one greater than the x-coordinate of the first transform coefficient; The y coordinate of the second transform coefficient is smaller than the y coordinate of the first transform coefficient by 1. The image encoding method according to claim 3 .

5. A method for transmitting a bitstream, comprising: the bitstream is generated by an image coding device, the transmission method includes transmitting the bitstream; the bitstream includes coded information about transform coefficients of a current block; A scanning unit of the current block is determined; Transform coefficients of the current block are obtained using the coded information; the transform coefficients of the current block are aligned by scanning the transform coefficients of the current block based on the determined scanning unit; said scanning being performed according to a scanning order; If the current block is a transform-skipped block, the scan is performed in an upper right diagonal scanning order; the determined scanning unit is a coefficient group unit determined based on the size of the current block, the current block is non-square in shape; The coefficient group unit is square in shape. Transmission method.

6. The method of claim 1, wherein scanning a first transform coefficient is followed by scanning a second transform coefficient in accordance with the diagonal scanning order; the x-coordinate of the second transform coefficient is one greater than the x-coordinate of the first transform coefficient; The y coordinate of the second transform coefficient is smaller than the y coordinate of the first transform coefficient by 1. The transmission method according to claim 5.

Citation Information

Patent Citations

  • Scanning coefficients in video coding

    JP2014525200A

  • Coding of significance coefficient information in conversion skip mode

    JP2014535247A

  • Method and device for encoding / decoding images

    US20150172658A1

  • Image encoding method, image decoding method, image encoding device, image decoding device, integrated circuit, and program

    WO2010050156A1

  • Image processing device and method

    WO2017195476A1