Image encoding / decoding method and bit stream transmission method using adaptive loop filter

By employing a cross-component adaptive in-loop filtering video coding method, the filter type is dynamically adjusted to optimize image encoding and decoding, thus solving the problem of increased data volume in high-resolution, high-quality images and achieving more efficient image encoding and decoding.

CN119484816APending Publication Date: 2025-02-18ELECTRONICS & TELECOMM RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411923827.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2019-11-22
Filing Date
2020-11-23
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

As the resolution and quality of high-definition and ultra-high-definition images improve, the amount of image data increases, leading to higher transmission and storage costs. Existing video coding technologies struggle to efficiently compress and decode high-resolution, high-quality images.

Method used

A video coding method employing cross-component adaptive in-loop filtering dynamically adjusts the filter type through adaptive loop filters and cross-component adaptive loop filters to optimize the image encoding and decoding process, thereby reducing computational complexity and memory requirements.

Benefits of technology

It improves image encoding and decoding efficiency, reduces the computational complexity and memory access bandwidth of image encoders and decoders, and optimizes the transmission and storage costs of image data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484816A_ABST
    Figure CN119484816A_ABST
Patent Text Reader

Abstract

The present invention relates to an image encoding / decoding method and a bitstream transmission method using an adaptive loop filter. An image decoding method according to one embodiment of the present invention comprises the steps of: acquiring a reconstructed luminance block of a current block; determining whether to apply a cross-component adaptive loop filter to the current block; if a cross-component adaptive loop filter is to be applied to the current block, acquiring a reconstructed chroma block of the current block to which the adaptive loop filter has been applied; and acquiring a final reconstructed chroma block of the current block to which a cross-component adaptive loop filter has been applied, using the reconstructed luma block and the reconstructed chroma block to which the adaptive loop filter has been applied.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of a patent application with an application date of November 23, 2020, application number 202080079501.7, and invention name “Image encoding / decoding method and bit stream sending method using adaptive loop filter”. Technical Field

[0002] The present invention relates to a video encoding / decoding method, a video encoding / decoding device and a recording medium storing a bit stream. In particular, the present invention relates to a video encoding / decoding method and device using in-loop filtering. Background Art

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

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

[0005] Technical issues

[0006] The object of the present invention is to provide a video encoding / decoding method and device using adaptive in-loop filtering.

[0007] An object of the present invention is to provide a video encoding / decoding method and apparatus using cross-component adaptive in-loop filtering.

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

[0009] Technical Solution

[0010] According to an embodiment of the present disclosure, an image decoding method includes: obtaining a reconstructed luminance block of a current block, determining whether a cross-component adaptive loop filter is applied to the current block, when a cross-component adaptive loop filter is applied to the current block, obtaining a reconstructed chrominance block of the current block to which the adaptive loop filter is applied, and using the reconstructed luminance block and the reconstructed chrominance block to which the adaptive loop filter is applied to obtain a final reconstructed chrominance block of the current block to which the cross-component adaptive loop filter is applied.

[0011] The step of determining whether a cross-component adaptive loop filter is applied to the current block comprises: obtaining information indicating whether a cross-component adaptive loop filter is available for the current block, and wherein the information indicating whether the cross-component adaptive loop filter is available is signaled via a sequence parameter set.

[0012] The image decoding method further includes: when a cross-component adaptive loop filter is applicable to the current block, obtaining information indicating whether the cross-component adaptive loop filter is applied to the Cb component of the current block.

[0013] Among them, information indicating whether the cross-component adaptive loop filter is applied to the Cb component is signaled through the picture header.

[0014] The image decoding method further includes: when a cross-component adaptive loop filter is applied to the Cb component, acquiring an adaptive parameter set indicator referenced by the Cb component.

[0015] The image decoding method further includes: when a cross-component adaptive loop filter is applicable to the current block, obtaining information indicating whether the cross-component adaptive loop filter is applied to the Cr component of the current block.

[0016] Among them, information indicating whether the cross-component adaptive loop filter is applied to the Cr component is signaled through the picture header.

[0017] The image decoding method further includes: when a cross-component adaptive loop filter is available for the Cr component, obtaining an adaptive parameter set indicator referenced by the Cr component.

[0018] Wherein, when the information indicating whether the cross-component adaptive loop filter is available is not signaled, it is determined that the cross-component adaptive loop filter is not available for the current block.

[0019] The image decoding method further includes: obtaining a reconstructed chroma block of the current block; and determining whether an adaptive loop filter is applied to the reconstructed chroma block.

[0020] Wherein, the step of determining whether an adaptive loop filter is applied to the reconstructed chroma block comprises: obtaining information indicating whether an adaptive loop filter is applicable to the reconstructed chroma block, and wherein the information indicating whether the adaptive loop filter is applicable is signaled via a picture header.

[0021] The information indicating whether the adaptive loop filter is available is signaled for each of the Cb component and the Cr component.

[0022] The image decoding method further includes: acquiring information indicating the type of an adaptive loop filter applied to the reconstructed chrominance block, wherein the type of the adaptive loop filter includes a linear adaptive loop filter and a nonlinear adaptive loop filter.

[0023] The information indicating the type of adaptive loop filter applied to the reconstructed chrominance block is a single syntax element.

[0024] The final reconstructed chrominance block is derived using a luminance block to which a cross-component adaptive loop filter is applied and a reconstructed chrominance block to which an adaptive loop filter is applied, wherein the luminance block to which a cross-component adaptive loop filter is applied is obtained by applying the cross-component adaptive loop filter to the reconstructed luminance block.

[0025] According to an embodiment of the present disclosure, an image encoding method includes: obtaining a reconstructed luminance block of a current block, determining whether a cross-component adaptive loop filter is applied to the current block, and when a cross-component adaptive loop filter is applied to the current block, obtaining a reconstructed chrominance block of the current block to which the adaptive loop filter is applied; and using the reconstructed luminance block and the reconstructed chrominance block to which the adaptive loop filter is applied to obtain a final reconstructed chrominance block of the current block to which the cross-component adaptive loop filter is applied.

[0026] The image encoding method further includes: encoding information indicating whether a cross-component adaptive loop filter is available for the current block, wherein the information on whether the cross-component adaptive loop filter is available is encoded through a sequence parameter set.

[0027] The final reconstructed chrominance block is derived using a luminance block to which a cross-component adaptive loop filter is applied and a reconstructed chrominance block to which an adaptive loop filter is applied, wherein the luminance block to which a cross-component adaptive loop filter is applied is obtained by applying the cross-component adaptive loop filter to the reconstructed luminance block.

[0028] According to an embodiment of the present disclosure, a computer-readable recording medium stores a bit stream received by an image decoding device and used to reconstruct a current block included in a current picture, wherein the bit stream is generated by an image encoding method, and the image encoding method includes: obtaining a reconstructed luminance block of the current block, determining whether a cross-component adaptive loop filter is applied to the current block, when a cross-component adaptive loop filter is applied to the current block, obtaining a reconstructed chrominance block of the current block to which the adaptive loop filter is applied, and using the reconstructed luminance block and the reconstructed chrominance block to which the adaptive loop filter is applied to obtain a final reconstructed chrominance block of the current block to which the cross-component adaptive loop filter is applied.

[0029] The image encoding method further comprises: encoding information indicating whether a cross-component adaptive loop filter is available for the current block, and wherein the information indicating whether the cross-component adaptive loop filter is available is encoded through a sequence parameter set.

[0030] Beneficial Effects

[0031] According to the present invention, an image encoding / decoding method and apparatus using adaptive in-loop filtering can be provided.

[0032] According to the present invention, an image encoding / decoding method and apparatus using cross-component adaptive in-loop filtering can be provided.

[0033] According to the present invention, an in-loop filtering method and apparatus using sub-sampling-based block classification can be provided to reduce the computational complexity and memory access bandwidth of an image encoder / decoder.

[0034] According to the present invention, an in-loop filtering method and apparatus using a multi-filter type can be provided to reduce the computational complexity, memory requirements, and memory access bandwidth of an image encoder / decoder.

[0035] According to the present invention, there can be provided a recording medium storing a bit stream generated by the image encoding / decoding method or apparatus of the present invention.

[0036] According to the present invention, the image encoding and / or decoding efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

[0039] Figure 3is a diagram schematically showing a partition structure of an image when the image is encoded and decoded.

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

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

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

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

[0044] Figure 8a and Figure 8b is a flowchart illustrating an image decoding and encoding method according to an embodiment of the present invention.

[0045] Fig. 9 is a diagram illustrating an example of determining slope values ​​according to horizontal, vertical, first diagonal, and second diagonal directions based on subsampling.

[0046] Figures 10 to 12 is a diagram illustrating an example of determining a slope value according to horizontal, vertical, first diagonal, and second diagonal directions at a specific sample point position according to an embodiment of the present invention.

[0047] Fig.13 is a diagram illustrating a diamond filter according to an embodiment of the present invention.

[0048] Fig.14 is a diagram showing a filter having a filter tap number of 5×5 according to an embodiment of the present invention.

[0049] Fig.15a and 15b is a diagram illustrating various filter types according to an embodiment of the present invention.

[0050] Fig.16 is a diagram illustrating an embodiment of a sequence parameter set syntax required for adaptive in-loop filtering.

[0051] Fig.17 is a diagram illustrating an embodiment of an adaptive parameter set syntax required for adaptive in-loop filtering.

[0052] Fig.18 is a diagram illustrating an embodiment of an adaptation parameter type of an adaptation parameter set.

[0053] Fig.19 is a diagram illustrating an embodiment of a slice header syntax required for adaptive in-loop filtering.

[0054] Figures 20a to 20d is a diagram illustrating an embodiment of an adaptive in-loop filter data syntax required for adaptive in-loop filtering.

[0055] Fig.21 is a diagram illustrating an embodiment of a coding tree block syntax required for adaptive in-loop filtering.

[0056] Fig.22a and Figure 22b is a diagram illustrating an embodiment of fixed filter coefficients.

[0057] Fig.23 is a diagram showing an embodiment of a mapping relationship between adaptive in-loop filter coefficient categories and filters.

[0058] Fig.24 is a diagram illustrating an embodiment of a tailored index for an adaptive in-loop filter data syntax.

[0059] Fig.25 It is shown in detail Fig.24 Schematic diagram of the pruning index of the adaptive in-loop filter data syntax.

[0060] Fig.26 is a diagram illustrating another embodiment of a tailored index for an adaptive in-loop filter data syntax.

[0061] Fig. 27 It is shown in detail Fig.26 Schematic diagram of the pruning index of the adaptive in-loop filter data syntax.

[0062] Fig.28 is a diagram showing another embodiment of a slice header syntax required for adaptive in-loop filtering.

[0063] Fig.29a and Fig.29b is a diagram illustrating another embodiment of an adaptive in-loop filter data syntax required for adaptive in-loop filtering.

[0064] Fig.30a and Fig.30b is a diagram illustrating another embodiment of a coding tree block syntax required for adaptive in-loop filtering.

[0065] Fig.31 It is shown in detail Fig.28 An illustration of the strip header syntax.

[0066] Fig.32 and Fig.33 It is shown in detail Fig.29a and Fig.29b Schematic diagram of the adaptive in-loop filter data syntax.

[0067] Figure 34 to Figure 35b It is shown in detail Fig.29a and Fig.29b Schematic diagram of the adaptive in-loop filter data syntax.

[0068] Fig.36 and Fig.37 It is shown in detail Fig.31 Illustration of the coding tree block syntax.

[0069] Fig.38 is a diagram illustrating a video decoding method using an adaptive in-loop filter according to an embodiment.

[0070] Fig.39 is a diagram illustrating a video encoding method using an adaptive in-loop filter according to an embodiment.

[0071] Fig.40 is a diagram illustrating an image decoding method according to another embodiment of the present disclosure.

[0072] Fig.41 is a diagram illustrating an image encoding method according to another embodiment of the present disclosure.

[0073] Fig.42 is a diagram illustrating a sequence parameter set according to another embodiment of the present disclosure.

[0074] Fig.43 is a diagram illustrating an adaptive parameter set according to another embodiment of the present disclosure.

[0075] Fig.44 is a diagram illustrating adaptive parameters according to another embodiment of the present disclosure.

[0076] Fig.45 is a diagram illustrating a picture header according to another embodiment of the present disclosure.

[0077] Fig.46 is a diagram illustrating a slice header according to another embodiment of the present disclosure.

[0078] Fig.47a and Figure 47b is a diagram illustrating ALF data according to another embodiment of the present disclosure.

[0079] Fig.48 is a diagram illustrating a coding tree unit (CTU) according to another embodiment of the present disclosure.

[0080] Fig.49 and Fig.50 2 is another diagram illustrating ALF data according to another embodiment of the present disclosure.

[0081] Fig.51 and Fig.522 is another diagram illustrating ALF data according to another embodiment of the present disclosure. DETAILED DESCRIPTION

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

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

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

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

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

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

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

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

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

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

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

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

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

[0095] In the following, the terms "region" and "segment" are used interchangeably.

[0096] Hereinafter, a specific signal may be a signal representing a specific block. For example, an original signal may be a signal representing a target block. A prediction signal may be a signal representing a prediction block. A residual signal may be a signal representing a residual block.

[0097] In an embodiment, each of the specific information, data, flags, indexes, elements, attributes, etc. may have a value. The value of the information, data, flags, indexes, elements, and attributes equal to "0" may represent a logical false or a first predefined value. In other words, the value "0", false, logical false, and the first predefined value may be replaced with each other. The value of the information, data, flags, indexes, elements, and attributes equal to "1" may represent a logical true or a second predefined value. In other words, the value "1", true, logical true, and the second predefined value may be replaced with each other.

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

[0099] Description of terms

[0100] Encoder: This refers to a device that performs encoding. In other words, it refers to an encoding device.

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

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

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

[0104] Unit: may refer to a coding and decoding unit. When encoding and decoding an image, a unit may be a region generated by partitioning a single image. In addition, when a single image is partitioned into sub-division units during encoding or decoding, a unit may represent a sub-division unit. That is, an image may be partitioned into a plurality of units. When encoding and decoding an image, a predetermined process for each unit may be performed. A single unit may be partitioned into sub-units having a size smaller than that of the unit. According to the function, a unit may represent a block, a macroblock, a coding tree unit, a coding tree block, a coding unit, a coding block, a prediction unit, a prediction block, a residual unit, a residual block, a transform unit, a transform block, and the like. In addition, in order to distinguish a unit from a block, a unit may include a luminance component block, a chrominance component block associated with the luminance component block, and a syntax element for each color component block. A unit may have various sizes and shapes, and specifically, the shape of a unit may be a two-dimensional geometric figure such as a square, a rectangle, a trapezoid, a triangle, a pentagon, and the like. Also, the unit information may include at least one of a unit type indicating a coding unit, a prediction unit, a transformation unit, etc., and a unit size, a unit depth, an order of encoding and decoding of the unit, and the like.

[0105] Coding tree unit: A single coding tree block configured with a luminance component Y and two coding tree blocks associated with chrominance components Cb and Cr. In addition, the coding tree unit may represent a syntax element including a block and each block. Each coding tree unit may be partitioned by using at least one of a quadtree partitioning method, a binary tree partitioning method, and a ternary tree partitioning method to configure subordinate units such as coding units, prediction units, transform units, etc. The coding tree unit may be used as a term for specifying a sample block that becomes a processing unit when encoding / decoding an image as an input image. Here, the quadtree may represent a quadtree.

[0106] When the size of the coding block is within a predetermined range, it is possible to divide it using only quadtree partitioning. Here, the predetermined range may be defined as at least one of the maximum size and the minimum size of the coding block that can be divided using only quadtree partitioning. Information indicating the maximum / minimum size of the coding block that allows quadtree partitioning may be signaled through a bitstream, and the information may be signaled in at least one unit of a sequence, a picture parameter, a parallel block group, or a slice (fragment). Optionally, the maximum / minimum size of the coding block may be a fixed size predetermined in the encoder / decoder. For example, when the size of the coding block corresponds to 256×256 to 64×64, it is possible to divide it using only quadtree partitioning. Optionally, when the size of the coding block is larger than the size of the maximum conversion block, it is possible to divide it using only quadtree partitioning. Here, the block to be divided may be at least one of a coding block and a transform block. In this case, the information indicating the division of the coding block (e.g., split_flag) may be a flag indicating whether quadtree partitioning is performed. When the size of the coding block falls within a predetermined range, it is possible to divide it using only binary or ternary tree partitioning. In this case, the above description of the quadtree partition can be applied to the binary tree partition or the ternary tree partition in the same manner.

[0107] Coding tree block: may be used as a term used to designate any one of a Y coding tree block, a Cb coding tree block, and a Cr coding tree block.

[0108] Neighboring block: may refer to a block adjacent to the current block. The block adjacent to the current block may refer to a block that touches the boundary of the current block or a block that is located within a predetermined distance from the current block. The neighboring 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 refer to a block that is vertically adjacent to a neighboring block that is horizontally adjacent to the current block or a block that is horizontally adjacent to a neighboring block that is vertically adjacent to the current block.

[0109] Reconstructed neighboring block: may represent a neighboring block that is adjacent to the current block and has been encoded or decoded in space / time. Here, the reconstructed neighboring block may represent a reconstructed neighboring unit. The reconstructed spatial neighboring block may be a block that is within the current picture and has been reconstructed by encoding or decoding or both encoding and decoding. The reconstructed temporal neighboring block is a block at a position corresponding to the current block of the current picture within the reference image or a neighboring block of the block.

[0110] Unit depth: can represent the degree of partitioning of a unit. In a tree structure, the highest node (root node) can correspond to the first unit that is not partitioned. In addition, the highest node can have a minimum depth value. In this case, the depth of the highest node can be level 0. A node with a depth of level 1 can represent a unit generated by partitioning the first unit once. A node with a depth of level 2 can represent a unit generated by partitioning the first unit twice. A node with a depth of level n can represent a unit generated by partitioning the first unit n times. A leaf node can be the lowest node and a node that cannot be further partitioned. The depth of a leaf node can be the maximum level. For example, the predefined value of the maximum level can be 3. The depth of the root node can be the lowest, and the depth of the leaf node can be the deepest. In addition, when a unit is represented as a tree structure, the level at which the unit exists can represent the unit depth.

[0111] Bitstream: can represent a stream of bits including coded image information.

[0112] Parameter set: corresponds to header information among the configurations in the bitstream. At least one of a video parameter set, a sequence parameter set, a picture parameter set, and an adaptation parameter set may be included in the parameter set. In addition, the parameter set may include a slice header, a tile group header, and tile header information. The term "tile group" means a group of tiles and has the same meaning as a slice.

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

[0114] Symbol: At least one of a syntax element, a coding parameter, and a transform coefficient value that can represent a coding / decoding target unit. In addition, the symbol can represent an entropy coding target or an entropy decoding result.

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

[0116] Prediction unit: may represent a basic unit when performing prediction (such as inter prediction, intra prediction, inter compensation, intra compensation, and motion compensation). A single prediction unit may be partitioned into multiple partitions of smaller size, or may be partitioned into multiple lower-level prediction units. Multiple partitions may be basic units when performing prediction or compensation. Partitions generated by splitting a prediction unit may also be prediction units.

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

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

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

[0120] The prediction list utilization flag indicates whether at least one reference picture in a specific reference picture list is used to generate a prediction block. The prediction list utilization flag may be used to derive the inter prediction indicator, and conversely, the inter prediction indicator may be used to derive the prediction list utilization flag. For example, when the prediction list utilization flag has a first value of zero (0), it indicates that the reference picture in the reference picture list is not used to generate the prediction block. On the other hand, when the prediction list utilization flag has a second value of one (1), it indicates that the reference picture list is used to generate the prediction block.

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

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

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

[0124] The search range may be a two-dimensional area that is searched during inter prediction to retrieve a motion vector. For example, the size of the search range may be M×N. Here, M and N are both integers.

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

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

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

[0128] The motion information may represent information including at least one of items including a motion vector, a reference picture index, an inter prediction indicator, a prediction list utilization flag, a reference picture list information, a reference picture, a motion vector candidate, a motion vector candidate index, a merge candidate, and a merge index.

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

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

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

[0132] Transform unit: may represent a basic unit when encoding / decoding (such as transform, inverse transform, quantization, inverse quantization, transform coefficient encoding / decoding) is performed on a residual signal. A single transform unit may be partitioned into a plurality of lower-level transform units having a smaller size. Here, the transform / inverse transform may include at least one of a first transform / first inverse transform and a second transform / second inverse transform.

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

[0134] Quantization parameter: may indicate a value used when a transform coefficient is used to generate a quantized level during quantization. The quantization parameter may also indicate a value used when a transform coefficient is generated by scaling the quantized level during inverse quantization. The quantization parameter may be a value mapped to a quantization step size.

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

[0136] Scan: may refer to a method of ordering coefficients within a cell, block, or matrix. For example, changing a two-dimensional matrix of coefficients to a one-dimensional matrix may be called scanning, and changing a one-dimensional matrix of coefficients to a two-dimensional matrix may be called scanning or inverse scanning.

[0137] Transform coefficient: may refer to a coefficient value generated after performing a transform in an encoder. Transform coefficient may refer to a coefficient value generated after performing at least one of entropy decoding and inverse quantization in a decoder. A quantization level obtained by quantizing a transform coefficient or a residual signal or a quantized transform coefficient level may also fall within the meaning of a transform coefficient.

[0138] Quantization level: may represent a value generated by quantizing a transform coefficient or a residual signal in an encoder. Alternatively, the quantization level may represent a value that is a dequantization target subjected to dequantization in a decoder. Similarly, the quantized transform coefficient level as a result of transformation and quantization may also fall within the meaning of the quantization level.

[0139] Non-zero transform coefficient: may refer to a transform coefficient having a value other than zero, or a transform coefficient level or quantization level having a value other than zero.

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

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

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

[0143] Non-default matrix: may denote a quantization matrix that is not predefined in the encoder or decoder but is signaled by the user.

[0144] Statistical value: The statistical value for at least one of a variable, a coding parameter, a constant value, etc. having a calculable specific value can be one or more of the average value, summed value, weighted average value, weighted sum value, minimum value, maximum value, most frequently occurring value, median value, and interpolation value of the corresponding specific value.

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

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

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

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

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

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

[0151] The motion compensation unit 112 may generate a predicted block by performing motion compensation on the current block using a motion vector. Here, inter prediction may refer to prediction or motion compensation between frames.

[0152] When the value of the motion vector is not an integer, the motion prediction unit 111 and the motion compensation unit 112 may generate a prediction block by applying an interpolation filter to a partial area of ​​a reference picture. In order to perform inter-picture prediction or motion compensation on a coding unit, it may be determined which mode among the skip mode, merge mode, advanced motion vector prediction (AMVP) mode, and current picture reference mode is used for motion prediction and motion compensation of a prediction unit included in the corresponding coding unit. Then, inter-picture prediction or motion compensation may be performed differently according to the determined mode.

[0153] The subtractor 125 may generate a residual block by using the difference between the input block and the prediction block. The residual block may be referred to as a residual signal. The residual signal may represent the difference between the original signal and the prediction signal. In addition, the residual signal may be a signal generated by transforming or quantizing the difference between the original signal and the prediction signal, or by transforming and quantizing the difference between the original signal and the prediction signal. The residual block may be a residual signal of a block unit.

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

[0155] The quantized level may be generated by applying quantization to a transform coefficient or to a residual signal. Hereinafter, the quantized level may also be referred to as a transform coefficient in an embodiment.

[0156] The quantization unit 140 may generate a quantization level by quantizing the transform coefficient or the residual signal according to the parameter and output the generated quantization level. Here, the quantization unit 140 may quantize the transform coefficient by using a quantization matrix.

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

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

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

[0160] The coding parameters may include information such as syntax elements (flags, indexes, etc.) that are encoded in the encoder and sent to the decoder by signaling, as well as information derived when performing encoding or decoding. The coding parameters may represent information required when encoding or decoding an image. For example, at least one value or combination of the following items may be included in the coding parameters: unit / block size, unit / block depth, unit / block partition information, unit / block shape, unit / block partition structure, whether to perform quadtree partitioning, whether to perform binary tree partitioning, binary tree partition direction (horizontal or vertical), binary tree partition form (symmetric partitioning or asymmetric partitioning), whether the current coding unit is partitioned by ternary tree partitioning, the direction of ternary tree partitioning (horizontal or vertical), the type of ternary tree partitioning (symmetric type or asymmetric type), whether the current coding unit is partitioned by multi-type tree partitioning, and the type of multi-type tree partitioning. direction (horizontal or vertical), type of multi-type tree partition (symmetric or asymmetric), tree (binary tree or ternary tree) structure of multi-type tree partition, prediction mode (intra-frame prediction or inter-frame prediction), luminance intra-frame prediction mode / direction, chrominance intra-frame prediction mode / direction, intra-frame partition information, inter-frame partition information, coding block partition flag, prediction block partition flag, transform block partition flag, reference sample filtering method, reference sample filter taps, reference sample filter coefficients, prediction block filtering method, prediction block filter taps, prediction block filter coefficients, prediction block boundary filtering method, prediction block boundary filter taps, prediction block boundary filter coefficients, intra-frame prediction mode , inter prediction mode, motion information, motion vector, motion vector difference, reference picture index, inter prediction angle, inter prediction indicator, prediction list utilization flag, reference picture list, reference picture, motion vector predictor index, motion vector predictor candidate, motion vector candidate list, whether to use merge mode, merge index, merge candidate, merge candidate list, whether to use skip mode, interpolation filter type, interpolation filter tap, interpolation filter coefficient, motion vector size, representation accuracy of motion vector, transform type, transform size, information on whether primary (first) transform is used, information on whether secondary transform is used, primary transform index, secondary transform index , information on whether a residual signal exists, coding block pattern, coding block flag (CBF), quantization parameter, quantization parameter residual, quantization matrix, whether to apply an intra-loop filter, intra-loop filter coefficients, intra-loop filter taps, intra-loop filter shape / form, whether to apply a deblocking filter, deblocking filter coefficients, deblocking filter taps, deblocking filter strength, deblocking filter shape / form, whether to apply adaptive sample offset, adaptive sample offset value, adaptive sample offset category, adaptive sample offset type, whether to apply an adaptive intra-loop filter, adaptive intra-loop filter coefficients, adaptive intra-loop filter taps, adaptive intra-loop filter shape / form,Binarization / debinarization method, context model determination method, context model update method, whether to execute normal mode, whether to execute bypass mode, context binary bit, bypass binary bit, significant coefficient flag, last significant coefficient flag, encoding flag for unit of coefficient group, position of last significant coefficient, flag on whether the value of coefficient is greater than 1, flag on whether the value of coefficient is greater than 2, flag on whether the value of coefficient is greater than 3, information on remaining coefficient values, positive and negative sign information, reconstructed luminance sample, reconstructed chrominance sample, residual luminance sample, residual chrominance sample, luminance transform coefficient, chrominance transform coefficient, quantized luminance level, quantized chrominance level, transform coefficient level scanning method, motion vector at decoder side the size of the motion vector search area, the shape of the motion vector search area at the decoder side, the number of motion vector searches at the decoder side, information about the CTU size, information about the minimum block size, information about the maximum block size, information about the maximum block depth, information about the minimum block depth, image display / output order, slice identification information, slice type, slice partition information, tile identification information, tile type, tile partition information, tile group identification information, tile group type, tile group partition information, picture type, bit depth of input samples, bit depth of reconstructed samples, bit depth of residual samples, bit depth of transform coefficients, bit depth of quantization levels, and information about a luminance signal or information about a chrominance signal.

[0161] Here, signaling a flag or an index may mean entropy encoding the corresponding flag or index by an encoder and including it in a bitstream, and may mean entropy decoding the corresponding flag or index from the bitstream by a decoder.

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

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

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

[0165] The deblocking filter may remove block distortion generated in the boundary between blocks. In order to determine whether to apply the deblocking filter, it may be determined whether to apply the deblocking filter to the current block based on the samples included in the number of rows or columns included in the block. When the deblocking filter is applied to the block, another filter may be applied according to the required deblocking filter strength.

[0166] In order to compensate for the coding error, a suitable offset value may be added to the sample value by using sample adaptive offset. Sample adaptive offset can correct the offset of the deblocked image from the original image in units of samples. A method of applying the offset in consideration of edge information about each sample may be used, or a method of partitioning the samples of the image into a predetermined number of regions, determining the region to which the offset is applied, and applying the offset to the determined region may be used.

[0167] The adaptive in-loop filter may perform filtering based on a comparison result of a filtered reconstructed image and an original image. Samples included in an image may be partitioned into predetermined groups, a filter to be applied to each group may be determined, and differential filtering may be performed on each group. Information on whether ALF is applied may be signaled by a coding unit (CU), and the form and coefficient of ALF to be applied to each block may vary.

[0168] The reconstructed block or the reconstructed image that has passed through the filter unit 180 may be stored in the reference picture buffer 190. The reconstructed block processed by the filter unit 180 may be a part of the reference image. That is, the reference image is a reconstructed image composed of the reconstructed blocks processed by the filter unit 180. The stored reference image may be used later in inter-frame prediction or motion compensation.

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

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

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

[0172] The decoding device 200 may receive a bit stream output from the encoding device 100. The decoding device 200 may receive a bit stream stored in a computer-readable recording medium, or may receive a bit stream streamed through a wired / wireless transmission medium. The decoding device 200 may decode the bit stream by using an intra mode or an inter mode. In addition, the decoding device 200 may generate a reconstructed image or a decoded image generated by decoding, and output the reconstructed image or the decoded image.

[0173] When the prediction mode used in decoding is the intra mode, the switch may be switched to the intra mode. Alternatively, when the prediction mode used in decoding is the inter mode, the switch may be switched to the inter mode.

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

[0175] The entropy decoding unit 210 may generate symbols by entropy decoding the bit stream according to the probability distribution. The generated symbols may include symbols in the form of quantized levels. Here, the entropy decoding method may be an inverse process of the above entropy encoding method.

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

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

[0178] When the intra mode is used, the intra prediction unit 240 may generate a predicted block by performing spatial prediction on the current block, wherein the spatial prediction uses sample values ​​of a block that is adjacent to the decoding target block and has been decoded.

[0179] When the inter mode is used, the motion compensation unit 250 may generate a prediction block by performing motion compensation on the current block, wherein the motion compensation uses a motion vector and a reference image stored in the reference picture buffer 270 .

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

[0181] Figure 3 is a diagram schematically showing a partition structure of an image when the image is encoded and decoded. Figure 3 An example of partitioning a single unit into a plurality of subordinate units is schematically shown.

[0182] In order to effectively partition an image, a coding unit (CU) may be used when encoding and decoding. A coding unit may be used as a basic unit when encoding / decoding an image. In addition, a coding unit may be used as a unit for distinguishing an intra prediction mode from an inter prediction mode when encoding / decoding an image. A coding unit may be a basic unit for prediction, transformation, quantization, inverse transformation, inverse quantization, or encoding / decoding processing of a transform coefficient.

[0183] Reference Figure 3 , the image 300 is partitioned sequentially according to the maximum coding unit (LCU), and the LCU unit is determined as a partition structure. Here, the LCU may be used in the same meaning as the coding tree unit (CTU). Unit partitioning may represent partitioning of a block associated with the unit. In the block partition information, information about the unit depth may be included. The depth information may represent the number or degree of the unit being partitioned or both the number and degree of the unit being partitioned. A single unit may be partitioned into a plurality of subordinate units hierarchically associated with the depth information based on a tree structure. In other words, the unit and the subordinate units generated by partitioning the unit may correspond to a node and a child node of the node, respectively. Each of the partitioned subordinate units may have depth information. The depth information may be information representing the size of a CU and may be stored in each CU. The unit depth represents the number and / or degree associated with partitioning the unit. Therefore, the partition information of the subordinate unit may include information about the size of the subordinate unit.

[0184] The partition structure may represent the distribution of coding units (CUs) within the LCU 310. Such distribution may be determined according to whether a single CU is partitioned into multiple (including 2, 4, 8, 16, etc., positive integers equal to or greater than 2) CUs. The horizontal size and vertical size of the CU generated by partitioning may be half of the horizontal size and vertical size of the CU before partitioning, respectively, or may have sizes smaller than the horizontal size and vertical size before partitioning, respectively, according to the number of partitioning. The CU may be recursively partitioned into multiple CUs. By recursive partitioning, at least one of the height and width of the CU after partitioning may be reduced compared to at least one of the height and width of the CU before partitioning. The partitioning of the CU may be recursively performed until a predefined depth or a predefined size. For example, the depth of the LCU may be 0, and the depth of the minimum coding unit (SCU) may be a predefined maximum depth. Here, as described above, the LCU may be a coding unit having a maximum coding unit size, and the SCU may be a coding unit having a minimum coding unit size. Partitioning starts from the LCU 310, and when the horizontal size or the vertical size or both the horizontal size and the vertical size of the CU are reduced by partitioning, the CU depth increases by 1. For example, for each depth, the size of the non-partitioned CU may be 2N×2N. In addition, in the case of a partitioned CU, a CU of size 2N×2N may be partitioned into four CUs of size N×N. As the depth increases by 1, the size of N may be halved.

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

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

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

[0188] For example, when one coding unit is partitioned into two sub-coding units, the horizontal size or vertical size (width or height) of each of the two sub-coding units may be half of the horizontal size or vertical size of the original coding unit. For example, when a coding unit of size 32×32 is partitioned vertically into two sub-coding units, each of the two sub-coding units may have a size of 16×32. For example, when a coding unit of size 8×32 is partitioned horizontally into two sub-coding units, each of the two sub-coding units may have a size of 8×16. When one coding unit is partitioned into two sub-coding units, the coding unit may be said to be partitioned into two or partitioned according to a binary tree partition structure.

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

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

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

[0192] The fact that the coding unit corresponding to the node of the quadtree is partitioned may be signaled using the four partition information. The four partition information having a first value (e.g., '1') may indicate that the current coding unit is partitioned according to the quadtree partition structure. The four partition information having a second value (e.g., '0') may indicate that the current coding unit is not partitioned according to the quadtree partition structure. The four partition information may be a flag having a predetermined length (e.g., one bit).

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

[0194] A tree structure in which there is no priority between binary tree partitions and ternary tree partitions is called a multi-type tree structure. A coding unit corresponding to a leaf node of a quadtree may be used as a root node of a multi-type tree. At least one of multi-type tree partition indication information, partition direction information, and partition tree information may be used to signal whether to partition a coding unit corresponding to a node of a multi-type tree. In order to partition a coding unit corresponding to a node of a multi-type tree, multi-type tree partition indication information, partition direction information, and partition tree information may be sequentially signaled.

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

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

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

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

[0199] At least any one of the quadtree partition indication information, the multi-type tree partition indication information, the partition direction information, and the partition tree information may be entropy encoded / decoded. In order to entropy encode / decode those types of information, information about neighboring coding units adjacent to the current coding unit may be used. For example, there is a high probability that the partition type (partitioned or not partitioned, partition tree, and / or partition direction) of the left neighboring coding unit and / or the upper neighboring coding unit of the current coding unit is similar to the partition type of the current coding unit. Therefore, context information for entropy encoding / decoding the information about the current coding unit may be derived from the information about the neighboring coding units. The information about the neighboring coding units may include at least any one of the quadtree partition information, the multi-type tree partition indication information, the partition direction information, and the partition tree information.

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

[0201] A coding unit that cannot be partitioned according to a quadtree partition structure, a binary tree partition structure, and / or a ternary tree partition structure becomes a basic unit for encoding, prediction, and / or transformation. That is, the coding unit cannot be further partitioned for prediction and / or transformation. Therefore, partition structure information and partition information for partitioning a coding unit into a prediction unit and / or a transformation unit may not exist in the bitstream.

[0202] However, when the size of the coding unit (i.e., the basic unit for partitioning) is larger than the size of the maximum transform block, the coding unit may be recursively partitioned until the size of the coding unit is reduced to be equal to or smaller than the size of the maximum transform block. For example, when the size of the coding unit is 64×64 and when the size of the maximum transform block is 32×32, the coding unit may be partitioned into four 32×32 blocks for transforming. For example, when the size of the coding unit is 32×64 and the size of the maximum transform block is 32×32, the coding unit may be partitioned into two 32×32 blocks for transforming. In this case, the partitioning of the coding unit for transforming is not separately signaled, and the partitioning of the coding unit for transforming may be determined by comparison between the horizontal size or vertical size of the coding unit and the horizontal size or vertical size of the maximum transform block. For example, when the horizontal size (width) of the coding unit is larger than the horizontal size (width) of the maximum transform block, the coding unit may be vertically divided into two equal parts. For example, when the vertical size (height) of the coding unit is larger than the vertical size (height) of the maximum transform block, the coding unit may be horizontally divided into two equal parts.

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

[0204] Information on the minimum size of the coding unit corresponding to the leaf node of the quadtree (quadtree minimum size) and / or information on the maximum depth from the root node of the multi-type tree to the leaf node (maximum tree depth of the multi-type tree) may be signaled or determined at an upper level of the coding unit. For example, the upper level may be a sequence level, a picture level, a slice level, a tile group level, a tile level, etc. Information on the minimum size of the quadtree and / or information on the maximum depth of the multi-type tree may be signaled or determined for each of the intra-picture slice and the inter-picture slice.

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

[0206] As another example, the maximum size of the binary tree and / or the maximum size of the ternary tree may be signaled or determined at the slice level. Alternatively, the minimum size of the binary tree and / or the minimum size of the ternary tree may be signaled or determined at the slice level.

[0207] According to the sizes and depth information of the above-mentioned various blocks, quad partition information, multi-type tree partition indication information, partition tree information and / or partition direction information may or may not be included in the bitstream.

[0208] For example, when the size of the coding unit is not greater than the minimum size of the quadtree, the coding unit does not include the quad partition information. The quad partition information may be inferred as the second value.

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

[0210] Optionally, when the size (horizontal size and vertical size) of the coding unit corresponding to the node of the multi-type tree is the same as the maximum size (horizontal size and vertical size) of the binary tree and / or is twice as large as the maximum size (horizontal size and vertical size) of the ternary tree, the coding unit may not be further partitioned into two or three partitions. Therefore, the multi-type tree partition indication information may not be signaled, but the multi-type tree partition indication information may be inferred as a second value. This is because when the coding unit is partitioned according to the binary tree partition structure and / or the ternary tree partition structure, a coding unit smaller than the minimum size of the binary tree and / or the minimum size of the ternary tree is generated.

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

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

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

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

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

[0216] Optionally, only when at least one of vertical binary tree partitioning, horizontal binary tree partitioning, vertical ternary tree partitioning, and horizontal ternary tree partitioning is possible for a coding unit corresponding to a node of a multi-type tree, a multi-type tree partition indication information may be sent by a signal. Otherwise, the coding unit may not be partitioned into two and / or three partitions. Therefore, the multi-type tree partition indication information may not be sent by a signal, but the multi-type tree partition indication information may be inferred as a second value.

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

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

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

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

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

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

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

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

[0225] The intra prediction mode may be a non-angle mode or an angle mode. The non-angle mode may be a DC mode or a planar mode, and the angle mode may be a prediction mode having a specific direction or angle. The intra prediction mode may be represented by at least one of a mode number, a mode value, a mode number, a mode angle, and a mode direction. The number of intra prediction modes may be M, which is greater than 1, including non-angle modes and angle modes. In order to perform intra prediction on a current block, a step of determining whether a sample included in a reconstructed neighboring block can be used as a reference sample of the current block may be performed. When there are samples that cannot be used as reference samples of the current block, a value obtained by copying or interpolating at least one sample value of the samples included in the reconstructed neighboring block, or by both copying and interpolating, may be used to replace the unavailable sample value of the sample, so that the replaced sample value is used as the reference sample of the current block.

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

[0227] like Figure 7 As shown in , at least one of the reference sample line 0 to the reference sample line 3 can be used for intra prediction of the current block. Figure 7 In , the samples of fragment A and fragment F can be filled with the samples of the closest fragment B and fragment E, respectively, instead of retrieving from the reconstructed neighboring blocks. The index information indicating the reference sample line to be used for intra prediction of the current block can be sent by signaling. For example, in Figure 7 In the example, reference sample line indicators 0, 1, and 2 may be signaled as index information indicating reference sample line 0, reference sample line 1, and reference sample line 2. When the upper boundary of the current block is the boundary of the CTU, only reference sample line 0 may be available. Therefore, in this case, index information may not be signaled. When reference sample lines other than reference sample line 0 are used, filtering for a prediction block, which will be described later, may not be performed.

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

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

[0230] In the case of intra prediction between color components, a prediction block of a current block of a second color component may be generated based on a corresponding reconstruction block of a first color component. For example, the first color component may be a luminance component, and the second color component may be a chrominance component. For intra prediction between color components, parameters of a linear model between the first color component and the second color component may be derived based on a template. The template may include upper and / or left neighboring samples of the current block and upper and / or left neighboring samples of a reconstruction block of the first color component corresponding thereto. For example, the sample value of the first color component having the maximum value among the samples in the template and the sample value of the second color component corresponding thereto, and the sample value of the first color component having the minimum value among the samples in the template and the sample value of the second color component corresponding thereto may be used to derive the parameters of the linear model. When deriving the parameters of the linear model, the corresponding reconstruction block may be applied to the linear model to generate a prediction block of the current block. Depending on the video format, subsampling may be performed on the neighboring samples of the reconstruction block of the first color component and the corresponding reconstruction block. For example, when one sample of the second color component corresponds to four samples of the first color component, the four samples of the first color component may be subsampled to calculate one corresponding sample. In this case, parameter derivation of the linear model and intra prediction between color components may be performed based on the corresponding subsampled samples. Whether to perform intra prediction between color components and / or the range of the template may be signaled as an intra prediction mode.

[0231] The current block may be partitioned into two sub-blocks or four sub-blocks in the horizontal direction or the vertical direction. The partitioned sub-blocks may be reconstructed sequentially. That is, intra prediction may be performed on the sub-block to generate a sub-prediction block. In addition, inverse quantization and / or inverse transformation may be performed on the sub-block to generate a sub-residual block. The reconstructed sub-block may be generated by adding the sub-prediction block to the sub-residual block. The reconstructed sub-block may be used as a reference sample for intra prediction of a subsequent sub-block. The sub-block may be a block including a predetermined number (e.g., 16) or more samples. Thus, for example, when the current block is an 8×4 block or a 4×8 block, the current block may be partitioned into two sub-blocks. In addition, when the current block is a 4×4 block, the current block may not be partitioned into sub-blocks. When the current block has other sizes, the current block may be partitioned into four sub-blocks. Information on whether intra prediction is performed based on sub-blocks and / or partition directions (horizontal or vertical) may be sent by a signal. Intra prediction based on sub-blocks may be performed only when reference sample line 0 is used. When subblock-based intra prediction is performed, filtering for a prediction block, which will be described later, may not be performed.

[0232] The final prediction block may be generated by performing filtering on the prediction block predicted by the intra-frame. The filtering may be performed by applying a predetermined weight to the filtering target sample, the left reference sample, the upper reference sample, and / or the upper left reference sample. The weight and / or reference sample (range, position, etc.) used for filtering may be determined based on at least one of the block size, the intra-frame prediction mode, and the position of the filtering target sample in the prediction block. The filtering may be performed only in the case of a predetermined intra-frame prediction mode (e.g., DC, plane, vertical, horizontal, diagonal, and / or adjacent diagonal mode). The adjacent diagonal mode may be a mode in which k is added to the diagonal mode or subtracted from the diagonal mode. For example, k may be a positive integer of 8 or less.

[0233] The intra-frame prediction mode of the current block may be entropy encoded / decoded by predicting the intra-frame prediction mode of a block existing adjacent to the current block. When the intra-frame prediction mode of the current block is the same as that of the neighboring block, information that the intra-frame prediction mode of the current block is the same as that of the neighboring block may be signaled by using predetermined flag information. In addition, indicator information of the intra-frame prediction mode that is the same as the intra-frame prediction mode of the current block among the intra-frame prediction modes of multiple neighboring blocks may be signaled. When the intra-frame prediction mode of the current block is different from that of the neighboring block, the intra-frame prediction mode information of the current block may be entropy encoded / decoded by performing entropy encoding / decoding based on the intra-frame prediction mode of the neighboring block.

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

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

[0236] An I picture may be encoded by intra prediction without requiring inter-picture prediction. A P picture may be encoded by inter-picture prediction using a reference picture existing in one direction (i.e., forward or backward) relative to the current block. A B picture may be encoded by inter-picture prediction using a reference picture existing in two directions (i.e., forward and backward) relative to the current block. When inter-picture prediction is used, the encoder may perform inter-picture prediction or motion compensation, and the decoder may perform corresponding motion compensation.

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

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

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

[0240] The derivation method of motion information may be different according to the prediction mode of the current block. For example, the prediction modes applied to inter prediction include AMVP mode, merge mode, skip mode, merge mode with motion vector difference, sub-block merge mode, geometric partition mode, combined inter-intra prediction mode, affine mode, etc. Here, the merge mode may be referred to as motion merge mode.

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

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

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

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

[0245] The bitstream may include a reference picture index indicating a reference picture. The reference picture index may be entropy encoded by the encoding apparatus 100 and then signaled as a bitstream to the decoding apparatus 200. The decoding apparatus 200 may generate a prediction block of a decoding target block based on the derived motion vector and the reference picture index information.

[0246] Another example of a method of deriving motion information of a current block may be a merge mode. The merge mode may represent a method of merging motions of a plurality of blocks. The merge mode may represent a mode of deriving motion information of a current block from motion information of a neighboring block. When the merge mode is applied, the motion information of the reconstructed neighboring block and / or the motion information of the same-position block may be used to generate a merge candidate list. The motion information may include at least one of a motion vector, a reference picture index, and an inter-picture prediction indicator. The prediction indicator may indicate unidirectional prediction (L0 prediction or L1 prediction) or bidirectional prediction (L0 prediction and L1 prediction).

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

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

[0249] In addition, the encoding device 100 performs entropy encoding on the correction information for correcting the motion vector in the motion information of the merge candidate, and transmits it to the decoding device 200 by signal. The decoding device 200 may correct the motion vector of the merge candidate selected by the merge index based on the correction information. Here, the correction information may include at least one of information on whether to perform correction, correction direction information, and correction size information. As described above, the prediction mode in which the motion vector of the merge candidate is corrected based on the correction information transmitted by the signal may be referred to as a merge mode with a motion vector difference.

[0250] The skip mode may be a mode in which the motion information of the neighboring blocks is applied to the current block as it is. When the skip mode is applied, the encoding apparatus 100 may perform entropy encoding on information of the fact of which block's motion information is to be used as the motion information of the current block to generate a bitstream, and may signal the bitstream to the decoding apparatus 200. The encoding apparatus 100 may not signal a syntax element regarding at least any one of the motion vector difference information, the coded block flag, and the transform coefficient level to the decoding apparatus 200.

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

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

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

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

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

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

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

[0258] At least one scheme selected from various predefined transform schemes is used to perform the primary transform. For example, examples of the predefined transform schemes include discrete cosine transform (DCT), discrete sine transform (DST) and Karhunen-Loève transform (KLT). The transform coefficients generated by the primary transform may undergo a secondary transform. The transform scheme for the primary transform and / or the secondary transform may be determined based on the coding parameters of the current block and / or the neighboring blocks of the current block. Optionally, transform information indicating the transform scheme may be sent by a signal. DCT-based transforms may include, for example, DCT-2, DCT-8, etc. DST-based transforms may include, for example, DST-7.

[0259] A quantized level signal (quantized coefficient) may be generated by performing quantization on a residual signal or on a result of performing a primary transform and / or a secondary transform. Depending on the intra prediction mode of the block or the block size / shape, the quantized level signal may be scanned according to at least one of a diagonal upper right scan, a vertical scan, and a horizontal scan. For example, when the coefficients are scanned according to a diagonal upper right scan, the coefficients in block form are changed to a one-dimensional vector form. In addition to the diagonal upper right scan, a horizontal scan that scans the coefficients in a two-dimensional block form horizontally or a vertical scan that scans the coefficients in a two-dimensional block form vertically may be used according to the intra prediction mode and / or the size of the transform block. The scanned quantized level coefficients may be entropy encoded for insertion into a bitstream.

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

[0261] The quantized level coefficients may then be dequantized, then inversely transformed at a secondary level as required, and finally inversely transformed at a primary level as required to generate a reconstructed residual signal.

[0262] Inverse mapping in the dynamic range can be performed for the luminance component reconstructed by intra-frame prediction or inter-frame prediction before in-loop filtering. The dynamic range can be divided into 16 equal segments, and the mapping function for each segment can be sent by signal. The mapping function can be sent by signal at the slice level or parallel block group level. The inverse mapping function for performing inverse mapping can be derived based on the mapping function. In-loop filtering, reference picture storage and motion compensation are performed in the inverse mapping area, and the prediction block generated by inter-frame prediction is converted to the mapping area via mapping using the mapping function, and then used to generate the reconstructed block. However, since intra-frame prediction is performed in the mapping area, the prediction block generated by intra-frame prediction can be used to generate the reconstructed block without mapping / inverse mapping.

[0263] When the current block is a residual block of a chroma component, the residual block can be converted to an inverse mapping area by performing scaling on the chroma component of the mapping area. The availability of scaling can be signaled at the slice level or the parallel block group level. Scaling can be applied only when mapping for the luminance component is available and the division of the luminance component and the division of the chroma component follow the same tree structure. Scaling can be performed based on the average value of the sample value of the luminance prediction block corresponding to the chroma block. In this case, when the current block uses inter-frame prediction, the luminance prediction block can represent the mapped luminance prediction block. The value required for scaling can be derived by using the index reference lookup table of the fragment to which the average value of the sample value of the luminance prediction block belongs. Finally, the residual block can be converted to an inverse mapping area by scaling the residual block using the derived value. Then, chroma component block recovery, intra-frame prediction, inter-frame prediction, in-loop filtering, and reference picture storage can be performed in the inverse mapping area.

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

[0265] The prediction block of the current block may be generated based on a block vector indicating the displacement between the current block and the reference block in the current picture. In this way, the prediction mode for generating the prediction block with reference to the current picture is called an intra-block copy (IBC) mode. The IBC mode may be applied to M×N (M<=64, N<=64) coding units. The IBC mode may include a skip mode, a merge mode, an AMVP mode, and the like. In the case of a skip mode or a merge mode, a merge candidate list is constructed, and a merge index is signaled so that a merge candidate can be specified. The block vector of the specified merge candidate may be used as the block vector of the current block. The merge candidate list may include at least one of a spatial candidate, a history-based candidate, a candidate based on the average of two candidates, and a zero merge candidate. In the case of the AMVP mode, a difference block vector may be signaled. In addition, a prediction block vector may be derived from the left neighboring block and the upper neighboring block of the current block. The index of the neighboring block to be used may be signaled. The prediction block in the IBC mode is included in the current CTU or the left CTU and is limited to blocks in the reconstructed area. For example, the value of the block vector may be limited so that the prediction block of the current block is located in the region of three 64×64 blocks preceding the 64×64 block to which the current block belongs in the encoding / decoding order. By limiting the value of the block vector in this way, the memory consumption and device complexity of the implementation according to the IBC mode may be reduced.

[0266] Hereinafter, an in-loop filtering method using sub-sampling based block classification according to an embodiment of the present invention will be described with reference to FIGS. 8 to 15 .

[0267] In the present invention, the in-loop filtering method includes deblocking filtering, sample adaptive offset (SAO), bilateral filtering, adaptive in-loop filtering, and the like.

[0268] By applying at least one of deblocking filtering and SAO to a reconstructed picture (i.e., a video frame) generated by summing a reconstructed intra / inter prediction block and a reconstructed residual block, the block effect and ringing effect within the reconstructed picture can be effectively reduced. Deblocking filtering aims to reduce the block effect around the block boundary by performing vertical filtering and horizontal filtering on the block boundary. However, the problem with deblocking filtering is that when the block boundary is filtered, deblocking filtering cannot minimize the distortion between the original picture and the reconstructed picture. Sample adaptive offset (SAO) is a filtering technique that adds an offset to a sample after comparing the pixel value of a specific sample with the pixel value of an adjacent sample in units of samples, or adds an offset to a sample whose pixel value is within a specific pixel value range in order to reduce the ringing effect. SAO has the effect of reducing the distortion between the original picture and the reconstructed picture to a certain extent by using rate-distortion optimization. However, when the difference between the original picture and the reconstructed picture is large, there is a limitation in minimizing the distortion.

[0269] Bidirectional filtering refers to a filtering technique that determines filter coefficients based on a distance from a central sample point in a filtering target area to each of the other sample points in the filtering target area and based on a difference between a pixel value of the central sample point and a pixel value of each of the other sample points.

[0270] Adaptive in-loop filtering refers to a filtering technique that minimizes the distortion between an original picture and a reconstructed picture by using a filter that can minimize the distortion between the original picture and the reconstructed picture.

[0271] Unless otherwise specifically stated in the description of the present invention, in-loop filtering means adaptive in-loop filtering. In addition, an adaptive in-loop filter may have the same meaning as an adaptive in-loop filter.

[0272] In the present invention, filtering means a process of applying a filter to at least one basic unit selected from a sample, a block, a coding unit (CU), a prediction unit (PU), a transform unit (TU), a coding tree unit (CTU), a slice, a tile, a group of tiles (tile group), a picture, and a sequence. The filtering includes at least one of a block classification process, a filtering execution process, and a filtering information encoding / decoding process.

[0273] In the present invention, a coding unit (CU), a prediction unit (PU), a transform unit (TU) and a coding tree unit (CTU) have the same meanings as a coding block (CB), a prediction block (PB), a transform block (TB) and a coding tree block (CTB), respectively.

[0274] In the present invention, a block refers to at least one of a CU, a PU, a TU, a CB, a PB, and a TB used as a basic unit in an encoding / decoding process.

[0275] In-loop filtering is performed such that bidirectional filtering, deblocking filtering, sample adaptive offset, and adaptive in-loop filtering are sequentially applied to a reconstructed picture to generate a decoded picture. However, the order in which filtering schemes classified as in-loop filtering are applied to the reconstructed picture varies.

[0276] For example, in-loop filtering may be performed such that deblocking filtering, sample adaptive offset, and adaptive in-loop filtering are sequentially applied to the reconstructed picture in the order of deblocking filtering, sample adaptive offset, and adaptive in-loop filtering.

[0277] Optionally, in-loop filtering may be performed such that bidirectional filtering, adaptive in-loop filtering, deblocking filtering and sample adaptive offset are sequentially applied to the reconstructed picture in the order of bidirectional filtering, adaptive in-loop filtering, deblocking filtering and sample adaptive offset.

[0278] Further optionally, in-loop filtering may be performed such that adaptive in-loop filtering, deblocking filtering and sample adaptive offset are sequentially applied to the reconstructed picture in the order of adaptive in-loop filtering, deblocking filtering and sample adaptive offset.

[0279] Further optionally, in-loop filtering may be performed such that adaptive in-loop filtering, sample adaptive offset, and deblocking filtering are sequentially applied to the reconstructed picture in the order of adaptive in-loop filtering, sample adaptive offset, and deblocking filtering.

[0280] In the present invention, a decoded picture refers to the output from in-loop filtering or post-processing filtering performed on a reconstructed picture composed of reconstructed blocks, each of which is generated by summing a reconstructed residual block and a corresponding intra-frame prediction block or summing a reconstructed block and a corresponding inter-frame prediction block. In the present invention, the meaning of a decoded sample, block, CTU or picture is no different from the meaning of a reconstructed sample, block, CTU or picture, respectively.

[0281] Adaptive in-loop filtering is performed on the reconstructed picture to generate a decoded picture. Adaptive in-loop filtering may be performed on a decoded picture that has undergone at least one of deblocking filtering, sample adaptive offset, and bidirectional filtering. In addition, adaptive in-loop filtering may be performed on a reconstructed picture that has undergone adaptive in-loop filtering. In this case, adaptive in-loop filtering may be repeatedly performed N times on the reconstructed picture or the decoded picture. In this case, N is a positive integer.

[0282] In-loop filtering may be performed on a decoded picture that has been subjected to at least one of the in-loop filtering methods. For example, when at least one of the in-loop filtering methods is performed on a decoded picture that has been subjected to at least one of the other in-loop filtering methods, the parameters for the latter filtering method may be changed, and then the former filtering with the changed parameters may be performed on the decoded picture. In this case, the parameters include encoding parameters, filter coefficients, the number of filter taps (filter length), filter shape, filter type, number of filtering executions, filter strength, thresholds, and / or combinations of those.

[0283] The filter coefficient refers to a coefficient constituting a filter. Optionally, the filter coefficient refers to a coefficient value corresponding to a specific mask position of the mask form, and the reconstructed sample point is multiplied by the coefficient value.

[0284] The number of filter taps refers to the length of the filter. When the filter is symmetrical with respect to a particular direction, the filter coefficients to be encoded / decoded can be reduced by half. In addition, the filter taps refer to the width (horizontal dimension) or height (vertical dimension) of the filter. Alternatively, the filter taps refer to both the width (lateral dimension) and height (vertical dimension) of a two-dimensional filter. In addition, the filter can be symmetrical with respect to two or more particular directions.

[0285] When the filter has a mask form, the filter can be a two-dimensional geometric figure having the following shapes: a diamond / rhombus shape, a non-square rectangular shape, a square shape, a trapezoidal shape, a diagonal shape, a snowflake shape, a digital symbol shape, a clover shape, a cross shape, a triangle shape, a pentagonal shape, a hexagonal shape, an octagonal shape, a decagonal shape, a dodecagonal shape, or any combination of those. Alternatively, the filter shape can be a shape obtained by projecting a three-dimensional figure onto a two-dimensional plane.

[0286] The filter type refers to a filter selected from a Wiener filter, a low-pass filter, a high-pass filter, a linear filter, a nonlinear filter, and a bidirectional filter.

[0287] In the present invention, among various filters, the Wiener filter will be described intensively. However, the present invention is not limited thereto, and a combination of the above filters may be used in an embodiment of the present invention.

[0288] As a filter type for adaptive in-loop filtering, a Wiener filter can be used. The Wiener filter is an optimal linear filter for effectively removing noise, blur and distortion within a picture to improve coding efficiency. The Wiener filter is designed to minimize the distortion between the original picture and the reconstructed / decoded picture.

[0289] At least one of the filtering methods may be performed in the encoding process or the decoding process. The encoding process or the decoding process refers to the encoding or decoding performed in units of at least one of a strip, a parallel block, a parallel block group, a picture, a sequence, a CTU, a block, a CU, a PU, and a TU. At least one of the filtering methods is performed during the encoding or decoding performed in units of a strip, a parallel block, a parallel block group, a picture, etc. For example, the Wiener filter is used for adaptive in-loop filtering during encoding or decoding. That is, in the phrase "adaptive in-loop filtering", the term "in-loop" means that filtering is performed during the encoding or decoding process. When adaptive in-loop filtering is performed, when encoding or decoding subsequent pictures, the decoded picture that has undergone adaptive in-loop filtering can be used as a reference picture. In this case, since intra-frame prediction or motion compensation is performed on the subsequent picture to be encoded / decoded by referring to the reconstructed picture that has undergone adaptive in-loop filtering, the encoding efficiency of the subsequent picture and the encoding efficiency of the current picture that has undergone in-loop filtering can be improved.

[0290] In addition, at least one of the above-mentioned filtering methods is performed in a CTU-based or block-based encoding or decoding process. For example, the Wiener filter is used for adaptive in-loop filtering in a CTU-based or block-based encoding or decoding process. That is, in the phrase "adaptive in-loop filtering", the term "in-loop" means that filtering is performed during a CTU-based or block-based encoding or decoding process. When adaptive in-loop filtering is performed in units of CTUs or in units of blocks, the decoded CTU or block that has undergone adaptive in-loop filtering is used as a reference CTU or block for subsequent CTUs or blocks to be encoded / decoded. In this case, since intra-frame prediction or motion compensation is performed on subsequent CTUs or blocks by referring to the current CTU or block to which adaptive in-loop filtering is applied, the coding efficiency of the current CTU or block to which in-loop filtering is applied is improved, and the coding efficiency of subsequent CTUs or blocks to be encoded / decoded is improved.

[0291] In addition, after the decoding process is performed, at least one of the filtering methods is performed as post-processing filtering. For example, the Wiener filter can be used as a post-processing filter after the decoding process is performed. When the Wiener filter is used after the decoding process, the Wiener filter is applied to the reconstructed / decoded picture before outputting (i.e., displaying) the reconstructed / decoded picture. When post-processing filtering is performed, the decoded picture that has undergone post-processing filtering may not be used as a reference picture for a subsequent picture to be encoded / decoded.

[0292] Adaptive in-loop filtering cannot be performed in units of blocks. That is, block-based filter adaptation cannot be performed. Here, block-based filter adaptation means selecting different filters for different blocks respectively. Block-based filter adaptation also means block classification.

[0293] Figure 8a is a flowchart illustrating a video decoding method according to an embodiment of the present invention.

[0294] Reference Figure 8a , the decoder decodes the filter information for each coding unit (S701).

[0295] The filter information is not limited to the filter information in units of coding units, but also refers to the filter information in units of slices, tiles, tile groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs.

[0296] The filter information includes information about whether filtering is performed, filter coefficient values, the number of filters, the number of filter taps (filter length), filter shape information, filter type information, information about whether a fixed filter is used for block classification indexes, and / or filter symmetry type information.

[0297] The filter shape information includes at least one shape selected from rhombus (diamond), rectangle, square, trapezoid, diagonal shape, snowflake shape, digital symbol shape, clover shape, cross shape, triangle, pentagon, hexagon, octagon, decagon and dodecagon.

[0298] The filter coefficient values ​​include geometrically transformed filter coefficient values ​​for each block in which samples are classified into a plurality of classes in units of block classification units.

[0299] On the other hand, examples of the filter symmetry type include at least one of point symmetry, horizontal symmetry, longitudinal symmetry, and diagonal symmetry.

[0300] In addition, the decoder performs block classification on samples of the coding unit in units of block classification units (step S702). In addition, the decoder assigns block classification indices to the block classification units in the coding unit.

[0301] Block classification is not limited to classification in units of coding units. That is, block classification may be performed in units of slices, tiles, tile groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs.

[0302] A block classification index is determined based on the directionality information and the activity information.

[0303] At least one of the directionality information and the activity information is determined according to a gradient value for at least one of a vertical direction, a horizontal direction, a first diagonal direction, and a second diagonal direction.

[0304] On the other hand, a one-dimensional Laplacian operation is used in units of block classification units to obtain the gradient value.

[0305] The one-dimensional Laplacian operation is preferably a one-dimensional Laplacian operation in which the operation position is a sub-sampling position.

[0306] Alternatively, the gradient value may be determined based on a temporal layer identifier.

[0307] Furthermore, the decoder filters the coding units on which block classification has been performed in units of block classification units by using the filtering information (S703).

[0308] The filtering target unit is not limited to the coding unit. That is, filtering can be performed in units of slices, tiles, tile groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs.

[0309] Figure 8b is a flowchart illustrating a video encoding method according to an embodiment of the present invention.

[0310] Reference Figure 8b The encoder classifies samples in a coding unit into multiple categories in units of block classification units (step S801). In addition, the encoder assigns a block classification index to the block classification unit in each coding unit.

[0311] The basic unit for block classification is not limited to the coding unit. That is, block classification can be performed in units of slices, tiles, tile groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs.

[0312] A block classification index is determined based on the directionality information and the activity information.

[0313] At least one of the directionality information and the activity information is determined based on a gradient value for at least one of a vertical direction, a horizontal direction, a first diagonal direction, and a second diagonal direction.

[0314] The gradient value is obtained using a one-dimensional Laplacian operation in block classification units.

[0315] The one-dimensional Laplacian operation is preferably a one-dimensional Laplacian operation in which the operation position is a sub-sampling position.

[0316] Optionally, the gradient value is determined based on a temporal layer identifier.

[0317] Furthermore, the encoder filters the coding units whose samples are classified in units of block classification units by using filter information of the coding units ( S802 ).

[0318] The basic unit for filtering is not limited to the coding unit. That is, filtering can be performed in units of slices, tiles, tile groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs.

[0319] The filter information includes information about whether filtering is performed, filter coefficient values, the number of filters, the number of filter taps (filter length), filter shape information, filter type information, information about whether a fixed filter is used for block classification indexes, and / or filter symmetry type information.

[0320] Examples of the filter shape include at least one of rhombus (diamond), rectangle, square, trapezoid, diagonal shape, snowflake, number sign shape, cloverleaf shape, cross, triangle, pentagon, hexagon, octagon, decagon and dodecagon.

[0321] The filter coefficient values ​​include filter coefficient values ​​geometrically transformed in units of block classification units.

[0322] Next, the encoder encodes the filter information (S803).

[0323] The filter information is not limited to filter information in units of coding units, but may be filter information in units of slices, tiles, tile groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs.

[0324] On the encoder side, the adaptive in-loop filtering process can be divided into several sub-steps, such as block classification, filtering, and filter information encoding.

[0325] In addition, on the decoder side, the adaptive in-loop filtering process is divided into filter information decoding, block classification and filtering steps.

[0326] Hereinafter, in order to avoid redundant description, the filter information encoding step and the filter information decoding step are collectively referred to as a filter information encoding / decoding step.

[0327] In the following, the block classification step will be described first.

[0328] The block classification index is allocated within the reconstructed picture based on the block of M×N size (or in units of block classification units), so that the blocks within the reconstructed picture can be classified into L categories. Here, the block classification index can be allocated not only to the reconstructed / decoded picture, but also to at least one of the restored / decoded slice, the restored / decoded tile group, the restored / decoded tile, the restored / decoded CTU, and the restored / decoded block.

[0329] Here, N, M, and L are all positive integers. For example, N and M are all positive integers selected from 2, 4, 8, 16, and 32, and L is a positive integer selected from 4, 8, 16, 20, 25, and 32. When N and M are the same integer 1, block classification is performed based on samples rather than blocks. On the other hand, when N and M are different positive integers, a block of N×M size has a non-square shape. Alternatively, N and M may be the same positive integer.

[0330] For example, a total of 25 block class indexes may be allocated to the reconstructed picture in units of 2×2 sized blocks. For example, a total of 25 block class indexes may be allocated to the reconstructed picture in units of 4×4 sized blocks.

[0331] The block classification index has a value in the range from 0 to L-1, or may have a value in the range from 1 to L.

[0332] The block classification index C is a quantized activity value A based on the directionality value D and the activity value A. q is determined by at least one of and is expressed by Equation 1.

[0333] [Equation 1]

[0334] C=5D+A q

[0335] In Equation 1, 5 is an exemplary constant value. The constant value may be represented by J. In this case, J is a positive integer having a value less than L.

[0336] For example, in one embodiment where block classification is performed in units of 2×2 size blocks, the sum of the one-dimensional Laplacian gradient values ​​in the vertical direction is given by g v , and the sum of the one-dimensional Laplace gradient values ​​for the horizontal direction, the first diagonal direction (angle of 135°) and the second diagonal direction (angle of 45°) are respectively represented by g h , g d1 and g d2 The Laplace operations for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction are represented by Expressions 2, 3, 4, and 5, respectively. The directivity value D and the activity value A are derived by using the sum of the gradient values. In one embodiment, the sum of the gradient values ​​is used. Alternatively, any statistical value of the gradient values ​​may be used instead of the sum of the gradient values.

[0337] [Equation 2]

[0338]

[0339] [Equation 3]

[0340]

[0341] [Equation 4]

[0342]

[0343] [Equation 5]

[0344]

[0345] In Equations 2 to 5, i and j represent coordinates of an upper left position in horizontal and vertical directions, respectively, and R(i, j) represents a reconstructed sample value at the position (i, j).

[0346] In equations 2 to 5, k and l represent the horizontal operation range and the vertical operation range, respectively, to generate the result V of the sample-based one-dimensional Laplace operation for each direction. k,l , H k,l 、D1 k,l 、D2 k,l The result of the one-dimensional Laplace operation based on the sample points for one direction represents the gradient value based on the sample points for the corresponding direction. That is, the result of the one-dimensional Laplace operation represents the gradient value. The one-dimensional Laplace operation is performed on each of the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction, and the one-dimensional Laplace operation indicates the gradient value for the corresponding direction. In addition, the results of the one-dimensional Laplace operation for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction are respectively represented by V k,l , H k,l 、D1 k,l 、D2 k,l express.

[0347] For example, k and l may be in the same range. That is, the horizontal length and vertical length of the operation range for calculating the one-dimensional Laplace sum may be the same.

[0348] Alternatively, k and l may be in different ranges. That is, the horizontal length and vertical length of the operation range for calculating the one-dimensional Laplace sum may be different.

[0349] As an example, k ranges from i-2 to i+3, and l ranges from j-2 to j+3. In this case, the range for calculating the one-dimensional Laplace sum is 6×6 size. In this case, the operation range for calculating the one-dimensional Laplace sum is larger than the size of the block classification unit.

[0350] As another example, k ranges from i-1 to i+2, and l ranges from j-1 to j+2. In this case, the operation range for calculating the one-dimensional Laplace sum is 4×4 size. In this case, the operation range for calculating the one-dimensional Laplace sum is larger than the size of the block classification unit.

[0351] As another example, k ranges from i to i+1, and l ranges from j to j+1. In this case, the operation range for calculating the one-dimensional Laplace sum is 2×2 size. In this case, the operation range for calculating the one-dimensional Laplace sum is equal to the size of the block classification unit.

[0352] For example, an operation range for calculating the sum of results of one-dimensional Laplace operations has a two-dimensional geometric shape selected from a rhombus, a rectangle, a square, a trapezoid, a diagonal shape, a snowflake shape, a number sign shape, a clover shape, a cross shape, a triangle, a pentagon, a hexagon, a decagon, and a dodecagon.

[0353] For example, the block classification unit has a two-dimensional geometric shape selected from rhombus / diamond, rectangle, square, trapezoid, diagonal shape, snowflake, number sign, clover, cross, triangle, pentagon, hexagon, octagon, decagon and dodecagon.

[0354] For example, the range for calculating the sum of one-dimensional Laplacian operations has a size of S × T. In this case, S and T are both zero or positive integers.

[0355] In addition, D1 indicating a first diagonal line and D2 indicating a second diagonal line may respectively mean D0 indicating the first diagonal line and D1 indicating the second diagonal line.

[0356] For example, in one embodiment of performing block classification in units of 4×4 size blocks, the sum of the gradient values ​​g for the horizontal direction, the vertical direction, the first diagonal direction, and the second diagonal direction is calculated by equations 6, 7, 8, and 9 based on a one-dimensional Laplace operation. v , g h , g d1 , g d2 The directionality value D and the activity value A are derived by using the sum of the gradient values. In one embodiment, the sum of the gradient values ​​is used. Alternatively, any statistical value of the gradient values ​​may be used instead of the sum of the gradient values.

[0357] [Equation 6]

[0358]

[0359] [Equation 7]

[0360]

[0361] [Equation 8]

[0362]

[0363] [Equation 9]

[0364]

[0365] In Equation 6 to Equation 9, i and j represent coordinates of an upper left position in horizontal and vertical directions, respectively, and R(i, j) represents a reconstructed sample value at the position (i, j).

[0366] In equations 6 to 9, k and l represent the results V used to calculate the sample-based one-dimensional Laplace operation for each direction. k,l , H k,l 、D1 k,l 、D2 k,l The result of the one-dimensional Laplace operation based on the sample points for one direction represents the gradient value based on the sample points for the corresponding direction. That is, the result of the one-dimensional Laplace operation represents the gradient value. The one-dimensional Laplace operation is performed for each of the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction, and the one-dimensional Laplace operation indicates the gradient value for the corresponding direction. In addition, the results of the one-dimensional Laplace operation for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction are respectively represented as V k,l , H k,l 、D1 k,l 、D2 k,l .

[0367] For example, k and l may be in the same range. That is, the horizontal length and vertical length of the operation range for calculating the sum of the one-dimensional Laplace operation may be the same.

[0368] Alternatively, k and l may be of different ranges. That is, the horizontal length and vertical length of the operation range for calculating the sum of the one-dimensional Laplace operations may be different.

[0369] As an example, k ranges from i-2 to i+5, and l ranges from j-2 to j+5. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is 8×8 size. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is larger than the size of the block classification unit.

[0370] As another example, k ranges from i to i+3, and l ranges from j to j+3. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is 4×4 size. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is equal to the size of the block classification unit.

[0371] For example, an operation range for calculating the sum of results of one-dimensional Laplace operations has a two-dimensional geometric shape selected from a rhombus, a rectangle, a square, a trapezoid, a diagonal shape, a snowflake shape, a number sign shape, a clover shape, a cross shape, a triangle, a pentagon, a hexagon, a decagon, and a dodecagon.

[0372] For example, the operation range for calculating the sum of one-dimensional Laplace operations has a size of S × T. In this case, both S and T are zero or positive integers.

[0373] For example, the block classification unit has a two-dimensional geometric shape selected from rhombus / diamond, rectangle, square, trapezoid, diagonal shape, snowflake, number sign, clover, cross, triangle, pentagon, hexagon, octagon, decagon and dodecagon.

[0374] For example, in one embodiment in which block classification is performed in units of 4×4 size blocks, the one-dimensional Laplacian and g of the gradient values ​​for the horizontal direction, the vertical direction, the first diagonal direction, and the second diagonal direction are calculated by Equations 10 to 13, respectively. v , g h , g d1 , g d2 The gradient value is represented based on sub-sample points to reduce the computational complexity for block classification. The directionality value D and the activity value A are derived by using the sum of the gradient values. In one embodiment, the sum of the gradient values ​​is used. Alternatively, any statistical value of the gradient values ​​may be used instead of the sum of the gradient values.

[0375] [Equation 10]

[0376] g v =∑ k ∑ l V k,l V k,l =|2R(k,l)-R(k,l-1)-R(k,l+1)|,k=i-2,i,i+2,i+4,l=j-2,...,j+5

[0377] [Equation 11]

[0378] g h =∑ k ∑ l H k,l , H k,l =|2R(k,l)-R(k-1,l)-R(k+1,l)|,k=i-2,...,i+5,l=j-2i,j,j+2,j+4

[0379] [Equation 12]

[0380] gd1 =∑ k ∑ l m k,l D1 k,l , D1 k,l =|2R(k,l)-R(k-1,l-1)-R(k+1,l+1)|,k=i-2,...,i+5,l=j-2,...,j+5

[0381]

[0382] [Equation 13]

[0383] g d2 =∑ k ∑ l n k,l D2 k,l , D2 k,l =|2R(k,l)-R(k-1,l+1)-R(k+1,l-1)|,k=i-2,...,i+5,l=j-2,...,j+5

[0384]

[0385] In Equations 10 to 13, i and j represent coordinates of an upper left position in horizontal and vertical directions, respectively, and R(i, j) represents a reconstructed sample value at the position (i, j).

[0386] In equations 10 to 13, k and l represent the results of calculating the one-dimensional Laplace operation based on the sample points, V k,l , H k,l 、D1 k,l 、D2 k,l The result of the one-dimensional Laplace operation based on the sample points for one direction represents the gradient value based on the sample points for the corresponding direction. That is, the result of the one-dimensional Laplace operation represents the gradient value. The one-dimensional Laplace operation is performed for each of the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction, and the one-dimensional Laplace operation indicates the gradient value for the corresponding direction. In addition, the results of the one-dimensional Laplace operation for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction are respectively represented as V k,l , H k,l 、D1 k,l 、D2 k,l .

[0387] For example, k and l may be in the same range. That is, the horizontal length and vertical length of the operation range for calculating the sum of the one-dimensional Laplace operation are the same.

[0388] Alternatively, k and l may be of different ranges. That is, the horizontal length and vertical length of the operation range for calculating the sum of the one-dimensional Laplace operations may be different.

[0389] As an example, k ranges from i-2 to i+5, and l ranges from j-2 to j+5. In this case, the operation range for calculating the sum of the one-dimensional Laplace operation is 8×8 size. In this case, the operation range for calculating the sum of the one-dimensional Laplace operation is larger than the size of the block classification unit.

[0390] As another example, k ranges from i to i+3, and l ranges from j to j+3. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is 4×4 size. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is equal to the size of the block classification unit.

[0391] For example, an operation range for calculating the sum of results of one-dimensional Laplace operations has a two-dimensional geometric shape selected from a rhombus, a rectangle, a square, a trapezoid, a diagonal shape, a snowflake shape, a number sign shape, a clover shape, a cross shape, a triangle, a pentagon, a hexagon, a decagon, and a dodecagon.

[0392] For example, the operation range for calculating the sum of one-dimensional Laplace operations has a size of S × T. In this case, S and T are zero or positive integers.

[0393] For example, the block classification unit has a two-dimensional geometric shape selected from rhombus / diamond, rectangle, square, trapezoid, diagonal shape, snowflake, number sign, clover, cross, triangle, pentagon, hexagon, octagon, decagon and dodecagon.

[0394] According to an embodiment of the present invention, the sample-based gradient value calculation method can calculate the gradient value by performing a one-dimensional Laplace operation on the sample points within the operation range along the corresponding direction. Here, the statistical value of the gradient value can be calculated by calculating the statistical value of the result of the one-dimensional Laplace operation performed on at least one sample point in the operation range for calculating the sum of the one-dimensional Laplace operation. In this case, the statistical value is any one of a sum, a weighted sum, and an average value.

[0395] For example, in order to calculate the gradient value for the horizontal direction, a one-dimensional Laplace operation is performed at each sample point position within the operation range for calculating the sum of the one-dimensional Laplace operations. In this case, the gradient value for the horizontal direction can be calculated at intervals of P rows within the operation range for calculating the sum of the one-dimensional Laplace operations. Here, P is a positive integer.

[0396] Optionally, in order to calculate the gradient value for the vertical direction, a one-dimensional Laplace operation is performed at each sample point position within the operation range on the column where the sum of the one-dimensional Laplace operation is calculated. In this case, the gradient value for the vertical direction can be calculated at intervals of P columns within the operation range where the sum of the one-dimensional Laplace operation is calculated. Here, P is a positive integer.

[0397] Further optionally, in order to calculate the gradient value for the first diagonal direction, within the operation range of calculating the sum of the one-dimensional Laplace operations, a one-dimensional Laplace operation is performed on the sample point positions at intervals of P rows or Q columns in at least one of the horizontal direction and the vertical direction, thereby obtaining the gradient value for the first diagonal direction. Here, P and Q are zero or positive integers.

[0398] Further optionally, in order to calculate the gradient value for the second diagonal direction, within the operation range of calculating the sum of the one-dimensional Laplace operations, a one-dimensional Laplace operation is performed on the sample point positions at intervals of P rows or Q columns in at least one of the horizontal direction and the vertical direction, thereby obtaining the gradient value for the second diagonal direction. Here, P and Q are zero or positive integers.

[0399] According to an embodiment of the present invention, the sample-based gradient value calculation method can calculate the gradient value by performing a one-dimensional Laplace operation on at least one sample within the operation range for calculating the sum of the one-dimensional Laplace operation. Here, the statistical value of the gradient value can be calculated by calculating the statistical value of the result of the one-dimensional Laplace operation performed on at least one sample in the operation range for calculating the sum of the one-dimensional Laplace operation. In this case, the statistical value is any one of a sum, a weighted sum, and an average value.

[0400] For example, in order to calculate the gradient value, a one-dimensional Laplace operation is performed at each sample point position within the operation range for calculating the sum of the one-dimensional Laplace operations. In this case, the gradient value can be calculated at intervals of P rows within the operation range for calculating the sum of the one-dimensional Laplace operations. Here, P is a positive integer.

[0401] Optionally, in order to calculate the gradient value, a one-dimensional Laplace operation is performed at each sample point position within the operation range on the column where the sum of the one-dimensional Laplace operation is calculated. In this case, the gradient value may be calculated at intervals of P rows within the operation range where the sum of the one-dimensional Laplace operation is calculated. Here, P is a positive integer.

[0402] Further optionally, in order to calculate the gradient value, within the operation range of calculating the sum of the one-dimensional Laplace operation, a one-dimensional Laplace operation is performed on the sample point positions at intervals of P rows or Q columns in at least one of the horizontal direction and the vertical direction, thereby obtaining the gradient value. Here, P and Q are zero or positive integers.

[0403] Further optionally, in order to calculate the gradient value, within the operation range of calculating the sum of the one-dimensional Laplace operation, a one-dimensional Laplace operation is performed on the sample point positions at intervals of P rows and Q columns in the horizontal direction and the vertical direction, thereby obtaining the gradient value. Here, P and Q are zero or positive integers.

[0404] On the other hand, the gradient refers to at least one of a gradient for a horizontal direction, a gradient for a vertical direction, a gradient for a first diagonal direction, and a gradient for a second diagonal direction.

[0405] Fig. 9 is a diagram illustrating an example of determining slope values ​​according to horizontal, vertical, first diagonal, and second diagonal directions based on subsampling.

[0406] like Fig. 9 As shown in FIG. 1 , when block classification is performed in units of 4×4 size blocks, the sum of the gradient values ​​g for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction may be calculated based on subsampling. v , g h , g d1 , g d2 At least one of. Here, V, H, D1 and D2 represent the results of the one-dimensional Laplace operation based on the sample points for the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction at the positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed is the subsampling position. Fig. 9 In FIG. 1 , the block classification index C is assigned to the shaded 4×4 size block. In this case, the operation range for calculating the one-dimensional Laplace sum is larger than the size of the block classification unit. Here, the thin solid rectangle represents the reconstruction sample point position, and the thick solid rectangle represents the operation range for calculating the one-dimensional Laplace sum.

[0407] According to an embodiment of the present invention, a gradient value may be calculated by performing a one-dimensional Laplace operation on a sample point arranged at a specific position in a block of N×M size based on subsampling. In this case, the specific position may be at least one of an absolute position and a relative position within the block. Here, a statistical value of the gradient value may be calculated by calculating a statistical value of a result of a one-dimensional Laplace operation performed on at least one sample point in a calculation range for calculating a one-dimensional Laplace sum. In this case, the statistical value is any one of a sum, a weighted sum, and an average value.

[0408] For example, the absolute position indicates the upper left position in the N×M block.

[0409] Optionally, the absolute position indicates a lower right position within an N×M block.

[0410] Further optionally, the relative position indicates a center position within an N×M block.

[0411] According to an embodiment of the present invention, the gradient value may be calculated by performing a one-dimensional Laplace operation on R samples within a block of N×M size based on subsampling. In this case, P and Q are zero or positive integers. In addition, R is equal to or less than the product of N and M. Here, the statistical value of the gradient value may be calculated by calculating the statistical value of the result of the one-dimensional Laplace operation performed on at least one sample point in the operation range for calculating the one-dimensional Laplace sum. In this case, the statistical value is any one of a sum, a weighted sum, and an average value.

[0412] For example, when R is 1, a one-dimensional Laplace operation is performed only on one sample point within an N×M block.

[0413] Optionally, when R is 2, a one-dimensional Laplace operation is performed only on two sample points within the N×M block.

[0414] Further optionally, when R is 4, a one-dimensional Laplacian operation is performed only on 4 sample points in each N×M block.

[0415] According to an embodiment of the present invention, the gradient value may be calculated by performing a one-dimensional Laplace operation on R samples within each N×M size block based on subsampling. In this case, R is a positive integer. In addition, R is equal to or less than the product of N and M. Here, the statistical value of the gradient value is obtained by calculating the statistical value of the result of the one-dimensional Laplace operation performed on at least one sample point in the operation range for calculating the one-dimensional Laplace sum. In this case, the statistical value is any one of a sum, a weighted sum, and an average value.

[0416] For example, when R is 1, a one-dimensional Laplacian operation is performed only on one sample point within each N×M-sized block for calculating a one-dimensional Laplacian sum.

[0417] Alternatively, when R is 2, the one-dimensional Laplacian operation is performed only on two sample points within each N×M size block for calculating the one-dimensional Laplacian sum.

[0418] Further optionally, when R is 4, the one-dimensional Laplacian operation is performed only on 4 sample points in each N×M size block for calculating the one-dimensional Laplacian sum.

[0419] Figures 10 to 121 is a diagram showing a method of determining a gradient value at a specific sample point position for a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction. The specific sample point position may be a sub-sampled sample point position within a block classification unit, or may be a sub-sampled sample point position within an operation range for calculating a sum of a one-dimensional Laplace operation. In addition, the specific sample point position is a sample point position within each block. Optionally, the specific sample point position may vary from block to block. In addition, the specific sample point position may be the same regardless of the direction of the one-dimensional Laplace operation to be calculated. In addition, the specific sample point position may be the same for each block regardless of the direction of the one-dimensional Laplace operation.

[0420] like Fig.10 As shown in FIG. 1 , when block classification is performed based on a 4×4 size block, the sum of the gradient values ​​g is calculated at one or more specific sample point locations. v , g h , g d1 , g d2 At least one of. Here, V, H, D1 and D2 represent the results of the one-dimensional Laplace operation based on the sample points for the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction at the positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Fig.10 , the block classification index C is assigned to the shadowed 4×4 size block. In this case, the operation range for calculating the one-dimensional Laplace sum may be larger than the size of the block classification unit. Here, the thin solid rectangle represents the reconstruction sample point position, and the thick solid rectangle represents the operation range for calculating the one-dimensional Laplace sum.

[0421] like Fig.10 As shown in , the specific sample point locations for performing the one-dimensional Laplace operation are the same regardless of the direction of the one-dimensional Laplace operation. Fig.10 As shown in , the pattern of the sample point positions for performing the one-dimensional Laplace calculation can be called a chessboard pattern or a quincunx pattern. In addition, all the sample point positions for performing the one-dimensional Laplace operation are even sample point positions or odd sample point positions in the horizontal direction (x-axis direction) and the vertical direction (y-axis direction) within the block classification unit or the operation range of calculating the one-dimensional Laplace sum within the block unit.

[0422] like Fig.11 As shown in FIG. 1 , when block classification is performed based on a 4×4 size block, the sum of the gradient values ​​g is calculated at one or more specific sample point locations. v , g h , g d1 , g d2At least one of. Here, V, H, D1 and D2 represent the results of the one-dimensional Laplace operation based on the sample points for the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction at the positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Fig.11 , the block classification index C is assigned to the shaded 4×4 size block. In this case, the operation range for the one-dimensional Laplace sum may be larger than the size of the block classification unit. Here, the thin solid rectangle represents the reconstruction sample point position, and the thick solid rectangle represents the operation range for calculating the one-dimensional Laplace sum.

[0423] like Fig.11 As shown in , regardless of the direction of the one-dimensional Laplace operation, the specific sample point locations for performing the one-dimensional Laplace operation are the same. Fig.11 As shown in , the pattern of the sample point positions for performing the one-dimensional Laplace calculation can be called a checkerboard pattern or a quincunx pattern. In addition, the sample point positions for performing the one-dimensional Laplace operation are even sample point positions or odd sample point positions in both the horizontal direction (x-axis direction) and the vertical direction (y-axis direction) in the block classification unit or the one-dimensional Laplace operation range within the block unit.

[0424] like Fig.12 As shown in FIG. 1 , when block classification is performed based on a 4×4 size block, the sum of the gradient values ​​g is calculated at one or more specific sample point locations. v , g h , g d1 , g d2 At least one of. Here, V, H, D1 and D2 represent the results of the sample-based one-dimensional Laplace operation performed on the sample-based direction for the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction at the positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Fig.12 , the block classification index C is assigned to the shadowed 4×4 size block. In this case, the operation range for calculating the one-dimensional Laplace sum may be larger than the size of the block classification unit. Here, the thin solid rectangle represents the reconstruction sample point position, and the thick solid rectangle represents the operation range for calculating the one-dimensional Laplace sum.

[0425] According to an embodiment of the present invention, the sum of the gradient values ​​g along the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction is calculated. v , g h , gd1 and g d2 Compares two or more values ​​in a to each other.

[0426] For example, after calculating the sum of the gradient values, the sum of the gradient values ​​in the vertical direction g v and the sum of the gradient values ​​in the horizontal direction g h Compare, and derive the maximum value of the sum of the gradient values ​​for the vertical direction and the sum of the gradient values ​​for the horizontal direction according to equation 14 and minimum value

[0427] [Equation 14]

[0428]

[0429] In this case, in order to sum the vertical gradient values ​​g v and the sum of the gradient values ​​in the horizontal direction g h Compare, and compare the values ​​of the sum according to equation 15.

[0430] [Equation 15]

[0431]

[0432] Optionally, for example, the sum of the gradient values ​​g in the first diagonal direction is d1 The sum of the gradient values ​​for the second diagonal direction g d2 Compare, and derive the maximum value of the sum of the gradient values ​​for the first diagonal direction and the sum of the gradient values ​​for the second diagonal direction according to Equation 16 and minimum value

[0433] [Equation 16]

[0434]

[0435] In this case, in order to sum the gradient values ​​g for the first diagonal direction d1 The sum of the gradient values ​​for the second diagonal direction g d2 Compare, and compare the values ​​of the sum according to equation 17.

[0436] [Equation 17]

[0437]

[0438] According to one embodiment of the present invention, in order to calculate the directivity value D, as described below, the maximum value and the minimum value are compared with two thresholds t 1 and t 2Make a comparison.

[0439] The directivity value D is a positive integer or zero. For example, the directivity value D may have a value in the range from 0 to 4. For example, the directivity value D may have a value in the range from 0 to 2.

[0440] In addition, the directivity value D may be determined according to the characteristics of the region. For example, directivity values ​​D 0 to 4 are represented as follows: 0 represents a texture region; 1 represents a strong horizontal / vertical directivity; 2 represents a weak horizontal / vertical directivity; 3 represents a strong first / second diagonal directivity; and 4 represents a weak first / second diagonal directivity. The directivity value D is determined by the steps described below.

[0441] Step 1: When satisfied and , set the value D to 0.

[0442] Step 2: When satisfied When , the process proceeds to step 3, but when it does not meet , proceed to step 4.

[0443] Step 3: When satisfied , set the value D to 2, but when it does not meet , set the value D to 1.

[0444] Step 4: When satisfied , set the value D to 4, but when it does not meet , set the value D to 3.

[0445] Among them, the threshold t 1 and t 2 is a positive integer, and t 1 and t 2 can have the same value or different values. For example, t 1 and t 2 are 2 and 9 respectively. In another example, t 1 and t 2 are all 1. In another example, t 1 and t 2 They are 1 and 9 respectively.

[0446] When block classification is performed based on a 2×2 sized block, the activity value A may be expressed as in Equation 18.

[0447] [Equation 18]

[0448]

[0449] For example, k and l are of the same range. That is, the horizontal length and vertical length of the operation range for calculating the sum of the one-dimensional Laplace operation are equal.

[0450] Alternatively, for example, k and l are different ranges from each other. That is, the horizontal length and the vertical length of the operation range for calculating the sum of the one-dimensional Laplace operation are different.

[0451] Further alternatively, for example, k ranges from i-2 to i+3, and l ranges from j-2 to j+3. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is 6×6 size.

[0452] Further alternatively, for example, k ranges from i-1 to i+2, and l ranges from j-1 to j+2. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is 4×4 size.

[0453] Further optionally, for example, k is a range from i to i+1, and l is a range from j to j+1. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is a 2×2 size. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation may be equal to the size of the block classification unit.

[0454] For example, the operation range for calculating the sum of the results of the one-dimensional Laplace operation may have a two-dimensional geometric shape selected from a rhombus, a rectangle, a square, a trapezoid, a diagonal shape, a snowflake shape, a number sign shape, a clover shape, a cross shape, a triangle, a pentagon, a hexagon, a decagon, and a dodecagon.

[0455] In addition, when block classification is performed based on a 4×4 sized block, the activity value A may be expressed as in Equation 19.

[0456] [Equation 19]

[0457]

[0458] For example, k and l are of the same range. That is, the horizontal length and vertical length of the operation range for calculating the sum of the one-dimensional Laplace operation are equal.

[0459] Alternatively, for example, k and l are different ranges from each other. That is, the horizontal length and the vertical length of the operation range for calculating the sum of the one-dimensional Laplace operation are different.

[0460] Further alternatively, for example, k ranges from i-2 to i+5, and l ranges from j-2 to j+5. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is 8×8 size.

[0461] Further optionally, for example, k ranges from i to i+3, and l ranges from j to j+3. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation is 4×4 size. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operation may be equal to the size of the block classification unit.

[0462] For example, the operation range for calculating the sum of the results of the one-dimensional Laplace operation may have a two-dimensional geometric shape selected from a rhombus, a rectangle, a square, a trapezoid, a diagonal shape, a snowflake shape, a number sign shape, a clover shape, a cross shape, a triangle, a pentagon, a hexagon, a decagon, and a dodecagon.

[0463] On the other hand, the activity value A is quantized to generate a quantized activity value A ranging from I to J. q Here, I and J are both positive integers or zero. For example, I and J are 0 and 4 respectively.

[0464] A predetermined method may be used to determine the quantitative activity value A q .

[0465] For example, the quantified activity value A q It can be obtained by equation 20. In this case, the quantized activity value A q Can be included within a range from a certain minimum value X to a certain maximum value Y.

[0466] [Equation 20]

[0467]

[0468] In Equation 20, the quantized activity value A is calculated by multiplying the activity value A by a specific constant W and performing a right shift R operation on the product of A and W. q . In this case, X, Y, W and R are all positive integers or zero. For example, W is 24, and R is 13. Alternatively, for example, W is 64 and R is 3+N (bits). For example, N is a positive integer and is specifically 8 or 10. In another example, W is 32 and R is 3+N (bits). Alternatively, for example, N is a positive integer and is specifically 8 or 10.

[0469] Further optionally, for example, a lookup table (LUT) is used to calculate the quantized activity value A q , and set the activity value A and the quantized activity value A q That is, the activity value A is operated on, and the quantized activity value A is calculated using the lookup table. q In this case, the operation may include at least one of multiplication, division, right shift operation, left shift operation, addition, and subtraction.

[0470] On the other hand, in the case of chroma components, filtering is performed for each chroma component using K filters without performing block classification processing. Here, K is a positive integer or zero. For example, K is one of 0 to 7. In addition, in the case of chroma components, block classification may not be performed on the chroma components, and filtering may be performed using a block classification index derived from a luminance component at a corresponding position of the chroma component. In addition, in the case of chroma components, filter information for the chroma components may not be signaled, and a fixed type filter may be used.

[0471] Further optionally, for example, at least one of a combination of the above-mentioned block classification index determination methods may be used to determine the block classification index.

[0472] In the following, the filtering execution sub-step will be described.

[0473] According to an exemplary embodiment of the present invention, the filter corresponding to the determined block classification index is used to perform filtering on the samples or blocks in the reconstructed / decoded picture. When performing filtering, one of L filters is selected. L is a positive integer or zero.

[0474] For example, one filter among L filters is selected in units of block classification units, and filtering is performed on a reconstructed / decoded picture in units of reconstructed / decoded samples.

[0475] Alternatively, for example, one filter among L filters is selected in units of block classification units, and filtering is performed on the reconstructed / decoded picture in units of block classification units.

[0476] Further optionally, for example, one filter among L filters is selected in units of block classification units, and filtering is performed on a reconstructed / decoded picture in units of CUs.

[0477] Further alternatively, for example, one filter among L filters is selected in units of block classification units, and filtering is performed on the reconstructed / decoded picture in units of blocks.

[0478] Further optionally, for example, U filters among the L filters are selected in units of block classification units, and filtering is performed on the reconstructed / decoded picture in units of reconstructed / decoded samples. Here, U is a positive integer.

[0479] Further optionally, for example, U filters among the L filters are selected in units of block classification units, and filtering is performed on the reconstructed / decoded picture in units of block classification units. Here, U is a positive integer.

[0480] Further optionally, for example, U filters among the L filters are selected in units of block classification units, and filtering is performed on the reconstructed / decoded picture in units of CUs. Here, U is a positive integer.

[0481] Further optionally, for example, U filters among the L filters are selected in units of block classification units, and filtering is performed on the reconstructed / decoded picture in units of blocks. Here, U is a positive integer.

[0482] Here, the L filters are referred to as a filter set.

[0483] According to an embodiment of the present invention, the L filters are different from each other in at least one of filter coefficients, the number of filter taps (ie, filter length), filter shape, and filter type.

[0484] For example, the L filters are identical in at least one of filter coefficients, the number of filter taps (filter length), filter coefficients, filter shapes, and filter types in units of blocks, CUs, PUs, TUs, CTUs, slices, tile blocks, tile groups, pictures, and sequences.

[0485] Optionally, for example, the L filters are identical in at least one of filter coefficients, the number of filter taps (filter length), filter shape, and filter type in units of CU, PU, ​​TU, CTU, slice, tile, tile group, picture, and sequence.

[0486] Filtering may be performed using the same filter or different filters in units of CU, PU, ​​TU, CTU, slice, tile, tile group, picture, and sequence.

[0487] The filtering may be performed or not performed based on the filtering performance information of whether to perform filtering in units of samples, blocks, CUs, PUs, TUs, CTUs, slices, tiles, tile groups, pictures, and sequences. The filtering performance information of whether to perform filtering is information signaled from the encoder to the decoder in units of samples, blocks, CUs, PUs, TUs, CTUs, slices, tiles, tile groups, pictures, and sequences.

[0488] According to an embodiment of the present invention, N filters with different numbers of filter taps and the same filter shape (i.e., diamond or rhombus filter shape) are used. Here, N is a positive integer. For example, Fig.13 Diamond filters with 5×5, 7×7 or 9×9 filter taps are shown in FIG.

[0489] Fig.13 is a diagram illustrating a diamond filter according to an embodiment of the present invention.

[0490] Reference Fig.13 , in order to signal from the encoder to the decoder which filter of the three diamond filters with the number of 5×5, 7×7 or 9×9 filter taps is to be used, the filter index is entropy encoded / decoded in units of picture / tile / tile group / slice / sequence. That is, the filter index is entropy encoded / decoded in the sequence parameter set, picture parameter set, slice header, slice data, tile header, tile group header, header, etc. in the bitstream.

[0491] According to an embodiment of the present invention, when the number of filter taps is fixed to 1 in an encoder / decoder, the encoder / decoder uses the filter index to perform filtering without entropy encoding / entropy decoding the filter index. Here, a diamond filter with 7×7 filter taps is used for the luminance component, and a diamond filter with 5×5 filter taps is used for the chrominance component.

[0492] According to an embodiment of the present invention, at least one of the three diamond filters is used to filter at least one reconstructed / decoded sample of at least one of the luma component and the chroma component.

[0493] For example, Fig.13 At least one of the three diamond-type filters shown in is used to filter the reconstructed / decoded luma samples.

[0494] Alternatively, for example, Fig.13 The 5×5 diamond shaped filter shown in FIG. 1 is used to filter the reconstructed / decoded chrominance samples.

[0495] Further optionally, for example, a filter used to filter luma samples is used to filter reconstructed / decoded chroma samples corresponding to the luma samples.

[0496] According to an embodiment of the present invention, the filters have the same filter length (representing 5×5 filter taps), but may have different filter shapes selected from the following shapes: diamond, rectangle, square, trapezoid, diagonal shape, snowflake, digital symbol shape, clover shape, cross, triangle, pentagon, hexagon, octagon, decagon and dodecagon. For example, Fig.14 A square-shaped filter, an octagonal-shaped filter, a snowflake-shaped filter, and a diamond-shaped filter with 5×5 filter taps are shown in FIG.

[0497] The number of filter taps is not limited to 5×5. A filter having H×V filter taps selected from the following items can be used: 3×3, 4×4, 5×5, 6×6, 7×7, 8×8, 9×9, 5×3, 7×3, 9×3, 7×5, 9×5, 9×7, and 11×7. Here, H and V are positive integers and have the same value or different values. In addition, at least one of H and V is a value predefined in the encoder / decoder and is a value sent from the encoder to the decoder with a signal. In addition, one of H and V is defined using the other of H and V. In addition, the final value of H or V can be defined using the values ​​of H and V.

[0498] On the other hand, in order to send a signal from the encoder to the decoder Fig.14 In order to know which filter among the filters shown in will be used, the filter index can be entropy encoded / decoded in units of picture / tile / tile group / slice / sequence. That is, the filter index is entropy encoded / decoded into the sequence parameter set, picture parameter set, slice header, slice data, tile header, and tile group header in the bitstream.

[0499] on the other hand, Fig.14 At least one of the square shape filter, octagonal shape filter, snowflake filter, diamond filter shown in is used to filter at least one reconstructed / decoded sample of at least one of the luminance component and the chrominance component.

[0500] According to an embodiment of the present invention, as a filter used in the above filtering process, a filter having at least one shape selected from the following shapes is used: a rhombus, a rectangle, a square, a trapezoid, a diagonal shape, a snowflake shape, a digital symbol shape, a clover shape, a cross shape, a triangle, a pentagon, a hexagon, an octagon, a decagon, and a dodecagon. For example, Fig.15a and / or Fig.15b As shown in , the filter may have a shape selected from the following shapes: square, octagon, snowflake, diamond, hexagon, rectangle, cross, number sign, cloverleaf, and diagonal.

[0501] For example, using Fig.15a and / or Fig.15b A filter set is constructed by using at least one filter of the filters having a vertical length of 5 among the filters shown in , and filtering is then performed using the filter set.

[0502] Alternatively, for example, use Fig.15a and Fig.15b A filter set is constructed by using at least one filter among the filters having a vertical filter length of 3 among the filters shown in , and then filtering is performed using the filter set.

[0503] Further optionally, for example, using Fig.15a and / or Fig.15b A filter set is constructed by using at least one of the filters having a vertical filter length of 3 or 5 shown in , and filtering is performed using the filter set.

[0504] Fig.15a and Fig.15b The filter shown in is designed to have a vertical filter length of 3 or 5. However, the filter shape used in the embodiment of the present invention is not limited thereto. The filter can be designed to have an arbitrary vertical filter length M. Here, M is a positive integer.

[0505] On the other hand, using Fig.15a and / or Fig.15b The information of which filter to use is sent from the encoder to the decoder by signaling. In this case, the filter index is entropy encoded / decoded in units of picture, tile, tile group, slice or sequence. Here, H is a positive integer. That is, the filter index is entropy encoded / decoded into the sequence parameter set, picture parameter set, slice header, slice data, tile header and tile group header in the bitstream.

[0506] At least one of diamond, rectangular, square, trapezoidal, diagonal, snowflake, numeric sign, trefoil, cross, triangle, pentagonal, hexagonal, octagonal, and decagonal filters is used to filter the reconstructed / decoded samples of at least one of the luma component and the chroma component.

[0507] on the other hand, Fig.15a and / or Fig.15b The numbers in each filter shape shown in represent the filter coefficient index, and the filter coefficient index is symmetric with respect to the filter center. That is, Fig.15a and / or Fig.15b The filter shape shown in is a point-symmetric filter.

[0508] At least one of diamond, rectangular, square, trapezoidal, diagonal, snowflake, digital sign, trefoil, cross, triangle, pentagonal, hexagonal, octagonal, and decagonal filters is used to filter the reconstructed / decoded samples of at least one of the luma component and the chroma component.

[0509] According to one embodiment of the present invention, filtering is performed on the reconstructed / decoded sample R(i, j) to generate filtered decoded sample R′(i, j). The filtered decoded sample can be expressed by Equation 21.

[0510] [Equation 21]

[0511]

[0512] In Equation 21, L is the number of filter taps in the horizontal direction or the vertical direction (filter length), and f(k, l) is the filter coefficient.

[0513] On the other hand, when filtering is performed, the offset value Y may be added to the filtered decoded sample R'(i, j). The offset value Y may be entropy encoded / decoded. In addition, the offset value Y is calculated using at least one statistical value of the current reconstructed / decoded sample value and the neighboring reconstructed / decoded sample value. In addition, the offset value Y is determined based on at least one encoding parameter of the current reconstructed / decoded sample and the neighboring reconstructed / decoded sample. Here, the threshold E is a positive integer or zero.

[0514] In addition, the filtered decoded samples may be clipped to be represented by N bits. Here, N is a positive integer. For example, when the filtered decoded samples generated by performing filtering on the reconstructed / decoded samples are clipped by 10 bits, the final decoded sample value may have a value in the range from 0 to 1023.

[0515] According to an embodiment of the present invention, filtering of a chrominance component is performed based on filter information of a luminance component.

[0516] For example, filtering of the reconstructed picture of the chrominance component may be performed only when filtering of the reconstructed picture of the luminance component is performed in the previous stage. Here, filtering of the reconstructed picture of the chrominance component may be performed on U (Cr), V (Cb), or both components.

[0517] Alternatively, for example, in the case of a chrominance component, filtering is performed using at least one of a filter coefficient of a corresponding luminance component, the number of filter taps, a filter shape, and information on whether filtering is performed.

[0518] According to an exemplary embodiment of the present invention, when filtering is performed, when there are unavailable samples near the current sample, padding is performed, and then filtering is performed using the padded samples. Padding refers to a method of copying sample values ​​of adjacent available samples to unavailable samples. Alternatively, sample values ​​or statistical values ​​obtained based on available sample values ​​adjacent to the unavailable samples are used. Padding may be repeatedly performed for P columns and R rows. Here, M and L are both positive integers.

[0519] Here, the unavailable sample refers to a sample arranged outside the boundary of a CTU, a CTB, a slice, a tile, a tile group, or a picture. Optionally, the unavailable sample refers to a sample belonging to at least one of a CTU, a CTB, a slice, a tile, a tile group, and a picture different from at least one of the CTU, a CTB, a slice, a tile, a tile group, and a picture to which the current sample belongs.

[0520] According to an embodiment, a filling method for a sample located outside a picture boundary and a filling method for a sample located outside a predetermined area, where the predetermined area exists in the picture boundary but an adaptive in-loop filtering is applied, may be different. For a sample located outside the picture boundary, a value of an available sample located at the picture boundary may be copied, and a value of a sample located outside the picture boundary may be determined. For a sample located outside a predetermined area, a filling value of an unavailable sample may be determined by mirroring the value of an available sample based on the picture boundary, where the predetermined area exists in the picture boundary but an adaptive in-loop filtering is applied.

[0521] According to an embodiment, padding of samples located outside the screen boundary may be performed only in the horizontal direction, and padding of samples located outside the screen boundary may not be performed in the vertical direction. Conversely, padding of samples located outside the screen boundary may be performed only in the vertical direction, and padding of samples located outside the screen boundary may not be performed in the horizontal direction.

[0522] Furthermore, when filtering is performed, predetermined samples may not be used.

[0523] For example, when performing filtering, the padded samples may not be used.

[0524] Alternatively, for example, when filtering is performed, when an unavailable sample exists near a current sample, the unavailable sample may not be used in filtering.

[0525] Further optionally, for example, when filtering is performed, when samples near the current sample are located outside the CTU or CTB, neighboring samples near the current sample may not be used in filtering.

[0526] Also, when filtering is performed, samples to which at least one of deblocking filtering, adaptive sample offset, and adaptive in-loop filtering is applied may be used.

[0527] Furthermore, when filtering is performed, when at least one of samples existing near a current sample is located outside a CTU or CTB boundary, at least one of deblocking filtering, adaptive sample offset, and adaptive in-loop filtering may not be applied.

[0528] Furthermore, the filtering target samples include unavailable samples located outside a CTU or CTB boundary, at least one of deblocking filtering, adaptive sample shifting, and adaptive in-loop filtering is not performed on the unavailable samples, and the unavailable samples are used for filtering as is.

[0529] According to an embodiment of the present invention, when filtering is performed, at least one of the samples located near a boundary of at least one of a CU, a PU, a TU, a block, a block classification unit, a CTU, and a CTB is filtered. In this case, the boundary includes at least one of a vertical boundary, a horizontal boundary, and a diagonal boundary. In addition, the sample located near the boundary may be at least one of U rows, U columns, and U samples located near the boundary. Here, U is a positive integer.

[0530] According to an embodiment of the present invention, when filtering is performed, filtering is performed on at least one of the samples located within the block, and filtering is not performed on the samples located outside the boundary of at least one of the CU, PU, ​​TU, block, block classification unit, CTU, and CTB. In this case, the boundary includes at least one of a vertical boundary, a horizontal boundary, and a diagonal boundary. In addition, the sample located near the boundary may be at least one of U rows, U columns, and U samples located near the boundary. Here, U is a positive integer.

[0531] Further optionally, filtering is performed, for example, by using any combination of the above filtering methods.

[0532] Hereinafter, the filter information encoding / decoding steps will be described.

[0533] According to an embodiment of the present invention, the filter information is entropy encoded / decoded to be disposed between the slice header and the first CTU syntax element of the slice data within the bitstream.

[0534] In addition, the filter information is entropy encoded / decoded to be set in a sequence parameter set, a picture parameter set, a slice header, a slice data, a tile header, a tile group header, a CTU, or a CTB within a bitstream.

[0535] On the other hand, the filter information includes at least one piece of information selected from the following items: information about whether luminance component filtering is performed, information about whether chrominance component filtering is performed, filter coefficient values; the number of filters, the number of filter taps (filter length), filter shape information, filter type information, information about whether filtering is performed in units of slices, parallel blocks, parallel block groups, pictures, CTUs, CTBs, blocks or CUs, information about the number of times CU-based filtering is performed, CU maximum depth filtering information, information about whether CU-based filtering is performed, information about whether a filter of a previous reference picture is used, a filter index of a previous reference picture, information about whether a fixed filter is used for a block classification index, index information for a fixed filter, filter merging information, information about whether different filters are used for luminance components and chrominance components, respectively, and filter symmetry shape information.

[0536] Here, the number of filter taps refers to at least one of the horizontal length of the filter, the vertical length of the filter, the first diagonal length of the filter, the second diagonal length of the filter, the horizontal and vertical lengths of the filter, and the number of filter coefficients within the filter.

[0537] On the other hand, the filter information includes a maximum of L luma filters. Here, L is a positive integer, and specifically 25. In addition, the filter information includes a maximum of L chroma filters. Here, L is a positive integer, including 0, and can be 0 to 8. Information about a maximum of L chroma filters may be included in a parameter set or a header. The parameter set may be an adaptive parameter set. Information about a maximum of L chroma filters may represent information about the number of chroma ALFs, and may be encoded / decoded as, for example, a syntax element alf_chroma_num_alt_filters_minus1.

[0538] On the other hand, one filter includes a maximum of K luminance filter coefficients. Here, K is a positive integer, and is specifically 13. In addition, the filter information includes a maximum of K chrominance filter coefficients. Here, K is a positive integer, and is specifically 7.

[0539] For example, the information about the filter symmetric shape is information about the filter shape such as a point symmetric shape, a horizontal symmetric shape, a vertical symmetric shape, or a combination thereof.

[0540] On the other hand, only some of the filter coefficients are signaled. For example, when the filter has a symmetric form, information about the filter symmetric shape and only one of the symmetric filter coefficient sets is signaled. Alternatively, for example, the filter coefficients at the center of the filter are not signaled, because they can be derived implicitly.

[0541] According to an embodiment of the present invention, the filter coefficient values ​​in the filter information are quantized in the encoder, and the obtained quantized filter coefficient values ​​are entropy encoded. Similarly, the quantized filter coefficient values ​​in the decoder are entropy decoded, and the quantized filter coefficient values ​​are dequantized to be restored to the original filter coefficient values. The filter coefficient values ​​are quantized to a range of values ​​that can be represented by fixed M bits, and then dequantized. In addition, at least one filter coefficient in the filter coefficients is quantized to different bits and dequantized. Conversely, at least one filter coefficient in the filter coefficients may be quantized to the same bit and dequantized. The M bits are determined according to the quantization parameter. In addition, M of the M bits is a constant predefined in the encoder and decoder. Here, M can be a positive integer, and can specifically be 8 or 10. The M bits can be less than or equal to the number of bits required to represent a sample point in the encoder / decoder. For example, when the number of bits required to represent a sample point is 10, M can be 8. The first filter coefficient in the filter coefficients within the filter can have a value from -2 M to -2 M -1, and the second filter coefficient may have a value from 0 to 2 M Here, the first filter coefficient refers to filter coefficients other than the center filter coefficient among the filter coefficients, and the second filter coefficient refers to the center filter coefficient among the filter coefficients.

[0542] The filter coefficient values ​​in the filter information may be clipped by at least one of the encoder and the decoder, and at least one of the minimum value and the maximum value associated with the clipping may be entropy encoded / decoded. The filter coefficient values ​​may be clipped to fall within a range from the minimum value to the maximum value. For each filter coefficient, at least one of the minimum value and the maximum value may have different values. On the other hand, for each filter coefficient, at least one of the minimum value and the maximum value may have the same value. At least one of the minimum value and the maximum value may be determined based on a quantization parameter. At least one of the minimum value and the maximum value may be a constant value predefined in the encoder and the decoder.

[0543] According to an exemplary embodiment of the present invention, whether filtering is performed on at least one of a luminance component and a chrominance component is indicated by using filtering performance information (flag).

[0544] For example, whether filtering is performed on at least one of the luminance component and the chrominance component is indicated by using filtering execution information (flag) in units of CTU, CTB, CU, or block. For example, when the filtering execution information has a first value, filtering is performed in units of CTB, and when the filtering execution information has a second value, filtering is not performed on the corresponding CTB. In this case, information about whether filtering is performed for each CTB may be entropy encoded / decoded. Optionally, for example, information about the maximum depth or minimum size of a CU (maximum depth filtering information of a CU) is additionally entropy encoded / decoded, and CU-based filtering execution information about a CU having a maximum depth or a CU having a minimum size may be entropy encoded / decoded.

[0545] For example, when a block can be partitioned into smaller square sub-blocks and non-square sub-blocks according to a block structure, the CU-based flag is entropy encoded / decoded until the block has a partition depth of a block structure that can be partitioned into smaller square sub-blocks. In addition, the CU-based flag may be entropy encoded / decoded until the block has a partition depth of a block structure that can be partitioned into smaller non-square sub-blocks.

[0546] Alternatively, for example, the information about whether to perform filtering on at least one of the luminance component and the chrominance component may be a block-based flag (i.e., a flag in units of blocks). For example, when the block-based flag of the block has a first value, filtering is performed on the corresponding block, and when the block-based flag of the corresponding block has a second value, filtering is not performed. The size of the block is N×M, where N and M are positive integers.

[0547] Further optionally, for example, the information about whether to perform filtering on at least one of the luminance component and the chrominance component may be a CTU-based flag (i.e., a flag in units of CTU). For example, when the CTU-based flag of the CTU has a first value, filtering is performed on the corresponding CTU, and when the CTU-based flag of the corresponding CTU has a second value, filtering is not performed. The size of the CTU is N×M, where N and M are positive integers.

[0548] Further optionally, for example, whether to perform filtering on at least one of the luminance component and the chrominance component is determined according to a picture, a slice, a tile group, or a tile type. The information about whether to perform filtering on at least one of the luminance component and the chrominance component can be a flag in units of a picture, a slice, a tile group, or a tile.

[0549] According to an embodiment of the present invention, filtering is performed using a fixed filter set.

[0550] Although it is not possible to use temporal filter coefficient prediction in an intra-frame prediction picture (I picture, slice, parallel block group or parallel block), at least one filter of up to 16 fixed filters in the filter set can be used for filtering according to the block classification index. In order to send information about whether to use a fixed filter set from the encoder to the decoder with a signal, information about whether to use a fixed filter for each block classification index in the block classification index is entropy encoded / decoded. When a fixed filter is used, the index information about the fixed filter is also entropy encoded / decoded. Even when a fixed filter is used for a specific block classification index, the filter coefficient is entropy encoded / decoded, and the reconstructed picture is filtered using the filter coefficient and the fixed filter coefficient that have been entropy encoded / decoded.

[0551] Furthermore, a fixed filter set is also used in inter-predicted pictures (B / P pictures, slices, tile groups or tiles).

[0552] In addition, when entropy encoding / decoding is not performed on the filter coefficients, a fixed filter can be used to perform adaptive in-loop filtering. Here, the fixed filter may represent a filter set predefined in the encoder and decoder. In this case, when entropy encoding / decoding is not performed on the filter coefficients, the encoder and decoder entropy encode / decode the fixed filter index information indicating which filter or which filter set is used in a filter set of multiple filter sets predefined in the encoder and decoder. In this case, based on at least one of a block category, a block, a CU, a stripe, a parallel block, a parallel block group, and a picture, filtering is performed using a fixed filter that is different in at least one of a filter coefficient value, a filter tap (i.e., the number of filter taps or the filter length) and a filter shape.

[0553] According to an embodiment of the invention, prediction of filter coefficients from filter coefficients of a predefined fixed filter is prohibited.

[0554] According to an embodiment of the present invention, the multiplication operation is replaced by a shift operation. First, the filter coefficients for performing filtering on the luminance block and / or the chrominance block are divided into two groups. For example, the filter coefficients are divided into a first group including coefficients {L0, L1, L2, L3, L4, L5, L7, L8, L9, L10, L14, L15, L16, and L17} and a second group including the remaining coefficients. The first group is limited to only include coefficient values ​​{-64, -32, -16, -8, -4, 0, 4, 8, 16, 32, and 64}. In this case, the multiplication of the filter coefficients included in the first group and the reconstructed / decoded samples can be performed by a single bit shift operation. Therefore, the filter coefficients included in the first group are mapped to pre-binarized bit-shifted values ​​to reduce signaling overhead.

[0555] A computer-readable recording medium according to the present invention stores a bitstream generated by a video encoding method, wherein the video encoding method includes: classifying the encoding unit into multiple categories in units of block classification units, filtering the encoding units classified in units of block classification units, and encoding the filter information. The block classification unit is not limited to the encoding unit. That is, block classification can be performed in units of strips, parallel blocks, parallel block groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs. In addition, the target to be filtered is not a coding unit. In other words, filtering can be performed on strips, parallel blocks, parallel block groups, pictures, sequences, CTUs, blocks, CUs, PUs, or TUs. In addition, the filter information is not limited to the filter information for each coding unit. The filter information can be filter information for each strip, parallel block, parallel block group, picture, sequence, CTU, block, CU, PU, ​​or TU.

[0556] The following shows examples of syntax element information required to implement adaptive in-loop filtering in an encoder / decoder, semantics of the syntax element information, and encoding / decoding processes. In the present disclosure, syntax may refer to syntax elements.

[0557] Figures 16 to 21 An example of syntax element information required for adaptive in-loop filtering is shown. At least one syntax element among the syntax elements required for the adaptive in-loop filter may be entropy encoded / decoded in at least one of a parameter set, a header, a partition, a CTU, or a CU.

[0558] At this time, the parameter set, header, block, CTU or CU can be at least one of a video parameter set, a decoding parameter set, a sequence parameter set, an adaptation parameter set, a picture parameter set, a picture header, a sub-picture header, a slice header, a parallel block group header, a parallel block header, a block, a coding tree unit (CTU) or a coding unit (CU).

[0559] Here, the signaled parameter set, header, partition, CTU, or CU may be used for adaptive in-loop filtering using syntax elements for adaptive in-loop filtering.

[0560] For example, when entropy encoding / decoding of syntax elements for adaptive in-loop filtering is performed in a sequence parameter set, adaptive in-loop filtering may be performed using syntax elements for adaptive in-loop filtering having the same syntax element values ​​in sequence units.

[0561] In another example, when the syntax elements for adaptive in-loop filtering are entropy encoded / decoded in a picture parameter set, adaptive in-loop filtering may be performed using the syntax elements for adaptive in-loop filtering having the same syntax element values ​​in a picture unit.

[0562] In another example, when a syntax element for adaptive in-loop filtering is entropy encoded / decoded in a picture header, adaptive in-loop filtering may be performed using a syntax element for adaptive in-loop filtering having the same syntax element value in a picture unit.

[0563] In another example, when a syntax element for adaptive in-loop filtering is entropy encoded / decoded in a slice header, adaptive in-loop filtering may be performed using a syntax element for adaptive in-loop filtering having the same syntax element value in a slice unit.

[0564] In another example, when syntax elements for adaptive in-loop filtering are entropy encoded / decoded in an adaptive parameter set, adaptive in-loop filtering may be performed using syntax elements for adaptive in-loop filtering having the same syntax element values ​​in units referring to the same adaptive parameter set.

[0565] An adaptation parameter set may refer to a parameter set that can be referenced and shared in different pictures, sub-pictures, slices, tile groups, tiles, or partitions. In addition, in a sub-picture, slice, tile group, tile, or partition in a picture, information in an adaptation parameter set may be used by referring to different adaptation parameter sets.

[0566] Furthermore, in a sub-picture, a slice, a tile group, a tile or a partition in a picture, different adaptation parameter sets may be referenced using identifiers of different adaptation parameter sets.

[0567] Furthermore, in a slice, a tile group, a tile or a partition in a sub-picture, different adaptation parameter sets may be referenced using identifiers of different adaptation parameter sets.

[0568] Furthermore, in a tile or partition in a slice, different adaptation parameter sets may be referenced using identifiers of different adaptation parameter sets.

[0569] Furthermore, in partitions within a tile, different adaptation parameter sets may be referenced using identifiers of different adaptation parameter sets.

[0570] An adaptation parameter set identifier may refer to an identification number assigned to an adaptation parameter set.

[0571] Information about the adaptation parameter set identifier may be included in a header of a parameter set or a sequence. An adaptation parameter set corresponding to the adaptation parameter set identifier may be used in a sequence.

[0572] Information about the adaptation parameter set identifier may be included in a header of a parameter set or a picture. In addition, an adaptation parameter set corresponding to the adaptation parameter set identifier may be used in the picture.

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

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

[0575] Information about the adaptation parameter set identifier may be included in a header of a parameter set or a slice. In addition, an adaptation parameter set corresponding to the adaptation parameter set identifier may be used in a slice.

[0576] Information about the adaptation parameter set identifier may be included in a header of a parameter set or a partition. In addition, an adaptation parameter set corresponding to the adaptation parameter set identifier may be used in the partition.

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

[0578] A sub-picture may be partitioned into one or more tile rows and one or more tile columns in a picture. A sub-picture is an area in a picture having a rectangular / square shape and may include one or more CTUs. In addition, at least one tile / block / strip may be included in one sub-picture.

[0579] A tile is a region having a rectangular / square shape in a picture and may include one or more CTUs. In addition, a tile may be partitioned into one or more partitions.

[0580] A partition may refer to one or more CTU rows in a tile. A tile may be partitioned into one or more partitions, and each partition may have one or more CTU rows. In addition, a partition may represent a tile that is not partitioned further.

[0581] A slice may include one or more tiles in a picture and may include one or more partitions in a tile.

[0582] As in Fig.16 In the example of , sps_alf_enabled_flag may represent information indicating whether adaptive in-loop filtering is performed in sequence units.

[0583] For example, when sps_alf_enabled_flag has a first value (eg, 0), adaptive in-loop filtering may not be performed in sequence units. In addition, when sps_alf_enabled_flag has a second value (eg, 1), adaptive in-loop filtering may be performed in sequence units.

[0584] When sps_alf_enabled_flag is not present in the bitstream, sps_alf_enabled_flag may be inferred to be a first value (eg, 0).

[0585] As in Fig.17 In the example of , adaptation_parameter_set_id may represent an identifier of an adaptation parameter set referenced by another syntax element. When adaptation_parameter_set_id is not present in the bitstream, adaptation_parameter_set_id may be inferred to be a first value (eg, 0).

[0586] As in Fig.18 In the example of , aps_params_type may indicate the type information of the adaptive parameter set present in the adaptive parameter set. In addition, aps_params_type may indicate the type of encoding information included in the adaptive parameter set. For example, when aps_params_type has a first value (e.g., 0), the data / content / syntax element value in the adaptive parameter set may indicate a parameter for adaptive in-loop filtering (ALF type). When aps_params_type has a second value (e.g., 1), the data / content / syntax element value in the adaptive parameter set may indicate a parameter for luma mapping and chroma scaling (luminance mapping and chroma scaling type). When aps_params_type has a third value (e.g., 2), the data / content / syntax element value in the adaptive parameter set may indicate a parameter for a quantization matrix set (quantization matrix type). Here, SL refers to a scaling list representing a quantization matrix. When aps_params_type is not present in the bitstream, aps_params_type may be inferred to be a value other than the first value (e.g., 0), the second value (e.g., 1), and the third value (e.g., 2).

[0587] The same adaptive parameter set identifier as that of the adaptive parameter set previously signaled may be newly signaled for the current adaptive parameter set. In addition, an adaptive parameter set having the same adaptive parameter set identifier and adaptive parameter type as that of the adaptive parameter set previously signaled may be newly signaled. At this time, the data / content / syntax element value of the adaptive parameter set previously signaled may be replaced with the data / content / syntax element value of the adaptive parameter set newly signaled. The replacement process represents an update process of the adaptive parameter set.

[0588] That is, in the encoder / decoder, at least one of adaptive in-loop filtering, luminance mapping and chrominance scaling (LMCS), and quantization / dequantization using a quantization matrix may be performed by referring to data / content / syntax element values ​​of the previously signaled adaptive parameter set. From a time point when an adaptive parameter set having an adaptive parameter set identifier identical to that of the previously signaled adaptive parameter set is newly signaled for a current adaptive parameter set, in the encoder / decoder, at least one of adaptive in-loop filtering, luminance mapping and chrominance scaling (LMCS), and quantization / dequantization using a quantization matrix may be performed by referring to data / content / syntax element values ​​in the newly signaled adaptive parameter set.

[0589] Furthermore, in the encoder / decoder, at least one of adaptive in-loop filtering, luminance mapping and chrominance scaling (LMCS), and quantization / dequantization using a quantization matrix may be performed by referring to data / content / syntax element values ​​of the previously signaled adaptive parameter set. From a time point when an adaptive parameter set having the same adaptive parameter set identifier and adaptive parameter type as the previously signaled adaptive parameter set is newly signaled, in the encoder / decoder, at least one of adaptive in-loop filtering, luminance mapping and chrominance scaling (LMCS), and quantization / dequantization using a quantization matrix may be performed by referring to data / content / syntax element values ​​in the newly signaled adaptive parameter set.

[0590] According to an embodiment, chroma component presence information aps_chroma_present_flag indicating whether the encoding information related to the chroma component is included in the adaptive parameter set may be included in the adaptive parameter set and encoded / decoded. When the chroma component presence information indicates that the encoding information related to the chroma component is included in the adaptive parameter set, the adaptive parameter set may include encoding information of the chroma component for adaptive in-loop filtering, luminance mapping and chroma scaling, or quantization matrix. If not, the adaptive parameter set may not include encoding information of the chroma component for adaptive in-loop filtering, luminance mapping and chroma scaling, or quantization matrix.

[0591] According to the chroma component existence information, it can be determined whether there is a quantization matrix of the chroma component. In addition, according to the chroma component existence information, it can be determined whether there is adaptive in-loop filter information of the chroma component. In addition, according to the chroma component existence information, it can be determined whether there is brightness mapping and chroma scaling information of the chroma component.

[0592] According to an embodiment, when the chroma format of the current video, sequence, picture, or slice is 4:0:0 (in the case of monochrome), the chroma component presence information may indicate that there is no chroma component. Therefore, when the chroma format is 4:0:0, the picture header or the slice header may not include an adaptation parameter set identifier for the chroma component. That is, when the chroma format is 4:0:0, the picture header or the slice header may not include quantization matrix information, adaptive in-loop filter information, and luma mapping and chroma scaling (LMCS) for the chroma component.

[0593] chroma_format_idc or ChromaArrayType may indicate the chroma format. Chroma_format may indicate the format of the chroma component.

[0594] For example, when chroma_format_idc has a first value (eg, 0), the chroma format may be set to 4:0:0. When the chroma format of the current picture is 4:0:0, the current picture may be determined as monochrome without a chroma component.

[0595] In addition, when chroma_format_idc has a second value (e.g., 1), the chroma format may be set to 4:2:0. When chroma_format_idc has a third value (e.g., 2), the chroma format may be set to 4:2:2. When chroma_format_idc has a fourth value (e.g., 3), the chroma format may be set to 4:4:4.

[0596] Furthermore, when the chroma format is 4:0:0, chroma component presence information in an adaptation parameter set referenced in a current picture or a current slice may be determined as a first value (eg, 0) indicating encoding information that a chroma component does not exist.

[0597] Furthermore, when the chroma format is not 4:0:0, the chroma component presence information in the adaptation parameter set referenced in the current picture or the current slice may be determined as a second value (eg, 1) representing encoding information of the presence of the chroma component.

[0598] Furthermore, when the chroma format is 4:0:0, chroma component presence information in an adaptation parameter set referenced in a current picture or a current slice may be determined as a first value (eg, 0) of quantization matrix information indicating that a chroma component does not exist.

[0599] Furthermore, when the chroma format is not 4:0:0, the chroma component presence information in the adaptation parameter set referenced in the current picture or the current slice may be determined as a second value (eg, 1) indicating the presence of quantization matrix information of the chroma component.

[0600] As in Fig.19In the example of , slice_alf_enabled_flag may represent information indicating whether adaptive in-loop filtering is performed in slice units for at least one of Y, Cb, or Cr components.

[0601] For example, when slice_alf_enabled_flag has a first value (e.g., 0), adaptive in-loop filtering may not be performed in slice units for all Y, Cb, and Cr components. In addition, when slice_alf_enabled_flag has a second value (e.g., 1), adaptive in-loop filtering may be performed in slice units for at least one of the Y, Cb, or Cr components.

[0602] When slice_alf_enabled_flag is not present in the bitstream, slice_alf_enabled_flag may be inferred to be a first value (eg, 0).

[0603] slice_num_alf_aps_ids_luma may be slice luma ALF set number information, wherein the slice luma ALF set number information indicates the number of adaptive parameter sets for adaptive in-loop filtering referenced in a slice. Here, an ALF set may indicate a filter set including a plurality of adaptive in-loop filters (ALFs). At this time, luma ALF may indicate an adaptive in-loop filter for a luma component.

[0604] slice_num_alf_aps_ids_luma may have a value from 0 to N. Here, N may be a positive integer, and may be 6, for example.

[0605] When slice_num_alf_aps_ids_luma is not present in the bitstream, slice_num_alf_aps_ids_luma may be inferred to be a first value (eg, 0).

[0606] In addition, the maximum number of adaptive parameter sets for adaptive in-loop filtering and the maximum number of adaptive parameter sets for luminance mapping and chrominance scaling preset in the encoder / decoder may be equal to each other. In addition, the maximum number of adaptive parameter sets for adaptive in-loop filtering and the maximum number of adaptive parameter sets for quantization matrix sets preset in the encoder / decoder may be equal to each other. In addition, the maximum number of adaptive parameter sets for luminance mapping and chrominance scaling and the maximum number of adaptive parameter sets for quantization matrix sets preset in the encoder / decoder may be equal to each other.

[0607] In addition, the maximum number of adaptive parameter sets for adaptive in-loop filtering and the maximum number of adaptive parameter sets for luminance mapping and chrominance scaling preset in the encoder / decoder may be different from each other. In addition, the maximum number of adaptive parameter sets for quantization matrix sets and the maximum number of adaptive parameter sets for luminance mapping and chrominance scaling preset in the encoder / decoder may be different from each other. In addition, the maximum number of adaptive parameter sets for adaptive in-loop filtering and the maximum number of adaptive parameter sets for quantization matrix sets preset in the encoder / decoder may be different from each other.

[0608] The sum of the maximum number of adaptive parameter sets for adaptive in-loop filtering, the maximum number of adaptive parameter sets for luma mapping and chroma scaling, and the maximum number of adaptive parameter sets for quantization matrix sets may be the maximum number of adaptive parameter sets that may be included in the encoder / decoder.

[0609] The number of adaptive parameter sets for adaptive in-loop filtering may be a maximum of K in the case of intra slices, and a maximum of L in the case of inter slices. Here, K and L may be positive integers, and for example, K may be 1 and L may be 6.

[0610] The number of adaptive parameter sets for luma mapping and chroma scaling may be a maximum of K in the case of intra slices, and a maximum of L in the case of inter slices. Here, K and L may be positive integers, and for example, K may be 1 and L may be 6.

[0611] The number of adaptive parameter sets for a quantization matrix set may be a maximum of K in the case of an intra slice, and a maximum of L in the case of an inter slice. Here, K and L may be positive integers, and for example, K may be 1 and L may be 6.

[0612] Optionally, the number of adaptive parameter sets for luma mapping and chroma scaling may be at most J, regardless of the type of slice. Here, J may be a positive integer from 1 to 8, and for example, J may be 4.

[0613] Alternatively, the number of adaptive parameter sets for the adaptive in-loop filter may be at most J, regardless of the type of the slice. Here, J may be a positive integer from 1 to 8, and for example, J may be 8.

[0614] Alternatively, the number of adaptive parameter sets for the quantization matrix set may be at most J regardless of the type of slice. Here, J may be a positive integer from 1 to 8, and for example, J may be 8.

[0615] According to an embodiment, the adaptation parameter set identifier may have an N-bit positive integer value. The N value is a positive integer greater than 1. For example, the N value may be 5. Therefore, the adaptation parameter set identifier may indicate one of 0 to 31. That is, a maximum of 32 adaptation parameter sets may be defined.

[0616] Among the 32 adaptive parameter sets, 8 adaptive parameter sets may indicate information about quantization matrices. In addition, the other 8 adaptive parameter sets may indicate information about adaptive in-loop filters. In addition, the other four adaptive parameter sets may indicate information about luma mapping and chroma scaling.

[0617] The adaptive parameter set identifier for the quantization matrix may have a value from 0 to N. At this time, N is a positive integer and may be 7.

[0618] In addition, the adaptation parameter set identifier for the adaptive in-loop filter may have a value from 0 to N. At this time, N is a positive integer and may be 7.

[0619] In addition, the adaptation parameter set identifier for luma mapping and chroma scaling may have a value from 0 to N. At this time, N is a positive integer and may be 3.

[0620] Adaptation parameter set identifiers for quantization matrix, adaptive in-loop filter, and luma mapping and chroma scaling may be encoded as fixed length codes according to the adaptation parameter set type.

[0621] According to an embodiment, the maximum number of adaptive parameter sets referenced by a slice included in one picture may be one or more. For example, a slice included in one picture may refer to at most one adaptive parameter set for a quantization matrix, at most one adaptive parameter set for luma mapping and chroma scaling, and at most N adaptive parameter sets for an adaptive in-loop filter. N is an integer equal to or greater than 2. For example, N may be 8 or 9.

[0622] slice_alf_aps_id_luma[i] may represent a slice luma ALF set identifier indicating an i-th adaptive parameter set for adaptive in-loop filtering referenced in a slice.

[0623] When slice_alf_aps_id_luma[i] is not present in the bitstream, slice_alf_aps_id_luma[i] may be inferred to be a first value (eg, 0).

[0624] Here, the temporal layer identifier of the adaptation parameter set having the same adaptation_parameter_set_id as slice_alf_aps_id_luma[i] may be less than or equal to the temporal layer identifier of the current slice. In the present disclosure, adaptation_parameter_set_id may represent an adaptation parameter set identifier.

[0625] When two or more sub-pictures / slices / tile groups / partitions have the same adaptation_parameter_set_id in one picture and there are two or more adaptation parameter sets for adaptive in-loop filtering with the adaptation_parameter_set_id, the two or more adaptation parameter sets for adaptive in-loop filtering with the same adaptation_parameter_set_id may have the same data / content / syntax element value.

[0626] In case of an intra slice, slice_alf_aps_id_luma[i] may not refer to an adaptation parameter set for adaptive in-loop filtering for a picture other than an intra picture or a picture including an intra slice.

[0627] According to an embodiment, slice_alf_aps_id_luma[i] may refer to only an adaptive parameter set including an adaptive in-loop filter set for a luma component.

[0628] According to an embodiment, slice_alf_aps_id_luma[i] may refer to an adaptive parameter set for adaptive in-loop filtering among the adaptive parameter sets referenced in a picture header or a slice header. In addition, the picture header or the slice header may include encoding information indicating an adaptive parameter set for adaptive in-loop filtering applicable to the picture or the slice. Here, the temporal layer identifier of the adaptive parameter set having the adaptation_parameter_set_id indicated by the encoding information may be less than or equal to the temporal layer identifier of the current picture.

[0629] When the adaptation parameter set type of a predetermined adaptation parameter set is a parameter for adaptive in-loop filtering (ALF type) and the adaptation parameter set identifier adaptation_parameter_set_id is equal to alf_aps_id_luma[i] which is the identifier of the adaptation parameter set referenced in the current picture or the picture header, the temporal layer identifier of the predetermined adaptation parameter set may be less than or equal to the temporal layer identifier of the current picture.

[0630] When slice_alf_chroma_idc has a first value (eg, 0), adaptive in-loop filtering may not be performed on Cb and Cr components.

[0631] Furthermore, when slice_alf_chroma_idc has a second value (eg, 1), adaptive in-loop filtering may be performed on the Cb component.

[0632] Also, when slice_alf_chroma_idc has a third value (eg, 2), adaptive in-loop filtering may be performed on the Cr component.

[0633] Also, when slice_alf_chroma_idc has a fourth value (eg, 3), adaptive in-loop filtering may be performed on Cb and Cr components.

[0634] When slice_alf_chroma_idc is not present in the bitstream, slice_alf_chroma_idc may be inferred to be a first value (eg, 0).

[0635] According to an embodiment, a picture header or a slice header may include encoding information indicating whether adaptive in-loop filtering is performed for Cb and Cr components in a slice or a slice included in the picture. In addition, for chroma components Cb and Cr allowed by the encoding information of the picture header or the slice header, slice_alf_chroma_idc may be chroma ALF application information indicating whether the chroma component is allowed in the slice. For example, when only the adaptive in-loop filtering of the Cb component of the picture header or the slice header is allowed, slice_alf_chroma_idc may only indicate whether the adaptive in-loop filtering of the Cb component is allowed in the slice. Conversely, when only the adaptive in-loop filtering of the Cr component of the picture header or the slice header is allowed, slice_alf_chroma_idc may only indicate whether the adaptive in-loop filtering of the Cr component is allowed in the slice. Furthermore, when both the Cb component and the Cr component are not allowed, slice_alf_chroma_idc may be inferred as a first value (eg, 0) without being encoded / decoded / acquired.

[0636] According to an embodiment, as an alternative to slice_alf_chroma_idc, slice_alf_cb_flag indicating whether adaptive in-loop filtering is performed for Cb components and slice_alf_cr_flag indicating whether adaptive in-loop filtering is performed for Cr components may be encoded / decoded / acquired. When slice_alf_cb_flag has a first value (e.g., 0), adaptive in-loop filtering may not be performed for Cb components. In addition, when slice_alf_cb_flag has a second value (e.g., 1), adaptive in-loop filtering may be performed for Cb components. When slice_alf_cr_flag has a first value (e.g., 0), adaptive in-loop filtering may not be performed for Cr components. In addition, when slice_alf_cr_flag has a second value (e.g., 1), adaptive in-loop filtering may be performed for Cr components. When slice_alf_cb_flag and slice_alf_cr_flag are not present in the bitstream, slice_alf_cb_flag and slice_alf_cr_flag may be inferred to be a first value (eg, 0).

[0637] According to an embodiment, the picture header or the slice header may include encoding information indicating whether adaptive in-loop filtering is performed for a slice included in the picture or a Cb component in the slice. In addition, when the encoding information of the picture header or the slice header allows adaptive in-loop filtering of the Cb component, slice_alf_cb_flag may be encoded / decoded / acquired. In addition, according to slice_alf_cb_flag, it may be determined whether to filter the Cb component in the picture or the slice. If the encoding information of the picture header or the slice header does not allow adaptive in-loop filtering of the Cb component, slice_alf_cb_flag may not be encoded / decoded / acquired, and slice_alf_cb_flag may be inferred to be a first value (e.g., 0).

[0638] Similarly, the picture header or the slice header may include encoding information indicating whether adaptive in-loop filtering is performed for a slice included in the picture or a Cr component in the slice. In addition, when the encoding information of the picture header or the slice header allows adaptive in-loop filtering of the Cr component, slice_alf_cr_flag may be encoded / decoded / acquired. In addition, according to slice_alf_cr_flag, it may be determined whether to filter the Cr component in the picture or the slice. If the encoding information of the picture header or the slice header does not allow adaptive in-loop filtering of the Cr component, slice_alf_cr_flag may not be encoded / decoded / acquired, and slice_alf_cr_flag may be inferred to be a first value (e.g., 0).

[0639] slice_alf_cb_flag and slice_alf_cr_flag are examples of information indicating whether adaptive in-loop filtering is performed on chroma components, which is signaled in a slice, and when information indicating whether adaptive in-loop filtering is performed on chroma components in a picture is signaled, slice_alf_cb_flag and slice_alf_cr_flag may be changed to ph_alf_cb_flag and ph_alf_cr_flag.

[0640] slice_alf_aps_id_chroma may represent an identifier of an adaptation parameter set referenced in a chroma component of a slice. That is, slice_alf_aps_id_chroma may represent a slice chroma ALF set identifier indicating an adaptation parameter set for adaptive in-loop filtering referenced in a slice.

[0641] When at least one of slice_alf_cb_flag or slice_alf_cr_flag has a second value (eg, 1), slice_alf_aps_id_chroma may be encoded / decoded.

[0642] When slice_alf_aps_id_chroma is not present in the bitstream, slice_alf_aps_id_chroma may be inferred to be a first value (eg, 0).

[0643] Here, the temporal layer identifier of the adaptation parameter set having the same adaptation_parameter_set_id as slice_alf_aps_id_chroma may be less than or equal to the temporal layer identifier of the current slice.

[0644] In case of an intra slice, slice_alf_aps_id_chroma or slice_alf_aps_id_chroma[i] may not refer to an adaptation parameter set for adaptive in-loop filtering for a picture other than an intra picture or a picture including an intra slice.

[0645] According to an embodiment, slice_alf_aps_id_chroma[i] may refer to only the adaptive parameter set including the adaptive in-loop filter set for the chroma component.

[0646] In addition, as an alternative to slice_alf_aps_id_chroma, slice_alf_aps_id_chroma[i] may be used. That is, one of two or more adaptive parameter sets including adaptive in-loop filter information may be selected during adaptive in-loop filtering for chroma components. Adaptive in-loop filter information (slice_alf_aps_id_chroma[i]) in the adaptive parameter set may be used in adaptive in-loop filtering for chroma components.

[0647] slice_alf_aps_id_chroma[i] may represent an identifier of an i-th adaptation parameter set for adaptive in-loop filtering referenced in a slice. That is, slice_alf_aps_id_chroma[i] may represent a slice chroma ALF set identifier indicating an i-th adaptation parameter set for adaptive in-loop filtering referenced in a slice.

[0648] When slice_alf_aps_id_chroma[i] is not present in the bitstream, slice_alf_aps_id_chroma[i] may be inferred to be a first value (eg, 0).

[0649] Here, the temporal layer identifier of the adaptation parameter set having the same adaptation_parameter_set_id as slice_alf_aps_id_chroma[i] may be less than or equal to the temporal layer identifier of the current slice.

[0650] When two or more sub-pictures / slices / tile groups / tiles / partitions have the same adaptation_parameter_set_id in one picture and there are two or more adaptation parameter sets for adaptive in-loop filtering with the adaptation_parameter_set_id, the two or more adaptation parameter sets for adaptive in-loop filtering with the same adaptation_parameter_set_id may have the same data / content / syntax element value.

[0651] In case of intra slices, slice_alf_aps_id_chroma[i] may not refer to an adaptation parameter set for adaptive in-loop filtering for pictures other than intra pictures or pictures including intra slices.

[0652] When the adaptation parameter set type of a predetermined adaptation parameter set is a parameter for adaptive in-loop filtering (ALF type) and the adaptation parameter set identifier adaptation_parameter_set_id is equal to alf_aps_id_chroma or alf_aps_id_chroma[i] which is an identifier of an adaptation parameter set referenced in a current picture or a picture header, the temporal layer identifier of the predetermined adaptation parameter set may be less than or equal to the temporal layer identifier of the current picture.

[0653] As in Figures 20a to 20d In the example of , alf_luma_filter_signal_flag may represent a luma ALF signaling flag indicating whether the adaptive in-loop filter set for the luma component is included in the adaptive parameter set. In addition, alf_luma_filter_signal_flag may represent a luma ALF signaling flag indicating whether the adaptive in-loop filter set for the luma component is encoded / decoded.

[0654] For example, when alf_luma_filter_signal_flag has a first value (eg, 0), the adaptive in-loop filter set for the luma component may not be entropy encoded / decoded. When alf_luma_filter_signal_flag has a second value (eg, 1), the adaptive in-loop filter set for the luma component may be entropy encoded / decoded.

[0655] When alf_luma_filter_signal_flag is not present in the bitstream, alf_luma_filter_signal_flag may be inferred to be a first value (eg, 0).

[0656] In an embodiment, when the chroma component presence information encoded / decoded / acquired in the adaptive parameter set indicates that the information about the chroma component is not included in the adaptive parameter set, alf_luma_filter_signal_flag may not be included in the adaptive in-loop filter data and may be inferred to be a second value (e.g., 1). That is, alf_luma_filter_signal_flag may not be encoded / decoded in the adaptive in-loop filter data.

[0657] In addition, when the chroma component presence information indicates that information about the chroma component is included in the adaptive parameter set, alf_luma_filter_signal_flag may be included in the adaptive in-loop filter data. That is, alf_luma_filter_signal_flag may be encoded / decoded in the adaptive in-loop filter data.

[0658] When the adaptive parameter set type of the predetermined adaptive parameter set is a parameter (ALF type) for adaptive in-loop filtering and the adaptive parameter set identifier adaptation_parameter_set_id is equal to slice_alf_aps_id_luma[i], the luma ALF signaling flag alf_luma_filter_signal_flag may be determined to be a second value (e.g., 1). That is, when the parameter for adaptive in-loop filtering exists in the adaptive parameter set and the adaptive parameter set is referenced in the current picture or the current slice, since adaptive in-loop filter information for the luma component is signaled, the luma ALF signaling flag (alf_luma_filter_signal_flag) may have a second value (e.g., 1).

[0659] alf_chroma_filter_signal_flag may represent a chroma ALF signaling flag indicating whether an adaptive in-loop filter set for chroma components is included in an adaptation parameter set. In addition, alf_chroma_filter_signal_flag may represent a chroma ALF signaling flag indicating whether an adaptive in-loop filter set for chroma components is encoded / decoded.

[0660] For example, when alf_chroma_filter_signal_flag has a first value (eg, 0), the adaptive in-loop filter set for the chroma component may not be entropy encoded / decoded. In addition, when alf_chroma_filter_signal_flag has a second value (eg, 1), the adaptive in-loop filter set for the chroma component may be entropy encoded / decoded.

[0661] When alf_chroma_filter_signal_flag is not present in the bitstream, alf_chroma_filter_signal_flag may be inferred to be a first value (eg, 0).

[0662] When the adaptation parameter set type of the predetermined adaptation parameter set is a parameter for adaptive in-loop filtering (ALF type) and the adaptation parameter set identifier adaptation_parameter_set_id is equal to slice_alf_aps_id_chroma or slice_alf_aps_id_chroma[i], the chroma ALF signaling flag alf_chroma_filter_signal_flag may be determined to be a second value (e.g., 1). That is, when the parameter for adaptive in-loop filtering exists in the adaptation parameter set and the adaptation parameter set is referenced in the current picture or the current slice, since the adaptive in-loop filter information of the chroma component is signaled, the chroma ALF signaling flag alf_chroma_filter_signal_flag may have a second value (e.g., 1).

[0663] NumAlfFilters, which is the maximum value of the number of different adaptive in-loop filters included in the adaptive in-loop filter set, may be N. Here, N may be a positive integer and may be, for example, 25.

[0664] alf_luma_clip_flag may be a luma clipping flag, where the luma clipping flag indicates whether linear adaptive in-loop filtering or nonlinear adaptive in-loop filtering is performed on the luma component.

[0665] For example, when alf_luma_clip_flag has a first value (eg, 0), linear adaptive in-loop filtering may be performed on the luma component. In addition, when alf_luma_clip_flag has a second value (eg, 1), nonlinear adaptive in-loop filtering may be performed on the luma component.

[0666] When alf_luma_clip_flag is not present in the bitstream, alf_luma_clip_flag may be inferred to be a first value (eg, 0).

[0667] alf_luma_num_filters_signalled_minus1 may represent luma signaling ALF number information indicating the number of signaled luma ALFs. In addition, a value of alf_luma_num_filters_signalled_minus1+1 may represent the number of luma signaling ALFs.

[0668] alf_luma_num_filters_signalled_minus1 may have a value from 0 to NumAlfFilters-N. Here, N may be a positive integer, and may be 1, for example.

[0669] When alf_luma_num_filters_signalled_minus1 is not present in the bitstream, alf_luma_num_filters_signalled_minus1 may be inferred to have the value 0.

[0670] alf_luma_coeff_delta_idx[filtIdx] may indicate the index of the luma signaling adaptive in-loop filter referenced by the luma adaptive in-loop filter corresponding to filtIdx. alf_luma_coeff_delta_idx[filtIdx] may represent the luma ALF delta index. The luma ALF delta index may represent the filter coefficient difference index for the luma component.

[0671] filtIdx may have a value from 0 to NumAlfFilters - N. Here, N may be a positive integer and may be 1, for example.

[0672] When alf_luma_coeff_delta_idx[filtIdx] is not present in the bitstream, alf_luma_coeff_delta_idx[filtIdx] may be inferred to have a value of 0.

[0673] alf_luma_use_fixed_filter_flag may indicate whether a fixed filter is used when adaptive in-loop filter coefficients are signaled.

[0674] For example, when alf_luma_use_fixed_filter_flag has a first value (eg, 0), a fixed filter may not be used when adaptive in-loop filter coefficients are signaled. In addition, when alf_luma_use_fixed_filter_flag has a second value (eg, 1), a fixed filter may be used when adaptive in-loop filter coefficients are signaled.

[0675] When alf_luma_use_fixed_filter_flag is not present in the bitstream, alf_luma_use_fixed_filter_flag may be inferred to be a first value (eg, 0).

[0676] alf_luma_fixed_filter_set_idx may represent the fixed filter set index.

[0677] alf_luma_fixed_filter_set_idx may have a value from 0 to N. Here, N may be a positive integer and may be 15, for example.

[0678] When alf_luma_fixed_filter_set_idx is not present in the bitstream, alf_luma_fixed_filter_set_idx may be inferred to have a value of 0.

[0679] alf_luma_fixed_filter_pred_present_flag may indicate whether alf_luma_fixed_filter_pred_flag[i] is present in the bitstream.

[0680] For example, when alf_luma_fixed_filter_pred_present_flag has a first value (eg, 0), alf_luma_fixed_filter_pred_flag[i] may not be present in the bitstream. In addition, when alf_luma_fixed_filter_pred_present_flag has a second value (eg, 1), alf_luma_fixed_filter_pred_flag[i] may be present in the bitstream.

[0681] In addition, alf_luma_fixed_filter_pred_present_flag may indicate whether all adaptive in-loop filter coefficient categories (types) for luma components are predicted from fixed filters and signaled. For example, when alf_luma_fixed_filter_pred_present_flag has a first value (e.g., 0), all adaptive in-loop filter coefficient categories (types) for luma components may not be predicted from fixed filters and signaled. When alf_luma_fixed_filter_pred_present_flag has a second value (e.g., 1), at least one adaptive in-loop filter coefficient category (type) among the adaptive in-loop filter coefficient categories (types) for luma components may be predicted from fixed filters and signaled.

[0682] When alf_luma_fixed_filter_pred_present_flag is not present in the bitstream, alf_luma_fixed_filter_pred_present_flag may be inferred to be a first value (eg, 0).

[0683] alf_luma_fixed_filter_pred_flag[i] may indicate whether the i-th adaptive in-loop filter coefficient category (type) is predicted from a fixed filter and signaled.

[0684] For example, when alf_luma_fixed_filter_pred_flag[i] has a first value (e.g., 0), the i-th adaptive in-loop filter coefficient category (type) may not be predicted from the fixed filter. In addition, when alf_luma_fixed_filter_pred_flag[i] has a second value (e.g., 1), the i-th adaptive in-loop filter coefficient category (type) may be predicted from the fixed filter.

[0685] When alf_luma_fixed_filter_pred_flag[i] is not present in the bitstream, alf_luma_fixed_filter_pred_flag[i] may be inferred to be a second value (eg, 1).

[0686] According to an embodiment, Figures 20a to 20d Different, the adaptive loop filter data syntax may not include information about the fixed filter (alf_luma_use_fixed_filter_flag, alf_luma_fixed_filter_set_idx, alf_luma_fixed_filter_pred_present_flag, and alf_luma_fixed_filter_pred_flag). Therefore, information about the fixed filter may not be sent by signal. Therefore, in the encoder / decoder, a predetermined fixed filter may be used in the adaptive loop filtering. In addition, the filter coefficients may not be predicted from the fixed filter and sent by signal. In the encoder / decoder, only the predetermined fixed filter may be used in the adaptive loop filtering, and the filter coefficients predicted from the fixed filter may not be used in the adaptive loop filtering.

[0687] alf_luma_coeff_delta_flag may indicate whether alf_luma_coeff_delta_prediction_flag is signaled.

[0688] For example, when alf_luma_coeff_delta_flag has a first value (eg, 0), alf_luma_coeff_delta_prediction_flag may be signaled, and when alf_luma_coeff_delta_flag has a second value (eg, 1), alf_luma_coeff_delta_prediction_flag may not be signaled.

[0689] When alf_luma_coeff_delta_flag is not present in the bitstream, alf_luma_coeff_delta_flag may be inferred to be a second value (eg, 1).

[0690] alf_luma_coeff_delta_prediction_flag may indicate whether the signaled adaptive in-loop filter coefficients for the luma component are predicted from previously signaled adaptive in-loop filter coefficients for the luma component.

[0691] For example, when alf_luma_coeff_delta_prediction_flag has a first value (e.g., 0), the adaptive in-loop filter coefficient for the luma component sent by the signal may not be predicted from the adaptive in-loop filter coefficient for the luma component sent by the signal. In addition, when alf_luma_coeff_delta_prediction_flag has a second value (e.g., 1), the adaptive in-loop filter coefficient for the luma component sent by the signal may be predicted from the adaptive in-loop filter coefficient for the luma component sent by the signal.

[0692] When alf_luma_coeff_delta_prediction_flag is not present in the bitstream, alf_luma_coeff_delta_prediction_flag may be inferred to be a first value (eg, 0).

[0693] The value of alf_luma_min_eg_order_minus1+1 may represent the minimum order of the exponential Golomb code used when the adaptive in-loop filter coefficients for the luma component are signaled.

[0694] alf_luma_eg_order_increase_flag[i] may indicate that the order of the exponential Golomb code used when the adaptive in-loop filter coefficients for the luma component are signaled is increased by 1.

[0695] The order expGoOrderY[i] of the exponential Golomb code used for entropy encoding / decoding the value of alf_luma_coeff_delta_abs[sfIdx][j] may be derived as follows.

[0696] expGoOrderY[i]=(i==0?alf_luma_min_eg_order_minus1+1:expGoOrderY[i-1])+alf_luma_eg_order_increase_flag[i]

[0697] alf_luma_coeff_flag[sfIdx] may indicate whether an adaptive in-loop filter for a luma component indicated by sfIdx is signaled.

[0698] For example, when alf_luma_coeff_flag[sfIdx] has a first value (eg, 0), the adaptive in-loop filter for the luma component indicated by sfIdx may be set to a value of 0. Also, when alf_luma_coeff_flag[sfIdx] has a second value (eg, 1), the adaptive in-loop filter for the luma component indicated by sfIdx may be signaled.

[0699] When alf_luma_coeff_flag[sfIdx] is not present in the bitstream, alf_luma_coeff_flag[sfIdx] may be inferred to be a second value (eg, 1).

[0700] According to an embodiment, Figures 20a to 20d Differently, alf_luma_coeff_flag[sfIdx] may not be included in the adaptive in-loop filter data syntax. That is, alf_luma_coeff_flag[sfIdx] may not be encoded / decoded in the adaptive in-loop filter data syntax. Therefore, it can be determined that the coefficient information of the adaptive in-loop filter is encoded / decoded / acquired without encoding / decoding / acquiring alf_luma_coeff_flag[sfIdx].

[0701] alf_luma_coeff_delta_abs[sfIdx][j] may represent an absolute value of a j-th coefficient difference (delta) of the adaptive in-loop filter for the luma component indicated by sfIdx.

[0702] When alf_luma_coeff_delta_abs[sfIdx][j] is not present in the bitstream, alf_luma_coeff_delta_abs[sfIdx][j] may be inferred to have the value 0.

[0703] The order k of the exponential Golomb code (binarization) uek(v) can be derived as follows.

[0704] golombOrderIdxY[]={0,0,1,0,0,1,2,1,0,0,1,2}

[0705] k=expGoOrderY[golombOrderIdxY[j]]

[0706] According to an embodiment, the order k of the exponential Golomb code uek(v) used for entropy encoding / decoding / binarization of alf_luma_coeff_delta_abs[sfIdx][j] may be fixed to 0. Therefore, for entropy encoding / decoding / binarization of alf_luma_coeff_delta_abs[sfIdx][j], the 0-order exponential Golomb code ue(v) is available. The value of alf_luma_coeff_delta_abs[sfIdx][j] may be a positive integer including 0 and may have a value in the range from 0 to 128.

[0707] alf_luma_coeff_delta_sign[sfIdx][j] may represent the sign of the j-th coefficient or coefficient difference of the adaptive in-loop filter for the luma component indicated by sfIdx. In addition, alf_luma_coeff_delta_sign[sfIdx][j] may be derived as follows.

[0708] When alf_luma_coeff_delta_sign[sfIdx][j] has a first value (eg, 0), the adaptive filter coefficient or coefficient difference for the corresponding luma component may have a positive sign.

[0709] When alf_luma_coeff_delta_sign[sfIdx][j] has a second value (eg, 1), the adaptive filter coefficient or coefficient difference for the corresponding luma component may have a negative sign.

[0710] When alf_luma_coeff_delta_sign[sfIdx][j] is not present in the bitstream, alf_luma_coeff_delta_sign[sfIdx][j] may be inferred to be a first value (eg, 0).

[0711] According to an embodiment, the value of the filter coefficient can be directly sent with a signal instead of the coefficient difference of the adaptive loop filter. For example, the sign information and absolute value information of the filter coefficient can be included in the adaptive loop filter data syntax. That is to say, the sign information and absolute value information of the filter coefficient can be encoded / decoded in the adaptive loop filter data syntax. For the encoding / decoding of the absolute value information of the filter coefficient, the 0th order exponential Golomb code ue(v) can be used. The value of the absolute value information of the filter coefficient can be a positive integer including 0, and can have a value in the range of from 0 to 128. The filter coefficient of the adaptive loop filter may include at least one of the filter coefficient of the adaptive loop filter for the luminance component or the filter coefficient of the adaptive loop filter for the chrominance component.

[0712] filtCoeff[sfIdx][j] as the luma signaling ALF may be derived as follows: At this time, sfIdx may have a value from 0 to alf_luma_num_filters_signalled_minus1. Also, j may have a value from 0 to N. Here, N may be a positive integer, and may be 11, for example.

[0713] filtCoeff[sfIdx][j]=alf_luma_coeff_delta_abs[sfIdx][j]*(1-2*alf_luma_coeff_delta_sign[sfIdx][j])

[0714] When alf_luma_coeff_delta_prediction_flag has a first value (eg, 1), filtCoeff[sfIdx][j] may be derived as follows: At this time, sfIdx may have a value from 1 to alf_luma_num_filters_signalled_minus1. In addition, j may have a value from 0 to N. Here, N may be a positive integer, and may be, for example, 11.

[0715] filtCoeff[sfIdx][j]+=filtCoeff[sfIdx-1][j]

[0716] According to an embodiment, Figures 20a to 20dDifferently, alf_luma_coeff_delta_prediction_flag may not be included in the adaptive in-loop filter data syntax. That is, alf_luma_coeff_delta_prediction_flag may not be encoded / decoded in the adaptive in-loop filter data syntax. Therefore, the luminance component filter coefficient difference value of the adaptive in-loop filter may be directly signaled without being predictively encoded / decoded.

[0717] The adaptive in-loop filter coefficient AlfCoeffL[adaptation_parameter_set_id][filtIdx][j] for the luma component may be derived as follows: At this time, filtIdx may have a value from 0 to NumAlfFilters-1. In addition, j may have a value from 0 to N. Here, N may be a positive integer, and may be, for example, 11.

[0718] AlfCoeffL[adaptation_parameter_set_id][filtIdx][j]=filtCoeff[alf_luma_coeff_delta_idx[filtIdx]][j]

[0719] When alf_luma_use_fixed_filter_flag has a second value (e.g., 1) and alf_luma_fixed_filter_pred_flag[filtIdx] has a second value (e.g., 1), AlfCoeffL[adaptation_parameter_set_id][filtIdx][j] may be derived as in the following example. At this time, filtIdx may have a value from 0 to NumAlfFilters-1. In addition, j may have a value from 0 to N. Here, N may be a positive integer and may be, for example, 11.

[0720] Alf Coeff L [adaptation_parameter_set_id][filtIdx][j]+=

[0721] AlfFixFiltCoeff[AlfClassToFiltMap[alf_luma_fixed_filter_set_idx][filtIdx]][j]

[0722] As in Fig.22a and Figure 22bIn the example of , the fixed filter coefficient AlfFixFiltCoeff[i][j] is derived. At this time, i can have a value from 0 to imax. In addition, j can have a value from 0 to N. Here, imax can be a positive integer, and can be, for example, 64. Here, N can be a positive integer, and can be, for example, 11.

[0723] As in Fig.23 In the example of , the mapping relationship between the adaptive in-loop filter coefficient class and the filter AlfClassToFiltMap[m][n] is derived. At this time, m can have a value from 0 to mmax. In addition, n can have a value from 0 to nmax. Here, mmax can be a positive integer and can be, for example, 15. Here, nmax can be a positive integer and can be, for example, 24.

[0724] AlfCoeffL[adaptation_parameter_set_id][filtIdx][j] can have values ​​from -2 M to 2 M In this case, filtIdx may have a value from 0 to NumAlfFilters-1. In addition, j may have a value from 0 to N. Here, N may be a positive integer, and may be, for example, 11. In this case, M may be a positive integer, and may be, for example, 7.

[0725] The value of alf_luma_clip_min_eg_order_minus1+1 may represent the minimum order of the exponential Golomb code used when the adaptive in-loop filter clipping index for the luma component is signaled. In the case of a non-linear adaptive in-loop filter, the clipping index may be signaled or used.

[0726] alf_luma_clip_eg_order_increase_flag[i] may indicate whether the order of the exponential Golomb code used when the adaptive in-loop filter clipping index for the luma component is signaled is increased by 1.

[0727] The order kClipY[i] of the exponential Golomb code used for entropy encoding / decoding alf_luma_clip_idx[sfIdx][j] may be derived as follows.

[0728] kClipY[i]=(i==0?alf_luma_clip_min_eg_order_minus1+1:kClipY[i-1])+alf_luma_clip_eg_order_increase_flag[i]

[0729] alf_luma_clip_idx[sfIdx][j] may represent a luma clipping index for a clipping value for clipping before multiplying the j-th coefficient of the adaptive in-loop filter for the luma component indicated by sfIdx by the reconstructed / decoded sample. The clipping value may be determined by the luma clipping index indicated by alf_luma_clip_idx[sfIdx][j] and the bit depth of the image. Here, the bit depth may represent a bit depth determined in at least one of a sequence, a picture, a slice, a tile group, a tile, or a CTU unit.

[0730] When alf_luma_clip_idx[sfIdx][j] is not present in the bitstream, alf_luma_clip_idx[sfIdx][j] may be inferred to be a first value (eg, 0).

[0731] alf_luma_clip_idx[sfIdx][j] may have a value from 0 to M. Here, M may be a positive integer, and may be, for example, 3. At this time, sfIdx may have a value from 0 to alf_luma_num_filters_signalled_minus1. In addition, j may have a value from 0 to N. Here, N may be a positive integer, and may be, for example, 11.

[0732] The order k of the exponential Golomb code (binarization) uek(v) can be derived as follows.

[0733] k=kClipY[golombOrderIdxY[j]]

[0734] filterClips[sfIdx][j] may be derived as follows: At this time, sfIdx may have a value from 0 to alf_luma_num_filters_signalled_minus1. In addition, j may have a value from 0 to N. Here, N may be a positive integer, and may be 11, for example.

[0735] filterClips[sfIdx][j]=Round(2(BitDepthY*(M+1-alf_luma_clip_idx[sfIdx][j]) / (M+1)) or filterClips[sfIdx][j]=Round(2(BitDepthY-8)*2(8*(M-alf_luma_clip_idx[sfIdx][j]) / M))

[0736] Here, BitDepthY may represent an input bit depth / depth for a luma component. Here, the bit depth may represent a bit depth determined in at least one of a sequence, a picture, a slice, a tile group, a tile, or a CTU unit.

[0737] Here, M may be a positive integer, and may be, for example, 3. Also, M may represent a maximum value of alf_luma_clip_idx[sfIdx][j].

[0738] The adaptive in-loop filter clipping value AlfClipL[adaptation_parameter_set_id][filtIdx][j] for the luma component may be derived as follows: At this time, filtIdx may have a value from 0 to NumAlfFilters-1. In addition, j may have a value from 0 to N. Here, N may be a positive integer, and may be, for example, 11.

[0739] AlfClipL[adaptation_parameter_set_id][filtIdx][j]=filterClips[alf_luma_coeff_delta_idx[filtIdx]][j]

[0740] If the range of values ​​of the exponential Golomb code used in alf_luma_clip_idx[sfIdx][j] is large, the exponential Golomb code used in alf_luma_clip_idx[sfIdx][j] can be efficiently entropy encoded / decoded. However, as in the above example, when the range of values ​​of alf_luma_clip_idx[sfIdx][j] (from 0 to 3) is relatively small, the exponential Golomb code used in alf_luma_clip_idx[sfIdx][j] may be inefficient in entropy encoding / decoding.

[0741] Therefore, as an alternative to using at least one of alf_luma_clip_min_eg_order_minus1 or alf_luma_clip_eg_order_increase_flag[i], if the range of values ​​of alf_luma_clip_idx[sfIdx][j] (from 0 to 3) is relatively small, alf_luma_clip_idx[sfIdx][j] may be entropy encoded / decoded using at least one of the entropy encoding / decoding methods of tu(3), f(2), u(2), or tb(3).

[0742] alf_chroma_clip_flag may be a chroma clipping flag indicating whether linear adaptive in-loop filtering or nonlinear adaptive in-loop filtering is performed for the chroma component. That is, alf_chroma_clip_flag is not signaled and applied for each chroma ALF that is signaled, but may be signaled and applied only once for all chroma ALFs that are signaled. At this time, the chroma ALF may represent an adaptive in-loop filter for the chroma component.

[0743] For example, when alf_chroma_clip_flag has a first value (eg, 0), linear adaptive in-loop filtering may be performed on the chroma component. In addition, when alf_chroma_clip_flag has a second value (eg, 1), nonlinear adaptive in-loop filtering may be performed on the chroma component.

[0744] When alf_chroma_clip_flag is not present in the bitstream, alf_chroma_clip_flag may be inferred to be a first value (eg, 0).

[0745] The value of alf_chroma_min_eg_order_minus1+1 may represent the minimum order of the exponential Golomb code used when adaptive in-loop filter coefficients for chroma components are signaled.

[0746] alf_chroma_eg_order_increase_flag[i] may indicate whether the order of the exponential Golomb code used when the adaptive in-loop filter coefficients for the chroma component are signaled is increased by 1.

[0747] The order expGoOrderC[i] of the exponential Golomb code used for entropy encoding / decoding the value of alf_chroma_coeff_abs[j] may be derived as follows.

[0748] expGoOrderC[i]=(i==0?alf_chroma_min_eg_order_minus1+1:expGoOrderC[i-1])+alf_chroma_eg_order_increase_flag[i]

[0749] alf_chroma_coeff_abs[j] may represent the absolute value of the j-th coefficient of the adaptive in-loop filter for the chroma component.

[0750] When alf_chroma_coeff_abs[j] is not present in the bitstream, alf_chroma_coeff_abs[j] may be inferred to have the value 0.

[0751] alf_chroma_coeff_abs[j] can have a value from 0 to 2. M At this time, M may be a positive integer, and may be, for example, 7.

[0752] The order k of the exponential Golomb code (binarization) uek(v) can be derived as follows.

[0753] golombOrderIdxC[]={0,0,1,0,0,1}

[0754] k=expGoOrderC[golombOrderIdxC[j]]

[0755] According to an embodiment, the order k of the exponential Golomb code uek(v) used for entropy encoding / decoding / binarization of alf_chroma_coeff_abs[j] may be fixed to 0. Therefore, the 0-order exponential Golomb code ue(v) may be used for entropy encoding / decoding / binarization of alf_chroma_coeff_abs[j]. The value of alf_chroma_coeff_abs[j] may be a positive integer including 0 and may have a value in the range from 0 to 128.

[0756] alf_chroma_coeff_sign[j] may represent the sign of the j-th coefficient or coefficient difference of the adaptive in-loop filter for the chroma component. In addition, alf_chroma_coeff_sign[j] may be derived as follows.

[0757] When alf_chroma_coeff_sign[j] has a first value (eg, 0), the adaptive in-loop filter coefficient or coefficient difference for the corresponding chroma component may have a positive sign.

[0758] When alf_chroma_coeff_sign[j] has a second value (eg, 1), the adaptive in-loop filter coefficient or coefficient difference for the corresponding chroma component may have a negative sign.

[0759] When alf_chroma_coeff_sign[j] is not present in the bitstream, alf_chroma_coeff_sign[j] may be inferred to be a first value (eg, 0).

[0760] An adaptive in-loop filter for a chroma component coefficient (chroma signaling ALF) AlfCoeffC[adaptation_parameter_set_id][j] may be derived as follows: At this time, j may have a value from 0 to N. Here, N may be a positive integer, and may be 5, for example.

[0761] AlfCoeffC[adaptation_parameter_set_id][j]=alf_chroma_coeff_abs[j]*(1-2*alf_chroma_coeff_sign[j])

[0762] AlfCoeffC[adaptation_parameter_set_id][j] can have values ​​from -2 M -1 to 2 M At this time, j may have a value from 0 to N. Here, N may be a positive integer, and may be, for example, 5. At this time, M may be a positive integer, and may be, for example, 7. Optionally, AlfCoeffC[adaptation_parameter_set_id][j] may have a value from -2^M to 2^M-1.

[0763] The value of alf_chroma_clip_min_eg_order_minus1+1 may represent the minimum order of the exponential Golomb code used when the adaptive in-loop filter clipping index for the chroma component is signaled. In the case of a non-linear adaptive in-loop filter, the clipping index may be signaled or used.

[0764] alf_chroma_clip_eg_order_increase_flag[i] may indicate whether the order of the exponential Golomb code used when the adaptive in-loop filter clipping index for the chroma component is signaled is increased by 1.

[0765] The order kClipC[i] of the exponential Golomb code used for entropy encoding / decoding alf_chroma_clip_idx[j] may be derived as follows.

[0766] kClipC[i]=(i==0?alf_chroma_clip_min_eg_order_minus1+1:kClipC[i-1])+alf_chroma_clip_eg_order_increase_flag[i]

[0767] alf_chroma_clip_idx[j] may represent a chroma clipping index for a clipping value for clipping before multiplying the j-th coefficient of the adaptive in-loop filter for the chroma component by the reconstructed / decoded sample. The clipping value may be determined by the chroma clipping index indicated by alf_chroma_clip_idx[j] and the bit depth of the image. Here, the bit depth may represent a bit depth determined in at least one of a sequence, a picture, a slice, a tile group, a tile, or a CTU unit.

[0768] When alf_chroma_clip_idx[j] is not present in the bitstream, alf_chroma_clip_idx[j] may be inferred to be a first value (eg, 0).

[0769] alf_chroma_clip_idx[j] may have a value from 0 to M. Here, M may be a positive integer, and may be, for example, 3. At this time, j may have a value from 0 to N. Here, N may be a positive integer, and may be, for example, 5.

[0770] The order k of the exponential Golomb code (binarization) uek(v) can be derived as follows.

[0771] k=kClipC[golombOrderIdxC[j]]

[0772] According to an embodiment, the clipping value indicated by the clipping index of the chroma component may be determined using the same method as the clipping value indicated by the clipping index of the luma component. That is, the clipping value for the chroma component and the clipping value for the luma component may be determined using the same method based on at least one of the clipping index or the bit depth. For example, it may be determined that the clipping value when the clipping index of the chroma component is 3 is the same as the clipping value when the clipping index of the luma component is 3. Therefore, when the clipping index and the bit depth are the same, the clipping process for the luma component samples and the clipping process for the chroma component samples may be performed according to the same clipping value.

[0773] In addition, the clipping value may be set based on the bit depth. For example, the clipping value may be set to a value of 2<<(BitDepth-N). Here, N may be a positive integer including 0. N may be determined according to the clipping index value. As the clipping index increases, N may increase. Here, BitDepth may represent the bit depth.

[0774] The adaptive in-loop filter clipping value AlfClipC[adaptation_parameter_set_id][j] for the chroma component may be derived as follows: At this time, j may have a value from 0 to N. Here, N may be a positive integer, and may be 5, for example.

[0775] AlfClipC[adaptation_parameter_set_id][j]=Round(2 (BitDepthC-8) *2 (8 *(M-alf_chroma_clip_idx[j]) / M) ) or AlfClipC[adaptation_parameter_set_id][j]=Round(2 (BitDepthC*(M+1-alf_chroma_clip_idx[j]) / (M+1) )

[0776] Here, BitDepthC may represent an input bit depth / depth for a chroma component. Here, the bit depth may represent a bit depth determined in at least one of a sequence, a picture, a slice, a tile group, a tile, or a CTU unit.

[0777] Here, M may be a positive integer, and may be, for example, 3. Also, M may represent a maximum value of alf_chroma_clip_idx[j].

[0778] If the range of the value of the exponential Golomb code used in alf_chroma_clip_idx[j] is large, the exponential Golomb code used in alf_chroma_clip_idx[j] can be efficiently entropy encoded / decoded. However, as in the above example, when the range of the value of alf_chroma_clip_idx[j] (from 0 to 3) is relatively small, the exponential Golomb code used in alf_chroma_clip_idx[j] may be inefficient in entropy encoding / decoding.

[0779] Therefore, as an alternative to using at least one of the syntax elements alf_chroma_clip_min_eg_order_minus1 or alf_chroma_clip_eg_order_increase_flag[i], if the range of values ​​of alf_chroma_clip_idx[j] (from 0 to 3) is relatively small, alf_chroma_clip_idx[j] may be entropy encoded / decoded using at least one of the entropy encoding / decoding methods of tu(3), f(2), u(2), or tb(3).

[0780] As in Fig.21 In the example of , alf_ctb_flag[cIdx][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may indicate whether adaptive in-loop filtering is used in the color component (Y, Cb, or Cr) coding tree block indicated by cIdx at the luma component position (xCtb, yCtb).

[0781] For example, alf_ctb_flag[0][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be a first ALF coding tree block flag indicating whether adaptive in-loop filtering is applied to luma samples of a current coding tree block. When alf_ctb_flag[0][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] has a first value (e.g., 0), adaptive in-loop filtering may not be used in the luma component coding tree block at the luma component position (xCtb, yCtb). In addition, when alf_ctb_flag[0][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] has a second value (e.g., 1), adaptive in-loop filtering may be used in the luma component coding tree block at the luma component position (xCtb, yCtb).

[0782] When alf_ctb_flag[0][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] is not present in the bitstream, alf_ctb_flag[0][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be inferred to be a first value (eg, 0).

[0783] For example, alf_ctb_flag[1][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be a second ALF coding tree block flag indicating whether adaptive in-loop filtering is applied to the Cb samples of the current coding tree block. When alf_ctb_flag[1][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] has a first value (e.g., 0), adaptive in-loop filtering may not be used in the Cb component coding tree block at the luma component position (xCtb, yCtb). In addition, when alf_ctb_flag[1][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] has a second value (e.g., 1), adaptive in-loop filtering may be used in the Cb component coding tree block at the luma component position (xCtb, yCtb).

[0784] When alf_ctb_flag[1][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] is not present in the bitstream, alf_ctb_flag[1][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be inferred to be a first value (eg, 0).

[0785] For example, alf_ctb_flag[2][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be a third ALF coding tree block flag indicating whether adaptive in-loop filtering is applied to Cr samples of the current coding tree block. When alf_ctb_flag[2][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] has a first value (e.g., 0), adaptive in-loop filtering may not be used in the Cr coding tree block at the luma component position (xCtb, yCtb). In addition, when alf_ctb_flag[2][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] has a second value (e.g., 1), adaptive in-loop filtering may be used in the Cr coding tree block at the luma component position (xCtb, yCtb).

[0786] When alf_ctb_flag[2][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] is not present in the bitstream, alf_ctb_flag[2][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be inferred to be a first value (eg, 0).

[0787] alf_ctb_use_first_aps_flag may indicate whether adaptive in-loop filter information in an adaptation parameter set indicated by adaptation_parameter_set_id having the same value as slice_alf_aps_id_luma[0] is used.

[0788] For example, when alf_ctb_use_first_aps_flag has a first value (e.g., 0), the adaptive in-loop filter information in the adaptation parameter set indicated by the adaptation_parameter_set_id having the same value as slice_alf_aps_id_luma[0] may not be used. In addition, when alf_ctb_use_first_aps_flag has a second value (e.g., 1), the adaptive in-loop filter information in the adaptation parameter set indicated by the adaptation_parameter_set_id having the same value as slice_alf_aps_id_luma[0] may be used.

[0789] When alf_ctb_use_first_aps_flag is not present in the bitstream, alf_ctb_use_first_aps_flag may be inferred to be a first value (eg, 0).

[0790] According to an embodiment, Fig.21 Unlike the example of , alf_ctb_use_first_aps_flag may not be included in the adaptive in-loop filter data syntax. That is, alf_ctb_use_first_aps_flag may not be encoded / decoded in the adaptive in-loop filter data syntax. Therefore, without encoding / decoding / obtaining alf_ctb_use_first_aps_flag, alf_luma_prev_filter_idx may be used to determine the adaptive in-loop filter set applied to the current luma coding tree block.

[0791] alf_use_aps_flag may represent an adaptation parameter set application flag indicating whether an ALF set of an adaptation parameter set is applied to a current coding tree block.

[0792] For example, when alf_use_aps_flag has a first value (e.g., 0), at least one fixed filter in the fixed filters may be used in the luma component coding tree block. That is, at least one fixed filter in the fixed ALF set may be used in the current coding tree block. In addition, when alf_use_aps_flag has a second value (e.g., 1), adaptive in-loop filter information in at least one adaptive parameter set may be used in the luma component coding tree block.

[0793] When alf_use_aps_flag is not present in the bitstream, alf_use_aps_flag may be inferred to be a first value (eg, 0).

[0794] The value of alf_luma_prev_filter_idx_minus1 may represent an index indicating which adaptive in-loop filter information among adaptive parameter sets used in at least one picture / sub-picture / slice / tile group / partition of a previous picture is used.

[0795] alf_luma_prev_filter_idx_minus1 may have a value from 0 to slice_num_alf_aps_ids_luma-N. Here, N may be a positive integer and may be, for example, 1. Fig.21, since alf_ctb_use_first_aps_flag indicates whether the index value of the adaptive in-loop filter applied to the current coding tree block is 1, alf_luma_prev_filter_idx_minus1 indicates one of the at least two adaptive in-loop filters with an index value of 2 or more. Therefore, N may be determined to be 2. Therefore, when slice_num_alf_aps_ids_luma is 2 and the number of adaptive in-loop filters with an index value of 2 or more is 1, alf_luma_prev_filter_idx_minus1 may not be signaled.

[0796] When alf_luma_prev_filter_idx_minus1 is not present in the bitstream, alf_luma_prev_filter_idx_minus1 may be inferred to have the value 0.

[0797] According to an embodiment, Fig.21 Unlike the example of , when alf_ctb_use_first_aps_flag is not included in the syntax structure of the coding tree block, alf_luma_prev_filter_idx may be included in the syntax structure of the coding tree block as a substitute for alf_luma_prev_filter_idx_minus1. That is, alf_luma_prev_filter_idx may be encoded / decoded in the syntax structure of the coding tree block. alf_luma_prev_filter_idx may represent an index indicating which adaptive in-loop filter information in an adaptive parameter set used in at least one picture / sub-picture / slice / parallel block group / block in a previous picture / sub-picture / slice / parallel block group / block is used.

[0798] alf_luma_prev_filter_idx may have a value from 0 to slice_num_alf_aps_ids_luma-N. Here, N may be a positive integer and may be, for example, 1. When alf_ctb_use_first_aps_flag is not included in the syntax structure of the coding tree block, alf_luma_prev_filter_idx indicates one of at least two adaptive in-loop filters regardless of the index value. Therefore, N may be determined to be 1. Therefore, when slice_num_alf_aps_ids_luma is 1, since the total number of adaptive in-loop filters is 1, alf_luma_prev_filter_idx_minus1 may not be signaled.

[0799] When at least one of a case where alf_use_aps_flag has the second value (eg, 1) or a case where slice_num_alf_aps_ids_luma is 2 or more is satisfied, alf_luma_prev_filter_idx may be encoded / decoded.

[0800] When alf_luma_prev_filter_idx is not present in the bitstream, alf_luma_prev_filter_idx may be inferred to have a value of 0.

[0801] The adaptive in-loop filter index AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] used in the luma component coding tree block at the luma component position (xCtb, yCtb) may be derived as follows.

[0802] When alf_ctb_use_first_aps_flag has a second value (eg, 1), AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be determined as a value F. In addition, F may represent the maximum number of fixed filters used in the encoder / decoder. That is, F may be the value of the maximum value of alf_luma_fixed_filter_idx+1.

[0803] When alf_ctb_use_first_aps_flag has a first value (eg, 0) and alf_use_aps_flag has a first value (eg, 0), AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be determined as alf_luma_fixed_filter_idx.

[0804] In other cases, when (alf_ctb_use_first_aps_flag has the first value (eg, 0) and alf_use_aps_flag has the second value (eg, 1)), AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be determined as 17+alf_luma_prev_filter_idx_minus1.

[0805] Alternatively, an adaptive in-loop filter index AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] used in a luma component coding tree block at a luma component position (xCtb, yCtb) may be derived as follows.

[0806] When alf_use_aps_flag has the first value (eg, 0), AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be determined as alf_luma_fixed_filter_idx.

[0807] If not (when alf_use_aps_flag has the second value (e.g., 1)), AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] may be determined as F+alf_luma_prev_filter_idx. Here, F may be a positive integer and may be 16. In addition, F may represent the maximum number of fixed filters used in the encoder / decoder. That is, F may be the value of the maximum value of alf_luma_fixed_filter_idx+1.

[0808] alf_luma_fixed_filter_idx may represent a fixed filter index used in the luma component coding tree block. That is, when at least one fixed filter in the fixed ALF set is used in the current coding tree block, a fixed filter may be selected from the fixed ALF set using alf_luma_fixed_filter_idx.

[0809] alf_luma_fixed_filter_idx may have a value from 0 to N. Here, N may be a positive integer, and may be 15, for example.

[0810] When alf_luma_fixed_filter_idx is not present in the bitstream, alf_luma_fixed_filter_idx may be inferred to have a value of 0.

[0811] Fig.21The syntax structure of the coding tree block may further include chroma adaptive in-loop filter index information alf_ctb_filter_alt_idx, wherein the chroma adaptive in-loop filter index information alf_ctb_filter_alt_idx indicates one adaptive in-loop filter among a plurality of adaptive in-loop filters included in the adaptive parameter set. When the chroma ALF quantity information is a positive integer greater than 1, the chroma adaptive in-loop filter index information may be sent by a signal.

[0812] For example, when alf_ctb_flag[1][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] indicates that a Cb adaptive in-loop filter is used in a current coding tree block and two or more Cb adaptive in-loop filters are included in an adaptive parameter set, Cb adaptive in-loop filter index information alf_ctb_filter_alt_idx indicating the Cb adaptive in-loop filter used in the current coding tree block may be included in the syntax structure of the coding tree block. That is, Cb adaptive in-loop filter index information alf_ctb_filter_alt_idx indicating the Cb adaptive in-loop filter used in the current coding tree block may be encoded / decoded in the syntax structure of the coding tree block.

[0813] In addition, when alf_ctb_flag[2][xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] indicates that a Cr adaptive in-loop filter is used in a current coding tree block and two or more Cr adaptive in-loop filters are included in an adaptive parameter set, Cr adaptive in-loop filter index information alf_ctb_filter_alt_idx indicating the Cr adaptive in-loop filter used in the current coding tree block may be included in the syntax structure of the coding tree block. That is, the Cr adaptive in-loop filter index information alf_ctb_filter_alt_idx indicating the Cr adaptive in-loop filter used in the current coding tree block may be encoded / decoded in the syntax structure of the coding tree block.

[0814] The Cb adaptive in-loop filter index information and the Cr adaptive in-loop filter index information may be signaled for each chroma component and may indicate different filter indexes or the same filter index.

[0815] In the following, one embodiment of an adaptive in-loop filtering process will be described. In the following, reconstruction may mean decoding.

[0816] The luma component picture sample array recPictureL reconstructed before adaptive in-loop filtering is performed may be input. In addition, when ChromaArrayType does not have the first value (eg, 0), the chroma component picture sample arrays recPictureCb and recPictureCr reconstructed before adaptive in-loop filtering is performed may be input.

[0817] In addition, the luminance component picture sample array alfPictureL changed and reconstructed after the adaptive in-loop filtering is performed may be output according to the adaptive in-loop filtering process. In addition, when ChromaArrayType does not have a first value (e.g., 0), the chrominance component picture sample arrays alfPictureCb and alfPictureCr reconstructed before the adaptive in-loop filter is performed may be output.

[0818] The luma component picture sample array alfPictureL changed and reconstructed after performing the adaptive in-loop filtering may be initialized to the luma component picture sample array recPictureL reconstructed before performing the adaptive in-loop filtering.

[0819] When ChromaArrayType does not have the first value (eg, 0), picture sample arrays alfPictureCb and alfPictureCr reconstructed before adaptive in-loop filtering is performed may be initialized to picture sample arrays recPictureCb and recPictureCr reconstructed before adaptive in-loop filtering is performed.

[0820] When slice_alf_enabled_flag has a second value (eg, 1), the following process may be performed for all coding tree units having a luma coding tree block position (rx, ry): Here, rx may have a value from 0 to PicWidthInCtbs-1, and ry may have a value from 0 to PicHeightInCtbs-1.

[0821] When alf_ctb_flag[0][rx][ry] has the second value (eg, 1), a coding tree block filtering process for a luma component may be performed.

[0822] Inputs to the coding tree block filtering process for the luminance component: recPictureL, alfPictureL, the luminance component coding tree block position (xCtb, yCtb) can be set to (rx < <CtbLog2SizeY,ry<<CtbLog2SizeY)。

[0823] alfPictureL may be output through a coding tree block filtering process for the luma component.

[0824] When ChromaArrayType does not have the first value (eg, 0) and alf_ctb_flag[1][rx][ry] has the second value (eg, 1), a coding tree block filtering process for the chroma component Cb may be performed.

[0825] The input of the coding tree block filtering process for the chroma component Cb can be set to recPictureCb, alfPictureCb, and the chroma component Cb coding tree block position (xCtbC, yCtbC) can be set to ((rx < <CtbLog2SizeY) / SubWidthC,(ry<<CtbLog2SizeY) / SubHeightC)。

[0826] alfPictureCb may be output through a coding tree block filtering process for the chroma component Cb.

[0827] According to an embodiment, when adaptive in-loop filtering is applied to the Cb sample of the current coding tree block, a second ALF coding tree block identifier may be encoded / decoded / acquired, wherein the second ALF coding tree block identifier indicates an adaptive parameter set including a Cb adaptive in-loop filter set (Cb ALF set) applied to the current coding tree block in one or more adaptive parameter sets including an adaptive in-loop filter set applied to the current picture or current slice. In addition, according to the second ALF coding tree block identifier, an adaptive parameter set including a Cb adaptive in-loop filter set applied to the current coding tree block may be determined. In addition, the Cb adaptive in-loop filter set may be encoded / decoded / acquired in the adaptive parameter set.

[0828] When ChromaArrayType does not have the first value (eg, 0) and alf_ctb_flag[2][rx][ry] has the second value (eg, 1), a coding tree block filtering process for the chroma component Cr may be performed.

[0829] Inputs to the chroma component Cr coding tree block filtering process: recPictureCr, alfPictureCr, the chroma component Cr coding tree block position (xCtbC, yCtbC) can be set to ((rx < <CtbLog2SizeY) / SubWidthC,(ry<<CtbLog2SizeY) / SubHeightC)。

[0830] alfPictureCr may be output through a coding tree block filtering process for the chrominance component Cr.

[0831] According to an embodiment, when adaptive in-loop filtering is applied to the Cr samples of the current coding tree block, a third ALF coding tree block identifier may be encoded / decoded / acquired, wherein the third ALF coding tree block identifier indicates an adaptive parameter set including a Cr adaptive in-loop filter set (Cr ALF set) applied to the current coding tree block in one or more adaptive parameter sets including an adaptive in-loop filter set applied to the current picture or current strip. According to the third ALF coding tree block identifier, an adaptive parameter set including a Cr adaptive in-loop filter set applied to the current coding tree block may be determined. In addition, the Cr adaptive in-loop filter set may be encoded / decoded / acquired in the adaptive parameter set.

[0832] Hereinafter, an embodiment of a coding treeblock filtering process for a luma component will be described.

[0833] For coding tree block filtering, the luminance component picture sample array recPictureL reconstructed before performing adaptive in-loop filtering, the luminance component picture sample array alfPictureL changed after performing adaptive in-loop filtering, and the position (xCtb, yCtb) of the upper left sample point of the current luminance component coding tree block based on the upper left sample point of the current picture can be input.

[0834] Furthermore, a changed luma component picture sample array alfPictureL may be output according to coding treeblock filtering.

[0835] The filter index derivation process for coding treeblock filtering may be performed as follows.

[0836] For the filter index derivation process, the reconstructed luma component picture sample array recPictureL before performing adaptive in-loop filtering and the position (xCtb, yCtb) of the upper left sample of the current luma component coding tree block based on the upper left sample of the current picture may be input.

[0837] According to the filter index derivation process, a classification filter index array filtIdx and a transpose index array transposeIdx may be output.

[0838] At this time, x and y may have values ​​from 0 to CtbSizeY-1.

[0839] To derive alfPictureL[x][y], each reconstructed luma component sample in the current luma component coding tree block in recPictureL[x][y] may be filtered as follows: At this time, x and y may have values ​​of 0 to CtbSizeY-1.

[0840] The luma component filter coefficient array f[j] and luma component clipping value array c[j] for the filter indicated by filtIdx[x][y] may be derived as follows: Here, j may have a value from 0 to N, and for example, N may be a positive integer and may be, for example, 11.

[0841] When AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] has a value less than F, the following operations may be performed. Here, F may be a positive integer and may be 16. In addition, F may represent the maximum number of fixed filters used in the encoder / decoder. That is, F may be the value of the maximum value of alf_luma_fixed_filter_idx+1.

[0842] i=AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize]

[0843] f[j]=AlfFixFiltCoeff[AlfClassToFiltMap[i][filtIdx[x][y]]][j]

[0844] c[j] = 2BitdepthY or c[j] = AlfClipL[i][filtIdx[x][y]][j]

[0845] Here, assigning AlfClipL[i][filtIdx[x][y]][j] to c[j] may indicate the use of a clipping method as a nonlinear adaptive in-loop filtering method in a fixed filter.

[0846] When AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize] is greater than or equal to F, the following operations can be performed.

[0847] i=slice_alf_aps_id_luma[AlfCtbFiltSetIdxY[xCtb>>Log2CtbSize][yCtb>>Log2CtbSize]-F]

[0848] f[j]=AlfCoeffL[i][filtIdx[x][y]][j]

[0849] c[j]=AlfClipL[i][filtIdx[x][y]][j]

[0850] Here, f[j] may represent a luma ALF, and c[j] may represent a luma clipping value.

[0851] The index idx for the luma component filter coefficient and the clipping value may be derived from transposeIdx[x][y] as follows.

[0852] When transposeIndex[x][y] has a second value (eg, 1), the following operations may be performed.

[0853] idx[]={9,4,10,8,1,5,11,7,3,0,2,6}

[0854] When transposeIndex[x][y] has a third value (eg, 2), the following operations may be performed.

[0855] idx[]={0,3,2,1,8,7,6,5,4,9,10,11}

[0856] When transposeIndex[x][y] has a fourth value (eg, 3), the following operations may be performed.

[0857] idx[]={9,8,10,4,3,7,11,5,1,0,2,6}

[0858] If not (when transposeIndex[x][y] has a first value (eg, 0)), the following operations may be performed.

[0859] idx[]={0,1,2,3,4,5,6,7,8,9,10,11}

[0860] The position (h) of each corresponding luminance component sample point (x, y) in recPicture can be derived as follows x+i ,v y+j ). At this time, i and j may have values ​​from -N to N. Here, N may be a positive integer, and may be, for example, 3. In addition, (N*2)+1 may represent the width or height of the luminance component filter.

[0861] h x+i =Clip3(0,pic_width_in_luma_samples-1,xCtb+x+i)

[0862] v y+j =Clip3(0,pic_height_in_luma_samples-1,yCtb+y+j)

[0863] The variable applyVirtualBoundary indicating whether a virtual boundary is applied may be derived as follows.

[0864] applyVirtualBoundary may be set to 0 when at least one of the following conditions is true.

[0865] When the lower boundary of the current coding tree block is the lower boundary of the picture, applyVirtualBoundary may be set to 0.

[0866] When a lower boundary of the current coding tree block is a lower boundary of a partition and loop_filter_across_bricks_enabled_flag has a first value (eg, 0), applyVirtualBoundary may be set to 0.

[0867] Here, loop_filter_across_bricks_enabled_flag may indicate whether filtering may be performed across a block boundary using at least one of the loop filtering methods. That is, this may indicate whether filtering may be performed at a block boundary using at least one of the loop filtering methods.

[0868] When a lower boundary of the current coding tree block is a lower boundary of a slice and loop_filter_across_slices_enabled_flag has a first value (eg, 0), applyVirtualBoundary may be set to 0.

[0869] Here, loop_filter_across_slices_enabled_flag may indicate whether filtering may be performed across a slice boundary using at least one of the loop filtering methods. That is, this may indicate whether filtering may be performed at a slice boundary using at least one of the loop filtering methods.

[0870] When a lower boundary of the current coding tree block is a lower boundary of a tile and loop_filter_across_tiles_enabled_flag has a first value (eg, 0), applyVirtualBoundary may be set to 0.

[0871] Optionally, when the lower boundary of the current coding tree block is the lower boundary of the parallel block and loop_filter_across_tiles_enabled_flag has a first value (e.g., 0), the position of the y coordinate of the lower boundary of the area (parallel block) to which the adaptive in-loop filter is applied can be determined according to the position of the y coordinate of the lower boundary of the current coding tree block.

[0872] Here, loop_filter_across_tiles_enabled_flag may indicate whether filtering may be performed across tile boundaries using at least one of the loop filtering methods. That is, this may indicate whether filtering may be performed at a tile boundary using at least one of the loop filtering methods.

[0873] According to an embodiment, applyVirtualBoundary may be set to 1 even if the lower boundary of the current coding tree block is the lower boundary of the slice.

[0874] Furthermore, even if the lower boundary of the current coding tree block is the lower boundary of the tile, applyVirtualBoundary may be set to 1. Furthermore, even if the lower boundary of the current coding tree block is the lower boundary of the sub-picture, applyVirtualBoundary may be set to 1.

[0875] When a lower boundary of the current coding treeblock is a lower boundary of a subpicture and loop_filter_across_subpictures_enabled_flag has a first value (eg, 0), applyVirtualBoundary may be set to 0.

[0876] Optionally, when the lower boundary of the current coding tree block is the lower boundary of the sub-picture and loop_filter_across_subpictures_enabled_flag has a first value (e.g., 0), the y coordinate position of the lower boundary of the area (sub-picture) to which the adaptive in-loop filter is applied can be determined according to the y coordinate position of the lower boundary of the current coding tree block.

[0877] Here, loop_filter_across_subpictures_enabled_flag may indicate whether filtering may be performed across sub-picture boundaries using at least one of the loop filtering methods. That is, this may indicate whether filtering may be performed at sub-picture boundaries using at least one of the loop filtering methods.

[0878] When a lower boundary of the current coding tree block is a lower virtual boundary of the picture and pps_loop_filter_across_virtual_boundaries_disabled_flag has a second value (eg, 1), applyVirtualBoundary may be set to 0.

[0879] If not (if the above condition is not true), applyVirtualBoundary may be set to 1.

[0880] As shown in Table 1, the reconstructed sample offsets r1, r2, and r3 may be determined according to the vertical luma component sample positions and applyVirtualBoundary.

[0881] [Table 1]

[0882] condition r1 r2 r3 (y==CtbSizeY-5||y==CtbSizeY-4)&&(applyVirtualBoundary==1) 0 0 0 (y==CtbSizeY-6||y==CtbSizeY-3)&&(applyVirtualBoundary==1) 1 1 1 (y==CtbSizeY-7||y==CtbSizeY-2)&&(applyVirtualBoundary==1) 1 2 2 If not (if the above conditions do not apply) 1 2 3

[0883] The sample value curr for the current sample position may be derived as follows.

[0884] curr=recPictureL[h x ,v y ]

[0885] The value sum obtained by performing filtering on the current sample point may be derived as follows.

[0886] Equation 22

[0887]

[0888] alfPictureL[xCtb+x][yCtb+y] can be derived as follows.

[0889] When pcm_loop_filter_disabled_flag has the second value (eg, 1) and pcm_flag[xCtb+x][yCtb+y] has the second value (eg, 1), the following operations may be performed.

[0890] alfPictureL[xCtb+x][yCtb+y]=recPictureL[h x ,v y ]

[0891] If not (when pcm_loop_filter_disabled_flag has a first value (eg, 0) and pcm_flag[xCtb+x][yCtb+y] has a first value (eg, 0)), the following operations may be performed. alfPictureL[xCtb+x][yCtb+y]=Clip3(0, (1< <BitDepthY)-1,sum)

[0892] Hereinafter, an embodiment of a coding treeblock filtering process for a chroma component will be described.

[0893] The recPicture as a reconstructed picture and the alfPicture subjected to adaptive in-loop filtering may be input. In addition, the position (xCtbC, yCtbC) of the upper left sample point of the current chroma component coding tree block based on the upper left sample point of the current picture may be input. In addition, the alfPicture as a picture subjected to adaptive in-loop filtering may be output.

[0894] The width ctbWidthC and height ctbHeightC of the current chroma component coding tree block may be derived as follows.

[0895] ctbWidthC=CtbSizeY / SubWidthC

[0896] ctbHeightC=CtbSizeY / SubHeightC

[0897] To derive alfPicture[x][y], each reconstructed chroma component sample in the current chroma component coding tree block in recPicture[x][y] may be filtered as follows. In this case, x may have a value from 0 to ctbWidthC-1. In addition, y may have a value from 0 to ctbHeightC-1.

[0898] The position (h) of each corresponding chrominance component sample (x, y) in recPicture can be derived as follows x+i ,v y+j ). At this time, i and j may have values ​​from -N to N. Here, N may be a positive integer, and may be, for example, 2. In addition, (N*2)+1 may represent the width or height of the ch...

Claims

1. An image decoding method, comprising: Get the reconstructed chroma block of the current block; determining whether an adaptive loop filter is enabled for a chroma component; and In response to enabling an adaptive loop filter for a chroma component, obtaining a final reconstructed chroma block of the current block by applying the adaptive loop filter to the reconstructed chroma block, Wherein, whether to enable an adaptive loop filter for a chroma component is determined based on a first flag, wherein the first flag indicates whether to enable an adaptive loop filter for a chroma component, Wherein the first flag is signaled via the picture header, wherein the type of adaptive loop filter for the chroma component is determined based on a second flag, wherein the second flag indicates whether a linear adaptive loop filter is applied to the chroma component or a nonlinear adaptive loop filter is applied to the chroma component, The types of the adaptive loop filter include linear adaptive loop filter and nonlinear adaptive loop filter. wherein the current block is obtained by partitioning a coding tree block based on partition information signaled from a bitstream, and The partition information includes a partition flag indicating whether to partition the coding tree block.

2. The image decoding method according to claim 1, further comprising: Obtaining a reconstructed luminance block of the current block; as well as determining whether a cross-component adaptive loop filter is applied to the current block, The step of determining whether a cross-component adaptive loop filter is applied to the current block comprises: obtaining information indicating whether a cross-component adaptive loop filter is applicable to the current block, and Wherein, the information indicating whether the cross-component adaptive loop filter is available is signaled through a sequence parameter set.

3. The image decoding method according to claim 2, further comprising: When a cross-component adaptive loop filter is available for the current block, information indicating whether the cross-component adaptive loop filter is applied to the Cb component of the current block is obtained.

4. The image decoding method according to claim 3, wherein: Information indicating whether a cross-component adaptive loop filter is applied to the Cb component is signaled through a picture header.

5. The image decoding method according to claim 3, further comprising: When a cross-component adaptive loop filter is applied to the Cb component, an adaptive parameter set indicator referenced by the Cb component is acquired.

6. The image decoding method according to claim 2, further comprising: When a cross-component adaptive loop filter is available for the current block, information indicating whether the cross-component adaptive loop filter is applied to the Cr component of the current block is obtained.

7. The image decoding method according to claim 6, wherein: Information indicating whether a cross-component adaptive loop filter is applied to the Cr component is signaled through a picture header.

8. The image decoding method according to claim 6, further comprising: When a cross-component adaptive loop filter is available for the Cr component, an adaptive parameter set indicator referenced by the Cr component is obtained.

9. The image decoding method according to claim 2, wherein: When the information indicating whether the cross-component adaptive loop filter is available is not signaled, it is determined that the cross-component adaptive loop filter is not available for the current block.

10. The image decoding method according to claim 1, wherein: The second flag indicating whether a linear adaptive loop filter is applied to the chroma component or a non-linear adaptive loop filter is applied to the chroma component is a single syntax element.

11. An image encoding method, comprising: Get the reconstructed chroma block of the current block; determining whether an adaptive loop filter is enabled for a chroma component; and In response to enabling an adaptive loop filter for a chroma component, obtaining a final reconstructed chroma block of the current block by applying the adaptive loop filter to the reconstructed chroma block, wherein the first flag is encoded based on whether an adaptive loop filter is enabled for a chroma component, wherein the first flag indicates whether an adaptive loop filter is enabled for a chroma component, Among them, the first flag is encoded into the picture header, wherein the second flag is encoded based on a type of adaptive loop filter for the chroma component, wherein the second flag indicates whether a linear adaptive loop filter is applied to the chroma component or a non-linear adaptive loop filter is applied to the chroma component, The types of the adaptive loop filter include linear adaptive loop filter and nonlinear adaptive loop filter. The current block is obtained by dividing the coding tree block. The partition information includes a partition flag indicating whether to partition the coding tree block, and The partitioning information is encoded into a bit stream.

12. A method for sending a bit stream, comprising: Get the reconstructed chroma block of the current block; determining whether an adaptive loop filter is enabled for a chroma component; In response to enabling an adaptive loop filter for a chroma component, obtaining a final reconstructed chroma block of the current block by applying the adaptive loop filter to the reconstructed chroma block; encoding a first flag and a second flag into the bitstream; and sending the bit stream, The first flag is encoded based on whether an adaptive loop filter is enabled for a chroma component, wherein the first flag indicates whether an adaptive loop filter is enabled for a chroma component, wherein the first flag is encoded into a picture header of the bitstream, wherein the second flag is encoded based on a type of adaptive loop filter for a chroma component, wherein the second flag indicates whether a linear adaptive loop filter is applied to the chroma component or a nonlinear adaptive loop filter is applied to the chroma component, The types of the adaptive loop filter include linear adaptive loop filter and nonlinear adaptive loop filter. The current block is obtained by dividing the coding tree block. The partition information includes a partition flag indicating whether to partition the coding tree block, and Wherein, the partition information is encoded into the bit stream.