Adaptive in-loop filtering method and apparatus

Filtering video coding tree blocks through an adaptive in-loop filter set solves the problem of high transmission and storage costs of high-resolution video data, achieves more efficient video encoding and decoding, and reduces computational complexity and storage requirements.

CN118631991APending Publication Date: 2024-09-10ELECTRONICS & TELECOMM RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410671432.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2019-07-09
Filing Date
2020-06-17
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing video coding technology cannot effectively reduce the cost of transmitting and storing high-resolution, high-quality video data, and existing filtering technologies such as deblocking filtering and sample adaptive offset have limitations in reducing picture distortion.

Method used

The adaptive in-loop filter (ALF) set is used to filter the video coding tree block (CTB) by obtaining and determining the adaptive parameter set, including nonlinear filtering to clip the brightness and chroma components, reducing computational complexity and storage bandwidth.

Benefits of technology

It improves the efficiency of video encoding and decoding, reduces the computational complexity and storage requirements of video encoders and decoders, and optimizes the transmission and storage efficiency of video data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118631991A_ABST
    Figure CN118631991A_ABST
Patent Text Reader

Abstract

The invention provides an adaptive in-loop filtering method and device. Disclosed is a video decoding method, comprising: acquiring an adaptive parameter set comprising an adaptive in-loop filter (ALF) set, the ALF set comprising a plurality of ALFs; determining, from the set of adaptive parameters, an adaptive parameter set applied to a current picture or slice and including an ALF set applied to the current picture or slice; determining, from a set of adaptive parameters applied to the current picture or slice, an adaptive parameter set applied to a current coding tree block (CTB) and including an ALF set applied to the current CTB included in the current picture or slice; and filtering the current CTB based on an ALF set of the determined adaptive parameter set applied to the current CTB, where the adaptive parameter set includes chroma ALF number information, and where the ALF set includes chroma ALFs whose number is indicated by the chroma ALF number information.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of a patent application with an application date of June 17, 2020, application number 202080040649.X, and invention name “Adaptive in-loop filtering method and device”. 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] Nowadays, the demand for high-resolution, high-quality video (such as high-definition (HD) video and ultra-high-definition (UHD) video) is increasing in various applications. Due to the higher resolution and quality of video, the amount of video data increases compared to existing video data. Therefore, when video data is transmitted through a medium (such as a wired / wireless broadband line) or stored in an existing storage medium, the transmission or storage cost increases. In order to solve this problem of high-resolution, high-quality video data, efficient video encoding / decoding technology is needed.

[0004] There are various video compression technologies, such as inter-frame prediction technology for predicting pixel values ​​in a current picture from pixel values ​​in a previous picture or a subsequent picture, intra-frame prediction technology for predicting pixel values ​​in a region of the current picture from another region of the current picture, transform and quantization technology for compressing the energy of a residual signal, and entropy coding technology for assigning shorter codes to frequently occurring pixel values ​​and longer codes to less frequently occurring pixel values. Using these video compression technologies, video data can be efficiently compressed, transmitted, and stored.

[0005] Deblocking filtering aims to reduce blocking artifacts around block boundaries by performing vertical filtering and horizontal filtering on block boundaries. However, a problem with deblocking filtering is that it cannot minimize the distortion between the original picture and the reconstructed picture when filtering is performed on block boundaries.

[0006] Sample Adaptive Offset (SAO) is a method that adds an offset to a specific sample after comparing its pixel value with the pixel values ​​of adjacent samples on a sample-by-sample basis, or adds an offset to samples whose pixel values ​​are within a specific pixel value range, in order to reduce ringing artifacts. SAO has the effect of reducing the distortion between the original and reconstructed images to a certain extent by using rate-distortion optimization. However, when the difference between the original and reconstructed images is large, there are limitations in minimizing the distortion. Summary of the Invention

[0007] Technical issues

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

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

[0010] Technical Solution

[0011] In the present disclosure, a video decoding method is provided, including: acquiring an adaptive parameter set including an adaptive in-loop filter (ALF) set, wherein the adaptive in-loop filter (ALF) set includes multiple ALFs; determining an adaptive parameter set applied to a current picture or slice and including an ALF set applied to the current picture or slice from the adaptive parameter set; determining an adaptive parameter set applied to a current coding tree block (CTB) and including an ALF set applied to the current CTB included in the current picture or slice from the adaptive parameter set applied to the current picture or slice; and filtering the current CTB based on the determined ALF set of the adaptive parameter set applied to the current CTB, wherein the acquired adaptive parameter set includes chroma ALF number information, and wherein the ALF set includes chroma ALFs whose number is indicated by the chroma ALF number information.

[0012] According to an embodiment, the adaptive parameter set may include a luma clipping flag and a chroma clipping flag, wherein the luma clipping flag indicates whether nonlinear adaptive in-loop filtering is performed on the luma component, and the chroma clipping flag indicates whether nonlinear adaptive in-loop filtering is performed on the chroma component.

[0013] According to an embodiment, the adaptive parameter set may include a luma clipping index and a chroma clipping index, wherein when the luma clipping flag indicates that nonlinear adaptive in-loop filtering is performed on a luma component, the luma clipping index indicates a clipping value for the nonlinear adaptive in-loop filtering, and when the chroma clipping flag indicates that nonlinear adaptive in-loop filtering is performed on a chroma component, the chroma clipping index indicates a clipping value for the nonlinear adaptive in-loop filtering.

[0014] According to an embodiment, the luma clipping index and the chroma clipping index may be encoded with a fixed length of 2 bits.

[0015] According to an embodiment, a luma clipping value for nonlinear adaptive in-loop filtering for a luma component may be determined based on a value indicated by the luma clipping index and a bit depth of a current sequence, and a chroma clipping value for nonlinear adaptive in-loop filtering for a chroma component may be determined based on a value indicated by the chroma clipping index and a bit depth of the current sequence, and when the value indicated by the luma clipping index and the value indicated by the chroma clipping index are the same, the luma clipping value and the chroma clipping value may be the same.

[0016] According to an embodiment, the adaptation parameter set may include an adaptation parameter set identifier and adaptation parameter set type information, wherein the adaptation parameter set identifier indicates an identification number assigned to the adaptation parameter set, and the adaptation parameter set type information indicates the type of encoding information included in the adaptation parameter set.

[0017] According to an embodiment, the step of determining an adaptation parameter set applied to a current picture or slice and including an ALF set applied to the current picture or slice may include: obtaining luma ALF set quantity information of the current picture or slice, and obtaining luma ALF set identifiers whose number is indicated by the luma ALF set quantity information.

[0018] According to an embodiment, the step of determining an adaptation parameter set applied to a current picture or slice and including an ALF set applied to the current picture or slice may include: obtaining chroma ALF application information of the current picture or slice, and when the chroma ALF application information is applied to at least one of a Cb component or a Cr component, obtaining a chroma ALF set identifier.

[0019] According to an embodiment, the step of acquiring the adaptation parameter set including the ALF set may include: when the adaptation parameter set type information indicates the ALF type, determining the adaptation parameter set including the ALF set.

[0020] According to an embodiment, the adaptive parameter set may include a luma ALF signaling flag and a chroma ALF signaling flag, wherein the luma ALF signaling flag indicates whether the adaptive parameter set includes ALF for the luma component, and the chroma ALF signaling flag indicates whether the adaptive parameter set includes ALF for the chroma component.

[0021] According to an embodiment, the adaptive parameter set may include luma signaling ALF quantity information indicating the number of luma signaling ALFs, and when the luma signaling ALF quantity information indicates that the number of luma signaling ALFs is greater than 1, the adaptive parameter set may include a luma ALF differential index, wherein the luma ALF differential index indicates an index of a luma signaling ALF referenced by a predetermined number of luma ALFs in the luma ALF set.

[0022] According to an embodiment, the adaptation parameter set may include one or more luma signaling ALFs, and the predetermined number of luma ALFs may be determined from the one or more luma signaling ALFs according to the luma ALF delta index.

[0023] According to an embodiment, the adaptation parameter set may include chroma ALF number information indicating the number of chroma ALFs, and may include chroma ALFs whose number is indicated by the chroma ALF number information.

[0024] According to an embodiment, the step of determining an adaptive parameter set applied to a current CTB and including an ALF set applied to the current CTB may include: obtaining a first ALF coding tree block flag indicating whether adaptive in-loop filtering is applied to luma samples of the current CTB, and determining whether adaptive in-loop filtering is applied to luma samples of the current CTB according to the first ALF coding tree block flag; obtaining a second ALF coding tree block flag indicating whether adaptive in-loop filtering is applied to Cb samples of the current CTB, and determining whether adaptive in-loop filtering is applied to Cb samples of the current CTB according to the second ALF coding tree block flag; and obtaining a third ALF coding tree block flag indicating whether adaptive in-loop filtering is applied to Cr samples of the current CTB, and determining whether adaptive in-loop filtering is applied to Cr samples of the current CTB according to the third ALF coding tree block flag.

[0025] According to an embodiment, the step of determining an adaptive parameter set applied to a current CTB and including an ALF set applied to the current CTB may include: when adaptive in-loop filtering is applied to luma samples of the current CTB, obtaining an adaptive parameter set application flag, wherein the adaptive parameter set application flag indicates whether the ALF set of the adaptive parameter set is applied to the current CTB; when the adaptive parameter set application flag indicates that the ALF set of the adaptive parameter set is applied to the current CTB, determining the luma ALF set applied to the current CTB from one or more adaptive parameter sets including the ALF set applied to the current picture or slice; and when the adaptive parameter set application flag indicates that the ALF set of the adaptive parameter set is not applied to the current CTB, determining a fixed filter applied to the current CTB from a fixed ALF set for luma samples.

[0026] According to an embodiment, the step of determining an adaptive parameter set applied to a current CTB and including an ALF set applied to the current CTB may include: when adaptive in-loop filtering is applied to a Cb sample of the current CTB, obtaining a second ALF coding tree block identifier from one or more adaptive parameter sets including the ALF set applied to the current picture or slice, wherein the second ALF coding tree block identifier indicates an adaptive parameter set including the Cb ALF set applied to the current CTB; determining an adaptive parameter set including the Cb ALF set applied to the current CTB according to the second ALF coding tree block identifier; when adaptive in-loop filtering is applied to a Cr sample of the current CTB, obtaining a third ALF coding tree block identifier from one or more adaptive parameter sets including the ALF set applied to the current picture or slice, wherein the third ALF coding tree block identifier indicates an adaptive parameter set including the Cr ALF set applied to the current CTB; and determining an adaptive parameter set including the Cr ALF set applied to the current CTB according to the third ALF coding tree block identifier.

[0027] According to an embodiment, the step of filtering the current CTB may further include assigning a block class index to a basic filtering unit block of the current CTB, and the block class index may be determined using directionality information and activity information.

[0028] According to an embodiment, at least one of the directionality information or the activity information may be determined based on a gradient value in at least one of a vertical direction, a horizontal direction, a first diagonal direction, or a second diagonal direction.

[0029] In the present disclosure, a video encoding method is provided, including: determining an adaptive parameter set including an adaptive in-loop filter (ALF) set, wherein the adaptive in-loop filter (ALF) set includes multiple ALFs; determining an adaptive parameter set applied to a current picture or slice and including an ALF set applied to the current picture or slice from the adaptive parameter set; determining an adaptive parameter set applied to a current coding tree block (CTB) and including an ALF set applied to the current CTB included in the current picture or slice from the adaptive parameter set applied to the current picture or slice; and filtering the current CTB based on the determined ALF set of the adaptive parameter set applied to the current CTB, wherein the determined adaptive parameter set includes chroma ALF number information, and wherein the ALF set includes chroma ALFs whose number is indicated by the chroma ALF number information.

[0030] According to an embodiment, the adaptive parameter set may include a luma clipping flag and a chroma clipping flag, wherein the luma clipping flag indicates whether nonlinear adaptive in-loop filtering is performed on the luma component, and the chroma clipping flag indicates whether nonlinear adaptive in-loop filtering is performed on the chroma component.

[0031] According to an embodiment, the adaptive parameter set may include a luma clipping index and a chroma clipping index, wherein when the luma clipping flag indicates that nonlinear adaptive in-loop filtering is performed on a luma component, the luma clipping index indicates a clipping value for the nonlinear adaptive in-loop filtering, and when the chroma clipping flag indicates that nonlinear adaptive in-loop filtering is performed on a chroma component, the chroma clipping index indicates a clipping value for the nonlinear adaptive in-loop filtering.

[0032] According to an embodiment, the luma clipping index and the chroma clipping index may be encoded with a fixed length of 2 bits.

[0033] According to an embodiment, a luma clipping value for nonlinear adaptive in-loop filtering for a luma component may be determined based on a value indicated by the luma clipping index and a bit depth of a current sequence, and a chroma clipping value for nonlinear adaptive in-loop filtering for a chroma component may be determined based on a value indicated by the chroma clipping index and a bit depth of the current sequence, and when the value indicated by the luma clipping index and the value indicated by the chroma clipping index are the same, the luma clipping value and the chroma clipping value may be the same.

[0034] According to an embodiment, the adaptation parameter set may include an adaptation parameter set identifier and adaptation parameter set type information, wherein the adaptation parameter set identifier indicates an identification number assigned to the adaptation parameter set, and the adaptation parameter set type information indicates the type of encoding information included in the adaptation parameter set.

[0035] According to an embodiment, determining the adaptation parameter set applied to the current picture or slice may include determining luma ALF set quantity information of the current picture or slice, and determining luma ALF set identifiers whose number is indicated by the luma ALF set quantity information.

[0036] According to an embodiment, the step of determining the adaptation parameter set applied to the current picture or slice may include: determining chroma ALF application information of the current picture or slice, and when the chroma ALF application information is applied to at least one of the Cb component or the Cr component, determining a chroma ALF set identifier.

[0037] According to an embodiment, the step of determining the adaptation parameter set including the ALF set may include: when the adaptation parameter set type information indicates the ALF type, determining the adaptation parameter set including the ALF set.

[0038] According to an embodiment, the adaptive parameter set may include a luma ALF signaling flag and a chroma ALF signaling flag, wherein the luma ALF signaling flag indicates whether the adaptive parameter set includes ALF for the luma component, and the chroma ALF signaling flag indicates whether the adaptive parameter set includes ALF for the chroma component.

[0039] According to an embodiment, the adaptive parameter set may include luma signaling ALF quantity information, wherein the luma signaling ALF quantity information indicates the number of luma signaling ALFs, and when the luma signaling ALF quantity information indicates that the number of luma signaling ALFs is greater than 1, the adaptive parameter set may include a luma ALF differential index, wherein the luma ALF differential index indicates an index of a luma signaling ALF referenced by a predetermined number of luma ALFs in a luma ALF set.

[0040] According to an embodiment, the adaptation parameter set may include one or more luma signaling ALFs, and the predetermined number of luma ALFs may be determined from the one or more luma signaling ALFs according to the luma ALF delta index.

[0041] According to an embodiment, the adaptation parameter set may include chroma ALF number information indicating the number of chroma ALFs, and may include chroma ALFs whose number is indicated by the chroma ALF number information.

[0042] According to an embodiment, the step of determining an adaptive parameter set applied to a current CTB may include: determining a first ALF coding tree block flag indicating whether adaptive in-loop filtering is applied to luma samples of the current CTB, and determining whether adaptive in-loop filtering is applied to luma samples of the current CTB according to the first ALF coding tree block flag; determining a second ALF coding tree block flag indicating whether adaptive in-loop filtering is applied to Cb samples of the current CTB, and determining whether adaptive in-loop filtering is applied to Cb samples of the current CTB according to the second ALF coding tree block flag; and determining a third ALF coding tree block flag indicating whether adaptive in-loop filtering is applied to Cr samples of the current CTB, and determining whether adaptive in-loop filtering is applied to Cr samples of the current CTB according to the third ALF coding tree block flag.

[0043] According to an embodiment, the step of determining an adaptive parameter set applied to a current CTB may include: when adaptive in-loop filtering is applied to luma samples of the current CTB, determining an adaptive parameter set application flag, wherein the adaptive parameter set application flag indicates whether an ALF set of the adaptive parameter set is applied to the current CTB; when the adaptive parameter set application flag indicates that the ALF set of the adaptive parameter set is applied to the current CTB, determining a luma ALF set applied to the current CTB from one or more adaptive parameter sets including an ALF set applied to the current picture or slice; and when the adaptive parameter set application flag indicates that the ALF set of the adaptive parameter set is not applied to the current CTB, determining a fixed filter applied to the current CTB from a fixed ALF set for luma samples.

[0044] According to an embodiment, the step of determining an adaptive parameter set applied to a current CTB may include: when adaptive in-loop filtering is applied to a Cb sample of the current CTB, determining a second ALF coding tree block identifier from one or more adaptive parameter sets including an ALF set applied to the current picture or slice, wherein the second ALF coding tree block identifier indicates an adaptive parameter set including the Cb ALF set applied to the current CTB; determining an adaptive parameter set including the Cb ALF set applied to the current CTB according to the second ALF coding tree block identifier; when adaptive in-loop filtering is applied to a Cr sample of the current CTB, determining a third ALF coding tree block identifier from one or more adaptive parameter sets including the ALF set applied to the current picture or slice, wherein the third ALF coding tree block identifier indicates an adaptive parameter set including the Cr ALF set applied to the current CTB; and determining an adaptive parameter set including the Cr ALF set applied to the current CTB according to the third ALF coding tree block identifier.

[0045] According to an embodiment, the step of filtering the current CTB may further include assigning a block class index to a basic filtering unit block of the current CTB, and the block class index may be determined using directionality information and activity information.

[0046] According to an embodiment, at least one of the directionality information or the activity information may be determined based on a gradient value in at least one of a vertical direction, a horizontal direction, a first diagonal direction, or a second diagonal direction.

[0047] In the present disclosure, a non-transitory computer-readable recording medium is provided, wherein the non-transitory computer-readable recording medium is used to store a bitstream generated by encoding a video according to a video encoding method, the video encoding method including: determining an adaptive parameter set including an adaptive in-loop filter (ALF) set, wherein the adaptive in-loop filter (ALF) set includes a plurality of ALFs; determining an adaptive parameter set applied to a current picture or slice and including an ALF set applied to the current picture or slice from the adaptive parameter set; determining an adaptive parameter set applied to a current coding tree block (CTB) and including an ALF set applied to the current CTB included in the current picture or slice from the adaptive parameter set applied to the current picture or slice; and filtering the current CTB based on the determined ALF set of the adaptive parameter set applied to the current CTB, wherein the determined adaptive parameter set includes chroma ALF number information, and wherein the ALF set includes chroma ALFs whose number is indicated by the chroma ALF number information.

[0048] Beneficial effects

[0049] According to the present invention, a video encoding / decoding method and apparatus using in-loop filtering can be provided.

[0050] Furthermore, according to the present invention, a method and apparatus for in-loop filtering using subsampling-based block classification may be provided to reduce computational complexity and memory access bandwidth of a video encoder / decoder.

[0051] Furthermore, according to the present invention, a method and apparatus for in-loop filtering using multiple filter shapes may be provided to reduce computational complexity, memory capacity requirements, and memory access bandwidth of a video encoder / decoder.

[0052] Furthermore, according to the present invention, a recording medium storing a bit stream generated by a video encoding / decoding method or apparatus can be provided.

[0053] Furthermore, according to the present invention, video encoding and / or decoding efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

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

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

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

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

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

[0061] Figure 8a and Figure 8b are flowcharts respectively illustrating a video decoding method and a video encoding method according to embodiments of the present invention.

[0062] Figure 9 is a diagram illustrating an exemplary method of determining gradient values ​​for a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction.

[0063] Figures 10 to 12 is a diagram illustrating an exemplary subsampling-based method of determining gradient values ​​for a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction.

[0064] Figures 13 to 18 is a diagram illustrating an exemplary subsampling-based method of determining gradient values ​​for a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction.

[0065] Figures 19 to 30 is a diagram illustrating an exemplary method of determining gradient values ​​for a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction at a specific sample point position according to an embodiment of the present invention.

[0066] Figure 31 is a diagram illustrating an exemplary method of determining gradient values ​​for a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction when a temporal layer identifier indicates a top layer.

[0067] Figure 32 is a diagram illustrating various computational techniques that may be used instead of a one-dimensional Laplacian operation according to an embodiment of the present invention.

[0068] Figure 33 is a diagram illustrating a diamond filter according to an embodiment of the present invention.

[0069] Figure 34 is a diagram illustrating a 5×5 tap filter according to an embodiment of the present invention.

[0070] Figure 35aand Figure 35b is a diagram illustrating various filter shapes according to an embodiment of the present invention.

[0071] Figure 36 2 is a diagram illustrating a horizontally symmetric filter and a vertically symmetric filter according to an embodiment of the present invention.

[0072] Figure 37 is a diagram illustrating filters generated by geometrically transforming a square filter, an octagonal filter, a snowflake filter, and a diamond filter according to an embodiment of the present invention.

[0073] Figure 38 is a diagram illustrating a process of transforming a diamond filter including 9×9 coefficients into a square filter including 5×5 coefficients.

[0074] Figures 39 to 55d is a diagram illustrating an exemplary subsampling-based method of determining a sum of gradient values ​​for a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction.

[0075] Figure 56 is a diagram illustrating an embodiment of a sequence parameter set syntax required for adaptive in-loop filtering.

[0076] Figure 57 is a diagram illustrating an embodiment of a sequence parameter set syntax required for adaptive in-loop filtering.

[0077] Figure 58 is a diagram illustrating an embodiment of an adaptation parameter type of an adaptation parameter set.

[0078] Figure 59 is a diagram illustrating an embodiment of a slice header syntax required for adaptive in-loop filtering.

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

[0080] Figure 61 is a diagram illustrating an embodiment of a coding tree block syntax required for adaptive in-loop filtering.

[0081] Figure 62a and Figure 62b is a diagram illustrating an embodiment of fixed filter coefficients.

[0082] Figure 63 is a diagram illustrating an embodiment of a mapping relationship between adaptive in-loop filter coefficient categories and filters.

[0083] Figure 64 is a diagram illustrating an embodiment of a tailoring index for an adaptive in-loop filter data syntax.

[0084] Figure 65 It shows Figure 64 FIG. 5 is a diagram illustrating a detailed description of the pruning index of the adaptive in-loop filter data syntax.

[0085] Figure 66 is a diagram illustrating another embodiment of a tailored index for an adaptive in-loop filter data syntax.

[0086] Figure 67 It shows Figure 66 FIG. 5 is a diagram illustrating a detailed description of the pruning index of the adaptive in-loop filter data syntax.

[0087] Figure 68 is a diagram illustrating another embodiment of a slice header syntax required for adaptive in-loop filtering.

[0088] Figure 69a and Figure 69b is a diagram illustrating another embodiment of an adaptive in-loop filter data syntax required for adaptive in-loop filtering.

[0089] Figure 70a and Figure 70b is a diagram illustrating another embodiment of a coding tree block syntax required for adaptive in-loop filtering.

[0090] Figure 71 It shows Figure 68 A diagram illustrating a detailed description of the slice header syntax.

[0091] Figure 72 and Figure 73 It shows Figure 69a and Figure 69b FIG. 5 is a diagram illustrating a detailed description of the adaptive in-loop filter data syntax.

[0092] Figure 74a and Figure 74b is a diagram illustrating another embodiment of fixed filter coefficients.

[0093] Figure 75 and FIG76 is a diagram showing Figure 69a and Figure 69b FIG. 5 is a diagram illustrating a detailed description of the adaptive in-loop filter data syntax.

[0094] Figure 77 and Figure 78 It shows Figure 61 A diagram illustrating a detailed description of the coding tree block syntax.

[0095] Figures 79 to 91 is a diagram illustrating adaptive in-loop filter processing.

[0096] Figure 92is a flowchart illustrating a video decoding method using an adaptive in-loop filter according to an embodiment.

[0097] Figure 93 is a flowchart illustrating a video encoding method using an adaptive in-loop filter according to an embodiment.

[0098] Best Mode

[0099] In the present disclosure, a video decoding method is provided, including: acquiring an adaptive parameter set including an adaptive in-loop filter (ALF) set, wherein the adaptive in-loop filter (ALF) set includes multiple ALFs; determining an adaptive parameter set applied to a current picture or slice and including an ALF set applied to the current picture or slice from the adaptive parameter set; determining an adaptive parameter set applied to a current coding tree block (CTB) and including an ALF set applied to the current CTB included in the current picture or slice from the adaptive parameter set applied to the current picture or slice; and filtering the current CTB based on the determined ALF set of the adaptive parameter set applied to the current CTB, wherein the acquired adaptive parameter set includes chroma ALF number information, and wherein the ALF set includes chroma ALFs whose number is indicated by the chroma ALF number information. DETAILED DESCRIPTION

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

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

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

[0103] In addition, the components shown in the embodiments of the present invention are shown independently to represent different characteristic functions from each other. Therefore, this does not mean that each component is composed of a separate hardware or software component 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.

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

[0105] Furthermore, some components may not be essential components for performing the basic functions of the present invention, but may be optional components that only enhance its performance. The present invention may be implemented by including only the essential components for achieving the essence of the present invention without including components that enhance its performance. Structures that include only the essential components without including optional components that enhance its performance are also within the scope of the present invention.

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

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

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

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

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

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

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

[0113] Hereinafter, the terms "region" and "segment" are used interchangeably.

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

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

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

[0117] Description of terms

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

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

[0120] Block: An M×N array of samples. Here, M and N may represent positive integers, and a block may represent a two-dimensional array of samples. A block may refer to a unit. The current block may refer to an encoding target block that is targeted during encoding, or a decoding target block that is targeted during decoding. Furthermore, the current block may be at least one of a coding block, a prediction block, a residual block, and a transform block.

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

[0122] Unit: This refers to an encoding and decoding unit. When encoding and decoding an image, a unit may be a region generated by partitioning a single image. Furthermore, when a single image is partitioned into sub-partitioned units during encoding or decoding, a unit may represent a sub-partitioned unit. In other words, an image may be partitioned into multiple units. When encoding and decoding an image, predetermined processing may be performed on each unit. A single unit may be partitioned into sub-units smaller than the unit. Depending on its function, a unit may represent a block, macroblock, coding tree unit, coding tree block, coding unit, coding block, prediction unit, prediction block, residual unit, residual block, transform unit, transform block, and so on. Furthermore, to distinguish a unit from a block, a unit may include a luma component block, chroma component blocks associated with the luma component block, and syntax elements for each color component block. A unit may have various sizes and shapes. Specifically, the shape of a unit may be a two-dimensional geometric figure such as a square, rectangle, trapezoid, triangle, pentagon, and so on. 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.

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

[0124] When the size of a coding block is within a predetermined range, partitioning using only quadtree partitioning is possible. Here, the predetermined range may be defined as at least one of the maximum and minimum sizes of the coding block that can be partitioned using only quadtree partitioning. Information indicating the maximum / minimum sizes of the coding block that allow quadtree partitioning may be signaled via the bitstream and may be signaled in at least one of a sequence, a picture parameter, a tile group, or a slice (segment). Alternatively, the maximum / minimum sizes of the coding block may be fixed sizes predetermined in the encoder / decoder. For example, when the size of the coding block corresponds to 256×256 to 64×64, partitioning using only quadtree partitioning is possible. Alternatively, when the size of the coding block is larger than the size of the largest transform block, partitioning using only quadtree partitioning is possible. Here, the block to be partitioned may be at least one of a coding block and a transform block. In this case, the information indicating the partitioning of the coding block (e.g., split_flag) may be a flag indicating whether quadtree partitioning is performed. When the size of the coding block falls within a predetermined range, partitioning using only binary or ternary tree partitioning is possible. 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.

[0125] Coding tree block: may be used as a term for designating any one of a Y coding tree block, a Cb coding tree block, and a Cr coding tree block.

[0126] Neighboring blocks: These may represent blocks adjacent to the current block. These blocks may be blocks that touch the boundary of the current block or are located within a predetermined distance from the current block. These blocks may be blocks adjacent to vertices of the current block. Here, blocks adjacent to vertices of the current block may be blocks that are vertically adjacent to a neighboring block horizontally adjacent to the current block, or blocks that are horizontally adjacent to a neighboring block vertically adjacent to the current block.

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

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

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

[0130] Parameter set: This corresponds to header information within the bitstream configuration. A parameter set may include at least one of a video parameter set, a sequence parameter set, a picture parameter set, and an adaptation parameter set. Furthermore, a parameter set may include a slice header, a tile group header, and tile header information. The term "tile group" refers to a group of tiles and has the same meaning as a slice.

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

[0132] Symbol: can represent at least one of the syntax elements, coding parameters, and transform coefficient values ​​of the encoding / decoding target unit. In addition, the symbol can represent the entropy encoding target or the entropy decoding result.

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

[0134] Prediction unit: This refers to the basic unit used when performing predictions such as inter-frame prediction, intra-frame prediction, inter-frame compensation, intra-frame compensation, and motion compensation. A single prediction unit can be partitioned into multiple partitions of smaller sizes, or into multiple lower-level prediction units. Multiple partitions can be the basic unit used when performing prediction or compensation. Partitions generated by splitting a prediction unit can also be prediction units.

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

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

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

[0138] 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 can be used to derive the inter prediction indicator, and conversely, the inter prediction indicator can be used to derive the prediction list utilization flag. For example, when the prediction list utilization flag has a first value of zero (0), it indicates that the reference pictures in the reference picture list are not used to generate the prediction block. On the other hand, when the prediction list utilization flag has a second value of one (1), it indicates that the reference picture list is used to generate the prediction block.

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

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

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

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

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

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

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

[0146] 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, reference picture list information, a reference picture, a motion vector candidate, a motion vector candidate index, a merge candidate, and a merge index.

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

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

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

[0150] Transform unit: This refers to a basic unit used when encoding / decoding a residual signal (such as transform, inverse transform, quantization, inverse quantization, and transform coefficient encoding / decoding). A single transform unit can be partitioned into multiple lower-level transform units of smaller size. The transform / inverse transform may include at least one of a first transform / first inverse transform and a second transform / second inverse transform.

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

[0152] Quantization parameter: This may indicate the value used when generating the quantization level using the transform coefficient during quantization. It may also indicate the value used when generating the transform coefficient by scaling the quantization level during inverse quantization. The quantization parameter may be a value mapped to the quantization step size.

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

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

[0155] Transform coefficient: This term may refer to a coefficient value generated after a transform is performed in an encoder. A transform coefficient may refer to a coefficient value generated after at least one of entropy decoding and inverse quantization is performed in a decoder. A transform coefficient also includes a quantization level obtained by quantizing a transform coefficient or a residual signal, or a quantized transform coefficient level.

[0156] Quantization level: This refers to the value generated by quantizing transform coefficients or residual signals in an encoder. Alternatively, the quantization level may refer to a value that is a target for inverse quantization in a decoder. Similarly, the level of quantized transform coefficients, which are the result of transformation and quantization, also falls within the meaning of the quantization level.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0184] To compensate for coding errors, sample adaptive offset can be used to add an appropriate offset value to the sample value. Sample adaptive offset can correct the offset between the deblocked image and the original image on a sample-by-sample basis. A method can be used to apply the offset by considering edge information about each sample, or a method can be used in which the samples of the image are partitioned into a predetermined number of regions, the regions to which the offset is applied are determined, and the offset is applied to the determined regions.

[0185] The adaptive in-loop filter can perform filtering based on the comparison result of the filtered reconstructed image and the original image. The samples included in the image can be partitioned into predetermined groups, the filter to be applied to each group can be determined, and differential filtering can be performed on each group. Information on whether to apply ALF can be signaled by the coding unit (CU), and the form and coefficients of the ALF to be applied to each block can be varied.

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

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

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

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

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

[0191] When the prediction mode used at the time of decoding is the intra mode, the switch may be switched to the intra mode. Alternatively, when the prediction mode used at the time of decoding is the inter mode, the switch may be switched to the inter mode.

[0192] 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 the decoding target by adding the reconstructed residual block to the prediction block. The decoding target block may be referred to as the current block.

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

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

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

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

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

[0198] 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 in-loop filter to the reconstructed block or reconstructed image. The filter unit 260 can output the reconstructed image. The reconstructed block or reconstructed image can be stored in the reference picture buffer 270 and used when performing inter-frame prediction. The reconstructed block processed by the filter unit 260 can be part of a reference image. In other words, 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.

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

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

[0201] Reference Figure 3 , the image 300 is partitioned sequentially according to the largest coding unit (LCU), and the LCU unit is determined as a partition structure. Here, LCU can be used with the same meaning as the coding tree unit (CTU). Unit partitioning may mean partitioning the block associated with the unit. In the block partition information, information on the unit depth may be included. The depth information may indicate the number or degree of partitioning of the unit or both the number and degree of partitioning of the unit. A single unit may be partitioned into multiple lower-level units hierarchically associated with the depth information based on a tree structure. In other words, the unit and the lower-level units generated by partitioning the unit may correspond to a node and a child node of the node, respectively. Each of the partitioned lower-level units may have depth information. The depth information may be information indicating the size of a CU and may be stored in each CU. The unit depth indicates the number and / or degree associated with partitioning the unit. Therefore, the partition information of the lower-level unit may include information about the size of the lower-level unit.

[0202] The partition structure may indicate the distribution of coding units (CUs) within LCU 310. This distribution may be determined based on whether a single CU is partitioned into multiple CUs (including 2, 4, 8, 16, and other positive integers equal to or greater than 2). The horizontal and vertical sizes of the CU generated by partitioning may be half the horizontal and vertical sizes of the CU before partitioning, or may be smaller than the horizontal and vertical sizes before partitioning, depending on the number of partitioning operations. A CU may be recursively partitioned into multiple CUs. Recursive partitioning may reduce at least one of the height and width of the CU after partitioning compared to at least one of the height and width of the CU before partitioning. CU partitioning may be recursively performed until a predefined depth or a predefined size is reached. For example, the depth of an LCU may be 0, and the depth of a smallest coding unit (SCU) may be a predefined maximum depth. As described above, an LCU may be a coding unit with the largest coding unit size, and an SCU may be a coding unit with the smallest coding unit size. Partitioning starts from the LCU 310. When the horizontal size or 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, the size of a non-partitioned CU can be 2N×2N for each depth. In addition, in the case of a partitioned CU, a CU of size 2N×2N can be partitioned into four CUs of size N×N. As the depth increases by 1, the size of N can be halved.

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

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

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

[0206] For example, when one coding unit is partitioned into two sub-coding units, the horizontal size or vertical size (width or height) of each of the two sub-coding units may be half the horizontal size or vertical size of the original coding unit. For example, when a coding unit 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.

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

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

[0209] As described above, to partition a CTU, at least one of a quadtree partition structure, a binary tree partition structure, and a ternary tree partition structure may be applied. The various tree partition structures may be sequentially applied to the CTU according to a predetermined priority order. For example, the quadtree partition structure may be preferentially applied to the CTU. Coding units that can no longer be partitioned using the quadtree partition structure may correspond to leaf nodes of the quadtree. Coding units corresponding to leaf nodes of the quadtree may serve as root nodes of the binary and / or ternary tree partition structures. In other words, coding units corresponding to leaf nodes of the quadtree may be further partitioned according to the binary or ternary tree partition structure, or may not be further partitioned. Therefore, by preventing coding units derived from binary or ternary tree partitioning of coding units corresponding to leaf nodes of the quadtree from undergoing further quadtree partitioning, block partitioning operations and / or operations for signaling partition information may be efficiently performed.

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

[0211] 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 be further partitioned by either binary tree partitioning or ternary tree partitioning. In addition, the coding unit generated by binary tree partitioning or ternary tree partitioning may be further partitioned by binary tree partitioning or ternary tree partitioning, or may not be further partitioned.

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

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

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

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

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

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

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

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

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

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

[0222] Information about the minimum size of the coding unit corresponding to the leaf node of the quadtree (quadtree minimum size) and / or information about the maximum depth from the root node to the leaf node of the multi-type tree (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 about the minimum size of the quadtree and / or information about the maximum depth of the multi-type tree may be signaled or determined for each of the intra-picture slices and the inter-picture slices.

[0223] The difference between the size of the CTU and the maximum size of the transform block may be signaled or determined at a higher level of the coding unit. For example, the higher level may be the sequence level, picture level, slice level, tile group level, tile level, etc. Information regarding the maximum size of the coding units 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 units corresponding to each node of the ternary tree (hereinafter referred to as the maximum size of the ternary tree) may vary depending on the slice type. For example, for intra-picture slices, the maximum size of the ternary tree may be 32×32. For example, for inter-picture slices, the maximum size of the ternary tree may be 128×128. For example, the minimum size of the coding units 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 units 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.

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

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

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

[0227] For example, when the size (horizontal size and vertical size) of the coding unit corresponding to the node of the multi-type tree is larger than the maximum size (horizontal size and vertical size) of the binary tree and / or the maximum size (horizontal size and vertical size) of the ternary tree, the coding unit may not be partitioned 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.

[0228] 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 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 the second value. This is because when the coding unit is partitioned according to the binary tree partition structure and / or the ternary tree partition structure, a coding unit smaller than the minimum size of the binary tree and / or the minimum size of the ternary tree is generated.

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

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

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

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

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

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

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

[0236] Optionally, partition tree information may be signaled only when both vertical binary tree partitioning and vertical ternary tree partitioning, or both horizontal binary tree partitioning and horizontal ternary tree partitioning, are possible for a coding tree corresponding to a node of a multi-type tree. 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.

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

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

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

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

[0241] Intra-frame prediction may be performed based on an intra-frame prediction mode for the current block. The number of intra-frame prediction modes that the current block may have may be a fixed value or may be a value determined differently depending on the properties of the prediction block. For example, the properties of the prediction block may include the size and shape of the prediction block.

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

[0243] 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 for the current block may be performed. When there are samples that cannot be used as reference samples for the current block, a value obtained by copying or interpolating at least one sample value of the samples included in the reconstructed neighboring block, or performing both copying and interpolation, may be used to replace the unavailable sample value of the sample, so that the replaced sample value is used as the reference sample for the current block.

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

[0245] 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 example, the samples of fragments A and F can be filled with the samples of the closest fragments B and E, respectively, instead of retrieving them from the reconstructed neighboring blocks. The index information indicating the reference sample line to be used for intra prediction of the current block can be signaled. For example, in Figure 7 In the example, reference sample line indicators 0, 1, and 2 may be signaled as index information indicating reference sample 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 the prediction block, which will be described later, may not be performed.

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

[0247] In the case of planar mode, when generating a prediction block for the current block, the sample value of the prediction target sample may be generated by using a weighted sum of the upper and left reference samples of the current block, and the upper right and lower left reference samples of the current block, depending on the position of the prediction target sample within the prediction block. Furthermore, in the case of DC mode, when generating a prediction block for the current block, the average of the upper and left reference samples of the current block may be used. Furthermore, in the case of angular mode, the prediction block may be generated by using the upper, left, upper right, and / or lower left reference samples of the current block. To generate the prediction sample values, interpolation of real units may be performed.

[0248] In the case of intra-frame prediction between color components, a prediction block for the current block of the second color component can be generated based on the corresponding reconstructed block of the first color component. For example, the first color component can be a luma component, and the second color component can be a chroma component. For intra-frame prediction between color components, parameters of a linear model between the first and second color components can be derived based on a template. The template can include the upper and / or left neighboring samples of the current block and the upper and / or left neighboring samples of the corresponding reconstructed block of the first color component. For example, the parameters of the linear model can be derived using the sample value of the first color component with the maximum value and the corresponding sample value of the second color component among the samples in the template, as well as the sample value of the first color component with the minimum value and the corresponding sample value of the second color component among the samples in the template. Once the parameters of the linear model are derived, the corresponding reconstructed block can be applied to the linear model to generate a prediction block for the current block. Depending on the video format, subsampling can be performed on the neighboring samples of the reconstructed block of the first color component and the corresponding reconstructed block. For example, when one sample of the second color component corresponds to four samples of the first color component, the four samples of the first color component may be subsampled to calculate one corresponding sample. In this case, parameter derivation of a linear model and intra 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.

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

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

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

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

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

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

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

[0256] Inter-picture prediction or motion compensation may be performed using reference pictures and motion information.

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

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

[0259] For example, when AMVP is used as a prediction mode, at least one of the motion vector of the reconstructed neighboring block, the motion vector of the co-located block, the motion vector of the block adjacent to the co-located block, and the (0,0) motion vector may be determined as a motion vector candidate for the current block, and a motion vector candidate list may be generated by using the motion vector candidates. 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 the block adjacent to the co-located block may be referred to as a temporal motion vector candidate, and the motion vector of the reconstructed neighboring block may be referred to as a spatial motion vector candidate.

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

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

[0262] 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 subblock by deriving an affine controlled motion vector of a decoding target block from the sum of the entropy-decoded MVD and the affine controlled motion vector candidate.

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

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

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

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

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

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

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

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

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

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

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

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

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

[0276] 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 used for the primary transform and / or secondary transform may be determined based on coding parameters of the current block and / or neighboring blocks of the current block. Optionally, transform information indicating the transform scheme may be signaled. DCT-based transforms may include, for example, DCT-2, DCT-8, etc. DST-based transforms may include, for example, DST-7.

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

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

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

[0280] Inverse mapping in the dynamic range can be performed for the luminance component reconstructed by intra prediction or inter prediction before in-loop filtering. The dynamic range can be divided into 16 equal segments, and the mapping function for each segment can be sent by signal. The mapping function can be sent by signal at the slice level or the 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 prediction is converted to the mapping area via mapping using the mapping function, and then used to generate the reconstructed block. However, since intra prediction is performed in the mapping area, the prediction block generated by intra prediction can be used to generate the reconstructed block without mapping / inverse mapping.

[0281] 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 only be applied when mapping for the luma component is available and the partitioning of the luma component and the partitioning of the chroma component follow the same tree structure. Scaling can be performed based on the average value of the sample values ​​of the luma prediction block corresponding to the chroma block. In this case, when the current block uses inter-frame prediction, the luma prediction block can represent the mapped luma prediction block. The value required for scaling can be derived by referencing a lookup table using the index of the segment to which the average value of the sample values ​​of the luma prediction block belongs. Finally, the residual block can be converted to the inverse mapping area by scaling the residual block using the derived value. Then, chroma component block recovery, intra-frame prediction, inter-frame prediction, in-loop filtering, and reference picture storage can be performed in the inverse mapping area.

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

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

[0284] In the following, reference will be made to Figures 7 to 55d An in-loop filtering method using subsampling-based block classification according to an embodiment of the present invention is described.

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

[0286] By applying at least one of deblocking filtering and SAO to a reconstructed picture (i.e., a video frame) generated by summing reconstructed intra / inter prediction blocks and reconstructed residual blocks, blocking and ringing artifacts within the reconstructed picture can be effectively reduced. Deblocking filtering aims to reduce blocking artifacts around block boundaries by performing vertical and horizontal filtering on block boundaries. However, a problem with deblocking filtering is that it fails to minimize the distortion between the original and reconstructed pictures when the block boundaries are filtered. Sample adaptive offset (SAO) is a filtering technique that adds an offset to specific samples after comparing their pixel values ​​with those of neighboring samples on a sample-by-sample basis, or adds an offset to samples within a specific pixel value range, in order to reduce ringing artifacts. SAO has the effect of reducing the distortion between the original and reconstructed pictures to a certain extent by using rate-distortion optimization. However, there are limitations in minimizing distortion when the difference between the original and reconstructed pictures is large.

[0287] Bidirectional filtering refers to a filtering technique in which a filter coefficient is determined 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.

[0288] Adaptive in-loop filtering refers to a filtering technique that minimizes 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.

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

[0290] In the present invention, filtering refers to a process of applying a filter to at least one basic unit selected from the following: 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. Filtering includes at least one of a block classification process, a filtering execution process, and a filter information encoding / decoding process.

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

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

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

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

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

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

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

[0298] For the purposes of the present invention, a decoded picture refers to the output from in-loop filtering or post-processing filtering performed on a reconstructed picture, where the reconstructed picture is composed of reconstructed blocks, each of which is generated by summing a reconstructed residual block and a corresponding intra-prediction block, or summing a reconstructed block and a corresponding inter-prediction block. For the purposes of the present invention, the meaning of a decoded sample, block, CTU, or picture does not differ from the meaning of a reconstructed sample, block, CTU, or picture, respectively.

[0299] Adaptive in-loop filtering is performed on the reconstructed picture to generate a decoded picture. Adaptive in-loop filtering may be performed on the decoded picture that has undergone at least one of deblocking filtering, sample adaptive offset, and bidirectional filtering. Furthermore, adaptive in-loop filtering may be performed on the 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.

[0300] 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, 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, threshold value, and / or a combination thereof.

[0301] The filter coefficient refers to a coefficient constituting a filter. Alternatively, 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.

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

[0303] When the filter has a mask form, the filter may 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 number 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 thereof. Alternatively, the filter shape may be a shape obtained by projecting a three-dimensional figure onto a two-dimensional plane.

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

[0305] In the present invention, among various filters, the description will be focused on the Wiener filter. 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.

[0306] 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, thereby improving coding efficiency. The Wiener filter is designed to minimize distortion between the original picture and the reconstructed / decoded picture.

[0307] At least one of the filtering methods may be performed during the encoding or decoding process. The encoding or decoding process refers to encoding or decoding performed in units of at least one of a slice, tile, tile group, picture, sequence, CTU, block, CU, PU, ​​and TU. At least one of the filtering methods is performed during encoding or decoding performed in units of slices, tiles, tile groups, pictures, etc. For example, a 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" indicates that filtering is performed during the encoding or decoding process. When adaptive in-loop filtering is performed, a decoded picture that has undergone adaptive in-loop filtering can be used as a reference picture when encoding or decoding a subsequent picture. In this case, since intra-frame prediction or motion compensation is performed on the subsequent picture to be encoded / decoded by referencing the reconstructed picture that has undergone adaptive in-loop filtering, the coding efficiency of the subsequent picture as well as the coding efficiency of the current picture that has undergone in-loop filtering can be improved.

[0308] 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, a 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 on a CTU-by-CTU or block-by-block basis, the decoded CTU or block that has undergone adaptive in-loop filtering is used as a reference CTU or block for a subsequent CTU or block to be encoded / decoded. In this case, since intra-frame prediction or motion compensation is performed on the subsequent CTU or block 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 the subsequent CTU or block to be encoded / decoded is improved.

[0309] In addition, after the decoding process is performed, at least one of the filtering methods is performed as post-processing filtering. For example, a 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.

[0310] Adaptive in-loop filtering cannot be performed on a block-by-block basis. That is, block-based filter adaptation cannot be performed. Here, block-based filter adaptation refers to selecting different filters for different blocks. Block-based filter adaptation also refers to block classification.

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

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

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

[0314] 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 indexing and / or filter symmetry type information.

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

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

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

[0318] 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 a block classification index to the block classification unit in the coding unit.

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

[0320] A block sort index is determined based on the directionality information and the activity information.

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

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

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

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

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

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

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

[0328] Reference Figure 8b The encoder classifies samples in a coding unit into a plurality of 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.

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

[0330] A block sort index is determined based on the directionality information and the activity information.

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

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

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

[0334] Optionally, the gradient value is determined according to a temporal layer identifier.

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

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

[0337] 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 indexing and / or filter symmetry type information.

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

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

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

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

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

[0343] More specifically, on the encoder side, adaptive in-loop filtering can be divided into several sub-steps, such as block classification, filter coefficient derivation, filter execution determination, filter shape determination, filter execution, and filter information encoding. Filter coefficient derivation, filter execution determination, and filter shape determination are not within the scope of the present invention. Therefore, those sub-steps will not be described in detail, but only briefly. Therefore, on the encoder side, the in-loop filtering process is divided into block classification, filtering, filter information encoding, etc.

[0344] In the filter coefficient derivation step, Wiener filter coefficients that minimize the distortion between the original image and the filtered image can be derived. In this case, the Wiener filter coefficients are derived in units of block categories. In addition, the Wiener filter coefficients are derived based on at least one of the number of filter taps and the filter shape. When deriving the Wiener filter coefficients, the autocorrelation function for the reconstructed sample points, the cross-correlation function for the original sample points and the reconstructed sample points, the autocorrelation matrix, and the cross-correlation matrix can be derived. The filter coefficients are calculated by deriving the Wiener-Hopf equation based on the autocorrelation matrix and the cross-correlation matrix. In this case, the filter coefficients are obtained by calculating the Wiener-Hopf equation based on Gaussian elimination or Cholesky decomposition.

[0345] In the filtering execution determination step, it is determined whether to perform adaptive in-loop filtering in units of stripes, pictures, tiles, or tile groups, whether to perform adaptive in-loop filtering in units of blocks, or whether to not perform adaptive in-loop filtering based on rate-distortion optimization. Here, the rate includes the filter information to be encoded. Distortion is the difference between the original picture and the reconstructed picture, or the difference between the original picture and the filtered reconstructed picture. Distortion is represented by mean square error (MSE), sum of squared errors (SSE), sum of absolute differences, etc. In the filtering execution determination step, it is determined whether filtering is performed on the chrominance components and whether filtering is performed on the luma components.

[0346] In the filter shape determination step, when applying in-loop adaptive filtering, the type of filter shape to be used, the number of taps to be used, etc. may be determined based on rate-distortion optimization.

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

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

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

[0350] Block classification indices are allocated within the reconstructed picture based on M×N blocks (or in units of block classification units) so that 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 a restored / decoded slice, a restored / decoded tile group, a restored / decoded tile, a restored / decoded CTU, and a restored / decoded block.

[0351] Here, N, M, and L are all positive integers. For example, N and M are both 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 on a sample basis rather than a block basis. On the other hand, when N and M are different positive integers, blocks of size N×M have a non-square shape. Alternatively, N and M may be the same positive integer.

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

[0353] The block classification index has a value ranging from 0 to L-1, or may have a value ranging from 1 to L.

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

[0355] [Equation 1]

[0356] C=5D+A q

[0357] 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 smaller than L.

[0358] For example, in one embodiment where block classification is performed in units of 2×2 blocks, the sum of the one-dimensional Laplacian gradient values ​​in the vertical direction is represented by g v 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°) is represented by g h 、g d1 and g d2 The Laplace operations for the vertical direction, horizontal direction, first diagonal direction, and second diagonal direction are represented by Expressions 2, 3, 4, and 5, respectively. 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 ​​can be used instead of the sum of the gradient values.

[0359] [Equation 2]

[0360]

[0361] [Equation 3]

[0362]

[0363] [Equation 4]

[0364]

[0365] [Equation 5]

[0366]

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

[0368] 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 、Hk,l 、D1 k,l 、D2 k,l The result of the one-dimensional Laplace operation based on the sample points in one direction represents the gradient value based on the sample points in 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 、D 1k,l 、D 2k,l express.

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

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

[0371] 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 Laplacian sum is 6×6 size. In this case, the operation range for calculating the one-dimensional Laplacian sum is larger than the size of the block classification unit.

[0372] 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 Laplacian sum is 4×4 size. In this case, the operation range for calculating the one-dimensional Laplacian sum is larger than the size of the block classification unit.

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

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

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

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

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

[0378] For example, in one embodiment where block classification is performed in units of 4×4 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 Laplacian 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.

[0379] [Equation 6]

[0380]

[0381] [Equation 7]

[0382]

[0383] [Equation 8]

[0384]

[0385] [Equation 9]

[0386]

[0387] In Equations 6 to 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).

[0388] 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,lThe horizontal operation range and vertical operation range of the sum of the two. The result of the one-dimensional Laplace operation based on the sample points in one direction represents the gradient value based on the sample points in 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 .

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

[0390] Alternatively, k and l may have 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.

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

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

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

[0394] For example, the operation 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.

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

[0396] Figure 9 is a diagram illustrating an exemplary method of determining gradient values ​​for a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction, respectively;

[0397] like Figure 9 As shown in FIG, 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. 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed for the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. Figure 9 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the one-dimensional Laplacian 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 Laplacian sum.

[0398] For example, in one embodiment, block classification is performed in units of 4×4 blocks, and 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 values ​​are represented based on subsample 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 ​​can be used instead of the sum of the gradient values.

[0399] [Equation 10]

[0400] g v =∑ A ∑ 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

[0401] [Equation 11]

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

[0403] [Equation 12]

[0404] g d1 =∑ 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

[0405]

[0406] [Equation 13]

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

[0408]

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

[0410] In equations 10 to 13, k and 1 represent the results of the one-dimensional Laplace operation based on the sample points, V k,l 、H k,l 、D1 k,l 、D2 k,1 The horizontal operation range and vertical operation range of the sum of the two. The result of the one-dimensional Laplace operation based on the sample points in one direction represents the gradient value based on the sample points in 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,1 、Hk,l 、D1 k,l 、D2 k,l .

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

[0412] Alternatively, k and l may have 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.

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

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

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

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

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

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

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

[0420] Alternatively, to calculate the gradient value in the vertical direction, a one-dimensional Laplacian operation is performed at each sample point within the operation range on the column where the sum of the one-dimensional Laplacian operations is calculated. In this case, the gradient value in the vertical direction may be calculated at intervals of P columns within the operation range where the sum of the one-dimensional Laplacian operations is calculated. Here, P is a positive integer.

[0421] Further optionally, to calculate the gradient value for the first diagonal direction, within the operation range for calculating the sum of the one-dimensional Laplace operations, a one-dimensional Laplace operation is performed on the sample 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.

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

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

[0424] For example, to calculate the gradient value, a one-dimensional Laplacian operation is performed at each sample point within the operation range for calculating the sum of the one-dimensional Laplacian 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 Laplacian operations. Here, P is a positive integer.

[0425] Alternatively, to calculate the gradient value, a one-dimensional Laplacian operation is performed at each sample point within an operation range on the column where the one-dimensional Laplacian sum is calculated. In this case, the gradient value may be calculated at intervals of P rows within the operation range where the one-dimensional Laplacian sum is calculated. Here, P is a positive integer.

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

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

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

[0429] Figures 10 to 12 is a diagram illustrating a subsampling-based method of determining gradient values ​​for a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction.

[0430] like Figure 10 As shown in , when block classification is performed in units of 2×2 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed at the positions V, H, D1 and D2 for the vertical direction, horizontal direction, first diagonal direction and second diagonal direction, respectively. In addition, the position where the one-dimensional Laplace operation is performed is the subsampling position. Figure 10 In the example, the block classification index C is assigned to the shaded 2×2 blocks. In this case, the operation range for calculating the one-dimensional Laplacian 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 Laplacian sum.

[0431] In the drawings of the present invention, positions not represented by V, H, D1, or D2 are sample positions for which a one-dimensional Laplace operation along a direction is not performed. That is, a one-dimensional Laplace operation along each direction is performed only at the sample positions represented by V, H, D1, or D2. When a one-dimensional Laplace operation is not performed, the result of the one-dimensional Laplace operation on the corresponding sample position is determined to be a specific value, for example, H. Here, H can be at least one of a negative integer, 0, and a positive integer.

[0432] like Figure 11 As shown in , when block classification is performed based on a 4×4 size block, 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed is the subsampling position. Figure 11 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the one-dimensional Laplacian 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 Laplacian sum.

[0433] like Figure 12 As shown in , when block classification is performed based on a 4×4 size block, 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed is the subsampling position. Figure 12In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations is equal to the size of the block classification unit. Here, the thin solid rectangle represents the reconstruction sample position, and the thick solid rectangle represents the operation range for calculating the one-dimensional Laplacian sum.

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

[0435] For example, the absolute position indicates the upper left position within an N×M block.

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

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

[0438] According to an embodiment of the present invention, the gradient value can be calculated by performing a one-dimensional Laplacian operation on R samples within an N×M block 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 can be calculated by calculating the statistical value of the result of the one-dimensional Laplacian operation performed on at least one sample within the operation range for calculating the one-dimensional Laplacian sum. In this case, the statistical value is any one of a sum, a weighted sum, and an average.

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

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

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

[0442] According to an embodiment of the present invention, the gradient value can be calculated by performing a one-dimensional Laplacian operation on R samples within each N×M 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 Laplacian operation performed on at least one sample within the operation range for calculating the one-dimensional Laplacian sum. In this case, the statistical value is any one of a sum, a weighted sum, and an average.

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

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

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

[0446] Figures 13 to 18 is a diagram illustrating an exemplary subsampling-based method of determining gradient values ​​along a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction.

[0447] like Figure 13 As shown in , when block classification is performed in units of 4×4 size blocks, the sum g of the gradient values ​​for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction is calculated by using samples at specific positions within each N×M size block 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 13 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations is equal to 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 sum of the one-dimensional Laplacian operations.

[0448] like Figure 14As shown in , when block classification is performed in units of 4×4 size blocks, the sum of gradient values ​​g for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction may be calculated by using samples at specific positions within each N×M size block 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed is the subsampling position. Figure 14 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations is smaller 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 sum of the one-dimensional Laplacian operations.

[0449] like Figure 15 As shown in , when block classification is performed in units of 4×4 size blocks, the sum of gradient values ​​g for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction may be calculated by using samples at specific positions within each N×M size block 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 15 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations is smaller 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 Laplacian sum.

[0450] like Figure 16 As shown in , when block classification is performed in units of 4×4 size blocks, the sum g of the gradient values ​​for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction is calculated by using samples at specific positions within each N×M size block 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed is the subsampling position. Figure 16 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations is smaller 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 sum of the one-dimensional Laplacian operations.

[0451] like Figure 17 As shown in , when block classification is performed based on a 4×4 size block, the sum g of the gradient values ​​for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction may be calculated by using a sample point at a specific position within each N×M size block 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 17 In the example, the block classification index C is assigned to the shaded 4×4 block. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations can be smaller than the size of the block classification unit. Here, since the operation range for calculating the sum of the one-dimensional Laplacian operations has a size of 1×1, the gradient value can be calculated without calculating the sum of the one-dimensional Laplacian operations. Here, the thin solid rectangle represents the reconstruction sample point position, and the thick solid rectangle represents the operation range for calculating the sum of the one-dimensional Laplacian operations.

[0452] like Figure 18 As shown in , when block classification is performed based on a 2×2 size block, the sum g of the gradient values ​​for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction may be calculated by using a sample point at a specific position within each N×M size block 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 18 In the example, the block classification index C is assigned to the shadowed 2×2 block. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations can be smaller than the size of the block classification unit. Here, since the operation range for calculating the sum of the one-dimensional Laplacian operations has a size of 1×1, the gradient value can be calculated without calculating the sum of the one-dimensional Laplacian operations. Here, the thin solid rectangle represents the reconstruction sample point position, and the thick solid rectangle represents the operation range for calculating the sum of the one-dimensional Laplacian operations.

[0453] Figures 19 to 30 1 is a diagram illustrating a method for determining gradient values ​​at specific sample points for the horizontal direction, the vertical direction, the first diagonal direction, and the second diagonal direction. The specific sample points may be subsampled sample points within a block classification unit, or may be subsampled sample points within a calculation range for calculating the sum of one-dimensional Laplacian operations. Furthermore, the specific sample points are sample points within each block. Optionally, the specific sample points may vary from block to block. Furthermore, the specific sample points may be the same regardless of the direction of the one-dimensional Laplacian operation to be calculated. Furthermore, the specific sample points may be the same for each block regardless of the direction of the one-dimensional Laplacian operation.

[0454] like Figure 19 As shown in FIG, 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 positions. 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 19In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the one-dimensional Laplacian sum can 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 Laplacian sum.

[0455] like Figure 19 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. Figure 19 As shown in , the pattern of sample point positions for performing one-dimensional Laplace calculations can be called a checkerboard pattern or a quincunx pattern. In addition, all sample point positions for performing one-dimensional Laplace calculations are even-numbered sample point positions or odd-numbered sample point positions in the horizontal direction (x-axis direction) and the vertical direction (y-axis direction) within the block classification unit or the calculation range of the one-dimensional Laplace sum within the block unit.

[0456] like Figure 20 As shown in FIG, 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 positions. 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. Figure 20 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the computation range for the one-dimensional Laplacian sum can 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 computation range for computing the one-dimensional Laplacian sum.

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

[0458] like Figure 21As shown in FIG, 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 positions. 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 21 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the one-dimensional Laplacian sum can 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 Laplacian sum.

[0459] like Figure 22 As shown in FIG, 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 positions. 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 22 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the one-dimensional Laplacian sum can 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 Laplacian sum.

[0460] like Figure 23 As shown in FIG, when block classification is performed in units of 4×4 size blocks, the sum of the gradient values ​​g is calculated at one or more specific sample positions. 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 23 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the one-dimensional Laplacian sum can be equal to 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 Laplacian sum.

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

[0462] like Figure 24 As shown in FIG, when block classification is performed in units of 4×4 size blocks, the sum of the gradient values ​​g is calculated at one or more specific sample positions. 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 24 In the example, the block classification index C is assigned to the shaded 4×4 block. In this case, the operation range for calculating the one-dimensional Laplacian sum can be equal to 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 Laplacian sum.

[0463] like Figure 24 As shown in , regardless of the direction of the one-dimensional Laplace operation, the specific sample point position for performing the one-dimensional Laplace operation is the same. In addition, as Figure 24As shown in , the pattern of sample point positions for performing a one-dimensional Laplace operation can be referred to as a checkerboard pattern or a quincunx pattern. Furthermore, the sample point positions for performing a one-dimensional Laplace operation are even-numbered sample point positions or odd-numbered sample point positions in both or one of the horizontal direction (X-axis direction) and the vertical direction (Y-axis direction) within the one-dimensional Laplace operation range in the block classification unit or the block unit.

[0464] like Figure 25 As shown in FIG, when block classification is performed in units of 4×4 size blocks, the sum of the gradient values ​​g is calculated at one or more specific sample positions. 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 25 In the example, the block classification index C is assigned to the shaded 4×4 block. In this case, the operation range for calculating the one-dimensional Laplacian sum can be equal to 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 Laplacian sum.

[0465] like Figure 26 As shown in FIG, when block classification is performed in units of 4×4 size blocks, the sum of the gradient values ​​g is calculated at one or more specific sample positions. 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 for the vertical direction, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, a one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. Figure 26 In the example, the block classification index C is assigned to the shaded 4×4 block. In this case, the operation range for calculating the one-dimensional Laplacian sum can be equal to the size of the block classification unit. Here, the thin solid rectangle represents the reconstruction sample position, and the thick solid rectangle represents the operation range for calculating the one-dimensional Laplacian sum. The specific sample position may refer to each sample position within the block classification unit.

[0466] like Figure 27As shown in FIG, when block classification is performed in units of 4×4 size blocks, the sum of the gradient values ​​g is calculated at one or more specific sample positions. 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 27 In the example, the block classification index C is assigned to the shaded 4×4 block. In this case, the operation range for calculating the one-dimensional Laplacian sum can be equal to 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 Laplacian sum.

[0467] like Figure 28 As shown in FIG, when block classification is performed in units of 4×4 size blocks, the sum of the gradient values ​​g is calculated at one or more specific sample positions. 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 for the vertical direction, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, a one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. Figure 28 In the example, the block classification index C is assigned to the shaded 4×4 block. In this case, the operation range for calculating the one-dimensional Laplacian sum can be larger than the size of the block classification unit. Here, the thin solid rectangle represents the reconstruction sample position, and the thick solid rectangle represents the operation range for calculating the one-dimensional Laplacian sum. The specific sample position may refer to each sample position within the block classification unit.

[0468] like Figure 29 As shown in FIG, when block classification is performed in units of 4×4 size blocks, the sum of the gradient values ​​g is calculated at one or more specific sample positions. v 、g h 、g d1 、g d2At least one of. Here, V, H, D1 and D2 represent the results of the sample-based one-dimensional Laplace operation for the vertical direction, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, a one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. Figure 29 In the example, the block classification index C is assigned to the shaded 4×4 block. In this case, the operation range for calculating the one-dimensional Laplacian sum can be larger than the size of the block classification unit. Here, the thin solid rectangle represents the reconstruction sample position, and the thick solid rectangle represents the operation range for calculating the one-dimensional Laplacian sum. The specific sample position may refer to each sample position within the block classification unit.

[0469] like Figure 30 As shown in FIG, when block classification is performed in units of 4×4 size blocks, the sum of the gradient values ​​g is calculated at one or more specific sample positions. 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, horizontal direction, first diagonal direction and second diagonal direction, respectively. That is, the one-dimensional Laplace operation is performed along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction at positions V, H, D1 and D2, respectively. In addition, the position where the one-dimensional Laplace operation is performed may be a subsampling position. Figure 30 In the example, the block classification index C is assigned to the shaded 4×4 blocks. In this case, the operation range for calculating the one-dimensional Laplacian sum can 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 Laplacian sum.

[0470] According to an embodiment of the present invention, at least one of the methods of calculating the gradient value may be performed based on the temporal layer identifier.

[0471] For example, when block classification is performed in units of 2×2 sized blocks, Equations 2 to 5 may be collectively expressed by one equation as shown in Equation 14.

[0472] [Equation 14]

[0473]

[0474] In Equation 14, dir represents the horizontal direction, the vertical direction, the first diagonal direction, and the second diagonal direction, and g dirrepresents the sum of each of the sums of the gradient values ​​along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction. In addition, i and j represent the horizontal position and the vertical position in the 2×2 size block, respectively, and G dir Indicates each of the results of the one-way Laplacian operation along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction.

[0475] In this case, when the temporal layer identifier of the current picture (or reconstructed picture) indicates the top layer, Equation 14 may be expressed as Equation 15 when block classification is performed in units of 2×2 sized blocks within the current picture (or reconstructed picture).

[0476] [Equation 15]

[0477] 8 2x2,dir =|G dir (i0,j0)|

[0478] In Equation 15, G dir (i0, j0) represents the gradient values ​​along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction at the upper left position in the 2×2 size block.

[0479] Figure 31 is a diagram illustrating an exemplary method of determining gradient values ​​along a horizontal direction, a vertical direction, a first diagonal direction, and a second diagonal direction for a case where a temporal layer identifier indicates a top layer;

[0480] Reference Figure 31 The sum of the gradient values ​​g along the vertical, horizontal, first diagonal, and second diagonal directions can be simplified by calculating the gradient only at the upper left sample point position (i.e., the shadow sample point position) in each 2×2 size block. v 、g h 、g d1 、g d2 operation.

[0481] According to an embodiment of the present invention, a statistical value of a gradient value is calculated by calculating a weighted sum while applying a weight to the result of a one-dimensional Laplacian operation performed on one or more sample points within a range for calculating the one-dimensional Laplacian sum. In this case, at least one of a weighted average, a median, a minimum, a maximum, and a mode may be used instead of the weighted sum.

[0482] The operation of applying the weights or calculating the weighted sums may be determined based on various conditions or coding parameters associated with the current block and associated with neighboring blocks.

[0483] For example, the weighted sum may be calculated in units of at least one of a sample, a sample group, a line, and a block. In this case, the weighted sum may be calculated by changing the weight in units of at least one of a sample, a sample group, a line, and a block.

[0484] For example, the weight may vary according to at least one of the size of the current block, the shape of the current block, and the position of the sample point.

[0485] For example, the weighted sum may be calculated according to conditions preset in the encoder and the decoder.

[0486] For example, the weight is adaptively determined based on at least one of encoding parameters such as a block size, a block shape, and an intra prediction mode of at least one of a current block and a neighboring block.

[0487] For example, whether to calculate the weighted sum is adaptively determined based on at least one of encoding parameters such as a block size, a block shape, and an intra prediction mode of at least one of a current block and a neighboring block.

[0488] For example, when the operation range of calculating the sum of one-dimensional Laplacian operations is larger than the size of the block classification unit, at least one of the weights applied to the samples within the block classification unit may be larger than at least one of the weights applied to the samples outside the block classification unit.

[0489] Optionally, for example, when the operation range of calculating the sum of the one-dimensional Laplacian operations is equal to the size of the block classification unit, the weights applied to the samples in the block classification unit are all the same.

[0490] The weights and / or information on whether weighted sum calculations are performed may be entropy encoded in the encoder and then signaled to the decoder.

[0491] According to an embodiment of the present invention, when calculating the sum of the gradient values ​​g along the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction, v 、g h 、g d1 and g d2 When one or more unavailable samples exist around the current sample, padding is performed on the unavailable samples, and the gradient value can be calculated using the padded samples. Padding refers to a method of copying the sample values ​​of adjacent available samples to the unavailable samples. Alternatively, a sample value or statistical value obtained based on the values ​​of available samples adjacent to the unavailable sample can be used. Padding can be repeated for P columns and R rows. Here, M and L are both positive integers.

[0492] Here, the unavailable sample refers to a sample located outside the boundary of a CTU, CTB, slice, tile, tile group, or picture. Alternatively, the unavailable sample may refer to a sample belonging to at least one of a CTU, CTB, slice, tile, tile group, and picture that is different from at least one of the CTU, CTB, slice, tile, tile group, and picture to which the current sample belongs.

[0493] 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 respectively. v 、g h 、g d1 and g d2 At least one of the .

[0494] For example, when calculating the sum of the gradient values ​​g along the vertical direction, horizontal direction, first diagonal direction and second diagonal direction, v 、g h 、g d1 and g d2 When at least one of , the padded samples may not be used.

[0495] Optionally, for example, when calculating the sum of the gradient values ​​g along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction, v 、g h 、g d1 and g d2 , when there are one or more unavailable sample points around the current sample point, the unavailable sample points may not be used for calculation of the gradient value.

[0496] Further optionally, for example, when calculating the sum of the gradient values ​​g along the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction, v 、g h 、g d1 and g d2 When at least one of the following is used, when the samples surrounding the current sample are located outside the CTU or CTB, the neighboring samples adjacent to the current sample may not be used.

[0497] According to an embodiment of the present invention, when calculating at least one of the one-dimensional Laplacian operation values, when one or more unavailable samples exist around a current sample, padding is performed such that sample values ​​of available samples adjacent to the unavailable sample are copied to the unavailable sample, and the one-dimensional Laplacian operation is performed using the padded samples.

[0498] According to an embodiment of the present invention, in the one-dimensional Laplace calculation, the predetermined sample points may not be used.

[0499] For example, in a one-dimensional Laplace calculation, the padded samples may not be used.

[0500] Alternatively, for example, when calculating at least one of the one-dimensional Laplacian operation values, when one or more unavailable samples exist around the current sample, the one or more unavailable samples may not be used for the one-dimensional Laplacian operation.

[0501] Further optionally, for example, when calculating at least one of the one-dimensional Laplacian operation values, when samples around the current sample are located outside the CTU or CTB, neighboring samples may not be used for the one-dimensional Laplacian operation.

[0502] According to an embodiment of the present invention, when calculating the sum of the gradient values ​​g along the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction, v 、g h 、g d1 and g d2 , or when calculating at least one of the one-dimensional Laplacian operation values, at least one of the samples that have undergone at least one of deblocking filtering, adaptive sample offset (SAO), and adaptive in-loop filtering may be used.

[0503] According to an embodiment of the present invention, when calculating the sum of the gradient values ​​g along the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction, v 、g h 、g d1 and g d2 , or when calculating at least one of the one-dimensional Laplacian operation values, when samples around the current block are located outside the CTU or CTB, at least one of deblocking filtering, adaptive sample offset (SAO), and adaptive in-loop filtering may be applied to the corresponding samples.

[0504] Optionally, when calculating the sum of the gradient values ​​g along the vertical direction, the horizontal direction, the first diagonal direction and the second diagonal direction, v 、g h 、g d1 and g d2 , or when calculating at least one of the one-dimensional Laplacian operation values, when samples around the current block are located outside the CTU or CTB, at least one of deblocking filtering, adaptive sample offset (SAO), and adaptive in-loop filtering may not be applied to the corresponding samples.

[0505] According to an embodiment of the present invention, when there are unavailable samples arranged within the operation range for the one-dimensional Laplacian sum and arranged outside the CTU or CTB, the unavailable samples can be used to calculate the one-dimensional Laplacian operation without applying at least one of deblocking filtering, adaptive sample offset, and adaptive in-loop filtering.

[0506] According to an embodiment of the present invention, when unavailable samples exist within a block classification unit or outside a CTU or CTB, a one-dimensional Laplacian operation may be performed without applying at least one of deblocking filtering, adaptive sample offset, and adaptive in-loop filtering to the unavailable samples.

[0507] On the other hand, when calculating gradient values ​​based on subsampling, the one-dimensional Laplacian operation is not performed on all samples within the operation range for calculating the one-dimensional Laplacian operation, but rather on subsamples within the operation range. Therefore, the number of operations required for block classification (such as multiplication, shift, addition, and absolute value operations) can be reduced. Furthermore, the memory access bandwidth required for using reconstructed samples can be reduced. Consequently, the complexity of the encoder and decoder is also reduced. Specifically, performing a one-dimensional Laplacian operation on subsampled samples is advantageous in terms of the hardware complexity of the encoder and decoder because it reduces the time required for block classification.

[0508] Furthermore, when the operation range for calculating the sum of one-dimensional Laplacian operations is equal to or smaller than the size of the block classification unit, the number of additions required for block classification can be reduced. Furthermore, the memory access bandwidth required for using reconstructed samples can be reduced. Consequently, the complexity of the encoder and decoder can be reduced.

[0509] On the other hand, in the subsampling-based gradient value calculation method, the sum g of the gradient values ​​for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction is calculated by changing at least one of the sample point position, the number of samples, and the direction of the sample point position of the sample points on which the one-dimensional Laplace operation is performed according to the gradient values ​​for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction. v 、g h 、g d1 and g d2 At least one of .

[0510] Furthermore, in the subsampling-based gradient value calculation method, the sum g of the gradient values ​​for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction is calculated by using at least one common factor among the sample position, the number of samples, and the direction of the sample position for performing a one-dimensional Laplace operation. v 、g h 、g d1 and g d2regardless of the gradient values ​​for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction.

[0511] Furthermore, by using any combination of the above one or more gradient value calculations, a one-dimensional Laplace operation for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction may be performed, and 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. v 、g h 、g d1 and g d2 At least one of .

[0512] 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 、g d1 and g d2 Compares two or more values ​​in a to each other.

[0513] 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 16 and minimum value

[0514] [Equation 16]

[0515]

[0516] 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 17.

[0517] [Equation 17]

[0518]

[0519] Optionally, for example, the sum of the gradient values ​​in the first diagonal direction g d1 and 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 18 and minimum value

[0520] [Equation 18]

[0521]

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

[0523] [Equation 19]

[0524]

[0525] According to one embodiment of the present invention, in order to calculate the directivity value D, the maximum value and the minimum value are compared with two thresholds t1 and t2 as described below.

[0526] The directivity value D is a positive integer or 0. 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.

[0527] Furthermore, the directivity value D can be determined based on the characteristics of the region. For example, directivity values ​​D 0 to 4 are represented as follows: 0 represents a textured region; 1 represents strong horizontal / vertical directivity; 2 represents weak horizontal / vertical directivity; 3 represents strong first / second diagonal directivity; and 4 represents weak first / second diagonal directivity. The directivity value D is determined through the steps described below.

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

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

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

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

[0532] Wherein, threshold values ​​t1 and t2 are positive integers, and t1 and t2 may have the same value or different values. For example, t1 and t2 are 2 and 9, respectively. In another example, t1 and t2 are both 1. In another example, t1 and t2 are 1 and 9, respectively.

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

[0534] [Equation 20]

[0535]

[0536] For example, k and l have 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.

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

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

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

[0540] Further alternatively, for 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 sum of the one-dimensional Laplacian operations is 2×2 size. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations may be equal to the size of the block classification unit.

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

[0542] Furthermore, when block classification is performed based on a 4×4 sized block, the activity value A may be expressed as in Equation 21.

[0543] [Equation 21]

[0544]

[0545] For example, k and l have 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.

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

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

[0548] Further alternatively, 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 operations is 4×4 size. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations may be equal to the size of the block classification unit.

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

[0550] Furthermore, when block classification is performed based on a 2×2 sized block, the activity value A may be expressed as in Equation 22. Here, at least one of one-dimensional Laplacian operation values ​​for the first and second diagonal directions may be additionally used in calculation of the activity value A.

[0551] [Equation 22]

[0552]

[0553] For example, k and l have 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.

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

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

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

[0557] Further alternatively, for 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 sum of the one-dimensional Laplacian operations is 2×2 size. In this case, the operation range for calculating the sum of the one-dimensional Laplacian operations may be equal to the size of the block classification unit.

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

[0559] Furthermore, when block classification is performed based on a 4×4 sized block, the activity value A may be expressed as in Equation 23. Here, at least one of one-dimensional Laplacian operation values ​​for the first and second diagonal directions may be additionally used in calculation of the activity value A.

[0560] [Equation 23]

[0561]

[0562] For example, k and l may be 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 operations may be the same.

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

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

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

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

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

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

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

[0570] [Equation 24]

[0571]

[0572] In Equation 24, 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.

[0573] 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 operation is performed on the activity value A, 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.

[0574] 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 the luma component at the 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 fixed-type filters may be used.

[0575] Figure 32 is a diagram illustrating various calculation methods that may be used instead of a one-dimensional Laplace operation according to an embodiment of the present invention.

[0576] According to an embodiment of the present invention, the Figure 32 At least one of the calculation methods shown in is used to replace the one-dimensional Laplace operation. Figure 32 , the calculation methods include two-dimensional (two-dimensional) Laplace, two-dimensional Sobel, two-dimensional edge extraction and Gaussian two-dimensional Laplace (LoG) operation. Here, the LoG operation means applying a combination of a Gaussian filter and a Laplace filter to reconstruct the sample points. In addition to these operation methods, at least one of a one-dimensional edge extraction filter and a two-dimensional edge extraction filter can be used instead of the one-dimensional Laplace operation. Alternatively, a Gaussian difference (DoG) operation can be used. Here, the DoG operation means applying a combination of Gaussian filters with different internal parameters to reconstruct the sample points.

[0577] In addition, in order to calculate the directivity value D or the activity value A, a LoG operation of size N×M can be used. Here, M and L are both positive integers. For example, using Figure 32 The 5×5 two-dimensional LoG shown in (i) and Figure 32 At least one of the 9×9 two-dimensional LoG operations shown in (j) of FIG. Alternatively, for example, a one-dimensional LoG operation may be used instead of the two-dimensional LoG operation.

[0578] According to an embodiment of the present invention, each 2×2 block of the luminance block can be classified based on directionality and two-dimensional Laplacian activity. For example, horizontal / vertical gradient characteristics can be obtained by using a Sobel filter. The directionality value D can be obtained using Equations 25 to 26.

[0579] The representative vector may be calculated such that a gradient vector within a predetermined window size (eg, a 6×6 sized block) satisfies the condition of Equation 25. A direction and deformation may be identified according to θ.

[0580] [Equation 25]

[0581]

[0582] The similarity between the representative vector within the window and each gradient vector may be calculated using the inner product as shown in Equation 26.

[0583] [Equation 26]

[0584]

[0585] The directivity value D may be determined using the S value calculated by Equation 26.

[0586] Step 1: When S>th1 is satisfied, set the D value to 0.

[0587] Step 2: When θ ∈ (D0 or D1) and S < th2 are satisfied, set the D value to 2, but when not satisfied, set the D value to 1.

[0588] Step 3: When θ ∈ (V or H) and S < th2 are satisfied, set the D value to 4, but when not satisfied, set the D value to 3.

[0589] Here, the number of block classification indices can be 25 in total.

[0590] According to an embodiment of the present invention, the block classification of the reconstructed sample point s′(i, j) can be represented by Equation 27.

[0591] [Equation 27]

[0592] where k = 0,..., K - 1

[0593] In Equation 27, I represents the set of sample positions of all reconstructed sample points s′(i, j). D is a classifier that assigns the class index k ∈ {0,..., K - 1} to the sample position (i, j). In addition, is the set of all samples to which the class index is assigned by the classifier D. The class supports four different classifiers, and each classifier can provide K = 25 or 27 classes. The classifier used in the decoder can be specified by the syntax element classification_idx signaled at the slice level. The class with the class index k ∈ {0,..., K - 1} is given Perform the following steps.

[0594] When classification_idx = 0, use the block classifier D based on directionality and activity G . This classifier can provide K = 25 classes.

[0595] When classification_idx = 1, the sample-based feature classifier D S is used as the classifier. D S (i, j) uses the quantized sample values of each sample in the sample point s′(i, j) according to Equation 28.

[0596] [Equation 28]

[0597]

[0598] where B is the sample bit depth, the class number K is set to 27 (K = 27), and the operator specifies the operation of rounding to the nearest integer.

[0599] When classification_idx=2, the feature classifier based on sorting and sample points Can be used as a classifier. From the equation 30 r8(i, j) is a classifier that compares s′(i, j) with the eight adjacent points and arranges the points in order of value.

[0600] [Equation 29]

[0601]

[0602] The classifier r8(i, j) has a value ranging from 0 to 8. When the sample s'(i, j) is the largest sample in a 3x3 block centered at (i, j), the value of s'(i, j) is zero. When s'(i, j) is the second largest sample, the value of r8(i, j) is 1.

[0603] [Equation 30]

[0604]

[0605] In Equation 30, T1 and T2 are predefined thresholds. That is, the dynamic range of the samples is divided into three segments, and the rank of the local samples in each segment is used as an additional criterion. The rank-based, sample-based feature classifier provides 27 categories (K=27).

[0606] When classification_idx=3, a classifier based on sorting and region changes is used. It can be expressed by Equation 31.

[0607] [Equation 31]

[0608]

[0609] In Equation 31, T3 or T4 is a predefined threshold. The local variable v(i, j) at each sample position (I, j) can be expressed as Equation 32.

[0610] [Equation 32]

[0611] v(i,j)=4*s′(i,j)-(s′(i-1,j)+s′(i+1,j)+s′(i,j+1)+s′(i,j-1))

[0612] It is the same as Next, within each class, the ranking of nearby local points can be used as an additional criterion to provide 27 classes.

[0613] According to an embodiment of the present invention, at the slice level, a filter set including a maximum of 16 filters using three pixel classification methods (such as intensity classifier, histogram classifier, and directional activity classifier) ​​is used for the current slice. At the CTU level, based on a control flag in a slice header signaled, three modes including a new filter mode, a spatial filter mode, and a slice filter mode are used in units of CTUs.

[0614] Here, the intensity classifier is similar to the band offset of SAO. The sample intensity range is divided into 32 groups, and the group index for each sample is determined based on the intensity of the sample to be processed.

[0615] In addition, in the case of a similarity classifier, neighboring samples in a 5×5 diamond filter are compared with a filter target sample, which is a sample to be filtered. The group index of the sample to be filtered can be initialized to 0. When the difference between the neighboring sample and the filter target sample is greater than a predefined threshold, the group index is increased by one. In addition, when the difference between the neighboring sample and the filter target sample is twice the predefined threshold, an additional 1 is added as the group index. In this case, the similarity classifier has 25 groups.

[0616] Furthermore, in the case of the Rot BA classifier, the computational scope for calculating the sum of one-dimensional Laplacian operations for a 2×2 block is reduced from a 6×6 size to a 4×4 size. This classifier has a maximum number of 25 groups. In some classifiers, a maximum number of 25 or 32 groups can exist. However, the number of filters in a stripe filter set is limited to a maximum of 16 groups. In other words, the encoder merges consecutive groups so that the number of merged groups remains at 16 or less.

[0617] According to an embodiment of the present invention, when determining a block classification index, the block classification index is determined based on at least one of the coding parameters of the current block and the neighboring blocks. The block classification index varies according to at least one of the coding parameters. In this case, the coding parameters include a prediction mode (i.e., whether the prediction is intra prediction or inter prediction), an inter prediction mode, an intra prediction mode, an intra prediction indicator, a motion vector, a reference picture index, a quantization parameter, a block size of the current block, a block shape of the current block, a size of a block classification unit, and at least one of a coding block flag / pattern.

[0618] In one example, the block class is determined based on a quantization parameter. For example, when the quantization parameter is less than a threshold value T, J block class indices are used. When the quantization parameter is greater than a threshold value R, H block class indices are used. For other cases, G block class indices are used. Here, T, R, J, H, and G are positive integers or zero. Furthermore, J is greater than or equal to H. The larger the quantization parameter value, the fewer block class indices are used.

[0619] In another example, the number of block categories is determined based on the size of the current block. For example, when the size of the current block is less than a threshold value T, J block category indices are used. When the size of the current block is greater than a threshold value R, H block category indices are used. For other cases, G block category indices are used. Here, T, R, J, H, and G are positive integers or zero. Furthermore, J is greater than or equal to H. The larger the block size, the fewer block category indices are used.

[0620] In another example, the number of block categories is determined based on the size of the block classification unit. For example, when the size of the block classification unit is less than a threshold value T, J block classification indices are used. When the size of the block classification unit is greater than a threshold value R, H block classification indices are used. For other cases, G block classification indices are used. Here, T, R, J, H, and G are positive integers or zero. Furthermore, J is greater than or equal to H. Here, the larger the size of the block classification unit, the fewer block classification indices are used.

[0621] According to an embodiment of the present invention, at least one of the sum of the gradient values ​​of the current block and the sum of the gradient values ​​of the current block classification unit is determined as the sum of the gradient values ​​of the current block and the sum of the gradient values ​​of the current block classification unit. Here, the co-located sample point in the previous picture is the spatial position or the adjacent position of the reconstructed sample point in the current picture in the previous picture.

[0622] For example, when the sum of the vertical and horizontal gradient values ​​g for the current block unit is v and g h When the difference between at least one of the sum of the gradient values ​​in the vertical direction and the horizontal direction of the neighboring block classification units around the current block classification unit is equal to or less than the threshold E, the sum of the gradient values ​​in the first diagonal direction and the second diagonal direction of the neighboring block classification units of the current block classification unit is g d1 and g d2 At least one of the threshold values ​​? is determined as at least one of the gradient values ​​of the current block unit. Here, the threshold E is a positive integer or zero.

[0623] In another example, when the sum of the vertical and horizontal gradient values ​​g for the current block unit is v and gh When the difference between the sum of the gradient values ​​of the neighboring block classification units around the current block classification unit and the sum of the gradient values ​​of the neighboring block classification units in the vertical and horizontal directions is equal to or less than a threshold E, at least one of the sums of the gradient values ​​of the neighboring block classification units of the current block classification unit is determined as at least one of the sums of the gradient values ​​of the current block unit. Here, the threshold E is a positive integer or zero.

[0624] In another example, when the difference between at least one statistical value of reconstructed samples within the current block unit and at least one statistical value of reconstructed samples within neighboring block classification units surrounding the current block unit is equal to or less than a threshold E, at least one of the sums of the gradient values ​​of the neighboring block classification units surrounding the current block unit is determined as at least one of the sums of the gradient values ​​of the current block unit. Here, the threshold E is a positive integer or zero. The threshold E is derived from spatially and / or temporally neighboring blocks of the current block. Furthermore, the threshold E is a predefined value in the encoder and decoder.

[0625] According to an embodiment of the present invention, at least one of the block classification index of the co-located sample point in the previous picture, the block classification index of the neighboring block of the current block, and the block classification index of the neighboring block classification unit of the current block classification unit is determined as at least one of the block classification index of the current block and the block classification index of the current block classification unit.

[0626] For example, when the sum of the vertical and horizontal gradient values ​​g for the previous block unit is v and g h When the difference between at least one of the vertical and horizontal gradient values ​​of the neighboring block classification units around the current block classification unit and at least one of the sums of the gradient values ​​of the neighboring block classification units around the current block classification unit is equal to or less than a threshold E, the block classification index of the neighboring block classification unit around the current block classification unit is determined as the block classification index of the current block unit. Here, the threshold E is a positive integer or zero.

[0627] Optionally, for example, when the sum of the vertical and horizontal gradient values ​​g for the current block unit is v and g h When the difference between the sum of the gradient values ​​in the vertical and horizontal directions of the neighboring block classification units around the current block classification unit is equal to or less than a threshold E, the block classification index of the neighboring block classification unit around the current block classification unit is determined as the block classification index of the current block unit. Here, the threshold E is a positive integer or zero.

[0628] Further optionally, for example, when a difference between at least one statistical value of reconstructed samples within the current block unit and at least one statistical value of reconstructed samples within neighboring block classification units surrounding the current block unit is equal to or less than a threshold E, the block classification index of the neighboring block classification unit surrounding the current block unit is determined as the block classification index of the current block unit. Here, the threshold E is a positive integer or zero.

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

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

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

[0632] For example, one of 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.

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

[0634] Further alternatively, 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.

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

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

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

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

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

[0640] Here, the L filters are called a filter set.

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

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

[0643] Optionally, for example, the L filters are identical in at least one of filter coefficients, 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.

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

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

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

[0647] Figure 33 is a diagram illustrating a diamond filter according to an embodiment of the present invention.

[0648] Reference Figure 33In order to signal from the encoder to the decoder which of the three diamond filters with 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.

[0649] 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 performs filtering using a filter index without entropy encoding / decoding the filter index. Here, a diamond filter with 7×7 filter taps is used for the luma component, and a diamond filter with 5×5 filter taps is used for the chroma component.

[0650] According to an embodiment of the present invention, at least one of 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.

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

[0652] Alternatively, for example, Figure 33 The 5×5 diamond shaped filter shown in FIG is used to filter the reconstructed / decoded chroma samples.

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

[0654] in addition, Figure 33 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, Figure 33 The filter shown in is a point-symmetric filter.

[0655] On the other hand, Figure 33 In the case of the 9×9 diamond filter shown in (a), a total of 21 filter coefficients are entropy encoded / decoded. Figure 33 In the case of the 7×7 diamond filter shown in (b), a total of 13 filter coefficients are entropy encoded / decoded, and Figure 33 In the case of the 5×5 diamond filter shown in (c), a total of 7 filter coefficients are entropy encoded / decoded. That is, a maximum of 21 filter coefficients need to be entropy encoded / decoded.

[0656] In addition, for Figure 33 The 9×9 diamond filter shown in (a) requires a total of 21 multiplications per sample point. Figure 33 The 7×7 diamond filter shown in (b) requires a total of 13 multiplications per sample point. Figure 33 The 5×5 diamond filter shown in (c) requires a total of 7 multiplications per sample point. That is, a maximum of 21 multiplications are used per sample point to perform filtering.

[0657] In addition, if Figure 33 As shown in (a), since the 9×9 diamond filter has a size of 9×9, the hardware implementation requires four line buffers that are half the length of the vertical filter. That is, a maximum of four line buffers are required.

[0658] 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, snowflake, number sign, clover, cross, triangle, pentagon, hexagon, octagon, decagon, and dodecagon. For example, Figure 34 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.

[0659] The number of filter taps is not limited to 5×5. A filter having an H×V filter tap 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 can 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 by the encoder to the decoder. 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.

[0660] On the other hand, in order to send a signal from the encoder to the decoder Figure 34 In order to know which filter among the filters shown in [ ] is to 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.

[0661] on the other hand, Figure 34At least one of the square shape filter, octagonal shape filter, snowflake filter, and diamond filter shown in is used to filter at least one reconstructed / decoded sample of at least one of the luma component and the chroma component.

[0662] on the other hand, Figure 34 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, Figure 34 The filter shown in is a point-symmetric filter.

[0663] According to an embodiment of the present invention, when filtering a reconstructed picture in units of samples, in terms of rate-distortion optimization in an encoder, it is possible to determine which filter shape to use for each picture, slice, tile, or tile group. Furthermore, filtering is performed using the determined filter shape. Because the degree of improvement in coding efficiency and the amount of filter information (the number of filter coefficients) vary depending on the following: Figure 34 The filter shape shown in , therefore, it is necessary to determine the optimal filter shape for each picture, slice, tile, or tile group. That is, the filter shape is determined differently depending on the video resolution, video characteristics, bit rate, etc. Figure 34 The best filter shape among the filter shapes shown in .

[0664] According to an embodiment of the present invention, Figure 33 Compared to the filter shown in Figure 34 The filter shown in has the advantage of reducing the computational complexity of the encoder / decoder.

[0665] For example, in Figure 34 In the case of a 5×5 square filter shown in (a), a total of 13 filter coefficients are entropy encoded / decoded. Figure 34 In the case of the 5×5 octagonal filter shown in (b), a total of 11 filter coefficients are entropy encoded / decoded. Figure 34 In the case of the 5×5 snowflake filter shown in (c), a total of 9 filter coefficients are entropy encoded / decoded, and Figure 34 In the case of the 5×5 diamond filter shown in (c), a total of 7 filter coefficients are entropy encoded / decoded. That is, the number of filter coefficients to be entropy encoded / decoded varies depending on the filter shape. Here, Figure 34 The maximum number of filter coefficients of the filter in the example (ie, 13) is less than Figure 33 The maximum number of filter coefficients for the filter in the example is (i.e., 21). Therefore, when using Figure 34When the filter in the example of is used, the number of filter coefficients to be entropy encoded / decoded is reduced. Therefore, in this case, the computational complexity of the encoder / decoder can be reduced.

[0666] Optionally, for example, Figure 34 The 5×5 square filter shown in (a) requires a total of 13 multiplications per sample point. Figure 34 The 5×5 octagonal filter shown in (b) requires a total of 11 multiplications per sample point. Figure 34 The 5×5 snowflake filter shown in (c) requires a total of 9 multiplications per sample point, and for Figure 34 The 5×5 diamond filter shown in (d) requires a total of 7 multiplications per sample point. Figure 34 The maximum number of filter coefficients of the filter in the example (ie, 13) is less than Figure 33 The maximum number of filter coefficients for the filter in the example is (i.e., 21). Therefore, when using Figure 34 When the filter in the example is used, the number of multiplications per sample point is reduced. Therefore, in this case, the computational complexity of the encoder / decoder can be reduced.

[0667] Further optionally, for example, due to Figure 34 All filters in the example have a size of 5×5, so the hardware implementation requires two line buffers that are half the vertical filter length. Figure 34 The number of line buffers required for the filter in the example of φ (i.e., two line buffers) is less than that required for the filter using Figure 33 The number of line buffers required for the filter in the example is (i.e., four line buffers). Therefore, when using Figure 34 When the filter in the example of FIG. 5 is used, the line buffer size, the hardware complexity of the encoder / decoder, the memory capacity requirement, and the memory access bandwidth can be reduced.

[0668] According to an embodiment of the present invention, as the filter used in the above-mentioned 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 numeric symbol shape, a clover shape, a cross shape, a triangle, a pentagon, a hexagon, an octagon, a decagon, and a dodecagon. For example, Figure 35a and / or Figure 35b 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.

[0669] For example, using Figure 35a and / or Figure 35bA 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.

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

[0671] Further optionally, for example, using Figure 35a and / or Figure 35b 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.

[0672] Figure 35a and Figure 35b The filter shown in FIG is designed to have a vertical filter length of 3 or 5. However, the filter shape used in the embodiments 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.

[0673] On the other hand, using Figure 35a and / or Figure 35b , the information about which filter to use is signaled from the encoder to the decoder. 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.

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

[0675] on the other hand, Figure 35a and / or Figure 35b 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, Figure 35a and / or Figure 35b The filter shape shown in is a point-symmetric filter.

[0676] According to an embodiment of the present invention, Figure 33 Compared to the filter in the example, using Figure 35aand / or Figure 35b The filter in the example has the advantage of reducing the computational complexity of the encoder / decoder.

[0677] For example, when using Figure 35a and / or Figure 35b When using at least one of the filters shown in Figure 33 Compared to the case of one filter in the 9×9 diamond filter shown in FIG, the number of filter coefficients to be entropy encoded / decoded is reduced. Therefore, the computational complexity of the encoder / decoder can be reduced.

[0678] Alternatively, for example, when using Figure 35a and / or Figure 35b When using at least one of the filters shown in Figure 33 Compared to the case of one filter in the 9×9 diamond filter shown in FIG, the number of multiplications required for filtering the filter coefficients is reduced. Therefore, the computational complexity of the encoder / decoder can be reduced.

[0679] Further optionally, for example, when using Figure 35a and / or Figure 35b When using at least one of the filters shown in Figure 33 Compared to the case of one filter in the 9×9 diamond filter shown in FIG, the number of lines of the line buffer required for filtering the filter coefficients is reduced. In addition, the hardware complexity, memory requirements and memory access bandwidth can also be reduced.

[0680] According to an embodiment of the present invention, the Figure 36 At least one filter selected from the horizontal / vertical symmetric filters shown in is used to replace the point symmetric filter for filtering. Optionally, in addition to the point symmetric filter and the horizontal / vertical symmetric filter, a diagonal symmetric filter can also be used. Figure 36 The numbers in each filter shape represent the filter coefficient indices.

[0681] For example, using Figure 36 A filter set is constructed by using at least one filter having a vertical filter length of 5 among the filters shown in , and filtering is then performed using the filter set.

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

[0683] Further optionally, for example, using Figure 36A 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.

[0684] Figure 36 The filter shape shown in FIG 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.

[0685] To prepare include Figure 36 The filter index is entropy encoded / decoded in units of a picture, a tile, a tile group, a slice, or a sequence. A filter set of H filters among the filters shown in is used, and information about which filter in the filter set to use is signaled from the encoder to the decoder. 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.

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

[0687] According to an embodiment of the present invention, Figure 33 Compared to the filter shown in Figure 36 The filter shown in has the advantage of reducing the computational complexity of the encoder / decoder.

[0688] For example, when using Figure 36 When using at least one of the filters shown in Figure 33 Compared to the case of one filter in the 9×9 diamond filter shown in FIG, the number of filter coefficients to be entropy encoded / decoded is reduced. Therefore, the computational complexity of the encoder / decoder can be reduced.

[0689] Alternatively, for example, when using Figure 36 When using at least one of the filters shown in Figure 33 Compared to the case of one filter in the 9×9 diamond filter shown in FIG, the number of multiplications required for filtering the filter coefficients is reduced. Therefore, the computational complexity of the encoder / decoder can be reduced.

[0690] Further optionally, for example, when using Figure 36 When using at least one of the filters shown in Figure 33Compared to the case of one filter in the 9×9 diamond filter shown in FIG, the number of lines of the line buffer required for filtering the filter coefficients is reduced. In addition, the hardware complexity, memory requirements and memory access bandwidth can also be reduced.

[0691] According to an embodiment of the present invention, before filtering is performed in units of block classification units, the sum of the gradient values ​​calculated in units of block classification units (i.e., the sum of the gradient values ​​for the vertical direction, the horizontal direction, the first diagonal direction, and the second diagonal direction g) is calculated. v 、g h 、g d1 and g d2 ), and performing a geometric transformation on the filter coefficients f(k, l). In this case, the geometric transformation on the filter coefficients is achieved by performing a 90° rotation, a 180° rotation, a 270° rotation, a second diagonal flip, a first diagonal flip, a vertical flip, a horizontal flip, a vertical and horizontal flip, or an enlargement / reduction on the filter, thereby generating a geometrically transformed filter.

[0692] On the other hand, after the filter coefficients are geometrically transformed, the reconstructed / decoded samples are filtered using the geometrically transformed filter coefficients. In this case, a geometric transform is performed on at least one of the reconstructed / decoded samples that are filtering targets, and then the reconstructed / decoded samples are filtered using the filter coefficients.

[0693] According to an embodiment of the present invention, geometric transformation is performed according to Equations 33 to 35.

[0694] [Equation 33]

[0695] f D (k, l) = f(l, k)

[0696] [Equation 34]

[0697] f V (k, l) = f(k, Kl-1)

[0698] [Equation 35]

[0699] f R (k, l) = f(Kl-1, k)

[0700] Here, Equation 33 shows an example of an equation for flipping the second diagonal, Equation 34 shows an example of vertical flipping, and Equation 35 shows an example of a 90° rotation. In Equations 34 and 35, K is the number of filter taps (filter length) in the horizontal and vertical directions, and "0 ≤ K and 1 ≤ K-1" represents the coordinates of the filter coefficients. For example, (0, 0) represents the upper left corner, and (K-1, K-1) represents the lower right corner.

[0701] Table 1 shows an example of a geometric transformation applied to the filter coefficients f(k, l) according to the sum of gradient values.

[0702] [Table 1]

[0703] Sum of gradient values Types of geometric transformations <![CDATA[g d2 <g d1 And g h <g v ]]> Transformation not performed <![CDATA[g d2 <g d1 And g v <g h ]]> Second diagonal flip <![CDATA[g d1 <g d2 And g h <g v ]]> Flip vertically <![CDATA[g d1 <g d2 And g v <g h ]]> 90° rotation

[0704] Figure 37 is a diagram illustrating filters obtained by performing geometric transformation on a square filter, an octagonal filter, a snowflake filter, and a diamond filter according to an embodiment of the present invention.

[0705] Reference Figure 37 , at least one geometric transformation of a second diagonal flip, a vertical flip, and a 90° rotation is performed on the filter coefficients of the square filter, the octagonal filter, the snowflake filter, and the diamond filter. Then, the filter coefficients obtained by the geometric transformation can be used for filtering. On the other hand, after the geometric transformation is performed on the filter coefficients, the reconstructed / decoded samples are filtered using the geometrically transformed filter coefficients. In this case, a geometric transformation is performed on at least one of the reconstructed / decoded samples as filtering targets, and then the reconstructed / decoded samples are filtered using the filter coefficients.

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

[0707] [Equation 36]

[0708]

[0709] In Equation 36, 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.

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

[0711] 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 filtering the reconstructed / decoded samples are clipped by 10 bits, the final decoded sample values ​​may have values ​​within a range from 0 to 1023.

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

[0713] 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 has been 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.

[0714] Alternatively, for example, in the case of a chroma 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.

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

[0716] Here, the unavailable samples refer to samples arranged outside the boundary of a CTU, CTB, slice, tile, tile group, or picture. Alternatively, the unavailable samples refer to samples belonging to at least one of a CTU, CTB, slice, tile, tile group, and picture that is different from at least one of the CTU, CTB, slice, tile, tile group, and picture to which the current sample belongs.

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

[0718] According to an embodiment, padding of samples located outside the screen boundary may be performed only in the horizontal direction, and 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 may not be performed in the horizontal direction.

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

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

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

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

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

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

[0725] 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 they are.

[0726] According to an embodiment of the present invention, when filtering is performed, at least one sample 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.

[0727] According to an embodiment of the present invention, when filtering is performed, at least one sample located within a block is filtered, and filtering is not performed on samples located outside a boundary of at least one of a CU, a PU, a TU, a block, a block classification unit, a CTU, and a CTB. In this case, the boundary includes at least one of a vertical boundary, a horizontal boundary, and a diagonal boundary. In addition, the samples 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.

[0728] According to an embodiment of the present invention, when filtering is performed, whether to perform filtering is determined based on at least one encoding parameter among encoding parameters of the current block and the neighboring blocks. In this case, the encoding parameters include a prediction mode (i.e., whether the prediction is intra prediction or inter prediction), an inter prediction mode, an intra prediction mode, an intra prediction indicator, a motion vector, a reference picture index, a quantization parameter, a block size of the current block, a block shape of the current block, a size of a block classification unit, and at least one of a coding block flag / pattern.

[0729] Furthermore, when filtering is performed, at least one of a filter coefficient, a number of filter taps (filter length), a filter shape, and a filter type is determined based on at least one coding parameter among coding parameters of the current block and the neighboring blocks. At least one of the filter coefficient, the number of filter taps (filter length), the filter shape, and the filter type varies according to at least one coding parameter among the coding parameters.

[0730] For example, the number of filters used for filtering is determined based on the quantization parameter. For example, when the quantization parameter is less than a threshold value T, J filters are used. When the quantization parameter is greater than a threshold value R, H filters are used. In other cases, G filters are used. Here, T, R, J, H, and G are positive integers or zero. Furthermore, J is greater than or equal to H. Here, the larger the quantization parameter value, the fewer filters are used.

[0731] Optionally, for example, the number of filters used for filtering is determined based on the size of the current block. For example, when the size of the current block is less than a threshold T, J filters are used. When the size of the current block is greater than a threshold R, H filters are used. In other cases, G filters are used. Here, T, R, J, H, and G are positive integers or zero. Furthermore, J is greater than or equal to H. The larger the block size, the fewer block filters are used.

[0732] Alternatively, for example, the number of filters used for filtering is determined based on the size of the block classification unit. For example, when the size of the block classification unit is less than a threshold value T, J filters are used. When the size of the block classification unit is greater than a threshold value R, H filters are used. In other cases, G filters are used. Here, T, R, J, H, and G are positive integers or zero. Furthermore, J is greater than or equal to H. The larger the size of the block classification unit, the fewer block filters are used.

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

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

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

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

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

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

[0739] On the other hand, the filter information includes a maximum of L luma filters. Here, L is a positive integer, specifically 25. Furthermore, 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 the maximum of L chroma filters can be included in a parameter set or header. The parameter set can be an adaptive parameter set. The information about the maximum of L chroma filters can represent information about the number of chroma ALFs and can be encoded / decoded as, for example, the syntax element alf_chroma_num_alt_filters_minus1.

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

[0741] For example, the information about the symmetric shape of the filter is information about a filter shape such as a point-symmetric shape, a horizontally symmetric shape, a vertically symmetric shape, or a combination thereof.

[0742] Alternatively, only some of the filter coefficients may be signaled. For example, when the filter has a symmetric form, information about the filter's symmetric shape and only one of the symmetric filter coefficient sets may be signaled. Alternatively, for example, the filter coefficients at the center of the filter may not be signaled, as they may be implicitly derived.

[0743] 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 a fixed M bits, and then dequantized. In addition, at least one filter coefficient among the filter coefficients is quantized to different bits and dequantized. Conversely, at least one filter coefficient among 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 in 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 among the filter coefficients within the filter can have a value from -2 M to -2 M -1, and the second filter coefficient can have a value from 0 to 2 M Here, the first filter coefficient refers to the filter coefficients excluding the center filter coefficient among the filter coefficients, and the second filter coefficient refers to the center filter coefficient among the filter coefficients.

[0744] At least one of an encoder and a decoder may clip filter coefficient values ​​in the filter information, and at least one of a minimum value and a 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. At least one of the minimum value and the maximum value may have different values ​​for each filter coefficient. Alternatively, at least one of the minimum value and the maximum value may have the same value for each filter coefficient. 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.

[0745] According to an embodiment of the present invention, at least one piece of filter information in the filter information is entropy encoded / decoded based on at least one encoding parameter of the current block and the neighboring blocks. In this case, the encoding parameter includes at least one of a prediction mode (i.e., whether the prediction is intra prediction or inter prediction), an inter prediction mode, an intra prediction mode, an intra prediction indicator, a motion vector, a reference picture index, a quantization parameter, a block size of the current block, a block shape of the current block, a size of a block classification unit, and a coding block flag / mode.

[0746] For example, the number of filters in the plurality of filter information is determined based on the quantization parameter of the picture, slice, tile group, tile, CTU, CTB, or block. Specifically, when the quantization parameter is less than a threshold value T, J filters are entropy encoded / decoded. When the quantization parameter is greater than a threshold value R, H filters are entropy encoded / decoded. In other cases, G filters are entropy encoded / decoded. Here, T, R, J, H, and G are positive integers or zero. In addition, J is greater than or equal to H. Here, the larger the quantization parameter value, the fewer the number of filters for entropy encoding.

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

[0748] For example, whether filtering is performed on at least one of the luma component and the chroma 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 on whether filtering is performed for each CTB can be entropy encoded / decoded. Alternatively, for example, information on 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 on a CU having the maximum depth or a CU having the minimum size can be entropy encoded / decoded.

[0749] 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 can 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.

[0750] Alternatively, for example, the information on whether filtering is performed 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 a 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.

[0751] Further optionally, for example, the information about whether filtering is performed on at least one of the luma component and the chroma component may be a CTU-based flag (i.e., a flag in units of CTUs). 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.

[0752] Further optionally, for example, whether filtering is performed on at least one of the luma component and the chroma component is determined according to a picture, a slice, a tile group, or a tile type. The information on whether filtering is performed on at least one of the luma component and the chroma component may be a flag in units of a picture, a slice, a tile group, or a tile.

[0753] According to an embodiment of the present invention, filter coefficients belonging to different block categories can be merged to reduce the amount of filter coefficients to be entropy encoded / decoded. In this case, filter merging information on whether the filter coefficients are merged is entropy encoded / decoded.

[0754] In addition, in order to reduce the amount of filter coefficients to be entropy encoded / decoded, the filter coefficients of the reference picture can be used as the filter coefficients of the current picture. In this case, the method of using the filter coefficients of the reference picture is called temporal filter coefficient prediction. For example, temporal filter coefficient prediction is used for inter-frame prediction pictures (B / P pictures, slices, tile groups or tiles). On the other hand, the filter coefficients of the reference picture are stored in a memory. In addition, when the filter coefficients of the reference picture are used for the current picture, the entropy encoding / decoding of the filter coefficients of the current image is omitted. In this case, the previous reference picture filter index indicating which reference picture filter coefficient is used is entropy encoded / decoded.

[0755] For example, when using temporal filter coefficient prediction, a filter set candidate list is constructed. Before a new sequence is decoded, the filter set candidate list is empty. However, each time a picture is decoded, the filter coefficients of the picture are added to the filter set candidate list. When the number of filters in the filter set candidate list reaches the maximum number of filters G, the new filter can replace the oldest filter in the decoding order. In other words, the filter set candidate list is updated in a first-in-first-out (FIFO) manner. Here, G is a positive integer, and specifically 6. To prevent filters in the filter set candidate list from being repeated, the filter coefficients of pictures that are not predicted using temporal filter coefficients can be added to the filter set candidate list.

[0756] Optionally, for example, when using temporal filter coefficient prediction, filter set candidate lists for multiple temporal layer indices are constructed to support temporal scalability. That is, a filter set candidate list is constructed for each temporal layer. For example, the filter set candidate list for each temporal layer includes filter sets for decoded pictures whose temporal layer indices are equal to or less than the temporal layer indices of previously decoded pictures. In addition, after decoding each picture, the filter coefficients for the current picture are added to the filter set candidate lists for temporal layer indices equal to or greater than the temporal layer indices of the current picture.

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

[0758] Although temporal filter coefficient prediction cannot be used in intra-frame predicti...

Claims

1. A method for decoding a video, the method comprising: decoding an adaptive parameter set; Determine one or more adaptive parameter sets applied to a current picture or slice from the adaptive parameter sets; Determining an adaptive parameter set including one or more adaptive in-loop filters ALF for a current coding tree block CTB included in the current picture or slice; as well as filtering a luminance component of the current CTB based on an ALF in an adaptive parameter set for the current CTB, The adaptive parameter set includes signaling ALF quantity information indicating the number of signaling ALFs for the luminance component, The adaptive parameter set further includes chroma ALF quantity information indicating the number of alternative filters for chroma components of the current CTB, and Wherein, when the chroma ALF quantity information indicates that a plurality of alternative filters for chroma components are included, chroma ALF index information specifying one of the alternative filters for the chroma components of the current CTB is also decoded from the bitstream.

2. The method according to claim 1, wherein: The adaptive parameter set includes a luma clipping flag and a chroma clipping flag, wherein the luma clipping flag indicates whether to perform nonlinear adaptive in-loop filtering on a luma component, and the chroma clipping flag indicates whether to perform nonlinear adaptive in-loop filtering on a chroma component.

3. The method according to claim 2, wherein: The adaptive parameter set includes: a luma clipping index, wherein when the luma clipping flag indicates that nonlinear adaptive in-loop filtering is performed on a luma component, the luma clipping index indicates a clipping value for the nonlinear adaptive in-loop filtering, and A chroma clipping index, wherein when the chroma clipping flag indicates that nonlinear adaptive in-loop filtering is performed on the chroma component, the chroma clipping index indicates a clipping value for the nonlinear adaptive in-loop filtering.

4. The method according to claim 3, wherein: The luma clipping index and the chroma clipping index are decoded based on a 2-bit fixed length without decoding any information about the order of the Exponential Golomb for the luma clipping index and the chroma clipping index.

5. The method according to claim 3, in, A luma clipping value for nonlinear adaptive in-loop filtering of a luma component is determined to be one of the clipping value candidates specified by the luma clipping index, wherein a chroma clipping value for nonlinear adaptive in-loop filtering of a chroma component is determined to be one of the clipping value candidates specified by the chroma clipping index, wherein the composition of the cropping value candidates varies according to the bit depth of the current sequence, and Therein, the clipping value candidates are shared for both luma and chroma components.

6. The method according to claim 1, wherein: The chroma ALF index information is decoded separately for the Cb component and the Cr component.

7. A method for encoding a video, the method comprising: encoding an adaptive parameter set; encoding information about one or more adaptation parameter sets in the adaptation parameter set that are applied to a current picture or slice; encoding information about an adaptive parameter set including one or more adaptive in-loop filters ALF for a current coding tree block CTB included in the current picture or slice; as well as filtering the current CTB based on the ALF included in the adaptive parameter set applied to the current CTB, The adaptive parameter set includes signaling ALF quantity information indicating the number of signaling ALFs for the luminance component, The adaptive parameter set further includes chroma ALF quantity information indicating the number of alternative filters for the chroma components of the current CTB, and Wherein, when the chroma ALF quantity information indicates that multiple alternative filters for chroma components are included, chroma ALF index information specifying one of the alternative filters for the chroma components of the current CTB is also encoded in the bitstream.

8. An apparatus for transmitting compressed video data, comprising: a processor configured to obtain the compressed video data, and a sending unit, configured to send the compressed video data, The compressed video data is obtained by: encoding an adaptation parameter set; encoding information about one or more adaptation parameter sets in the adaptation parameter set that are applied to a current picture or slice; encoding information about an adaptive parameter set including one or more adaptive in-loop filters ALF for a current coding tree block CTB included in the current picture or slice; and filtering the current CTB based on the ALF included in the adaptive parameter set applied to the current CTB, The adaptive parameter set includes signaling ALF quantity information indicating the number of signaling ALFs for the luminance component, The adaptive parameter set further includes chroma ALF quantity information indicating the number of alternative filters for the chroma components of the current CTB, and Wherein, when the chroma ALF quantity information indicates that a plurality of alternative filters for chroma components are included, chroma ALF index information specifying one of the alternative filters for the chroma components of the current CTB is also encoded in the bitstream.